Commit 222f05b7 by aagusti

prod

1 parent bcf95ccc
......@@ -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/os"
eis_url = "postgresql://eis:31sb4p3nd4@192.168.99.25/eis"
webr_url = "postgresql://aagusti:a@192.168.56.1/webr"
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"
......@@ -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)
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!