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 1d8a4a1b
authored
Sep 04, 2020
by
Owo Sugiana
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
inquiry.py tambah opsi --tgl-bayar
1 parent
3f15b2e0
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
48 additions
and
8 deletions
CHANGES.txt
opensipkd/pad/scripts/available_invoice.py
opensipkd/pad/scripts/inquiry.py
opensipkd/pad/services/default/__init__.py
CHANGES.txt
View file @
1d8a4a1
0.2.3 2020-09-04
----------------
- inquiry.py tambah opsi --tgl-bayar
- available_invoice.py tambah opsi --jatuh-tempo-min dan --jatuh-tempo-max
0.2.2 2020-08-25
0.2.2 2020-08-25
----------------
----------------
- Tambah get_jenis_usaha()
- Tambah get_jenis_usaha()
...
...
opensipkd/pad/scripts/available_invoice.py
View file @
1d8a4a1
...
@@ -15,8 +15,8 @@ def get_option(argv):
...
@@ -15,8 +15,8 @@ def get_option(argv):
pars
.
add_argument
(
'conf'
)
pars
.
add_argument
(
'conf'
)
pars
.
add_argument
(
'--jenis'
,
help
=
help_jenis
)
pars
.
add_argument
(
'--jenis'
,
help
=
help_jenis
)
pars
.
add_argument
(
'--tahun'
,
type
=
int
)
pars
.
add_argument
(
'--tahun'
,
type
=
int
)
pars
.
add_argument
(
'--
belum-jatuh-tempo'
,
action
=
'store_true
'
)
pars
.
add_argument
(
'--
jatuh-tempo-min
'
)
pars
.
add_argument
(
'--
lewat-jatuh-tempo'
,
action
=
'store_true
'
)
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
(
pars
.
add_argument
(
...
...
opensipkd/pad/scripts/inquiry.py
View file @
1d8a4a1
...
@@ -41,6 +41,7 @@ def get_option(argv):
...
@@ -41,6 +41,7 @@ def get_option(argv):
pars
.
add_argument
(
'--invoice-id'
)
pars
.
add_argument
(
'--invoice-id'
)
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'
)
pars
.
add_argument
(
'--tgl-bayar'
)
return
pars
.
parse_args
(
argv
)
return
pars
.
parse_args
(
argv
)
...
@@ -59,6 +60,7 @@ def show(inq):
...
@@ -59,6 +60,7 @@ def show(inq):
show_val
(
'Alamat Objek Pajak'
,
inq
.
get_alamat_op
())
show_val
(
'Alamat Objek Pajak'
,
inq
.
get_alamat_op
())
show_val
(
'Kelurahan Objek Pajak'
,
inq
.
get_kelurahan_op
())
show_val
(
'Kelurahan Objek Pajak'
,
inq
.
get_kelurahan_op
())
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_rp
(
'Tagihan'
,
inq
.
tagihan
)
show_rp
(
'Tagihan'
,
inq
.
tagihan
)
show_rp
(
'Denda'
,
inq
.
denda
)
show_rp
(
'Denda'
,
inq
.
denda
)
show_rp
(
'Total Bayar'
,
inq
.
total_bayar
)
show_rp
(
'Total Bayar'
,
inq
.
total_bayar
)
...
@@ -84,10 +86,19 @@ def error(s):
...
@@ -84,10 +86,19 @@ def error(s):
sys
.
exit
()
sys
.
exit
()
def
date_from_str
(
s
):
d
,
m
,
y
=
s
.
split
(
'-'
)
return
datetime
(
int
(
y
),
int
(
m
),
int
(
d
))
def
main
(
argv
=
sys
.
argv
):
def
main
(
argv
=
sys
.
argv
):
option
=
get_option
(
argv
[
1
:])
option
=
get_option
(
argv
[
1
:])
conf_file
=
option
.
conf
conf_file
=
option
.
conf
invoice_id
=
option
.
invoice_id
invoice_id
=
option
.
invoice_id
if
option
.
tgl_bayar
:
tgl_bayar
=
date_from_str
(
option
.
tgl_bayar
)
else
:
tgl_bayar
=
None
conf
=
ConfigParser
()
conf
=
ConfigParser
()
conf
.
read
(
conf_file
)
conf
.
read
(
conf_file
)
module_name
=
conf
.
get
(
'main'
,
'module'
)
module_name
=
conf
.
get
(
'main'
,
'module'
)
...
@@ -100,7 +111,8 @@ def main(argv=sys.argv):
...
@@ -100,7 +111,8 @@ def main(argv=sys.argv):
module
.
pad
.
services
.
base
.
DBSession
=
session_factory
()
module
.
pad
.
services
.
base
.
DBSession
=
session_factory
()
register
(
module
.
pad
.
services
.
base
.
DBSession
)
register
(
module
.
pad
.
services
.
base
.
DBSession
)
inq
=
services
.
Inquiry
(
inq
=
services
.
Inquiry
(
invoice_id
,
rekening_notes
,
conf
.
getfloat
(
'main'
,
'persen_denda'
))
invoice_id
,
rekening_notes
,
conf
.
getfloat
(
'main'
,
'persen_denda'
),
tgl_bayar
=
tgl_bayar
)
if
not
inq
.
invoice
:
if
not
inq
.
invoice
:
error
(
'Invoice ID {} tidak ada.'
.
format
(
invoice_id
))
error
(
'Invoice ID {} tidak ada.'
.
format
(
invoice_id
))
show
(
inq
)
show
(
inq
)
...
...
opensipkd/pad/services/default/__init__.py
View file @
1d8a4a1
from
time
import
time
from
time
import
time
from
textwrap
import
wrap
from
textwrap
import
wrap
from
datetime
import
datetime
from
datetime
import
(
datetime
,
date
,
)
from
sqlalchemy
import
(
from
sqlalchemy
import
(
func
,
func
,
exists
,
exists
,
...
@@ -76,6 +79,9 @@ class BaseInquiry:
...
@@ -76,6 +79,9 @@ class BaseInquiry:
def
is_available
(
self
):
def
is_available
(
self
):
return
self
.
invoice
.
status_pembayaran
==
0
return
self
.
invoice
.
status_pembayaran
==
0
def
get_jatuh_tempo
(
self
):
return
self
.
invoice
.
jatuhtempotgl
def
get_objek_pajak
(
self
):
def
get_objek_pajak
(
self
):
CustomerUsaha
=
self
.
get_customer_usaha_model
()
CustomerUsaha
=
self
.
get_customer_usaha_model
()
DBSession
=
get_db_session
()
DBSession
=
get_db_session
()
...
@@ -232,10 +238,12 @@ class Inquiry(BaseInquiry):
...
@@ -232,10 +238,12 @@ class Inquiry(BaseInquiry):
return
return
self
.
denda
=
self
.
bunga
self
.
denda
=
self
.
bunga
if
self
.
invoice
.
jatuhtempotgl
:
if
self
.
invoice
.
jatuhtempotgl
:
bul
an
,
self
.
denda_waktu
=
hitung_denda
(
self
.
bln_tunggak
an
,
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
+=
self
.
denda_waktu
self
.
denda
+=
self
.
denda_waktu
else
:
self
.
bln_tunggakan
=
None
self
.
denda
=
round_up
(
self
.
denda
)
self
.
denda
=
round_up
(
self
.
denda
)
self
.
total
+=
self
.
denda
self
.
total
+=
self
.
denda
...
@@ -299,6 +307,11 @@ class Reversal(BaseInquiry):
...
@@ -299,6 +307,11 @@ class Reversal(BaseInquiry):
return
q
.
first
()
return
q
.
first
()
def
date_from_str
(
s
):
d
,
m
,
y
=
[
int
(
x
)
for
x
in
s
.
split
(
'-'
)]
return
date
(
y
,
m
,
d
)
class
AvailableInvoice
:
class
AvailableInvoice
:
def
__init__
(
self
,
persen_denda
=
2
,
option
=
None
):
def
__init__
(
self
,
persen_denda
=
2
,
option
=
None
):
self
.
option
=
option
self
.
option
=
option
...
@@ -371,6 +384,12 @@ class AvailableInvoice:
...
@@ -371,6 +384,12 @@ class AvailableInvoice:
q
=
q
.
filter
(
q
=
q
.
filter
(
Invoice
.
pajak_terhutang
-
Invoice
.
bunga
<=
Invoice
.
pajak_terhutang
-
Invoice
.
bunga
<=
self
.
option
.
nominal_max
)
self
.
option
.
nominal_max
)
if
self
.
option
.
jatuh_tempo_min
:
tgl
=
date_from_str
(
self
.
option
.
jatuh_tempo_min
)
q
=
q
.
filter
(
Invoice
.
jatuhtempotgl
>=
tgl
)
if
self
.
option
.
jatuh_tempo_max
:
tgl
=
date_from_str
(
self
.
option
.
jatuh_tempo_max
)
q
=
q
.
filter
(
Invoice
.
jatuhtempotgl
<=
tgl
)
return
q
return
q
def
get_message
(
self
,
row
):
def
get_message
(
self
,
row
):
...
@@ -381,6 +400,10 @@ class AvailableInvoice:
...
@@ -381,6 +400,10 @@ 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
return
'{} {} {} Rp {}'
.
format
(
s
=
f
'{invoice_id.get_raw()} {inq.get_kode_rekening()}'
\
invoice_id
.
get_raw
(),
row
.
rekeningkd
,
row
.
rekeningnm
,
f
' {inq.get_nama_rekening()} Rp {thousand(inq.total)}'
thousand
(
inq
.
total
))
jatuh_tempo
=
inq
.
get_jatuh_tempo
()
if
not
jatuh_tempo
:
return
s
jatuh_tempo
=
jatuh_tempo
.
date
()
.
strftime
(
'
%
d-
%
m-
%
Y'
)
return
f
'{s} jatuh tempo {jatuh_tempo}'
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