diff --git a/india_compliance/gst_india/report/itc_04_beta/itc_04_beta.py b/india_compliance/gst_india/report/itc_04_beta/itc_04_beta.py index 54233f12c6..0ec81cd5d9 100644 --- a/india_compliance/gst_india/report/itc_04_beta/itc_04_beta.py +++ b/india_compliance/gst_india/report/itc_04_beta/itc_04_beta.py @@ -1,5 +1,7 @@ # Copyright (c) 2024, Resilient Tech and contributors # For license information, please see license.txt +from frappe import _ + from india_compliance.gst_india.utils.itc_04.itc_04_data import ITC04Query @@ -26,85 +28,87 @@ def get_common_columns(): return [ { "fieldname": "company_gstin", - "label": "Company GSTIN", + "label": _("Company GSTIN"), "fieldtype": "Data", "width": 180, }, { "fieldname": "posting_date", - "label": "Posting Date", + "label": _("Posting Date"), "fieldtype": "Date", "width": 180, }, { - "fieldname": "invoice_no", - "label": "Invoice No (Challan No)", - "fieldtype": "Data", + "fieldname": "invoice_type", + "label": _("Invoice Type"), "width": 180, }, { "fieldname": "supplier", - "label": "Supplier", - "fieldtype": "Data", + "label": _("Supplier"), + "fieldtype": "Link", + "options": "Supplier", "width": 180, }, { "fieldname": "gst_category", - "label": "GST Category", + "label": _("GST Category"), "fieldtype": "Data", "width": 180, }, { "fieldname": "supplier_gstin", - "label": "Supplier GSTIN", + "label": _("Supplier GSTIN"), "fieldtype": "Data", "width": 180, }, { "fieldname": "place_of_supply", - "label": "Destination of Supply", + "label": _("Destination of Supply"), "fieldtype": "Data", "width": 180, }, { "fieldname": "is_return", - "label": "Is Return", + "label": _("Is Return"), "fieldtype": "Check", "width": 180, }, { "fieldname": "item_code", - "label": "Item Code", - "fieldtype": "Data", + "label": _("Item Code"), + "fieldtype": "Link", + "options": "Item", "width": 180, }, { "fieldname": "gst_hsn_code", - "label": "HSN Code", - "fieldtype": "Data", - "width": 180, + "label": _("HSN Code"), + "fieldtype": "Link", + "options": "GST HSN Code", + "width": 120, }, { "fieldname": "uom", - "label": "UOM", + "label": _("UOM"), "fieldtype": "Data", "width": 180, }, { "fieldname": "gst_treatment", - "label": "GST Treatment", + "label": _("GST Treatment"), "fieldtype": "Data", "width": 180, }, { "fieldname": "qty", - "label": "Qty", + "label": _("Qty"), "fieldtype": "Float", "width": 180, }, { "fieldname": "item_type", - "label": "Item Type (Input/Capital Goods)", + "label": _("Item Type (Input/Capital Goods)"), "fieldtype": "Data", "width": 180, }, @@ -113,51 +117,58 @@ def get_common_columns(): def get_columns_table_4(): return get_common_columns() + [ + { + "fieldname": "invoice_no", + "label": _("Invoice No (Challan No)"), + "fieldtype": "Dynamic Link", + "options": "invoice_type", + "width": 180, + }, { "fieldname": "taxable_value", - "label": "Taxable Value", + "label": _("Taxable Value"), "fieldtype": "Currency", "width": 180, }, { "fieldname": "gst_rate", - "label": "GST Rate", + "label": _("GST Rate"), "fieldtype": "Percent", "width": 180, }, { "fieldname": "cgst_amount", - "label": "CGST Amount", + "label": _("CGST Amount"), "fieldtype": "Currency", "width": 180, }, { "fieldname": "sgst_amount", - "label": "SGST Amount", + "label": _("SGST Amount"), "fieldtype": "Currency", "width": 180, }, { "fieldname": "igst_amount", - "label": "IGST Amount", + "label": _("IGST Amount"), "fieldtype": "Currency", "width": 180, }, { "fieldname": "total_cess_amount", - "label": "Total Cess Amount", + "label": _("Total Cess Amount"), "fieldtype": "Currency", "width": 180, }, { "fieldname": "total_tax", - "label": "Total Tax", + "label": _("Total Tax"), "fieldtype": "Currency", "width": 180, }, { "fieldname": "total_amount", - "label": "Total Amount", + "label": _("Total Amount"), "fieldtype": "Currency", "width": 180, }, @@ -168,8 +179,16 @@ def get_columns_table_5A(): return [ { "fieldname": "original_challan_no", - "label": "Original Challan No", - "fieldtype": "Data", + "label": _("Original Challan No"), + "fieldtype": "Dynamic Link", + "options": "original_challan_invoice_type", + "width": 180, + }, + { + "fieldname": "invoice_no", + "label": _("Job Worker Invoice No (Challan No)"), + "fieldtype": "Dynamic Link", + "options": "invoice_type", "width": 180, }, ] + get_common_columns() diff --git a/india_compliance/gst_india/utils/itc_04/itc_04_data.py b/india_compliance/gst_india/utils/itc_04/itc_04_data.py index 7115f7b650..735d8026ee 100644 --- a/india_compliance/gst_india/utils/itc_04/itc_04_data.py +++ b/india_compliance/gst_india/utils/itc_04/itc_04_data.py @@ -2,6 +2,7 @@ # For license information, please see license.txt from pypika import Order +from pypika.terms import ValueWrapper import frappe from frappe.query_builder.functions import Date, IfNull @@ -18,6 +19,8 @@ def __init__(self, filters=None): self.se_item = frappe.qb.DocType("Stock Entry Detail") self.sr = frappe.qb.DocType("Subcontracting Receipt") self.sr_item = frappe.qb.DocType("Subcontracting Receipt Item") + self.se_doctype = ValueWrapper("Stock Entry") + self.sr_doctype = ValueWrapper("Subcontracting Receipt") def get_base_query_table_4(self, doc, doc_item): """Construct the base query for Table-4.""" @@ -86,6 +89,7 @@ def get_query_table_4_se(self): self.se.bill_to_gstin.as_("supplier_gstin"), self.se.bill_from_gstin.as_("company_gstin"), self.se.bill_to_gst_category.as_("gst_category"), + self.se_doctype.as_("invoice_type"), ) .where(IfNull(self.se.bill_to_gstin, "") != self.se.bill_from_gstin) .where(self.se.subcontracting_order != "") @@ -105,6 +109,7 @@ def get_query_table_4_sr(self): self.sr_item.stock_uom.as_("uom"), self.sr.company_gstin, self.sr.supplier_gstin, + self.sr_doctype.as_("invoice_type"), ) .where(IfNull(self.sr.supplier_gstin, "") != self.sr.company_gstin) .where(self.sr.is_return == 1) @@ -135,6 +140,7 @@ def get_base_query_table_5A(self, doc, doc_item, ref_doc): doc.base_grand_total.as_("invoice_total"), IfNull(doc.gst_category, "").as_("gst_category"), IfNull(doc_item.gst_treatment, "Not Defined").as_("gst_treatment"), + ref_doc.parenttype.as_("original_challan_invoice_type"), IfNull(ref_doc.link_name, "").as_("original_challan_no"), ) .where(doc.docstatus == 1) @@ -158,6 +164,7 @@ def get_query_table_5A_se(self): self.se_item.uom, self.se.bill_to_gstin.as_("supplier_gstin"), self.se.bill_from_gstin.as_("company_gstin"), + self.se_doctype.as_("invoice_type"), ) .where(IfNull(self.se.bill_to_gstin, "") != self.se.bill_from_gstin) .where(self.se.subcontracting_order != "") @@ -177,6 +184,7 @@ def get_query_table_5A_sr(self): self.sr_item.stock_uom.as_("uom"), self.sr.company_gstin, self.sr.supplier_gstin, + self.sr_doctype.as_("invoice_type"), ) .where(IfNull(self.sr.supplier_gstin, "") != self.sr.company_gstin) )