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 c0f502a7
authored
Aug 02, 2019
by
Owo Sugiana
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
Kode bayar di tabel t_pembayaranspt
1 parent
a926cbbc
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
32 additions
and
17 deletions
CHANGES.txt
opensipkd/bphtb/cilegon/scripts/available_invoice.py
opensipkd/bphtb/cilegon/scripts/inquiry.py
opensipkd/bphtb/cilegon/services.py
setup.py
CHANGES.txt
View file @
c0f502a
0.1.2 2019-08-02
----------------
- Bug fixed dimana kode bayar ada di tabel t_pembayaranspt.
0.1.1 2019-07-10
0.1.1 2019-07-10
----------------
----------------
- Bug fixed nomor urut pada AvailableInvoice.
- Bug fixed nomor urut pada AvailableInvoice.
...
...
opensipkd/bphtb/cilegon/scripts/available_invoice.py
View file @
c0f502a
...
@@ -7,6 +7,7 @@ from opensipkd.base.models import DBSession
...
@@ -7,6 +7,7 @@ from opensipkd.base.models import DBSession
from
opensipkd.bphtb.cilegon.models
import
(
from
opensipkd.bphtb.cilegon.models
import
(
Spt
,
Spt
,
DetailSpt
,
DetailSpt
,
Pembayaran
,
)
)
import
opensipkd.bphtb.cilegon.services
import
opensipkd.bphtb.cilegon.services
...
@@ -43,7 +44,9 @@ class AvailableInvoice:
...
@@ -43,7 +44,9 @@ class AvailableInvoice:
break
break
def
row_handler
(
self
,
inv
):
def
row_handler
(
self
,
inv
):
inq
=
Inquiry
(
inv
.
t_idspt
,
registry
[
'persen_denda'
])
q
=
DBSession
.
query
(
Pembayaran
)
.
filter_by
(
t_idspt
=
inv
.
t_idspt
)
pay
=
q
.
first
()
inq
=
Inquiry
(
pay
.
t_kodebayarbanksppt
,
registry
[
'persen_denda'
])
if
not
inq
.
total
:
if
not
inq
.
total
:
return
return
self
.
no
+=
1
self
.
no
+=
1
...
@@ -51,7 +54,7 @@ class AvailableInvoice:
...
@@ -51,7 +54,7 @@ class AvailableInvoice:
q
=
DBSession
.
query
(
DetailSpt
)
.
filter_by
(
t_idspt
=
inv
.
t_idspt
)
q
=
DBSession
.
query
(
DetailSpt
)
.
filter_by
(
t_idspt
=
inv
.
t_idspt
)
op
=
q
.
first
()
op
=
q
.
first
()
msg
=
'#{} {} {} {} {} Rp {}'
.
format
(
msg
=
'#{} {} {} {} {} Rp {}'
.
format
(
self
.
no
,
inv
.
t_ids
pt
,
inv
.
t_periodespt
,
inv
.
t_nopbphtbsppt
,
self
.
no
,
pay
.
t_kodebayarbanksp
pt
,
inv
.
t_periodespt
,
inv
.
t_nopbphtbsppt
,
op
.
t_namawppembeli
,
nominal
)
op
.
t_namawppembeli
,
nominal
)
print
(
msg
)
print
(
msg
)
...
...
opensipkd/bphtb/cilegon/scripts/inquiry.py
View file @
c0f502a
...
@@ -40,7 +40,7 @@ def show_rp(label, value):
...
@@ -40,7 +40,7 @@ def show_rp(label, value):
def
get_option
(
argv
):
def
get_option
(
argv
):
pars
=
OptionParser
()
pars
=
OptionParser
()
pars
.
add_option
(
'-i'
,
'--invoice-id'
,
type
=
'int'
)
pars
.
add_option
(
'-i'
,
'--invoice-id'
)
pars
.
add_option
(
''
,
'--payment'
,
action
=
'store_true'
)
pars
.
add_option
(
''
,
'--payment'
,
action
=
'store_true'
)
pars
.
add_option
(
''
,
'--reversal'
,
action
=
'store_true'
)
pars
.
add_option
(
''
,
'--reversal'
,
action
=
'store_true'
)
return
pars
.
parse_args
(
argv
)
return
pars
.
parse_args
(
argv
)
...
...
opensipkd/bphtb/cilegon/services.py
View file @
c0f502a
...
@@ -17,13 +17,23 @@ DBSession = None # override, please
...
@@ -17,13 +17,23 @@ DBSession = None # override, please
class
Inquiry
:
class
Inquiry
:
def
__init__
(
self
,
invoice_id
,
persen_denda
=
2
):
def
__init__
(
self
,
invoice_id
,
persen_denda
=
2
):
self
.
invoice_id
=
invoice_id
self
.
invoice_id
=
invoice_id
q
=
DBSession
.
query
(
Spt
)
.
filter_by
(
t_idspt
=
invoice_id
)
q
=
DBSession
.
query
(
Pembayaran
)
.
filter_by
(
t_kodebayarbanksppt
=
invoice_id
)
.
order_by
(
Pembayaran
.
t_idpembayaranspt
)
self
.
payment
=
q
.
first
()
if
not
self
.
payment
:
self
.
invoice
=
None
return
q
=
DBSession
.
query
(
Spt
)
.
filter_by
(
t_idspt
=
self
.
payment
.
t_idspt
)
self
.
invoice
=
q
.
first
()
self
.
invoice
=
q
.
first
()
if
not
self
.
invoice
:
if
not
self
.
invoice
:
return
return
self
.
profile
=
self
.
get_profile
()
self
.
profile
=
self
.
get_profile
()
self
.
notaris
=
self
.
get_notaris
()
self
.
notaris
=
self
.
get_notaris
()
self
.
total_bayar
=
self
.
get_payment_amount
()
self
.
total_bayar
=
self
.
get_payment_amount
()
if
self
.
payment
.
t_statusbayarspt
:
self
.
tagihan
=
self
.
denda
=
self
.
total
=
0
return
self
.
tagihan
=
self
.
invoice
.
t_totalspt
self
.
tagihan
=
self
.
invoice
.
t_totalspt
self
.
total
=
self
.
tagihan
-
self
.
total_bayar
self
.
total
=
self
.
tagihan
-
self
.
total_bayar
if
self
.
total
<=
0
:
if
self
.
total
<=
0
:
...
@@ -38,7 +48,7 @@ class Inquiry:
...
@@ -38,7 +48,7 @@ class Inquiry:
self
.
total
=
self
.
total
-
self
.
denda
self
.
total
=
self
.
total
-
self
.
denda
def
get_profile
(
self
):
def
get_profile
(
self
):
q
=
DBSession
.
query
(
DetailSpt
)
.
filter_by
(
t_idspt
=
self
.
invoice
_id
)
q
=
DBSession
.
query
(
DetailSpt
)
.
filter_by
(
t_idspt
=
self
.
invoice
.
t_idspt
)
return
q
.
first
()
return
q
.
first
()
def
get_notaris
(
self
):
def
get_notaris
(
self
):
...
@@ -112,19 +122,17 @@ class Inquiry:
...
@@ -112,19 +122,17 @@ class Inquiry:
def
get_payment_amount
(
self
):
def
get_payment_amount
(
self
):
q
=
DBSession
.
query
(
q
=
DBSession
.
query
(
func
.
sum
(
Pembayaran
.
t_nilaipembayaranspt
)
.
label
(
'jml'
))
func
.
sum
(
Pembayaran
.
t_nilaipembayaranspt
)
.
label
(
'jml'
))
q
=
q
.
filter_by
(
t_idspt
=
self
.
invoice
_id
,
t_statusbayarspt
=
True
)
q
=
q
.
filter_by
(
t_idspt
=
self
.
invoice
.
t_idspt
,
t_statusbayarspt
=
True
)
row
=
q
.
first
()
row
=
q
.
first
()
return
row
.
jml
or
0
return
row
.
jml
or
0
def
do_payment
(
self
,
ntb
):
def
do_payment
(
self
,
ntb
):
pay
=
Pembayaran
(
t_idspt
=
self
.
invoice_id
)
self
.
payment
.
t_tanggalpembayaran
=
date
.
today
()
pay
.
t_tanggalpembayaran
=
date
.
today
()
self
.
payment
.
t_nilaipembayaranspt
=
self
.
total
pay
.
t_nilaipembayaranspt
=
self
.
total
self
.
payment
.
t_statusbayarspt
=
True
pay
.
t_statusbayarspt
=
True
DBSession
.
add
(
self
.
payment
)
pay
.
t_kodebayarbanksppt
=
ntb
DBSession
.
add
(
pay
)
DBSession
.
flush
()
DBSession
.
flush
()
return
pay
return
self
.
payment
class
Reversal
:
class
Reversal
:
...
@@ -133,9 +141,9 @@ class Reversal:
...
@@ -133,9 +141,9 @@ class Reversal:
self
.
payment
=
self
.
get_last_payment
()
self
.
payment
=
self
.
get_last_payment
()
def
get_last_payment
(
self
):
def
get_last_payment
(
self
):
q
=
DBSession
.
query
(
Pembayaran
)
q
=
DBSession
.
query
(
Pembayaran
)
.
filter_by
(
q
=
q
.
filter_by
(
t_idspt
=
self
.
invoice_id
)
t_kodebayarbanksppt
=
self
.
invoice_id
)
.
order_by
(
q
=
q
.
order_by
(
Pembayaran
.
t_idpembayaranspt
.
desc
()
)
Pembayaran
.
t_idpembayaranspt
)
return
q
.
first
()
return
q
.
first
()
def
do_reversal
(
self
):
def
do_reversal
(
self
):
...
...
setup.py
View file @
c0f502a
...
@@ -20,7 +20,7 @@ setuptools.setup(
...
@@ -20,7 +20,7 @@ setuptools.setup(
version
=
version
,
version
=
version
,
author
=
'Owo Sugiana'
,
author
=
'Owo Sugiana'
,
author_email
=
'sugiana@gmail.com'
,
author_email
=
'sugiana@gmail.com'
,
description
=
'Struktur tabel
ISO 8583
'
,
description
=
'Struktur tabel
BPHTB
'
,
long_description
=
long_description
,
long_description
=
long_description
,
long_description_content_type
=
'text/markdown'
,
long_description_content_type
=
'text/markdown'
,
license
=
'PostgreSQL License'
,
license
=
'PostgreSQL License'
,
...
...
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