Ahora el disponible tiene en cuenta la tabla order_row
This commit is contained in:
parent
75e7d58479
commit
ee7c7c262f
|
@ -1,4 +1,4 @@
|
||||||
hedera-web (1.229-deb8) stable; urgency=low
|
hedera-web (1.230-deb8) stable; urgency=low
|
||||||
|
|
||||||
* Initial Release.
|
* Initial Release.
|
||||||
|
|
||||||
|
|
|
@ -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'));
|
||||||
|
|
|
@ -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>
|
||||||
|
|
Loading…
Reference in New Issue