9. April 2009 08:43
//Datum erfinden
bDatum := TODAY();
vDatum := CALCDATE('LT-1J',bDatum);
// Verbrauchsstatistik beschaffen
gVerbrauch1 := 0;
CLEAR(gItemLedger);
gItemLedger.RESET;
gItemLedger.SETFILTER(gItemLedger."Item No.","Item No.");
gItemLedger.SETFILTER(gItemLedger."Location Code",'=%1',"Location Code");
gItemLedger.SETFILTER(gItemLedger."Document Date",'%1..%2',vDatum,bDatum);
gItemLedger.SETFILTER(gItemLedger."Entry Type",'=%1',gItemLedger."Entry Type"::Consumption);
IF gItemLedger.FIND('-') THEN BEGIN
REPEAT
gVerbrauch1 := gVerbrauch1 + gItemLedger.Quantity;
UNTIL gItemLedger.NEXT =0;
END;
gVerbrauch2 := 0;
CLEAR(gItemLedger);
gItemLedger.RESET;
gItemLedger.SETFILTER(gItemLedger."Item No.","Item No.");
gItemLedger.SETFILTER(gItemLedger."Location Code",'=%1',"Location Code");
gItemLedger.SETFILTER(gItemLedger."Document Date",'%1..%2',vDatum,bDatum);
gItemLedger.SETFILTER(gItemLedger."Entry Type",'=%1',gItemLedger."Entry Type"::Sale);
IF gItemLedger.FIND('-') THEN BEGIN
REPEAT
gVerbrauch2 := gVerbrauch2 + gItemLedger.Quantity;
UNTIL gItemLedger.NEXT =0;
END;
9. April 2009 09:03