Commit 6b605eb6 authored by Prajkta Patkar's avatar Prajkta Patkar Committed by Prajkta_Patkar
Browse files

a private function to generate voucher numbers

parent a393865f
......@@ -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):
"""
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment