Commit 7c24b44e authored by Krishnakant Mane's avatar Krishnakant Mane
Browse files

Merge branch 'cash_memo' into 'devel'

changes made in and

1.paymentmode value sent to the front end.

2.Wrote code in gkUpgrade to set paymentmode (i.e 2 for 'bank' and 3 for 'cash') to make a database consistent.For this, check whether paymentmode is NULL or Not.then check bankdetails are present or not if bankdetails are not present then set payment mode =3, else set paymentmode=2.

please refer issue #851 at gkwebapp

See merge request !38
parents c580e479 5d97d119
......@@ -284,7 +284,7 @@ There will be an icFlag which will determine if it's an incrementing or decreme
self.con = eng.connect()
result = self.con.execute(select([invoice]).where(invoice.c.invid==self.request.params["invid"]))
invrow = result.fetchone()
inv = {"invid":invrow["invid"],"taxflag":invrow["taxflag"],"invoiceno":invrow["invoiceno"],"invoicedate":datetime.strftime(invrow["invoicedate"],"%d-%m-%Y"),"icflag":invrow["icflag"],"invoicetotal":"%.2f"%float(invrow["invoicetotal"]),"bankdetails":invrow["bankdetails"], "orgstategstin":invrow["orgstategstin"]}
inv = {"invid":invrow["invid"],"taxflag":invrow["taxflag"],"invoiceno":invrow["invoiceno"],"invoicedate":datetime.strftime(invrow["invoicedate"],"%d-%m-%Y"),"icflag":invrow["icflag"],"invoicetotal":"%.2f"%float(invrow["invoicetotal"]),"bankdetails":invrow["bankdetails"], "orgstategstin":invrow["orgstategstin"], "paymentmode":invrow["paymentmode"]}
if invrow["sourcestate"] != None:
inv["sourcestate"] = invrow["sourcestate"]
inv["sourcestatecode"] = getStateCode(invrow["sourcestate"],self.con)["statecode"]
......@@ -93,6 +93,20 @@ class api_organisation(object):
self.con.execute("alter table invoice add address text")
self.con.execute("alter table customerandsupplier add bankdetails jsonb")
self.con.execute("alter table invoice add paymentmode integer")
#Code for assinging paymentmode where paymentmode is blank and bank details are present.
bankresult = self.con.execute(select([gkdb.invoice.c.invid,gkdb.invoice.c.bankdetails]).where(gkdb.invoice.c.paymentmode == None))
#Fetching invid,bankdetails using fetchall() method in list.for loop is used to fetch each record in bankresult.
dict = bankresult.fetchall()
for invdata in dict:
#Storing account number,ifsc number,invoice id in invaccno,invifsc,invoid respectively
invaccno = invdata["bankdetails"]["accountno"]
invifsc = invdata["bankdetails"]["ifsc"]
invoid = invdata["invid"]
#Checking for bankdetails,if accountno and ifsc are present then set paymentmode=2 else set paymentmode=3.
if (invaccno == "" or invifsc == ""):
self.con.execute("update invoice set paymentmode=3 where invid = %d"%int(invoid))
self.con.execute("update invoice set paymentmode=2 where invid = %d"%int(invoid))
self.con.execute("alter table organisation add bankdetails json")
self.con.execute("alter table delchal add consignee jsonb")
self.con.execute("alter table invoice add orgstategstin text")
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment