hedera-web/reports/delivery-note/delivery-note.js

40 lines
935 B
JavaScript

Hedera.DeliveryNote = new Class({
Extends: Hedera.Report,
onTicketReady: function(form) {
if (form.$.method != 'PICKUP')
Vn.Node.setText(this.$.method, _('Agency'));
else
Vn.Node.setText(this.$.method, _('Warehouse'));
},
discountRenderer: function(column, form) {
column.value = form.$.discount ? form.$.discount : null;
},
subtotalRenderer: function(column, form) {
column.value = this.subtotal(form);
},
subtotal: function(form) {
var price = form.$.price;
var discount = form.$.discount;
return form.$.quantity * price *((100 - discount) / 100);
},
serviceSubtotal: function(column, form) {
column.value = form.$.quantity * form.$.price;
},
onServicesChanged: function(model) {
this.$.services.node.style.display =
model.numRows > 0 ? 'block' : 'none';
},
onPackagesChanged: function(model) {
this.$.packages.node.style.display =
model.numRows > 0 ? 'block' : 'none';
}
});