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 222f05b7
authored
Aug 25, 2017
by
aagusti
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
prod
1 parent
bcf95ccc
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
20 additions
and
16 deletions
conf.py
import-pap.py
conf.py
View file @
222f05b
...
@@ -8,8 +8,8 @@ quoted = quote_plus(url)
...
@@ -8,8 +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://
aagusti:a@192.168.56.1/o
s"
eis_url
=
"postgresql://
eis:31sb4p3nd4@192.168.99.25/ei
s"
webr_url
=
"postgresql://
aagusti:a@192.168.56.1/web
r"
webr_url
=
"postgresql://
web-r:bandung@localhost/web_
r"
pap_url
=
"informix://user:pass@db"
\ No newline at end of file
\ No newline at end of file
pap_url
=
"informis://samsatjb:samsatjb@dbdapja"
import-pap.py
View file @
222f05b
...
@@ -95,7 +95,7 @@ def calculate(tabel, all=None, kode=None):
...
@@ -95,7 +95,7 @@ def calculate(tabel, all=None, kode=None):
else
:
else
:
jumlahs
[
key
]
+=
row
.
jumlah
jumlahs
[
key
]
+=
row
.
jumlah
old_level
=
row
.
level_id
old_level
=
row
.
level_id
print
(
'kode: '
,
row
.
kode
,
'level: '
,
row
.
level_id
,
'old: '
,
old_level
,
'key: '
,
key
,
'jml: '
,
row
.
jumlah
,
'jmls: '
,
jumlahs
)
#
print('kode: ', row.kode, 'level: ', row.level_id, 'old: ', old_level, 'key: ', key, 'jml: ', row.jumlah, 'jmls: ', jumlahs)
EisDBSession
.
commit
()
EisDBSession
.
commit
()
def
validate_parent
(
tabel
,
departemen_kd
,
departemen_nm
,
rekening
,
tanggal
):
def
validate_parent
(
tabel
,
departemen_kd
,
departemen_nm
,
rekening
,
tanggal
):
...
@@ -143,10 +143,13 @@ def insert_data(row, kode, nama):
...
@@ -143,10 +143,13 @@ def insert_data(row, kode, nama):
eis
.
level_id
=
kode
.
count
(
'.'
)
eis
.
level_id
=
kode
.
count
(
'.'
)
eis
.
nama
=
nama
eis
.
nama
=
nama
eis
.
departemen_nm
=
dep_nama
eis
.
departemen_nm
=
dep_nama
eis
.
jumlah
=
row
[
'
denda
'
]
eis
.
jumlah
=
row
[
'
pokok
'
]
EisDBSession
.
add
(
eis
)
EisDBSession
.
add
(
eis
)
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
)
if
row
[
'denda'
]:
print
(
row
)
insert_denda
(
row
,
denda_kode
,
denda_nama
)
def
insert_denda
(
row
,
kode
,
nama
):
def
insert_denda
(
row
,
kode
,
nama
):
eis
=
EisDBSession
.
query
(
EisArPayment
)
.
\
eis
=
EisDBSession
.
query
(
EisArPayment
)
.
\
...
@@ -164,13 +167,10 @@ def insert_denda(row, kode, nama):
...
@@ -164,13 +167,10 @@ def insert_denda(row, kode, nama):
eis
.
level_id
=
rek_kode
.
count
(
'.'
)
eis
.
level_id
=
rek_kode
.
count
(
'.'
)
eis
.
nama
=
nama
eis
.
nama
=
nama
eis
.
departemen_nm
=
dep_nama
eis
.
departemen_nm
=
dep_nama
eis
.
jumlah
=
row
[
'
pokok
'
]
eis
.
jumlah
=
row
[
'
denda
'
]
EisDBSession
.
add
(
eis
)
EisDBSession
.
add
(
eis
)
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
)
if
row
[
'denda'
]:
print
(
row
)
insert_data
(
row
,
denda_kode
,
denda_nama
)
def
import_pap
(
all
=
False
):
def
import_pap
(
all
=
False
):
...
@@ -203,18 +203,19 @@ def import_pkb(all=False):
...
@@ -203,18 +203,19 @@ def import_pkb(all=False):
denda_nama
=
'PENDAPATAN DENDA KENDARAAN BERMOTOR'
denda_nama
=
'PENDAPATAN DENDA KENDARAAN BERMOTOR'
if
all
:
if
all
:
sql
=
"SELECT tg_pros_bayar as tanggal, (bbn1_pok+bbn2_pok) as bbn_pok, "
\
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"
\
"(bbn1_den+bbn2_den) as bbn_den, pkb_pok as pokok, pkb_den as denda
"
\
"FROM vsts "
\
"FROM v
_
sts "
\
"WHERE year(tg_pros_bayar) = '{tahun}' {where} "
\
"WHERE year(tg_pros_bayar) = '{tahun}' {where} "
\
"ORDER BY tg_pros_bayar"
"ORDER BY tg_pros_bayar"
sql
=
sql
.
format
(
tahun
=
tahun
,
sql
=
sql
.
format
(
tahun
=
tahun
,
where
=
''
)
where
=
''
)
print
(
sql
)
rows
=
engine
.
fetchall
(
sql
)
rows
=
engine
.
fetchall
(
sql
)
for
row
in
rows
:
for
row
in
rows
:
insert_data
(
row
,
rek_kode
,
rek_nama
)
insert_data
(
row
,
rek_kode
,
rek_nama
)
sql
=
"SELECT tg_pros_bayar as tanggal, (bbn1_pok+bbn2_pok) as bbn_pok, "
\
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"
\
"(bbn1_den+bbn2_den) as bbn_den, pkb_pok as pokok, pkb_den as denda
"
\
"FROM v_rtime "
\
"FROM v_rtime "
\
"WHERE year(tg_pros_bayar) = '{tahun}' {where} "
\
"WHERE year(tg_pros_bayar) = '{tahun}' {where} "
\
"ORDER BY tg_pros_bayar"
"ORDER BY tg_pros_bayar"
...
@@ -223,6 +224,7 @@ def import_pkb(all=False):
...
@@ -223,6 +224,7 @@ def import_pkb(all=False):
sql
=
sql
.
format
(
tahun
=
tahun
,
sql
=
sql
.
format
(
tahun
=
tahun
,
where
=
" AND tg_pros_bayar = '{tanggal}'"
.
\
where
=
" AND tg_pros_bayar = '{tanggal}'"
.
\
format
(
tanggal
=
tanggal
.
strftime
(
'
%
d-
%
m-
%
Y'
)),)
format
(
tanggal
=
tanggal
.
strftime
(
'
%
d-
%
m-
%
Y'
)),)
print
(
sql
)
rows
=
engine
.
fetchall
(
sql
)
rows
=
engine
.
fetchall
(
sql
)
for
row
in
rows
:
for
row
in
rows
:
insert_data
(
row
,
rek_kode
,
rek_nama
)
insert_data
(
row
,
rek_kode
,
rek_nama
)
...
@@ -235,18 +237,19 @@ def import_pkb(all=False):
...
@@ -235,18 +237,19 @@ def import_pkb(all=False):
denda_nama
=
'PENDAPATAN DENDA BBN-KB'
denda_nama
=
'PENDAPATAN DENDA BBN-KB'
if
all
:
if
all
:
sql
=
"SELECT tg_pros_bayar as tanggal, (bbn1_pok+bbn2_pok) as pokok, "
\
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"
\
"(bbn1_den+bbn2_den) as denda, pkb_pok as pkb_pok, pkb_den as pkb_den
"
\
"FROM vsts "
\
"FROM v
_
sts "
\
"WHERE year(tg_pros_bayar) = '{tahun}' {where} "
\
"WHERE year(tg_pros_bayar) = '{tahun}' {where} "
\
"ORDER BY tg_pros_bayar"
"ORDER BY tg_pros_bayar"
sql
=
sql
.
format
(
tahun
=
tahun
,
sql
=
sql
.
format
(
tahun
=
tahun
,
where
=
''
)
where
=
''
)
print
(
sql
)
rows
=
engine
.
fetchall
(
sql
)
rows
=
engine
.
fetchall
(
sql
)
for
row
in
rows
:
for
row
in
rows
:
insert_data
(
row
,
rek_kode
,
rek_nama
)
insert_data
(
row
,
rek_kode
,
rek_nama
)
sql
=
"SELECT tg_pros_bayar as tanggal, (bbn1_pok+bbn2_pok) as pokok, "
\
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"
\
"(bbn1_den+bbn2_den) as denda, pkb_pok as pkb_pok, pkb_den as pkb_den
"
\
"FROM v_rtime "
\
"FROM v_rtime "
\
"WHERE year(tg_pros_bayar) = '{tahun}' {where} "
\
"WHERE year(tg_pros_bayar) = '{tahun}' {where} "
\
"ORDER BY tg_pros_bayar"
"ORDER BY tg_pros_bayar"
...
@@ -255,12 +258,13 @@ def import_pkb(all=False):
...
@@ -255,12 +258,13 @@ def import_pkb(all=False):
sql
=
sql
.
format
(
tahun
=
tahun
,
sql
=
sql
.
format
(
tahun
=
tahun
,
where
=
" AND tg_pros_bayar = '{tanggal}'"
.
\
where
=
" AND tg_pros_bayar = '{tanggal}'"
.
\
format
(
tanggal
=
tanggal
.
strftime
(
'
%
d-
%
m-
%
Y'
)),)
format
(
tanggal
=
tanggal
.
strftime
(
'
%
d-
%
m-
%
Y'
)),)
print
(
sql
)
rows
=
engine
.
fetchall
(
sql
)
rows
=
engine
.
fetchall
(
sql
)
for
row
in
rows
:
for
row
in
rows
:
insert_data
(
row
,
rek_kode
,
rek_nama
)
insert_data
(
row
,
rek_kode
,
rek_nama
)
EisDBSession
.
commit
()
EisDBSession
.
commit
()
print
(
'IMPORT PAP'
)
print
(
'IMPORT PAP'
)
#
import_pap(True)
import_pap
(
True
)
import_pkb
(
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