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 3b79562f
authored
Aug 26, 2017
by
aa.gusti
Browse Files
Options
Browse Files
Tag
Download
Plain Diff
Merge branch 'master' of
http://git.opensipkd.com/project/import-sipkd-eis
2 parents
3734a84e
222f05b7
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 @
3b79562
...
...
@@ -8,8 +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://
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
pap_url
=
"informis://samsatjb:samsatjb@dbdapja"
import-pap.py
View file @
3b79562
...
...
@@ -95,7 +95,7 @@ def calculate(tabel, all=None, kode=None):
else
:
jumlahs
[
key
]
+=
row
.
jumlah
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
()
def
validate_parent
(
tabel
,
departemen_kd
,
departemen_nm
,
rekening
,
tanggal
):
...
...
@@ -143,10 +143,13 @@ def insert_data(row, kode, nama):
eis
.
level_id
=
kode
.
count
(
'.'
)
eis
.
nama
=
nama
eis
.
departemen_nm
=
dep_nama
eis
.
jumlah
=
row
[
'
denda
'
]
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_denda
(
row
,
denda_kode
,
denda_nama
)
def
insert_denda
(
row
,
kode
,
nama
):
eis
=
EisDBSession
.
query
(
EisArPayment
)
.
\
...
...
@@ -164,13 +167,10 @@ def insert_denda(row, kode, nama):
eis
.
level_id
=
rek_kode
.
count
(
'.'
)
eis
.
nama
=
nama
eis
.
departemen_nm
=
dep_nama
eis
.
jumlah
=
row
[
'
pokok
'
]
eis
.
jumlah
=
row
[
'
denda
'
]
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
):
...
...
@@ -203,18 +203,19 @@ def import_pkb(all=False):
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 "
\
"(bbn1_den+bbn2_den) as bbn_den, pkb_pok as pokok, pkb_den as denda
"
\
"FROM v
_
sts "
\
"WHERE year(tg_pros_bayar) = '{tahun}' {where} "
\
"ORDER BY tg_pros_bayar"
sql
=
sql
.
format
(
tahun
=
tahun
,
where
=
''
)
print
(
sql
)
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"
\
"(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"
...
...
@@ -223,6 +224,7 @@ def import_pkb(all=False):
sql
=
sql
.
format
(
tahun
=
tahun
,
where
=
" AND tg_pros_bayar = '{tanggal}'"
.
\
format
(
tanggal
=
tanggal
.
strftime
(
'
%
d-
%
m-
%
Y'
)),)
print
(
sql
)
rows
=
engine
.
fetchall
(
sql
)
for
row
in
rows
:
insert_data
(
row
,
rek_kode
,
rek_nama
)
...
...
@@ -235,18 +237,19 @@ def import_pkb(all=False):
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 "
\
"(bbn1_den+bbn2_den) as denda, pkb_pok as pkb_pok, pkb_den as pkb_den
"
\
"FROM v
_
sts "
\
"WHERE year(tg_pros_bayar) = '{tahun}' {where} "
\
"ORDER BY tg_pros_bayar"
sql
=
sql
.
format
(
tahun
=
tahun
,
where
=
''
)
print
(
sql
)
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"
\
"(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"
...
...
@@ -255,12 +258,13 @@ def import_pkb(all=False):
sql
=
sql
.
format
(
tahun
=
tahun
,
where
=
" AND tg_pros_bayar = '{tanggal}'"
.
\
format
(
tanggal
=
tanggal
.
strftime
(
'
%
d-
%
m-
%
Y'
)),)
print
(
sql
)
rows
=
engine
.
fetchall
(
sql
)
for
row
in
rows
:
insert_data
(
row
,
rek_kode
,
rek_nama
)
EisDBSession
.
commit
()
print
(
'IMPORT PAP'
)
#
import_pap(True)
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