penambahan kembali nop_to_id

1 parent 3d2826b1
...@@ -114,12 +114,15 @@ class FixDati2(BaseFixLength): ...@@ -114,12 +114,15 @@ class FixDati2(BaseFixLength):
class FixKecamatan(FixDati2): class FixKecamatan(FixDati2):
def get_structure(self): def get_structure(self):
return KECAMATAN return KECAMATAN
def kd_kecamatan(self): def kd_kecamatan(self):
return super().kd_dati2+'.'+self['kd_kecamatan'] return super().kd_dati2+'.'+self['kd_kecamatan']
class FixKelurahan(FixKecamatan): class FixKelurahan(FixKecamatan):
def get_structure(self): def get_structure(self):
return KELURAHAN return KELURAHAN
def kd_kelurahan(self): def kd_kelurahan(self):
return super().kd_kecamatan+'.'+self['kd_kelurahan'] return super().kd_kecamatan+'.'+self['kd_kelurahan']
...@@ -127,6 +130,7 @@ class FixKelurahan(FixKecamatan): ...@@ -127,6 +130,7 @@ class FixKelurahan(FixKecamatan):
class FixBlok(FixKelurahan): class FixBlok(FixKelurahan):
def get_structure(self): def get_structure(self):
return BLOK return BLOK
def kd_blok(self): def kd_blok(self):
return super().kd_kelurahan+'.'+self['kd_blok'] return super().kd_kelurahan+'.'+self['kd_blok']
...@@ -134,6 +138,7 @@ class FixBlok(FixKelurahan): ...@@ -134,6 +138,7 @@ class FixBlok(FixKelurahan):
class FixKantor(BaseFixLength): class FixKantor(BaseFixLength):
def get_structure(self): def get_structure(self):
return KANTOR return KANTOR
def kd_kantor(self): def kd_kantor(self):
return self['kd_kanwil']+'.'+self['kd_kantor'] return self['kd_kanwil']+'.'+self['kd_kantor']
...@@ -141,6 +146,7 @@ class FixKantor(BaseFixLength): ...@@ -141,6 +146,7 @@ class FixKantor(BaseFixLength):
class FixBank(FixKantor): class FixBank(FixKantor):
def get_structure(self): def get_structure(self):
return BANK return BANK
def kd_bank(self): def kd_bank(self):
return self['kd_kanwil']+'.'+self['kd_kantor']+'.'+self['kd_tp'] return self['kd_kanwil']+'.'+self['kd_kantor']+'.'+self['kd_tp']
...@@ -148,14 +154,15 @@ class FixBank(FixKantor): ...@@ -148,14 +154,15 @@ class FixBank(FixKantor):
class FixBankSismiop(FixKantor): class FixBankSismiop(FixKantor):
def get_structure(self): def get_structure(self):
return BANK_SISMIOP return BANK_SISMIOP
def kd_bank(self): def kd_bank(self):
return self['kd_kanwil_bank']+'.'+self['kd_kppbb_bank']+'.'+self['kd_bank_tunggal']+'.'+self['kd_bank_persepsi']+'.'+self['kd_tp'] return self['kd_kanwil_bank']+'.'+self['kd_kppbb_bank']+'.'+self['kd_bank_tunggal']+'.'+self['kd_bank_persepsi']+'.'+self['kd_tp']
class FixNop(FixBlok): class FixNop(FixBlok):
def get_structure(self): def get_structure(self):
return NOP return NOP
def nop(self): def nop(self):
return ".".join([self.kd_blok(), self["no_urut"], self["kd_jns_op"]]) return ".".join([self.kd_blok(), self["no_urut"], self["kd_jns_op"]])
...@@ -176,6 +183,7 @@ class FixNop(FixBlok): ...@@ -176,6 +183,7 @@ class FixNop(FixBlok):
class FixSppt(FixNop): class FixSppt(FixNop):
def get_structure(self): def get_structure(self):
return SPPT return SPPT
def sppt(self): def sppt(self):
return self.nop() + "." + self['thn_pajak_sppt'] return self.nop() + "." + self['thn_pajak_sppt']
...@@ -319,39 +327,44 @@ def nop_formatted(row): ...@@ -319,39 +327,44 @@ def nop_formatted(row):
row.kd_kelurahan, row.kd_blok, row.no_urut, row.kd_jns_op) row.kd_kelurahan, row.kd_blok, row.no_urut, row.kd_jns_op)
# def nop_to_id(row): def nop_to_id(row):
# if type(row) in (StringType, UnicodeType): if type(row) == str:
# row = FixNop(row) row = FixNop(row)
# return "%s%s%s%s%s%s%s" % (row.kd_propinsi, row.kd_dati2, row.kd_kecamatan, elif type(row) != dict:
# row.kd_kelurahan, row.kd_blok, row.no_urut, row = dict(row.__dict__)
# row.kd_jns_op) row.pop('_sa_instance_state', None)
return "%s%s%s%s%s%s%s" % (
def query_nop(table): #digunakan oleh e2apbb row.get("kd_propinsi"), row.get("kd_dati2"),
return func.concat(table.kd_propinsi, row.get("kd_kecamatan"), row.get("kd_kelurahan"),
func.concat( row.get("kd_blok"), row.get("no_urut"),
'.', row.get("kd_jns_op"))
func.concat(
table.kd_dati2,
func.concat( def column_concat(*args):
'-', cols = []
func.concat( for arg in args:
table.kd_kecamatan, if type(arg) == list:
func.concat( # for a in arg:
'.', cols.extend(arg)
func.concat( else:
table.kd_kelurahan, cols.append(arg)
func.concat(
'-', if not cols:
func.concat( return ''
table.kd_blok,
func.concat( elif len(cols) == 1:
'.', return cols[0]
func.concat( # saat ini menggunakan recursive spertinya ada syntax pythonic
table.no_urut, # func.concat(cols[i], for col in cols)
func.concat( # lambda_concat = lambda args: func.concat(x, y) for x, y in zip(args[:-1], args[1:])
'-', return func.concat(cols[0], column_concat(*cols[1:])) # pylint: disable=not-callable
table.kd_jns_op))))))))))))
def query_nop(table): # digunakan oleh e2apbb
return column_concat(table.kd_propinsi, '.', table.kd_dati2, '-',
table.kd_kecamatan, '.', table.kd_kelurahan, '-',
table.kd_blok, '.', table.no_urut, '-', table.kd_jns_op)
# JEnis REstitusi Kompensasi # JEnis REstitusi Kompensasi
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!