fix: Cess amount in GSTR 3B report
This commit is contained in:
parent
eb2a42d9e1
commit
0fa4143bac
@ -45,6 +45,10 @@ frappe.ui.form.on('GSTR 3B Report', {
|
||||
frm.set_df_property('year', 'options', options);
|
||||
},
|
||||
|
||||
validate: function(frm) {
|
||||
frm.dirty();
|
||||
},
|
||||
|
||||
setup: function(frm) {
|
||||
frm.set_query('company_address', function(doc) {
|
||||
if(!doc.company) {
|
||||
|
@ -243,20 +243,15 @@ class GSTR3BReport(Document):
|
||||
|
||||
osup_det = self.report_dict["sup_details"]["osup_det"]
|
||||
|
||||
for d in inter_state_supply.get("Unregistered", []):
|
||||
self.report_dict["inter_sup"]["unreg_details"].append(d)
|
||||
osup_det["txval"] = flt(osup_det["txval"] + d["txval"], 2)
|
||||
osup_det["iamt"] = flt(osup_det["iamt"] + d["iamt"], 2)
|
||||
for key, value in iteritems(inter_state_supply):
|
||||
if key[0] == "Unregistered":
|
||||
self.report_dict["inter_sup"]["unreg_details"].append(value)
|
||||
|
||||
for d in inter_state_supply.get("Registered Composition", []):
|
||||
self.report_dict["inter_sup"]["comp_details"].append(d)
|
||||
osup_det["txval"] = flt(osup_det["txval"] + d["txval"], 2)
|
||||
osup_det["iamt"] = flt(osup_det["iamt"] + d["iamt"], 2)
|
||||
if key[0] == "Registered Composition":
|
||||
self.report_dict["inter_sup"]["comp_details"].append(value)
|
||||
|
||||
for d in inter_state_supply.get("UIN Holders", []):
|
||||
self.report_dict["inter_sup"]["uin_details"].append(d)
|
||||
osup_det["txval"] = flt(osup_det["txval"] + d["txval"], 2)
|
||||
osup_det["iamt"] = flt(osup_det["iamt"] + d["iamt"], 2)
|
||||
if key[0] == "UIN Holders":
|
||||
self.report_dict["inter_sup"]["uin_details"].append(value)
|
||||
|
||||
def get_total_taxable_value(self, doctype, reverse_charge):
|
||||
|
||||
@ -301,41 +296,54 @@ class GSTR3BReport(Document):
|
||||
(self.month_no, self.year, self.company, self.gst_details.get("gstin")), as_dict=1)[0].total
|
||||
|
||||
def get_inter_state_supplies(self, state_number):
|
||||
|
||||
inter_state_supply_taxable_value = frappe.db.sql(""" select sum(s.net_total) as total, s.place_of_supply, s.gst_category
|
||||
from `tabSales Invoice` s where s.docstatus = 1 and month(s.posting_date) = %s and year(s.posting_date) = %s
|
||||
and s.company = %s and s.company_gstin = %s and s.gst_category in ('Unregistered', 'Registered Composition', 'UIN Holders')
|
||||
group by s.gst_category, s.place_of_supply""", (self.month_no, self.year, self.company, self.gst_details.get("gstin")), as_dict=1)
|
||||
|
||||
inter_state_supply_tax = frappe.db.sql(""" select sum(t.tax_amount_after_discount_amount) as tax_amount, s.place_of_supply, s.gst_category
|
||||
from `tabSales Invoice` s, `tabSales Taxes and Charges` t
|
||||
inter_state_supply_tax = frappe.db.sql(""" select t.account_head, t.tax_amount_after_discount_amount as tax_amount,
|
||||
s.name, s.net_total, s.place_of_supply, s.gst_category from `tabSales Invoice` s, `tabSales Taxes and Charges` t
|
||||
where t.parent = s.name and s.docstatus = 1 and month(s.posting_date) = %s and year(s.posting_date) = %s
|
||||
and s.company = %s and s.company_gstin = %s and s.gst_category in ('Unregistered', 'Registered Composition', 'UIN Holders')
|
||||
group by s.gst_category, s.place_of_supply""", (self.month_no, self.year, self.company, self.gst_details.get("gstin")), as_dict=1)
|
||||
""", (self.month_no, self.year, self.company, self.gst_details.get("gstin")), as_dict=1)
|
||||
|
||||
inter_state_supply_tax_mapping={}
|
||||
inter_state_supply_tax_mapping = {}
|
||||
inter_state_supply_details = {}
|
||||
|
||||
for d in inter_state_supply_tax:
|
||||
inter_state_supply_tax_mapping.setdefault(d.place_of_supply, d.tax_amount)
|
||||
inter_state_supply_tax_mapping.setdefault(d.name, {
|
||||
'place_of_supply': d.place_of_supply,
|
||||
'taxable_value': d.net_total,
|
||||
'camt': 0.0,
|
||||
'samt': 0.0,
|
||||
'iamt': 0.0,
|
||||
'csamt': 0.0
|
||||
})
|
||||
|
||||
for d in inter_state_supply_taxable_value:
|
||||
inter_state_supply_details.setdefault(
|
||||
d.gst_category, []
|
||||
)
|
||||
if d.account_head in [d.cgst_account for d in self.account_heads]:
|
||||
inter_state_supply_tax_mapping[d.name]['camt'] += d.tax_amount
|
||||
|
||||
if d.account_head in [d.sgst_account for d in self.account_heads]:
|
||||
inter_state_supply_tax_mapping[d.name]['samt'] += d.tax_amount
|
||||
|
||||
if d.account_head in [d.igst_account for d in self.account_heads]:
|
||||
inter_state_supply_tax_mapping[d.name]['samt'] += d.tax_amount
|
||||
|
||||
if d.account_head in [d.cess_account for d in self.account_heads]:
|
||||
inter_state_supply_tax_mapping[d.name]['csamt'] += d.tax_amount
|
||||
|
||||
for key, value in iteritems(inter_state_supply_tax_mapping):
|
||||
if d.place_of_supply:
|
||||
osup_det = self.report_dict["sup_details"]["osup_det"]
|
||||
osup_det["txval"] = flt(osup_det["txval"] + value['taxable_value'], 2)
|
||||
osup_det["camt"] = flt(osup_det["camt"] + value['camt'], 2)
|
||||
osup_det["samt"] = flt(osup_det["samt"] + value['samt'], 2)
|
||||
osup_det["csamt"] = flt(osup_det["csamt"] + value['csamt'], 2)
|
||||
|
||||
if state_number != d.place_of_supply.split("-")[0]:
|
||||
inter_state_supply_details[d.gst_category].append({
|
||||
inter_state_supply_details.setdefault((d.gst_category, d.place_of_supply), {
|
||||
"txval": 0.0,
|
||||
"pos": d.place_of_supply.split("-")[0],
|
||||
"txval": flt(d.total, 2),
|
||||
"iamt": flt(inter_state_supply_tax_mapping.get(d.place_of_supply), 2)
|
||||
"iamt": 0.0
|
||||
})
|
||||
else:
|
||||
osup_det = self.report_dict["sup_details"]["osup_det"]
|
||||
osup_det["txval"] = flt(osup_det["txval"] + d.total, 2)
|
||||
osup_det["camt"] = flt(osup_det["camt"] + inter_state_supply_tax_mapping.get(d.place_of_supply)/2, 2)
|
||||
osup_det["samt"] = flt(osup_det["samt"] + inter_state_supply_tax_mapping.get(d.place_of_supply)/2, 2)
|
||||
|
||||
inter_state_supply_details[(d.gst_category, d.place_of_supply)]['txval'] += value['taxable_value']
|
||||
inter_state_supply_details[(d.gst_category, d.place_of_supply)]['iamt'] += value['iamt']
|
||||
|
||||
return inter_state_supply_details
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user