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

55 lines
1.1 KiB
JavaScript
Raw Normal View History

2016-09-26 09:28:47 +00:00
Hedera.Ticket = new Class
({
2016-09-26 09:28:47 +00:00
Extends: Hedera.Form
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);
2018-01-02 13:16:41 +00:00
this.conn.execQuery ('CALL myTicketLogAccess (#ticket)', null, batch);
2016-10-27 11:22:04 +00:00
}
2018-02-06 08:57:05 +00:00
,onTicketReady: function (form)
{
if (form.get ('method') != 'PICKUP')
Vn.Node.setText (this.$('method'), _('Agency'));
else
Vn.Node.setText (this.$('method'), _('Warehouse'));
}
2018-01-02 13:16:41 +00:00
,onPrintClick: function ()
{
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);
}
,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');
2018-01-02 13:16:41 +00:00
return form.get ('quantity') * price * ((100 - discount) / 100);
}
2018-01-05 12:57:35 +00:00
,onPackagesChanged: function (model)
{
this.$('packages').node.style.display =
model.numRows > 0 ? 'block' : 'none';
}
});