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
6221833e
Commit
6221833e
authored
Dec 10, 2017
by
Abhijith Balan
Browse files
List of Pending sale/purchase invoices can be fetched separately
parent
dcf80a6d
Changes
1
Hide whitespace changes
Inline
Side-by-side
gkcore/views/api_billwise.py
View file @
6221833e
...
...
@@ -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"
]}
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