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);
	},
	
	onPackagesChanged: function(model) {
		this.$('packages').node.style.display =
			model.numRows > 0 ? 'block' : 'none';
	}
});