I have following code written for some customized report. Currently these code is pulling QtyOnHand from Item Card. I have item divided into sub item using variants. I need to pull the QtyOnHand of variants instead, how can I do that??
Thanks for help.
Hdr.SETFILTER(“Posting Date”,’%1…%2’,StartingDate,EndingDate);
Hdr.SETRANGE(“No.”,“Document No.”);
IF NOT Hdr.FIND(’-’) THEN
CurrDataport.SKIP;
InvDate := Hdr.“Posting Date”;
CustName := Hdr.“Sell-to Customer Name”;
FullAdd := Hdr.“Sell-to Address” + ’ ’ + Hdr.“Sell-to Address 2”;
City := Hdr.“Sell-to City”;
State := Hdr.“Sell-to County”;
Zip := Hdr.“Sell-to Post Code”;
Unit := “Unit of Measure Code”;
PROMO:= FALSE;
CLASS:= Hdr.“Customer Posting Group”;
//Cigarette//
IF ItemRec.GET(“No.”) THEN BEGIN
ItemNo := “No.” + “Variant Code”;
ItemRec.CALCFIELDS(Inventory);
QtyOnHand := ItemRec.Inventory;
IF ItemRec.Brand = ‘MSA’ THEN
MSA := TRUE;
IF ItemVar.GET(“No.”,“Variant Code”) THEN
UPC := ItemVar.UPC;
IF ItemRec.Brand = ‘MSA’ THEN
MSACAT := ‘CIGS’;
IF ItemRec.Brand = ‘MSA’ THEN
ItemCount := ‘200’;