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
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
34 additions
and
19 deletions
opensipkd/bphtb/services/serang_kab/__init__.py
opensipkd/bphtb/services/serang_kab/__init__.py
View file @
84b3d77
from
datetime
import
datetime
from
datetime
import
(
from
sqlalchemy
import
func
datetime
,
from
opensipkd.hitung
import
(
date
,
hitung_denda
,
round_up
,
)
)
from
sqlalchemy
import
func
from
opensipkd.hitung
import
round_up
from
opensipkd.string
import
FixLength
from
opensipkd.string
import
FixLength
from
opensipkd.string.money
import
thousand
from
opensipkd.string.money
import
thousand
from
opensipkd.string.transaction_id
import
TransactionID
from
opensipkd.string.transaction_id
import
TransactionID
...
@@ -148,7 +148,7 @@ class Common:
...
@@ -148,7 +148,7 @@ class Common:
class
Inquiry
(
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
)
super
()
.
__init__
(
invoice_id
)
if
not
self
.
invoice
:
if
not
self
.
invoice
:
return
return
...
@@ -169,19 +169,21 @@ class Inquiry(Common):
...
@@ -169,19 +169,21 @@ class Inquiry(Common):
'Jenis'
:
self
.
invoice
.
kd_jns_op
,
'Jenis'
:
self
.
invoice
.
kd_jns_op
,
})
})
self
.
hitung
()
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
):
def
hitung
(
self
):
if
self
.
invoice_kb
:
if
self
.
invoice_kb
:
self
.
tagihan
=
self
.
invoice_kb
.
bphtb_krg_bayar
self
.
tagihan
=
self
.
invoice_kb
.
jml_
bphtb_krg_bayar
else
:
else
:
self
.
tagihan
=
self
.
invoice
.
bphtb_disetor
self
.
tagihan
=
self
.
invoice
.
bphtb_disetor
self
.
tagihan
=
round_up
(
self
.
tagihan
)
self
.
total_bayar
=
self
.
get_payment_amount
()
self
.
total_bayar
=
self
.
get_payment_amount
()
self
.
tagihan
-=
self
.
total_bayar
self
.
total
=
self
.
tagihan
-
self
.
total_bayar
self
.
total
=
self
.
denda
=
self
.
discount
=
0
if
self
.
total
<
1
:
if
self
.
tagihan
<
1
:
self
.
total
=
self
.
tagihan
=
0
self
.
tagihan
=
self
.
total
=
0
self
.
discount
=
self
.
denda
=
0
else
:
self
.
tagihan
=
self
.
total
=
round_up
(
self
.
tagihan
)
def
get_subjek
(
self
):
def
get_subjek
(
self
):
db_session
=
get_db_session
()
db_session
=
get_db_session
()
...
@@ -306,7 +308,8 @@ class Inquiry(Common):
...
@@ -306,7 +308,8 @@ class Inquiry(Common):
return
self
.
invoice
.
thn_bphtb
return
self
.
invoice
.
thn_bphtb
def
get_jatuh_tempo
(
self
):
def
get_jatuh_tempo
(
self
):
pass
if
self
.
invoice_kb
:
return
self
.
invoice_kb
.
tgl_jth_tempo
.
date
()
def
get_payment_amount
(
self
):
def
get_payment_amount
(
self
):
db_session
=
get_db_session
()
db_session
=
get_db_session
()
...
@@ -391,7 +394,8 @@ class Reversal(Common):
...
@@ -391,7 +394,8 @@ class Reversal(Common):
class
AvailableInvoice
(
BaseAvailableInvoice
):
class
AvailableInvoice
(
BaseAvailableInvoice
):
def
is_kb
(
self
):
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
):
def
get_query
(
self
):
db_session
=
get_db_session
()
db_session
=
get_db_session
()
...
@@ -399,6 +403,11 @@ class AvailableInvoice(BaseAvailableInvoice):
...
@@ -399,6 +403,11 @@ class AvailableInvoice(BaseAvailableInvoice):
if
kb
:
if
kb
:
orm
=
self
.
option
.
skpdkb
and
Skbkb
or
SkbkbT
orm
=
self
.
option
.
skpdkb
and
Skbkb
or
SkbkbT
q
=
db_session
.
query
(
orm
)
.
filter
(
orm
.
status_pembayaran
==
'0'
)
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
:
else
:
orm
=
Invoice
orm
=
Invoice
q
=
db_session
.
query
(
Invoice
)
.
filter
(
q
=
db_session
.
query
(
Invoice
)
.
filter
(
...
@@ -410,12 +419,14 @@ class AvailableInvoice(BaseAvailableInvoice):
...
@@ -410,12 +419,14 @@ class AvailableInvoice(BaseAvailableInvoice):
q
=
q
.
filter_by
(
thn_bphtb
=
self
.
option
.
tahun
)
q
=
q
.
filter_by
(
thn_bphtb
=
self
.
option
.
tahun
)
if
self
.
option
.
max_nominal
:
if
self
.
option
.
max_nominal
:
if
kb
:
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
:
else
:
q
=
q
.
filter
(
orm
.
bphtb_hrs_dibayar
<=
self
.
option
.
max_nominal
)
q
=
q
.
filter
(
orm
.
bphtb_hrs_dibayar
<=
self
.
option
.
max_nominal
)
if
self
.
option
.
min_nominal
:
if
self
.
option
.
min_nominal
:
if
kb
:
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
:
else
:
q
=
q
.
filter
(
orm
.
bphtb_hrs_dibayar
>=
self
.
option
.
min_nominal
)
q
=
q
.
filter
(
orm
.
bphtb_hrs_dibayar
>=
self
.
option
.
min_nominal
)
return
q
.
order_by
(
orm
.
tgl_rekam
.
desc
())
return
q
.
order_by
(
orm
.
tgl_rekam
.
desc
())
...
@@ -433,8 +444,12 @@ class AvailableInvoice(BaseAvailableInvoice):
...
@@ -433,8 +444,12 @@ class AvailableInvoice(BaseAvailableInvoice):
invoice_id_struct
[
'tgl'
]
=
row
.
tgl_bphtb
invoice_id_struct
[
'tgl'
]
=
row
.
tgl_bphtb
invoice_id_struct
[
'no_urut'
]
=
row
.
no_urut_bphtb
invoice_id_struct
[
'no_urut'
]
=
row
.
no_urut_bphtb
invoice_id
=
invoice_id_struct
.
get_raw
()
invoice_id
=
invoice_id_struct
.
get_raw
()
inq
=
Inquiry
(
invoice_id
,
self
.
conf
)
inq
=
Inquiry
(
invoice_id
,
self
.
conf
,
for_test
=
True
)
if
inq
.
total
<
1
:
if
not
inq
.
invoice
or
inq
.
total
<
1
:
return
return
total
=
thousand
(
inq
.
total
)
.
rjust
(
11
)
total
=
thousand
(
inq
.
total
)
.
rjust
(
11
)
jatuh_tempo
=
inq
.
get_jatuh_tempo
()
if
not
jatuh_tempo
:
return
f
'{invoice_id} Rp {total}'
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