From 49206f85b2679d12bd612cdc735ecc17922ae135 Mon Sep 17 00:00:00 2001 From: kk Date: Fri, 17 Nov 2017 12:10:12 +0530 Subject: [PATCH 01/56] Corrected the update reverse charge issue. --- gkcore/views/api_organisation.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/gkcore/views/api_organisation.py b/gkcore/views/api_organisation.py index 890f472..281a3e0 100644 --- a/gkcore/views/api_organisation.py +++ b/gkcore/views/api_organisation.py @@ -63,7 +63,10 @@ class api_organisation(object): self.con.execute(select([func.count(gkdb.invoice.c.orgstategstin)])) self.con.execute(select([func.count(gkdb.invoice.c.cess)])) self.con.execute(select([func.count(gkdb.state.c.statecode)])) - self.con.execute(select([func.count(gkdb.invoice.c.reversecharge)])) + countResult = self.con.execute(select([func.count(gkdb.invoice.c.reversecharge).label('revcount')])) + countData = countResult.fetchone() + if int(countData["revcount"]) > 0: + self.con.execute("update invoice set reversecharge = '0'" ) self.con.execute(select(gkdb.organisation.c.gstin)) self.con.execute(select([func.count(gkdb.invoice.c.consignee)])) self.con.execute(select([func.count(gkdb.customerandsupplier.c.gstin)])) @@ -80,7 +83,6 @@ class api_organisation(object): self.con.execute(select(gkdb.organisation.c.billflag)) self.con.execute(select([func.count(gkdb.billwise.c.billid)])) except: - self.con.execute("update invoice set reversecharge = '0'" ) self.con.execute("alter table invoice add orgstategstin text") self.con.execute("alter table invoice add cess jsonb") self.con.execute("alter table product add UNIQUE(productdesc,orgcode)") -- GitLab From ad95b100646464cf638bf881953354d47a303629 Mon Sep 17 00:00:00 2001 From: RESHMA Date: Mon, 27 Nov 2017 18:30:07 +0530 Subject: [PATCH 02/56] "getGodownProd" is written for 'Dispatched From', it will return Godown Name with Address containing products. --- gkcore/views/api_godown.py | 503 ++++++++++++++++++++----------------- 1 file changed, 267 insertions(+), 236 deletions(-) diff --git a/gkcore/views/api_godown.py b/gkcore/views/api_godown.py index 6b67c78..83ffe2f 100644 --- a/gkcore/views/api_godown.py +++ b/gkcore/views/api_godown.py @@ -44,257 +44,288 @@ from gkcore.views.api_login import authCheck from gkcore.views.api_user import getUserRole def getusergodowns(userid): - try: - con = Connection - con = eng.connect() - uid=userid - godowns=con.execute(select([godown]).where(godown.c.goid.in_(select([usergodown.c.goid]).where(usergodown.c.userid == uid)))) - usergo = [] - srno=1 - for row in godowns: - godownstock = con.execute(select([func.count(stock.c.goid).label("godownstockstatus") ]).where(stock.c.goid==row["goid"])) - godownstockcount = godownstock.fetchone() - godownstatus = godownstockcount["godownstockstatus"] - if godownstatus > 0: - status = "Active" - else: - status = "Inactive" - usergo.append({"godownstatus":status, "srno":srno, "goid": row["goid"], "goname": row["goname"], "goaddr": row["goaddr"], "gocontact": row["gocontact"],"state":row["state"],"contactname":row["contactname"],"designation":row["designation"]}) - srno = srno+1 - return {"gkstatus": gkcore.enumdict["Success"], "gkresult":usergo } - except: - return {"gkstatus":gkcore.enumdict["ConnectionFailed"] } - finally: - con.close(); + try: + con = Connection + con = eng.connect() + uid=userid + godowns=con.execute(select([godown]).where(godown.c.goid.in_(select([usergodown.c.goid]).where(usergodown.c.userid == uid)))) + usergo = [] + srno=1 + for row in godowns: + godownstock = con.execute(select([func.count(stock.c.goid).label("godownstockstatus") ]).where(stock.c.goid==row["goid"])) + godownstockcount = godownstock.fetchone() + godownstatus = godownstockcount["godownstockstatus"] + if godownstatus > 0: + status = "Active" + else: + status = "Inactive" + usergo.append({"godownstatus":status, "srno":srno, "goid": row["goid"], "goname": row["goname"], "goaddr": row["goaddr"], "gocontact": row["gocontact"],"state":row["state"],"contactname":row["contactname"],"designation":row["designation"]}) + srno = srno+1 + return {"gkstatus": gkcore.enumdict["Success"], "gkresult":usergo } + except: + return {"gkstatus":gkcore.enumdict["ConnectionFailed"] } + finally: + con.close(); @view_defaults(route_name='godown') class api_godown(object): - def __init__(self,request): - self.request = Request - self.request = request - self.con = Connection + def __init__(self,request): + self.request = Request + self.request = request + self.con = Connection - @view_config(request_method='POST',renderer='json') - def addGodown(self): - try: - token = self.request.headers["gktoken"] - except: - return {"gkstatus": gkcore.enumdict["UnauthorisedAccess"]} - authDetails = authCheck(token) - if authDetails["auth"] == False: - return {"gkstatus": enumdict["UnauthorisedAccess"]} - else: - try: - self.con = eng.connect() - dataset = self.request.json_body - dataset["orgcode"] = authDetails["orgcode"] - result = self.con.execute(godown.insert(),[dataset]) - return {"gkstatus":enumdict["Success"]} - except exc.IntegrityError: - return {"gkstatus":enumdict["DuplicateEntry"]} - except: - return {"gkstatus":gkcore.enumdict["ConnectionFailed"] } - finally: - self.con.close() + @view_config(request_method='POST',renderer='json') + def addGodown(self): + try: + token = self.request.headers["gktoken"] + except: + return {"gkstatus": gkcore.enumdict["UnauthorisedAccess"]} + authDetails = authCheck(token) + if authDetails["auth"] == False: + return {"gkstatus": enumdict["UnauthorisedAccess"]} + else: + try: + self.con = eng.connect() + dataset = self.request.json_body + dataset["orgcode"] = authDetails["orgcode"] + result = self.con.execute(godown.insert(),[dataset]) + return {"gkstatus":enumdict["Success"]} + except exc.IntegrityError: + return {"gkstatus":enumdict["DuplicateEntry"]} + except: + return {"gkstatus":gkcore.enumdict["ConnectionFailed"] } + finally: + self.con.close() - @view_config(request_method='PUT', renderer='json') - def editGodown(self): - try: - token = self.request.headers["gktoken"] - except: - return {"gkstatus": gkcore.enumdict["UnauthorisedAccess"]} - authDetails = authCheck(token) - if authDetails["auth"] == False: - return {"gkstatus": enumdict["UnauthorisedAccess"]} - else: - try: - self.con = eng.connect() - dataset = self.request.json_body - result = self.con.execute(godown.update().where(godown.c.goid==dataset["goid"]).values(dataset)) - return {"gkstatus":enumdict["Success"]} - except: - return {"gkstatus":gkcore.enumdict["ConnectionFailed"] } - finally: - self.con.close() + @view_config(request_method='PUT', renderer='json') + def editGodown(self): + try: + token = self.request.headers["gktoken"] + except: + return {"gkstatus": gkcore.enumdict["UnauthorisedAccess"]} + authDetails = authCheck(token) + if authDetails["auth"] == False: + return {"gkstatus": enumdict["UnauthorisedAccess"]} + else: + try: + self.con = eng.connect() + dataset = self.request.json_body + result = self.con.execute(godown.update().where(godown.c.goid==dataset["goid"]).values(dataset)) + return {"gkstatus":enumdict["Success"]} + except: + return {"gkstatus":gkcore.enumdict["ConnectionFailed"] } + finally: + self.con.close() - @view_config(request_method='GET', renderer ='json') - def getAllGodowns(self): - try: - token = self.request.headers["gktoken"] - except: - return {"gkstatus": gkcore.enumdict["UnauthorisedAccess"]} - authDetails = authCheck(token) - if authDetails["auth"] == False: - return {"gkstatus": gkcore.enumdict["UnauthorisedAccess"]} - else: - try: - self.con = eng.connect() - userrole = getUserRole(authDetails["userid"]) - gorole = userrole["gkresult"] - if (gorole["userrole"]==3): - try: - result = getusergodowns(authDetails["userid"]) - return {"gkstatus": gkcore.enumdict["Success"], "gkresult":result["gkresult"]} - except: - return {"gkstatus":gkcore.enumdict["ConnectionFailed"] } - if (gorole["userrole"]!=3): - result = self.con.execute(select([godown]).where(godown.c.orgcode==authDetails["orgcode"]).order_by(godown.c.goname)) - godowns = [] - srno=1 - for row in result: - godownstock = self.con.execute(select([func.count(stock.c.goid).label("godownstockstatus") ]).where(stock.c.goid==row["goid"])) - godownstockcount = godownstock.fetchone() - godownstatus = godownstockcount["godownstockstatus"] - if godownstatus > 0: - status = "Active" - else: - status = "Inactive" - godowns.append({"godownstatus":status, "srno":srno, "goid": row["goid"], "goname": row["goname"], "goaddr": row["goaddr"], "gocontact": row["gocontact"],"state":row["state"],"contactname":row["contactname"],"designation":row["designation"]}) - srno = srno+1 - return {"gkstatus": gkcore.enumdict["Success"], "gkresult":godowns } - except: - return {"gkstatus":gkcore.enumdict["ConnectionFailed"] } - finally: - self.con.close() + @view_config(request_method='GET', renderer ='json') + def getAllGodowns(self): + try: + token = self.request.headers["gktoken"] + except: + return {"gkstatus": gkcore.enumdict["UnauthorisedAccess"]} + authDetails = authCheck(token) + if authDetails["auth"] == False: + return {"gkstatus": gkcore.enumdict["UnauthorisedAccess"]} + else: + try: + self.con = eng.connect() + userrole = getUserRole(authDetails["userid"]) + gorole = userrole["gkresult"] + if (gorole["userrole"]==3): + try: + result = getusergodowns(authDetails["userid"]) + return {"gkstatus": gkcore.enumdict["Success"], "gkresult":result["gkresult"]} + except: + return {"gkstatus":gkcore.enumdict["ConnectionFailed"] } + if (gorole["userrole"]!=3): + result = self.con.execute(select([godown]).where(godown.c.orgcode==authDetails["orgcode"]).order_by(godown.c.goname)) + godowns = [] + srno=1 + for row in result: + godownstock = self.con.execute(select([func.count(stock.c.goid).label("godownstockstatus") ]).where(stock.c.goid==row["goid"])) + godownstockcount = godownstock.fetchone() + godownstatus = godownstockcount["godownstockstatus"] + if godownstatus > 0: + status = "Active" + else: + status = "Inactive" + godowns.append({"godownstatus":status, "srno":srno, "goid": row["goid"], "goname": row["goname"], "goaddr": row["goaddr"], "gocontact": row["gocontact"],"state":row["state"],"contactname":row["contactname"],"designation":row["designation"]}) + srno = srno+1 + return {"gkstatus": gkcore.enumdict["Success"], "gkresult":godowns } + except: + return {"gkstatus":gkcore.enumdict["ConnectionFailed"] } + finally: + self.con.close() - @view_config(request_method='GET', request_param='type=togodown', renderer ='json') - def togodowns(self): - try: - token = self.request.headers["gktoken"] - except: - return {"gkstatus": gkcore.enumdict["UnauthorisedAccess"]} - authDetails = authCheck(token) - if authDetails["auth"] == False: - return {"gkstatus": gkcore.enumdict["UnauthorisedAccess"]} - else: - try: - self.con = eng.connect() - result = self.con.execute(select([godown]).where(godown.c.orgcode==authDetails["orgcode"])) - godowns = [] - for row in result: - godowns.append({"goid": row["goid"], "goname": row["goname"], "goaddr": row["goaddr"]}) - return {"gkstatus": gkcore.enumdict["Success"], "gkresult":godowns } - except: - return {"gkstatus":gkcore.enumdict["ConnectionFailed"] } - finally: - self.con.close() + @view_config(request_method='GET', request_param='type=togodown', renderer ='json') + def togodowns(self): + try: + token = self.request.headers["gktoken"] + except: + return {"gkstatus": gkcore.enumdict["UnauthorisedAccess"]} + authDetails = authCheck(token) + if authDetails["auth"] == False: + return {"gkstatus": gkcore.enumdict["UnauthorisedAccess"]} + else: + try: + self.con = eng.connect() + result = self.con.execute(select([godown]).where(godown.c.orgcode==authDetails["orgcode"])) + godowns = [] + for row in result: + godowns.append({"goid": row["goid"], "goname": row["goname"], "goaddr": row["goaddr"]}) + return {"gkstatus": gkcore.enumdict["Success"], "gkresult":godowns } + except: + return {"gkstatus":gkcore.enumdict["ConnectionFailed"] } + finally: + self.con.close() - @view_config(request_param='qty=single', request_method='GET',renderer='json') - def getGodown(self): - try: - token = self.request.headers["gktoken"] - except: - return {"gkstatus": enumdict["UnauthorisedAccess"]} - authDetails = authCheck(token) - if authDetails["auth"]==False: - return {"gkstatus":enumdict["UnauthorisedAccess"]} - else: - try: - self.con = eng.connect() - result = self.con.execute(select([godown]).where(godown.c.goid == self.request.params["goid"])) - row = result.fetchone() - godownDetails={"goid": row["goid"], "goname": row["goname"], "goaddr": row["goaddr"], "gocontact": row["gocontact"],"state":row["state"],"contactname":row["contactname"],"designation":row["designation"]} - self.con.close() - return {"gkstatus":enumdict["Success"],"gkresult":godownDetails} - except: - return {"gkstatus":enumdict["ConnectionFailed"]} - finally: - self.con.close() + @view_config(request_param='qty=single', request_method='GET',renderer='json') + def getGodown(self): + try: + token = self.request.headers["gktoken"] + except: + return {"gkstatus": enumdict["UnauthorisedAccess"]} + authDetails = authCheck(token) + if authDetails["auth"]==False: + return {"gkstatus":enumdict["UnauthorisedAccess"]} + else: + try: + self.con = eng.connect() + result = self.con.execute(select([godown]).where(godown.c.goid == self.request.params["goid"])) + row = result.fetchone() + godownDetails={"goid": row["goid"], "goname": row["goname"], "goaddr": row["goaddr"], "gocontact": row["gocontact"],"state":row["state"],"contactname":row["contactname"],"designation":row["designation"]} + self.con.close() + return {"gkstatus":enumdict["Success"],"gkresult":godownDetails} + except: + return {"gkstatus":enumdict["ConnectionFailed"]} + finally: + self.con.close() - '''This function returns all godowns associated with godown in charge. - It takes user id as a input''' - @view_config(request_method='GET', request_param='type=byuser', renderer ='json') - def getGodownsByUser(self): - try: - token = self.request.headers["gktoken"] - except: - return {"gkstatus": gkcore.enumdict["UnauthorisedAccess"]} - authDetails = authCheck(token) - if authDetails["auth"] == False: - return {"gkstatus": gkcore.enumdict["UnauthorisedAccess"]} - else: - try: - self.con = eng.connect() - result = getusergodowns(self.request.params["userid"]) - return {"gkstatus": gkcore.enumdict["Success"], "gkresult":result["gkresult"]} - except: - return {"gkstatus":gkcore.enumdict["ConnectionFailed"] } - finally: - self.con.close() + '''This function returns all godowns associated with godown in charge. + It takes user id as a input''' + @view_config(request_method='GET', request_param='type=byuser', renderer ='json') + def getGodownsByUser(self): + try: + token = self.request.headers["gktoken"] + except: + return {"gkstatus": gkcore.enumdict["UnauthorisedAccess"]} + authDetails = authCheck(token) + if authDetails["auth"] == False: + return {"gkstatus": gkcore.enumdict["UnauthorisedAccess"]} + else: + try: + self.con = eng.connect() + result = getusergodowns(self.request.params["userid"]) + return {"gkstatus": gkcore.enumdict["Success"], "gkresult":result["gkresult"]} + except: + return {"gkstatus":gkcore.enumdict["ConnectionFailed"] } + finally: + self.con.close() + """ + The below function "getNumberOfProductInGodown" will be called when user select a + godown for deletetion, it will return number of products a selected godown content. + """ + + @view_config(request_method='GET', request_param='type=goproduct',renderer='json') + def getNumberOfProductInGodown(self): + try: + token = self.request.headers["gktoken"] + except: + return {"gkstatus": enumdict["UnauthorisedAccess"]} + authDetails = authCheck(token) + if authDetails["auth"]==False: + return {"gkstatus":enumdict["UnauthorisedAccess"]} + else: + try: + self.con = eng.connect() + goid = self.request.params["goid"] + result = self.con.execute(select([func.count(goprod.c.productcode)]).where(goprod.c.goid == goid)) + row = result.fetchone() + return {"gkstatus":enumdict["Success"],"gkresult":row[0]} + except: + self.con.close() + return {"gkstatus":enumdict["ConnectionFailed"]} + finally: + self.con.close() + """ - The below function "getNumberOfProductInGodown" will be called when user select a - godown for deletetion, it will return number of products a selected godown content. + The below function "getGodownProd" will be called when user select Dispatched From for Transfer Note, it will return Godown Name with Address containing products. """ + @view_config(request_method='GET', request_param='value=1',renderer='json') + def getGodownProd(self): + try: + token = self.request.headers["gktoken"] + except: + return {"gkstatus": enumdict["UnauthorisedAccess"]} + authDetails = authCheck(token) + if authDetails["auth"]==False: + return {"gkstatus":enumdict["UnauthorisedAccess"]} + else: + try: + self.con = eng.connect() + result = self.con.execute(select([goprod.c.goid]).distinct().where(goprod.c.orgcode == authDetails["orgcode"])) + grow = result.fetchall() + godownList = [] + for g in grow : + godownData = self.con.execute(select([godown.c.goid, godown.c.goname, godown.c.goaddr]).where(godown.c.goid == g["goid"])) + row = godownData.fetchone() + godownList.append({"goid": row["goid"], "goname": row["goname"], "goaddr": row["goaddr"]}) + self.con.close() + return {"gkstatus":enumdict["Success"],"gkresult":godownList} + except: + self.con.close() + return {"gkstatus":enumdict["ConnectionFailed"]} + finally: + self.con.close() + - @view_config(request_method='GET', request_param='type=goproduct',renderer='json') - def getNumberOfProductInGodown(self): - try: - token = self.request.headers["gktoken"] - except: - return {"gkstatus": enumdict["UnauthorisedAccess"]} - authDetails = authCheck(token) - if authDetails["auth"]==False: - return {"gkstatus":enumdict["UnauthorisedAccess"]} - else: - try: - self.con = eng.connect() - goid = self.request.params["goid"] - result = self.con.execute(select([func.count(goprod.c.productcode)]).where(goprod.c.goid == goid)) - row = result.fetchone() - return {"gkstatus":enumdict["Success"],"gkresult":row[0]} - except: - self.con.close() - return {"gkstatus":enumdict["ConnectionFailed"]} - finally: - self.con.close() - - @view_config(request_method='DELETE', renderer ='json') - def deleteGodown(self): - try: - token = self.request.headers["gktoken"] - except: - return {"gkstatus": enumdict["UnauthorisedAccess"]} - authDetails = authCheck(token) - if authDetails["auth"]==False: - return {"gkstatus":enumdict["UnauthorisedAccess"]} - else: - try: - self.con = eng.connect() - dataset = self.request.json_body - result = self.con.execute(godown.delete().where(godown.c.goid==dataset["goid"])) - return {"gkstatus":enumdict["Success"]} - except exc.IntegrityError: - return {"gkstatus":enumdict["ActionDisallowed"]} - except: - return {"gkstatus":enumdict["ConnectionFailed"] } - finally: - self.con.close() + @view_config(request_method='DELETE', renderer ='json') + def deleteGodown(self): + try: + token = self.request.headers["gktoken"] + except: + return {"gkstatus": enumdict["UnauthorisedAccess"]} + authDetails = authCheck(token) + if authDetails["auth"]==False: + return {"gkstatus":enumdict["UnauthorisedAccess"]} + else: + try: + self.con = eng.connect() + dataset = self.request.json_body + result = self.con.execute(godown.delete().where(godown.c.goid==dataset["goid"])) + return {"gkstatus":enumdict["Success"]} + except exc.IntegrityError: + return {"gkstatus":enumdict["ActionDisallowed"]} + except: + return {"gkstatus":enumdict["ConnectionFailed"] } + finally: + self.con.close() - @view_config(request_method='GET', request_param='type=lastfivegodown', renderer ='json') - def lastfivegodata(self): - try: - token = self.request.headers["gktoken"] - except: - return {"gkstatus": gkcore.enumdict["UnauthorisedAccess"]} - authDetails = authCheck(token) - if authDetails["auth"] == False: - return {"gkstatus": gkcore.enumdict["UnauthorisedAccess"]} - else: - try: - self.con = eng.connect() - result = self.con.execute(select([godown]).where(godown.c.orgcode==authDetails["orgcode"]).order_by(godown.c.goid.desc()).limit(5)) - godowns = [] - srno=1 - for row in result: - godowns.append({"goname": row["goname"], "goaddr": row["goaddr"], "state":row["state"]}) - srno = srno+1 - return {"gkstatus": gkcore.enumdict["Success"], "gkresult":godowns } - except: - return {"gkstatus":gkcore.enumdict["ConnectionFailed"] } - finally: - self.con.close() + @view_config(request_method='GET', request_param='type=lastfivegodown', renderer ='json') + def lastfivegodata(self): + try: + token = self.request.headers["gktoken"] + except: + return {"gkstatus": gkcore.enumdict["UnauthorisedAccess"]} + authDetails = authCheck(token) + if authDetails["auth"] == False: + return {"gkstatus": gkcore.enumdict["UnauthorisedAccess"]} + else: + try: + self.con = eng.connect() + result = self.con.execute(select([godown]).where(godown.c.orgcode==authDetails["orgcode"]).order_by(godown.c.goid.desc()).limit(5)) + godowns = [] + srno=1 + for row in result: + godowns.append({"goname": row["goname"], "goaddr": row["goaddr"], "state":row["state"]}) + srno = srno+1 + return {"gkstatus": gkcore.enumdict["Success"], "gkresult":godowns } + except: + return {"gkstatus":gkcore.enumdict["ConnectionFailed"] } + finally: + self.con.close() -- GitLab From 070b325c7f767e20d1a8333fb090d05849ccc1c3 Mon Sep 17 00:00:00 2001 From: abhijith Date: Thu, 30 Nov 2017 13:07:43 +0530 Subject: [PATCH 03/56] A new view in Bill Wise API that returns all unadjusted invoices of an organisation. --- gkcore/views/api_billwise.py | 36 +++++++++++++++++++++++++++++++++--- 1 file changed, 33 insertions(+), 3 deletions(-) diff --git a/gkcore/views/api_billwise.py b/gkcore/views/api_billwise.py index 79c16ce..ec58365 100644 --- a/gkcore/views/api_billwise.py +++ b/gkcore/views/api_billwise.py @@ -147,7 +147,37 @@ It will be used for creating entries in the billwise table and updating it as ne return{"gkstatus":enumdict["Success"],"vouchers":unAdjReceipts,"invoices":unAdjInvoices} except: return{"gkstatus":enumdict["ConnectionFailed"]} - - - + @view_config(request_method='GET',renderer='json', request_param="type=all") + def getallUnadjustedBills(self): + """ + Purpose: + Gets the list of unadjusted invoices. + Description: + An invoice is considered unadjusted if it has not been paid or payment for it has not been received. + These are adjusted either while creating vouchers or while doing bill wise accounting. + This function returns a list of all unadjusted or partially adjusted bills of an organisation. + """ + try: + token = self.request.headers["gktoken"] + except: + return {"gkstatus": enumdict["UnauthorisedAccess"]} + authDetails = authCheck(token) + if authDetails["auth"]==False: + return {"gkstatus":enumdict["UnauthorisedAccess"]} + else: + try: + self.con = eng.connect() + # An empty list into which unadjusted invoices shall be appended. + unAdjInvoices = [] + # Fetching id, number, date, total amount and amount paid of all unpaid invoices. + # It is unadjusted if invoice total is greater that amount paid. + invoices = self.con.execute(select([invoice.c.invid,invoice.c.invoiceno,invoice.c.invoicedate,invoice.c.invoicetotal,invoice.c.amountpaid]).where(and_(invoice.c.invoicetotal > invoice.c.amountpaid, invoice.c.orgcode == authDetails["orgcode"]))) + invoicesData = invoices.fetchall() + # Appending dictionaries into empty list. + # Each dictionary has details of an invoice viz. id, number, date, total amount, amount paid and balance. + for inv in invoicesData: + unAdjInvoices.append({"invid":inv["invid"],"invoiceno":inv["invoiceno"],"invoicedate":datetime.strftime(inv["invoicedate"],'%d-%m-%Y'),"invoiceamount":"%.2f"%(float(inv["invoicetotal"])),"balanceamount":"%.2f"%(float(inv["invoicetotal"]-inv["amountpaid"]))}) + return{"gkstatus":enumdict["Success"],"invoices":unAdjInvoices} + except: + return{"gkstatus":enumdict["ConnectionFailed"]} -- GitLab From f432bfd90f19a6cbcd73b4cc181183b6a0e0872f Mon Sep 17 00:00:00 2001 From: abhijith Date: Thu, 30 Nov 2017 17:18:50 +0530 Subject: [PATCH 04/56] New function for getting invoices that have never been paid --- gkcore/views/api_billwise.py | 37 ++++++++++++++++++++++++++++++++++-- 1 file changed, 35 insertions(+), 2 deletions(-) diff --git a/gkcore/views/api_billwise.py b/gkcore/views/api_billwise.py index ec58365..16884c6 100644 --- a/gkcore/views/api_billwise.py +++ b/gkcore/views/api_billwise.py @@ -1,5 +1,5 @@ """ -Copyright (C) 2013, 2014, 2015, 2016 Digital Freedom Foundation +Copyright (C) 2013, 2014, 2015, 2016, 2017 Digital Freedom Foundation This file is part of GNUKhata:A modular,robust and Free Accounting System. GNUKhata is Free Software; you can redistribute it and/or modify @@ -154,7 +154,7 @@ It will be used for creating entries in the billwise table and updating it as ne Purpose: Gets the list of unadjusted invoices. Description: - An invoice is considered unadjusted if it has not been paid or payment for it has not been received. + An invoice is considered unadjusted if it has not been paid or payment for it has not been received completely. These are adjusted either while creating vouchers or while doing bill wise accounting. This function returns a list of all unadjusted or partially adjusted bills of an organisation. """ @@ -181,3 +181,36 @@ It will be used for creating entries in the billwise table and updating it as ne return{"gkstatus":enumdict["Success"],"invoices":unAdjInvoices} except: return{"gkstatus":enumdict["ConnectionFailed"]} + @view_config(request_method='GET',renderer='json', request_param="type=pending") + def getallPendingBills(self): + """ + Purpose: + Gets the list of pending invoices. + Description: + An invoice is considered pending if it has not been paid or no payment for it has not been received. + These are adjusted either while creating vouchers or while doing bill wise accounting. + This function returns a list of all pending bills of an organisation. + """ + try: + token = self.request.headers["gktoken"] + except: + return {"gkstatus": enumdict["UnauthorisedAccess"]} + authDetails = authCheck(token) + if authDetails["auth"]==False: + return {"gkstatus":enumdict["UnauthorisedAccess"]} + else: + try: + self.con = eng.connect() + # An empty list into which pending invoices shall be appended. + unAdjInvoices = [] + # Fetching id, number, date, total amount and amount paid of all unpaid invoices. + # It is pending if invoice total is greater that amount paid. + invoices = self.con.execute(select([invoice.c.invid,invoice.c.invoiceno,invoice.c.invoicedate,invoice.c.invoicetotal,invoice.c.amountpaid]).where(and_(invoice.c.amountpaid == 0, invoice.c.orgcode == authDetails["orgcode"]))) + invoicesData = invoices.fetchall() + # Appending dictionaries into empty list. + # Each dictionary has details of an invoice viz. id, number, date, total amount, amount paid and balance. + for inv in invoicesData: + unAdjInvoices.append({"invid":inv["invid"],"invoiceno":inv["invoiceno"],"invoicedate":datetime.strftime(inv["invoicedate"],'%d-%m-%Y'),"invoiceamount":"%.2f"%(float(inv["invoicetotal"])),"balanceamount":"%.2f"%(float(inv["invoicetotal"]-inv["amountpaid"]))}) + return{"gkstatus":enumdict["Success"],"invoices":unAdjInvoices} + except: + return{"gkstatus":enumdict["ConnectionFailed"]} -- GitLab From 690a87e7d1fdd3a0ec009de50cb06137af51b083 Mon Sep 17 00:00:00 2001 From: abhijith Date: Fri, 1 Dec 2017 12:39:21 +0530 Subject: [PATCH 05/56] Cash Memos are excluded from unpaid invoices --- gkcore/views/api_billwise.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/gkcore/views/api_billwise.py b/gkcore/views/api_billwise.py index 16884c6..38343ee 100644 --- a/gkcore/views/api_billwise.py +++ b/gkcore/views/api_billwise.py @@ -172,7 +172,7 @@ It will be used for creating entries in the billwise table and updating it as ne unAdjInvoices = [] # Fetching id, number, date, total amount and amount paid of all unpaid invoices. # It is unadjusted if invoice total is greater that amount paid. - invoices = self.con.execute(select([invoice.c.invid,invoice.c.invoiceno,invoice.c.invoicedate,invoice.c.invoicetotal,invoice.c.amountpaid]).where(and_(invoice.c.invoicetotal > invoice.c.amountpaid, invoice.c.orgcode == authDetails["orgcode"]))) + invoices = self.con.execute(select([invoice.c.invid,invoice.c.invoiceno,invoice.c.invoicedate,invoice.c.invoicetotal,invoice.c.amountpaid]).where(and_(invoice.c.invoicetotal > invoice.c.amountpaid, invoice.c.icflag == 9, invoice.c.orgcode == authDetails["orgcode"]))) invoicesData = invoices.fetchall() # Appending dictionaries into empty list. # Each dictionary has details of an invoice viz. id, number, date, total amount, amount paid and balance. @@ -205,7 +205,7 @@ It will be used for creating entries in the billwise table and updating it as ne unAdjInvoices = [] # Fetching id, number, date, total amount and amount paid of all unpaid invoices. # It is pending if invoice total is greater that amount paid. - invoices = self.con.execute(select([invoice.c.invid,invoice.c.invoiceno,invoice.c.invoicedate,invoice.c.invoicetotal,invoice.c.amountpaid]).where(and_(invoice.c.amountpaid == 0, invoice.c.orgcode == authDetails["orgcode"]))) + invoices = self.con.execute(select([invoice.c.invid,invoice.c.invoiceno,invoice.c.invoicedate,invoice.c.invoicetotal,invoice.c.amountpaid]).where(and_(invoice.c.amountpaid == 0, invoice.c.icflag == 9, invoice.c.orgcode == authDetails["orgcode"]))) invoicesData = invoices.fetchall() # Appending dictionaries into empty list. # Each dictionary has details of an invoice viz. id, number, date, total amount, amount paid and balance. -- GitLab From 53802bf0ab4ecf3f1fe4d43c5d62a12a2ffb5f09 Mon Sep 17 00:00:00 2001 From: Prajkta_Patkar Date: Sat, 2 Dec 2017 15:58:53 +0530 Subject: [PATCH 06/56] duplicate entry exception added --- gkcore/views/api_account.py | 460 ++++++++++++++++++------------------ 1 file changed, 232 insertions(+), 228 deletions(-) diff --git a/gkcore/views/api_account.py b/gkcore/views/api_account.py index d50ca7b..41b1f19 100644 --- a/gkcore/views/api_account.py +++ b/gkcore/views/api_account.py @@ -1,6 +1,7 @@ """ -Copyright (C) 2013, 2014, 2015, 2016 Digital Freedom Foundation +Copyright (C) 2013, 2014, 2015, 2016, Digital Freedom Foundation +Copyright (C) 2017 Digital Freedom Foundation & Accion Labs This file is part of GNUKhata:A modular,robust and Free Accounting System. GNUKhata is Free Software; you can redistribute it and/or modify @@ -23,7 +24,7 @@ Contributors: "Krishnakant Mane" "Ishan Masdekar " "Navin Karkera" -Prajkta Patkar" +Prajkta Patkar" """ from gkcore import eng, enumdict @@ -58,240 +59,243 @@ refer to the __init__.py of main gkcore package for details on routing url """ @view_defaults(route_name='accounts') class api_account(object): - #constructor will initialise request. - def __init__(self,request): - self.request = Request - self.request = request - self.con = Connection - print "accounts initialized" + #constructor will initialise request. + def __init__(self,request): + self.request = Request + self.request = request + self.con = Connection + print "accounts initialized" - @view_config(request_method='POST',renderer='json') - def addAccount(self): - """ - purpose: - Adds an account under either a group or it's subgroup. - Request_method is post which means adding a resource. - returns a json object containing success result as true if account is created. - Alchemy expression language will be used for inserting into accounts table. - The data is fetched from request.json_body. - Expects accountname,groupsubgroupcode and opening balance. - Function will only proceed if auth check is successful, because orgcode needed as a common parameter can be procured only through the said method. - """ - try: - token = self.request.headers["gktoken"] - except: - return {"gkstatus": enumdict["UnauthorisedAccess"]} - authDetails = authCheck(token) - if authDetails["auth"]==False: - return {"gkstatus":enumdict["UnauthorisedAccess"]} - else: - try: - self.con = eng.connect() - dataset = self.request.json_body - dataset["orgcode"] = authDetails["orgcode"] - result = self.con.execute(gkdb.accounts.insert(),[dataset]) - self.con.close() - return {"gkstatus":enumdict["Success"]} - except exc.IntegrityError: - self.con.close() - return {"gkstatus":enumdict["DuplicateEntry"]} - except: - self.con.close() - return {"gkstatus":enumdict["ConnectionFailed"]} + @view_config(request_method='POST',renderer='json') + def addAccount(self): + """ + purpose: + Adds an account under either a group or it's subgroup. + Request_method is post which means adding a resource. + returns a json object containing success result as true if account is created. + Alchemy expression language will be used for inserting into accounts table. + The data is fetched from request.json_body. + Expects accountname,groupsubgroupcode and opening balance. + Function will only proceed if auth check is successful, because orgcode needed as a common parameter can be procured only through the said method. + """ + try: + token = self.request.headers["gktoken"] + except: + return {"gkstatus": enumdict["UnauthorisedAccess"]} + authDetails = authCheck(token) + if authDetails["auth"]==False: + return {"gkstatus":enumdict["UnauthorisedAccess"]} + else: + try: + self.con = eng.connect() + dataset = self.request.json_body + dataset["orgcode"] = authDetails["orgcode"] + result = self.con.execute(gkdb.accounts.insert(),[dataset]) + self.con.close() + return {"gkstatus":enumdict["Success"]} + except exc.IntegrityError: + self.con.close() + return {"gkstatus":enumdict["DuplicateEntry"]} + except: + self.con.close() + return {"gkstatus":enumdict["ConnectionFailed"]} - @view_config(route_name='account', request_method='GET',renderer='json') - def getAccount(self): - """ - Purpose: - Returns an account given it's account code. - Returns a json object containing: - *accountcode - *accountname - *openingbal as float - *groupsubgroupcode - The request_method is get meaning retriving data. - The route_name has been override here to make a special call which does not come under view_default. - parameter will be taken from request.matchdict in a get request. - Function will only proceed if auth check is successful, because orgcode needed as a common parameter can be procured only through the said method. - """ - try: - token = self.request.headers["gktoken"] - except: - return {"gkstatus": enumdict["UnauthorisedAccess"]} - authDetails = authCheck(token) - if authDetails["auth"]==False: - return {"gkstatus":enumdict["UnauthorisedAccess"]} - else: - try: - self.con = eng.connect() - result = self.con.execute(select([gkdb.accounts]).where(gkdb.accounts.c.accountcode==self.request.matchdict["accountcode"])) - row = result.fetchone() - acc={"accountcode":row["accountcode"], "accountname":row["accountname"], "openingbal":"%.2f"%float(row["openingbal"]),"groupcode":row["groupcode"]} - self.con.close() - return {"gkstatus": enumdict["Success"], "gkresult":acc} - except: - self.con.close() - return {"gkstatus":enumdict["ConnectionFailed"] } + @view_config(route_name='account', request_method='GET',renderer='json') + def getAccount(self): + """ + Purpose: + Returns an account given it's account code. + Returns a json object containing: + *accountcode + *accountname + *openingbal as float + *groupsubgroupcode + The request_method is get meaning retriving data. + The route_name has been override here to make a special call which does not come under view_default. + parameter will be taken from request.matchdict in a get request. + Function will only proceed if auth check is successful, because orgcode needed as a common parameter can be procured only through the said method. + """ + try: + token = self.request.headers["gktoken"] + except: + return {"gkstatus": enumdict["UnauthorisedAccess"]} + authDetails = authCheck(token) + if authDetails["auth"]==False: + return {"gkstatus":enumdict["UnauthorisedAccess"]} + else: + try: + self.con = eng.connect() + result = self.con.execute(select([gkdb.accounts]).where(gkdb.accounts.c.accountcode==self.request.matchdict["accountcode"])) + row = result.fetchone() + acc={"accountcode":row["accountcode"], "accountname":row["accountname"], "openingbal":"%.2f"%float(row["openingbal"]),"groupcode":row["groupcode"]} + self.con.close() + return {"gkstatus": enumdict["Success"], "gkresult":acc} + except: + self.con.close() + return {"gkstatus":enumdict["ConnectionFailed"] } - @view_config(request_method='GET', renderer ='json') - def getAllAccounts(self): - try: - token = self.request.headers["gktoken"] - except: - return {"gkstatus": enumdict["UnauthorisedAccess"]} - authDetails = authCheck(token) - if authDetails["auth"]==False: - return {"gkstatus":enumdict["UnauthorisedAccess"]} - else: - try: - self.con = eng.connect() - result = self.con.execute(select([gkdb.accounts]).where(gkdb.accounts.c.orgcode==authDetails["orgcode"]).order_by(gkdb.accounts.c.accountname)) - accs = [] - srno=1 - for accrow in result: - g = gkdb.groupsubgroups.alias("g") - sg = gkdb.groupsubgroups.alias("sg") + @view_config(request_method='GET', renderer ='json') + def getAllAccounts(self): + try: + token = self.request.headers["gktoken"] + except: + return {"gkstatus": enumdict["UnauthorisedAccess"]} + authDetails = authCheck(token) + if authDetails["auth"]==False: + return {"gkstatus":enumdict["UnauthorisedAccess"]} + else: + try: + self.con = eng.connect() + result = self.con.execute(select([gkdb.accounts]).where(gkdb.accounts.c.orgcode==authDetails["orgcode"]).order_by(gkdb.accounts.c.accountname)) + accs = [] + srno=1 + for accrow in result: + g = gkdb.groupsubgroups.alias("g") + sg = gkdb.groupsubgroups.alias("sg") - resultset = self.con.execute(select([(g.c.groupcode).label('groupcode'),(g.c.groupname).label('groupname'),(sg.c.groupcode).label('subgroupcode'),(sg.c.groupname).label('subgroupname')]).where(or_(and_(g.c.groupcode==int(accrow["groupcode"]),g.c.subgroupof==null(),sg.c.groupcode==int(accrow["groupcode"]),sg.c.subgroupof==null()),and_(g.c.groupcode==sg.c.subgroupof,sg.c.groupcode==int(accrow["groupcode"]))))) - grprow = resultset.fetchone() - if grprow["groupcode"]==grprow["subgroupcode"]: - accs.append({"srno":srno,"accountcode":accrow["accountcode"], "accountname":accrow["accountname"], "openingbal":"%.2f"%float(accrow["openingbal"]),"groupcode":grprow["groupcode"],"groupname":grprow["groupname"],"subgroupcode":"","subgroupname":""}) - else: - accs.append({"srno":srno,"accountcode":accrow["accountcode"], "accountname":accrow["accountname"], "openingbal":"%.2f"%float(accrow["openingbal"]),"groupcode":grprow["groupcode"],"groupname":grprow["groupname"],"subgroupcode":grprow["subgroupcode"],"subgroupname":grprow["subgroupname"]}) - srno = srno+1 - self.con.close() - return {"gkstatus": enumdict["Success"], "gkresult":accs} - except: - self.con.close() - return {"gkstatus":enumdict["ConnectionFailed"] } + resultset = self.con.execute(select([(g.c.groupcode).label('groupcode'),(g.c.groupname).label('groupname'),(sg.c.groupcode).label('subgroupcode'),(sg.c.groupname).label('subgroupname')]).where(or_(and_(g.c.groupcode==int(accrow["groupcode"]),g.c.subgroupof==null(),sg.c.groupcode==int(accrow["groupcode"]),sg.c.subgroupof==null()),and_(g.c.groupcode==sg.c.subgroupof,sg.c.groupcode==int(accrow["groupcode"]))))) + grprow = resultset.fetchone() + if grprow["groupcode"]==grprow["subgroupcode"]: + accs.append({"srno":srno,"accountcode":accrow["accountcode"], "accountname":accrow["accountname"], "openingbal":"%.2f"%float(accrow["openingbal"]),"groupcode":grprow["groupcode"],"groupname":grprow["groupname"],"subgroupcode":"","subgroupname":""}) + else: + accs.append({"srno":srno,"accountcode":accrow["accountcode"], "accountname":accrow["accountname"], "openingbal":"%.2f"%float(accrow["openingbal"]),"groupcode":grprow["groupcode"],"groupname":grprow["groupname"],"subgroupcode":grprow["subgroupcode"],"subgroupname":grprow["subgroupname"]}) + srno = srno+1 + self.con.close() + return {"gkstatus": enumdict["Success"], "gkresult":accs} + except: + self.con.close() + return {"gkstatus":enumdict["ConnectionFailed"] } - @view_config(request_method='GET',request_param='accbygrp', renderer ='json') - def getAllAccountsByGroup(self): - """ - Purpose: - This function returns accountcode , accountname and openingbalance for a certain groupcode (group) which has been provided. - """ - try: - token = self.request.headers["gktoken"] - except: - return {"gkstatus": enumdict["UnauthorisedAccess"]} - authDetails = authCheck(token) - if authDetails["auth"]==False: - return {"gkstatus":enumdict["UnauthorisedAccess"]} - else: - try: - self.con = eng.connect() - result = self.con.execute(select([accounts.c.accountcode,accounts.c.accountname,accounts.c.openingbal]).where(and_(accounts.c.orgcode==authDetails["orgcode"],accounts.c.groupcode==self.request.params["groupcode"]))) - accData = result.fetchall() - allAcc = [] - for row in accData: - allAcc.append({"accountcode":row["accountcode"], "accountname":row["accountname"],"openingbal":"%.2f"%float(row["openingbal"])}) - self.con.close() - return {"gkstatus": enumdict["Success"], "gkresult":allAcc} - except: - self.con.close() - return {"gkstatus":enumdict["ConnectionFailed"] } + @view_config(request_method='GET',request_param='accbygrp', renderer ='json') + def getAllAccountsByGroup(self): + """ + Purpose: + This function returns accountcode , accountname and openingbalance for a certain groupcode (group) which has been provided. + """ + try: + token = self.request.headers["gktoken"] + except: + return {"gkstatus": enumdict["UnauthorisedAccess"]} + authDetails = authCheck(token) + if authDetails["auth"]==False: + return {"gkstatus":enumdict["UnauthorisedAccess"]} + else: + try: + self.con = eng.connect() + result = self.con.execute(select([accounts.c.accountcode,accounts.c.accountname,accounts.c.openingbal]).where(and_(accounts.c.orgcode==authDetails["orgcode"],accounts.c.groupcode==self.request.params["groupcode"]))) + accData = result.fetchall() + allAcc = [] + for row in accData: + allAcc.append({"accountcode":row["accountcode"], "accountname":row["accountname"],"openingbal":"%.2f"%float(row["openingbal"])}) + self.con.close() + return {"gkstatus": enumdict["Success"], "gkresult":allAcc} + except: + self.con.close() + return {"gkstatus":enumdict["ConnectionFailed"] } - @view_config(request_method='GET',request_param='acclist', renderer ='json') - def getAccountslist(self): - try: - token = self.request.headers["gktoken"] - except: - return {"gkstatus": enumdict["UnauthorisedAccess"]} - authDetails = authCheck(token) - if authDetails["auth"]==False: - return {"gkstatus":enumdict["UnauthorisedAccess"]} - else: - try: - self.con = eng.connect() - accData = self.con.execute(select([accounts.c.accountcode,accounts.c.accountname]).where(accounts.c.orgcode == authDetails["orgcode"])) - accRows = accData.fetchall() - accList = {} - for row in accRows: - accList[row["accountname"]]= row["accountcode"] - - return {"gkstatus": enumdict["Success"], "gkresult":accList} - except: - self.con.close() - return {"gkstatus":enumdict["ConnectionFailed"] } - finally: - self.con.close() + @view_config(request_method='GET',request_param='acclist', renderer ='json') + def getAccountslist(self): + try: + token = self.request.headers["gktoken"] + except: + return {"gkstatus": enumdict["UnauthorisedAccess"]} + authDetails = authCheck(token) + if authDetails["auth"]==False: + return {"gkstatus":enumdict["UnauthorisedAccess"]} + else: + try: + self.con = eng.connect() + accData = self.con.execute(select([accounts.c.accountcode,accounts.c.accountname]).where(accounts.c.orgcode == authDetails["orgcode"])) + accRows = accData.fetchall() + accList = {} + for row in accRows: + accList[row["accountname"]]= row["accountcode"] + + return {"gkstatus": enumdict["Success"], "gkresult":accList} + except: + self.con.close() + return {"gkstatus":enumdict["ConnectionFailed"] } + finally: + self.con.close() - @view_config(request_method='GET',request_param='find=exists', renderer ='json') - def accountExists(self): - try: - token = self.request.headers["gktoken"] - except: - return {"gkstatus": enumdict["UnauthorisedAccess"]} - authDetails = authCheck(token) - if authDetails["auth"]==False: - return {"gkstatus":enumdict["UnauthorisedAccess"]} - else: - try: - self.con = eng.connect() - accountname = self.request.params["accountname"] - result = self.con.execute(select([func.count(gkdb.accounts.c.accountname).label('acc')]).where(and_(gkdb.accounts.c.accountname==accountname,gkdb.accounts.c.orgcode==authDetails["orgcode"]))) - acccount = result.fetchone() - if acccount["acc"]>0: - self.con.close() - return {"gkstatus": enumdict["DuplicateEntry"]} - else: - self.con.close() - return {"gkstatus": enumdict["Success"]} - except: - self.con.close() - return {"gkstatus":enumdict["ConnectionFailed"] } + @view_config(request_method='GET',request_param='find=exists', renderer ='json') + def accountExists(self): + try: + token = self.request.headers["gktoken"] + except: + return {"gkstatus": enumdict["UnauthorisedAccess"]} + authDetails = authCheck(token) + if authDetails["auth"]==False: + return {"gkstatus":enumdict["UnauthorisedAccess"]} + else: + try: + self.con = eng.connect() + accountname = self.request.params["accountname"] + result = self.con.execute(select([func.count(gkdb.accounts.c.accountname).label('acc')]).where(and_(gkdb.accounts.c.accountname==accountname,gkdb.accounts.c.orgcode==authDetails["orgcode"]))) + acccount = result.fetchone() + if acccount["acc"]>0: + self.con.close() + return {"gkstatus": enumdict["DuplicateEntry"]} + else: + self.con.close() + return {"gkstatus": enumdict["Success"]} + except: + self.con.close() + return {"gkstatus":enumdict["ConnectionFailed"] } - @view_config(request_method='PUT', renderer='json') - def editAccount(self): - try: - token = self.request.headers["gktoken"] - except: - return {"gkstatus": enumdict["UnauthorisedAccess"]} - authDetails = authCheck(token) - if authDetails["auth"]==False: - return {"gkstatus":enumdict["UnauthorisedAccess"]} - else: - try: - self.con = eng.connect() - dataset = self.request.json_body - result = self.con.execute(gkdb.accounts.update().where(gkdb.accounts.c.accountcode==dataset["accountcode"]).values(dataset)) - self.con.close() - return {"gkstatus":enumdict["Success"]} - except: - self.con.close() - return {"gkstatus":enumdict["ConnectionFailed"]} + @view_config(request_method='PUT', renderer='json') + def editAccount(self): + try: + token = self.request.headers["gktoken"] + except: + return {"gkstatus": enumdict["UnauthorisedAccess"]} + authDetails = authCheck(token) + if authDetails["auth"]==False: + return {"gkstatus":enumdict["UnauthorisedAccess"]} + else: + try: + self.con = eng.connect() + dataset = self.request.json_body + result = self.con.execute(gkdb.accounts.update().where(gkdb.accounts.c.accountcode==dataset["accountcode"]).values(dataset)) + self.con.close() + return {"gkstatus":enumdict["Success"]} + except exc.IntegrityError: + self.con.close() + return {"gkstatus":enumdict["DuplicateEntry"]} + except: + self.con.close() + return {"gkstatus":enumdict["ConnectionFailed"]} - @view_config(request_method='DELETE', renderer ='json') - def deleteAccount(self): - try: - token = self.request.headers["gktoken"] - except: - return {"gkstatus": enumdict["UnauthorisedAccess"]} - authDetails = authCheck(token) - if authDetails["auth"]==False: - return {"gkstatus":enumdict["UnauthorisedAccess"]} - else: - try: - self.con = eng.connect() - user=self.con.execute(select([gkdb.users.c.userrole]).where(gkdb.users.c.userid == authDetails["userid"] )) - userRole = user.fetchone() - dataset = self.request.json_body - if userRole[0]==-1: - vouchercountdata = self.con.execute(select([gkdb.accounts.c.vouchercount]).where(gkdb.accounts.c.accountcode==dataset["accountcode"])) - vouchercountrow = vouchercountdata.fetchone() - if vouchercountrow["vouchercount"]!=0: - self.con.close() - return {"gkstatus":enumdict["ActionDisallowed"]} - else: - result = self.con.execute(gkdb.accounts.delete().where(gkdb.accounts.c.accountcode==dataset["accountcode"])) - self.con.close() - return {"gkstatus":enumdict["Success"]} - else: - self.con.close() - return {"gkstatus": enumdict["BadPrivilege"]} - except: - self.con.close() - return {"gkstatus":enumdict["ConnectionFailed"] } + @view_config(request_method='DELETE', renderer ='json') + def deleteAccount(self): + try: + token = self.request.headers["gktoken"] + except: + return {"gkstatus": enumdict["UnauthorisedAccess"]} + authDetails = authCheck(token) + if authDetails["auth"]==False: + return {"gkstatus":enumdict["UnauthorisedAccess"]} + else: + try: + self.con = eng.connect() + user=self.con.execute(select([gkdb.users.c.userrole]).where(gkdb.users.c.userid == authDetails["userid"] )) + userRole = user.fetchone() + dataset = self.request.json_body + if userRole[0]==-1: + vouchercountdata = self.con.execute(select([gkdb.accounts.c.vouchercount]).where(gkdb.accounts.c.accountcode==dataset["accountcode"])) + vouchercountrow = vouchercountdata.fetchone() + if vouchercountrow["vouchercount"]!=0: + self.con.close() + return {"gkstatus":enumdict["ActionDisallowed"]} + else: + result = self.con.execute(gkdb.accounts.delete().where(gkdb.accounts.c.accountcode==dataset["accountcode"])) + self.con.close() + return {"gkstatus":enumdict["Success"]} + else: + self.con.close() + return {"gkstatus": enumdict["BadPrivilege"]} + except: + self.con.close() + return {"gkstatus":enumdict["ConnectionFailed"] } -- GitLab From 911bb12da8aafd161d06587723a1bbd186fca1d0 Mon Sep 17 00:00:00 2001 From: RESHMA Date: Wed, 29 Nov 2017 18:17:18 +0530 Subject: [PATCH 07/56] 'consignee' field is added in delchal table of type JSONB. --- gkcore/models/gkdb.py | 1 + 1 file changed, 1 insertion(+) diff --git a/gkcore/models/gkdb.py b/gkcore/models/gkdb.py index 4c0d982..b24f584 100644 --- a/gkcore/models/gkdb.py +++ b/gkcore/models/gkdb.py @@ -361,6 +361,7 @@ delchal = Table('delchal',metadata, Column('noofpackages', Integer, nullable=False), Column('modeoftransport', UnicodeText), Column('attachment',JSON), + Column('consignee',JSONB), Column('attachmentcount',Integer,default=0), Column('orgcode',Integer, ForeignKey('organisation.orgcode',ondelete="CASCADE"), nullable=False), Column('custid',Integer, ForeignKey('customerandsupplier.custid')), -- GitLab From 98546f99e4fc9b0f85fb4414d55a54cf67d57d64 Mon Sep 17 00:00:00 2001 From: RESHMA Date: Wed, 29 Nov 2017 18:50:51 +0530 Subject: [PATCH 08/56] changes in api_organisation.py for consignee field in delchal table. --- gkcore/views/api_organisation.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/gkcore/views/api_organisation.py b/gkcore/views/api_organisation.py index 281a3e0..c201809 100644 --- a/gkcore/views/api_organisation.py +++ b/gkcore/views/api_organisation.py @@ -60,6 +60,7 @@ class api_organisation(object): """ self.con = eng.connect() try: + self.con.execute(select([func.count(gkdb.delchal.c.consignee)])) self.con.execute(select([func.count(gkdb.invoice.c.orgstategstin)])) self.con.execute(select([func.count(gkdb.invoice.c.cess)])) self.con.execute(select([func.count(gkdb.state.c.statecode)])) @@ -83,6 +84,7 @@ class api_organisation(object): self.con.execute(select(gkdb.organisation.c.billflag)) self.con.execute(select([func.count(gkdb.billwise.c.billid)])) except: + self.con.execute("alter table delchal add consignee jsonb") self.con.execute("alter table invoice add orgstategstin text") self.con.execute("alter table invoice add cess jsonb") self.con.execute("alter table product add UNIQUE(productdesc,orgcode)") -- GitLab From 0abf207ab5153c722055dd065948dfc056ff9e58 Mon Sep 17 00:00:00 2001 From: RESHMA Date: Sat, 2 Dec 2017 17:29:39 +0530 Subject: [PATCH 09/56] congnee details getting from gkcore. --- gkcore/views/api_delchal.py | 1 + 1 file changed, 1 insertion(+) diff --git a/gkcore/views/api_delchal.py b/gkcore/views/api_delchal.py index e7fddcf..9883fff 100644 --- a/gkcore/views/api_delchal.py +++ b/gkcore/views/api_delchal.py @@ -231,6 +231,7 @@ class api_delchal(object): "dcflag":delchaldata["dcflag"], "issuername":delchaldata["issuername"], "designation":delchaldata["designation"], + "consignee":delchaldata["consignee"], "dcdate":datetime.strftime(delchaldata["dcdate"],'%d-%m-%Y'), "custid":delchaldata["custid"],"custname":custname["custname"], "custstate":custname["state"], -- GitLab From ec05f8fc76b5b229f56c09d23b1edc96e33cd5cf Mon Sep 17 00:00:00 2001 From: RESHMA Date: Wed, 6 Dec 2017 12:30:57 +0530 Subject: [PATCH 10/56] Accion Labs name is added in copyright. --- gkcore/models/gkdb.py | 1 + gkcore/views/api_delchal.py | 3 +++ gkcore/views/api_organisation.py | 1 + 3 files changed, 5 insertions(+) diff --git a/gkcore/models/gkdb.py b/gkcore/models/gkdb.py index b24f584..980ece7 100644 --- a/gkcore/models/gkdb.py +++ b/gkcore/models/gkdb.py @@ -1,6 +1,7 @@ """ Copyright (C) 2013, 2014, 2015, 2016 Digital Freedom Foundation +Copyright (C) 2017 Digital Freedom Foundation & Accion Labs This file is part of GNUKhata:A modular,robust and Free Accounting System. GNUKhata is Free Software; you can redistribute it and/or modify diff --git a/gkcore/views/api_delchal.py b/gkcore/views/api_delchal.py index 9883fff..433be59 100644 --- a/gkcore/views/api_delchal.py +++ b/gkcore/views/api_delchal.py @@ -1,6 +1,7 @@ """ Copyright (C) 2013, 2014, 2015, 2016 Digital Freedom Foundation +Copyright (C) 2017 Digital Freedom Foundation & Accion Labs This file is part of GNUKhata:A modular,robust and Free Accounting System. GNUKhata is Free Software; you can redistribute it and/or modify @@ -23,6 +24,8 @@ Contributors: "Krishnakant Mane" "Ishan Masdekar " "Navin Karkera" +"Reshma Bhatawade" + """ diff --git a/gkcore/views/api_organisation.py b/gkcore/views/api_organisation.py index c201809..0910f65 100644 --- a/gkcore/views/api_organisation.py +++ b/gkcore/views/api_organisation.py @@ -1,6 +1,7 @@ """ Copyright (C) 2013, 2014, 2015, 2016 Digital Freedom Foundation +Copyright (C) 2017 Digital Freedom Foundation & Accion Labs This file is part of GNUKhata:A modular,robust and Free Accounting System. GNUKhata is Free Software; you can redistribute it and/or modify -- GitLab From 226a6a8a2dd30af21e7fb51c1d534fa5e6d25ade Mon Sep 17 00:00:00 2001 From: abhijith Date: Fri, 1 Dec 2017 16:41:17 +0530 Subject: [PATCH 11/56] API for Unpaid Invoices now returns customer data --- gkcore/views/api_billwise.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/gkcore/views/api_billwise.py b/gkcore/views/api_billwise.py index 38343ee..ac96855 100644 --- a/gkcore/views/api_billwise.py +++ b/gkcore/views/api_billwise.py @@ -172,12 +172,14 @@ It will be used for creating entries in the billwise table and updating it as ne unAdjInvoices = [] # Fetching id, number, date, total amount and amount paid of all unpaid invoices. # It is unadjusted if invoice total is greater that amount paid. - invoices = self.con.execute(select([invoice.c.invid,invoice.c.invoiceno,invoice.c.invoicedate,invoice.c.invoicetotal,invoice.c.amountpaid]).where(and_(invoice.c.invoicetotal > invoice.c.amountpaid, invoice.c.icflag == 9, invoice.c.orgcode == authDetails["orgcode"]))) + invoices = self.con.execute(select([invoice.c.invid,invoice.c.invoiceno,invoice.c.invoicedate,invoice.c.invoicetotal,invoice.c.amountpaid, invoice.c.custid]).where(and_(invoice.c.invoicetotal > invoice.c.amountpaid, invoice.c.icflag == 9, invoice.c.orgcode == authDetails["orgcode"]))) invoicesData = invoices.fetchall() # Appending dictionaries into empty list. # Each dictionary has details of an invoice viz. id, number, date, total amount, amount paid and balance. for inv in invoicesData: - unAdjInvoices.append({"invid":inv["invid"],"invoiceno":inv["invoiceno"],"invoicedate":datetime.strftime(inv["invoicedate"],'%d-%m-%Y'),"invoiceamount":"%.2f"%(float(inv["invoicetotal"])),"balanceamount":"%.2f"%(float(inv["invoicetotal"]-inv["amountpaid"]))}) + custData = self.con.execute(select([customerandsupplier.c.custname, customerandsupplier.c.csflag, customerandsupplier.c.custid]).where(customerandsupplier.c.custid == inv["custid"])) + customerdata = custData.fetchone() + unAdjInvoices.append({"invid":inv["invid"],"invoiceno":inv["invoiceno"],"invoicedate":datetime.strftime(inv["invoicedate"],'%d-%m-%Y'),"invoicetotal":"%.2f"%(float(inv["invoicetotal"])),"balanceamount":"%.2f"%(float(inv["invoicetotal"]-inv["amountpaid"])), "customername":customerdata["custname"], "custid":customerdata["custid"], "csflag": customerdata["csflag"]}) return{"gkstatus":enumdict["Success"],"invoices":unAdjInvoices} except: return{"gkstatus":enumdict["ConnectionFailed"]} @@ -210,7 +212,7 @@ It will be used for creating entries in the billwise table and updating it as ne # Appending dictionaries into empty list. # Each dictionary has details of an invoice viz. id, number, date, total amount, amount paid and balance. for inv in invoicesData: - unAdjInvoices.append({"invid":inv["invid"],"invoiceno":inv["invoiceno"],"invoicedate":datetime.strftime(inv["invoicedate"],'%d-%m-%Y'),"invoiceamount":"%.2f"%(float(inv["invoicetotal"])),"balanceamount":"%.2f"%(float(inv["invoicetotal"]-inv["amountpaid"]))}) + unAdjInvoices.append({"invid":inv["invid"],"invoiceno":inv["invoiceno"],"invoicedate":datetime.strftime(inv["invoicedate"],'%d-%m-%Y'),"invoicetotal":"%.2f"%(float(inv["invoicetotal"])),"balanceamount":"%.2f"%(float(inv["invoicetotal"]-inv["amountpaid"]))}) return{"gkstatus":enumdict["Success"],"invoices":unAdjInvoices} except: return{"gkstatus":enumdict["ConnectionFailed"]} -- GitLab From 745373a925c116acccfc15fbf2b517808b6284fb Mon Sep 17 00:00:00 2001 From: abhijith Date: Fri, 1 Dec 2017 17:05:48 +0530 Subject: [PATCH 12/56] Now function for getting pending invoices also returns customer details --- gkcore/views/api_billwise.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/gkcore/views/api_billwise.py b/gkcore/views/api_billwise.py index ac96855..fdcf8eb 100644 --- a/gkcore/views/api_billwise.py +++ b/gkcore/views/api_billwise.py @@ -189,7 +189,7 @@ It will be used for creating entries in the billwise table and updating it as ne Purpose: Gets the list of pending invoices. Description: - An invoice is considered pending if it has not been paid or no payment for it has not been received. + An invoice is considered pending if it has not been paid or no payment for it has been received. These are adjusted either while creating vouchers or while doing bill wise accounting. This function returns a list of all pending bills of an organisation. """ @@ -207,12 +207,14 @@ It will be used for creating entries in the billwise table and updating it as ne unAdjInvoices = [] # Fetching id, number, date, total amount and amount paid of all unpaid invoices. # It is pending if invoice total is greater that amount paid. - invoices = self.con.execute(select([invoice.c.invid,invoice.c.invoiceno,invoice.c.invoicedate,invoice.c.invoicetotal,invoice.c.amountpaid]).where(and_(invoice.c.amountpaid == 0, invoice.c.icflag == 9, invoice.c.orgcode == authDetails["orgcode"]))) + invoices = self.con.execute(select([invoice.c.invid,invoice.c.invoiceno,invoice.c.invoicedate,invoice.c.invoicetotal,invoice.c.amountpaid, invoice.c.custid]).where(and_(invoice.c.amountpaid == 0, invoice.c.icflag == 9, invoice.c.orgcode == authDetails["orgcode"]))) invoicesData = invoices.fetchall() # Appending dictionaries into empty list. # Each dictionary has details of an invoice viz. id, number, date, total amount, amount paid and balance. for inv in invoicesData: - unAdjInvoices.append({"invid":inv["invid"],"invoiceno":inv["invoiceno"],"invoicedate":datetime.strftime(inv["invoicedate"],'%d-%m-%Y'),"invoicetotal":"%.2f"%(float(inv["invoicetotal"])),"balanceamount":"%.2f"%(float(inv["invoicetotal"]-inv["amountpaid"]))}) + custData = self.con.execute(select([customerandsupplier.c.custname, customerandsupplier.c.csflag, customerandsupplier.c.custid]).where(customerandsupplier.c.custid == inv["custid"])) + customerdata = custData.fetchone() + unAdjInvoices.append({"invid":inv["invid"],"invoiceno":inv["invoiceno"],"invoicedate":datetime.strftime(inv["invoicedate"],'%d-%m-%Y'),"invoicetotal":"%.2f"%(float(inv["invoicetotal"])),"balanceamount":"%.2f"%(float(inv["invoicetotal"]-inv["amountpaid"])), "customername":customerdata["custname"], "custid":customerdata["custid"], "csflag": customerdata["csflag"]}) return{"gkstatus":enumdict["Success"],"invoices":unAdjInvoices} except: return{"gkstatus":enumdict["ConnectionFailed"]} -- GitLab From ea3233e957d48cd620753713730210975c89a580 Mon Sep 17 00:00:00 2001 From: abhijith Date: Fri, 1 Dec 2017 17:37:51 +0530 Subject: [PATCH 13/56] Changed the name of key that returns customer name --- gkcore/views/api_billwise.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/gkcore/views/api_billwise.py b/gkcore/views/api_billwise.py index fdcf8eb..01dbac1 100644 --- a/gkcore/views/api_billwise.py +++ b/gkcore/views/api_billwise.py @@ -179,7 +179,7 @@ It will be used for creating entries in the billwise table and updating it as ne for inv in invoicesData: custData = self.con.execute(select([customerandsupplier.c.custname, customerandsupplier.c.csflag, customerandsupplier.c.custid]).where(customerandsupplier.c.custid == inv["custid"])) customerdata = custData.fetchone() - unAdjInvoices.append({"invid":inv["invid"],"invoiceno":inv["invoiceno"],"invoicedate":datetime.strftime(inv["invoicedate"],'%d-%m-%Y'),"invoicetotal":"%.2f"%(float(inv["invoicetotal"])),"balanceamount":"%.2f"%(float(inv["invoicetotal"]-inv["amountpaid"])), "customername":customerdata["custname"], "custid":customerdata["custid"], "csflag": customerdata["csflag"]}) + unAdjInvoices.append({"invid":inv["invid"],"invoiceno":inv["invoiceno"],"invoicedate":datetime.strftime(inv["invoicedate"],'%d-%m-%Y'),"invoicetotal":"%.2f"%(float(inv["invoicetotal"])),"balanceamount":"%.2f"%(float(inv["invoicetotal"]-inv["amountpaid"])), "custname":customerdata["custname"], "custid":customerdata["custid"], "csflag": customerdata["csflag"]}) return{"gkstatus":enumdict["Success"],"invoices":unAdjInvoices} except: return{"gkstatus":enumdict["ConnectionFailed"]} @@ -214,7 +214,7 @@ It will be used for creating entries in the billwise table and updating it as ne for inv in invoicesData: custData = self.con.execute(select([customerandsupplier.c.custname, customerandsupplier.c.csflag, customerandsupplier.c.custid]).where(customerandsupplier.c.custid == inv["custid"])) customerdata = custData.fetchone() - unAdjInvoices.append({"invid":inv["invid"],"invoiceno":inv["invoiceno"],"invoicedate":datetime.strftime(inv["invoicedate"],'%d-%m-%Y'),"invoicetotal":"%.2f"%(float(inv["invoicetotal"])),"balanceamount":"%.2f"%(float(inv["invoicetotal"]-inv["amountpaid"])), "customername":customerdata["custname"], "custid":customerdata["custid"], "csflag": customerdata["csflag"]}) + unAdjInvoices.append({"invid":inv["invid"],"invoiceno":inv["invoiceno"],"invoicedate":datetime.strftime(inv["invoicedate"],'%d-%m-%Y'),"invoicetotal":"%.2f"%(float(inv["invoicetotal"])),"balanceamount":"%.2f"%(float(inv["invoicetotal"]-inv["amountpaid"])), "custname":customerdata["custname"], "custid":customerdata["custid"], "csflag": customerdata["csflag"]}) return{"gkstatus":enumdict["Success"],"invoices":unAdjInvoices} except: return{"gkstatus":enumdict["ConnectionFailed"]} -- GitLab From 48ee8cd92485e1cdf39b85a0886240323291c730 Mon Sep 17 00:00:00 2001 From: RESHMA Date: Wed, 6 Dec 2017 19:52:19 +0530 Subject: [PATCH 14/56] License is changed. --- gkcore/models/gkdb.py | 2 +- gkcore/views/api_delchal.py | 2 +- gkcore/views/api_organisation.py | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/gkcore/models/gkdb.py b/gkcore/models/gkdb.py index 980ece7..6d5559c 100644 --- a/gkcore/models/gkdb.py +++ b/gkcore/models/gkdb.py @@ -1,7 +1,7 @@ """ Copyright (C) 2013, 2014, 2015, 2016 Digital Freedom Foundation -Copyright (C) 2017 Digital Freedom Foundation & Accion Labs +Copyright (C) 2017 Digital Freedom Foundation & Accion Labs Pvt. Ltd. This file is part of GNUKhata:A modular,robust and Free Accounting System. GNUKhata is Free Software; you can redistribute it and/or modify diff --git a/gkcore/views/api_delchal.py b/gkcore/views/api_delchal.py index 433be59..3096947 100644 --- a/gkcore/views/api_delchal.py +++ b/gkcore/views/api_delchal.py @@ -1,7 +1,7 @@ """ Copyright (C) 2013, 2014, 2015, 2016 Digital Freedom Foundation -Copyright (C) 2017 Digital Freedom Foundation & Accion Labs +Copyright (C) 2017 Digital Freedom Foundation & Accion Labs Pvt. Ltd. This file is part of GNUKhata:A modular,robust and Free Accounting System. GNUKhata is Free Software; you can redistribute it and/or modify diff --git a/gkcore/views/api_organisation.py b/gkcore/views/api_organisation.py index 0910f65..bb67d76 100644 --- a/gkcore/views/api_organisation.py +++ b/gkcore/views/api_organisation.py @@ -1,7 +1,7 @@ """ Copyright (C) 2013, 2014, 2015, 2016 Digital Freedom Foundation -Copyright (C) 2017 Digital Freedom Foundation & Accion Labs +Copyright (C) 2017 Digital Freedom Foundation & Accion Labs Pvt. Ltd. This file is part of GNUKhata:A modular,robust and Free Accounting System. GNUKhata is Free Software; you can redistribute it and/or modify -- GitLab From e92dcbd304ae82be4617324d3b7241292d331ea4 Mon Sep 17 00:00:00 2001 From: RESHMA Date: Thu, 14 Dec 2017 17:51:46 +0530 Subject: [PATCH 15/56] for getting custsup state code. --- gkcore/views/api_invoice.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/gkcore/views/api_invoice.py b/gkcore/views/api_invoice.py index 923bc93..84368f5 100644 --- a/gkcore/views/api_invoice.py +++ b/gkcore/views/api_invoice.py @@ -308,7 +308,8 @@ There will be an icFlag which will determine if it's an incrementing or decreme inv["inoutflag"] = int(inOutData["inout"]) custandsup = self.con.execute(select([customerandsupplier.c.custname,customerandsupplier.c.state, customerandsupplier.c.custaddr, customerandsupplier.c.custtan,customerandsupplier.c.gstin, customerandsupplier.c.csflag]).where(customerandsupplier.c.custid==invrow["custid"])) custData = custandsup.fetchone() - custSupDetails = {"custname":custData["custname"],"custsupstate":custData["state"],"custaddr":custData["custaddr"],"csflag":custData["csflag"]} + custsupstatecode = getStateCode(custData["state"],self.con)["statecode"] + custSupDetails = {"custname":custData["custname"],"custsupstate":custData["state"],"custaddr":custData["custaddr"],"csflag":custData["csflag"],"custsupstatecode":custsupstatecode} if custData["custtan"] != None: custSupDetails["custtin"] = custData["custtan"] if custData["gstin"] != None: @@ -323,7 +324,6 @@ There will be an icFlag which will determine if it's an incrementing or decreme except: custSupDetails["custgstin"] = None - inv["custSupDetails"] = custSupDetails #contents is a nested dictionary from invoice table. #It contains productcode as the key with a value as a dictionary. -- GitLab From 76abffcc157a27a79e113bfd276926e9cabfbf6e Mon Sep 17 00:00:00 2001 From: RESHMA Date: Mon, 18 Dec 2017 18:00:26 +0530 Subject: [PATCH 16/56] and condition is (i.e. added stock.c.dcinvtnflag==9) --- gkcore/views/api_invoice.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gkcore/views/api_invoice.py b/gkcore/views/api_invoice.py index 84368f5..3fc40ac 100644 --- a/gkcore/views/api_invoice.py +++ b/gkcore/views/api_invoice.py @@ -285,7 +285,7 @@ There will be an icFlag which will determine if it's an incrementing or decreme inv["transportationmode"] = invrow["transportationmode"] inv["vehicleno"] = invrow["vehicleno"] inv["reversecharge"] = invrow["reversecharge"] - inOut = self.con.execute(select([stock.c.inout]).where(stock.c.dcinvtnid==self.request.params["invid"])) + inOut = self.con.execute(select([stock.c.inout]).where(and_(stock.c.dcinvtnid==self.request.params["invid"], stock.c.dcinvtnflag==9))) inOutData = inOut.fetchone() if inOutData != None: inv["inoutflag"] = int(inOutData["inout"]) -- GitLab From 811c8ef8d74a55c9201f3db00334644bee71a45d Mon Sep 17 00:00:00 2001 From: Prajkta Patkar Date: Fri, 24 Nov 2017 18:47:00 +0530 Subject: [PATCH 17/56] code is running but it gets userid = 1 irrespective of mentioned in url --- gkcore/views/api_user.py | 22 +++++++++++++++++++++- 1 file changed, 21 insertions(+), 1 deletion(-) diff --git a/gkcore/views/api_user.py b/gkcore/views/api_user.py index 9bd222f..843014d 100644 --- a/gkcore/views/api_user.py +++ b/gkcore/views/api_user.py @@ -109,6 +109,9 @@ class api_user(object): return {"gkstatus":gkcore.enumdict["ConnectionFailed"] } finally: self.con.close() + """ + Following function is to retrive user data. + """ @view_config(route_name='user', request_method='GET',renderer='json') def getUser(self): try: @@ -121,15 +124,31 @@ class api_user(object): else: try: self.con = eng.connect() + print "i am here " + # get necessary user data by comparing userid + print authDetails["userid"] result = self.con.execute(select([gkdb.users]).where(gkdb.users.c.userid == authDetails["userid"] )) row = result.fetchone() - User = {"userid":row["userid"], "username":row["username"], "userrole":row["userrole"], "userquestion":row["userquestion"], "useranswer":row["useranswer"], "userpassword":row["userpassword"]} + User = {"userid":row["userid"], "username":row["username"], "userrole":row["userrole"], "userquestion":row["userquestion"], "useranswer":row["useranswer"]} + if(row["userrole"] == -1): + User["userroleName"]= "Admin" + elif(row["userrole"] == 0): + User["userroleName"] = "Manager" + elif(row["userrole"] == 1): + User["userroleName"] = "Operator" + elif(row["userrole"] == 2): + urole = "Internal Auditor" + + # -1 = admin,1 = operator,2 = manager , 3 = godown in charge + # if user is godown in-charge we need to retrive associated godown/s if User["userrole"] == 3: + User["userroleName"] = "Godown In Charge" usgo = self.con.execute(select([gkdb.usergodown.c.goid]).where(gkdb.users.c.userid == authDetails["userid"])) goids = usgo.fetchall() userGodowns = {} for g in goids: godownid = g["goid"] + # now we have associated godown ids, by which we can get godown name godownData = self.con.execute(select([gkdb.godown.c.goname]).where(gkdb.godown.c.goid == godownid)) gNameRow = godownData.fetchone() userGodowns[godownid] = gNameRow["goname"] @@ -140,6 +159,7 @@ class api_user(object): return {"gkstatus":gkcore.enumdict["ConnectionFailed"] } finally: self.con.close() + @view_config(request_method='PUT', renderer='json') def editUser(self): try: -- GitLab From 6195e9cfe8fedf2c89d4b28cadc6fa6de78d3c6c Mon Sep 17 00:00:00 2001 From: Prajkta Patkar Date: Mon, 27 Nov 2017 11:43:05 +0530 Subject: [PATCH 18/56] mistake corrected, data supposed to taken from request.params and not from authdetails --- gkcore/views/api_user.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/gkcore/views/api_user.py b/gkcore/views/api_user.py index 843014d..e949d55 100644 --- a/gkcore/views/api_user.py +++ b/gkcore/views/api_user.py @@ -116,6 +116,7 @@ class api_user(object): def getUser(self): try: token = self.request.headers["gktoken"] + print token except: return {"gkstatus": enumdict["UnauthorisedAccess"]} authDetails = authCheck(token) @@ -127,7 +128,7 @@ class api_user(object): print "i am here " # get necessary user data by comparing userid print authDetails["userid"] - result = self.con.execute(select([gkdb.users]).where(gkdb.users.c.userid == authDetails["userid"] )) + result = self.con.execute(select([gkdb.users]).where(gkdb.users.c.userid == self.request.params["userid"] )) row = result.fetchone() User = {"userid":row["userid"], "username":row["username"], "userrole":row["userrole"], "userquestion":row["userquestion"], "useranswer":row["useranswer"]} if(row["userrole"] == -1): -- GitLab From 51a9286f2a8c9a0d197990eb5304b223d424fcf9 Mon Sep 17 00:00:00 2001 From: Prajkta Patkar Date: Mon, 27 Nov 2017 12:03:31 +0530 Subject: [PATCH 19/56] if else conditions added and documentation corrected --- gkcore/views/api_user.py | 65 +++++++++++++++++++++------------------- 1 file changed, 34 insertions(+), 31 deletions(-) diff --git a/gkcore/views/api_user.py b/gkcore/views/api_user.py index e949d55..794877b 100644 --- a/gkcore/views/api_user.py +++ b/gkcore/views/api_user.py @@ -24,6 +24,8 @@ Contributors: "Ishan Masdekar " "Navin Karkera" "Mohd. Talha Pawaty" +Prajkta Patkar + """ @@ -110,13 +112,12 @@ class api_user(object): finally: self.con.close() """ - Following function is to retrive user data. + Following function is to retrive user data.It needs userid & only admin can view data. """ @view_config(route_name='user', request_method='GET',renderer='json') def getUser(self): try: token = self.request.headers["gktoken"] - print token except: return {"gkstatus": enumdict["UnauthorisedAccess"]} authDetails = authCheck(token) @@ -125,37 +126,39 @@ class api_user(object): else: try: self.con = eng.connect() - print "i am here " # get necessary user data by comparing userid - print authDetails["userid"] - result = self.con.execute(select([gkdb.users]).where(gkdb.users.c.userid == self.request.params["userid"] )) - row = result.fetchone() - User = {"userid":row["userid"], "username":row["username"], "userrole":row["userrole"], "userquestion":row["userquestion"], "useranswer":row["useranswer"]} - if(row["userrole"] == -1): - User["userroleName"]= "Admin" - elif(row["userrole"] == 0): - User["userroleName"] = "Manager" - elif(row["userrole"] == 1): - User["userroleName"] = "Operator" - elif(row["userrole"] == 2): - urole = "Internal Auditor" - - # -1 = admin,1 = operator,2 = manager , 3 = godown in charge - # if user is godown in-charge we need to retrive associated godown/s - if User["userrole"] == 3: - User["userroleName"] = "Godown In Charge" - usgo = self.con.execute(select([gkdb.usergodown.c.goid]).where(gkdb.users.c.userid == authDetails["userid"])) - goids = usgo.fetchall() - userGodowns = {} - for g in goids: - godownid = g["goid"] - # now we have associated godown ids, by which we can get godown name - godownData = self.con.execute(select([gkdb.godown.c.goname]).where(gkdb.godown.c.goid == godownid)) - gNameRow = godownData.fetchone() - userGodowns[godownid] = gNameRow["goname"] - User["godowns"] = userGodowns + if authDetails["userid"] == -1 : + result = self.con.execute(select([gkdb.users]).where(gkdb.users.c.userid == self.request.params["userid"] )) + row = result.fetchone() + User = {"userid":row["userid"], "username":row["username"], "userrole":row["userrole"], "userquestion":row["userquestion"], "useranswer":row["useranswer"]} + if(row["userrole"] == -1): + User["userroleName"]= "Admin" + elif(row["userrole"] == 0): + User["userroleName"] = "Manager" + elif(row["userrole"] == 1): + User["userroleName"] = "Operator" + elif(row["userrole"] == 2): + urole = "Internal Auditor" - return {"gkstatus": gkcore.enumdict["Success"], "gkresult":User} + # -1 = admin,1 = operator,2 = manager , 3 = godown in charge + # if user is godown in-charge we need to retrive associated godown/s + if User["userrole"] == 3: + User["userroleName"] = "Godown In Charge" + usgo = self.con.execute(select([gkdb.usergodown.c.goid]).where(gkdb.users.c.userid == authDetails["userid"])) + goids = usgo.fetchall() + userGodowns = {} + for g in goids: + godownid = g["goid"] + # now we have associated godown ids, by which we can get godown name + godownData = self.con.execute(select([gkdb.godown.c.goname]).where(gkdb.godown.c.goid == godownid)) + gNameRow = godownData.fetchone() + userGodowns[godownid] = gNameRow["goname"] + User["godowns"] = userGodowns + + return {"gkstatus": gkcore.enumdict["Success"], "gkresult":User} + else: + return {"gkstatus":gkcore.enumdict["ActionDisallowed"]} + except: return {"gkstatus":gkcore.enumdict["ConnectionFailed"] } finally: -- GitLab From 466c352c6659a539aee916c63a32122c804dcc33 Mon Sep 17 00:00:00 2001 From: Prajkta Patkar Date: Mon, 27 Nov 2017 12:17:48 +0530 Subject: [PATCH 20/56] checked whether user has logged in as admin --- gkcore/views/api_user.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/gkcore/views/api_user.py b/gkcore/views/api_user.py index 794877b..19105cf 100644 --- a/gkcore/views/api_user.py +++ b/gkcore/views/api_user.py @@ -112,7 +112,7 @@ class api_user(object): finally: self.con.close() """ - Following function is to retrive user data.It needs userid & only admin can view data. + Following function is to retrive user data.It needs userid & only admin can view data of other users. """ @view_config(route_name='user', request_method='GET',renderer='json') def getUser(self): @@ -127,7 +127,10 @@ class api_user(object): try: self.con = eng.connect() # get necessary user data by comparing userid - if authDetails["userid"] == -1 : + print authDetails["userid"] + user=self.con.execute(select([gkdb.users.c.userrole]).where(gkdb.users.c.userid == authDetails["userid"] )) + userRole = user.fetchone() + if userRole[0]==-1: result = self.con.execute(select([gkdb.users]).where(gkdb.users.c.userid == self.request.params["userid"] )) row = result.fetchone() User = {"userid":row["userid"], "username":row["username"], "userrole":row["userrole"], "userquestion":row["userquestion"], "useranswer":row["useranswer"]} -- GitLab From 2d875eee35be6fe89d037d8703c9e525e02d8dad Mon Sep 17 00:00:00 2001 From: Prajkta Patkar Date: Mon, 27 Nov 2017 15:43:31 +0530 Subject: [PATCH 21/56] added request param --- gkcore/views/api_user.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/gkcore/views/api_user.py b/gkcore/views/api_user.py index 19105cf..16e0ee8 100644 --- a/gkcore/views/api_user.py +++ b/gkcore/views/api_user.py @@ -114,7 +114,7 @@ class api_user(object): """ Following function is to retrive user data.It needs userid & only admin can view data of other users. """ - @view_config(route_name='user', request_method='GET',renderer='json') + @view_config(route_name='user', request_method='GET', request_param = "userAllData",renderer='json') def getUser(self): try: token = self.request.headers["gktoken"] @@ -127,7 +127,6 @@ class api_user(object): try: self.con = eng.connect() # get necessary user data by comparing userid - print authDetails["userid"] user=self.con.execute(select([gkdb.users.c.userrole]).where(gkdb.users.c.userid == authDetails["userid"] )) userRole = user.fetchone() if userRole[0]==-1: -- GitLab From 0c106d0320ba75757263babc8aab89e04c1a4377 Mon Sep 17 00:00:00 2001 From: Prajkta Patkar Date: Mon, 27 Nov 2017 18:18:48 +0530 Subject: [PATCH 22/56] function to get username , userrole of logged in user --- gkcore/views/api_user.py | 40 ++++++++++++++++++++++++++++++++++++++-- 1 file changed, 38 insertions(+), 2 deletions(-) diff --git a/gkcore/views/api_user.py b/gkcore/views/api_user.py index 16e0ee8..ccbebef 100644 --- a/gkcore/views/api_user.py +++ b/gkcore/views/api_user.py @@ -115,7 +115,7 @@ class api_user(object): Following function is to retrive user data.It needs userid & only admin can view data of other users. """ @view_config(route_name='user', request_method='GET', request_param = "userAllData",renderer='json') - def getUser(self): + def getUserAllData(self): try: token = self.request.headers["gktoken"] except: @@ -140,7 +140,7 @@ class api_user(object): elif(row["userrole"] == 1): User["userroleName"] = "Operator" elif(row["userrole"] == 2): - urole = "Internal Auditor" + User["userroleName"] = "Internal Auditor" # -1 = admin,1 = operator,2 = manager , 3 = godown in charge # if user is godown in-charge we need to retrive associated godown/s @@ -399,3 +399,39 @@ class api_user(object): except: return {"gkstatus": enumdict["ConnectionFailed"]} + + """This function sends basic data of user like username ,userrole """ + @view_config(request_method='GET',request_param = "user=single" ,renderer ='json') + def getDataofUser(self): + try: + token = self.request.headers["gktoken"] + except: + return {"gkstatus": gkcore.enumdict["UnauthorisedAccess"]} + authDetails = authCheck(token) + if authDetails["auth"] == False: + return {"gkstatus": gkcore.enumdict["UnauthorisedAccess"]} + else: + try: + self.con = eng.connect() + #there is only one possibility for a catch which is failed connection to db. + #Retrieve data of that user whose userid is sent + result = self.con.execute(select([gkdb.users.c.username,gkdb.users.c.userrole]).where(gkdb.users.c.userid==authDetails["userid"])) + row = result.fetchone() + userData = {"username":row["username"],"userrole":row["userrole"]} + if(row["userrole"] == -1): + userData["userroleName"]= "Admin" + elif(row["userrole"] == 0): + userData["userroleName"] = "Manager" + elif(row["userrole"] == 1): + userData["userroleName"] = "Operator" + elif(row["userrole"] == 2): + userData["userroleName"] = "Internal Auditor" + elif(row["userrole"] == 3): + userData["userroleName"] = "Godown In Charge" + + return {"gkstatus": gkcore.enumdict["Success"], "gkresult":userData } + except: + return {"gkstatus":gkcore.enumdict["ConnectionFailed"] } + finally: + self.con.close() + -- GitLab From 490a1b0ad2432c51a1b36496b6e9b9c41bc43a71 Mon Sep 17 00:00:00 2001 From: Prajkta Patkar Date: Wed, 29 Nov 2017 18:39:08 +0530 Subject: [PATCH 23/56] Specified userrole by numbers in database --- gkcore/views/api_user.py | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/gkcore/views/api_user.py b/gkcore/views/api_user.py index ccbebef..f564fb7 100644 --- a/gkcore/views/api_user.py +++ b/gkcore/views/api_user.py @@ -206,7 +206,17 @@ class api_user(object): result = self.con.execute(select([gkdb.users.c.username,gkdb.users.c.userid,gkdb.users.c.userrole]).where(gkdb.users.c.orgcode==authDetails["orgcode"]).order_by(gkdb.users.c.username)) users = [] for row in result: - users.append({"userid":row["userid"], "username":row["username"], "userrole":row["userrole"]}) + if(row["userrole"] == -1): + userroleName = "Admin" + elif(row["userrole"] == 0): + userroleName = "Manager" + elif(row["userrole"] == 1): + userroleName = "Operator" + elif(row["userrole"] == 2): + userroleName = "Internal Auditor" + elif(row["userrole"] == 3): + userroleName = "Godown In Charge" + users.append({"userid":row["userid"], "username":row["username"], "userrole":row["userrole"],"userrolename": userroleName}) return {"gkstatus": gkcore.enumdict["Success"], "gkresult":users } except: return {"gkstatus":gkcore.enumdict["ConnectionFailed"] } @@ -428,7 +438,6 @@ class api_user(object): userData["userroleName"] = "Internal Auditor" elif(row["userrole"] == 3): userData["userroleName"] = "Godown In Charge" - return {"gkstatus": gkcore.enumdict["Success"], "gkresult":userData } except: return {"gkstatus":gkcore.enumdict["ConnectionFailed"] } -- GitLab From 459cef58f9e839938bfa4e25129f8d3eaa31bff2 Mon Sep 17 00:00:00 2001 From: Prajkta Patkar Date: Wed, 29 Nov 2017 19:00:33 +0530 Subject: [PATCH 24/56] code tested & documented --- gkcore/views/api_user.py | 1 + 1 file changed, 1 insertion(+) diff --git a/gkcore/views/api_user.py b/gkcore/views/api_user.py index f564fb7..865740b 100644 --- a/gkcore/views/api_user.py +++ b/gkcore/views/api_user.py @@ -206,6 +206,7 @@ class api_user(object): result = self.con.execute(select([gkdb.users.c.username,gkdb.users.c.userid,gkdb.users.c.userrole]).where(gkdb.users.c.orgcode==authDetails["orgcode"]).order_by(gkdb.users.c.username)) users = [] for row in result: + # Specify user role if(row["userrole"] == -1): userroleName = "Admin" elif(row["userrole"] == 0): -- GitLab From a93cc7f8c5b1c05e69e817bf653faa9ab8d98ac0 Mon Sep 17 00:00:00 2001 From: Prajkta Patkar Date: Thu, 30 Nov 2017 19:17:00 +0530 Subject: [PATCH 25/56] new function added which take userrole and gives all users data having same userrole --- gkcore/views/api_account.py | 3 +- gkcore/views/api_user.py | 62 ++++++++++++++++++++++++++++++++++++- 2 files changed, 63 insertions(+), 2 deletions(-) diff --git a/gkcore/views/api_account.py b/gkcore/views/api_account.py index 41b1f19..23b4265 100644 --- a/gkcore/views/api_account.py +++ b/gkcore/views/api_account.py @@ -24,7 +24,8 @@ Contributors: "Krishnakant Mane" "Ishan Masdekar " "Navin Karkera" -Prajkta Patkar" +"Prajkta Patkar" +"Prajkta Patkar" """ from gkcore import eng, enumdict diff --git a/gkcore/views/api_user.py b/gkcore/views/api_user.py index 865740b..bdb7379 100644 --- a/gkcore/views/api_user.py +++ b/gkcore/views/api_user.py @@ -24,7 +24,7 @@ Contributors: "Ishan Masdekar " "Navin Karkera" "Mohd. Talha Pawaty" -Prajkta Patkar +"Prajkta Patkar" """ @@ -165,6 +165,66 @@ class api_user(object): return {"gkstatus":gkcore.enumdict["ConnectionFailed"] } finally: self.con.close() + + """ + Following function is to get all users data having same user role .It needs userrole & only admin can view data of other users. + """ + @view_config(route_name='user', request_method='GET', request_param = "sameRoleUsers",renderer='json') + def getAllUsersData(self): + try: + token = self.request.headers["gktoken"] + except: + return {"gkstatus": enumdict["UnauthorisedAccess"]} + authDetails = authCheck(token) + if authDetails["auth"] == False: + return {"gkstatus": enumdict["UnauthorisedAccess"]} + else: + try: + self.con = eng.connect() + # get user role to validate. + # only admin can view all users entire data + user=self.con.execute(select([gkdb.users.c.userrole]).where(gkdb.users.c.userid == authDetails["userid"] )) + userRole = user.fetchone() + if userRole[0]==-1: + # get all users having same user role. + result = self.con.execute(select([gkdb.users.c.username,gkdb.users.c.userid,gkdb.users.c.userquestion,gkdb.users.c.useranswer]).where(and_(gkdb.users.c.userrole == self.request.params["userrole"] , gkdb.users.c.orgcode == authDetails["orgcode"]))) + userData = result.fetchall() + usersList = [] + for row in userData : + User = {"userid":row["userid"], "username":row["username"], "userrole":self.request.params["userrole"], "userquestion":row["userquestion"], "useranswer":row["useranswer"]} + # -1 = admin, 0 = Manager ,1 = operator,2 = Internal Auditor , 3 = godown in charge + if int(self.request.params["userrole"]) == -1: + User["userroleName"]= "Admin" + elif int(self.request.params["userrole"] == 0): + User["userroleName"] = "Manager" + elif int(self.request.params["userrole"] == 1): + User["userroleName"] = "Operator" + elif int(self.request.params["userrole"] == 2): + User["userroleName"] = "Internal Auditor" + # if user is godown in-charge we need to retrive associated godown/s + + elif int(self.request.params["userrole"]) == 3: + User["userroleName"] = "Godown In Charge" + usgo = self.con.execute(select([gkdb.usergodown.c.goid]).where(gkdb.users.c.userid == row["userid"])) + goids = usgo.fetchall() + userGodowns = {} + for g in goids: + godownid = g["goid"] + # now we have associated godown ids, by which we can get godown name + godownData = self.con.execute(select([gkdb.godown.c.goname]).where(gkdb.godown.c.goid == godownid)) + gNameRow = godownData.fetchone() + userGodowns[godownid] = gNameRow["goname"] + User["godowns"] = userGodowns + usersList.append(User) + + return {"gkstatus": gkcore.enumdict["Success"], "gkresult":usersList} + else: + return {"gkstatus":gkcore.enumdict["ActionDisallowed"]} + + except: + return {"gkstatus":gkcore.enumdict["ConnectionFailed"] } + finally: + self.con.close() @view_config(request_method='PUT', renderer='json') def editUser(self): -- GitLab From 2ac1cdec17622b3f9dd4a2de936b8233aecdae0f Mon Sep 17 00:00:00 2001 From: Nitesh Date: Mon, 11 Dec 2017 14:23:11 +0530 Subject: [PATCH 26/56] This will gives only the particular user assigned godown list. --- gkcore/views/api_user.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gkcore/views/api_user.py b/gkcore/views/api_user.py index bdb7379..216e783 100644 --- a/gkcore/views/api_user.py +++ b/gkcore/views/api_user.py @@ -146,7 +146,7 @@ class api_user(object): # if user is godown in-charge we need to retrive associated godown/s if User["userrole"] == 3: User["userroleName"] = "Godown In Charge" - usgo = self.con.execute(select([gkdb.usergodown.c.goid]).where(gkdb.users.c.userid == authDetails["userid"])) + usgo = self.con.execute(select([gkdb.usergodown.c.goid]).where(gkdb.usergodown.c.userid == self.request.params["userid"])) goids = usgo.fetchall() userGodowns = {} for g in goids: -- GitLab From 559c42abe16f3edbd5d29d55abf36351c5a9ecbe Mon Sep 17 00:00:00 2001 From: Nitesh Date: Tue, 12 Dec 2017 18:02:20 +0530 Subject: [PATCH 27/56] PUT is written for users. --- gkcore/views/api_user.py | 39 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 39 insertions(+) diff --git a/gkcore/views/api_user.py b/gkcore/views/api_user.py index 216e783..626093e 100644 --- a/gkcore/views/api_user.py +++ b/gkcore/views/api_user.py @@ -250,6 +250,45 @@ class api_user(object): return {"gkstatus":gkcore.enumdict["ConnectionFailed"] } finally: self.con.close() + + + @view_config(request_method='PUT', request_param='editdata' ,renderer='json') + def addedituser(self): + try: + token = self.request.headers["gktoken"] + except: + return {"gkstatus": gkcore.enumdict["UnauthorisedAccess"]} + authDetails = authCheck(token) + if authDetails["auth"] == False: + return {"gkstatus": enumdict["UnauthorisedAcces"]} + else: + try: + self.con =eng.connect() + user=self.con.execute(select([gkdb.users.c.userrole]).where(gkdb.users.c.userid == authDetails["userid"] )) + userRole = getUserRole(authDetails["userid"]) + dataset = self.request.json_body + print dataset["userrole"] + if userRole["gkresult"]["userrole"] == -1: + dataset["orgcode"] = authDetails["orgcode"] + if dataset["userrole"]== "3": + result = self.con.execute(gkdb.usergodown.delete().where(gkdb.usergodown.c.userid==dataset["userid"])) + golist = tuple(dataset.pop("golist")) + result = self.con.execute(gkdb.users.update().where(gkdb.users.c.userid==dataset["userid"]).values(dataset)) + userdata = self.con.execute(select([gkdb.users.c.userid]).where(and_( gkdb.users.c.username == dataset["username"],gkdb.users.c.orgcode == dataset["orgcode"]))) + userRow = userdata.fetchone() + lastid = userRow["userid"] + for goid in golist: + godata = {"userid":lastid,"goid":goid,"orgcode":dataset["orgcode"]} + result = self.con.execute(gkdb.usergodown.insert(),[godata]) + else: + result = self.con.execute(gkdb.users.update().where(gkdb.users.c.userid==dataset["userid"]).values(dataset)) + else: + return {"gkstatus":gkcore.enumdict["ActionDisallowed"]} + except: + return {"gkstatus":gkcore.enumdict["ConnectionFailed"] } + finally: + self.con.close() + @view_config(request_method='GET', renderer ='json') def getAllUsers(self): try: -- GitLab From cfa5a085742c54c055c8fb5a3406a63caa68bbd0 Mon Sep 17 00:00:00 2001 From: Nitesh Date: Wed, 13 Dec 2017 19:05:53 +0530 Subject: [PATCH 28/56] Remove unwanted code. Documentation is done. --- gkcore/views/api_user.py | 20 +++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-) diff --git a/gkcore/views/api_user.py b/gkcore/views/api_user.py index 626093e..23adb3c 100644 --- a/gkcore/views/api_user.py +++ b/gkcore/views/api_user.py @@ -251,7 +251,12 @@ class api_user(object): finally: self.con.close() - + """ + This function update user in the users table. + It may also have a list of goids for the godowns associated with this user. + This is only true if goflag is True. + The frontend must send the role as Godown In Charge for this. +""" @view_config(request_method='PUT', request_param='editdata' ,renderer='json') def addedituser(self): try: @@ -264,26 +269,27 @@ class api_user(object): else: try: self.con =eng.connect() - user=self.con.execute(select([gkdb.users.c.userrole]).where(gkdb.users.c.userid == authDetails["userid"] )) userRole = getUserRole(authDetails["userid"]) dataset = self.request.json_body - print dataset["userrole"] + print dataset if userRole["gkresult"]["userrole"] == -1: dataset["orgcode"] = authDetails["orgcode"] - if dataset["userrole"]== "3": + if int(dataset["userrole"])== 3: result = self.con.execute(gkdb.usergodown.delete().where(gkdb.usergodown.c.userid==dataset["userid"])) golist = tuple(dataset.pop("golist")) + print golist result = self.con.execute(gkdb.users.update().where(gkdb.users.c.userid==dataset["userid"]).values(dataset)) - userdata = self.con.execute(select([gkdb.users.c.userid]).where(and_( gkdb.users.c.username == dataset["username"],gkdb.users.c.orgcode == dataset["orgcode"]))) - userRow = userdata.fetchone() - lastid = userRow["userid"] + lastid = dataset["userid"] for goid in golist: godata = {"userid":lastid,"goid":goid,"orgcode":dataset["orgcode"]} result = self.con.execute(gkdb.usergodown.insert(),[godata]) else: result = self.con.execute(gkdb.users.update().where(gkdb.users.c.userid==dataset["userid"]).values(dataset)) + return {"gkstatus":enumdict["Success"]} else: return {"gkstatus":gkcore.enumdict["ActionDisallowed"]} + except exc.IntegrityError: + return {"gkstatus":enumdict["DuplicateEntry"]} except: return {"gkstatus":gkcore.enumdict["ConnectionFailed"] } finally: -- GitLab From ac561e24cb5bd515239c3fbea3076f97f2dca0bf Mon Sep 17 00:00:00 2001 From: Nitesh Date: Tue, 19 Dec 2017 08:27:09 +0530 Subject: [PATCH 29/56] if condition check old user userrole and if it is godownkeeper then delete it. --- gkcore/views/api_user.py | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/gkcore/views/api_user.py b/gkcore/views/api_user.py index 23adb3c..e4e0ca1 100644 --- a/gkcore/views/api_user.py +++ b/gkcore/views/api_user.py @@ -252,7 +252,7 @@ class api_user(object): self.con.close() """ - This function update user in the users table. + Following function update user in the users table. It may also have a list of goids for the godowns associated with this user. This is only true if goflag is True. The frontend must send the role as Godown In Charge for this. @@ -271,13 +271,15 @@ class api_user(object): self.con =eng.connect() userRole = getUserRole(authDetails["userid"]) dataset = self.request.json_body - print dataset if userRole["gkresult"]["userrole"] == -1: dataset["orgcode"] = authDetails["orgcode"] - if int(dataset["userrole"])== 3: + #This is give userrole of old user + originalrole = getuserrole(dataset[userid]) + if int(originalrole ==3): result = self.con.execute(gkdb.usergodown.delete().where(gkdb.usergodown.c.userid==dataset["userid"])) + #this is give userrole of new user + if int(dataset["userrole"])== 3: golist = tuple(dataset.pop("golist")) - print golist result = self.con.execute(gkdb.users.update().where(gkdb.users.c.userid==dataset["userid"]).values(dataset)) lastid = dataset["userid"] for goid in golist: -- GitLab From fc795c3577b6c3b5ea84e431d0b60ef6eacf18fb Mon Sep 17 00:00:00 2001 From: Nitesh Date: Tue, 19 Dec 2017 20:56:33 +0530 Subject: [PATCH 30/56] function for current password status. --- gkcore/views/api_user.py | 56 ++++++++++++++++++++++++++++++---------- 1 file changed, 43 insertions(+), 13 deletions(-) diff --git a/gkcore/views/api_user.py b/gkcore/views/api_user.py index e4e0ca1..f87b815 100644 --- a/gkcore/views/api_user.py +++ b/gkcore/views/api_user.py @@ -241,6 +241,8 @@ class api_user(object): user=self.con.execute(select([gkdb.users.c.userrole]).where(gkdb.users.c.userid == authDetails["userid"] )) userRole = user.fetchone() dataset = self.request.json_body + print dataset + print authDetails["userid"] if userRole[0]==-1 or int(authDetails["userid"])==int(dataset["userid"]): result = self.con.execute(gkdb.users.update().where(gkdb.users.c.userid==dataset["userid"]).values(dataset)) return {"gkstatus":enumdict["Success"]} @@ -251,6 +253,29 @@ class api_user(object): finally: self.con.close() + @view_config(request_method='POST', request_param="userloginstatus",renderer='json') + def userLoginstatus(self): + try: + self.con = eng.connect() + token = self.request.headers["gktoken"] + except: + return {"gkstatus": gkcore.enumdict["UnauthorisedAccess"]} + authDetails = authCheck(token) + if authDetails["auth"] == False: + return {"gkstatus": enumdict["UnauthorisedAcces"]} + else: + try: + dataset = self.request.json_body + result = self.con.execute(select([gkdb.users.c.userid]).where(and_(gkdb.users.c.username==dataset["username"], gkdb.users.c.userpassword== dataset["userpassword"], gkdb.users.c.orgcode==authDetails["orgcode"])) ) + if result.rowcount == 1: + return {"gkstatus":enumdict["Success"]} + else: + return {"gkstatus": enumdict["BadPrivilege"]} + except: + return {"gkstatus":enumdict["ConnectionFailed"]} + finally: + self.con.close() + """ Following function update user in the users table. It may also have a list of goids for the godowns associated with this user. @@ -271,23 +296,28 @@ class api_user(object): self.con =eng.connect() userRole = getUserRole(authDetails["userid"]) dataset = self.request.json_body + print dataset if userRole["gkresult"]["userrole"] == -1: dataset["orgcode"] = authDetails["orgcode"] #This is give userrole of old user - originalrole = getuserrole(dataset[userid]) - if int(originalrole ==3): + originalrole = getUserRole(dataset["userid"]) + if int(userRole["gkresult"]["userrole"]==3): result = self.con.execute(gkdb.usergodown.delete().where(gkdb.usergodown.c.userid==dataset["userid"])) - #this is give userrole of new user - if int(dataset["userrole"])== 3: - golist = tuple(dataset.pop("golist")) - result = self.con.execute(gkdb.users.update().where(gkdb.users.c.userid==dataset["userid"]).values(dataset)) - lastid = dataset["userid"] - for goid in golist: - godata = {"userid":lastid,"goid":goid,"orgcode":dataset["orgcode"]} - result = self.con.execute(gkdb.usergodown.insert(),[godata]) + #this is give userrole of new user + if dataset.has_key("userrole"): + if int(dataset["userrole"])== 3: + golist = tuple(dataset.pop("golist")) + result = self.con.execute(gkdb.users.update().where(gkdb.users.c.userid==dataset["userid"]).values(dataset)) + lastid = dataset["userid"] + for goid in golist: + godata = {"userid":lastid,"goid":goid,"orgcode":dataset["orgcode"]} + result = self.con.execute(gkdb.usergodown.insert(),[godata]) + else: + result = self.con.execute(gkdb.users.update().where(gkdb.users.c.userid==dataset["userid"]).values(dataset)) + return {"gkstatus":enumdict["Success"]} else: result = self.con.execute(gkdb.users.update().where(gkdb.users.c.userid==dataset["userid"]).values(dataset)) - return {"gkstatus":enumdict["Success"]} + return {"gkstatus":enumdict["Success"]} else: return {"gkstatus":gkcore.enumdict["ActionDisallowed"]} except exc.IntegrityError: @@ -533,9 +563,9 @@ class api_user(object): self.con = eng.connect() #there is only one possibility for a catch which is failed connection to db. #Retrieve data of that user whose userid is sent - result = self.con.execute(select([gkdb.users.c.username,gkdb.users.c.userrole]).where(gkdb.users.c.userid==authDetails["userid"])) + result = self.con.execute(select([gkdb.users.c.username,gkdb.users.c.userrole, gkdb.users.c.userid]).where(gkdb.users.c.userid==authDetails["userid"])) row = result.fetchone() - userData = {"username":row["username"],"userrole":row["userrole"]} + userData = {"username":row["username"],"userrole":row["userrole"],"userid":row["userid"]} if(row["userrole"] == -1): userData["userroleName"]= "Admin" elif(row["userrole"] == 0): -- GitLab From 1d4522ef1f167f12a7c5c0e715d5c77c247524dd Mon Sep 17 00:00:00 2001 From: Nitesh Date: Wed, 20 Dec 2017 16:01:03 +0530 Subject: [PATCH 31/56] If godown in charge is request to update here it gives gkstatus. Documentation is done. --- gkcore/views/api_user.py | 28 ++++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/gkcore/views/api_user.py b/gkcore/views/api_user.py index f87b815..0bbab81 100644 --- a/gkcore/views/api_user.py +++ b/gkcore/views/api_user.py @@ -241,8 +241,6 @@ class api_user(object): user=self.con.execute(select([gkdb.users.c.userrole]).where(gkdb.users.c.userid == authDetails["userid"] )) userRole = user.fetchone() dataset = self.request.json_body - print dataset - print authDetails["userid"] if userRole[0]==-1 or int(authDetails["userid"])==int(dataset["userid"]): result = self.con.execute(gkdb.users.update().where(gkdb.users.c.userid==dataset["userid"]).values(dataset)) return {"gkstatus":enumdict["Success"]} @@ -252,8 +250,11 @@ class api_user(object): return {"gkstatus":gkcore.enumdict["ConnectionFailed"] } finally: self.con.close() + """ + Following function check status (i.e valid or not) of field current password in edituser. +""" - @view_config(request_method='POST', request_param="userloginstatus",renderer='json') + @view_config(request_method='POST', request_param="userloginstatus", renderer='json') def userLoginstatus(self): try: self.con = eng.connect() @@ -279,11 +280,10 @@ class api_user(object): """ Following function update user in the users table. It may also have a list of goids for the godowns associated with this user. - This is only true if goflag is True. The frontend must send the role as Godown In Charge for this. """ @view_config(request_method='PUT', request_param='editdata' ,renderer='json') - def addedituser(self): + def updateuser(self): try: token = self.request.headers["gktoken"] except: @@ -296,22 +296,22 @@ class api_user(object): self.con =eng.connect() userRole = getUserRole(authDetails["userid"]) dataset = self.request.json_body - print dataset if userRole["gkresult"]["userrole"] == -1: dataset["orgcode"] = authDetails["orgcode"] #This is give userrole of old user originalrole = getUserRole(dataset["userid"]) - if int(userRole["gkresult"]["userrole"]==3): + if int(originalrole["gkresult"]["userrole"]==3): result = self.con.execute(gkdb.usergodown.delete().where(gkdb.usergodown.c.userid==dataset["userid"])) - #this is give userrole of new user + #This is give userrole of new user if dataset.has_key("userrole"): if int(dataset["userrole"])== 3: - golist = tuple(dataset.pop("golist")) + golists = tuple(dataset.pop("golist")) result = self.con.execute(gkdb.users.update().where(gkdb.users.c.userid==dataset["userid"]).values(dataset)) - lastid = dataset["userid"] - for goid in golist: - godata = {"userid":lastid,"goid":goid,"orgcode":dataset["orgcode"]} + currentid = dataset["userid"] + for goid in golists: + godata = {"userid":currentid,"goid":goid,"orgcode":dataset["orgcode"]} result = self.con.execute(gkdb.usergodown.insert(),[godata]) + return {"gkstatus":enumdict["Success"]} else: result = self.con.execute(gkdb.users.update().where(gkdb.users.c.userid==dataset["userid"]).values(dataset)) return {"gkstatus":enumdict["Success"]} @@ -323,9 +323,9 @@ class api_user(object): except exc.IntegrityError: return {"gkstatus":enumdict["DuplicateEntry"]} except: - return {"gkstatus":gkcore.enumdict["ConnectionFailed"] } + return {"gkstatus":gkcore.enumdict["ConnectionFailed"] } finally: - self.con.close() + self.con.close() @view_config(request_method='GET', renderer ='json') def getAllUsers(self): -- GitLab From de31d98715bbad5d70dd91fa883d693789b16161 Mon Sep 17 00:00:00 2001 From: Nitesh Date: Wed, 20 Dec 2017 18:52:40 +0530 Subject: [PATCH 32/56] Documentation for user. --- gkcore/views/api_user.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/gkcore/views/api_user.py b/gkcore/views/api_user.py index 0bbab81..6e8d826 100644 --- a/gkcore/views/api_user.py +++ b/gkcore/views/api_user.py @@ -278,7 +278,7 @@ class api_user(object): self.con.close() """ - Following function update user in the users table. + Following function update user, in the users table. It may also have a list of goids for the godowns associated with this user. The frontend must send the role as Godown In Charge for this. """ @@ -298,11 +298,11 @@ class api_user(object): dataset = self.request.json_body if userRole["gkresult"]["userrole"] == -1: dataset["orgcode"] = authDetails["orgcode"] - #This is give userrole of old user + # "originalrole" gives userrole of old user originalrole = getUserRole(dataset["userid"]) if int(originalrole["gkresult"]["userrole"]==3): result = self.con.execute(gkdb.usergodown.delete().where(gkdb.usergodown.c.userid==dataset["userid"])) - #This is give userrole of new user + #dataset["userrole"] gives userrole of new user if dataset.has_key("userrole"): if int(dataset["userrole"])== 3: golists = tuple(dataset.pop("golist")) -- GitLab From 8b75b759a42a0c2bc58f90a2f1cbf3f362ecb58c Mon Sep 17 00:00:00 2001 From: Nitesh Date: Wed, 27 Dec 2017 12:45:18 +0530 Subject: [PATCH 33/56] Author list is updated in user api. --- gkcore/views/api_user.py | 1 + 1 file changed, 1 insertion(+) diff --git a/gkcore/views/api_user.py b/gkcore/views/api_user.py index 6e8d826..fcc3a9c 100644 --- a/gkcore/views/api_user.py +++ b/gkcore/views/api_user.py @@ -25,6 +25,7 @@ Contributors: "Navin Karkera" "Mohd. Talha Pawaty" "Prajkta Patkar" +"Nitesh Chaughule" """ -- GitLab From dcf80a6d41d071c1f91355b5ac51ab0488c85e02 Mon Sep 17 00:00:00 2001 From: abhijith Date: Sun, 10 Dec 2017 15:29:07 +0530 Subject: [PATCH 34/56] Modified put for Invoice --- gkcore/views/api_invoice.py | 30 +++++++++++++++--------------- 1 file changed, 15 insertions(+), 15 deletions(-) diff --git a/gkcore/views/api_invoice.py b/gkcore/views/api_invoice.py index 3fc40ac..1b44fb0 100644 --- a/gkcore/views/api_invoice.py +++ b/gkcore/views/api_invoice.py @@ -153,20 +153,21 @@ class api_invoice(object): items = invdataset["contents"] invdataset["orgcode"] = authDetails["orgcode"] stockdataset["orgcode"] = authDetails["orgcode"] - result = self.con.execute(stock.delete().where(and_(stock.c.dcinvtnid==invdataset["invid"],stock.c.dcinvtnflag==9))) - result = self.con.execute(dcinv.delete().where(dcinv.c.invid==invdataset["invid"])) + try: + deletestock = self.con.execute(stock.delete().where(and_(stock.c.dcinvtnid==invdataset["invid"],stock.c.dcinvtnflag==9))) + except: + pass + try: + deletedcinv = self.con.execute(dcinv.delete().where(dcinv.c.invid==invdataset["invid"])) + except: + pass + updateinvoice = self.con.execute(invoice.update().where(invoice.c.invid==invdataset["invid"]).values(invdataset)) if invdataset.has_key("dcid"): - dcid = invdataset.pop("dcid") - result = self.con.execute(invoice.update().where(invoice.c.invid==invdataset["invid"]).values(invdataset)) - invdataset["dcid"] = dcid - if result.rowcount == 1: - dcinvdataset["dcid"]=invdataset["dcid"] - dcinvdataset["orgcode"]=invdataset["orgcode"] - dcinvdataset["invid"]=invdataset["invid"] - result = self.con.execute(dcinv.insert(),[dcinvdataset]) - return {"gkstatus":enumdict["Success"]} - else: - return {"gkstatus":gkcore.enumdict["ConnectionFailed"] } + dcinvdataset["dcid"]=invdataset["dcid"] + dcinvdataset["orgcode"]=invdataset["orgcode"] + dcinvdataset["invid"]=invdataset["invid"] + result = self.con.execute(dcinv.insert(),[dcinvdataset]) + return {"gkstatus":enumdict["Success"]} else: try: result = self.con.execute(invoice.update().where(invoice.c.invid==invdataset["invid"]).values(invdataset)) @@ -174,10 +175,10 @@ class api_invoice(object): invoiceid = result.fetchone() stockdataset["dcinvtnid"] = invoiceid["invid"] stockdataset["stockdate"] = invoiceid["invoicedate"] + stockdataset["dcinvtnflag"] = "9" for item in items.keys(): stockdataset["productcode"] = item stockdataset["qty"] = items[item].values()[0] - stockdataset["dcinvtnflag"] = "9" result = self.con.execute(stock.insert(),[stockdataset]) return {"gkstatus":enumdict["Success"]} except: @@ -187,7 +188,6 @@ class api_invoice(object): except exc.IntegrityError: return {"gkstatus":enumdict["DuplicateEntry"]} except: - result = self.con.execute(invoice.delete().where(invoice.c.invid==invdataset["invid"])) return {"gkstatus":gkcore.enumdict["ConnectionFailed"] } finally: self.con.close() -- GitLab From 6221833e5b0492bc85a54b6b60be97026b421dbc Mon Sep 17 00:00:00 2001 From: abhijith Date: Sun, 10 Dec 2017 15:36:07 +0530 Subject: [PATCH 35/56] List of Pending sale/purchase invoices can be fetched separately --- gkcore/views/api_billwise.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/gkcore/views/api_billwise.py b/gkcore/views/api_billwise.py index 01dbac1..be92809 100644 --- a/gkcore/views/api_billwise.py +++ b/gkcore/views/api_billwise.py @@ -214,7 +214,13 @@ It will be used for creating entries in the billwise table and updating it as ne for inv in invoicesData: custData = self.con.execute(select([customerandsupplier.c.custname, customerandsupplier.c.csflag, customerandsupplier.c.custid]).where(customerandsupplier.c.custid == inv["custid"])) customerdata = custData.fetchone() - unAdjInvoices.append({"invid":inv["invid"],"invoiceno":inv["invoiceno"],"invoicedate":datetime.strftime(inv["invoicedate"],'%d-%m-%Y'),"invoicetotal":"%.2f"%(float(inv["invoicetotal"])),"balanceamount":"%.2f"%(float(inv["invoicetotal"]-inv["amountpaid"])), "custname":customerdata["custname"], "custid":customerdata["custid"], "csflag": customerdata["csflag"]}) + if self.request.params.has_key('type'): + if str(self.request.params["type"]) == 'sale' and int(customerdata['csflag']) == 3: + unAdjInvoices.append({"invid":inv["invid"],"invoiceno":inv["invoiceno"],"invoicedate":datetime.strftime(inv["invoicedate"],'%d-%m-%Y'),"invoicetotal":"%.2f"%(float(inv["invoicetotal"])),"balanceamount":"%.2f"%(float(inv["invoicetotal"]-inv["amountpaid"])), "custname":customerdata["custname"], "custid":customerdata["custid"], "csflag": customerdata["csflag"]}) + elif str(self.request.params["type"]) == 'purchase' and int(custname['csflag']) == 19: + unAdjInvoices.append({"invid":inv["invid"],"invoiceno":inv["invoiceno"],"invoicedate":datetime.strftime(inv["invoicedate"],'%d-%m-%Y'),"invoicetotal":"%.2f"%(float(inv["invoicetotal"])),"balanceamount":"%.2f"%(float(inv["invoicetotal"]-inv["amountpaid"])), "custname":customerdata["custname"], "custid":customerdata["custid"], "csflag": customerdata["csflag"]}) + else: + unAdjInvoices.append({"invid":inv["invid"],"invoiceno":inv["invoiceno"],"invoicedate":datetime.strftime(inv["invoicedate"],'%d-%m-%Y'),"invoicetotal":"%.2f"%(float(inv["invoicetotal"])),"balanceamount":"%.2f"%(float(inv["invoicetotal"]-inv["amountpaid"])), "custname":customerdata["custname"], "custid":customerdata["custid"], "csflag": customerdata["csflag"]}) return{"gkstatus":enumdict["Success"],"invoices":unAdjInvoices} except: return{"gkstatus":enumdict["ConnectionFailed"]} -- GitLab From 9fece18e430fec22564c0a12547a0246c40cf1f6 Mon Sep 17 00:00:00 2001 From: abhijith Date: Sun, 10 Dec 2017 15:58:46 +0530 Subject: [PATCH 36/56] Changed request param from type to invtype --- gkcore/views/api_billwise.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/gkcore/views/api_billwise.py b/gkcore/views/api_billwise.py index be92809..17b669b 100644 --- a/gkcore/views/api_billwise.py +++ b/gkcore/views/api_billwise.py @@ -214,10 +214,11 @@ It will be used for creating entries in the billwise table and updating it as ne for inv in invoicesData: custData = self.con.execute(select([customerandsupplier.c.custname, customerandsupplier.c.csflag, customerandsupplier.c.custid]).where(customerandsupplier.c.custid == inv["custid"])) customerdata = custData.fetchone() - if self.request.params.has_key('type'): - if str(self.request.params["type"]) == 'sale' and int(customerdata['csflag']) == 3: + # If there is a invtype parameter then only sale/purchase invoices are returned depending on the value of type. + if self.request.params.has_key('invtype'): + if str(self.request.params["invtype"]) == 'sale' and int(customerdata['csflag']) == 3: unAdjInvoices.append({"invid":inv["invid"],"invoiceno":inv["invoiceno"],"invoicedate":datetime.strftime(inv["invoicedate"],'%d-%m-%Y'),"invoicetotal":"%.2f"%(float(inv["invoicetotal"])),"balanceamount":"%.2f"%(float(inv["invoicetotal"]-inv["amountpaid"])), "custname":customerdata["custname"], "custid":customerdata["custid"], "csflag": customerdata["csflag"]}) - elif str(self.request.params["type"]) == 'purchase' and int(custname['csflag']) == 19: + elif str(self.request.params["invtype"]) == 'purchase' and int(customerdata['csflag']) == 19: unAdjInvoices.append({"invid":inv["invid"],"invoiceno":inv["invoiceno"],"invoicedate":datetime.strftime(inv["invoicedate"],'%d-%m-%Y'),"invoicetotal":"%.2f"%(float(inv["invoicetotal"])),"balanceamount":"%.2f"%(float(inv["invoicetotal"]-inv["amountpaid"])), "custname":customerdata["custname"], "custid":customerdata["custid"], "csflag": customerdata["csflag"]}) else: unAdjInvoices.append({"invid":inv["invid"],"invoiceno":inv["invoiceno"],"invoicedate":datetime.strftime(inv["invoicedate"],'%d-%m-%Y'),"invoicetotal":"%.2f"%(float(inv["invoicetotal"])),"balanceamount":"%.2f"%(float(inv["invoicetotal"]-inv["amountpaid"])), "custname":customerdata["custname"], "custid":customerdata["custid"], "csflag": customerdata["csflag"]}) -- GitLab From 77329d4718fa564d4e5a69db5cd9b90111008ffc Mon Sep 17 00:00:00 2001 From: abhijith Date: Tue, 19 Dec 2017 15:41:48 +0530 Subject: [PATCH 37/56] Invoice single get now returns delivery challan date also --- gkcore/views/api_invoice.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/gkcore/views/api_invoice.py b/gkcore/views/api_invoice.py index 1b44fb0..524f521 100644 --- a/gkcore/views/api_invoice.py +++ b/gkcore/views/api_invoice.py @@ -298,10 +298,11 @@ There will be an icFlag which will determine if it's an incrementing or decreme result =self.con.execute(select([dcinv.c.dcid]).where(dcinv.c.invid==invrow["invid"])) dcid = result.fetchone() if result.rowcount>0: - dc = self.con.execute(select([delchal.c.dcno]).where(delchal.c.dcid==dcid["dcid"])) + dc = self.con.execute(select([delchal.c.dcno, delchal.c.dcdate]).where(delchal.c.dcid==dcid["dcid"])) delchalData = dc.fetchone() inv["dcid"]=dcid["dcid"] inv["dcno"]=delchalData["dcno"] + inv["dcdate"] = datetime.strftime(delchalData["dcdate"],"%d-%m-%Y") inOut = self.con.execute(select([stock.c.inout]).where(and_(stock.c.dcinvtnid==dcid["dcid"], stock.c.dcinvtnflag==4))) inOutData = inOut.fetchone() if inOutData != None: -- GitLab From 60938350ab6091a18ef2b34d66caab729ea35a1d Mon Sep 17 00:00:00 2001 From: abhijith Date: Tue, 19 Dec 2017 17:50:36 +0530 Subject: [PATCH 38/56] Solved issue regarding invoices with delivery challan --- gkcore/views/api_invoice.py | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/gkcore/views/api_invoice.py b/gkcore/views/api_invoice.py index 524f521..030a408 100644 --- a/gkcore/views/api_invoice.py +++ b/gkcore/views/api_invoice.py @@ -161,16 +161,19 @@ class api_invoice(object): deletedcinv = self.con.execute(dcinv.delete().where(dcinv.c.invid==invdataset["invid"])) except: pass - updateinvoice = self.con.execute(invoice.update().where(invoice.c.invid==invdataset["invid"]).values(invdataset)) if invdataset.has_key("dcid"): - dcinvdataset["dcid"]=invdataset["dcid"] + dcinvdataset["dcid"]=invdataset.pop("dcid") dcinvdataset["orgcode"]=invdataset["orgcode"] dcinvdataset["invid"]=invdataset["invid"] - result = self.con.execute(dcinv.insert(),[dcinvdataset]) - return {"gkstatus":enumdict["Success"]} + try: + updateinvoice = self.con.execute(invoice.update().where(invoice.c.invid==invdataset["invid"]).values(invdataset)) + result = self.con.execute(dcinv.insert(),[dcinvdataset]) + return {"gkstatus":enumdict["Success"]} + except: + return {"gkstatus":gkcore.enumdict["ConnectionFailed"] } else: try: - result = self.con.execute(invoice.update().where(invoice.c.invid==invdataset["invid"]).values(invdataset)) + updateinvoice = self.con.execute(invoice.update().where(invoice.c.invid==invdataset["invid"]).values(invdataset)) result = self.con.execute(select([invoice.c.invid,invoice.c.invoicedate]).where(and_(invoice.c.custid==invdataset["custid"], invoice.c.invoiceno==invdataset["invoiceno"]))) invoiceid = result.fetchone() stockdataset["dcinvtnid"] = invoiceid["invid"] @@ -182,8 +185,6 @@ class api_invoice(object): result = self.con.execute(stock.insert(),[stockdataset]) return {"gkstatus":enumdict["Success"]} except: - result = self.con.execute(stock.delete().where(and_(stock.c.dcinvtnid==invoiceid["invid"],stock.c.dcinvtnflag==9))) - result = self.con.execute(invoice.delete().where(invoice.c.invid==invoiceid["invid"])) return {"gkstatus":gkcore.enumdict["ConnectionFailed"] } except exc.IntegrityError: return {"gkstatus":enumdict["DuplicateEntry"]} -- GitLab From fa6ecf4b0186d7cd62bd5ed2a571c25ae1d303aa Mon Sep 17 00:00:00 2001 From: abhijith Date: Wed, 20 Dec 2017 15:55:29 +0530 Subject: [PATCH 39/56] Added documentation for editinvoice --- gkcore/views/api_invoice.py | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/gkcore/views/api_invoice.py b/gkcore/views/api_invoice.py index 030a408..a85b731 100644 --- a/gkcore/views/api_invoice.py +++ b/gkcore/views/api_invoice.py @@ -134,6 +134,12 @@ class api_invoice(object): return {"gkstatus":gkcore.enumdict["ConnectionFailed"] } finally: self.con.close() + + ''' + This is a function to update an invoice. + This function is primarily used to enable editing of invoices. + It receives a dictionary with information regarding an invoice, changes to be made in stock if any and delivery notes linked if any. + ''' @view_config(request_method='PUT', renderer='json') def editInvoice(self): try: @@ -146,13 +152,17 @@ class api_invoice(object): else: try: self.con = eng.connect() + # Data is stored in a variable dtset. dtset = self.request.json_body + # Empty dictionary to store details of delivery challan linked if any. dcinvdataset={} + # Details of invoice and stock are stored in separate variables. invdataset = dtset["invoice"] stockdataset = dtset["stock"] items = invdataset["contents"] invdataset["orgcode"] = authDetails["orgcode"] stockdataset["orgcode"] = authDetails["orgcode"] + # Entries in dcinv and stock tables are deleted to avoid duplicate entries. try: deletestock = self.con.execute(stock.delete().where(and_(stock.c.dcinvtnid==invdataset["invid"],stock.c.dcinvtnflag==9))) except: @@ -161,6 +171,7 @@ class api_invoice(object): deletedcinv = self.con.execute(dcinv.delete().where(dcinv.c.invid==invdataset["invid"])) except: pass + # If delivery chalan is linked details of invoice are updated and a new entry is made in the dcinv table. if invdataset.has_key("dcid"): dcinvdataset["dcid"]=invdataset.pop("dcid") dcinvdataset["orgcode"]=invdataset["orgcode"] @@ -170,7 +181,8 @@ class api_invoice(object): result = self.con.execute(dcinv.insert(),[dcinvdataset]) return {"gkstatus":enumdict["Success"]} except: - return {"gkstatus":gkcore.enumdict["ConnectionFailed"] } + return {"gkstatus":gkcore.enumdict["ConnectionFailed"] } + # If no delivery challan is linked an entry is made in stock table after invoice details are updated. else: try: updateinvoice = self.con.execute(invoice.update().where(invoice.c.invid==invdataset["invid"]).values(invdataset)) -- GitLab From afafb2743c998faf5ab2701b5593e35f47a25809 Mon Sep 17 00:00:00 2001 From: abhijith Date: Sat, 6 Jan 2018 07:56:36 +0530 Subject: [PATCH 40/56] Inserted stock items in dcinv.c.invprods --- 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 a85b731..1276b6f 100644 --- a/gkcore/views/api_invoice.py +++ b/gkcore/views/api_invoice.py @@ -176,6 +176,7 @@ class api_invoice(object): dcinvdataset["dcid"]=invdataset.pop("dcid") dcinvdataset["orgcode"]=invdataset["orgcode"] dcinvdataset["invid"]=invdataset["invid"] + dcinvdataset["invprods"] = stockdataset["items"] try: updateinvoice = self.con.execute(invoice.update().where(invoice.c.invid==invdataset["invid"]).values(invdataset)) result = self.con.execute(dcinv.insert(),[dcinvdataset]) -- GitLab From a393865f6a8ca868c07c3287013cc8e8157e3a47 Mon Sep 17 00:00:00 2001 From: kk Date: Wed, 20 Dec 2017 14:22:06 +0530 Subject: [PATCH 41/56] Started work on auto generating voucher numbers for data import. --- gkcore/views/api_transaction.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/gkcore/views/api_transaction.py b/gkcore/views/api_transaction.py index 3de4076..03249ea 100644 --- a/gkcore/views/api_transaction.py +++ b/gkcore/views/api_transaction.py @@ -67,7 +67,13 @@ class api_transaction(object): self.request = Request self.request = request self.con = Connection - + def __genVoucherNumber(self,voucherType,con): + """ + Purpose: + Generates a new vouchernumber based on vouchertype and max count for that type. + """ + initialType = "" + @view_config(request_method='POST',renderer='json') def addVoucher(self): -- GitLab From 6b605eb6d9b53d991f532399293e66f7b15973d0 Mon Sep 17 00:00:00 2001 From: Prajkta Patkar Date: Wed, 20 Dec 2017 15:14:23 +0530 Subject: [PATCH 42/56] a private function to generate voucher numbers --- gkcore/views/api_transaction.py | 32 ++++++++++++++++++++++++++++++-- 1 file changed, 30 insertions(+), 2 deletions(-) diff --git a/gkcore/views/api_transaction.py b/gkcore/views/api_transaction.py index 03249ea..53e9b30 100644 --- a/gkcore/views/api_transaction.py +++ b/gkcore/views/api_transaction.py @@ -72,9 +72,37 @@ class api_transaction(object): Purpose: Generates a new vouchernumber based on vouchertype and max count for that type. """ - initialType = "" - + if voucherType == "Journal": + initialType = "jr" + if voucherType == "Contra": + initialType = "cr" + if voucherType == "Payment": + initialType = "pt" + if voucherType == "Receipt": + initialType = "rt" + if voucherType == "Sales": + initialType = "sl" + if voucherType == "Purchase": + initialType = "pu" + if voucherType == "Credit Note": + initialType = "cn" + if voucherType == "Debit Note": + initialType = "dn" + if voucherType == "Sale Return": + initialType = "sr" + if voucherType == "Purchase Return": + initialType = "pr" + + vchCountResult = self.con.execute("select count(vouchercode) as vcount from vouchers where orgcode = %d"%(int(orgcode))) + vchCount = vchCountResult.fetchone() + if vchCount["vcount"] == 0: + initialType = initialType + "1" + else: + vchCodeResult = self.con.execute("select max(vouchercode) as vcode from vouchers") + vchCode = vchCodeResult.fetchone() + initialType = initialType + str(vchCode) + @view_config(request_method='POST',renderer='json') def addVoucher(self): """ -- GitLab From c89b293b48b32dc2495efce1a0763e23041a8e48 Mon Sep 17 00:00:00 2001 From: kk Date: Wed, 20 Dec 2017 15:38:56 +0530 Subject: [PATCH 43/56] final changes to voucher number auto generation code. --- gkcore/views/api_transaction.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/gkcore/views/api_transaction.py b/gkcore/views/api_transaction.py index 53e9b30..f357e15 100644 --- a/gkcore/views/api_transaction.py +++ b/gkcore/views/api_transaction.py @@ -72,6 +72,7 @@ class api_transaction(object): Purpose: Generates a new vouchernumber based on vouchertype and max count for that type. """ + initialType = "" if voucherType == "Journal": initialType = "jr" if voucherType == "Contra": @@ -100,12 +101,14 @@ class api_transaction(object): else: vchCodeResult = self.con.execute("select max(vouchercode) as vcode from vouchers") vchCode = vchCodeResult.fetchone() - initialType = initialType + str(vchCode) + initialType = initialType + str(vchCode["vcode"]) + return initialType @view_config(request_method='POST',renderer='json') def addVoucher(self): """ + Purpose: adds a new voucher for given organisation and returns success as gkstatus if adding is successful. Description: -- GitLab From 02262d9474c1dfa50d541489c870e56f6581a721 Mon Sep 17 00:00:00 2001 From: Prajkta Patkar Date: Wed, 20 Dec 2017 15:56:41 +0530 Subject: [PATCH 44/56] checked presence of voucher no in POST of voucher and called function accordingly --- gkcore/views/api_transaction.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/gkcore/views/api_transaction.py b/gkcore/views/api_transaction.py index f357e15..3993c64 100644 --- a/gkcore/views/api_transaction.py +++ b/gkcore/views/api_transaction.py @@ -67,7 +67,7 @@ class api_transaction(object): self.request = Request self.request = request self.con = Connection - def __genVoucherNumber(self,voucherType,con): + def __genVoucherNumber(self,voucherType,orgcode,con): """ Purpose: Generates a new vouchernumber based on vouchertype and max count for that type. @@ -150,6 +150,11 @@ class api_transaction(object): if dataset.has_key("instrumentdate"): instrumentdate=dataset["instrumentdate"] dataset["instrumentdate"] = datetime.strptime(instrumentdate, "%Y-%m-%d") + # generate voucher number if it is sent. + if dataset.has_key("vouchernumber") == False: + vchNo = self.__genVoucherNumber(self.con,voucherType,dataset["orgcode"]) + dataset["vouchernumber"] = initialType + result = self.con.execute(vouchers.insert(),[dataset]) for drkeys in drs.keys(): self.con.execute("update accounts set vouchercount = vouchercount +1 where accountcode = %d"%(int(drkeys))) -- GitLab From 66070197d5aaf735f3a935ebe1aacbbd96105440 Mon Sep 17 00:00:00 2001 From: Prajkta Patkar Date: Wed, 20 Dec 2017 15:59:11 +0530 Subject: [PATCH 45/56] corrected --- gkcore/views/api_transaction.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gkcore/views/api_transaction.py b/gkcore/views/api_transaction.py index 3993c64..a4feb3e 100644 --- a/gkcore/views/api_transaction.py +++ b/gkcore/views/api_transaction.py @@ -150,7 +150,7 @@ class api_transaction(object): if dataset.has_key("instrumentdate"): instrumentdate=dataset["instrumentdate"] dataset["instrumentdate"] = datetime.strptime(instrumentdate, "%Y-%m-%d") - # generate voucher number if it is sent. + # generate voucher number if it is not sent. if dataset.has_key("vouchernumber") == False: vchNo = self.__genVoucherNumber(self.con,voucherType,dataset["orgcode"]) dataset["vouchernumber"] = initialType -- GitLab From 48c0424afc663824da478f75a8ae320dfa0e7812 Mon Sep 17 00:00:00 2001 From: Prajkta Patkar Date: Wed, 20 Dec 2017 16:33:35 +0530 Subject: [PATCH 46/56] voucher type fetched --- gkcore/views/api_transaction.py | 1 + 1 file changed, 1 insertion(+) diff --git a/gkcore/views/api_transaction.py b/gkcore/views/api_transaction.py index a4feb3e..5acc5f2 100644 --- a/gkcore/views/api_transaction.py +++ b/gkcore/views/api_transaction.py @@ -152,6 +152,7 @@ class api_transaction(object): dataset["instrumentdate"] = datetime.strptime(instrumentdate, "%Y-%m-%d") # generate voucher number if it is not sent. if dataset.has_key("vouchernumber") == False: + voucherType = dataset["vouchertype"] vchNo = self.__genVoucherNumber(self.con,voucherType,dataset["orgcode"]) dataset["vouchernumber"] = initialType -- GitLab From 1b7b3a1aa860112a23011fc0cf9f0a222280bba9 Mon Sep 17 00:00:00 2001 From: Prajkta Patkar Date: Wed, 20 Dec 2017 16:34:29 +0530 Subject: [PATCH 47/56] corrected --- gkcore/views/api_transaction.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gkcore/views/api_transaction.py b/gkcore/views/api_transaction.py index 5acc5f2..b6a2f3b 100644 --- a/gkcore/views/api_transaction.py +++ b/gkcore/views/api_transaction.py @@ -154,7 +154,7 @@ class api_transaction(object): if dataset.has_key("vouchernumber") == False: voucherType = dataset["vouchertype"] vchNo = self.__genVoucherNumber(self.con,voucherType,dataset["orgcode"]) - dataset["vouchernumber"] = initialType + dataset["vouchernumber"] = vchNo result = self.con.execute(vouchers.insert(),[dataset]) for drkeys in drs.keys(): -- GitLab From 54358bc6e2555b1b5bdb5bb9e98f910b8ae1e9e1 Mon Sep 17 00:00:00 2001 From: Prajkta_Patkar Date: Fri, 5 Jan 2018 13:58:10 +0530 Subject: [PATCH 48/56] parameters passing sequence corrected in auto no. generated voucher api --- gkcore/views/api_transaction.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gkcore/views/api_transaction.py b/gkcore/views/api_transaction.py index b6a2f3b..b9aeb95 100644 --- a/gkcore/views/api_transaction.py +++ b/gkcore/views/api_transaction.py @@ -67,7 +67,7 @@ class api_transaction(object): self.request = Request self.request = request self.con = Connection - def __genVoucherNumber(self,voucherType,orgcode,con): + def __genVoucherNumber(self,con,voucherType,orgcode): """ Purpose: Generates a new vouchernumber based on vouchertype and max count for that type. -- GitLab From 2b5cdaf202c5884abc5f7760c69eaf2d10c67c5a Mon Sep 17 00:00:00 2001 From: Prajkta_Patkar Date: Wed, 10 Jan 2018 14:47:04 +0530 Subject: [PATCH 49/56] changed case of v type --- gkcore/views/api_transaction.py | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/gkcore/views/api_transaction.py b/gkcore/views/api_transaction.py index b9aeb95..ced5f31 100644 --- a/gkcore/views/api_transaction.py +++ b/gkcore/views/api_transaction.py @@ -73,25 +73,25 @@ class api_transaction(object): Generates a new vouchernumber based on vouchertype and max count for that type. """ initialType = "" - if voucherType == "Journal": + if voucherType == "journal": initialType = "jr" - if voucherType == "Contra": + if voucherType == "contra": initialType = "cr" - if voucherType == "Payment": + if voucherType == "payment": initialType = "pt" - if voucherType == "Receipt": + if voucherType == "receipt": initialType = "rt" - if voucherType == "Sales": + if voucherType == "sales": initialType = "sl" - if voucherType == "Purchase": + if voucherType == "purchase": initialType = "pu" - if voucherType == "Credit Note": + if voucherType == "credit Note": initialType = "cn" - if voucherType == "Debit Note": + if voucherType == "debit Note": initialType = "dn" - if voucherType == "Sale Return": + if voucherType == "sale Return": initialType = "sr" - if voucherType == "Purchase Return": + if voucherType == "purchase Return": initialType = "pr" vchCountResult = self.con.execute("select count(vouchercode) as vcount from vouchers where orgcode = %d"%(int(orgcode))) -- GitLab From fec1015145d83f0b09447ac43b9837ef7a787eec Mon Sep 17 00:00:00 2001 From: Prajkta_Patkar Date: Wed, 10 Jan 2018 16:47:06 +0530 Subject: [PATCH 50/56] space remove from credit note and converted to 1 word creditnote same for other --- gkcore/views/api_transaction.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/gkcore/views/api_transaction.py b/gkcore/views/api_transaction.py index ced5f31..a65e714 100644 --- a/gkcore/views/api_transaction.py +++ b/gkcore/views/api_transaction.py @@ -85,13 +85,13 @@ class api_transaction(object): initialType = "sl" if voucherType == "purchase": initialType = "pu" - if voucherType == "credit Note": + if voucherType == "creditnote": initialType = "cn" - if voucherType == "debit Note": + if voucherType == "debitnote": initialType = "dn" - if voucherType == "sale Return": + if voucherType == "salereturn": initialType = "sr" - if voucherType == "purchase Return": + if voucherType == "purchasereturn": initialType = "pr" vchCountResult = self.con.execute("select count(vouchercode) as vcount from vouchers where orgcode = %d"%(int(orgcode))) -- GitLab From 6f6adc471fbed888dd7513b7fee0593a372ed2c7 Mon Sep 17 00:00:00 2001 From: Prajkta_Patkar Date: Wed, 10 Jan 2018 16:48:33 +0530 Subject: [PATCH 51/56] authors list name added --- gkcore/views/api_transaction.py | 1 + 1 file changed, 1 insertion(+) diff --git a/gkcore/views/api_transaction.py b/gkcore/views/api_transaction.py index a65e714..6dd716f 100644 --- a/gkcore/views/api_transaction.py +++ b/gkcore/views/api_transaction.py @@ -24,6 +24,7 @@ Contributors: "Ishan Masdekar " "Navin Karkera" "Vanita Rajpurohit" +'Prajkta Patkar' """ -- GitLab From 5158ec11d1a064d2284fd81464c79a44b3e8ded7 Mon Sep 17 00:00:00 2001 From: abhijith Date: Tue, 9 Jan 2018 15:59:26 +0530 Subject: [PATCH 52/56] Added changelog for version 4.50. Added Nitesh's name to AUTHORS list. --- AUTHORS | 1 + CHANGELOG | 10 ++++++++++ 2 files changed, 11 insertions(+) diff --git a/AUTHORS b/AUTHORS index 89b1591..9861521 100644 --- a/AUTHORS +++ b/AUTHORS @@ -2,6 +2,7 @@ Active Contributors "Abhijith Balan" "Mohd. Talha Pawaty" +"Nitesh Chaughule" "Prajkta Patkar" "Reshma Bhatawadekar" diff --git a/CHANGELOG b/CHANGELOG index 016d137..bb0a7fa 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -1,3 +1,13 @@ +[9-January-2018 Release 4.50] +* Function in Bill Wise API that returns all unpaid invoices. +* Function in Bill Wise API that returns both unpaid and partially paid invoices. +* Function in User API that returns list of users having same role and their role. +* Function in User API that returns all data of a user(accessible only to admin). +* All details of a user can be edited by admin. +* Consignee details can be added in Delivery Note. +* Function in Godowns API to return name and address of all godowns that contain products. +* Modified PUT of Invoice API. + [10-November-2017 Release 4.25 Update] * Permissions to Godown In Charge modified. * CESS field added in invoice and cash memo. -- GitLab From 484032a97d64befed3311cab955d720fa02b2327 Mon Sep 17 00:00:00 2001 From: abhijith Date: Tue, 9 Jan 2018 17:36:10 +0530 Subject: [PATCH 53/56] Modified licence in all files --- gkcore/__init__.py | 1 + gkcore/models/gkdb.py | 2 +- gkcore/models/meta.py | 1 + gkcore/tests/test_account.py | 1 + gkcore/tests/test_accountsbyrule.py | 1 + gkcore/tests/test_backuprestore.py | 1 + gkcore/tests/test_category.py | 1 + gkcore/tests/test_categoryspecs.py | 1 + gkcore/tests/test_customer.py | 1 + gkcore/tests/test_delchal.py | 1 + gkcore/tests/test_godown.py | 1 + gkcore/tests/test_groupssubgroups.py | 1 + gkcore/tests/test_invoice.py | 1 + gkcore/tests/test_log.py | 1 + gkcore/tests/test_login.py | 1 + gkcore/tests/test_organisation.py | 1 + gkcore/tests/test_product.py | 1 + gkcore/tests/test_project.py | 1 + gkcore/tests/test_reports.py | 1 + gkcore/tests/test_rollclose.py | 1 + gkcore/tests/test_supplier.py | 1 + gkcore/tests/test_tax.py | 1 + gkcore/tests/test_transaction.py | 1 + gkcore/tests/test_transfernote.py | 1 + gkcore/tests/test_unit.py | 1 + gkcore/tests/test_user.py | 1 + gkcore/views/api_account.py | 2 +- gkcore/views/api_accountsbyrule.py | 2 ++ gkcore/views/api_bankrecon.py | 1 + gkcore/views/api_billwise.py | 1 + gkcore/views/api_category.py | 1 + gkcore/views/api_categoryspecs.py | 1 + gkcore/views/api_customer.py | 1 + gkcore/views/api_delchal.py | 2 +- gkcore/views/api_godown.py | 1 + gkcore/views/api_groupssubgroups.py | 1 + gkcore/views/api_invoice.py | 1 + gkcore/views/api_log.py | 1 + gkcore/views/api_login.py | 1 + gkcore/views/api_organisation.py | 2 +- gkcore/views/api_product.py | 1 + gkcore/views/api_project.py | 1 + gkcore/views/api_purchaseorder.py | 1 + gkcore/views/api_reports.py | 1 + gkcore/views/api_rollclose.py | 1 + gkcore/views/api_state.py | 1 + gkcore/views/api_tax.py | 1 + gkcore/views/api_transaction.py | 1 + gkcore/views/api_transfernote.py | 1 + gkcore/views/api_unitofmeasurement.py | 1 + gkcore/views/api_user.py | 1 + gkutil.sh | 1 + initdb.py | 1 + 53 files changed, 54 insertions(+), 4 deletions(-) diff --git a/gkcore/__init__.py b/gkcore/__init__.py index 3c7fded..3e2cae4 100644 --- a/gkcore/__init__.py +++ b/gkcore/__init__.py @@ -1,6 +1,7 @@ """ Copyright (C) 2013, 2014, 2015, 2016 Digital Freedom Foundation +Copyright (C) 2017, 2018 Digital Freedom Foundation & Accion Labs This file is part of GNUKhata:A modular,robust and Free Accounting System. GNUKhata is Free Software; you can redistribute it and/or modify diff --git a/gkcore/models/gkdb.py b/gkcore/models/gkdb.py index 6d5559c..b49a1e3 100644 --- a/gkcore/models/gkdb.py +++ b/gkcore/models/gkdb.py @@ -1,7 +1,7 @@ """ Copyright (C) 2013, 2014, 2015, 2016 Digital Freedom Foundation -Copyright (C) 2017 Digital Freedom Foundation & Accion Labs Pvt. Ltd. +Copyright (C) 2017, 2018 Digital Freedom Foundation & Accion Labs Pvt. Ltd. This file is part of GNUKhata:A modular,robust and Free Accounting System. GNUKhata is Free Software; you can redistribute it and/or modify diff --git a/gkcore/models/meta.py b/gkcore/models/meta.py index d367ae9..883b3bb 100644 --- a/gkcore/models/meta.py +++ b/gkcore/models/meta.py @@ -1,6 +1,7 @@ """ Copyright (C) 2013, 2014, 2015, 2016 Digital Freedom Foundation +Copyright (C) 2017, 2018 Digital Freedom Foundation & Accion Labs This file is part of GNUKhata:A modular,robust and Free Accounting System. GNUKhata is Free Software; you can redistribute it and/or modify diff --git a/gkcore/tests/test_account.py b/gkcore/tests/test_account.py index 33ad807..7823418 100644 --- a/gkcore/tests/test_account.py +++ b/gkcore/tests/test_account.py @@ -1,5 +1,6 @@ """ Copyright (C) 2013, 2014, 2015, 2016 Digital Freedom Foundation +Copyright (C) 2017, 2018 Digital Freedom Foundation & Accion Labs This file is part of GNUKhata:A modular,robust and Free Accounting System. GNUKhata is Free Software; you can redistribute it and/or modify diff --git a/gkcore/tests/test_accountsbyrule.py b/gkcore/tests/test_accountsbyrule.py index 8babb03..971d50e 100644 --- a/gkcore/tests/test_accountsbyrule.py +++ b/gkcore/tests/test_accountsbyrule.py @@ -1,5 +1,6 @@ """ Copyright (C) 2013, 2014, 2015, 2016 Digital Freedom Foundation +Copyright (C) 2017, 2018 Digital Freedom Foundation & Accion Labs This file is part of GNUKhata:A modular,robust and Free Accounting System. GNUKhata is Free Software; you can redistribute it and/or modify diff --git a/gkcore/tests/test_backuprestore.py b/gkcore/tests/test_backuprestore.py index 2e82e8f..810a981 100644 --- a/gkcore/tests/test_backuprestore.py +++ b/gkcore/tests/test_backuprestore.py @@ -1,5 +1,6 @@ """ Copyright (C) 2013, 2014, 2015, 2016 Digital Freedom Foundation +Copyright (C) 2017, 2018 Digital Freedom Foundation & Accion Labs This file is part of GNUKhata:A modular,robust and Free Accounting System. GNUKhata is Free Software; you can redistribute it and/or modify diff --git a/gkcore/tests/test_category.py b/gkcore/tests/test_category.py index 773fd15..6537acc 100644 --- a/gkcore/tests/test_category.py +++ b/gkcore/tests/test_category.py @@ -1,5 +1,6 @@ """ Copyright (C) 2013, 2014, 2015, 2016 Digital Freedom Foundation +Copyright (C) 2017, 2018 Digital Freedom Foundation & Accion Labs This file is part of GNUKhata:A modular,robust and Free Accounting System. GNUKhata is Free Software; you can redistribute it and/or modify diff --git a/gkcore/tests/test_categoryspecs.py b/gkcore/tests/test_categoryspecs.py index 5a29fce..8778f48 100644 --- a/gkcore/tests/test_categoryspecs.py +++ b/gkcore/tests/test_categoryspecs.py @@ -1,5 +1,6 @@ """ Copyright (C) 2013, 2014, 2015, 2016 Digital Freedom Foundation +Copyright (C) 2017, 2018 Digital Freedom Foundation & Accion Labs This file is part of GNUKhata:A modular,robust and Free Accounting System. GNUKhata is Free Software; you can redistribute it and/or modify diff --git a/gkcore/tests/test_customer.py b/gkcore/tests/test_customer.py index ee77d53..00c5772 100644 --- a/gkcore/tests/test_customer.py +++ b/gkcore/tests/test_customer.py @@ -1,5 +1,6 @@ """ Copyright (C) 2013, 2014, 2015, 2016 Digital Freedom Foundation +Copyright (C) 2017, 2018 Digital Freedom Foundation & Accion Labs This file is part of GNUKhata:A modular,robust and Free Accounting System. GNUKhata is Free Software; you can redistribute it and/or modify diff --git a/gkcore/tests/test_delchal.py b/gkcore/tests/test_delchal.py index bed1e91..5e1fb9e 100644 --- a/gkcore/tests/test_delchal.py +++ b/gkcore/tests/test_delchal.py @@ -1,5 +1,6 @@ """ Copyright (C) 2013, 2014, 2015, 2016 Digital Freedom Foundation +Copyright (C) 2017, 2018 Digital Freedom Foundation & Accion Labs This file is part of GNUKhata:A modular,robust and Free Accounting System. GNUKhata is Free Software; you can redistribute it and/or modify diff --git a/gkcore/tests/test_godown.py b/gkcore/tests/test_godown.py index 57d497c..665cb4e 100644 --- a/gkcore/tests/test_godown.py +++ b/gkcore/tests/test_godown.py @@ -1,5 +1,6 @@ """ Copyright (C) 2013, 2014, 2015, 2016 Digital Freedom Foundation +Copyright (C) 2017, 2018 Digital Freedom Foundation & Accion Labs This file is part of GNUKhata:A modular,robust and Free Accounting System. GNUKhata is Free Software; you can redistribute it and/or modify diff --git a/gkcore/tests/test_groupssubgroups.py b/gkcore/tests/test_groupssubgroups.py index 0c59cd3..ad6803c 100644 --- a/gkcore/tests/test_groupssubgroups.py +++ b/gkcore/tests/test_groupssubgroups.py @@ -1,5 +1,6 @@ """ Copyright (C) 2013, 2014, 2015, 2016 Digital Freedom Foundation +Copyright (C) 2017, 2018 Digital Freedom Foundation & Accion Labs This file is part of GNUKhata:A modular,robust and Free Accounting System. GNUKhata is Free Software; you can redistribute it and/or modify diff --git a/gkcore/tests/test_invoice.py b/gkcore/tests/test_invoice.py index fba1497..1ddd7b5 100644 --- a/gkcore/tests/test_invoice.py +++ b/gkcore/tests/test_invoice.py @@ -1,5 +1,6 @@ """ Copyright (C) 2013, 2014, 2015, 2016 Digital Freedom Foundation +Copyright (C) 2017, 2018 Digital Freedom Foundation & Accion Labs This file is part of GNUKhata:A modular,robust and Free Accounting System. GNUKhata is Free Software; you can redistribute it and/or modify diff --git a/gkcore/tests/test_log.py b/gkcore/tests/test_log.py index 7cfea75..ecccceb 100644 --- a/gkcore/tests/test_log.py +++ b/gkcore/tests/test_log.py @@ -1,5 +1,6 @@ """ Copyright (C) 2013, 2014, 2015, 2016 Digital Freedom Foundation +Copyright (C) 2017, 2018 Digital Freedom Foundation & Accion Labs This file is part of GNUKhata:A modular,robust and Free Accounting System. GNUKhata is Free Software; you can redistribute it and/or modify diff --git a/gkcore/tests/test_login.py b/gkcore/tests/test_login.py index 4aaa892..ce3326c 100644 --- a/gkcore/tests/test_login.py +++ b/gkcore/tests/test_login.py @@ -1,5 +1,6 @@ """ Copyright (C) 2013, 2014, 2015, 2016 Digital Freedom Foundation +Copyright (C) 2017, 2018 Digital Freedom Foundation & Accion Labs This file is part of GNUKhata:A modular,robust and Free Accounting System. GNUKhata is Free Software; you can redistribute it and/or modify diff --git a/gkcore/tests/test_organisation.py b/gkcore/tests/test_organisation.py index b7e9d9f..fa74b37 100644 --- a/gkcore/tests/test_organisation.py +++ b/gkcore/tests/test_organisation.py @@ -1,5 +1,6 @@ """ Copyright (C) 2013, 2014, 2015, 2016 Digital Freedom Foundation +Copyright (C) 2017, 2018 Digital Freedom Foundation & Accion Labs This file is part of GNUKhata:A modular,robust and Free Accounting System. GNUKhata is Free Software; you can redistribute it and/or modify diff --git a/gkcore/tests/test_product.py b/gkcore/tests/test_product.py index 91df28d..2d7d615 100644 --- a/gkcore/tests/test_product.py +++ b/gkcore/tests/test_product.py @@ -1,5 +1,6 @@ """ Copyright (C) 2013, 2014, 2015, 2016 Digital Freedom Foundation +Copyright (C) 2017, 2018 Digital Freedom Foundation & Accion Labs This file is part of GNUKhata:A modular,robust and Free Accounting System. GNUKhata is Free Software; you can redistribute it and/or modify diff --git a/gkcore/tests/test_project.py b/gkcore/tests/test_project.py index 56a1f6b..c2ca350 100644 --- a/gkcore/tests/test_project.py +++ b/gkcore/tests/test_project.py @@ -1,5 +1,6 @@ """ Copyright (C) 2013, 2014, 2015, 2016 Digital Freedom Foundation +Copyright (C) 2017, 2018 Digital Freedom Foundation & Accion Labs This file is part of GNUKhata:A modular,robust and Free Accounting System. GNUKhata is Free Software; you can redistribute it and/or modify diff --git a/gkcore/tests/test_reports.py b/gkcore/tests/test_reports.py index e5f953b..578e55e 100644 --- a/gkcore/tests/test_reports.py +++ b/gkcore/tests/test_reports.py @@ -1,5 +1,6 @@ """ Copyright (C) 2013, 2014, 2015, 2016 Digital Freedom Foundation +Copyright (C) 2017, 2018 Digital Freedom Foundation & Accion Labs This file is part of GNUKhata:A modular,robust and Free Accounting System. GNUKhata is Free Software; you can redistribute it and/or modify diff --git a/gkcore/tests/test_rollclose.py b/gkcore/tests/test_rollclose.py index 1ef38ac..6da8ea0 100644 --- a/gkcore/tests/test_rollclose.py +++ b/gkcore/tests/test_rollclose.py @@ -1,5 +1,6 @@ """ Copyright (C) 2013, 2014, 2015, 2016 Digital Freedom Foundation +Copyright (C) 2017, 2018 Digital Freedom Foundation & Accion Labs This file is part of GNUKhata:A modular,robust and Free Accounting System. GNUKhata is Free Software; you can redistribute it and/or modify diff --git a/gkcore/tests/test_supplier.py b/gkcore/tests/test_supplier.py index 7ac4cef..e16fbb2 100644 --- a/gkcore/tests/test_supplier.py +++ b/gkcore/tests/test_supplier.py @@ -1,5 +1,6 @@ """ Copyright (C) 2013, 2014, 2015, 2016 Digital Freedom Foundation +Copyright (C) 2017, 2018 Digital Freedom Foundation & Accion Labs This file is part of GNUKhata:A modular,robust and Free Accounting System. GNUKhata is Free Software; you can redistribute it and/or modify diff --git a/gkcore/tests/test_tax.py b/gkcore/tests/test_tax.py index e1e7f1e..1b66761 100644 --- a/gkcore/tests/test_tax.py +++ b/gkcore/tests/test_tax.py @@ -1,5 +1,6 @@ """ Copyright (C) 2013, 2014, 2015, 2016 Digital Freedom Foundation +Copyright (C) 2017, 2018 Digital Freedom Foundation & Accion Labs This file is part of GNUKhata:A modular,robust and Free Accounting System. GNUKhata is Free Software; you can redistribute it and/or modify diff --git a/gkcore/tests/test_transaction.py b/gkcore/tests/test_transaction.py index b6aeb53..b75de2b 100644 --- a/gkcore/tests/test_transaction.py +++ b/gkcore/tests/test_transaction.py @@ -1,5 +1,6 @@ """ Copyright (C) 2013, 2014, 2015, 2016 Digital Freedom Foundation +Copyright (C) 2017, 2018 Digital Freedom Foundation & Accion Labs This file is part of GNUKhata:A modular,robust and Free Accounting System. GNUKhata is Free Software; you can redistribute it and/or modify diff --git a/gkcore/tests/test_transfernote.py b/gkcore/tests/test_transfernote.py index 050783a..d5cee35 100644 --- a/gkcore/tests/test_transfernote.py +++ b/gkcore/tests/test_transfernote.py @@ -1,5 +1,6 @@ """ Copyright (C) 2013, 2014, 2015, 2016 Digital Freedom Foundation +Copyright (C) 2017, 2018 Digital Freedom Foundation & Accion Labs This file is part of GNUKhata:A modular,robust and Free Accounting System. GNUKhata is Free Software; you can redistribute it and/or modify diff --git a/gkcore/tests/test_unit.py b/gkcore/tests/test_unit.py index d3c18ad..4ade9f3 100644 --- a/gkcore/tests/test_unit.py +++ b/gkcore/tests/test_unit.py @@ -1,5 +1,6 @@ """ Copyright (C) 2013, 2014, 2015, 2016 Digital Freedom Foundation +Copyright (C) 2017, 2018 Digital Freedom Foundation & Accion Labs This file is part of GNUKhata:A modular,robust and Free Accounting System. GNUKhata is Free Software; you can redistribute it and/or modify diff --git a/gkcore/tests/test_user.py b/gkcore/tests/test_user.py index d278189..8522a4f 100644 --- a/gkcore/tests/test_user.py +++ b/gkcore/tests/test_user.py @@ -1,5 +1,6 @@ """ Copyright (C) 2013, 2014, 2015, 2016 Digital Freedom Foundation +Copyright (C) 2017, 2018 Digital Freedom Foundation & Accion Labs This file is part of GNUKhata:A modular,robust and Free Accounting System. GNUKhata is Free Software; you can redistribute it and/or modify diff --git a/gkcore/views/api_account.py b/gkcore/views/api_account.py index 23b4265..9322299 100644 --- a/gkcore/views/api_account.py +++ b/gkcore/views/api_account.py @@ -1,7 +1,7 @@ """ Copyright (C) 2013, 2014, 2015, 2016, Digital Freedom Foundation -Copyright (C) 2017 Digital Freedom Foundation & Accion Labs +Copyright (C) 2017, 2018 Digital Freedom Foundation & Accion Labs This file is part of GNUKhata:A modular,robust and Free Accounting System. GNUKhata is Free Software; you can redistribute it and/or modify diff --git a/gkcore/views/api_accountsbyrule.py b/gkcore/views/api_accountsbyrule.py index 09a7f93..a82ee7f 100644 --- a/gkcore/views/api_accountsbyrule.py +++ b/gkcore/views/api_accountsbyrule.py @@ -1,6 +1,8 @@ """ Copyright (C) 2013, 2014, 2015, 2016 Digital Freedom Foundation +Copyright (C) 2017, 2018 Digital Freedom Foundation & Accion Labs Pvt. Ltd. + This file is part of GNUKhata:A modular,robust and Free Accounting System. GNUKhata is Free Software; you can redistribute it and/or modify diff --git a/gkcore/views/api_bankrecon.py b/gkcore/views/api_bankrecon.py index 3dbdc2b..b1ae6ca 100644 --- a/gkcore/views/api_bankrecon.py +++ b/gkcore/views/api_bankrecon.py @@ -1,6 +1,7 @@ """ Copyright (C) 2013, 2014, 2015, 2016 Digital Freedom Foundation +Copyright (C) 2017, 2018 Digital Freedom Foundation & Accion Labs Pvt. Ltd. This file is part of GNUKhata:A modular,robust and Free Accounting System. GNUKhata is Free Software; you can redistribute it and/or modify diff --git a/gkcore/views/api_billwise.py b/gkcore/views/api_billwise.py index 17b669b..a5c0689 100644 --- a/gkcore/views/api_billwise.py +++ b/gkcore/views/api_billwise.py @@ -1,5 +1,6 @@ """ Copyright (C) 2013, 2014, 2015, 2016, 2017 Digital Freedom Foundation +Copyright (C) 2017, 2018 Digital Freedom Foundation & Accion Labs Pvt. Ltd. This file is part of GNUKhata:A modular,robust and Free Accounting System. GNUKhata is Free Software; you can redistribute it and/or modify diff --git a/gkcore/views/api_category.py b/gkcore/views/api_category.py index 2acbc86..cd9f8a5 100644 --- a/gkcore/views/api_category.py +++ b/gkcore/views/api_category.py @@ -1,5 +1,6 @@ """ Copyright (C) 2013, 2014, 2015, 2016 Digital Freedom Foundation +Copyright (C) 2017, 2018 Digital Freedom Foundation & Accion Labs Pvt. Ltd. This file is part of GNUKhata:A modular,robust and Free Accounting System. GNUKhata is Free Software; you can redistribute it and/or modify diff --git a/gkcore/views/api_categoryspecs.py b/gkcore/views/api_categoryspecs.py index ea84bf1..f3fdc37 100644 --- a/gkcore/views/api_categoryspecs.py +++ b/gkcore/views/api_categoryspecs.py @@ -1,6 +1,7 @@ """ Copyright (C) 2013, 2014, 2015, 2016 Digital Freedom Foundation +Copyright (C) 2017, 2018 Digital Freedom Foundation & Accion Labs Pvt. Ltd. This file is part of GNUKhata:A modular,robust and Free Accounting System. GNUKhata is Free Software; you can redistribute it and/or modify diff --git a/gkcore/views/api_customer.py b/gkcore/views/api_customer.py index 87ea7d7..8a0bceb 100644 --- a/gkcore/views/api_customer.py +++ b/gkcore/views/api_customer.py @@ -1,6 +1,7 @@ """ Copyright (C) 2013, 2014, 2015, 2016 Digital Freedom Foundation +Copyright (C) 2017, 2018 Digital Freedom Foundation & Accion Labs Pvt. Ltd. This file is part of GNUKhata:A modular,robust and Free Accounting System. GNUKhata is Free Software; you can redistribute it and/or modify diff --git a/gkcore/views/api_delchal.py b/gkcore/views/api_delchal.py index 3096947..0d59be0 100644 --- a/gkcore/views/api_delchal.py +++ b/gkcore/views/api_delchal.py @@ -1,7 +1,7 @@ """ Copyright (C) 2013, 2014, 2015, 2016 Digital Freedom Foundation -Copyright (C) 2017 Digital Freedom Foundation & Accion Labs Pvt. Ltd. +Copyright (C) 2017, 2018 Digital Freedom Foundation & Accion Labs Pvt. Ltd. This file is part of GNUKhata:A modular,robust and Free Accounting System. GNUKhata is Free Software; you can redistribute it and/or modify diff --git a/gkcore/views/api_godown.py b/gkcore/views/api_godown.py index 83ffe2f..d044145 100644 --- a/gkcore/views/api_godown.py +++ b/gkcore/views/api_godown.py @@ -1,6 +1,7 @@ """ Copyright (C) 2013, 2014, 2015, 2016 Digital Freedom Foundation +Copyright (C) 2017, 2018 Digital Freedom Foundation & Accion Labs Pvt. Ltd. This file is part of GNUKhata:A modular,robust and Free Accounting System. GNUKhata is Free Software; you can redistribute it and/or modify diff --git a/gkcore/views/api_groupssubgroups.py b/gkcore/views/api_groupssubgroups.py index a40744c..2ab45a6 100644 --- a/gkcore/views/api_groupssubgroups.py +++ b/gkcore/views/api_groupssubgroups.py @@ -1,6 +1,7 @@ """ Copyright (C) 2013, 2014, 2015, 2016 Digital Freedom Foundation +Copyright (C) 2017, 2018 Digital Freedom Foundation & Accion Labs Pvt. Ltd. This file is part of GNUKhata:A modular,robust and Free Accounting System. GNUKhata is Free Software; you can redistribute it and/or modify diff --git a/gkcore/views/api_invoice.py b/gkcore/views/api_invoice.py index 1276b6f..dcc5422 100644 --- a/gkcore/views/api_invoice.py +++ b/gkcore/views/api_invoice.py @@ -1,5 +1,6 @@ """ Copyright (C) 2013, 2014, 2015, 2016 Digital Freedom Foundation +Copyright (C) 2017, 2018 Digital Freedom Foundation & Accion Labs Pvt. Ltd. This file is part of GNUKhata:A modular,robust and Free Accounting System. GNUKhata is Free Software; you can redistribute it and/or modify diff --git a/gkcore/views/api_log.py b/gkcore/views/api_log.py index f710e9a..f79ed08 100644 --- a/gkcore/views/api_log.py +++ b/gkcore/views/api_log.py @@ -1,6 +1,7 @@ """ Copyright (C) 2013, 2014, 2015, 2016 Digital Freedom Foundation +Copyright (C) 2017, 2018 Digital Freedom Foundation & Accion Labs Pvt. Ltd. This file is part of GNUKhata:A modular,robust and Free Accounting System. GNUKhata is Free Software; you can redistribute it and/or modify diff --git a/gkcore/views/api_login.py b/gkcore/views/api_login.py index 5deee2e..f4073db 100644 --- a/gkcore/views/api_login.py +++ b/gkcore/views/api_login.py @@ -1,6 +1,7 @@ """ Copyright (C) 2013, 2014, 2015, 2016 Digital Freedom Foundation +Copyright (C) 2017, 2018 Digital Freedom Foundation & Accion Labs Pvt. Ltd. This file is part of GNUKhata:A modular,robust and Free Accounting System. GNUKhata is Free Software; you can redistribute it and/or modify diff --git a/gkcore/views/api_organisation.py b/gkcore/views/api_organisation.py index bb67d76..0f6c1ac 100644 --- a/gkcore/views/api_organisation.py +++ b/gkcore/views/api_organisation.py @@ -1,7 +1,7 @@ """ Copyright (C) 2013, 2014, 2015, 2016 Digital Freedom Foundation -Copyright (C) 2017 Digital Freedom Foundation & Accion Labs Pvt. Ltd. +Copyright (C) 2017, 2018 Digital Freedom Foundation & Accion Labs Pvt. Ltd. This file is part of GNUKhata:A modular,robust and Free Accounting System. GNUKhata is Free Software; you can redistribute it and/or modify diff --git a/gkcore/views/api_product.py b/gkcore/views/api_product.py index a4b3123..120cdd7 100644 --- a/gkcore/views/api_product.py +++ b/gkcore/views/api_product.py @@ -1,6 +1,7 @@ """ Copyright (C) 2013, 2014, 2015, 2016 Digital Freedom Foundation +Copyright (C) 2017, 2018 Digital Freedom Foundation & Accion Labs Pvt. Ltd. This file is part of GNUKhata:A modular,robust and Free Accounting System. GNUKhata is Free Software; you can redistribute it and/or modify diff --git a/gkcore/views/api_project.py b/gkcore/views/api_project.py index e53dc9f..c737c1f 100644 --- a/gkcore/views/api_project.py +++ b/gkcore/views/api_project.py @@ -1,6 +1,7 @@ """ Copyright (C) 2013, 2014, 2015, 2016 Digital Freedom Foundation +Copyright (C) 2017, 2018 Digital Freedom Foundation & Accion Labs Pvt. Ltd. This file is part of GNUKhata:A modular,robust and Free Accounting System. GNUKhata is Free Software; you can redistribute it and/or modify diff --git a/gkcore/views/api_purchaseorder.py b/gkcore/views/api_purchaseorder.py index f551df5..5980c06 100644 --- a/gkcore/views/api_purchaseorder.py +++ b/gkcore/views/api_purchaseorder.py @@ -1,6 +1,7 @@ """ Copyright (C) 2013, 2014, 2015, 2016 Digital Freedom Foundation +Copyright (C) 2017, 2018 Digital Freedom Foundation & Accion Labs Pvt. Ltd. This file is part of GNUKhata:A modular,robust and Free Accounting System. GNUKhata is Free Software; you can redistribute it and/or modify diff --git a/gkcore/views/api_reports.py b/gkcore/views/api_reports.py index f06d6b1..cb14726 100644 --- a/gkcore/views/api_reports.py +++ b/gkcore/views/api_reports.py @@ -1,6 +1,7 @@ """ Copyright (C) 2013, 2014, 2015, 2016 Digital Freedom Foundation +Copyright (C) 2017, 2018 Digital Freedom Foundation & Accion Labs Pvt. Ltd. This file is part of GNUKhata:A modular,robust and Free Accounting System. GNUKhata is Free Software; you can redistribute it and/or modify diff --git a/gkcore/views/api_rollclose.py b/gkcore/views/api_rollclose.py index d0ccabf..9a252a3 100644 --- a/gkcore/views/api_rollclose.py +++ b/gkcore/views/api_rollclose.py @@ -1,6 +1,7 @@ """ Copyright (C) 2013, 2014, 2015, 2016 Digital Freedom Foundation +Copyright (C) 2017, 2018 Digital Freedom Foundation & Accion Labs Pvt. Ltd. This file is part of GNUKhata:A modular,robust and Free Accounting System. GNUKhata is Free Software; you can redistribute it and/or modify diff --git a/gkcore/views/api_state.py b/gkcore/views/api_state.py index 6660db0..0ea9fdb 100644 --- a/gkcore/views/api_state.py +++ b/gkcore/views/api_state.py @@ -1,5 +1,6 @@ """ Copyright (C) 2013, 2014, 2015, 2016 Digital Freedom Foundation +Copyright (C) 2017, 2018 Digital Freedom Foundation & Accion Labs Pvt. Ltd. This file is part of GNUKhata:A modular,robust and Free Accounting System. GNUKhata is Free Software; you can redistribute it and/or modify diff --git a/gkcore/views/api_tax.py b/gkcore/views/api_tax.py index 23ecc49..f109337 100644 --- a/gkcore/views/api_tax.py +++ b/gkcore/views/api_tax.py @@ -1,6 +1,7 @@ """ Copyright (C) 2013, 2014, 2015, 2016 Digital Freedom Foundation +Copyright (C) 2017, 2018 Digital Freedom Foundation & Accion Labs Pvt. Ltd. This file is part of GNUKhata:A modular,robust and Free Accounting System. GNUKhata is Free Software; you can redistribute it and/or modify diff --git a/gkcore/views/api_transaction.py b/gkcore/views/api_transaction.py index 6dd716f..413f590 100644 --- a/gkcore/views/api_transaction.py +++ b/gkcore/views/api_transaction.py @@ -1,6 +1,7 @@ """ Copyright (C) 2013, 2014, 2015, 2016 Digital Freedom Foundation +Copyright (C) 2017, 2018 Digital Freedom Foundation & Accion Labs Pvt. Ltd. This file is part of GNUKhata:A modular,robust and Free Accounting System. GNUKhata is Free Software; you can redistribute it and/or modify diff --git a/gkcore/views/api_transfernote.py b/gkcore/views/api_transfernote.py index fa86760..259174a 100644 --- a/gkcore/views/api_transfernote.py +++ b/gkcore/views/api_transfernote.py @@ -1,5 +1,6 @@ """ Copyright (C) 2013, 2014, 2015, 2016 Digital Freedom Foundation +Copyright (C) 2017, 2018 Digital Freedom Foundation & Accion Labs Pvt. Ltd. This file is part of GNUKhata:A modular,robust and Free Accounting System. GNUKhata is Free Software; you can redistribute it and/or modify diff --git a/gkcore/views/api_unitofmeasurement.py b/gkcore/views/api_unitofmeasurement.py index b2846a7..47e3b9e 100644 --- a/gkcore/views/api_unitofmeasurement.py +++ b/gkcore/views/api_unitofmeasurement.py @@ -1,6 +1,7 @@ """ Copyright (C) 2013, 2014, 2015, 2016 Digital Freedom Foundation +Copyright (C) 2017, 2018 Digital Freedom Foundation & Accion Labs Pvt. Ltd. This file is part of GNUKhata:A modular,robust and Free Accounting System. GNUKhata is Free Software; you can redistribute it and/or modify diff --git a/gkcore/views/api_user.py b/gkcore/views/api_user.py index fcc3a9c..73b813f 100644 --- a/gkcore/views/api_user.py +++ b/gkcore/views/api_user.py @@ -1,6 +1,7 @@ """ Copyright (C) 2013, 2014, 2015, 2016 Digital Freedom Foundation +Copyright (C) 2017, 2018 Digital Freedom Foundation & Accion Labs Pvt. Ltd. This file is part of GNUKhata:A modular,robust and Free Accounting System. GNUKhata is Free Software; you can redistribute it and/or modify diff --git a/gkutil.sh b/gkutil.sh index 4112c70..1ab5621 100755 --- a/gkutil.sh +++ b/gkutil.sh @@ -1,6 +1,7 @@ #!/bin/bash # Copyright (C) 2013, 2014, 2015, 2016 Digital Freedom Foundation +# Copyright (C) 2017, 2018 Digital Freedom Foundation & Accion Labs # This file is part of GNUKhata:A modular,robust and Free Accounting System. # GNUKhata is Free Software; you can redistribute it and/or modify diff --git a/initdb.py b/initdb.py index 726fa72..bef27e7 100644 --- a/initdb.py +++ b/initdb.py @@ -1,6 +1,7 @@ """ Copyright (C) 2013, 2014, 2015, 2016 Digital Freedom Foundation +Copyright (C) 2017, 2018 Digital Freedom Foundation & Accion Labs This file is part of GNUKhata:A modular,robust and Free Accounting System. GNUKhata is Free Software; you can redistribute it and/or modify -- GitLab From 50fa3d1eb7587fde7c0c1afd0a7db963dba2852e Mon Sep 17 00:00:00 2001 From: abhijith Date: Tue, 9 Jan 2018 17:37:32 +0530 Subject: [PATCH 54/56] Modified AUTHORS --- AUTHORS | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/AUTHORS b/AUTHORS index 9861521..8519d97 100644 --- a/AUTHORS +++ b/AUTHORS @@ -1,7 +1,6 @@ Active Contributors "Abhijith Balan" -"Mohd. Talha Pawaty" "Nitesh Chaughule" "Prajkta Patkar" "Reshma Bhatawadekar" @@ -16,7 +15,7 @@ Past contributers Abhijeet Mote, Abhishek Alai, Aditi Patil, Akshay Puradkar, Amit Chaugule, Ankita Shanbhag, Aparna Kokirkar, Ashwini Jogdand, Ashwini Shinde, Ashutosh Paralikar Avinash Pathak,Bhavesh Bawadhane,Dinesh Sutar, Ganesh Mashram, Girish Joshi, Girish Mane, Ishan Masdekar -Kanchan Kayande, Kanchan Palatane,Namita Dubey,Navin Karkera ,Nutan Nivate, Payal Mamidwar, +Kanchan Kayande, Kanchan Palatane, Mohd. Talha Pawat,Namita Dubey,Navin Karkera ,Nutan Nivate, Payal Mamidwar, Parabjyot Singh,, Poonam Dhane, Pornima Kolte,Prasad Shegokar, Priyali Mhetre,Radhika Vadegaonkar kulkarni, Rahul Chaurasiya ,Ravindra Lakal, Rupali Markad,Rohini Baraskar,Sachin Patil,Sadhana Bagal,Sayali Yawle, Snehal Nighut, Shruti Surve, Shweta Pawar, Sundeep Padmanabh,Trupti Kini, Ujwala Pawde, Vaibhav Kurhe,Vaishali Kamble,Vanita Rajpurohit, Vinayak Kusumkar and Vishakha Divekar. -- GitLab From 07d05feedfe9ff4736ed203e168367a3721b78ec Mon Sep 17 00:00:00 2001 From: abhijith Date: Wed, 10 Jan 2018 17:35:12 +0530 Subject: [PATCH 55/56] Modified Changelog --- CHANGELOG | 2 ++ 1 file changed, 2 insertions(+) diff --git a/CHANGELOG b/CHANGELOG index bb0a7fa..4f5499a 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -1,4 +1,6 @@ [9-January-2018 Release 4.50] +* Refinement in Transaction API +* Function in Transaction API to auto generate Voucher No. * Function in Bill Wise API that returns all unpaid invoices. * Function in Bill Wise API that returns both unpaid and partially paid invoices. * Function in User API that returns list of users having same role and their role. -- GitLab From 3f2ab8922e75b12ccd56b418789f954b34c24c1b Mon Sep 17 00:00:00 2001 From: abhijith Date: Wed, 10 Jan 2018 17:47:24 +0530 Subject: [PATCH 56/56] Changed date in Changelog --- CHANGELOG | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGELOG b/CHANGELOG index 4f5499a..5b47bdc 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -1,4 +1,4 @@ -[9-January-2018 Release 4.50] +[10-January-2018 Release 4.50] * Refinement in Transaction API * Function in Transaction API to auto generate Voucher No. * Function in Bill Wise API that returns all unpaid invoices. -- GitLab