Commit 41c817a9 by pindya

Revisi field status pembayaran di laporan skrd dan public

1 parent 5a1e5685
...@@ -842,6 +842,7 @@ def view_pdf(request): ...@@ -842,6 +842,7 @@ def view_pdf(request):
ARInvoice.tgl_tetap.label('tgl_tetap'), ARInvoice.tgl_tetap.label('tgl_tetap'),
ARInvoice.jumlah.label('jumlah'), ARInvoice.jumlah.label('jumlah'),
ARInvoice.jatuh_tempo.label('jatuh_tempo'), ARInvoice.jatuh_tempo.label('jatuh_tempo'),
ARInvoice.status_bayar.label('status_bayar'),
ARInvoice.pokok.label('pokok'), ARInvoice.pokok.label('pokok'),
ARInvoice.denda.label('denda'), ARInvoice.denda.label('denda'),
ARInvoice.pejabat_nama.label('pejabat_nama'), ARInvoice.pejabat_nama.label('pejabat_nama'),
...@@ -877,12 +878,21 @@ def view_pdf(request): ...@@ -877,12 +878,21 @@ def view_pdf(request):
item.jumlah = thousand(row.jumlah) item.jumlah = thousand(row.jumlah)
item.jatuh_tempo = dmy(row.jatuh_tempo) item.jatuh_tempo = dmy(row.jatuh_tempo)
item.terbilang = terbilang(row.jumlah) + ' Rupiah' item.terbilang = terbilang(row.jumlah) + ' Rupiah'
item.status_pembayaran = (row.ntb) and 'H2H Bank' or (row.ntp) and 'Manual' or '-' # item.status_pembayaran = (row.ntb) and 'H2H Bank' or (row.ntp) and 'Manual' or '-'
item.tgl_pembayaran = row.tgl_bayar and dmy(row.tgl_bayar) or '-' item.tgl_pembayaran = row.tgl_bayar and dmy(row.tgl_bayar) or '-'
item.pokok = row.pokok and thousand(row.pokok) or '-' # item.pokok = row.pokok and thousand(row.pokok) or '-'
item.denda = (row.tgl_bayar) and thousand(row.bunga) or (row.denda) and thousand(row.denda) or '0' # item.denda = (row.tgl_bayar) and thousand(row.bunga) or (row.denda) and thousand(row.denda) or '0'
item.bayar = row.bayar and thousand(row.bayar) or (row.jumlah) and thousand(row.jumlah) or (int(item.pokok)+int(item.denda)) # item.bayar = row.bayar and thousand(row.bayar) or (row.jumlah) and thousand(row.jumlah) or (int(item.pokok)+int(item.denda))
if (row.status_bayar == 0):
item.status_pembayaran = 'Belum Lunas'
item.pokok = 0
item.denda = 0
item.bayar = 0
else:
item.status_pembayaran = 'Sudah Lunas'
item.pokok = row.pokok and thousand(row.pokok) or '-'
item.denda = (row.tgl_bayar) and thousand(row.bunga) or (row.denda) and thousand(row.denda) or '0'
item.bayar = row.bayar and thousand(row.bayar) or (row.jumlah) and thousand(row.jumlah) or (int(item.pokok)+int(item.denda))
qrcodename = 'skrd_{}'.format(params['id']) qrcodename = 'skrd_{}'.format(params['id'])
path = '/tmp/' + qrcodename path = '/tmp/' + qrcodename
## ambil host ## ambil host
......
...@@ -350,6 +350,7 @@ def view_public(request): ...@@ -350,6 +350,7 @@ def view_public(request):
ARInvoice.tgl_tetap.label('tgl_tetap'), ARInvoice.tgl_tetap.label('tgl_tetap'),
ARInvoice.jumlah.label('jumlah'), ARInvoice.jumlah.label('jumlah'),
ARInvoice.jatuh_tempo.label('jatuh_tempo'), ARInvoice.jatuh_tempo.label('jatuh_tempo'),
ARInvoice.status_bayar.label('status_bayar'),
ARInvoice.pokok.label('pokok'), ARInvoice.pokok.label('pokok'),
ARInvoice.denda.label('denda'), ARInvoice.denda.label('denda'),
ARInvoice.pejabat_nama.label('pejabat_nama'), ARInvoice.pejabat_nama.label('pejabat_nama'),
...@@ -368,6 +369,17 @@ def view_public(request): ...@@ -368,6 +369,17 @@ def view_public(request):
jml = terbilang(row.jumlah) + ' Rupiah' jml = terbilang(row.jumlah) + ' Rupiah'
tahun = datetime.now().year tahun = datetime.now().year
if (row.status_bayar == 0):
status_pembayaran = 'Belum Lunas'
jml_pokok = 0
jml_denda = 0
jml_bayar = 0
else:
status_pembayaran = 'Sudah Lunas'
jml_pokok = row.pokok and thousand(row.pokok) or '-'
jml_denda = (row.tgl_bayar) and thousand(row.bunga) or (row.denda) and thousand(row.denda) or '0'
jml_bayar = row.bayar and thousand(row.bayar) or (row.jumlah) and thousand(row.jumlah) or (int(item.pokok)+int(item.denda))
## buat nama di folder /tmp ## buat nama di folder /tmp
qrcodename = 'skrd_{}{}'.format(row.invoice_id,'.png') qrcodename = 'skrd_{}{}'.format(row.invoice_id,'.png')
...@@ -383,4 +395,4 @@ def view_public(request): ...@@ -383,4 +395,4 @@ def view_public(request):
## convert ke base64 ## convert ke base64
qrcodebase64 = base64.b64encode(readqrcode) ##akan diouput ke html image qrcodebase64 = base64.b64encode(readqrcode) ##akan diouput ke html image
return dict(data=row, jml_terbilang=jml, tahun=tahun, qrcodebase64=qrcodebase64, found=found) return dict(data=row, jml_terbilang=jml, tahun=tahun, qrcodebase64=qrcodebase64, status_pembayaran=status_pembayaran, jml_pokok=jml_pokok, jml_denda=jml_denda, jml_bayar=jml_bayar, found=found)
...@@ -190,7 +190,7 @@ ...@@ -190,7 +190,7 @@
<tr class="borderless"> <tr class="borderless">
<td>Status Pembayaran</td> <td>Status Pembayaran</td>
<td>:</td> <td>:</td>
<td><b>${(data.ntb and 'H2H Bank' or data.ntp and 'Manual' or '-')}</b></td> <td><b>${status_pembayaran}</b></td>
<td rowspan="5" align="center">........,.................. Tahun ${tahun} <br> <td rowspan="5" align="center">........,.................. Tahun ${tahun} <br>
Yang Menerima <br><br><br><br><br> Yang Menerima <br><br><br><br><br>
..................................... .....................................
...@@ -199,22 +199,22 @@ ...@@ -199,22 +199,22 @@
<tr class="borderless"> <tr class="borderless">
<td>Tanggal Pembayaran</td> <td>Tanggal Pembayaran</td>
<td>:</td> <td>:</td>
<td><b>${data.tgl_bayar}</b></td> <td><b>${data.tgl_bayar or '-'}</b></td>
</tr> </tr>
<tr class="borderless"> <tr class="borderless">
<td>Pokok</td> <td>Pokok</td>
<td>:</td> <td>:</td>
<td><b>${'{:n}'.format(data.pokok)}</b></td> <td><b>${'{:n}'.format(jml_pokok)}</b></td>
</tr> </tr>
<tr class="borderless"> <tr class="borderless">
<td>Denda</td> <td>Denda</td>
<td>:</td> <td>:</td>
<td><b>${'{:n}'.format(data.denda)}</b></td> <td><b>${'{:n}'.format(jml_denda)}</b></td>
</tr> </tr>
<tr class="borderless"> <tr class="borderless">
<td>Jumlah</td> <td>Jumlah</td>
<td>:</td> <td>:</td>
<td><b>${'{:n}'.format(data.jumlah)}</b></td> <td><b>${'{:n}'.format(jml_bayar)}</b></td>
</tr> </tr>
</table> </table>
</td> </td>
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!