Skip to content
Toggle navigation
Projects
Groups
Snippets
Help
Owo Sugiana
/
opensipkd-webr-models
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Settings
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit 9ee94495
authored
Jul 13, 2023
by
Owo Sugiana
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
Bug fixed saat inquiry yang sudah lunas pada modul jabar
1 parent
e4752c24
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
16 additions
and
10 deletions
opensipkd/webr/scripts/inquiry.py
opensipkd/webr/services/jabar.py
opensipkd/webr/scripts/inquiry.py
View file @
9ee9449
...
@@ -66,6 +66,7 @@ def show(inq):
...
@@ -66,6 +66,7 @@ def show(inq):
show_rp
(
'Total Bayar'
,
inq
.
total_bayar
)
show_rp
(
'Total Bayar'
,
inq
.
total_bayar
)
show_rp
(
'Total Tagihan'
,
inq
.
total
)
show_rp
(
'Total Tagihan'
,
inq
.
total
)
show_field
(
inq
.
invoice
,
'status'
)
show_field
(
inq
.
invoice
,
'status'
)
show_field
(
inq
.
invoice
,
'status_bayar'
)
if
inq
.
total_bayar
:
if
inq
.
total_bayar
:
pay
=
inq
.
get_payment
()
pay
=
inq
.
get_payment
()
show_field
(
pay
,
'tgl_bayar'
)
show_field
(
pay
,
'tgl_bayar'
)
...
...
opensipkd/webr/services/jabar.py
View file @
9ee9449
...
@@ -38,7 +38,7 @@ class Inquiry:
...
@@ -38,7 +38,7 @@ class Inquiry:
payment_model
=
Payment
payment_model
=
Payment
ntp_cls
=
NTP
ntp_cls
=
NTP
def
__init__
(
self
,
invoice_id
,
persen_denda
=
2
,
tgl_bayar
=
None
):
def
__init__
(
self
,
invoice_id
,
persen_denda
=
2
,
tgl_bayar
=
None
,
conf
=
{}
):
self
.
invoice_id
=
invoice_id
self
.
invoice_id
=
invoice_id
self
.
persen_denda
=
persen_denda
self
.
persen_denda
=
persen_denda
self
.
tgl_bayar
=
tgl_bayar
or
date
.
today
()
self
.
tgl_bayar
=
tgl_bayar
or
date
.
today
()
...
@@ -60,26 +60,31 @@ class Inquiry:
...
@@ -60,26 +60,31 @@ class Inquiry:
q
=
q
.
order_by
(
self
.
payment_model
.
pembayaran_ke
.
desc
())
q
=
q
.
order_by
(
self
.
payment_model
.
pembayaran_ke
.
desc
())
return
q
.
first
()
return
q
.
first
()
def
get_total_payment
(
self
):
DBSession
=
get_db_session
()
q
=
DBSession
.
query
(
func
.
sum
(
self
.
payment_model
.
bayar
)
.
label
(
'jml'
))
q
=
q
.
filter_by
(
arinvoice_id
=
self
.
invoice
.
id
)
pay
=
q
.
first
()
return
pay
and
int
(
pay
.
jml
or
0
)
def
hitung
(
self
):
def
hitung
(
self
):
bunga
=
self
.
invoice
.
bunga
or
0
bunga
=
self
.
invoice
.
bunga
or
0
bunga
=
round_up
(
bunga
)
bunga
=
round_up
(
bunga
)
self
.
tagihan
=
self
.
invoice
.
jumlah
-
bunga
self
.
tagihan
=
self
.
invoice
.
jumlah
-
bunga
self
.
tagihan
=
round_up
(
self
.
tagihan
)
self
.
tagihan
=
round_up
(
self
.
tagihan
)
DBSession
=
get_db_session
()
q
=
DBSession
.
query
(
func
.
sum
(
self
.
payment_model
.
bayar
)
.
label
(
'jml'
),
func
.
sum
(
self
.
payment_model
.
bunga
)
.
label
(
'denda'
))
q
=
q
.
filter_by
(
arinvoice_id
=
self
.
invoice
.
id
)
pay
=
q
.
first
()
self
.
total_bayar
=
pay
.
jml
or
0
denda_lalu
=
pay
.
denda
or
0
tagihan_lalu
=
self
.
total_bayar
-
denda_lalu
self
.
tagihan
-=
tagihan_lalu
if
self
.
tagihan
<
0
:
self
.
tagihan
=
0
else
:
self
.
tagihan
=
round_up
(
self
.
tagihan
)
bln
,
denda_waktu
=
hitung_denda
(
bln
,
denda_waktu
=
hitung_denda
(
self
.
tagihan
,
self
.
invoice
.
jatuh_tempo
,
self
.
persen_denda
,
self
.
tagihan
,
self
.
invoice
.
jatuh_tempo
,
self
.
persen_denda
,
self
.
tgl_bayar
)
self
.
tgl_bayar
)
self
.
denda
=
denda_waktu
+
bunga
self
.
denda
=
denda_waktu
+
bunga
self
.
denda
=
round_up
(
self
.
denda
)
self
.
denda
=
round_up
(
self
.
denda
)
self
.
total
=
self
.
tagihan
+
self
.
denda
self
.
total
=
self
.
tagihan
+
self
.
denda
self
.
total_bayar
=
self
.
get_total_payment
()
if
self
.
total_bayar
>
0
:
if
self
.
total_bayar
>
0
:
self
.
total
-=
self
.
total_bayar
self
.
total
-=
self
.
total_bayar
if
self
.
total
<
0
:
if
self
.
total
<
0
:
...
...
Write
Preview
Markdown
is supported
Attach a file
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 post a comment