2015-01-23 13:09:30 +00:00
|
|
|
|
2016-09-26 09:28:47 +00:00
|
|
|
Hedera.Ticket = new Class
|
2015-01-23 13:09:30 +00:00
|
|
|
({
|
2016-09-26 09:28:47 +00:00
|
|
|
Extends: Hedera.Form
|
2015-01-23 13:09:30 +00:00
|
|
|
|
2016-10-27 11:22:04 +00:00
|
|
|
,onTicketChange: function (ticket)
|
|
|
|
{
|
|
|
|
if (!ticket.value)
|
|
|
|
return;
|
|
|
|
|
|
|
|
var batch = new Sql.Batch ();
|
|
|
|
batch.addValue ('ticket', ticket.value);
|
2017-03-17 12:42:10 +00:00
|
|
|
this.conn.execQuery ('CALL clientTicketLog (#ticket)', null, batch);
|
2016-10-27 11:22:04 +00:00
|
|
|
}
|
|
|
|
|
2017-03-17 12:42:10 +00:00
|
|
|
,onPrintClick: function ()
|
2015-01-23 13:09:30 +00:00
|
|
|
{
|
2017-04-08 11:42:27 +00:00
|
|
|
var params = {ticket: this.hash.get ('ticket')};
|
2017-03-23 16:20:51 +00:00
|
|
|
this.gui.openReport ('delivery-note', params);
|
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;
|
|
|
|
}
|
|
|
|
});
|
|
|
|
|