Table of Content
HAL Forum
function boolean RecordStore (
record AnyRecord,boolean UseEvents)
Description:
Will either update or store a new record to a register. Alternatives are to use RecordSave and RecordUpdate. Events that could be executed: RecordUpdate, RecordUpdateAfter, RecordSave,RecordSaveAfter.
Parameters:
AnyRecord Record that will be either stored or updated
UseEvents Will determine if record events are used when storing or updating the record. TRUE - Use Events / FALSE - Skip events.
updating procedure StoreItemDeficiency(string artcode,string location,val qty,Integer itemtype)
begin
  record MainStockBlock MainStockRec;
  record PrelStockVc PrelStockr;
  Boolean foundf;

  if ((itemtype==0) or (itemtype==1)) then begin
    BlockLoad(MainStockRec);
    PrelStockr.ItemCode = artcode;
    PrelStockr.Location = location;
    if (blank(PrelStockr.Location)) then begin
      PrelStockr.Location = MainStockRec.MainStock;
    end;
    if (ReadFirstMain(PrelStockr,2,true)) then begin
    end else begin
      RecordNew(PrelStockr);
      PrelStockr.ItemCode = artcode;
      PrelStockr.Location = location;
      PrelStockr.MaintDate = CurrentDate;
      if (blank(PrelStockr.Location)) then begin
        PrelStockr.Location = MainStockRec.MainStock;
      end;
      PrelStockr.Qty = 0;
      PrelStockr.ItemType = itemtype;
    end;
    PrelStockr.Qty = PrelStockr.Qty + qty;
    if (RecordStore(PrelStockr,true)) then begin
    end;
  end;
  return;
end;
Related topics:
««