Ahora el disponible tiene en cuenta la tabla order_row

This commit is contained in:
Juan Ferrer Toribio 2015-10-14 17:02:06 +02:00
parent 75e7d58479
commit ee7c7c262f
3 changed files with 12 additions and 16 deletions

2
debian/changelog vendored
View File

@ -1,4 +1,4 @@
hedera-web (1.229-deb8) stable; urgency=low hedera-web (1.230-deb8) stable; urgency=low
* Initial Release. * Initial Release.

View File

@ -244,18 +244,22 @@ Vn.Catalog = new Class
var model = this.$('item-lots'); var model = this.$('item-lots');
var grouping = model.get (row, 'grouping'); var grouping = model.get (row, 'grouping');
var warehouse = model.get (row, 'warehouse_id'); var warehouse = model.get (row, 'warehouse_id');
var available = model.get (row, 'available');
var lotAmount = this.items[warehouse]; var lotAmount = this.items[warehouse];
if (lotAmount === undefined) if (lotAmount === undefined)
lotAmount = 0; lotAmount = 0;
lotAmount += grouping; if (lotAmount < available)
if (lotAmount <= model.get (row, 'available'))
{ {
this.items[warehouse] = lotAmount; var newAmount = lotAmount + grouping;
this.$('amount').value += grouping;
if (newAmount > available)
newAmount = available;
this.items[warehouse] = newAmount;
this.$('amount').value += newAmount - lotAmount;
} }
else else
Htk.Toast.showError (_('NoMoreAmountAvailable')); Htk.Toast.showError (_('NoMoreAmountAvailable'));

View File

@ -44,18 +44,10 @@
</db-model> </db-model>
<db-model id="item-lots" result-index="1" on-status-changed-after="onStatusChange"> <db-model id="item-lots" result-index="1" on-status-changed-after="onStatusChange">
CALL bionic_from_item (#item); CALL bionic_from_item (#item);
SELECT p.warehouse_id, p.grouping, p.price, p.rate, SELECT p.warehouse_id, p.grouping, p.price, p.rate, l.available
t.amount, l.available - IFNULL(t.amount, 0) available
FROM tmp.bionic_lot l FROM tmp.bionic_lot l
JOIN tmp.bionic_price p JOIN tmp.bionic_price p
ON p.warehouse_id = l.warehouse_id ON p.warehouse_id = l.warehouse_id
LEFT JOIN (
SELECT warehouse_id, SUM(amount) amount
FROM basket_item
WHERE item_id = #item
GROUP BY warehouse_id
) t
ON t.warehouse_id = l.warehouse_id
ORDER BY warehouse_id, grouping; ORDER BY warehouse_id, grouping;
<sql-batch property="batch" id="lots-batch"/> <sql-batch property="batch" id="lots-batch"/>
</db-model> </db-model>