|
It flushes the buffer with records to database |
global
updating procedure StorePO(Array record POVc aPOr,Integer pocnt)
BEGIN
Integer poi;
record POVc POr;
row POVc POrw;
Integer i,rwcnt;
record MainStockBlock MainStockRec;
BlockLoad(MainStockRec);
for (poi=0;poi<pocnt;poi=poi+1) begin
POr = aPOr[poi];
POr.SerNr = NextSerNr("POVc",POr.TransDate,-1,false,"");
if (POr.SerNr>0) then begin
DBFlush;
DBHold;
if (RecordStore(POr,false)) then begin
rwcnt = MatRowCnt(POr);
for (i=0;i<rwcnt;i=i+1) begin
MatRowGet(POr,i,POrw);
if ((POrw.Shipd2<POrw.Quant) and (nonblank(POrw.ArtCode))) then begin
AddtoPrelORPUStock(POr.SerNr,i+1,POr.TransDate,StringToDate(POr.PlanShip),POr.Location,"POVc",POrw.ArtCode,POrw.Quant-POrw.Shipd2,MainStockRec.MainStock,0);
end;
end;
end;
end;
end;
RETURN;
END;
««