Commit 67f32728 by Owo Sugiana

Di Kota Bekasi memastikan status yang diproses hanya 0 dan 1

1 parent aced2df3
0.4.17 2026-11-05
-----------------
- Di Kota Bekasi memastikan status yang diproses hanya 0 dan 1
0.4.16 2026-11-03 0.4.16 2026-11-03
----------------- -----------------
- Di Kota Bekasi memastikan alamat tidak menampilkan karakter aneh - Di Kota Bekasi memastikan alamat tidak menampilkan karakter aneh
......
...@@ -114,7 +114,7 @@ def show_inquiry(inq): ...@@ -114,7 +114,7 @@ def show_inquiry(inq):
show_val('Tahun Pajak', inq.get_tahun()) show_val('Tahun Pajak', inq.get_tahun())
print('Tabel {}:'.format(inq.invoice.__table__.name)) print('Tabel {}:'.format(inq.invoice.__table__.name))
show_fields( show_fields(
inq.invoice, ['doc_id', 'pengenaan', 'denda_rp', inq.invoice, ['doc_id', 'pengenaan', 'denda_rp', 'status_bayar',
'status_pembayaran', 'nil_setor', 'nomor', 'tanggal']) 'status_pembayaran', 'nil_setor', 'nomor', 'tanggal'])
show_payment_from_inquiry(inq) show_payment_from_inquiry(inq)
...@@ -138,7 +138,12 @@ def main(argv=sys.argv): ...@@ -138,7 +138,12 @@ def main(argv=sys.argv):
tgl_bayar = option.tgl_bayar and to_date(option.tgl_bayar) tgl_bayar = option.tgl_bayar and to_date(option.tgl_bayar)
inq = services.Inquiry(invoice_id, conf, tgl_bayar) inq = services.Inquiry(invoice_id, conf, tgl_bayar)
if not inq.invoice: if not inq.invoice:
error(f'Invoice ID {invoice_id} tidak ada.') if inq.debug_invoice:
error(
f'Invoice ID {option.invoice_id} tidak tersedia karena '
'status_bayar bukan 0 atau 1 melainkan '
f'{inq.debug_invoice.status_bayar}')
error(f'Invoice ID {option.invoice_id} tidak ada.')
show_inquiry(inq) show_inquiry(inq)
if option.payment: if option.payment:
if not inq.total: if not inq.total:
......
...@@ -43,10 +43,11 @@ class Common: ...@@ -43,10 +43,11 @@ class Common:
def get_jatuh_tempo(self): def get_jatuh_tempo(self):
pass pass
def is_paid(self):
return self.invoice.status_bayar == '1'
def is_available(self): def is_available(self):
# Meski reversal tetap tidak bisa dibayarkan lagi karena kd_booking return self.invoice.status_bayar in ('0', '1')
# unique.
return not self.payment and self.invoice.status_bayar == '0'
def get_payment(self): def get_payment(self):
db_session = get_db_session() db_session = get_db_session()
...@@ -59,8 +60,13 @@ class Common: ...@@ -59,8 +60,13 @@ class Common:
class Inquiry(Common): class Inquiry(Common):
def __init__(self, invoice_id, conf, tgl_bayar=None): def __init__(self, invoice_id, conf, tgl_bayar=None):
super().__init__(invoice_id) super().__init__(invoice_id)
self.debug_invoice = None
if not self.invoice: if not self.invoice:
return return
if not self.is_available():
self.debug_invoice = self.invoice
self.invoice = None
return
self.conf = conf self.conf = conf
if tgl_bayar: if tgl_bayar:
self.tgl_bayar = tgl_bayar self.tgl_bayar = tgl_bayar
...@@ -82,6 +88,8 @@ class Inquiry(Common): ...@@ -82,6 +88,8 @@ class Inquiry(Common):
self.total = self.tagihan - self.total_bayar self.total = self.tagihan - self.total_bayar
if self.total < 0: if self.total < 0:
self.total = 0 self.total = 0
if self.is_paid():
self.total = 0
def get_payment_amount(self): def get_payment_amount(self):
db_session = get_db_session() db_session = get_db_session()
...@@ -236,6 +244,8 @@ class AvailableInvoice(BaseAvailableInvoice): ...@@ -236,6 +244,8 @@ class AvailableInvoice(BaseAvailableInvoice):
inq = Inquiry(row.kd_booking, self.conf) inq = Inquiry(row.kd_booking, self.conf)
if not inq.is_available(): if not inq.is_available():
return return
if inq.is_paid():
return
msg = '{} {} {} {}'.format( msg = '{} {} {} {}'.format(
inq.invoice_id, inq.get_tahun(), inq.get_nop(), inq.invoice_id, inq.get_tahun(), inq.get_nop(),
inq.get_nama()) inq.get_nama())
......
...@@ -3,7 +3,7 @@ requires = ['setuptools >= 64'] ...@@ -3,7 +3,7 @@ requires = ['setuptools >= 64']
[project] [project]
name = 'opensipkd-bphtb-models' name = 'opensipkd-bphtb-models'
version = '0.4.16' version = '0.4.17'
dependencies = [ dependencies = [
'psycopg', 'psycopg',
'zope.sqlalchemy', 'zope.sqlalchemy',
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!