Commit 904cda2b by Owo Sugiana

Prefix pada invoice ID Kabupaten Bekasi

1 parent 31ecba36
......@@ -10,6 +10,13 @@ def dmy(tgl):
return tgl.strftime('%d-%m-%Y')
PREFIX = '3218'
INVOICE_ID = [
('Prefix', 4, 'N'),
('Tahun', 4, 'N'),
('SptNo', 5, 'N'),
]
AWAL_MASA = date(2020, 3, 1)
AKHIR_MASA = date(2020, 12, 31)
AWAL_TERIMA = date(2020, 4, 1)
......@@ -23,6 +30,8 @@ NOTE_TGL_TERIMA = 'field terimatgl {tgl} >= ' + dmy(AWAL_TERIMA)
class Inquiry(BaseInquiry):
invoice_id_structure = INVOICE_ID
def get_discount_denda(self): # Override
self.notes = []
rek = self.rekening.rekeningkd
......@@ -57,5 +66,12 @@ class Inquiry(BaseInquiry):
class AvailableInvoice(BaseAvailableInvoice):
def get_inquiry_class(self):
invoice_id_structure = INVOICE_ID
def get_inquiry_class(self): # Override
return Inquiry
def get_invoice_id(self, row): # Override
invoice_id = super().get_invoice_id(row)
invoice_id['Prefix'] = PREFIX
return invoice_id
......@@ -41,9 +41,11 @@ INVOICE_ID = [
class BaseInquiry:
invoice_id_structure = INVOICE_ID
def __init__(self, invoice_id, conf=dict()):
real_inv_id = self.get_invoice_id(invoice_id)
self.invoice_id = FixLength(INVOICE_ID)
self.invoice_id = FixLength(self.invoice_id_structure)
self.invoice_id.set_raw(real_inv_id)
self.invoice = None
if not self.invoice_id['SptNo']:
......@@ -372,6 +374,8 @@ def date_from_str(s):
class AvailableInvoice:
invoice_id_structure = INVOICE_ID
def __init__(self, conf, option):
self.conf = conf
self.option = option
......@@ -532,10 +536,14 @@ class AvailableInvoice:
Invoice.type_id == SptType.id,
SptType.typenm.ilike(self.option.tipe))
def get_message(self, row):
invoice_id = FixLength(INVOICE_ID)
def get_invoice_id(self, row):
invoice_id = FixLength(self.invoice_id_structure)
invoice_id['Tahun'] = row.tahun
invoice_id['SptNo'] = row.sptno
return invoice_id
def get_message(self, row):
invoice_id = self.get_invoice_id(row)
Inquiry = self.get_inquiry_class()
inq = Inquiry(invoice_id.get_raw(), self.conf)
if not inq.total:
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!