Commit 55a4a125 by aagusti

Merge branch 'master' of https://git.opensipkd.com/taufik/esipkd

2 parents 13027031 45fa3197
......@@ -92,6 +92,58 @@ 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 = "01", #30,
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(
colander.String(),
......@@ -249,7 +301,10 @@ class view(object):
request = self.req
params = request.params
form = get_form(request, AddSchema)
if 'no_invoice' in params and params['no_invoice']:
row_invoice = q_inv(params['no_invoice']).first()
else:
row_invoice = 0
if request.POST:
if 'simpan' in request.POST:
......@@ -273,20 +328,23 @@ 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))
values = {}
values['invoice_no']=row_invoice.kode
values['description']=row_invoice.description
values['invoice_no']=str(row_invoice.kode)
values['description']=str(row_invoice.description)
values['customer_name']=row_invoice.subjek_nama
values['customer_email']=row_invoice.subjek_email and row_invoice.subjek_email or '-'
values['customer_phone']=row_invoice.subjek_phone and row_invoice.subjek_phone or '-'
values['expired_date']=ymdhms(datetime.combine(date.today(),time(23,59,59)))
values['amount']=(pokok + denda)
else:
alues = {}
form.set_appstruct(values)
return dict(form=form, invoice_no=params['no_invoice'])
else:
values = {}
form.set_appstruct(values)
return dict(form=form)
##########
......
......@@ -93,6 +93,56 @@ class AddSchema(colander.Schema):
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(
colander.String(),
......@@ -249,7 +299,10 @@ class view(object):
request = self.req
params = request.params
form = get_form(request, AddSchema)
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 = {}
......
......@@ -253,7 +253,7 @@
$('#btn_qris').click(function () {
if (mKD) {
window.location = oFormUrli+'/bjbqris/add?no_invoice='+mKD;
window.location = oFormUrli+'bjbqris/add?no_invoice='+mKD;
} else {
alert('Silahkan pilih data yang akan tambah QRIS');
}
......
......@@ -45,7 +45,7 @@
$('.input-date').datetimepicker({
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({
ajax: {
url: '/bjbqris/kodebayar/act',
......
......@@ -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!