Skip to content
Toggle navigation
Projects
Groups
Snippets
Help
Owo Sugiana
/
opensipkd-webr-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 e4752c24
authored
May 10, 2023
by
Owo Sugiana
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
Konfigurasi rekening tanpa denda
1 parent
21d4f347
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
27 additions
and
8 deletions
CHANGES.txt
opensipkd/webr/scripts/available_invoice.py
opensipkd/webr/scripts/inquiry.py
opensipkd/webr/services/default.py
setup.py
CHANGES.txt
View file @
e4752c2
0.3 2023-05-10
--------------
- Tambah input parameter conf pada Inquiry untuk rekening tanpa denda
0.2.3 2023-04-11
----------------
- Bug fixed saat reversal field bunga belum di-nol-kan
...
...
opensipkd/webr/scripts/available_invoice.py
View file @
e4752c2
...
...
@@ -18,6 +18,7 @@ def get_option(argv):
pars
.
add_argument
(
'--nominal-min'
,
type
=
int
)
pars
.
add_argument
(
'--nominal-max'
,
type
=
int
)
pars
.
add_argument
(
'--berbunga'
,
action
=
'store_true'
)
pars
.
add_argument
(
'--rekening'
)
pars
.
add_argument
(
'--count'
,
type
=
int
,
default
=
default_count
,
help
=
help_count
)
return
pars
.
parse_args
(
argv
)
...
...
opensipkd/webr/scripts/inquiry.py
View file @
e4752c2
...
...
@@ -106,16 +106,16 @@ def main(argv=sys.argv[1:]):
invoice_id
=
option
.
invoice_id
tgl_bayar
=
date_from_str
(
option
.
tgl_bayar
)
conf
=
get_conf
(
option
.
conf
)
module_name
=
conf
.
get
(
'main'
,
'module'
)
db_url
=
conf
.
get
(
'main'
,
'db_url'
)
engine
=
create_engine
(
db_url
)
module
=
__import__
(
'opensipkd.webr.services.'
+
module_name
)
services
=
getattr
(
module
.
webr
.
services
,
module_name
)
cf
=
dict
(
conf
.
items
(
'main'
))
cf
[
'persen_denda'
]
=
float
(
cf
[
'persen_denda'
])
cf
[
'rekening_tanpa_denda'
]
=
cf
.
get
(
'rekening_tanpa_denda'
,
''
)
.
split
()
engine
=
create_engine
(
cf
[
'db_url'
])
module
=
__import__
(
'opensipkd.webr.services.'
+
cf
[
'module'
])
services
=
getattr
(
module
.
webr
.
services
,
cf
[
'module'
])
session_factory
=
sessionmaker
(
bind
=
engine
)
module
.
webr
.
services
.
base
.
DBSession
=
db_session
=
session_factory
()
register
(
module
.
webr
.
services
.
base
.
DBSession
)
inq
=
services
.
Inquiry
(
invoice_id
,
conf
.
getfloat
(
'main'
,
'persen_denda'
),
tgl_bayar
)
inq
=
services
.
Inquiry
(
invoice_id
,
cf
[
'persen_denda'
],
tgl_bayar
,
conf
=
cf
)
if
not
inq
.
invoice
:
error
(
f
'Invoice ID {invoice_id} tidak ada.'
)
show
(
inq
)
...
...
opensipkd/webr/services/default.py
View file @
e4752c2
...
...
@@ -37,10 +37,12 @@ class Inquiry:
payment_model
=
Payment
ntp_cls
=
NTP
def
__init__
(
self
,
invoice_id
,
persen_denda
=
2
,
tgl_bayar
=
None
):
def
__init__
(
self
,
invoice_id
,
persen_denda
=
2
,
tgl_bayar
=
None
,
conf
=
dict
()):
self
.
invoice_id
=
invoice_id
self
.
persen_denda
=
persen_denda
self
.
tgl_bayar
=
tgl_bayar
or
date
.
today
()
self
.
conf
=
conf
DBSession
=
get_db_session
()
q
=
DBSession
.
query
(
self
.
invoice_model
)
.
filter_by
(
kode
=
invoice_id
)
self
.
invoice
=
q
.
first
()
...
...
@@ -81,6 +83,9 @@ class Inquiry:
bln
,
denda_waktu
=
hitung_denda
(
self
.
tagihan
,
self
.
invoice
.
jatuh_tempo
,
self
.
persen_denda
,
self
.
tgl_bayar
)
rek_tanpa_denda
=
self
.
conf
.
get
(
'rekening_tanpa_denda'
,
[])
if
self
.
invoice
.
rekening_kode
in
rek_tanpa_denda
:
denda_waktu
=
0
self
.
denda
=
denda_waktu
+
bunga
self
.
denda
=
round_up
(
self
.
denda
)
self
.
total
=
self
.
tagihan
+
self
.
denda
...
...
@@ -224,6 +229,7 @@ class AvailableInvoice:
q
=
self
.
get_filter_nominal
(
q
)
q
=
self
.
get_filter_jatuh_tempo
(
q
)
q
=
self
.
get_filter_berbunga
(
q
)
q
=
self
.
get_filter_rekening
(
q
)
return
q
def
get_filter_tahun
(
self
,
q
):
...
...
@@ -256,6 +262,12 @@ class AvailableInvoice:
q
=
q
.
filter
(
self
.
invoice_model
.
bunga
>
0
)
return
q
def
get_filter_rekening
(
self
,
q
):
if
self
.
option
.
rekening
:
q
=
q
.
filter
(
self
.
invoice_model
.
rekening_kode
==
self
.
option
.
rekening
)
return
q
def
get_message
(
self
,
row
):
inq
=
Inquiry
(
row
.
kode
,
persen_denda
=
self
.
persen_denda
)
if
not
inq
.
total
:
...
...
setup.py
View file @
e4752c2
...
...
@@ -12,6 +12,8 @@ version = line.split()[0]
requires
=
[
'sqlalchemy'
,
'opensipkd-hitung @ '
'git+https://git.opensipkd.com/sugiana/opensipkd-hitung.git'
,
'opensipkd-base @ '
'git+https://git.opensipkd.com/sugiana/opensipkd-base.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