Commit 715562db by suri

cetak skrd dengan no va dan qris dan update add with param no bayar

1 parent 82483bff
No preview for this file type
...@@ -51,6 +51,9 @@ from daftar import (STATUS, deferred_status, ...@@ -51,6 +51,9 @@ from daftar import (STATUS, deferred_status,
) )
from ..models.bjb_qris import BJBQRIS
from ..models.bjb_va import BJBVA
SESS_ADD_FAILED = 'Gagal tambah Tagihan' SESS_ADD_FAILED = 'Gagal tambah Tagihan'
SESS_EDIT_FAILED = 'Gagal edit Tagihan' SESS_EDIT_FAILED = 'Gagal edit Tagihan'
log = logging.getLogger(__name__) log = logging.getLogger(__name__)
...@@ -915,6 +918,30 @@ def view_pdf(request): ...@@ -915,6 +918,30 @@ def view_pdf(request):
imgqrcode.save(path, 'PNG') imgqrcode.save(path, 'PNG')
item.qrcode = open(path, 'rb').read() item.qrcode = open(path, 'rb').read()
# ---------------------------- untuk tambah qris---------------------
no_bayar = row.kode
qris = DBSession.query(BJBQRIS).join(ARInvoice, ARInvoice.kode==BJBQRIS.invoice_no).\
filter(BJBQRIS.invoice_no==no_bayar).first()
from ..tools import get_tmp
if qris:
img_qr = qrcode.make(str(qris.qrcode))
path = get_tmp() + str(qris.va_number)
img_qr.save(path, 'PNG')
item.qris = open(path, 'rb').read()
else:
item.qris=''
# -----------------------------------------------------------------------
# ---------------------------- untuk tambah va---------------------
qva = DBSession.query(BJBVA).join(ARInvoice, ARInvoice.kode==BJBVA.invoice_no).\
filter(BJBVA.invoice_no==no_bayar).first()
if qva:
item.qva = qva.va_number
else:
item.qva=''
# -----------------------------------------------------------------------
data = {} data = {}
data['item'] = item data['item'] = item
template.render(data) template.render(data)
......
...@@ -91,6 +91,7 @@ class AddSchema(colander.Schema): ...@@ -91,6 +91,7 @@ class AddSchema(colander.Schema):
colander.Integer(), colander.Integer(),
oid = "amount", oid = "amount",
title="Amount") title="Amount")
class EditSchema(AddSchema): class EditSchema(AddSchema):
invoice_no = colander.SchemaNode( invoice_no = colander.SchemaNode(
...@@ -289,10 +290,12 @@ class view(object): ...@@ -289,10 +290,12 @@ class view(object):
values['amount']=(pokok + denda) values['amount']=(pokok + denda)
print ('---------------------------------', values) print ('---------------------------------', values)
form.set_appstruct(values)
return dict(form=form, invoice_no=params['no_invoice'])
else: else:
values = {} values = {}
form.set_appstruct(values) form.set_appstruct(values)
return dict(form=form) return dict(form=form)
######## ########
......
...@@ -44,7 +44,7 @@ ...@@ -44,7 +44,7 @@
$('.input-date').datetimepicker({ $('.input-date').datetimepicker({
format: "yyyy-mm-dd hh:ii:ss" format: "yyyy-mm-dd hh:ii:ss"
}); });
<tal:block tal:condition="not 'id' in request.matchdict"> <tal:block tal:condition="not 'id' in request.matchdict and not 'no_invoice' in request.params">
$('#invoice_no').select2({ $('#invoice_no').select2({
ajax: { ajax: {
url: '/bjbva/kodebayar/act', url: '/bjbva/kodebayar/act',
...@@ -101,6 +101,11 @@ ...@@ -101,6 +101,11 @@
$('#response_code').prop('readonly', true); $('#response_code').prop('readonly', true);
$('#response_message').prop('readonly', true); $('#response_message').prop('readonly', true);
</tal:block> </tal:block>
<tal:block tal:condition="'no_invoice' in request.params and request.params['no_invoice']">
$('#invoice_no').select2('data', {id: {invoice_no}, value: {invoice_no}});
</tal:block>
}); });
</script> </script>
</div> <!-- /metal:script --> </div> <!-- /metal:script -->
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!