0
1
Fork 0
hedera-web-mindshore/web/forms/ecomerce/ticket/ticket.js

38 lines
834 B
JavaScript
Raw Normal View History

Vn.Ticket = new Class
({
Extends: Vn.Module
,activate: function ()
{
2015-03-06 23:33:54 +00:00
this.$('print').addEventListener ('click', this.printClicked.bind (this));
this.$('subtotal').renderer = this.subtotalRenderer.bind (this);
this.$('ticket-subtotal').func = this.subtotal;
}
,printClicked: function (event)
{
var report = window.open ('', 'report',
'resizable=yes,height=600,width=750,scrollbars=yes,menubar=no');
2015-03-07 00:56:24 +00:00
report.document.body.innerHTML = this.$('report').innerHTML;
report.print ();
}
,subtotalRenderer: function (column, form)
{
column.value = this.subtotal (form);
}
,subtotal: function (form)
{
var price = form.get ('price');
var discount = form.get ('discount');
if (price && form.get ('fixed'))
return form.get ('amount') * price * ((100 - discount) / 100);
else
return null;
}
});