Skip to content
Toggle navigation
Projects
Groups
Snippets
Help
Owo Sugiana
/
opensipkd-bphtb-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 84b3d774
authored
Dec 26, 2022
by
Owo Sugiana
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
Tambah jatuh tempo di Kabupaten Serang
1 parent
a96769b0
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
35 additions
and
20 deletions
opensipkd/bphtb/services/serang_kab/__init__.py
opensipkd/bphtb/services/serang_kab/__init__.py
View file @
84b3d77
from
datetime
import
datetime
from
sqlalchemy
import
func
from
opensipkd.hitung
import
(
hitung_denda
,
round_up
,
from
datetime
import
(
datetime
,
date
,
)
from
sqlalchemy
import
func
from
opensipkd.hitung
import
round_up
from
opensipkd.string
import
FixLength
from
opensipkd.string.money
import
thousand
from
opensipkd.string.transaction_id
import
TransactionID
...
...
@@ -148,7 +148,7 @@ class Common:
class
Inquiry
(
Common
):
def
__init__
(
self
,
invoice_id
,
conf
,
tgl_bayar
=
None
):
def
__init__
(
self
,
invoice_id
,
conf
,
tgl_bayar
=
None
,
for_test
=
False
):
super
()
.
__init__
(
invoice_id
)
if
not
self
.
invoice
:
return
...
...
@@ -169,19 +169,21 @@ class Inquiry(Common):
'Jenis'
:
self
.
invoice
.
kd_jns_op
,
})
self
.
hitung
()
if
self
.
invoice_kb
and
self
.
tgl_bayar
.
date
()
>
self
.
get_jatuh_tempo
():
if
not
for_test
:
self
.
invoice
=
self
.
invoice_kb
=
None
def
hitung
(
self
):
if
self
.
invoice_kb
:
self
.
tagihan
=
self
.
invoice_kb
.
bphtb_krg_bayar
self
.
tagihan
=
self
.
invoice_kb
.
jml_
bphtb_krg_bayar
else
:
self
.
tagihan
=
self
.
invoice
.
bphtb_disetor
self
.
tagihan
=
round_up
(
self
.
tagihan
)
self
.
total_bayar
=
self
.
get_payment_amount
()
self
.
tagihan
-=
self
.
total_bayar
self
.
total
=
self
.
denda
=
self
.
discount
=
0
if
self
.
tagihan
<
1
:
self
.
tagihan
=
self
.
total
=
0
else
:
self
.
tagihan
=
self
.
total
=
round_up
(
self
.
tagihan
)
self
.
total
=
self
.
tagihan
-
self
.
total_bayar
if
self
.
total
<
1
:
self
.
total
=
self
.
tagihan
=
0
self
.
discount
=
self
.
denda
=
0
def
get_subjek
(
self
):
db_session
=
get_db_session
()
...
...
@@ -306,7 +308,8 @@ class Inquiry(Common):
return
self
.
invoice
.
thn_bphtb
def
get_jatuh_tempo
(
self
):
pass
if
self
.
invoice_kb
:
return
self
.
invoice_kb
.
tgl_jth_tempo
.
date
()
def
get_payment_amount
(
self
):
db_session
=
get_db_session
()
...
...
@@ -391,7 +394,8 @@ class Reversal(Common):
class
AvailableInvoice
(
BaseAvailableInvoice
):
def
is_kb
(
self
):
return
self
.
option
.
skpdkb
or
self
.
option
.
skpdkb_tambahan
return
self
.
option
.
skpdkb
or
self
.
option
.
skpdkb_tambahan
or
\
self
.
option
.
lewat_jatuh_tempo
or
self
.
option
.
belum_jatuh_tempo
def
get_query
(
self
):
db_session
=
get_db_session
()
...
...
@@ -399,6 +403,11 @@ class AvailableInvoice(BaseAvailableInvoice):
if
kb
:
orm
=
self
.
option
.
skpdkb
and
Skbkb
or
SkbkbT
q
=
db_session
.
query
(
orm
)
.
filter
(
orm
.
status_pembayaran
==
'0'
)
kini
=
date
.
today
()
if
self
.
option
.
belum_jatuh_tempo
:
q
=
q
.
filter
(
orm
.
tgl_jth_tempo
>=
kini
)
else
:
q
=
q
.
filter
(
orm
.
tgl_jth_tempo
<
kini
)
else
:
orm
=
Invoice
q
=
db_session
.
query
(
Invoice
)
.
filter
(
...
...
@@ -410,12 +419,14 @@ class AvailableInvoice(BaseAvailableInvoice):
q
=
q
.
filter_by
(
thn_bphtb
=
self
.
option
.
tahun
)
if
self
.
option
.
max_nominal
:
if
kb
:
q
=
q
.
filter
(
orm
.
bphtb_krg_bayar
<=
self
.
option
.
max_nominal
)
q
=
q
.
filter
(
orm
.
jml_bphtb_krg_bayar
<=
self
.
option
.
max_nominal
)
else
:
q
=
q
.
filter
(
orm
.
bphtb_hrs_dibayar
<=
self
.
option
.
max_nominal
)
if
self
.
option
.
min_nominal
:
if
kb
:
q
=
q
.
filter
(
orm
.
bphtb_krg_bayar
>=
self
.
option
.
min_nominal
)
q
=
q
.
filter
(
orm
.
jml_bphtb_krg_bayar
>=
self
.
option
.
min_nominal
)
else
:
q
=
q
.
filter
(
orm
.
bphtb_hrs_dibayar
>=
self
.
option
.
min_nominal
)
return
q
.
order_by
(
orm
.
tgl_rekam
.
desc
())
...
...
@@ -433,8 +444,12 @@ class AvailableInvoice(BaseAvailableInvoice):
invoice_id_struct
[
'tgl'
]
=
row
.
tgl_bphtb
invoice_id_struct
[
'no_urut'
]
=
row
.
no_urut_bphtb
invoice_id
=
invoice_id_struct
.
get_raw
()
inq
=
Inquiry
(
invoice_id
,
self
.
conf
)
if
inq
.
total
<
1
:
inq
=
Inquiry
(
invoice_id
,
self
.
conf
,
for_test
=
True
)
if
not
inq
.
invoice
or
inq
.
total
<
1
:
return
total
=
thousand
(
inq
.
total
)
.
rjust
(
11
)
return
f
'{invoice_id} Rp {total}'
jatuh_tempo
=
inq
.
get_jatuh_tempo
()
if
not
jatuh_tempo
:
return
f
'{invoice_id} Rp {total}'
jt
=
jatuh_tempo
.
strftime
(
'
%
d-
%
m-
%
Y'
)
return
f
'{invoice_id} Rp {total} jatuh tempo {jt}'
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