From cc36ad7100c4d127615721039b03daff5833dfb4 Mon Sep 17 00:00:00 2001 From: abhijith Date: Fri, 27 Oct 2017 19:23:26 +0530 Subject: [PATCH 1/2] Invoice Single GET now returns cess rate, total cess amount and tax name. --- gkcore/views/api_invoice.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/gkcore/views/api_invoice.py b/gkcore/views/api_invoice.py index 1761024..30b948a 100644 --- a/gkcore/views/api_invoice.py +++ b/gkcore/views/api_invoice.py @@ -337,6 +337,7 @@ There will be an icFlag which will determine if it's an incrementing or decreme totalDisc = 0.00 totalTaxableVal = 0.00 totalTaxAmt = 0.00 + totalCessAmt = 0.00 discounts = invrow["discount"] freeqtys = invrow["freeqty"] #now looping through the contents. @@ -380,10 +381,12 @@ There will be an icFlag which will determine if it's an incrementing or decreme taxResult = TaxData["gkresult"] cessRate = 0.00 cessAmount = 0.00 + cessVal = 0.00 taxname = "" if taxResult.has_key('CESS'): cessVal = float(taxResult["CESS"]) cessAmount = (taxableAmount * (cessVal/100)) + totalCessAmt = totalCessAmt + cessAmount if taxResult.has_key('IGST'): taxname = "IGST" @@ -391,7 +394,6 @@ There will be an icFlag which will determine if it's an incrementing or decreme taxAmount = (taxableAmount * (taxRate/100)) totalAmount = taxableAmount + taxAmount + cessAmount else: - print "SGST" taxname = "SGST" taxRate = float(taxResult["SGST"]) taxAmount = (taxableAmount * (taxRate/100)) @@ -402,10 +404,12 @@ There will be an icFlag which will determine if it's an incrementing or decreme totalTaxAmt = totalTaxAmt + taxAmount - invContents[pc] = {"proddesc":prodrow["productdesc"],"gscode":prodrow["gscode"],"uom":unitofMeasurement,"qty":"%.2f"% (float(contentsData[pc][contentsData[pc].keys()[0]])),"freeqty":"%.2f"% (float(freeqty)),"priceperunit":"%.2f"% (float(contentsData[pc].keys()[0])),"discount":"%.2f"% (float(discount)),"taxableamount":"%.2f"%(float(taxableAmount)),"totalAmount":"%.2f"% (float(totalAmount)),"taxname":taxname,"taxrate":"%.2f"% (float(taxRate)),"taxamount":"%.2f"% (float(taxAmount)),"cess":"%.2f"%(float(cessAmount))} + invContents[pc] = {"proddesc":prodrow["productdesc"],"gscode":prodrow["gscode"],"uom":unitofMeasurement,"qty":"%.2f"% (float(contentsData[pc][contentsData[pc].keys()[0]])),"freeqty":"%.2f"% (float(freeqty)),"priceperunit":"%.2f"% (float(contentsData[pc].keys()[0])),"discount":"%.2f"% (float(discount)),"taxableamount":"%.2f"%(float(taxableAmount)),"totalAmount":"%.2f"% (float(totalAmount)),"taxname":taxname,"taxrate":"%.2f"% (float(taxRate)),"taxamount":"%.2f"% (float(taxAmount)),"cess":"%.2f"%(float(cessAmount)),"cessrate":"%.2f"%(float(cessVal))} inv["totaldiscount"] = "%.2f"% (float(totalDisc)) inv["totaltaxablevalue"] = "%.2f"% (float(totalTaxableVal)) inv["totaltaxamt"] = "%.2f"% (float(totalTaxAmt)) + inv["totalcessamt"] = "%.2f"% (float(totalCessAmt)) + inv['taxname'] = taxname inv["invcontents"] = invContents return {"gkstatus":gkcore.enumdict["Success"],"gkresult":inv} except: -- GitLab From 23ab52e915eab769921221aabc1de4996c62ac41 Mon Sep 17 00:00:00 2001 From: abhijith Date: Sat, 28 Oct 2017 10:20:16 +0530 Subject: [PATCH 2/2] Added tax name in VAT too --- gkcore/views/api_invoice.py | 1 + 1 file changed, 1 insertion(+) diff --git a/gkcore/views/api_invoice.py b/gkcore/views/api_invoice.py index 30b948a..3d45c35 100644 --- a/gkcore/views/api_invoice.py +++ b/gkcore/views/api_invoice.py @@ -370,6 +370,7 @@ There will be an icFlag which will determine if it's an incrementing or decreme if int(invrow["taxflag"]) == 22: taxRate = float(invrow["tax"][pc]) taxAmount = (taxableAmount * float(taxRate/100)) + taxname = 'VAT' totalAmount = float(taxableAmount) + (float(taxableAmount) * float(taxRate/100)) totalDisc = totalDisc + float(discount) totalTaxableVal = totalTaxableVal + taxableAmount -- GitLab