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.

View File

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

View File

@ -44,18 +44,10 @@
</db-model>
<db-model id="item-lots" result-index="1" on-status-changed-after="onStatusChange">
CALL bionic_from_item (#item);
SELECT p.warehouse_id, p.grouping, p.price, p.rate,
t.amount, l.available - IFNULL(t.amount, 0) available
SELECT p.warehouse_id, p.grouping, p.price, p.rate, l.available
FROM tmp.bionic_lot l
JOIN tmp.bionic_price p
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;
<sql-batch property="batch" id="lots-batch"/>
</db-model>