0
1
Fork 0

Discount is now displayed

This commit is contained in:
Juan 2018-08-30 15:26:05 +02:00
parent 1ade47299a
commit 03dd6f94e4
7 changed files with 63 additions and 61 deletions

2
debian/changelog vendored
View File

@ -1,4 +1,4 @@
hedera-web (1.406.17) stable; urgency=low hedera-web (1.406.18) stable; urgency=low
* Initial Release. * Initial Release.

View File

@ -81,6 +81,10 @@
{ {
color: #777; color: #777;
} }
.ticket .line > .info .discount
{
color: green;
}
.ticket .line > .info > .amount .ticket .line > .info > .amount
{ {
float: left; float: left;

View File

@ -1,52 +1,46 @@
Hedera.Ticket = new Class Hedera.Ticket = new Class({
({ Extends: Hedera.Form,
Extends: Hedera.Form
,onTicketChange: function (ticket) onTicketChange: function(ticket) {
{
if (!ticket.value) if (!ticket.value)
return; return;
var batch = new Sql.Batch (); var batch = new Sql.Batch();
batch.addValue ('ticket', ticket.value); batch.addValue('ticket', ticket.value);
this.conn.execQuery ('CALL myTicketLogAccess (#ticket)', null, batch); this.conn.execQuery('CALL myTicketLogAccess(#ticket)', null, batch);
} },
,onTicketReady: function (form) onTicketReady: function(form) {
{ if (form.get('method') != 'PICKUP')
if (form.get ('method') != 'PICKUP') Vn.Node.setText(this.$('method'), _('Agency'));
Vn.Node.setText (this.$('method'), _('Agency'));
else else
Vn.Node.setText (this.$('method'), _('Warehouse')); Vn.Node.setText(this.$('method'), _('Warehouse'));
} },
,onPrintClick: function () onPrintClick: function() {
{ var batch = new Sql.Batch();
var batch = new Sql.Batch (); batch.addValue('ticket', this.$('ticket-id').value);
batch.addValue ('ticket', this.$('ticket-id').value); this.gui.openReport('delivery-note', batch);
this.gui.openReport ('delivery-note', batch); },
}
,subtotalRenderer: function (column, form) repeaterFunc: function(res, form) {
{ var discount = res.$('discount');
column.value = this.subtotal (form); discount.style.display = form.get('discount') ? 'inline' : 'none';
} res.$('discount-subtotal').value = this.discountSubtotal(form);
res.$('subtotal').value = this.subtotal(form);
,repeaterFunc: function (res, form) },
{
res.$('subtotal').value = this.subtotal (form);
}
,subtotal: function (form) discountSubtotal: function(form) {
{ return form.get('quantity') * form.get('price');
var price = form.get ('price'); },
var discount = form.get ('discount');
return form.get ('quantity') * price * ((100 - discount) / 100);
}
,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 = this.$('packages').node.style.display =
model.numRows > 0 ? 'block' : 'none'; model.numRows > 0 ? 'block' : 'none';
} }

View File

@ -96,6 +96,10 @@
<htk-text form="iter" column="price" format="%.2d€"/> <htk-text form="iter" column="price" format="%.2d€"/>
</p> </p>
<p class="subtotal"> <p class="subtotal">
<span class="discount" id="discount">
<htk-text id="discount-subtotal" format="%.2d€"/> -
<htk-text form="iter" column="discount" format="%.0d%"/> =
</span>
<htk-text id="subtotal" format="%.2d€"/> <htk-text id="subtotal" format="%.2d€"/>
</p> </p>
</div> </div>

View File

@ -1,6 +1,6 @@
{ {
"name": "hedera-web", "name": "hedera-web",
"version": "1.406.17", "version": "1.406.18",
"description": "Verdnatura web page", "description": "Verdnatura web page",
"license": "GPL-3.0", "license": "GPL-3.0",
"repository": { "repository": {

View File

@ -1,30 +1,29 @@
Hedera.DeliveryNote = new Class Hedera.DeliveryNote = new Class({
({ Extends: Hedera.Report,
Extends: Hedera.Report
,onTicketReady: function (form) onTicketReady: function(form) {
{ if (form.get('method') != 'PICKUP')
if (form.get ('method') != 'PICKUP') Vn.Node.setText(this.$('method'), _('Agency'));
Vn.Node.setText (this.$('method'), _('Agency'));
else else
Vn.Node.setText (this.$('method'), _('Warehouse')); Vn.Node.setText(this.$('method'), _('Warehouse'));
} },
,subtotalRenderer: function (column, form) discountRenderer: function(column, form) {
{ column.value = form.get('discount') ? form.get('discount') : null;
column.value = this.subtotal (form); },
}
,subtotal: function (form) subtotalRenderer: function(column, form) {
{ column.value = this.subtotal(form);
var price = form.get ('price'); },
var discount = form.get ('discount');
return form.get ('quantity') * price * ((100 - discount) / 100); 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 = this.$('packages').node.style.display =
model.numRows > 0 ? 'block' : 'none'; model.numRows > 0 ? 'block' : 'none';
} }

View File

@ -46,6 +46,7 @@
<htk-column-text title="_S1" column="size"/> <htk-column-text title="_S1" column="size"/>
<htk-column-text title="_Cat" column="category"/> <htk-column-text title="_Cat" column="category"/>
<htk-column-spin title="_Price" column="price" unit="€" digits="2"/> <htk-column-spin title="_Price" column="price" unit="€" digits="2"/>
<htk-column-spin title="_Disc" column="discount" unit="%" renderer="discountRenderer"/>
<htk-column-spin title="_Subtotal" unit="€" digits="2" renderer="subtotalRenderer"/> <htk-column-spin title="_Subtotal" unit="€" digits="2" renderer="subtotalRenderer"/>
</htk-grid> </htk-grid>
<p class="footer important"> <p class="footer important">