Commit 7e0788cb by Owo Sugiana

Invoice ID porsi sptno menjadi 6 digit

1 parent a5748532
...@@ -24,7 +24,7 @@ def show_rp(label, value): ...@@ -24,7 +24,7 @@ def show_rp(label, value):
def show_field(t, fieldname): def show_field(t, fieldname):
label = 'Field ' + fieldname label = f'Field {t.__tablename__}.{fieldname}'
try: try:
value = getattr(t, fieldname) value = getattr(t, fieldname)
except AttributeError: except AttributeError:
...@@ -72,6 +72,10 @@ def show(inq): ...@@ -72,6 +72,10 @@ def show(inq):
show_rp('Total Bayar', inq.total_bayar) show_rp('Total Bayar', inq.total_bayar)
show_rp('Total Tagihan', inq.total) show_rp('Total Tagihan', inq.total)
show_field(inq.invoice, 'status_pembayaran') show_field(inq.invoice, 'status_pembayaran')
if inq.total_bayar:
pay = inq.get_payment()
show_field(pay, 'sspdtgl')
show_field(pay, 'id')
def show_pkey_values(row): def show_pkey_values(row):
......
...@@ -36,7 +36,7 @@ from ..base import get_db_session ...@@ -36,7 +36,7 @@ from ..base import get_db_session
INVOICE_ID = [ INVOICE_ID = [
('Tahun', 4, 'N'), ('Tahun', 4, 'N'),
('SptNo', 5, 'N'), ('SptNo', 6, 'N'),
] ]
...@@ -240,6 +240,13 @@ class BaseInquiry: ...@@ -240,6 +240,13 @@ class BaseInquiry:
k = self.get_kohir() k = self.get_kohir()
return k and k.kohirtgl.date() return k and k.kohirtgl.date()
def get_payment(self):
Payment = self.get_payment_model()
DBSession = get_db_session()
q = DBSession.query(Payment).filter_by(spt_id=self.invoice.id)
q = q.order_by(Payment.id.desc())
return q.first()
class Inquiry(BaseInquiry): class Inquiry(BaseInquiry):
def __init__( def __init__(
...@@ -357,13 +364,6 @@ class Reversal(BaseInquiry): ...@@ -357,13 +364,6 @@ class Reversal(BaseInquiry):
DBSession.add(self.invoice) DBSession.add(self.invoice)
DBSession.flush() DBSession.flush()
def get_payment(self):
Payment = self.get_payment_model()
DBSession = get_db_session()
q = DBSession.query(Payment).filter_by(spt_id=self.invoice.id)
q = q.order_by(Payment.id.desc())
return q.first()
def date_from_str(s): def date_from_str(s):
d, m, y = [int(x) for x in s.split('-')] d, m, y = [int(x) for x in s.split('-')]
......
...@@ -53,6 +53,8 @@ def satu_kalimat(notes): ...@@ -53,6 +53,8 @@ def satu_kalimat(notes):
class Inquiry(BaseInquiry): class Inquiry(BaseInquiry):
def get_discount_denda(self): # Override def get_discount_denda(self): # Override
if self.denda < 1:
return 0
tgl_bayar = to_date(self.tgl_bayar) tgl_bayar = to_date(self.tgl_bayar)
if tgl_bayar > TGL_BAYAR_MAX: if tgl_bayar > TGL_BAYAR_MAX:
return 0 return 0
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!