Skip to content
Toggle navigation
Projects
Groups
Snippets
Help
Owo Sugiana
/
opensipkd-pad-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 3544af11
authored
Oct 07, 2020
by
Owo Sugiana
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
Perubahan rumus tangsel
1 parent
1d8a4a1b
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
280 additions
and
43 deletions
CHANGES.txt
opensipkd/pad/models/default.py
opensipkd/pad/models/tangsel.py
opensipkd/pad/scripts/available_invoice.py
opensipkd/pad/scripts/inquiry.py
opensipkd/pad/services/default/__init__.py
opensipkd/pad/services/tangsel/__init__.py
setup.py
CHANGES.txt
View file @
3544af1
0.2.4 2020-10-07
----------------
- Perubahan rumus modul tangsel
0.2.3 2020-09-04
0.2.3 2020-09-04
----------------
----------------
- inquiry.py tambah opsi --tgl-bayar
- inquiry.py tambah opsi --tgl-bayar
...
...
opensipkd/pad/models/default.py
View file @
3544af1
...
@@ -334,6 +334,30 @@ class Invoice(Base):
...
@@ -334,6 +334,30 @@ class Invoice(Base):
dict
(
schema
=
'pad'
))
dict
(
schema
=
'pad'
))
class
Kohir
(
Base
):
__tablename__
=
'pad_kohir'
tahun
=
Column
(
Integer
,
nullable
=
False
)
kohirno
=
Column
(
Integer
,
nullable
=
False
)
spt_id
=
Column
(
Integer
,
ForeignKey
(
Invoice
.
id
),
nullable
=
False
)
kohirtgl
=
Column
(
DateTime
,
nullable
=
False
)
id
=
Column
(
Integer
,
primary_key
=
True
)
enabled
=
Column
(
Integer
)
create_date
=
Column
(
DateTime
)
create_uid
=
Column
(
Integer
)
write_date
=
Column
(
DateTime
)
write_uid
=
Column
(
Integer
)
denda
=
Column
(
Float
)
jatuhtempotgl
=
Column
(
DateTime
)
pajak_type
=
Column
(
String
(
10
))
usaha_id
=
Column
(
Integer
)
posted
=
Column
(
Integer
)
is_cancel
=
Column
(
Integer
)
notes
=
Column
(
Text
)
__table_args__
=
(
UniqueConstraint
(
tahun
,
pajak_type
,
kohirno
),
dict
(
schema
=
'pad'
))
class
Payment
(
Base
):
class
Payment
(
Base
):
__tablename__
=
'pad_sspd'
__tablename__
=
'pad_sspd'
id
=
Column
(
Integer
,
primary_key
=
True
)
id
=
Column
(
Integer
,
primary_key
=
True
)
...
...
opensipkd/pad/models/tangsel.py
View file @
3544af1
...
@@ -326,6 +326,29 @@ class Invoice(Base):
...
@@ -326,6 +326,29 @@ class Invoice(Base):
UniqueConstraint
(
'tahun'
,
'sptno'
),)
UniqueConstraint
(
'tahun'
,
'sptno'
),)
class
Kohir
(
Base
):
__tablename__
=
'pad_kohir'
tahun
=
Column
(
Integer
,
nullable
=
False
)
kohirno
=
Column
(
Integer
,
nullable
=
False
)
spt_id
=
Column
(
Integer
,
ForeignKey
(
Invoice
.
id
),
nullable
=
False
)
kohirtgl
=
Column
(
DateTime
,
nullable
=
False
)
id
=
Column
(
Integer
,
primary_key
=
True
)
enabled
=
Column
(
Integer
)
create_date
=
Column
(
DateTime
)
create_uid
=
Column
(
Integer
)
write_date
=
Column
(
DateTime
)
write_uid
=
Column
(
Integer
)
denda
=
Column
(
Float
)
jatuhtempotgl
=
Column
(
DateTime
)
pajak_type
=
Column
(
String
(
10
))
usaha_id
=
Column
(
Integer
)
posted
=
Column
(
Integer
)
is_cancel
=
Column
(
Integer
)
notes
=
Column
(
Text
)
__table_args__
=
(
UniqueConstraint
(
tahun
,
pajak_type
,
kohirno
),)
class
Payment
(
Base
):
class
Payment
(
Base
):
__tablename__
=
'pad_sspd'
__tablename__
=
'pad_sspd'
tahun
=
Column
(
Integer
,
nullable
=
False
)
tahun
=
Column
(
Integer
,
nullable
=
False
)
...
...
opensipkd/pad/scripts/available_invoice.py
View file @
3544af1
...
@@ -5,12 +5,13 @@ from sqlalchemy import create_engine
...
@@ -5,12 +5,13 @@ from sqlalchemy import create_engine
from
sqlalchemy.orm
import
sessionmaker
from
sqlalchemy.orm
import
sessionmaker
help_jenis
=
'contoh: restoran'
default_count
=
10
help_jenis
=
'dari tabel pad_usaha'
help_tipe
=
'dari tabel pad_spt_type'
help_count
=
f
'default {default_count}'
def
get_option
(
argv
):
def
get_option
(
argv
):
default_count
=
10
help_count
=
'default {}'
.
format
(
default_count
)
pars
=
ArgumentParser
()
pars
=
ArgumentParser
()
pars
.
add_argument
(
'conf'
)
pars
.
add_argument
(
'conf'
)
pars
.
add_argument
(
'--jenis'
,
help
=
help_jenis
)
pars
.
add_argument
(
'--jenis'
,
help
=
help_jenis
)
...
@@ -19,6 +20,11 @@ def get_option(argv):
...
@@ -19,6 +20,11 @@ def get_option(argv):
pars
.
add_argument
(
'--jatuh-tempo-max'
)
pars
.
add_argument
(
'--jatuh-tempo-max'
)
pars
.
add_argument
(
'--nominal-min'
,
type
=
int
)
pars
.
add_argument
(
'--nominal-min'
,
type
=
int
)
pars
.
add_argument
(
'--nominal-max'
,
type
=
int
)
pars
.
add_argument
(
'--nominal-max'
,
type
=
int
)
pars
.
add_argument
(
'--tgl-kohir-min'
)
pars
.
add_argument
(
'--tgl-kohir-max'
)
pars
.
add_argument
(
'--tipe'
,
help
=
help_tipe
)
pars
.
add_argument
(
'--self'
,
action
=
'store_true'
)
pars
.
add_argument
(
'--no-self'
,
action
=
'store_true'
)
pars
.
add_argument
(
pars
.
add_argument
(
'--count'
,
type
=
int
,
default
=
default_count
,
help
=
help_count
)
'--count'
,
type
=
int
,
default
=
default_count
,
help
=
help_count
)
return
pars
.
parse_args
(
argv
)
return
pars
.
parse_args
(
argv
)
...
...
opensipkd/pad/scripts/inquiry.py
View file @
3544af1
...
@@ -53,6 +53,8 @@ def show(inq):
...
@@ -53,6 +53,8 @@ def show(inq):
show_val
(
'Kode Rekening'
,
inq
.
get_kode_rekening
())
show_val
(
'Kode Rekening'
,
inq
.
get_kode_rekening
())
show_val
(
'Nama Rekening'
,
inq
.
get_nama_rekening
())
show_val
(
'Nama Rekening'
,
inq
.
get_nama_rekening
())
show_val
(
'Jenis Usaha'
,
inq
.
get_nama_jenis_usaha
())
show_val
(
'Jenis Usaha'
,
inq
.
get_nama_jenis_usaha
())
show_val
(
'Tipe'
,
inq
.
get_type_name
())
show_val
(
'Self'
,
inq
.
is_self
())
show_val
(
'NPWPD'
,
inq
.
get_npwp
())
show_val
(
'NPWPD'
,
inq
.
get_npwp
())
show_val
(
'Nama Wajib Pajak'
,
inq
.
get_nama
())
show_val
(
'Nama Wajib Pajak'
,
inq
.
get_nama
())
show_val
(
'Alamat Wajib Pajak'
,
inq
.
get_alamat_wp
())
show_val
(
'Alamat Wajib Pajak'
,
inq
.
get_alamat_wp
())
...
@@ -62,7 +64,11 @@ def show(inq):
...
@@ -62,7 +64,11 @@ def show(inq):
show_val
(
'Kecamatan Objek Pajak'
,
inq
.
get_kecamatan_op
())
show_val
(
'Kecamatan Objek Pajak'
,
inq
.
get_kecamatan_op
())
show_val
(
'Jatuh Tempo'
,
inq
.
get_jatuh_tempo
())
show_val
(
'Jatuh Tempo'
,
inq
.
get_jatuh_tempo
())
show_rp
(
'Tagihan'
,
inq
.
tagihan
)
show_rp
(
'Tagihan'
,
inq
.
tagihan
)
show_rp
(
'Denda'
,
inq
.
denda
)
show_rp
(
'Denda'
,
inq
.
denda_pokok
)
show_rp
(
'Discount Denda'
,
inq
.
discount_denda
)
if
inq
.
discount_denda
:
show_val
(
'Alasan Discount Denda'
,
inq
.
alasan_discount
)
show_rp
(
'Total Denda'
,
inq
.
denda
)
show_rp
(
'Total Bayar'
,
inq
.
total_bayar
)
show_rp
(
'Total Bayar'
,
inq
.
total_bayar
)
show_rp
(
'Total Tagihan'
,
inq
.
total
)
show_rp
(
'Total Tagihan'
,
inq
.
total
)
show_field
(
inq
.
invoice
,
'status_pembayaran'
)
show_field
(
inq
.
invoice
,
'status_pembayaran'
)
...
...
opensipkd/pad/services/default/__init__.py
View file @
3544af1
...
@@ -8,6 +8,7 @@ from sqlalchemy import (
...
@@ -8,6 +8,7 @@ from sqlalchemy import (
func
,
func
,
exists
,
exists
,
and_
,
and_
,
not_
,
)
)
from
opensipkd.hitung
import
(
from
opensipkd.hitung
import
(
round_up
,
round_up
,
...
@@ -15,6 +16,7 @@ from opensipkd.hitung import (
...
@@ -15,6 +16,7 @@ from opensipkd.hitung import (
)
)
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.pad.models.default
import
(
from
opensipkd.pad.models.default
import
(
Kecamatan
,
Kecamatan
,
Kelurahan
,
Kelurahan
,
...
@@ -25,6 +27,9 @@ from opensipkd.pad.models.default import (
...
@@ -25,6 +27,9 @@ from opensipkd.pad.models.default import (
Pajak
,
Pajak
,
Rekening
,
Rekening
,
Usaha
,
Usaha
,
SptType
,
Kohir
,
IsoPayment
,
)
)
from
..base
import
get_db_session
from
..base
import
get_db_session
...
@@ -61,6 +66,12 @@ class BaseInquiry:
...
@@ -61,6 +66,12 @@ class BaseInquiry:
def
get_usaha_model
(
self
):
def
get_usaha_model
(
self
):
return
Usaha
return
Usaha
def
get_type_model
(
self
):
return
SptType
def
get_kohir_model
(
self
):
return
Kohir
def
get_customer_usaha_model
(
self
):
def
get_customer_usaha_model
(
self
):
return
CustomerUsaha
return
CustomerUsaha
...
@@ -80,7 +91,7 @@ class BaseInquiry:
...
@@ -80,7 +91,7 @@ class BaseInquiry:
return
self
.
invoice
.
status_pembayaran
==
0
return
self
.
invoice
.
status_pembayaran
==
0
def
get_jatuh_tempo
(
self
):
def
get_jatuh_tempo
(
self
):
return
self
.
invoice
.
jatuhtempotgl
return
self
.
invoice
.
jatuhtempotgl
and
self
.
invoice
.
jatuhtempotgl
.
date
()
def
get_objek_pajak
(
self
):
def
get_objek_pajak
(
self
):
CustomerUsaha
=
self
.
get_customer_usaha_model
()
CustomerUsaha
=
self
.
get_customer_usaha_model
()
...
@@ -131,7 +142,20 @@ class BaseInquiry:
...
@@ -131,7 +142,20 @@ class BaseInquiry:
cust_usaha
=
q
.
first
()
cust_usaha
=
q
.
first
()
q
=
DBSession
.
query
(
Usaha
)
.
filter_by
(
id
=
cust_usaha
.
usaha_id
)
q
=
DBSession
.
query
(
Usaha
)
.
filter_by
(
id
=
cust_usaha
.
usaha_id
)
return
q
.
first
()
return
q
.
first
()
def
get_type
(
self
):
DBSession
=
get_db_session
()
SptType
=
self
.
get_type_model
()
q
=
DBSession
.
query
(
SptType
)
.
filter_by
(
id
=
self
.
invoice
.
type_id
)
return
q
.
first
()
def
get_kohir
(
self
):
DBSession
=
get_db_session
()
Kohir
=
self
.
get_kohir_model
()
q
=
DBSession
.
query
(
Kohir
)
.
filter_by
(
spt_id
=
self
.
invoice
.
id
)
q
=
q
.
order_by
(
Kohir
.
id
.
desc
())
return
q
.
first
()
def
set_profile
(
self
):
def
set_profile
(
self
):
self
.
objek_pajak
=
self
.
get_objek_pajak
()
self
.
objek_pajak
=
self
.
get_objek_pajak
()
self
.
wajib_pajak
=
self
.
get_wajib_pajak
()
self
.
wajib_pajak
=
self
.
get_wajib_pajak
()
...
@@ -194,16 +218,28 @@ class BaseInquiry:
...
@@ -194,16 +218,28 @@ class BaseInquiry:
def
get_nama_rekening
(
self
):
def
get_nama_rekening
(
self
):
return
self
.
rekening
.
rekeningnm
return
self
.
rekening
.
rekeningnm
def
get_masa_1
(
self
):
def
get_masa_1
(
self
,
fmt
=
'
%
d
%
m
%
Y'
):
return
self
.
invoice
.
masadari
.
strftime
(
'
%
d
%
m
%
Y'
)
return
self
.
invoice
.
masadari
.
strftime
(
fmt
)
def
get_masa_2
(
self
):
def
get_masa_2
(
self
,
fmt
=
'
%
d
%
m
%
Y'
):
return
self
.
invoice
.
masasd
.
strftime
(
'
%
d
%
m
%
Y'
)
return
self
.
invoice
.
masasd
.
strftime
(
fmt
)
def
get_nama_jenis_usaha
(
self
):
def
get_nama_jenis_usaha
(
self
):
jenis
=
self
.
get_jenis_usaha
()
jenis
=
self
.
get_jenis_usaha
()
return
jenis
.
usahanm
return
jenis
.
usahanm
def
is_self
(
self
):
jenis
=
self
.
get_jenis_usaha
()
return
jenis
.
so
==
'S'
and
jenis
.
enabled
==
1
def
get_type_name
(
self
):
t
=
self
.
get_type
()
return
t
.
typenm
def
get_tgl_kohir
(
self
):
k
=
self
.
get_kohir
()
return
k
and
k
.
kohirtgl
.
date
()
class
Inquiry
(
BaseInquiry
):
class
Inquiry
(
BaseInquiry
):
def
__init__
(
def
__init__
(
...
@@ -225,27 +261,43 @@ class Inquiry(BaseInquiry):
...
@@ -225,27 +261,43 @@ class Inquiry(BaseInquiry):
pay
=
q
.
first
()
pay
=
q
.
first
()
return
pay
.
jml
or
0
return
pay
.
jml
or
0
def
hitung
(
self
):
def
hitung_tagihan
(
self
):
self
.
bunga
=
self
.
invoice
.
bunga
or
0
self
.
tagihan
=
self
.
invoice
.
dasar
*
self
.
invoice
.
tarif
\
self
.
bunga
=
round_up
(
self
.
bunga
)
+
self
.
invoice
.
denda
+
self
.
invoice
.
kenaikan
\
self
.
tagihan
=
self
.
invoice
.
pajak_terhutang
-
self
.
bunga
-
self
.
invoice
.
kompensasi
+
self
.
invoice
.
lain2
\
-
self
.
invoice
.
setoran
self
.
tagihan
=
round_up
(
self
.
tagihan
)
self
.
tagihan
=
round_up
(
self
.
tagihan
)
self
.
total_bayar
=
self
.
get_payment_amount
()
self
.
total_bayar
=
round_up
(
self
.
total_bayar
)
def
hitung_denda
(
self
):
self
.
total
=
self
.
tagihan
-
self
.
total_bayar
bunga
=
self
.
invoice
.
bunga
or
0
if
self
.
total
<=
0
:
self
.
denda
=
self
.
bunga
=
round_up
(
bunga
)
self
.
tagihan
=
self
.
total
=
self
.
denda
=
0
return
self
.
denda
=
self
.
bunga
if
self
.
invoice
.
jatuhtempotgl
:
if
self
.
invoice
.
jatuhtempotgl
:
self
.
bln_tunggakan
,
self
.
denda_waktu
=
hitung_denda
(
self
.
bln_tunggakan
,
self
.
denda_waktu
=
hitung_denda
(
self
.
tagihan
,
self
.
invoice
.
jatuhtempotgl
,
self
.
persen_denda
,
self
.
tagihan
,
self
.
invoice
.
jatuhtempotgl
,
self
.
persen_denda
,
self
.
tgl_bayar
.
date
())
self
.
tgl_bayar
.
date
())
self
.
denda_waktu
=
round_up
(
self
.
denda_waktu
)
self
.
denda
+=
self
.
denda_waktu
self
.
denda
+=
self
.
denda_waktu
else
:
else
:
self
.
bln_tunggakan
=
None
self
.
bln_tunggakan
=
None
self
.
denda
=
round_up
(
self
.
denda
)
self
.
denda_pokok
=
self
.
denda
self
.
total
+=
self
.
denda
self
.
discount_denda
=
self
.
get_discount_denda
()
self
.
denda
-=
self
.
discount_denda
def
get_discount_denda
(
self
):
self
.
alasan_discount
=
''
return
0
def
hitung_bayar
(
self
):
bayar
=
self
.
get_payment_amount
()
self
.
total_bayar
=
round_up
(
bayar
)
def
hitung
(
self
):
self
.
hitung_tagihan
()
self
.
hitung_denda
()
self
.
hitung_bayar
()
self
.
total
=
self
.
tagihan
+
self
.
denda
-
self
.
total_bayar
if
self
.
total
<
0
:
self
.
total
=
0
def
get_pay_seq
(
self
):
def
get_pay_seq
(
self
):
Payment
=
self
.
get_payment_model
()
Payment
=
self
.
get_payment_model
()
...
@@ -285,8 +337,10 @@ class Inquiry(BaseInquiry):
...
@@ -285,8 +337,10 @@ class Inquiry(BaseInquiry):
class
Reversal
(
BaseInquiry
):
class
Reversal
(
BaseInquiry
):
def
__init__
(
self
,
invoice_id
):
def
__init__
(
self
,
invoice_id
):
BaseInquiry
.
__init__
(
self
,
invoice_id
)
BaseInquiry
.
__init__
(
self
,
invoice_id
)
if
self
.
invoice
:
if
self
.
invoice
and
self
.
invoice
.
status_pembayaran
==
1
:
self
.
payment
=
self
.
get_payment
()
self
.
payment
=
self
.
get_payment
()
else
:
self
.
payment
=
None
def
do_reversal
(
self
):
def
do_reversal
(
self
):
DBSession
=
get_db_session
()
DBSession
=
get_db_session
()
...
@@ -355,6 +409,12 @@ class AvailableInvoice:
...
@@ -355,6 +409,12 @@ class AvailableInvoice:
def
get_customer_usaha_model
(
self
):
def
get_customer_usaha_model
(
self
):
return
CustomerUsaha
return
CustomerUsaha
def
get_kohir_model
(
self
):
return
Kohir
def
get_type_model
(
self
):
return
SptType
def
get_inquiry_class
(
self
):
def
get_inquiry_class
(
self
):
return
Inquiry
return
Inquiry
...
@@ -362,28 +422,52 @@ class AvailableInvoice:
...
@@ -362,28 +422,52 @@ class AvailableInvoice:
Invoice
=
self
.
get_invoice_model
()
Invoice
=
self
.
get_invoice_model
()
Pajak
=
self
.
get_pajak_model
()
Pajak
=
self
.
get_pajak_model
()
Rekening
=
self
.
get_rekening_model
()
Rekening
=
self
.
get_rekening_model
()
Usaha
=
self
.
get_usaha_model
()
CustomerUsaha
=
self
.
get_customer_usaha_model
()
DBSession
=
get_db_session
()
DBSession
=
get_db_session
()
q
=
DBSession
.
query
(
q
=
DBSession
.
query
(
Invoice
.
sptno
,
Invoice
.
tahun
,
Rekening
.
rekeningkd
,
Invoice
.
sptno
,
Invoice
.
tahun
,
Rekening
.
rekeningkd
,
Rekening
.
rekeningnm
)
Rekening
.
rekeningnm
)
q
=
q
.
filter
(
q
=
q
.
filter
(
Invoice
.
pajak_id
==
Pajak
.
id
,
Pajak
.
rekening_id
==
Rekening
.
id
,
Invoice
.
pajak_id
==
Pajak
.
id
,
Pajak
.
rekening_id
==
Rekening
.
id
,
Invoice
.
customer_usaha_id
==
CustomerUsaha
.
id
,
CustomerUsaha
.
usaha_id
==
Usaha
.
id
,
Invoice
.
status_pembayaran
==
0
)
Invoice
.
status_pembayaran
==
0
)
q
=
self
.
get_filter_usaha
(
q
)
q
=
self
.
get_filter_nominal
(
q
)
q
=
self
.
get_filter_jatuh_tempo
(
q
)
q
=
self
.
get_filter_kohir
(
q
)
q
=
self
.
get_filter_type
(
q
)
return
q
def
get_filter_usaha
(
self
,
q
):
if
not
(
self
.
option
.
jenis
or
self
.
option
.
self
or
self
.
option
.
no_self
):
return
q
Invoice
=
self
.
get_invoice_model
()
Usaha
=
self
.
get_usaha_model
()
CustomerUsaha
=
self
.
get_customer_usaha_model
()
q
=
q
.
filter
(
Invoice
.
customer_usaha_id
==
CustomerUsaha
.
id
,
CustomerUsaha
.
usaha_id
==
Usaha
.
id
)
if
self
.
option
.
jenis
:
if
self
.
option
.
jenis
:
pola
=
'
%
{}
%
'
.
format
(
self
.
option
.
jenis
)
pola
=
'
%
{}
%
'
.
format
(
self
.
option
.
jenis
)
q
=
q
.
filter
(
Usaha
.
usahanm
.
ilike
(
pola
))
q
=
q
.
filter
(
Usaha
.
usahanm
.
ilike
(
pola
))
if
self
.
option
.
self
:
q
=
q
.
filter
(
Usaha
.
so
==
'S'
,
Usaha
.
enabled
==
1
)
if
self
.
option
.
no_self
:
q
=
q
.
filter
(
not_
(
and_
(
Usaha
.
so
==
'S'
,
Usaha
.
enabled
==
1
)))
return
q
def
get_filter_nominal
(
self
,
q
):
Invoice
=
self
.
get_invoice_model
()
if
self
.
option
.
nominal_min
:
if
self
.
option
.
nominal_min
:
q
=
q
.
filter
(
q
=
q
.
filter
(
Invoice
.
pajak_terhutang
-
Invoice
.
bunga
>=
Invoice
.
pajak_terhutang
-
Invoice
.
bunga
>=
self
.
option
.
nominal_min
)
self
.
option
.
nominal_min
)
if
self
.
option
.
nominal_max
:
if
self
.
option
.
nominal_max
:
q
=
q
.
filter
(
q
=
q
.
filter
(
Invoice
.
pajak_terhutang
-
Invoice
.
bunga
<=
Invoice
.
pajak_terhutang
-
Invoice
.
bunga
<=
self
.
option
.
nominal_max
)
self
.
option
.
nominal_max
)
return
q
def
get_filter_jatuh_tempo
(
self
,
q
):
Invoice
=
self
.
get_invoice_model
()
if
self
.
option
.
jatuh_tempo_min
:
if
self
.
option
.
jatuh_tempo_min
:
tgl
=
date_from_str
(
self
.
option
.
jatuh_tempo_min
)
tgl
=
date_from_str
(
self
.
option
.
jatuh_tempo_min
)
q
=
q
.
filter
(
Invoice
.
jatuhtempotgl
>=
tgl
)
q
=
q
.
filter
(
Invoice
.
jatuhtempotgl
>=
tgl
)
...
@@ -392,6 +476,29 @@ class AvailableInvoice:
...
@@ -392,6 +476,29 @@ class AvailableInvoice:
q
=
q
.
filter
(
Invoice
.
jatuhtempotgl
<=
tgl
)
q
=
q
.
filter
(
Invoice
.
jatuhtempotgl
<=
tgl
)
return
q
return
q
def
get_filter_kohir
(
self
,
q
):
if
not
(
self
.
option
.
tgl_kohir_min
or
self
.
option
.
tgl_kohir_max
):
return
q
Invoice
=
self
.
get_invoice_model
()
Kohir
=
self
.
get_kohir_model
()
q
=
q
.
filter
(
Kohir
.
spt_id
==
Invoice
.
id
)
if
self
.
option
.
tgl_kohir_min
:
tgl
=
date_from_str
(
self
.
option
.
tgl_kohir_min
)
q
=
q
.
filter
(
Kohir
.
kohirtgl
>=
tgl
)
if
self
.
option
.
tgl_kohir_max
:
tgl
=
date_from_str
(
self
.
option
.
tgl_kohir_max
)
q
=
q
.
filter
(
Kohir
.
kohirtgl
<=
tgl
)
return
q
def
get_filter_type
(
self
,
q
):
if
not
self
.
option
.
tipe
:
return
q
Invoice
=
self
.
get_invoice_model
()
SptType
=
self
.
get_type_model
()
return
q
.
filter
(
Invoice
.
type_id
==
SptType
.
id
,
SptType
.
typenm
.
ilike
(
self
.
option
.
tipe
))
def
get_message
(
self
,
row
):
def
get_message
(
self
,
row
):
invoice_id
=
FixLength
(
INVOICE_ID
)
invoice_id
=
FixLength
(
INVOICE_ID
)
invoice_id
[
'Tahun'
]
=
row
.
tahun
invoice_id
[
'Tahun'
]
=
row
.
tahun
...
@@ -400,10 +507,30 @@ class AvailableInvoice:
...
@@ -400,10 +507,30 @@ class AvailableInvoice:
inq
=
Inquiry
(
invoice_id
.
get_raw
(),
persen_denda
=
self
.
persen_denda
)
inq
=
Inquiry
(
invoice_id
.
get_raw
(),
persen_denda
=
self
.
persen_denda
)
if
not
inq
.
total
:
if
not
inq
.
total
:
return
return
total
=
thousand
(
inq
.
total
)
tagihan
=
thousand
(
inq
.
tagihan
)
denda
=
thousand
(
inq
.
denda
)
s
=
f
'{invoice_id.get_raw()} {inq.get_kode_rekening()}'
\
s
=
f
'{invoice_id.get_raw()} {inq.get_kode_rekening()}'
\
f
' {inq.get_nama_rekening()} Rp {thousand(inq.total)}'
f
' {inq.get_nama_rekening()} Rp {total} ='
\
f
' tagihan Rp {tagihan} + denda Rp {denda}'
jatuh_tempo
=
inq
.
get_jatuh_tempo
()
jatuh_tempo
=
inq
.
get_jatuh_tempo
()
if
not
jatuh_tempo
:
if
jatuh_tempo
:
return
s
jatuh_tempo
=
jatuh_tempo
.
strftime
(
'
%
d-
%
m-
%
Y'
)
jatuh_tempo
=
jatuh_tempo
.
date
()
.
strftime
(
'
%
d-
%
m-
%
Y'
)
s
=
f
'{s} jatuh tempo {jatuh_tempo}'
return
f
'{s} jatuh tempo {jatuh_tempo}'
if
self
.
option
.
tgl_kohir_min
or
self
.
option
.
tgl_kohir_max
:
tgl_kohir
=
inq
.
get_tgl_kohir
()
tgl_kohir
=
tgl_kohir
.
strftime
(
'
%
d-
%
m-
%
Y'
)
s
=
f
'{s} kohir {tgl_kohir}'
return
s
# Nomor Transaksi Pemda
class
NTP
(
TransactionID
):
def
is_found
(
self
,
tid
):
DBSession
=
get_db_session
()
IsoPayment
=
self
.
get_iso_payment_model
()
q
=
DBSession
.
query
(
IsoPayment
)
.
filter_by
(
ntp
=
tid
)
return
q
.
first
()
def
get_iso_payment_model
(
self
):
return
IsoPayment
opensipkd/pad/services/tangsel/__init__.py
View file @
3544af1
from
datetime
import
date
from
opensipkd.pad.services.default
import
(
from
opensipkd.pad.services.default
import
(
Inquiry
as
BaseInquiry
,
Inquiry
as
BaseInquiry
,
Reversal
as
BaseReversal
,
Reversal
as
BaseReversal
,
...
@@ -13,10 +14,48 @@ from opensipkd.pad.models.tangsel import (
...
@@ -13,10 +14,48 @@ from opensipkd.pad.models.tangsel import (
Pajak
,
Pajak
,
Rekening
,
Rekening
,
Usaha
,
Usaha
,
SptType
,
Kohir
,
)
)
SEPT_30
=
date
(
2020
,
9
,
30
)
class
Inquiry
(
BaseInquiry
):
class
Inquiry
(
BaseInquiry
):
def
get_discount_denda
(
self
):
# Override
if
self
.
tgl_bayar
.
year
>
2020
:
return
0
if
self
.
tgl_bayar
.
month
>
12
:
return
0
usaha
=
self
.
get_nama_jenis_usaha
()
is_self
=
self
.
is_self
()
if
is_self
or
usaha
==
'AIR TANAH'
:
masa_dari
=
self
.
invoice
.
masadari
.
date
()
if
masa_dari
>
SEPT_30
:
return
0
masa_sd
=
self
.
invoice
.
masasd
.
date
()
if
masa_sd
>
SEPT_30
:
return
0
if
is_self
:
self
.
alasan_discount
=
'Self'
else
:
self
.
alasan_discount
=
'Usaha AIR TANAH'
self
.
alasan_discount
+=
', masa pajak maksimal 30 Sep 2020'
elif
usaha
==
'REKLAME'
:
tgl_kohir
=
self
.
get_tgl_kohir
()
if
not
tgl_kohir
:
return
0
if
tgl_kohir
>
SEPT_30
:
return
0
self
.
alasan_discount
=
f
'Usaha {usaha}, kohir <= 30 Sep 2020'
else
:
tipe
=
self
.
get_type_name
()
if
tipe
not
in
(
'SKPDKB'
,
'STPD'
):
return
0
self
.
alasan_discount
=
f
'Tipe {tipe}'
return
self
.
denda
def
get_kecamatan_model
(
self
):
# Override
def
get_kecamatan_model
(
self
):
# Override
return
Kecamatan
return
Kecamatan
...
@@ -29,9 +68,15 @@ class Inquiry(BaseInquiry):
...
@@ -29,9 +68,15 @@ class Inquiry(BaseInquiry):
def
get_usaha_model
(
self
):
# Override
def
get_usaha_model
(
self
):
# Override
return
Usaha
return
Usaha
def
get_type_model
(
self
):
# Override
return
SptType
def
get_customer_usaha_model
(
self
):
# Override
def
get_customer_usaha_model
(
self
):
# Override
return
CustomerUsaha
return
CustomerUsaha
def
get_kohir_model
(
self
):
# Override
return
Kohir
def
get_rekening_model
(
self
):
# Override
def
get_rekening_model
(
self
):
# Override
return
Rekening
return
Rekening
...
@@ -69,5 +114,11 @@ class AvailableInvoice(BaseAvailableInvoice):
...
@@ -69,5 +114,11 @@ class AvailableInvoice(BaseAvailableInvoice):
def
get_customer_usaha_model
(
self
):
# Override
def
get_customer_usaha_model
(
self
):
# Override
return
CustomerUsaha
return
CustomerUsaha
def
get_kohir_model
(
self
):
# Override
return
Kohir
def
get_type_model
(
self
):
# Override
return
SptType
def
get_inquiry_class
(
self
):
# Override
def
get_inquiry_class
(
self
):
# Override
return
Inquiry
return
Inquiry
setup.py
View file @
3544af1
...
@@ -11,17 +11,12 @@ line = CHANGES.splitlines()[0]
...
@@ -11,17 +11,12 @@ line = CHANGES.splitlines()[0]
version
=
line
.
split
()[
0
]
version
=
line
.
split
()[
0
]
req_opensipkd_hitung
=
'opensipkd-hitung @ '
\
'git+https://git.opensipkd.com/sugiana/opensipkd-hitung'
,
requires
=
[
requires
=
[
'sqlalchemy'
,
'sqlalchemy'
,
req_opensipkd_hitung
,
'opensipkd-hitung @ '
'git+https://git.opensipkd.com/sugiana/opensipkd-hitung.git'
,
]
]
script_available_inv
=
'pad_available_invoice = '
\
'opensipkd.pad.scripts.available_invoice:main'
script_inq
=
'pad_inquiry = opensipkd.pad.scripts.inquiry:main'
setuptools
.
setup
(
setuptools
.
setup
(
name
=
'opensipkd-pad-models'
,
name
=
'opensipkd-pad-models'
,
...
@@ -40,8 +35,9 @@ setuptools.setup(
...
@@ -40,8 +35,9 @@ setuptools.setup(
],
],
entry_points
=
{
entry_points
=
{
'console_scripts'
:
[
'console_scripts'
:
[
script_available_inv
,
'pad_available_invoice = '
script_inq
,
'opensipkd.pad.scripts.available_invoice:main'
,
'pad_inquiry = opensipkd.pad.scripts.inquiry:main'
,
]
]
},
},
)
)
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