Commit 8426ff03 by Owo Sugiana

Tambah Subang

1 parent 33a45a1e
0.4.2 2022-07-01
----------------
- Tambah Subang
0.4.1 2022-02-23
----------------
- Jumlah digit Invoice ID harus sama persis sesuai struktur
......
......@@ -124,8 +124,6 @@ def main(argv=sys.argv):
print('Berhasil dibayar')
if option.reversal:
rev = services.Reversal(invoice_id)
if rev.is_available():
error('Memang belum dibayar')
pay = rev.payment
if not pay:
error(ERR_PAYMENT_NOT_FOUND)
......
......@@ -5,7 +5,7 @@ from datetime import (
from opensipkd.hitung import round_up
from .default import (
Inquiry as BaseInquiry,
Reversal,
Reversal as BaseReversal,
AvailableInvoice as BaseAvailableInvoice,
)
......@@ -131,6 +131,10 @@ class Inquiry(BaseInquiry):
return 0
class Reversal(BaseReversal):
invoice_id_structure = INVOICE_ID
class AvailableInvoice(BaseAvailableInvoice):
invoice_id_structure = INVOICE_ID
......
......@@ -366,11 +366,13 @@ class Inquiry(BaseInquiry):
class Reversal(BaseInquiry):
def __init__(self, invoice_id):
BaseInquiry.__init__(self, invoice_id)
if self.invoice and self.invoice.status_pembayaran == 1:
self.payment = self.get_payment()
else:
self.payment = None
super().__init__(invoice_id)
self.payment = None
if not self.invoice:
return
if self.invoice.status_pembayaran != 1:
return
self.payment = self.get_payment()
def do_reversal(self):
DBSession = get_db_session()
......
from datetime import date
from .default import (
Inquiry as BaseInquiry,
Reversal,
AvailableInvoice as BaseAvailableInvoice,
)
def dmy(tgl):
return tgl.strftime('%d-%m-%Y')
AKHIR_MASA_PAJAK = date(2021, 7, 31)
AKHIR_TGL_BAYAR = date(2021, 12, 31)
class Inquiry(BaseInquiry):
def get_discount_denda(self): # Override
tgl_bayar = self.tgl_bayar.date()
if self.invoice.tahun == 2020 and self.invoice.sptno == 6307:
return 0
if tgl_bayar > AKHIR_TGL_BAYAR:
return 0
if self.invoice.masadari.date() <= AKHIR_MASA_PAJAK:
return self.denda
return 0
class AvailableInvoice(BaseAvailableInvoice):
def get_inquiry_class(self): # Override
return Inquiry
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!