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 5dc5bce6
authored
Mar 01, 2023
by
Owo Sugiana
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
Bug fixed inquiry yang sudah lunas
1 parent
44b4580d
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
22 additions
and
9 deletions
opensipkd/webr/scripts/available_invoice.py
opensipkd/webr/scripts/inquiry.py
opensipkd/webr/services/default.py
opensipkd/webr/scripts/available_invoice.py
View file @
5dc5bce
...
...
@@ -17,6 +17,7 @@ def get_option(argv):
pars
.
add_argument
(
'--jatuh-tempo-max'
)
pars
.
add_argument
(
'--nominal-min'
,
type
=
int
)
pars
.
add_argument
(
'--nominal-max'
,
type
=
int
)
pars
.
add_argument
(
'--berbunga'
,
action
=
'store_true'
)
pars
.
add_argument
(
'--count'
,
type
=
int
,
default
=
default_count
,
help
=
help_count
)
return
pars
.
parse_args
(
argv
)
...
...
opensipkd/webr/scripts/inquiry.py
View file @
5dc5bce
...
...
@@ -61,6 +61,7 @@ def show(inq):
show_val
(
'Nama SKPD'
,
inq
.
get_nama_departemen
())
show_val
(
'Jatuh Tempo'
,
inq
.
get_jatuh_tempo
())
show_rp
(
'Tagihan Pokok'
,
inq
.
tagihan
)
show_field
(
inq
.
invoice
,
'bunga'
)
show_rp
(
'Denda'
,
inq
.
denda
)
show_rp
(
'Total Bayar'
,
inq
.
total_bayar
)
show_rp
(
'Total Tagihan'
,
inq
.
total
)
...
...
opensipkd/webr/services/default.py
View file @
5dc5bce
...
...
@@ -59,26 +59,31 @@ class Inquiry:
q
=
q
.
order_by
(
self
.
payment_model
.
pembayaran_ke
.
desc
())
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
(
ar_invoice_id
=
self
.
invoice
.
id
)
pay
=
q
.
first
()
return
pay
and
int
(
pay
.
jml
or
0
)
def
hitung
(
self
):
bunga
=
self
.
invoice
.
bunga
or
0
bunga
=
round_up
(
bunga
)
self
.
tagihan
=
self
.
invoice
.
jumlah
-
bunga
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
(
ar_invoice_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
(
self
.
tagihan
,
self
.
invoice
.
jatuh_tempo
,
self
.
persen_denda
,
self
.
tgl_bayar
)
self
.
denda
=
denda_waktu
+
bunga
self
.
denda
=
round_up
(
self
.
denda
)
self
.
total
=
self
.
tagihan
+
self
.
denda
self
.
total_bayar
=
self
.
get_total_payment
()
if
self
.
total_bayar
>
0
:
self
.
total
-=
self
.
total_bayar
if
self
.
total
<
0
:
...
...
@@ -218,6 +223,7 @@ class AvailableInvoice:
q
=
self
.
get_filter_tahun
(
q
)
q
=
self
.
get_filter_nominal
(
q
)
q
=
self
.
get_filter_jatuh_tempo
(
q
)
q
=
self
.
get_filter_berbunga
(
q
)
return
q
def
get_filter_tahun
(
self
,
q
):
...
...
@@ -245,6 +251,11 @@ class AvailableInvoice:
q
=
q
.
filter
(
self
.
invoice_model
.
jatuh_tempo
<=
tgl
)
return
q
def
get_filter_berbunga
(
self
,
q
):
if
self
.
option
.
berbunga
:
q
=
q
.
filter
(
self
.
invoice_model
.
bunga
>
0
)
return
q
def
get_message
(
self
,
row
):
inq
=
Inquiry
(
row
.
kode
,
persen_denda
=
self
.
persen_denda
)
if
not
inq
.
total
:
...
...
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