Skip to content
Toggle navigation
Projects
Groups
Snippets
Help
Owo Sugiana
/
sismiop-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 c4ac851a
authored
Apr 23, 2020
by
Owo Sugiana
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
Generalisir scripts/inquiry.py
1 parent
bface8d5
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
36 additions
and
31 deletions
sismiop/scripts/inquiry.py
sismiop/services/base.py
sismiop/services/bogor_kota/__init__.py
sismiop/scripts/inquiry.py
View file @
c4ac851
...
...
@@ -72,11 +72,11 @@ def show_payment(module_name, inq, pay):
return
print
(
'Tabel pembayaran_sppt'
)
show_fields
(
pay
,
[
'jml_sppt_yg_dibayar'
,
'denda_sppt'
,
'discount'
])
pc
=
inq
.
get_pengurangan_covid
(
pay
)
if
not
pc
:
row
,
fields
=
inq
.
get_other_payment_table
(
pay
)
if
not
row
:
return
print
(
'Tabel
pengurangan_covid'
)
show_fields
(
pc
,
[
'bayar'
,
'denda'
]
)
print
(
'Tabel
{}'
.
format
(
row
.
__tablename__
)
)
show_fields
(
row
,
fields
)
def
main
(
argv
=
sys
.
argv
):
...
...
sismiop/services/base.py
View file @
c4ac851
...
...
@@ -111,6 +111,9 @@ class Query:
q
=
q
.
order_by
(
Payment
.
pembayaran_sppt_ke
.
desc
())
return
q
.
first
()
def
is_available
(
self
):
return
self
.
invoice
.
status_pembayaran_sppt
==
'0'
class
Inquiry
(
Query
):
def
__init__
(
...
...
@@ -188,7 +191,7 @@ class Inquiry(Query):
def
is_paid
(
self
):
return
self
.
total
<
1
def
is_available
(
self
):
def
is_available
(
self
):
# Override
return
not
self
.
is_paid
()
and
\
self
.
invoice
.
status_pembayaran_sppt
in
(
'0'
,
'1'
)
...
...
@@ -263,16 +266,15 @@ class Reversal(Query):
def
__init__
(
self
,
invoice_id
):
Query
.
__init__
(
self
,
invoice_id
)
self
.
payment
=
self
.
invoice2payment
()
if
self
.
payment
and
self
.
is_available
():
self
.
payment
=
None
def
do_reversal
(
self
):
self
.
payment
.
jml_sppt_yg_dibayar
=
self
.
payment
.
denda_sppt
=
0
self
.
payment
.
jml_sppt_yg_dibayar
=
self
.
payment
.
denda_sppt
=
\
self
.
payment
.
discount
=
0
DBSession
.
add
(
self
.
payment
)
self
.
invoice
.
status_pembayaran_sppt
=
'0'
DBSession
.
add
(
self
.
invoice
)
self
.
before_save
()
def
before_save
(
self
):
pass
class
AvailableInvoice
(
Query
):
...
...
sismiop/services/bogor_kota/__init__.py
View file @
c4ac851
...
...
@@ -8,7 +8,10 @@ from sismiop.models.default import (
PenguranganPst
,
PenguranganCovid
,
)
from
..base
import
get_db_session
from
..base
import
(
get_db_session
,
Query
,
)
from
..default
import
(
Inquiry
as
BaseInquiry
,
Reversal
as
BaseReversal
,
...
...
@@ -16,7 +19,21 @@ from ..default import (
)
class
Inquiry
(
BaseInquiry
):
class
Common
(
Query
):
def
get_pengurangan_covid
(
self
,
pay
):
DBSession
=
get_db_session
()
q
=
DBSession
.
query
(
PenguranganCovid
)
q
=
self
.
get_filter
(
q
)
q
=
q
.
filter_by
(
pembayaran_sppt_ke
=
pay
.
pembayaran_sppt_ke
)
return
q
.
first
()
# Untuk debugging
def
get_other_payment_table
(
self
,
pay
):
pc
=
self
.
get_pengurangan_covid
(
pay
)
return
pc
,
(
'bayar'
,
'denda'
)
class
Inquiry
(
BaseInquiry
,
Common
):
def
is_pst
(
self
):
DBSession
=
get_db_session
()
inv_id
=
self
.
invoice_id
...
...
@@ -87,29 +104,15 @@ class Inquiry(BaseInquiry):
DBSession
=
get_db_session
()
DBSession
.
add
(
pc
)
def
get_pengurangan_covid
(
self
,
pay
):
DBSession
=
get_db_session
()
q
=
DBSession
.
query
(
PenguranganCovid
)
q
=
self
.
get_filter
(
q
)
q
=
q
.
filter_by
(
pembayaran_sppt_ke
=
pay
.
pembayaran_sppt_ke
)
return
q
.
first
()
class
Reversal
(
BaseReversal
):
def
before_save
(
self
):
# Override
class
Reversal
(
BaseReversal
,
Common
):
def
do_reversal
(
self
):
# Override
BaseReversal
.
do_reversal
(
self
)
DBSession
=
get_db_session
()
bayar
=
self
.
payment
q
=
DBSession
.
query
(
PenguranganCovid
)
.
filter_by
(
kd_propinsi
=
bayar
.
kd_propinsi
,
kd_dati2
=
bayar
.
kd_dati2
,
kd_kecamatan
=
bayar
.
kd_kecamatan
,
kd_kelurahan
=
bayar
.
kd_kelurahan
,
kd_blok
=
bayar
.
kd_blok
,
no_urut
=
bayar
.
no_urut
,
kd_jns_op
=
bayar
.
kd_jns_op
,
thn_pajak_sppt
=
bayar
.
thn_pajak_sppt
,
pembayaran_sppt_ke
=
bayar
.
pembayaran_sppt_ke
)
pc
=
q
.
first
()
pc
=
self
.
get_pengurangan_covid
(
self
.
payment
)
if
not
pc
:
return
pc
.
pokok
=
pc
.
denda
=
0
pc
.
bayar
=
pc
.
denda
=
0
DBSession
.
add
(
pc
)
...
...
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