Hi everyone,
I'm still struggling with C SIDE language.
I need to calculate the total stock value of the item table and already got the total stock for each product from the item ledger entry.
Now I need the grand total of all products, how I can sum all totals from each product to get the grand total?
This is my code.
//>> calculate total stock quantity per item no.
CLEAR(TotalStockQty);
ItemLedgerEntry.SETFILTER("Item No.",Item."No.");
ItemLedgerEntry.CALCSUMS(Quantity);
TotalStockQty:= ItemLedgerEntry.Quantity;
// << calculate total stock quantity per item no.
// now sum (TotalStockQty * ItemUnitCost."Unit Cost")
CLEAR(i);
CLEAR(TotalStockValue);
ItemUnitCost.SETRANGE("No.",Item."No.");
IF ItemUnitCost.FINDSET THEN BEGIN
REPEAT
TotalStockValue += (TotalStockQty * ItemUnitCost."Unit Cost");
UNTIL ItemUnitCost.NEXT =0;
END
Thanks for any advice.