Skip to content
Toggle navigation
Projects
Groups
Snippets
Help
Project
/
import-sipkd-eis
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 a48fb822
authored
Aug 25, 2017
by
aa.gusti
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
pkb
1 parent
8aa43811
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
111 additions
and
38 deletions
conf.py
import-pap.py
conf.py
View file @
a48fb82
...
...
@@ -8,9 +8,8 @@ quoted = quote_plus(url)
sipkd_url
=
'mssql+pyodbc:///?odbc_connect={}'
.
format
(
quoted
)
sipkd_url_master
=
sipkd_url
#pyodbc:///?odbc_connect=DRIVER%%3D%%7BFreeTDS%%7D%%3BServer%%3D192.168.56.1%%3BDatabase%%3DV%%40LID49V6_2015%%3BUID%%3Dsa%%3BPWD%%3Da%%3BPort%%3D1433%%3BTDS_Version%%3D8.0"
eis_url
=
"postgresql://
eis:31sb4p3nd4@192.168.99.25/ei
s"
eis_url
=
"postgresql://
aagusti:a@192.168.56.1/o
s"
webr_url
=
"postgresql://web-r:bandung@localhost/web_r"
pap_url
=
"informix://samsatjb:samsatjb@dbdapja"
webr_url
=
"postgresql://aagusti:a@192.168.56.1/webr"
pap_url
=
"informix://user:pass@db"
\ No newline at end of file
import-pap.py
View file @
a48fb82
...
...
@@ -11,10 +11,10 @@
#vsts yesterday
#tg_pros_bayar
#pkb
#
bbnkb1
#bbnkb
2
#
den_paja
k
#pkb
_pok
#
pkb_den
#bbnkb
1_pok
#
bbnkb2_po
k
#jumlah
from
models_eis
import
(
ArPayment
as
EisArPayment
,
...
...
@@ -46,6 +46,15 @@ now = datetime.now()
tanggal
=
now
.
date
()
tahun
=
now
.
strftime
(
'
%
Y'
)
dep_kode
=
'3.03.02.'
dep_nama
=
'BADAN PENDAPATAN DAERAH'
rek_kode
=
'4.1.1.06.01.'
rek_nama
=
'PAJAK AIR PERMUKAAN'
denda_kode
=
'4.1.4.07.03.'
denda_nama
=
'DENDA PAJAK AIR PERMUKAAN'
def
calculate
(
tabel
,
all
=
None
,
kode
=
None
):
query
=
EisDBSession
.
query
(
tabel
)
.
filter_by
(
tahun
=
str
(
tahun
))
.
\
order_by
(
tabel
.
departemen_kd
,
tabel
.
tanggal
,
tabel
.
kode
.
desc
())
...
...
@@ -117,7 +126,7 @@ def validate_parent(tabel, departemen_kd, departemen_nm, rekening, tanggal):
EisDBSession
.
add
(
induk
)
EisDBSession
.
flush
()
def
insert_data
(
row
,
kode
,
nama
,
dep_kode
,
dep_nama
):
def
insert_data
(
row
,
kode
,
nama
):
# TODO
eis
=
EisDBSession
.
query
(
EisArPayment
)
.
\
filter_by
(
tahun
=
str
(
tahun
),
...
...
@@ -139,6 +148,31 @@ def insert_data(row, kode, nama, dep_kode, dep_nama):
EisDBSession
.
flush
()
validate_parent
(
EisArPayment
,
eis
.
departemen_kd
,
eis
.
departemen_nm
,
eis
.
kode
,
eis
.
tanggal
)
def
insert_denda
(
row
,
kode
,
nama
):
eis
=
EisDBSession
.
query
(
EisArPayment
)
.
\
filter_by
(
tahun
=
str
(
tahun
),
kode
=
kode
,
departemen_kd
=
dep_kode
,
tanggal
=
row
[
'tanggal'
],
)
.
first
()
if
not
eis
:
eis
=
EisArPayment
()
eis
.
tahun
=
str
(
tahun
)
eis
.
kode
=
kode
eis
.
departemen_kd
=
dep_kode
eis
.
tanggal
=
row
[
'tanggal'
]
eis
.
level_id
=
rek_kode
.
count
(
'.'
)
eis
.
nama
=
nama
eis
.
departemen_nm
=
dep_nama
eis
.
jumlah
=
row
[
'pokok'
]
EisDBSession
.
add
(
eis
)
EisDBSession
.
flush
()
validate_parent
(
EisArPayment
,
eis
.
departemen_kd
,
eis
.
departemen_nm
,
eis
.
kode
,
eis
.
tanggal
)
if
row
[
'denda'
]:
print
(
row
)
insert_data
(
row
,
denda_kode
,
denda_nama
)
def
import_pap
(
all
=
False
):
sql
=
"SELECT tg_pros_bayar as tanggal, pap as pokok, den_pajak as denda FROM v_rtimepap "
\
"WHERE year(tg_pros_bayar) = '{tahun}' {where} "
\
...
...
@@ -152,40 +186,80 @@ def import_pap(all=False):
format
(
tanggal
=
tanggal
.
strftime
(
'
%
d-
%
m-
%
Y'
)),)
print
(
sql
)
rows
=
engine
.
fetchall
(
sql
)
rek_kode
=
'4.1.1.06.01.'
rek_nama
=
'PAJAK AIR PERMUKAAN'
denda_kode
=
'4.1.4.07.03.'
denda_nama
=
'DENDA PAJAK AIR PERMUKAAN'
dep_kode
=
'3.03.02.'
dep_nama
=
'BADAN PENDAPATAN DAERAH'
for
row
in
rows
:
#print(row)
eis
=
EisDBSession
.
query
(
EisArPayment
)
.
\
filter_by
(
tahun
=
str
(
tahun
),
kode
=
rek_kode
,
departemen_kd
=
dep_kode
,
tanggal
=
row
[
'tanggal'
],
)
.
first
()
if
not
eis
:
eis
=
EisArPayment
()
eis
.
tahun
=
str
(
tahun
)
eis
.
kode
=
rek_kode
eis
.
departemen_kd
=
dep_kode
eis
.
tanggal
=
row
[
'tanggal'
]
eis
.
level_id
=
rek_kode
.
count
(
'.'
)
eis
.
nama
=
rek_nama
eis
.
departemen_nm
=
dep_nama
eis
.
jumlah
=
row
[
'pokok'
]
EisDBSession
.
add
(
eis
)
EisDBSession
.
flush
()
validate_parent
(
EisArPayment
,
eis
.
departemen_kd
,
eis
.
departemen_nm
,
eis
.
kode
,
eis
.
tanggal
)
if
row
[
'denda'
]:
print
(
row
)
insert_data
(
row
,
denda_kode
,
denda_nama
,
dep_kode
,
dep_nama
)
insert_data
(
row
,
rek_kode
,
rek_nama
)
EisDBSession
.
commit
()
import_pap
(
True
)
def
import_pkb
(
all
=
False
):
print
(
'IMPORT PKB'
)
rek_kode
=
'4.1.1.01.01.'
rek_nama
=
'PAJAK KENDARAAN BERMOTOR'
denda_kode
=
'4.1.4.07.01.'
denda_nama
=
'PENDAPATAN DENDA KENDARAAN BERMOTOR'
if
all
:
sql
=
"SELECT tg_pros_bayar as tanggal, (bbn1_pok+bbn2_pok) as bbn_pok, "
\
"(bbn1_den+bbn2_den) as bbn_den, pkb_pok as pokok, pkb_den as denda"
\
"FROM vsts "
\
"WHERE year(tg_pros_bayar) = '{tahun}' {where} "
\
"ORDER BY tg_pros_bayar"
sql
=
sql
.
format
(
tahun
=
tahun
,
where
=
''
)
rows
=
engine
.
fetchall
(
sql
)
for
row
in
rows
:
insert_data
(
row
,
rek_kode
,
rek_nama
)
sql
=
"SELECT tg_pros_bayar as tanggal, (bbn1_pok+bbn2_pok) as bbn_pok, "
\
"(bbn1_den+bbn2_den) as bbn_den, pkb_pok as pokok, pkb_den as denda"
\
"FROM v_rtime "
\
"WHERE year(tg_pros_bayar) = '{tahun}' {where} "
\
"ORDER BY tg_pros_bayar"
sql
=
sql
.
format
(
tahun
=
tahun
,
where
=
''
)
sql
=
sql
.
format
(
tahun
=
tahun
,
where
=
" AND tg_pros_bayar = '{tanggal}'"
.
\
format
(
tanggal
=
tanggal
.
strftime
(
'
%
d-
%
m-
%
Y'
)),)
rows
=
engine
.
fetchall
(
sql
)
for
row
in
rows
:
insert_data
(
row
,
rek_kode
,
rek_nama
)
EisDBSession
.
commit
()
print
(
'IMPORT BBN'
)
rek_kode
=
'4.1.1.03.01.'
rek_nama
=
'POKOK BEA BALIK NAMA KENDARAAN BERMOTOR'
denda_kode
=
'4.1.4.07.02.'
denda_nama
=
'PENDAPATAN DENDA BBN-KB'
if
all
:
sql
=
"SELECT tg_pros_bayar as tanggal, (bbn1_pok+bbn2_pok) as pokok, "
\
"(bbn1_den+bbn2_den) as denda, pkb_pok as pkb_pok, pkb_den as pkb_den"
\
"FROM vsts "
\
"WHERE year(tg_pros_bayar) = '{tahun}' {where} "
\
"ORDER BY tg_pros_bayar"
sql
=
sql
.
format
(
tahun
=
tahun
,
where
=
''
)
rows
=
engine
.
fetchall
(
sql
)
for
row
in
rows
:
insert_data
(
row
,
rek_kode
,
rek_nama
)
sql
=
"SELECT tg_pros_bayar as tanggal, (bbn1_pok+bbn2_pok) as pokok, "
\
"(bbn1_den+bbn2_den) as denda, pkb_pok as pkb_pok, pkb_den as pkb_den"
\
"FROM v_rtime "
\
"WHERE year(tg_pros_bayar) = '{tahun}' {where} "
\
"ORDER BY tg_pros_bayar"
sql
=
sql
.
format
(
tahun
=
tahun
,
where
=
''
)
sql
=
sql
.
format
(
tahun
=
tahun
,
where
=
" AND tg_pros_bayar = '{tanggal}'"
.
\
format
(
tanggal
=
tanggal
.
strftime
(
'
%
d-
%
m-
%
Y'
)),)
rows
=
engine
.
fetchall
(
sql
)
for
row
in
rows
:
insert_data
(
row
,
rek_kode
,
rek_nama
)
EisDBSession
.
commit
()
print
(
'IMPORT PAP'
)
#import_pap(True)
import_pkb
(
True
)
calculate
(
EisArPayment
,
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