Commit fa99ab0d by aa.gusti

rekening

1 parent 6d513d7a
...@@ -73,18 +73,18 @@ def validate_parent(tabel, departemen_kd, departemen_nm, rekening, tanggal): ...@@ -73,18 +73,18 @@ def validate_parent(tabel, departemen_kd, departemen_nm, rekening, tanggal):
continue continue
induk = EisDBSession.query(tabel).\ induk = EisDBSession.query(tabel).\
filter_by(tahun=str(row.tahun), filter_by(tahun=str(row.tahun),
kode=row.kode, kode=row.kode.strip(),
departemen_kd = departemen_kd, departemen_kd = departemen_kd.strip(),
).first() ).first()
if not induk: if not induk:
induk = tabel() induk = tabel()
induk.tahun = str(tahun) induk.tahun = str(tahun)
induk.kode = row.kode induk.kode = row.kode.strip()
induk.departemen_kd = departemen_kd induk.departemen_kd = departemen_kd.strip()
induk.tanggal = tanggal induk.tanggal = tanggal
induk.departemen_nm = departemen_nm induk.departemen_nm = departemen_nm.strip()
induk.level_id = row.kode.count('.') induk.level_id = row.kode.count('.')
induk.nama = row.nama induk.nama = row.nama.strip()
EisDBSession.add(induk) EisDBSession.add(induk)
EisDBSession.flush() EisDBSession.flush()
...@@ -97,19 +97,19 @@ def import_ap(all=False): ...@@ -97,19 +97,19 @@ def import_ap(all=False):
for row in query.all(): for row in query.all():
eis = EisDBSession.query(EisApPayment).\ eis = EisDBSession.query(EisApPayment).\
filter_by(tahun = str(row.tahun), filter_by(tahun = str(row.tahun),
kode = row.kd_rekening, kode = row.kd_rekening.strip(),
departemen_kd = row.kd_opd, departemen_kd = row.kd_opd.strip(),
tanggal = row.tanggal, tanggal = row.tanggal,
).first() ).first()
if not eis: if not eis:
eis = EisApPayment() eis = EisApPayment()
eis.tahun = str(row.tahun) eis.tahun = str(row.tahun)
eis.kode = row.kd_rekening eis.kode = row.kd_rekening.strip()
eis.departemen_kd = row.kd_opd eis.departemen_kd = row.kd_opd.strip()
eis.tanggal = row.tanggal eis.tanggal = row.tanggal
eis.level_id = row.kd_rekening.count('.') eis.level_id = row.kd_rekening.count('.')
eis.nama = row.nm_rekening eis.nama = row.nm_rekening.strip()
eis.departemen_nm = row.nm_opd eis.departemen_nm = row.nm_opd.strip()
eis.jumlah = row.realisasi eis.jumlah = row.realisasi
EisDBSession.add(eis) EisDBSession.add(eis)
EisDBSession.flush() EisDBSession.flush()
...@@ -124,19 +124,19 @@ def import_by(all=False): ...@@ -124,19 +124,19 @@ def import_by(all=False):
for row in query.filter(Realisasi.kd_rekening.like('6.%')).all(): for row in query.filter(Realisasi.kd_rekening.like('6.%')).all():
eis = EisDBSession.query(EisByPayment).\ eis = EisDBSession.query(EisByPayment).\
filter_by(tahun = str(row.tahun), filter_by(tahun = str(row.tahun),
rekening_kd = row.kd_rekening, rekening_kd = row.kd_rekening.strip(),
departemen_kd = row.kd_opd, departemen_kd = row.kd_opd.strip(),
tanggal = tanggal, tanggal = tanggal,
).first() ).first()
if not eis: if not eis:
eis = EisByPayment() eis = EisByPayment()
eis.tahun = str(row.tahun) eis.tahun = str(row.tahun)
eis.kode = row.kd_rekening eis.kode = row.kd_rekening.strip()
eis.departemen_kd = row.kd_opd eis.departemen_kd = row.kd_opd.strip()
eis.tanggal = tanggal eis.tanggal = tanggal
eis.level_id = row.kd_rekening.count('.') eis.level_id = row.kd_rekening.count('.')
eis.nama = row.nm_rekening eis.nama = row.nm_rekening.strip()
eis.departemen_nm = row.nm_opd eis.departemen_nm = row.nm_opd.strip()
eis.jumlah = row.realisai eis.jumlah = row.realisai
EisDBSession.add(eis) EisDBSession.add(eis)
EisDBSession.flush() EisDBSession.flush()
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!