Commit 18081b14 by suri

update add ke bjbva

1 parent bd3213d1
......@@ -92,6 +92,56 @@ class AddSchema(colander.Schema):
oid = "amount",
title="Amount")
class AddParamsSchema(colander.Schema):
client_type = colander.SchemaNode(
colander.Integer(),
widget = widget.HiddenWidget(),
default = 3,
oid = "client_type",
title="")
product_code = colander.SchemaNode(
colander.String(),
widget = widget.HiddenWidget(),
default = 99,
oid = "product_code",
title="")
invoice_no = colander.SchemaNode(
colander.String(),
validator=colander.Length(max=16),
oid = "invoice_no",
title="Kode Bayar")
description = colander.SchemaNode(
colander.String(),
widget=widget.TextAreaWidget(rows=6),
validator=colander.Length(max=128),
oid = "description",)
customer_name = colander.SchemaNode(
colander.String(),
validator=colander.Length(max=64),
oid = "customer_name",
title="Customer Name")
customer_email = colander.SchemaNode(
colander.String(),
validator=colander.Length(max=128),
oid = "customer_email",
title="Customer Email")
customer_phone = colander.SchemaNode(
colander.String(),
validator=colander.Length(max=32),
oid = "customer_phone",
title="Customer Phone")
expired_date = colander.SchemaNode(
colander.String(),
widget=widget.TextInputWidget(css_class="input-date"),
oid = "expired_date",
default = ymdhms(datetime.now()),
title="Expired Date")
amount = colander.SchemaNode(
colander.Integer(),
oid = "amount",
title="Amount")
class EditSchema(AddSchema):
invoice_no = colander.SchemaNode(
......@@ -249,7 +299,10 @@ class view(object):
request = self.req
params = request.params
form = get_form(request, AddSchema)
row_invoice = q_inv(params['no_invoice']).first()
if 'no_invoice' in params and params['no_invoice']:
row_invoice = q_inv(params['no_invoice']).first()
else:
row_invoice = 0
# ArInvoice.departemen_id==request.session['departemen_id'])
......@@ -277,7 +330,8 @@ class view(object):
elif SESS_ADD_FAILED in request.session:
return session_failed(request, SESS_ADD_FAILED)
if row_invoice:
if row_invoice!=0:
form = get_form(request, AddParamsSchema)
pokok, denda = calculate_tagihan(dict(pokok = row_invoice.jumlah,jatuh_tempo=row_invoice.jatuh_tempo))
print ("++++++++++++++++++++++++++", str(row_invoice.description))
values = {}
......
......@@ -103,9 +103,7 @@
</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>
</div> <!-- /metal:script -->
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!