Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
gnukhata
gkcore
Commits
6b605eb6
Commit
6b605eb6
authored
Dec 20, 2017
by
Prajkta Patkar
Committed by
Prajkta_Patkar
Jan 10, 2018
Browse files
a private function to generate voucher numbers
parent
a393865f
Changes
1
Hide whitespace changes
Inline
Side-by-side
gkcore/views/api_transaction.py
View file @
6b605eb6
...
...
@@ -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
):
"""
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment