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

40 lines
975 B
JavaScript

Hedera.DeliveryNote = new Class({
Extends: Hedera.Report,
onTicketReady: function(form) {
if (form.get('method') != 'PICKUP')
Vn.Node.setText(this.$.method, _('Agency'));
else
Vn.Node.setText(this.$.method, _('Warehouse'));
},
discountRenderer: function(column, form) {
column.value = form.get('discount') ? form.get('discount') : null;
},
subtotalRenderer: function(column, form) {
column.value = this.subtotal(form);
},
subtotal: function(form) {
var price = form.get('price');
var discount = form.get('discount');
return form.get('quantity') * price *((100 - discount) / 100);
},
serviceSubtotal: function(column, form) {
column.value = form.get('quantity') * form.get('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';
}
});