Holaaa
ES: Me gustaría que me ayudaras a resolver esto, por favor:
EN (Google Translate): I would like you to help me solve this, please:

ES: Lo que necesito es que cuando se agregan los mismos productos, que no se agreguen nuevos, sino que la Cantidad aumente.
EN: What I need is that when the same products are added, that no new ones are added, but that the Quantity increases.
ES: Este es el código que tengo para ingresar productos por código de barras:
EN:This is the code I have to enter products by barcode:
ES: La idea final sería que aumente la cantidad y no un nuevo registro cuando se agregan los mismos productos.
EN: The final idea would be that the quantity increases and not a new record when the same products are added.
Thanks.
ES: Me gustaría que me ayudaras a resolver esto, por favor:
EN (Google Translate): I would like you to help me solve this, please:
ES: Lo que necesito es que cuando se agregan los mismos productos, que no se agreguen nuevos, sino que la Cantidad aumente.
EN: What I need is that when the same products are added, that no new ones are added, but that the Quantity increases.
ES: Este es el código que tengo para ingresar productos por código de barras:
EN:This is the code I have to enter products by barcode:
b = Input.GetText("barcode");
if b > "1000000" and b <= "9999999" then
for row in db:nrows("SELECT * FROM Products where Code="..b.."") do
if b == (row.Code) then
Input.SetText("barcode", "");
Page.SetFocus("barcode")
nRowID = Grid.InsertRow("GridSales", -1, false);
Grid.SetCellText("GridSales", nRowID, 0, row.Code, false);
Grid.SetCellText("GridSales", nRowID, 1, row.Name, false);
Grid.SetCellText("GridSales", nRowID, 2, row.SalePrice, false);
Grid.SetCellText("GridSales", nRowID, 3, "1", false);
Grid.SetCellText("GridSales", nRowID, 4, "0", false);
--Multiplica le Valor * Cantidad
value = Grid.GetCellText("GridSales", nRowID, 2);
quantity = Grid.GetCellText("GridSales", nRowID, 3);
multi = value * quantity;
Grid.SetCellText("GridSales", nRowID, 4, multi, true);
--Suma toda la Columna 4
cell_value = 0;
for x = 1, Grid.GetRowCount ("GridSales")-1 do
if Grid.GetCellText ("GridSales", x, 4) ~= "" and String.ToNumber(Grid.GetCellText ("GridSales", x, 4)) ~= 0 then
cell_value = cell_value + String.ToNumber (Grid.GetCellText ("GridSales", x, 4))
end
end
Input.SetText("total", Math.Round(cell_value, false));
--************************************************** ********************************
Grid.Refresh("GridSales");
--************************************************** *******************************
end
end
end
EN: The final idea would be that the quantity increases and not a new record when the same products are added.
Thanks.