35 lines
654 B
JavaScript
35 lines
654 B
JavaScript
|
|
Hedera.Ticket = new Class
|
|
({
|
|
Extends: Hedera.Form
|
|
|
|
,onPrintClick: function (event)
|
|
{
|
|
var batch = new Sql.Batch ();
|
|
batch.addValue ('ticket', this.$('ticket-id').value);
|
|
this.gui.openReport ('delivery-note', batch);
|
|
}
|
|
|
|
,subtotalRenderer: function (column, form)
|
|
{
|
|
column.value = this.subtotal (form);
|
|
}
|
|
|
|
,repeaterFunc: function (res, form)
|
|
{
|
|
res.$('subtotal').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;
|
|
}
|
|
});
|
|
|