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 8aa43811
authored
Aug 25, 2017
by
aagusti
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
prod
1 parent
34588be4
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
26 additions
and
22 deletions
conf.py
import-pap.py
import-pap.sh
conf.py
View file @
8aa4381
...
...
@@ -8,8 +8,9 @@ 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/webr"
webr_url
=
"postgresql://web-r:bandung@localhost/web_r"
pap_url
=
"informix://samsatjb:samsatjb@dbdapja"
pap_url
=
"informix://user:pass@db"
\ No newline at end of file
import-pap.py
View file @
8aa4381
...
...
@@ -17,8 +17,7 @@
#den_pajak
#jumlah
from
models_eis
import
(
ApPayment
as
EisApPayment
,
ByPayment
as
EisByPayment
,
from
models_eis
import
(
ArPayment
as
EisArPayment
,
Rekening
as
EisRekening
,
EisBase
,
EisDBSession
)
from
conf
import
pap_url
...
...
@@ -31,7 +30,7 @@ except:
from
urllib.parse
import
quote_plus
,
quote
from
conf
import
pap_url
as
url
from
DbTools
import
OtherEngine
data
=
url
.
split
(
'@'
)
db_name
=
data
[
1
]
...
...
@@ -40,6 +39,7 @@ data = data[1].split(':')
db_user
=
data
[
0
]
db_pass
=
data
[
1
]
print
(
db_name
,
db_user
,
db_pass
)
engine
=
OtherEngine
(
db_name
,
db_user
,
db_pass
)
now
=
datetime
.
now
()
...
...
@@ -123,34 +123,34 @@ def insert_data(row, kode, nama, dep_kode, dep_nama):
filter_by
(
tahun
=
str
(
tahun
),
kode
=
kode
,
departemen_kd
=
dep_kode
,
tanggal
=
row
.
tanggal
,
tanggal
=
row
[
'tanggal'
]
,
)
.
first
()
if
not
eis
:
eis
=
EisArPayment
()
eis
.
tahun
=
str
(
tahun
)
eis
.
kode
=
kode
eis
.
departemen_kd
=
dep_kode
eis
.
tanggal
=
tanggal
eis
.
tanggal
=
row
[
'tanggal'
]
eis
.
level_id
=
kode
.
count
(
'.'
)
eis
.
nama
=
nama
eis
.
departemen_nm
=
dep_nama
eis
.
jumlah
=
row
.
denda
eis
.
jumlah
=
row
[
'denda'
]
EisDBSession
.
add
(
eis
)
EisDBSession
.
flush
()
validate_parent
(
EisArPayment
,
eis
.
departemen_kd
,
eis
.
departemen_nm
,
eis
.
kode
,
eis
.
tanggal
)
def
import_pap
(
all
=
False
):
sql
=
"SELECT tg_pros_bayar as tanggal, pap as pokok, den_pajak as denda FROM v_rtimepap "
\
"WHERE
TO_CHAR(tg_pros_bayar, 'YYYY'
) = '{tahun}' {where} "
\
"WHERE
year(tg_pros_bayar
) = '{tahun}' {where} "
\
"ORDER BY tg_pros_bayar"
if
not
all
:
if
all
:
sql
=
sql
.
format
(
tahun
=
tahun
,
where
=
''
)
else
:
sql
=
sql
.
format
(
tahun
=
tahun
,
where
=
" tg_pros_bayar = '{tanggal}'"
.
\
where
=
"
AND
tg_pros_bayar = '{tanggal}'"
.
\
format
(
tanggal
=
tanggal
.
strftime
(
'
%
d-
%
m-
%
Y'
)),)
print
(
sql
)
rows
=
engine
.
fetchall
(
sql
)
rek_kode
=
'4.1.1.06.01.'
...
...
@@ -161,28 +161,29 @@ def import_pap(all=False):
dep_kode
=
'3.03.02.'
dep_nama
=
'BADAN PENDAPATAN DAERAH'
for
row
in
query
.
all
():
eis
=
EisDBSession
.
query
(
EisA
p
Payment
)
.
\
for
row
in
rows
:
#print(row)
eis
=
EisDBSession
.
query
(
EisA
r
Payment
)
.
\
filter_by
(
tahun
=
str
(
tahun
),
kode
=
rek_kode
,
departemen_kd
=
dep_kode
,
tanggal
=
row
.
tanggal
,
tanggal
=
row
[
'tanggal'
]
,
)
.
first
()
if
not
eis
:
eis
=
EisA
p
Payment
()
eis
=
EisA
r
Payment
()
eis
.
tahun
=
str
(
tahun
)
eis
.
kode
=
rek_kode
eis
.
departemen_kd
=
dep_kode
eis
.
tanggal
=
row
.
tanggal
eis
.
tanggal
=
row
[
'tanggal'
]
eis
.
level_id
=
rek_kode
.
count
(
'.'
)
eis
.
nama
=
rek_nama
eis
.
departemen_nm
=
dep_nama
eis
.
jumlah
=
row
.
pokok
eis
.
jumlah
=
row
[
'pokok'
]
EisDBSession
.
add
(
eis
)
EisDBSession
.
flush
()
validate_parent
(
EisApPayment
,
eis
.
departemen_kd
,
eis
.
departemen_nm
,
eis
.
kode
,
eis
.
tanggal
)
if
row
.
denda
:
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
()
...
...
import-pap.sh
0 → 100755
View file @
8aa4381
export
INFORMIXSERVER
=
"kpusat19_svr"
/usr/bin/python import-pap.py
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