From 03dd6f94e48c68b759ec338577a57bd1798e63b1 Mon Sep 17 00:00:00 2001
From: Juan
Date: Thu, 30 Aug 2018 15:26:05 +0200
Subject: [PATCH] Discount is now displayed
---
debian/changelog | 2 +-
forms/ecomerce/ticket/style.css | 4 ++
forms/ecomerce/ticket/ticket.js | 70 ++++++++++++--------------
forms/ecomerce/ticket/ui.xml | 4 ++
package.json | 2 +-
reports/delivery-note/delivery-note.js | 41 ++++++++-------
reports/delivery-note/ui.xml | 1 +
7 files changed, 63 insertions(+), 61 deletions(-)
diff --git a/debian/changelog b/debian/changelog
index e3463cb9..eec1ecb6 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,4 +1,4 @@
-hedera-web (1.406.17) stable; urgency=low
+hedera-web (1.406.18) stable; urgency=low
* Initial Release.
diff --git a/forms/ecomerce/ticket/style.css b/forms/ecomerce/ticket/style.css
index 850f6bfd..9fecbb6f 100644
--- a/forms/ecomerce/ticket/style.css
+++ b/forms/ecomerce/ticket/style.css
@@ -81,6 +81,10 @@
{
color: #777;
}
+.ticket .line > .info .discount
+{
+ color: green;
+}
.ticket .line > .info > .amount
{
float: left;
diff --git a/forms/ecomerce/ticket/ticket.js b/forms/ecomerce/ticket/ticket.js
index 395f64c1..11360995 100644
--- a/forms/ecomerce/ticket/ticket.js
+++ b/forms/ecomerce/ticket/ticket.js
@@ -1,52 +1,46 @@
-Hedera.Ticket = new Class
-({
- Extends: Hedera.Form
+Hedera.Ticket = new Class({
+ Extends: Hedera.Form,
- ,onTicketChange: function (ticket)
- {
+ onTicketChange: function(ticket) {
if (!ticket.value)
return;
- var batch = new Sql.Batch ();
- batch.addValue ('ticket', ticket.value);
- this.conn.execQuery ('CALL myTicketLogAccess (#ticket)', null, batch);
- }
+ var batch = new Sql.Batch();
+ batch.addValue('ticket', ticket.value);
+ this.conn.execQuery('CALL myTicketLogAccess(#ticket)', null, batch);
+ },
- ,onTicketReady: function (form)
- {
- if (form.get ('method') != 'PICKUP')
- Vn.Node.setText (this.$('method'), _('Agency'));
+ onTicketReady: function(form) {
+ if (form.get('method') != 'PICKUP')
+ Vn.Node.setText(this.$('method'), _('Agency'));
else
- Vn.Node.setText (this.$('method'), _('Warehouse'));
- }
+ Vn.Node.setText(this.$('method'), _('Warehouse'));
+ },
- ,onPrintClick: function ()
- {
- var batch = new Sql.Batch ();
- batch.addValue ('ticket', this.$('ticket-id').value);
- this.gui.openReport ('delivery-note', batch);
- }
+ onPrintClick: function() {
+ 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);
- }
+ repeaterFunc: function(res, form) {
+ var discount = res.$('discount');
+ discount.style.display = form.get('discount') ? 'inline' : 'none';
+ res.$('discount-subtotal').value = this.discountSubtotal(form);
+ res.$('subtotal').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);
- }
+ discountSubtotal: function(form) {
+ return form.get('quantity') * form.get('price');
+ },
- ,onPackagesChanged: function (model)
- {
+ subtotal: function(form) {
+ var discount = form.get('discount');
+ return this.discountSubtotal(form) * ((100 - discount) / 100);
+ },
+
+ onPackagesChanged: function(model) {
this.$('packages').node.style.display =
model.numRows > 0 ? 'block' : 'none';
}
diff --git a/forms/ecomerce/ticket/ui.xml b/forms/ecomerce/ticket/ui.xml
index 4132a4b8..97f03ce2 100644
--- a/forms/ecomerce/ticket/ui.xml
+++ b/forms/ecomerce/ticket/ui.xml
@@ -96,6 +96,10 @@
+
+ -
+ =
+
diff --git a/package.json b/package.json
index 2986ec43..9a14553c 100644
--- a/package.json
+++ b/package.json
@@ -1,6 +1,6 @@
{
"name": "hedera-web",
- "version": "1.406.17",
+ "version": "1.406.18",
"description": "Verdnatura web page",
"license": "GPL-3.0",
"repository": {
diff --git a/reports/delivery-note/delivery-note.js b/reports/delivery-note/delivery-note.js
index 9b0d01a0..db24e0c7 100644
--- a/reports/delivery-note/delivery-note.js
+++ b/reports/delivery-note/delivery-note.js
@@ -1,30 +1,29 @@
-Hedera.DeliveryNote = new Class
-({
- Extends: Hedera.Report
+Hedera.DeliveryNote = new Class({
+ Extends: Hedera.Report,
- ,onTicketReady: function (form)
- {
- if (form.get ('method') != 'PICKUP')
- Vn.Node.setText (this.$('method'), _('Agency'));
+ onTicketReady: function(form) {
+ if (form.get('method') != 'PICKUP')
+ Vn.Node.setText(this.$('method'), _('Agency'));
else
- Vn.Node.setText (this.$('method'), _('Warehouse'));
- }
+ Vn.Node.setText(this.$('method'), _('Warehouse'));
+ },
- ,subtotalRenderer: function (column, form)
- {
- column.value = this.subtotal (form);
- }
+ discountRenderer: function(column, form) {
+ column.value = form.get('discount') ? form.get('discount') : null;
+ },
- ,subtotal: function (form)
- {
- var price = form.get ('price');
- var discount = form.get ('discount');
- return form.get ('quantity') * price * ((100 - discount) / 100);
- }
+ 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)
- {
+ onPackagesChanged: function(model) {
this.$('packages').node.style.display =
model.numRows > 0 ? 'block' : 'none';
}
diff --git a/reports/delivery-note/ui.xml b/reports/delivery-note/ui.xml
index 16189ecb..c6c8357e 100644
--- a/reports/delivery-note/ui.xml
+++ b/reports/delivery-note/ui.xml
@@ -46,6 +46,7 @@
+