did I understand you correctly?
in current WP:
Consumption = today odrer*recipe
that is, throughout the day, does it each time count all the orders for today and compare them with recipes?
did I understand you correctly?
in current WP:
Consumption = today odrer*recipe
that is, throughout the day, does it each time count all the orders for today and compare them with recipes?
No thatās not what I said. Iāll have to look up conversations we had with Emre to be sure.
What do you mean with jscript? You can use report tags you wouldnāt need jscript.
Consumption would be based off the multiplier in the recipe yes. It will consume an amount even if you made no purchases.
It would be better if you let us know what your trying to do.
What do you mean with jscript? You can use report tags you wouldnāt need jscript.
I want to make a setting now that does not allow to sell goods which are not in stock.
like āout of stockā
only not for direct products like ācola = colaā.
and which, with the help of scripts, checked the recipe and issued a warning when some ingredient ended.
Thatās been done already. There are tutorials for it.
constantly use search.
but did not find the instruction in which this function was made. with the condition that in the recipe more than one ingredient.
if I missed something, please tell me how to find it.
Itās there I know Rickh used it. You may be searching the wrong terms. Iām busy atm or I would.
Let me get home and Ill copy and paste few bits
So you can create new rule with Event Name: Order Added to Ticket.
You can add something similar to this line to your custom constraint.
[=TN('{REPORT INVENTORY:{ITEM TAG:Alert}:Local Warehouse}')-TN('{TICKET ORDER QUANTITY TOTAL EXP:(MN=[:MenuItemName]) && (OS.Status=New)}')]
What happens (actions) when your constraint is true is up to you. Mine just shows āYou have less that x amount of Coke in stockā
P.S. This is for ārealtimeā counting of the inventory stock items. If you are running these across several terminals + several warehouses you might need a really strong server to handle that otherwise you will experience a drop in performance.
As far as Ive tried and seen inventory consumption details like C.Name, C.Unit, C.Prediction tags pull info from the EODR.
In my experience when you listed them with @ and change the date filter this week it would give you every single item from every single end of day record within that date range. Now I might have been doing something wrong but thatās what I got and thats why I think it works that way.
this only works for single ingredient recipes.
I also need a multi-ingredient recipe to check.
Well I copied what I use in some of my setups in case it helps you, its up to you to build something on top of that.
Hi @bezdelmax Iāve been off for a while Iāll check my system and show your my config for stopping OOS items being added to the ticket
thank you, but not relevant.
messages from Emre, this is a repository of undeclared functions. LOL
Now I do not use the general search, I am only looking for messages from Emre.
System setup went faster)
Very relevant I would have thought as I have a setup that does exactly what you have asked above, but no worries
A list of undeclared functions is only so much use without real world in use examples but hayho
What do you mean messages from Emre?
@bezdelmax this can probably be done but it will be a very complex script and personally I donāt have the time right now to write that. I may attempt it this weekend if I find the time.
Very relevant
relevant = actual, topical (sorry, google translate )
The point is that I had a problem when sambapos Inventory item was <= 0, but in fact such a inventory item was still in stock.
When the waiter added an order in which such a item was present, the cost of product was displayed incorrectly.
answer āWhere current WP data stored?ā was only part of the task of solving this problem.
I wanted to make it so that when the waiter added the order, the missing product was automatically added to the warehouse.
What do you mean messages from Emre?
Well, for example, in my bookmarks, I already have a message from Emre (REPORT CONSUMPTION Tag: Low Inventory Condition? - #19 by emre)
(Warehouse Report select specific warehouse - #14 by emre)
where used ā:C.GetPhysicalInventory() < 5}ā and ā(PCW=SHOP)ā expression.
it made my task much easier.
i created retarded script (Iām not a programmer) who solved the problem.
Rule āAfter Ticket Closingā:
{CALL:outofstock.run(ā{REPORT CONSUMPTION DETAILS:I.Id,C.Inventory,C.Cost:(PCW=Local Warehouse) and C.GetPhysicalInventory() < 0}ā)}
function run(par){
// number of data lines
var rowlen = par.split('<!rn>').length;
//split data
var row = par.split('<!rn>');
var cell1 = row[0].split('|');
var id1 = cell1[0];
if (rowlen >= 1 && id1 >= 1){
//create transaction document
var qry = "";
qry += "INSERT INTO [InventoryTransactionDocuments] ([Date],[InventoryDocumentTransactionTypeId],[TransactionAccountTransactionTypeId],[AccountTypeId],[AccountId],[Description],[ForeignCurrencyId],[Name],[AccountTransactionDocument_Id])";
qry += " VALUES (GETDATE(),'0','0','0','0',null,'0','Š°Š²ŃŠ¾ Š½Š°Š“Š»ŠøŃŠ¾Šŗ',null)";
qry += " DECLARE @transactionid nvarchar(10)";
qry += " SET @transactionid = (SELECT TOP (1) [Id] FROM [InventoryTransactionDocuments] ORDER BY [ID] DESC)";
// create first transaction
var q1 = cell1[1].replace(',','.');
var cost1 = cell1[2].replace(',','.');
qry += " DECLARE @unit1 varchar(5)";
qry += " SET @unit1 = (SELECT [BaseUnit] FROM [InventoryItems] WHERE [Id] = '"+id1+"')";
qry += " INSERT INTO [InventoryTransactions] ([InventoryTransactionDocumentId],[InventoryTransactionTypeId],[SourceWarehouseId],[TargetWarehouseId],[Date],[Unit],[Multiplier],[Quantity],[TotalPrice],[ExchangeRate],[InventoryItem_Id])";
qry += " VALUES (@transactionid,'1003','3','1',GETDATE(),@unit1,1,-1*"+q1+",-1*"+q1+"*"+cost1+",1,'"+id1+"')";
}
//creating second and subsequent transactions
f (rowlen >= 2){
var cell2 = row[1].split('|');
var id2 = cell2[0];
var q2 = cell2[1].replace(',','.');
var cost2 = cell2[2].replace(',','.');
qry += " DECLARE @unit2 varchar(5)";
qry += " SET @unit2 = (SELECT [BaseUnit] FROM [InventoryItems] WHERE [Id] = '"+id2+"')";
qry += " INSERT INTO [InventoryTransactions] ([InventoryTransactionDocumentId],[InventoryTransactionTypeId],[SourceWarehouseId],[TargetWarehouseId],[Date],[Unit],[Multiplier],[Quantity],[TotalPrice],[ExchangeRate],[InventoryItem_Id])";
qry += " VALUES (@transactionid,'1003','3','1',GETDATE(),@unit2,1,-1*"+q2+",-1*"+q2+"*"+cost2+",1,'"+id2+"')"; }
if (rowlen >= 3){
var cell3 = row[2].split('|');
var id3 = cell3[0];
var q3 = cell3[1].replace(',','.');
var cost3 = cell3[2].replace(',','.');
qry += " DECLARE @unit3 varchar(5)";
qry += " SET @unit3 = (SELECT [BaseUnit] FROM [InventoryItems] WHERE [Id] = '"+id3+"')";
qry += " INSERT INTO [InventoryTransactions] ([InventoryTransactionDocumentId],[InventoryTransactionTypeId],[SourceWarehouseId],[TargetWarehouseId],[Date],[Unit],[Multiplier],[Quantity],[TotalPrice],[ExchangeRate],[InventoryItem_Id])";
qry += " VALUES (@transactionid,'1003','3','1',GETDATE(),@unit3,1,-1*"+q3+",-1*"+q3+"*"+cost3+",1,'"+id3+"')"; }
if (rowlen >= 4){
var cell4 = row[3].split('|');
var id4 = cell4[0];
var q4 = cell4[1].replace(',','.');
var cost4 = cell4[2].replace(',','.');
qry += " DECLARE @unit4 varchar(5)";
qry += " SET @unit4 = (SELECT [BaseUnit] FROM [InventoryItems] WHERE [Id] = '"+id4+"')";
qry += " INSERT INTO [InventoryTransactions] ([InventoryTransactionDocumentId],[InventoryTransactionTypeId],[SourceWarehouseId],[TargetWarehouseId],[Date],[Unit],[Multiplier],[Quantity],[TotalPrice],[ExchangeRate],[InventoryItem_Id])";
qry += " VALUES (@transactionid,'1003','3','1',GETDATE(),@unit4,1,-1*"+q4+",-1*"+q4+"*"+cost4+",1,'"+id4+"')"; }
if (rowlen >= 5){
var cell5 = row[4].split('|');
var id5 = cell5[0];
var q5 = cell5[1].replace(',','.');
var cost5 = cell5[2].replace(',','.');
qry += "DECLARE @unit5 varchar(5)";
qry += "SET @unit5 = (SELECT [BaseUnit] FROM [InventoryItems] WHERE [Id] = '"+id5+"')";
qry += "INSERT INTO [InventoryTransactions] ([InventoryTransactionDocumentId],[InventoryTransactionTypeId],[SourceWarehouseId],[TargetWarehouseId],[Date],[Unit],[Multiplier],[Quantity],[TotalPrice],[ExchangeRate],[InventoryItem_Id])";
qry += "VALUES (@transactionid,'1003','3','1',GETDATE(),@unit5,1,-1*"+q5+",-1*"+q5+"*"+cost5+",1,'"+id5+"')"; }
if (rowlen >= 6){
var cell6 = row[5].split('|');
var id6 = cell6[0];
var q6 = cell6[1].replace(',','.');
var cost6 = cell6[2].replace(',','.');
qry += "DECLARE @unit6 varchar(5)";
qry += "SET @unit6 = (SELECT [BaseUnit] FROM [InventoryItems] WHERE [Id] = '"+id6+"')";
qry += "INSERT INTO [InventoryTransactions] ([InventoryTransactionDocumentId],[InventoryTransactionTypeId],[SourceWarehouseId],[TargetWarehouseId],[Date],[Unit],[Multiplier],[Quantity],[TotalPrice],[ExchangeRate],[InventoryItem_Id])";
qry += "VALUES (@transactionid,'1003','3','1',GETDATE(),@unit6,1,-1*"+q6+",-1*"+q6+"*"+cost6+",1,'"+id6+"')"; }
if (rowlen >= 7){
var cell7 = row[6].split('|');
var id7 = cell7[0];
var q7 = cell7[1].replace(',','.');
var cost7 = cell7[2].replace(',','.');
qry += "DECLARE @unit7 varchar(5)";
qry += "SET @unit7 = (SELECT [BaseUnit] FROM [InventoryItems] WHERE [Id] = '"+id7+"')";
qry += "INSERT INTO [InventoryTransactions] ([InventoryTransactionDocumentId],[InventoryTransactionTypeId],[SourceWarehouseId],[TargetWarehouseId],[Date],[Unit],[Multiplier],[Quantity],[TotalPrice],[ExchangeRate],[InventoryItem_Id])";
qry += "VALUES (@transactionid,'1003','3','1',GETDATE(),@unit7,1,-1*"+q7+",-1*"+q7+"*"+cost7+",1,'"+id7+"')"; }
if (rowlen >= 8){
var cell8 = row[7].split('|');
var id8 = cell8[0];
var q8 = cell8[1].replace(',','.');
var cost8 = cell8[2].replace(',','.');
qry += "DECLARE @unit8 varchar(5)";
qry += "SET @unit8 = (SELECT [BaseUnit] FROM [InventoryItems] WHERE [Id] = '"+id8+"')";
qry += "INSERT INTO [InventoryTransactions] ([InventoryTransactionDocumentId],[InventoryTransactionTypeId],[SourceWarehouseId],[TargetWarehouseId],[Date],[Unit],[Multiplier],[Quantity],[TotalPrice],[ExchangeRate],[InventoryItem_Id])";
qry += "VALUES (@transactionid,'1003','3','1',GETDATE(),@unit8,1,-1*"+q8+",-1*"+q8+"*"+cost8+",1,'"+id8+"')"; }
if (rowlen >= 9){
var cell9 = row[8].split('|');
var id9 = cell9[0];
var q9 = cell9[1].replace(',','.');
var cost9 = cell9[2].replace(',','.');
qry += "DECLARE @unit9 varchar(5)"
qry += "SET @unit9 = (SELECT [BaseUnit] FROM [InventoryItems] WHERE [Id] = '"+id9+"')"
qry += "INSERT INTO [InventoryTransactions] ([InventoryTransactionDocumentId],[InventoryTransactionTypeId],[SourceWarehouseId],[TargetWarehouseId],[Date],[Unit],[Multiplier],[Quantity],[TotalPrice],[ExchangeRate],[InventoryItem_Id])"
qry += "VALUES (@transactionid,'1003','3','1',GETDATE(),@unit9,1,-1*"+q9+",-1*"+q9+"*"+cost9+",1,'"+id9+"')"; }
if (rowlen >= 10){
var cell10 = row[9].split('|');
var id10 = cell10[0];
var q10 = cell10[1].replace(',','.');
var cost10 = cell10[2].replace(',','.');
qry += "DECLARE @unit10 varchar(5)"
qry += "SET @unit10 = (SELECT [BaseUnit] FROM [InventoryItems] WHERE [Id] = '"+id10+"')"
qry += "INSERT INTO [InventoryTransactions] ([InventoryTransactionDocumentId],[InventoryTransactionTypeId],[SourceWarehouseId],[TargetWarehouseId],[Date],[Unit],[Multiplier],[Quantity],[TotalPrice],[ExchangeRate],[InventoryItem_Id])"
qry += "VALUES (@transactionid,'1003','3','1',GETDATE(),@unit10,1,-1*"+q10+",-1*"+q10+"*"+cost10+",1,'"+id10+"')"; }
// sql query
if (rowlen >= 1 && id1 > 0 ){
var sqlqry = sql.ExecSql(qry)}
return sqlqry}