I am using the ledger demo for a project, and there is function I am having issues with regarding the calculation of the balance.
The current transaction balance hook is coded like this:
*/
$postive_transactions = "'Incoming'";
/* get sum of all item transactions and update item balance */
if($item){
$item_balance = sqlValue("select sum(if(transaction_type in ({$postive_transactions}), quantity, -1 * quantity)) from transactions where item={$item}");
sql("update items set balance='{$item_balance}' where id={$item}", $eo);
I need the drop down to apply these three logic:
Option 1) Incoming - the quantity will add to the balance
option 2) Burned - the quantity will delete from the balance
Option 3) Outgoing - the quantity will do nothing.
Any help would be great!!!
Calculation Function
Re: Calculation Function
Hi,
can you please explain what ledger demo you use?
Where is that code from?
Which dropdown are you refering to?
can you please explain what ledger demo you use?
Where is that code from?
Which dropdown are you refering to?
Any help offered comes with the best of intentions. Use it at your own risk. In any case, please make a backup of your existing environment before applying any changes.