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.

View File

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

View File

@ -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);
}
},
,onTicketReady: function (form)
{
onTicketReady: function(form) {
if (form.get('method') != 'PICKUP')
Vn.Node.setText(this.$('method'), _('Agency'));
else
Vn.Node.setText(this.$('method'), _('Warehouse'));
}
},
,onPrintClick: function ()
{
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)
{
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');
discountSubtotal: function(form) {
return form.get('quantity') * form.get('price');
},
subtotal: function(form) {
var discount = form.get('discount');
return form.get ('quantity') * price * ((100 - discount) / 100);
}
return this.discountSubtotal(form) * ((100 - discount) / 100);
},
,onPackagesChanged: function (model)
{
onPackagesChanged: function(model) {
this.$('packages').node.style.display =
model.numRows > 0 ? 'block' : 'none';
}

View File

@ -96,6 +96,10 @@
<htk-text form="iter" column="price" format="%.2d€"/>
</p>
<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€"/>
</p>
</div>

View File

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

View File

@ -1,30 +1,29 @@
Hedera.DeliveryNote = new Class
({
Extends: Hedera.Report
Hedera.DeliveryNote = new Class({
Extends: Hedera.Report,
,onTicketReady: function (form)
{
onTicketReady: function(form) {
if (form.get('method') != 'PICKUP')
Vn.Node.setText(this.$('method'), _('Agency'));
else
Vn.Node.setText(this.$('method'), _('Warehouse'));
}
},
,subtotalRenderer: function (column, form)
{
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)
{
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';
}

View File

@ -46,6 +46,7 @@
<htk-column-text title="_S1" column="size"/>
<htk-column-text title="_Cat" column="category"/>
<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-grid>
<p class="footer important">