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
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
110 additions
and
37 deletions
conf.py
import-pap.py
conf.py
View file @
a48fb82
...
@@ -8,9 +8,8 @@ quoted = quote_plus(url)
...
@@ -8,9 +8,8 @@ quoted = quote_plus(url)
sipkd_url
=
'mssql+pyodbc:///?odbc_connect={}'
.
format
(
quoted
)
sipkd_url
=
'mssql+pyodbc:///?odbc_connect={}'
.
format
(
quoted
)
sipkd_url_master
=
sipkd_url
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"
#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"
webr_url
=
"postgresql://aagusti:a@192.168.56.1/webr"
pap_url
=
"informix://samsatjb:samsatjb@dbdapja"
pap_url
=
"informix://user:pass@db"
\ No newline at end of file
\ No newline at end of file
import-pap.py
View file @
a48fb82
...
@@ -11,10 +11,10 @@
...
@@ -11,10 +11,10 @@
#vsts yesterday
#vsts yesterday
#tg_pros_bayar
#tg_pros_bayar
#pkb
#pkb
_pok
#
bbnkb1
#
pkb_den
#bbnkb
2
#bbnkb
1_pok
#
den_paja
k
#
bbnkb2_po
k
#jumlah
#jumlah
from
models_eis
import
(
ArPayment
as
EisArPayment
,
from
models_eis
import
(
ArPayment
as
EisArPayment
,
...
@@ -46,6 +46,15 @@ now = datetime.now()
...
@@ -46,6 +46,15 @@ now = datetime.now()
tanggal
=
now
.
date
()
tanggal
=
now
.
date
()
tahun
=
now
.
strftime
(
'
%
Y'
)
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
):
def
calculate
(
tabel
,
all
=
None
,
kode
=
None
):
query
=
EisDBSession
.
query
(
tabel
)
.
filter_by
(
tahun
=
str
(
tahun
))
.
\
query
=
EisDBSession
.
query
(
tabel
)
.
filter_by
(
tahun
=
str
(
tahun
))
.
\
order_by
(
tabel
.
departemen_kd
,
tabel
.
tanggal
,
tabel
.
kode
.
desc
())
order_by
(
tabel
.
departemen_kd
,
tabel
.
tanggal
,
tabel
.
kode
.
desc
())
...
@@ -117,7 +126,7 @@ def validate_parent(tabel, departemen_kd, departemen_nm, rekening, tanggal):
...
@@ -117,7 +126,7 @@ def validate_parent(tabel, departemen_kd, departemen_nm, rekening, tanggal):
EisDBSession
.
add
(
induk
)
EisDBSession
.
add
(
induk
)
EisDBSession
.
flush
()
EisDBSession
.
flush
()
def
insert_data
(
row
,
kode
,
nama
,
dep_kode
,
dep_nama
):
def
insert_data
(
row
,
kode
,
nama
):
# TODO
# TODO
eis
=
EisDBSession
.
query
(
EisArPayment
)
.
\
eis
=
EisDBSession
.
query
(
EisArPayment
)
.
\
filter_by
(
tahun
=
str
(
tahun
),
filter_by
(
tahun
=
str
(
tahun
),
...
@@ -139,6 +148,31 @@ def insert_data(row, kode, nama, dep_kode, dep_nama):
...
@@ -139,6 +148,31 @@ def insert_data(row, kode, nama, dep_kode, dep_nama):
EisDBSession
.
flush
()
EisDBSession
.
flush
()
validate_parent
(
EisArPayment
,
eis
.
departemen_kd
,
eis
.
departemen_nm
,
eis
.
kode
,
eis
.
tanggal
)
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
):
def
import_pap
(
all
=
False
):
sql
=
"SELECT tg_pros_bayar as tanggal, pap as pokok, den_pajak as denda FROM v_rtimepap "
\
sql
=
"SELECT tg_pros_bayar as tanggal, pap as pokok, den_pajak as denda FROM v_rtimepap "
\
"WHERE year(tg_pros_bayar) = '{tahun}' {where} "
\
"WHERE year(tg_pros_bayar) = '{tahun}' {where} "
\
...
@@ -152,40 +186,80 @@ def import_pap(all=False):
...
@@ -152,40 +186,80 @@ def import_pap(all=False):
format
(
tanggal
=
tanggal
.
strftime
(
'
%
d-
%
m-
%
Y'
)),)
format
(
tanggal
=
tanggal
.
strftime
(
'
%
d-
%
m-
%
Y'
)),)
print
(
sql
)
print
(
sql
)
rows
=
engine
.
fetchall
(
sql
)
rows
=
engine
.
fetchall
(
sql
)
rek_kode
=
'4.1.1.06.01.'
rek_kode
=
'4.1.1.06.01.'
rek_nama
=
'PAJAK AIR PERMUKAAN'
rek_nama
=
'PAJAK AIR PERMUKAAN'
denda_kode
=
'4.1.4.07.03.'
denda_kode
=
'4.1.4.07.03.'
denda_nama
=
'DENDA PAJAK AIR PERMUKAAN'
denda_nama
=
'DENDA PAJAK AIR PERMUKAAN'
for
row
in
rows
:
insert_data
(
row
,
rek_kode
,
rek_nama
)
EisDBSession
.
commit
()
dep_kode
=
'3.03.02.'
def
import_pkb
(
all
=
False
):
dep_nama
=
'BADAN PENDAPATAN DAERAH'
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
:
for
row
in
rows
:
#print(row)
insert_data
(
row
,
rek_kode
,
rek_nama
)
eis
=
EisDBSession
.
query
(
EisArPayment
)
.
\
filter_by
(
tahun
=
str
(
tahun
),
sql
=
"SELECT tg_pros_bayar as tanggal, (bbn1_pok+bbn2_pok) as bbn_pok, "
\
kode
=
rek_kode
,
"(bbn1_den+bbn2_den) as bbn_den, pkb_pok as pokok, pkb_den as denda"
\
departemen_kd
=
dep_kode
,
"FROM v_rtime "
\
tanggal
=
row
[
'tanggal'
],
"WHERE year(tg_pros_bayar) = '{tahun}' {where} "
\
)
.
first
()
"ORDER BY tg_pros_bayar"
if
not
eis
:
sql
=
sql
.
format
(
tahun
=
tahun
,
eis
=
EisArPayment
()
where
=
''
)
eis
.
tahun
=
str
(
tahun
)
sql
=
sql
.
format
(
tahun
=
tahun
,
eis
.
kode
=
rek_kode
where
=
" AND tg_pros_bayar = '{tanggal}'"
.
\
eis
.
departemen_kd
=
dep_kode
format
(
tanggal
=
tanggal
.
strftime
(
'
%
d-
%
m-
%
Y'
)),)
eis
.
tanggal
=
row
[
'tanggal'
]
rows
=
engine
.
fetchall
(
sql
)
eis
.
level_id
=
rek_kode
.
count
(
'.'
)
for
row
in
rows
:
eis
.
nama
=
rek_nama
insert_data
(
row
,
rek_kode
,
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
)
EisDBSession
.
commit
()
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
)
import_pap
(
True
)
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
)
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