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 4dbce716
authored
Dec 19, 2022
by
Owo Sugiana
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
Tambah Cimahi
1 parent
37913b94
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
166 additions
and
1 deletions
CHANGES.txt
opensipkd/pad/scripts/common.py
opensipkd/pad/scripts/inquiry.py
opensipkd/pad/scripts/logger.py
opensipkd/pad/services/cimahi.py
CHANGES.txt
View file @
4dbce71
0.4.7 2022-12-19
----------------
- Tambah Cimahi
0.4.6 2022-12-13
0.4.6 2022-12-13
----------------
----------------
- Tangerang Selatan mewajibkan keberadaan Kohir saat inquiry. Kalau tidak ada
- Tangerang Selatan mewajibkan keberadaan Kohir saat inquiry. Kalau tidak ada
...
...
opensipkd/pad/scripts/common.py
View file @
4dbce71
...
@@ -2,9 +2,11 @@ from configparser import ConfigParser
...
@@ -2,9 +2,11 @@ from configparser import ConfigParser
from
sqlalchemy
import
create_engine
from
sqlalchemy
import
create_engine
from
sqlalchemy.orm
import
sessionmaker
from
sqlalchemy.orm
import
sessionmaker
from
zope.sqlalchemy
import
register
from
zope.sqlalchemy
import
register
from
.logger
import
setup_logging
def
init
(
option
):
def
init
(
option
):
setup_logging
(
option
.
conf
)
conf
=
ConfigParser
()
conf
=
ConfigParser
()
conf
.
read
(
option
.
conf
)
conf
.
read
(
option
.
conf
)
cf
=
dict
(
rekening_notes
=
[])
cf
=
dict
(
rekening_notes
=
[])
...
...
opensipkd/pad/scripts/inquiry.py
View file @
4dbce71
...
@@ -21,6 +21,8 @@ def show_rp(label, value):
...
@@ -21,6 +21,8 @@ def show_rp(label, value):
def
show_field
(
t
,
fieldname
):
def
show_field
(
t
,
fieldname
):
if
isinstance
(
t
,
dict
):
return
label
=
f
'Field {t.__tablename__}.{fieldname}'
label
=
f
'Field {t.__tablename__}.{fieldname}'
try
:
try
:
value
=
getattr
(
t
,
fieldname
)
value
=
getattr
(
t
,
fieldname
)
...
@@ -43,7 +45,11 @@ def get_option(argv):
...
@@ -43,7 +45,11 @@ def get_option(argv):
def
show
(
inq
):
def
show
(
inq
):
show_val
(
'Invoice ID'
,
inq
.
invoice_id
.
get_raw
())
if
isinstance
(
inq
.
invoice_id
,
str
):
invoice_id
=
inq
.
invoice_id
else
:
invoice_id
=
inq
.
invoice_id
.
get_raw
()
show_val
(
'Invoice ID'
,
invoice_id
)
show_val
(
'Tahun Pajak'
,
inq
.
get_tahun
())
show_val
(
'Tahun Pajak'
,
inq
.
get_tahun
())
show_val
(
'Masa 1'
,
inq
.
get_masa_1
())
show_val
(
'Masa 1'
,
inq
.
get_masa_1
())
show_val
(
'Masa 2'
,
inq
.
get_masa_2
())
show_val
(
'Masa 2'
,
inq
.
get_masa_2
())
...
...
opensipkd/pad/scripts/logger.py
0 → 100644
View file @
4dbce71
from
configparser
import
RawConfigParser
import
logging
import
logging.config
def
setup_logging
(
conf_file
):
conf
=
RawConfigParser
()
conf
.
read
(
conf_file
)
d
=
{
'version'
:
1
,
'formatters'
:
{},
'handlers'
:
{},
'loggers'
:
{},
}
for
section
in
conf
.
sections
():
if
section
.
find
(
'formatter_'
)
==
0
:
name
=
section
.
split
(
'formatter_'
)[
1
]
data
=
{
'format'
:
conf
.
get
(
section
,
'format'
)}
d
[
'formatters'
][
name
]
=
data
elif
section
.
find
(
'handler_'
)
==
0
:
name
=
section
.
split
(
'handler_'
)[
1
]
data
=
{
'formatter'
:
conf
.
get
(
section
,
'formatter'
)}
data
[
'class'
]
=
'logging.'
+
conf
.
get
(
section
,
'class'
)
if
conf
.
has_option
(
section
,
'stream'
):
data
[
'stream'
]
=
'ext://'
+
conf
.
get
(
section
,
'stream'
)
else
:
data
[
'filename'
]
=
conf
.
get
(
section
,
'filename'
)
d
[
'handlers'
][
name
]
=
data
elif
section
.
find
(
'logger_'
)
==
0
:
name
=
section
.
split
(
'logger_'
)[
1
]
if
name
==
'root'
:
name
=
''
data
=
{
'level'
:
conf
.
get
(
section
,
'level'
)}
value
=
conf
.
get
(
section
,
'handlers'
)
data
[
'handlers'
]
=
[
x
.
strip
()
for
x
in
value
.
split
(
','
)]
d
[
'loggers'
][
name
]
=
data
logging
.
config
.
dictConfig
(
d
)
opensipkd/pad/services/cimahi.py
0 → 100644
View file @
4dbce71
from
logging
import
getLogger
from
opensipkd.hitung
import
round_up
from
.base
import
get_db_session
MSSQL_PROC_NAME
=
'SP_NTB'
TPL_SQL_TRANSACTION
=
"""DECLARE @out varchar(50);
EXEC [dbo].[{proc_name}] {params}, @out OUT;
SELECT @out AS hasil;
{commit}"""
def
list2str
(
d
):
r
=
[]
for
v
in
d
:
s
=
f
"'{v}'"
r
.
append
(
s
)
return
','
.
join
(
r
)
class
Inquiry
:
def
__init__
(
self
,
invoice_id
,
conf
,
tgl_bayar
=
None
):
self
.
invoice_id
=
invoice_id
self
.
conf
=
conf
self
.
invoice
=
self
.
transaction
(
invoice_id
)
if
self
.
invoice
[
'hasil'
]
==
'0'
:
self
.
invoice
=
None
else
:
self
.
tagihan
=
self
.
total
=
self
.
invoice
[
'Tagihan'
]
self
.
denda
=
self
.
invoice
[
'Denda'
]
self
.
total_bayar
=
self
.
discount_denda
=
0
self
.
bln_tunggakan
=
None
self
.
notes
=
None
def
transaction
(
self
,
number
,
method
=
'1'
,
need_commit
=
False
):
log
=
getLogger
(
'MS-SQL'
)
db_session
=
get_db_session
()
params
=
list2str
([
method
,
self
.
conf
[
'bank_id'
],
number
])
log
.
info
(
f
'execute {MSSQL_PROC_NAME} {params}'
)
commit
=
need_commit
and
'COMMIT;'
or
''
sql
=
TPL_SQL_TRANSACTION
.
format
(
proc_name
=
MSSQL_PROC_NAME
,
params
=
params
,
commit
=
commit
)
log
.
debug
(
sql
)
q
=
db_session
.
execute
(
sql
)
inv
=
q
.
fetchone
()
r
=
dict
(
inv
)
log
.
info
(
f
'result {r}'
)
return
r
def
get_tahun
(
self
):
return
self
.
invoice
[
'MasaAwal'
]
.
strftime
(
'
%
Y'
)
def
get_npwp
(
self
):
return
self
.
invoice
[
'NPWPD'
]
def
get_nama
(
self
):
return
self
.
invoice
[
'NamaWP'
]
def
get_alamat_wp
(
self
):
pass
def
get_kode_pos_wp
(
self
):
pass
def
get_alamat_1
(
self
):
return
self
.
invoice
[
'Alamat1'
]
def
get_alamat_2
(
self
):
return
self
.
invoice
[
'Alamat2'
]
def
get_alamat_op
(
self
):
return
', '
.
join
([
self
.
invoice
[
'Alamat1'
],
self
.
invoice
[
'Alamat2'
]])
def
get_kelurahan_op
(
self
):
pass
def
get_kecamatan_op
(
self
):
pass
def
get_kode_rekening
(
self
):
return
self
.
invoice
[
'KodeRekening'
]
.
replace
(
'.'
,
''
)
def
get_nama_rekening
(
self
):
return
self
.
invoice
[
'Pajak'
]
def
get_masa_1
(
self
):
return
self
.
invoice
[
'MasaAwal'
]
.
strftime
(
'
%
Y
%
m
%
d'
)
def
get_masa_2
(
self
):
return
self
.
invoice
[
'MasaAkhir'
]
.
strftime
(
'
%
Y
%
m
%
d'
)
def
get_nama_jenis_usaha
(
self
):
pass
def
is_self
(
self
):
pass
def
get_type_name
(
self
):
pass
def
get_tgl_kohir
(
self
):
pass
def
get_jatuh_tempo
(
self
):
pass
def
do_payment
(
self
,
ntb
=
None
):
return
self
.
transaction
(
self
.
invoice_id
,
'2'
,
True
)
class
Reversal
:
def
__init__
(
self
,
ntp
):
self
.
ntp
=
ntp
def
do_reversal
(
self
):
return
self
.
transaction
(
self
.
ntp
,
'3'
,
True
)
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