2015-01-23 13:09:30 +00:00
|
|
|
|
|
|
|
Vn.Ticket = new Class
|
|
|
|
({
|
2015-11-17 10:34:33 +00:00
|
|
|
Extends: Vn.Form
|
2015-01-23 13:09:30 +00:00
|
|
|
|
2015-11-19 13:57:23 +00:00
|
|
|
,onPrintClick: function (event)
|
2015-01-23 13:09:30 +00:00
|
|
|
{
|
2015-11-19 13:57:23 +00:00
|
|
|
var batch = new Sql.Batch ();
|
|
|
|
batch.addValue ('ticket', this.$('ticket-id').value);
|
|
|
|
this.gui.openReport ('delivery-note', batch);
|
2015-01-23 13:09:30 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
,subtotalRenderer: function (column, form)
|
|
|
|
{
|
|
|
|
column.value = this.subtotal (form);
|
|
|
|
}
|
2015-11-26 12:30:04 +00:00
|
|
|
|
|
|
|
,repeaterFunc: function (res, form)
|
|
|
|
{
|
|
|
|
res.$('subtotal').value = this.subtotal (form);
|
|
|
|
}
|
2015-01-23 13:09:30 +00:00
|
|
|
|
|
|
|
,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;
|
|
|
|
}
|
|
|
|
});
|
|
|
|
|