43 lines
776 B
JavaScript
43 lines
776 B
JavaScript
|
|
Hedera.Ticket = new Class
|
|
({
|
|
Extends: Hedera.Form
|
|
|
|
,onTicketChange: function (ticket)
|
|
{
|
|
if (!ticket.value)
|
|
return;
|
|
|
|
var batch = new Sql.Batch ();
|
|
batch.addValue ('ticket', ticket.value);
|
|
this.conn.execQuery ('CALL clientTicketLog (#ticket)', null, batch);
|
|
}
|
|
|
|
,onPrintClick: function ()
|
|
{
|
|
var params = {ticket: this.hash.get ('ticket')};
|
|
this.gui.openReport ('delivery-note', params);
|
|
}
|
|
|
|
,subtotalRenderer: function (column, form)
|
|
{
|
|
column.value = this.subtotal (form);
|
|
}
|
|
|
|
,repeaterFunc: function (scope, form)
|
|
{
|
|
scope.$.subtotal.value = this.subtotal (form);
|
|
}
|
|
|
|
,subtotal: function (form)
|
|
{
|
|
var row = form.$;
|
|
|
|
if (row.price && row.fixed)
|
|
return row.amount * row.price * ((100 - row.discount) / 100);
|
|
else
|
|
return null;
|
|
}
|
|
});
|
|
|