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 4f217062
authored
Feb 15, 2021
by
Owo Sugiana
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
Penambahan Kota Bekasi
1 parent
83b3511c
Show whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
433 additions
and
33 deletions
opensipkd/bphtb/models/bekasi_kota/__init__.py
opensipkd/bphtb/scripts/available_invoice.py
opensipkd/bphtb/scripts/common.py
opensipkd/bphtb/scripts/inquiry.py
opensipkd/bphtb/services/base.py
opensipkd/bphtb/services/bekasi_kota.py
opensipkd/bphtb/services/binjai.py
opensipkd/bphtb/services/cilegon.py
opensipkd/bphtb/services/default/__init__.py
setup.py
opensipkd/bphtb/models/bekasi_kota/__init__.py
View file @
4f21706
from
sqlalchemy
import
(
Column
,
Integer
,
String
,
Float
,
DateTime
,
)
from
sqlalchemy.ext.declarative
import
declarative_base
Base
=
declarative_base
()
class
Kecamatan
(
Base
):
__tablename__
=
'mkecamatan'
nkecamatan
=
Column
(
Integer
,
primary_key
=
True
)
skodekecamatan
=
Column
(
String
(
3
))
skecamatan
=
Column
(
String
(
50
))
bpakai
=
Column
(
Integer
)
class
Kelurahan
(
Base
):
__tablename__
=
'mkelurahan'
nkelurahan
=
Column
(
Integer
,
primary_key
=
True
)
nkecamatan
=
Column
(
Integer
)
skodekelurahan
=
Column
(
String
(
3
))
skelurahan
=
Column
(
String
(
50
))
bpakai
=
Column
(
Integer
)
class
Notaris
(
Base
):
__tablename__
=
'tbl_user'
id
=
Column
(
Integer
,
nullable
=
False
)
username
=
Column
(
String
(
50
),
primary_key
=
True
)
password
=
Column
(
String
(
200
),
nullable
=
False
)
access_level
=
Column
(
String
(
128
),
nullable
=
False
)
inventory
=
Column
(
Integer
,
nullable
=
False
)
fixed_asset
=
Column
(
Integer
,
nullable
=
False
)
department_id
=
Column
(
Integer
,
nullable
=
False
)
status
=
Column
(
Integer
,
nullable
=
False
)
last_login
=
Column
(
DateTime
,
nullable
=
False
)
ip
=
Column
(
String
(
32
),
nullable
=
False
)
authorize_ack
=
Column
(
String
(
1
),
nullable
=
False
)
authorize_approve
=
Column
(
String
(
1
),
nullable
=
False
)
position
=
Column
(
String
(
128
),
nullable
=
False
)
fullname
=
Column
(
String
(
128
),
nullable
=
False
)
email
=
Column
(
String
(
200
),
nullable
=
False
)
grade_code
=
Column
(
String
(
50
),
nullable
=
False
)
inquiry_access
=
Column
(
String
(
200
),
nullable
=
False
)
akses_deputi_bidang
=
Column
(
String
(
200
),
nullable
=
False
)
npwp
=
Column
(
String
(
20
))
sk_ppat
=
Column
(
String
(
30
))
tgl_sk_ppat
=
Column
(
DateTime
)
alamat
=
Column
(
String
(
50
))
no_telpon
=
Column
(
String
(
15
))
register_id
=
Column
(
String
(
20
),
nullable
=
False
,
unique
=
True
)
blokir
=
Column
(
String
(
1
),
nullable
=
False
)
no_hp
=
Column
(
String
(
12
))
class
Pembeli
(
Base
):
__tablename__
=
'tbl_pembeli'
id
=
Column
(
Integer
,
primary_key
=
True
)
nm_pembeli
=
Column
(
String
(
255
),
nullable
=
False
)
jns_kel_pembeli
=
Column
(
String
(
1
))
tempat_lahir_pembeli
=
Column
(
String
(
50
))
tgl_lahir_pembeli
=
Column
(
DateTime
)
stat_kawin_pembeli
=
Column
(
String
(
1
))
jns_pekerjaan_pembeli
=
Column
(
String
(
50
))
alamat_pembeli
=
Column
(
String
(
255
))
kota_pembeli
=
Column
(
String
(
50
))
kodepos_pembeli
=
Column
(
String
(
10
))
kecamatan_pembeli
=
Column
(
String
(
50
))
kelurahan_pembeli
=
Column
(
String
(
50
))
nm_ibu_pembeli
=
Column
(
String
(
100
))
hp_pembeli
=
Column
(
String
(
15
))
email_pembeli
=
Column
(
String
(
80
))
npwp_pembeli
=
Column
(
String
(
20
))
jns_identitas_pembeli
=
Column
(
String
(
30
))
no_identitas_pembeli
=
Column
(
String
(
50
))
keterangan_pembeli
=
Column
(
String
(
100
))
kd_bphtb
=
Column
(
String
(
20
),
nullable
=
False
)
tgl_rekam
=
Column
(
DateTime
)
blok_kav_no_pembeli
=
Column
(
String
(
20
))
rw_pembeli
=
Column
(
String
(
3
))
rt_pembeli
=
Column
(
String
(
3
))
class
Invoice
(
Base
):
__tablename__
=
'tbl_data_transaksi'
id
=
Column
(
Integer
,
primary_key
=
True
)
nop
=
Column
(
String
(
22
),
nullable
=
False
)
alamat_op
=
Column
(
String
(
50
),
nullable
=
False
)
blok_kav_no_op
=
Column
(
String
(
30
))
rt_op
=
Column
(
String
(
5
))
rw_op
=
Column
(
String
(
5
))
kota_op
=
Column
(
String
(
15
))
kodepos
=
Column
(
String
(
10
))
kecamatan
=
Column
(
String
(
30
))
kelurahan
=
Column
(
String
(
30
))
luas_tanah
=
Column
(
Float
,
nullable
=
False
)
luas_bng
=
Column
(
Float
,
nullable
=
False
)
njop_bumi
=
Column
(
Float
)
njop_bng
=
Column
(
Float
)
jns_perolehan
=
Column
(
String
(
5
))
harga_transaksi
=
Column
(
Float
)
njop_total
=
Column
(
Float
,
nullable
=
False
)
bphtb_terutang
=
Column
(
Float
,
nullable
=
False
)
kd_hak
=
Column
(
String
(
2
))
no_sertifikat
=
Column
(
String
(
50
))
npop
=
Column
(
Float
)
npoptkp
=
Column
(
Float
)
npopkp
=
Column
(
Float
)
peng_waris_hibah_wasiat
=
Column
(
Float
)
bphtb_yg_harus_dibayar
=
Column
(
Float
)
jns_setoran
=
Column
(
String
(
1
))
no_stb_skbkb
=
Column
(
String
(
20
))
tgl_stb_skbkb
=
Column
(
DateTime
)
kd_alasan_pengurangan
=
Column
(
String
(
4
))
ket_setoran_lain
=
Column
(
String
(
25
))
keterangan_op
=
Column
(
String
(
100
))
reg_ppat
=
Column
(
String
(
25
))
kd_booking
=
Column
(
String
(
12
),
nullable
=
False
,
unique
=
True
)
status_booking
=
Column
(
String
(
1
),
nullable
=
False
)
status_bayar
=
Column
(
String
(
1
),
nullable
=
False
)
status_validasi
=
Column
(
String
(
2
),
nullable
=
False
)
status_validasi_pph
=
Column
(
String
(
1
),
nullable
=
False
)
status_bpn
=
Column
(
String
(
1
),
nullable
=
False
)
tgl_rekam
=
Column
(
DateTime
)
kd_pembayaran
=
Column
(
String
(
15
))
tahun_sppt
=
Column
(
String
(
4
))
useredit
=
Column
(
String
(
50
))
tgl_edit
=
Column
(
DateTime
)
class
Payment
(
Base
):
__tablename__
=
'pembayaran_bphtb'
id
=
Column
(
Integer
,
primary_key
=
True
)
nop
=
Column
(
String
(
22
),
nullable
=
False
)
kd_booking
=
Column
(
String
(
20
),
nullable
=
False
,
unique
=
True
)
ntpd
=
Column
(
String
(
20
),
nullable
=
False
,
unique
=
True
)
pembayaran_bphtb_ke
=
Column
(
String
(
1
),
nullable
=
False
)
bphtb_dibayar
=
Column
(
Float
,
nullable
=
False
)
tgl_pembayaran_bphtb
=
Column
(
DateTime
,
nullable
=
False
)
nip_rekam_byr
=
Column
(
String
(
20
),
nullable
=
False
)
reversal
=
Column
(
Integer
)
tanggal_reversal
=
Column
(
DateTime
)
opensipkd/bphtb/scripts/available_invoice.py
View file @
4f21706
...
@@ -23,6 +23,5 @@ def get_option(argv):
...
@@ -23,6 +23,5 @@ def get_option(argv):
def
main
(
argv
=
sys
.
argv
):
def
main
(
argv
=
sys
.
argv
):
option
=
get_option
(
argv
[
1
:])
option
=
get_option
(
argv
[
1
:])
conf
,
services
=
init
(
option
)
conf
,
services
=
init
(
option
)
persen_denda
=
conf
.
getfloat
(
'main'
,
'persen_denda'
)
a
=
services
.
AvailableInvoice
(
conf
,
option
)
a
=
services
.
AvailableInvoice
(
persen_denda
,
option
)
a
.
show
()
a
.
show
()
opensipkd/bphtb/scripts/common.py
View file @
4f21706
...
@@ -7,12 +7,17 @@ from zope.sqlalchemy import register
...
@@ -7,12 +7,17 @@ from zope.sqlalchemy import register
def
init
(
option
):
def
init
(
option
):
conf
=
ConfigParser
()
conf
=
ConfigParser
()
conf
.
read
(
option
.
conf
)
conf
.
read
(
option
.
conf
)
module_name
=
conf
.
get
(
'main'
,
'module'
)
cf
=
dict
()
for
key
,
val
in
conf
.
items
(
'main'
):
if
key
==
'persen_denda'
:
val
=
float
(
val
)
cf
[
key
]
=
val
module_name
=
cf
[
'module'
]
module
=
__import__
(
'opensipkd.bphtb.services.'
+
module_name
)
module
=
__import__
(
'opensipkd.bphtb.services.'
+
module_name
)
db_url
=
c
onf
.
get
(
'main'
,
'db_url'
)
db_url
=
c
f
[
'db_url'
]
engine
=
create_engine
(
db_url
)
engine
=
create_engine
(
db_url
)
session_factory
=
sessionmaker
(
bind
=
engine
)
session_factory
=
sessionmaker
(
bind
=
engine
)
dbs
=
module
.
bphtb
.
services
.
base
.
DBSession
=
session_factory
()
dbs
=
module
.
bphtb
.
services
.
base
.
DBSession
=
session_factory
()
register
(
dbs
)
register
(
dbs
)
services
=
getattr
(
module
.
bphtb
.
services
,
module_name
)
services
=
getattr
(
module
.
bphtb
.
services
,
module_name
)
return
c
on
f
,
services
return
cf
,
services
opensipkd/bphtb/scripts/inquiry.py
View file @
4f21706
...
@@ -3,9 +3,13 @@ from datetime import datetime
...
@@ -3,9 +3,13 @@ from datetime import datetime
from
argparse
import
ArgumentParser
from
argparse
import
ArgumentParser
import
transaction
import
transaction
from
opensipkd.string.money
import
thousand
from
opensipkd.string.money
import
thousand
from
opensipkd.waktu
import
date_from_str
from
.common
import
init
from
.common
import
init
help_tgl_bayar
=
'format dd-mm-yyyy'
def
show_val
(
label
,
value
):
def
show_val
(
label
,
value
):
print
(
'{}: {}'
.
format
(
label
,
value
))
print
(
'{}: {}'
.
format
(
label
,
value
))
...
@@ -35,19 +39,29 @@ def get_option(argv):
...
@@ -35,19 +39,29 @@ def get_option(argv):
pars
=
ArgumentParser
()
pars
=
ArgumentParser
()
pars
.
add_argument
(
'conf'
,
help
=
'File konfigurasi'
)
pars
.
add_argument
(
'conf'
,
help
=
'File konfigurasi'
)
pars
.
add_argument
(
'--invoice-id'
,
required
=
True
)
pars
.
add_argument
(
'--invoice-id'
,
required
=
True
)
pars
.
add_argument
(
'--tgl-bayar'
,
help
=
help_tgl_bayar
)
pars
.
add_argument
(
'--payment'
,
action
=
'store_true'
)
pars
.
add_argument
(
'--payment'
,
action
=
'store_true'
)
pars
.
add_argument
(
'--reversal'
,
action
=
'store_true'
)
pars
.
add_argument
(
'--reversal'
,
action
=
'store_true'
)
return
pars
.
parse_args
(
argv
)
return
pars
.
parse_args
(
argv
)
def
show_payment
(
inq
):
def
show_payment
_from_inquiry
(
inq
):
pay
=
inq
.
get_payment
()
pay
=
inq
.
get_payment
()
if
not
pay
:
if
pay
:
return
show_payment
(
pay
)
def
show_payment
(
pay
):
print
(
'Tabel {}:'
.
format
(
pay
.
__table__
.
name
))
# Binjai
# Binjai
show_fields
(
show_fields
(
pay
,
[
'id'
,
'jumlah_bayar'
,
'tanggal_bayar'
,
'user_bayar'
,
pay
,
[
'id'
,
'jumlah_bayar'
,
'tanggal_bayar'
,
'user_bayar'
,
'kirim_bpn'
])
'kirim_bpn'
])
# Kota Bekasi
show_fields
(
pay
,
[
'nop'
,
'ntpd'
,
'pembayaran_bphtb_ke'
,
'bphtb_dibayar'
,
'tgl_pembayaran_bphtb'
,
'nip_rekam_byr'
,
'reversal'
,
'tanggal_reversal'
])
def
show_inquiry
(
inq
):
def
show_inquiry
(
inq
):
...
@@ -78,15 +92,7 @@ def show_inquiry(inq):
...
@@ -78,15 +92,7 @@ def show_inquiry(inq):
show_val
(
'Kota Wajib Pajak'
,
inq
.
get_kota_wp
())
show_val
(
'Kota Wajib Pajak'
,
inq
.
get_kota_wp
())
show_val
(
'Tahun Pajak'
,
inq
.
get_tahun
())
show_val
(
'Tahun Pajak'
,
inq
.
get_tahun
())
show_val
(
'Is Available'
,
inq
.
is_available
())
show_val
(
'Is Available'
,
inq
.
is_available
())
show_payment
(
inq
)
show_payment_from_inquiry
(
inq
)
def
show_pkey_values
(
row
):
print
(
'Primary key tabel {}:'
.
format
(
row
.
__table__
.
name
))
for
c
in
row
.
__table__
.
columns
:
if
c
.
primary_key
:
val
=
getattr
(
row
,
c
.
name
)
show_val
(
' '
+
c
.
name
,
val
)
def
error
(
s
):
def
error
(
s
):
...
@@ -97,20 +103,21 @@ def error(s):
...
@@ -97,20 +103,21 @@ def error(s):
def
main
(
argv
=
sys
.
argv
):
def
main
(
argv
=
sys
.
argv
):
option
=
get_option
(
argv
[
1
:])
option
=
get_option
(
argv
[
1
:])
conf
,
services
=
init
(
option
)
conf
,
services
=
init
(
option
)
persen_denda
=
conf
.
getfloat
(
'main'
,
'persen_denda'
)
invoice_id
=
option
.
invoice_id
invoice_id
=
option
.
invoice_id
inq
=
services
.
Inquiry
(
tgl_bayar
=
option
.
tgl_bayar
and
date_from_str
(
option
.
tgl_bayar
)
invoice_id
,
conf
.
getfloat
(
'main'
,
'persen_denda'
)
)
inq
=
services
.
Inquiry
(
invoice_id
,
conf
,
tgl_bayar
)
if
not
inq
.
invoice
:
if
not
inq
.
invoice
:
error
(
f
'Invoice ID {invoice_id} tidak ada.'
)
error
(
f
'Invoice ID {invoice_id} tidak ada.'
)
show_inquiry
(
inq
)
show_inquiry
(
inq
)
if
option
.
payment
:
if
option
.
payment
:
if
not
inq
.
total
:
if
not
inq
.
total
:
error
(
'Tidak ada tagihan, tidak ada yang perlu dibayar.'
)
error
(
'Tidak ada tagihan, tidak ada yang perlu dibayar.'
)
if
not
inq
.
is_available
():
error
(
'Tagihan ini tidak bisa dibayarkan.'
)
ntb
=
datetime
.
now
()
.
strftime
(
'
%
y
%
m
%
d
%
H
%
M
%
S'
)
ntb
=
datetime
.
now
()
.
strftime
(
'
%
y
%
m
%
d
%
H
%
M
%
S'
)
with
transaction
.
manager
:
with
transaction
.
manager
:
pay
=
inq
.
do_payment
(
ntb
)
pay
=
inq
.
do_payment
(
ntb
)
show_p
key_values
(
pay
)
show_p
ayment
(
pay
)
print
(
'Berhasil dibayar'
)
print
(
'Berhasil dibayar'
)
if
option
.
reversal
:
if
option
.
reversal
:
rev
=
services
.
Reversal
(
invoice_id
)
rev
=
services
.
Reversal
(
invoice_id
)
...
@@ -120,5 +127,5 @@ def main(argv=sys.argv):
...
@@ -120,5 +127,5 @@ def main(argv=sys.argv):
'Pembayaran tidak ditemukan, tidak ada yang perlu dibatalkan.'
)
'Pembayaran tidak ditemukan, tidak ada yang perlu dibatalkan.'
)
with
transaction
.
manager
:
with
transaction
.
manager
:
rev
.
do_reversal
()
rev
.
do_reversal
()
show_p
key_values
(
pay
)
show_p
ayment
(
pay
)
print
(
'Berhasil dibatalkan'
)
print
(
'Berhasil dibatalkan'
)
opensipkd/bphtb/services/base.py
View file @
4f21706
...
@@ -9,10 +9,11 @@ def get_db_session():
...
@@ -9,10 +9,11 @@ def get_db_session():
class
AvailableInvoice
:
class
AvailableInvoice
:
def
__init__
(
self
,
persen_denda
=
2
,
option
=
None
):
def
__init__
(
self
,
conf
,
option
=
None
):
self
.
option
=
option
self
.
option
=
option
self
.
count
=
option
and
option
.
count
or
10
self
.
count
=
option
and
option
.
count
or
10
self
.
persen_denda
=
persen_denda
self
.
conf
=
conf
self
.
persen_denda
=
conf
.
get
(
'persen_denda'
)
def
show
(
self
):
def
show
(
self
):
offset
=
-
1
offset
=
-
1
...
...
opensipkd/bphtb/services/bekasi_kota.py
0 → 100644
View file @
4f21706
from
datetime
import
(
date
,
datetime
,
)
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
from
..structure
import
NOP
from
..models.bekasi_kota
import
(
Kecamatan
,
Kelurahan
,
Notaris
,
Pembeli
,
Invoice
,
Payment
,
)
from
.base
import
get_db_session
from
.default
import
AvailableInvoice
as
BaseAvailableInvoice
class
NTP
(
TransactionID
):
def
is_found
(
self
,
tid
):
# Override
db_session
=
get_db_session
()
q
=
db_session
.
query
(
Payment
)
.
filter_by
(
ntpd
=
tid
)
return
q
.
first
()
class
Common
:
def
__init__
(
self
,
invoice_id
):
self
.
invoice_id
=
invoice_id
db_session
=
get_db_session
()
q
=
db_session
.
query
(
Invoice
)
.
filter_by
(
kd_booking
=
invoice_id
)
self
.
invoice
=
q
.
first
()
self
.
payment
=
self
.
invoice
and
self
.
get_payment
()
def
is_available
(
self
):
# Meski reversal tetap tidak bisa dibayarkan lagi karena kd_booking
# unique.
return
not
self
.
payment
and
self
.
invoice
.
status_bayar
==
'0'
def
get_payment
(
self
):
db_session
=
get_db_session
()
q
=
db_session
.
query
(
Payment
)
.
filter_by
(
kd_booking
=
self
.
invoice
.
kd_booking
)
.
order_by
(
Payment
.
pembayaran_bphtb_ke
.
desc
())
return
q
.
first
()
class
Inquiry
(
Common
):
def
__init__
(
self
,
invoice_id
,
conf
,
tgl_bayar
=
None
):
super
()
.
__init__
(
invoice_id
)
if
not
self
.
invoice
:
return
self
.
conf
=
conf
if
tgl_bayar
:
self
.
tgl_bayar
=
tgl_bayar
else
:
self
.
tgl_bayar
=
date
.
today
()
self
.
hitung
()
self
.
nop
=
FixLength
(
NOP
)
self
.
nop
.
set_raw
(
self
.
invoice
.
nop
)
self
.
kecamatan
=
self
.
get_kecamatan
()
self
.
kelurahan
=
self
.
get_kelurahan
()
self
.
notaris
=
self
.
get_notaris
()
self
.
pembeli
=
self
.
get_pembeli
()
def
hitung
(
self
):
self
.
denda
=
self
.
discount
=
0
self
.
tagihan
=
round_up
(
self
.
invoice
.
bphtb_yg_harus_dibayar
)
self
.
total_bayar
=
self
.
get_payment_amount
()
self
.
total_bayar
=
round_up
(
self
.
total_bayar
)
self
.
total
=
self
.
tagihan
-
self
.
total_bayar
if
self
.
total
<
0
:
self
.
total
=
0
def
get_payment_amount
(
self
):
db_session
=
get_db_session
()
q
=
db_session
.
query
(
func
.
sum
(
Payment
.
bphtb_dibayar
))
.
filter_by
(
kd_booking
=
self
.
invoice_id
,
reversal
=
0
)
return
q
.
scalar
()
or
0
def
get_kecamatan
(
self
):
db_session
=
get_db_session
()
q
=
db_session
.
query
(
Kecamatan
)
.
filter_by
(
skodekecamatan
=
self
.
nop
[
'Kecamatan'
])
return
q
.
first
()
def
get_kelurahan
(
self
):
db_session
=
get_db_session
()
q
=
db_session
.
query
(
Kelurahan
)
.
filter_by
(
nkecamatan
=
self
.
kecamatan
.
nkecamatan
,
skodekelurahan
=
self
.
nop
[
'Kelurahan'
])
return
q
.
first
()
def
get_notaris
(
self
):
db_session
=
get_db_session
()
q
=
db_session
.
query
(
Notaris
)
.
filter_by
(
register_id
=
self
.
invoice
.
reg_ppat
)
return
q
.
first
()
def
get_pembeli
(
self
):
db_session
=
get_db_session
()
q
=
db_session
.
query
(
Pembeli
)
.
filter_by
(
kd_bphtb
=
self
.
invoice
.
kd_booking
)
return
q
.
first
()
def
get_nop
(
self
):
return
self
.
invoice
.
nop
[:
18
]
def
get_luas_tanah
(
self
):
return
int
(
self
.
invoice
.
luas_tanah
)
def
get_luas_bangunan
(
self
):
return
int
(
self
.
invoice
.
luas_bng
)
def
get_npop
(
self
):
return
int
(
self
.
invoice
.
npop
)
def
get_jenis_perolehan_hak
(
self
):
return
self
.
invoice
.
jns_perolehan
def
get_nama_notaris
(
self
):
return
self
.
notaris
and
self
.
notaris
.
fullname
or
''
def
get_nama
(
self
):
return
self
.
pembeli
.
nm_pembeli
def
get_npwp
(
self
):
return
self
.
pembeli
.
npwp_pembeli
def
get_alamat_wp
(
self
):
return
self
.
pembeli
.
alamat_pembeli
def
get_alamat_op
(
self
):
return
self
.
invoice
.
alamat_op
def
get_kota_wp
(
self
):
return
self
.
get_kota_op
()
def
get_kota_op
(
self
):
return
self
.
invoice
.
kota_op
def
get_kelurahan_wp
(
self
):
return
self
.
pembeli
.
kelurahan_pembeli
def
get_kecamatan_wp
(
self
):
return
self
.
pembeli
.
kecamatan_pembeli
def
get_rt_wp
(
self
):
return
self
.
pembeli
.
rt_pembeli
def
get_rw_wp
(
self
):
return
self
.
pembeli
.
rw_pembeli
def
get_kode_pos_wp
(
self
):
return
self
.
pembeli
.
kodepos_pembeli
def
get_kelurahan_op
(
self
):
return
self
.
kelurahan
.
skelurahan
def
get_kecamatan_op
(
self
):
return
self
.
kecamatan
.
skecamatan
def
get_tahun
(
self
):
return
self
.
invoice
.
tgl_rekam
.
year
def
get_pay_seq
(
self
):
if
self
.
payment
:
return
int
(
self
.
payment
.
pembayaran_bphtb_ke
)
+
1
return
1
def
get_pay_id
(
self
):
db_session
=
get_db_session
()
q
=
db_session
.
query
(
func
.
max
(
Payment
.
id
))
n
=
q
.
scalar
()
return
n
and
n
+
1
or
1
def
do_payment
(
self
,
ntb
):
pembayaran_ke
=
self
.
get_pay_seq
()
pay_id
=
self
.
get_pay_id
()
ntp_generator
=
NTP
()
ntp
=
ntp_generator
.
create
()
pay
=
Payment
(
id
=
pay_id
,
nop
=
self
.
invoice
.
nop
,
kd_booking
=
self
.
invoice
.
kd_booking
,
ntpd
=
ntp
,
pembayaran_bphtb_ke
=
pembayaran_ke
,
bphtb_dibayar
=
self
.
total
,
tgl_pembayaran_bphtb
=
self
.
tgl_bayar
,
nip_rekam_byr
=
self
.
conf
[
'nip_pencatat'
],
reversal
=
0
)
self
.
invoice
.
status_bayar
=
'1'
db_session
=
get_db_session
()
db_session
.
add
(
pay
)
db_session
.
add
(
self
.
invoice
)
return
pay
class
Reversal
(
Common
):
def
__init__
(
self
,
invoice_id
):
super
()
.
__init__
(
invoice_id
)
if
not
self
.
invoice
or
not
self
.
payment
:
return
if
self
.
payment
.
reversal
==
1
:
self
.
payment
=
None
def
do_reversal
(
self
):
self
.
invoice
.
status_bayar
=
'0'
self
.
payment
.
reversal
=
1
self
.
payment
.
tanggal_reversal
=
datetime
.
now
()
self
.
payment
.
bphtb_dibayar
=
0
db_session
=
get_db_session
()
db_session
.
add
(
self
.
payment
)
db_session
.
add
(
self
.
invoice
)
class
AvailableInvoice
(
BaseAvailableInvoice
):
def
get_query
(
self
):
db_session
=
get_db_session
()
q
=
db_session
.
query
(
Invoice
)
.
filter
(
Invoice
.
bphtb_yg_harus_dibayar
>
0
)
.
filter_by
(
status_bayar
=
'0'
)
if
self
.
option
.
tahun
:
awal
=
date
(
self
.
option
.
tahun
,
1
,
1
)
akhir
=
date
(
self
.
option
.
tahun
,
12
,
31
)
q
=
q
.
filter
(
Invoice
.
tgl_rekam
>=
awal
,
Invoice
.
tgl_rekam
<=
akhir
)
return
q
.
order_by
(
Invoice
.
bphtb_yg_harus_dibayar
)
def
get_message
(
self
,
row
):
inq
=
Inquiry
(
row
.
kd_booking
,
self
.
conf
)
if
not
inq
.
is_available
():
return
msg
=
'{} {} {} {}'
.
format
(
inq
.
invoice_id
,
inq
.
get_tahun
(),
inq
.
get_nop
(),
inq
.
get_nama
())
if
inq
.
total_bayar
:
msg
=
'{} Rp {} - Rp {} = Rp {}'
.
format
(
msg
,
thousand
(
inq
.
tagihan
),
thousand
(
inq
.
total_bayar
),
thousand
(
inq
.
total
))
else
:
msg
=
'{} Rp {}'
.
format
(
msg
,
thousand
(
inq
.
total
))
return
msg
opensipkd/bphtb/services/binjai.py
View file @
4f21706
...
@@ -142,11 +142,11 @@ class Common:
...
@@ -142,11 +142,11 @@ class Common:
class
Inquiry
(
Common
):
class
Inquiry
(
Common
):
def
__init__
(
self
,
invoice_id
,
persen_denda
=
2
,
tgl_bayar
=
None
):
def
__init__
(
self
,
invoice_id
,
conf
,
tgl_bayar
=
None
):
super
()
.
__init__
(
invoice_id
)
super
()
.
__init__
(
invoice_id
)
if
not
self
.
invoice
:
if
not
self
.
invoice
:
return
return
self
.
persen_denda
=
persen_denda
self
.
persen_denda
=
conf
.
get
(
'persen_denda'
)
if
tgl_bayar
:
if
tgl_bayar
:
self
.
tgl_bayar
=
tgl_bayar
self
.
tgl_bayar
=
tgl_bayar
else
:
else
:
...
@@ -290,7 +290,7 @@ class AvailableInvoice(BaseAvailableInvoice):
...
@@ -290,7 +290,7 @@ class AvailableInvoice(BaseAvailableInvoice):
return
date
(
self
.
option
.
tahun
,
1
,
1
),
date
(
self
.
option
.
tahun
,
12
,
31
)
return
date
(
self
.
option
.
tahun
,
1
,
1
),
date
(
self
.
option
.
tahun
,
12
,
31
)
def
get_message
(
self
,
row
):
# Override
def
get_message
(
self
,
row
):
# Override
inq
=
Inquiry
(
row
.
kode
,
self
.
persen_denda
)
inq
=
Inquiry
(
row
.
kode
,
self
.
conf
)
if
not
inq
.
total
:
if
not
inq
.
total
:
return
return
msg
=
'{} {} {} {}'
.
format
(
msg
=
'{} {} {} {}'
.
format
(
...
...
opensipkd/bphtb/services/cilegon.py
View file @
4f21706
...
@@ -21,9 +21,9 @@ from ..models.cilegon import (
...
@@ -21,9 +21,9 @@ from ..models.cilegon import (
class
Inquiry
:
class
Inquiry
:
def
__init__
(
self
,
invoice_id
,
persen_denda
=
2
,
tgl_bayar
=
None
):
def
__init__
(
self
,
invoice_id
,
conf
,
tgl_bayar
=
None
):
self
.
invoice_id
=
invoice_id
self
.
invoice_id
=
invoice_id
self
.
persen_denda
=
persen_denda
self
.
persen_denda
=
conf
.
get
(
'persen_denda'
)
if
tgl_bayar
:
if
tgl_bayar
:
self
.
tgl_bayar
=
tgl_bayar
self
.
tgl_bayar
=
tgl_bayar
else
:
else
:
...
@@ -229,7 +229,7 @@ class AvailableInvoice(BaseAvailableInvoice):
...
@@ -229,7 +229,7 @@ class AvailableInvoice(BaseAvailableInvoice):
return
q
.
order_by
(
Spt
.
t_periodespt
.
desc
(),
Spt
.
t_totalspt
,
Spt
.
t_idspt
)
return
q
.
order_by
(
Spt
.
t_periodespt
.
desc
(),
Spt
.
t_totalspt
,
Spt
.
t_idspt
)
def
get_message
(
self
,
row
):
def
get_message
(
self
,
row
):
inq
=
Inquiry
(
row
.
t_kodebayarbanksppt
,
self
.
persen_denda
)
inq
=
Inquiry
(
row
.
t_kodebayarbanksppt
,
self
.
conf
)
if
not
inq
.
total
:
if
not
inq
.
total
:
return
return
msg
=
'{} {} {} {}'
.
format
(
msg
=
'{} {} {} {}'
.
format
(
...
...
opensipkd/bphtb/services/default/__init__.py
View file @
4f21706
...
@@ -76,11 +76,11 @@ class Common:
...
@@ -76,11 +76,11 @@ class Common:
class
Inquiry
(
Common
):
class
Inquiry
(
Common
):
def
__init__
(
self
,
invoice_id
,
persen_denda
=
2
,
tgl_bayar
=
None
):
def
__init__
(
self
,
invoice_id
,
conf
,
tgl_bayar
=
None
):
super
()
.
__init__
(
invoice_id
)
super
()
.
__init__
(
invoice_id
)
if
not
self
.
invoice
:
if
not
self
.
invoice
:
return
return
self
.
persen_denda
=
persen_denda
self
.
persen_denda
=
conf
.
get
(
'persen_denda'
)
if
tgl_bayar
:
if
tgl_bayar
:
self
.
tgl_bayar
=
tgl_bayar
self
.
tgl_bayar
=
tgl_bayar
else
:
else
:
...
@@ -326,7 +326,7 @@ class AvailableInvoice(BaseAvailableInvoice):
...
@@ -326,7 +326,7 @@ class AvailableInvoice(BaseAvailableInvoice):
invoice_id_struct
[
'Kode'
]
=
row
.
kode
.
zfill
(
2
)
invoice_id_struct
[
'Kode'
]
=
row
.
kode
.
zfill
(
2
)
invoice_id_struct
[
'SSPD No'
]
=
row
.
no_sspd
invoice_id_struct
[
'SSPD No'
]
=
row
.
no_sspd
invoice_id
=
invoice_id_struct
.
get_raw
()
invoice_id
=
invoice_id_struct
.
get_raw
()
inq
=
self
.
inquiry_cls
(
invoice_id
,
self
.
persen_denda
)
inq
=
self
.
inquiry_cls
(
invoice_id
,
self
.
conf
)
if
inq
.
total
<
1
:
if
inq
.
total
<
1
:
return
return
total
=
thousand
(
inq
.
total
)
.
rjust
(
11
)
total
=
thousand
(
inq
.
total
)
.
rjust
(
11
)
...
...
setup.py
View file @
4f21706
...
@@ -12,6 +12,7 @@ version = line.split()[0]
...
@@ -12,6 +12,7 @@ version = line.split()[0]
requires
=
[
requires
=
[
'sqlalchemy'
,
'sqlalchemy'
,
'zope.sqlalchemy'
,
'opensipkd-hitung @ '
'opensipkd-hitung @ '
'git+https://git.opensipkd.com/sugiana/opensipkd-hitung.git'
,
'git+https://git.opensipkd.com/sugiana/opensipkd-hitung.git'
,
]
]
...
...
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