Skip to content

Commit

Permalink
fix: ITC-04 beta report
Browse files Browse the repository at this point in the history
  • Loading branch information
Ninad1306 committed Aug 7, 2024
1 parent dec5f68 commit 4d26d5e
Show file tree
Hide file tree
Showing 5 changed files with 262 additions and 2 deletions.
Empty file.
35 changes: 35 additions & 0 deletions india_compliance/gst_india/report/itc_04_beta/itc_04_beta.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
// Copyright (c) 2024, Resilient Tech and contributors
// For license information, please see license.txt

frappe.query_reports["ITC-04 Beta"] = {
filters: [
{
fieldname: "company",
label: "Company",
fieldtype: "Link",
options: "Company",
},
{
fieldname: "company_gstin",
label: "Company GSTIN",
fieldtype: "Data",
},
{
fieldname: "from_date",
label: "From Date",
fieldtype: "Date",
},
{
fieldname: "to_date",
label: "To Date",
fieldtype: "Date",
},
{
fieldname: "category",
label: "Invoice Category",
fieldtype: "Select",
options: ["", "Table 4", "Table 5A"],
reqd: 1
},
],
};
50 changes: 50 additions & 0 deletions india_compliance/gst_india/report/itc_04_beta/itc_04_beta.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
{
"add_total_row": 0,
"columns": [],
"creation": "2024-08-07 16:20:53.275110",
"disabled": 0,
"docstatus": 0,
"doctype": "Report",
"filters": [],
"idx": 0,
"is_standard": "Yes",
"letterhead": null,
"modified": "2024-08-07 16:20:53.275110",
"modified_by": "Administrator",
"module": "GST India",
"name": "ITC-04 Beta",
"owner": "Administrator",
"prepared_report": 0,
"ref_doctype": "Item",
"report_name": "ITC-04 Beta",
"report_type": "Script Report",
"roles": [
{
"role": "Item Manager"
},
{
"role": "Stock Manager"
},
{
"role": "Stock User"
},
{
"role": "Sales User"
},
{
"role": "Purchase User"
},
{
"role": "Maintenance User"
},
{
"role": "Accounts User"
},
{
"role": "Manufacturing User"
},
{
"role": "Desk User"
}
]
}
175 changes: 175 additions & 0 deletions india_compliance/gst_india/report/itc_04_beta/itc_04_beta.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,175 @@
# Copyright (c) 2024, Resilient Tech and contributors
# For license information, please see license.txt
from india_compliance.gst_india.utils.itc_04.itc_04_data import ITC04Query


def execute(filters=None):
if not filters:
filters = {}

_class = ITC04Query(filters)
data = []

if filters.category == "Table 4":
columns = get_columns_table_4()
data = _class.get_query_table_4_se().run(as_dict=True)
data.extend(_class.get_query_table_4_sr().run(as_dict=True))
else:
columns = get_columns_table_5A()
data = _class.get_query_table_5A_se().run(as_dict=True)
data.extend(_class.get_query_table_5A_sr().run(as_dict=True))

return columns, data


def get_common_columns():
return [
{
"fieldname": "company_gstin",
"label": "Company GSTIN",
"fieldtype": "Data",
"width": 180,
},
{
"fieldname": "posting_date",
"label": "Posting Date",
"fieldtype": "Date",
"width": 180,
},
{
"fieldname": "invoice_no",
"label": "Invoice No (Challan No)",
"fieldtype": "Data",
"width": 180,
},
{
"fieldname": "supplier",
"label": "Supplier",
"fieldtype": "Data",
"width": 180,
},
{
"fieldname": "gst_category",
"label": "GST Category",
"fieldtype": "Data",
"width": 180,
},
{
"fieldname": "supplier_gstin",
"label": "Supplier GSTIN",
"fieldtype": "Data",
"width": 180,
},
{
"fieldname": "place_of_supply",
"label": "Destination of Supply",
"fieldtype": "Data",
"width": 180,
},
{
"fieldname": "is_return",
"label": "Is Return",
"fieldtype": "Check",
"width": 180,
},
{
"fieldname": "item_code",
"label": "Item Code",
"fieldtype": "Data",
"width": 180,
},
{
"fieldname": "gst_hsn_code",
"label": "HSN Code",
"fieldtype": "Data",
"width": 180,
},
{
"fieldname": "uom",
"label": "UOM",
"fieldtype": "Data",
"width": 180,
},
{
"fieldname": "gst_treatment",
"label": "GST Treatment",
"fieldtype": "Data",
"width": 180,
},
{
"fieldname": "qty",
"label": "Qty",
"fieldtype": "Float",
"width": 180,
},
{
"fieldname": "item_type",
"label": "Item Type (Input/Capital Goods)",
"fieldtype": "Data",
"width": 180,
},
]


def get_columns_table_4():
return get_common_columns() + [
{
"fieldname": "taxable_value",
"label": "Taxable Value",
"fieldtype": "Currency",
"width": 180,
},
{
"fieldname": "gst_rate",
"label": "GST Rate",
"fieldtype": "Percent",
"width": 180,
},
{
"fieldname": "cgst_amount",
"label": "CGST Amount",
"fieldtype": "Currency",
"width": 180,
},
{
"fieldname": "sgst_amount",
"label": "SGST Amount",
"fieldtype": "Currency",
"width": 180,
},
{
"fieldname": "igst_amount",
"label": "IGST Amount",
"fieldtype": "Currency",
"width": 180,
},
{
"fieldname": "total_cess_amount",
"label": "Total Cess Amount",
"fieldtype": "Currency",
"width": 180,
},
{
"fieldname": "total_tax",
"label": "Total Tax",
"fieldtype": "Currency",
"width": 180,
},
{
"fieldname": "total_amount",
"label": "Total Amount",
"fieldtype": "Currency",
"width": 180,
},
]


def get_columns_table_5A():
return [
{
"fieldname": "original_challan_no",
"label": "Original Challan No",
"fieldtype": "Data",
"width": 180,
},
] + get_common_columns()
4 changes: 2 additions & 2 deletions india_compliance/gst_india/utils/itc_04/itc_04_data.py
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ def get_query_table_4_se(self):
self.se.bill_to_gst_category.as_("gst_category"),
)
.where(IfNull(self.se.bill_to_gstin, "") != self.se.bill_from_gstin)
.where(self.se.subcontracting != "")
.where(self.se.subcontracting_order != "")
.where(self.se.purpose == "Send to Subcontractor")
)

Expand Down Expand Up @@ -160,7 +160,7 @@ def get_query_table_5A_se(self):
self.se.bill_from_gstin.as_("company_gstin"),
)
.where(IfNull(self.se.bill_to_gstin, "") != self.se.bill_from_gstin)
.where(self.se.subcontracting != "")
.where(self.se.subcontracting_order != "")
.where(self.se.purpose == "Material Transfer")
)

Expand Down

0 comments on commit 4d26d5e

Please sign in to comment.