Commit 446924c1 by sugiana

Rumus discount Kabupaten Cirebon

1 parent 04830631
......@@ -2,3 +2,4 @@ build
dist
*egg-info
test-*.ini
__pycache__
0.4 2022-01-22
--------------
- is_available() tidak lagi digunakan saat hitung() melainkan saat __init__().
Jadi bila field status_pembayaran bukan 0 atau 1 maka artinya sudah dihapus.
- Penggunaan pkgutil agar fleksibel saat pip install -e
- Rumus discount Kabupaten Cirebon
0.3.6 2021-07-05
----------------
- Perubahan rumus denda pada Kabupaten Bekasi
......
__path__ = __import__('pkgutil').extend_path(__path__, __name__)
......@@ -14,9 +14,18 @@ INVOICE_ID = [
]
AKHIR_DISC = date(2022, 3, 31)
class Inquiry(BaseInquiry):
invoice_id_structure = INVOICE_ID
def get_discount_denda(self): # Override
tgl_bayar = self.tgl_bayar.date()
if tgl_bayar <= AKHIR_DISC:
return self.denda
return 0
class Reversal(BaseReversal):
invoice_id_structure = INVOICE_ID
......
......@@ -59,6 +59,8 @@ class BaseInquiry:
q = DBSession.query(Invoice).filter_by(
tahun=self.invoice_id['Tahun'], sptno=self.invoice_id['SptNo'])
self.invoice = q.first()
if not self.is_available():
self.invoice = None
def get_invoice_id(self, raw):
return raw
......@@ -97,7 +99,7 @@ class BaseInquiry:
return Payment
def is_available(self):
return self.invoice.status_pembayaran == 0
return self.invoice.status_pembayaran in (0, 1)
def get_jatuh_tempo(self):
return self.invoice.jatuhtempotgl and self.invoice.jatuhtempotgl.date()
......@@ -307,7 +309,7 @@ class Inquiry(BaseInquiry):
self.hitung_denda()
self.hitung_bayar()
self.total = self.tagihan + self.denda - self.total_bayar
if self.total < 0 or not self.is_available():
if self.total < 0:
self.total = 0
def get_pay_seq(self):
......
......@@ -15,6 +15,7 @@ requires = [
'sqlalchemy',
'zope.sqlalchemy',
'transaction',
'psycopg2-binary',
'opensipkd-hitung @ '
'git+https://git.opensipkd.com/sugiana/opensipkd-hitung.git',
]
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!