Commit 3f15b2e0 by Owo Sugiana

available_invoice.py tambah opsi --nominal-min dan --nominal-max

1 parent 17e1bdb9
0.2.2 2020-08-04
0.2.2 2020-08-25
----------------
- Tambah get_jenis_usaha()
- available_invoice.py tambah opsi --nominal-min dan --nominal-max
0.2.1 2020-07-24
----------------
......
......@@ -17,6 +17,8 @@ def get_option(argv):
pars.add_argument('--tahun', type=int)
pars.add_argument('--belum-jatuh-tempo', action='store_true')
pars.add_argument('--lewat-jatuh-tempo', action='store_true')
pars.add_argument('--nominal-min', type=int)
pars.add_argument('--nominal-max', type=int)
pars.add_argument(
'--count', type=int, default=default_count, help=help_count)
return pars.parse_args(argv)
......
......@@ -322,7 +322,7 @@ class AvailableInvoice:
continue
count += 1
no = str(count).zfill(max_count_length)
msg = '#{}/{} {}'.format(no, self.option.count, msg)
msg = f'#{no}/{self.option.count} {msg}'
print(msg)
if count == self.option.count:
break
......@@ -363,6 +363,14 @@ class AvailableInvoice:
if self.option.jenis:
pola = '%{}%'.format(self.option.jenis)
q = q.filter(Usaha.usahanm.ilike(pola))
if self.option.nominal_min:
q = q.filter(
Invoice.pajak_terhutang - Invoice.bunga >=
self.option.nominal_min)
if self.option.nominal_max:
q = q.filter(
Invoice.pajak_terhutang - Invoice.bunga <=
self.option.nominal_max)
return q
def get_message(self, row):
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!