Table of Content
HAL Forum
procedure AddToStrArray (
string NewValue,var array string StrArray)
Description:
Adds new value to a string type array and increases it's internal element counter by 1. Note that the element count is stored in 0 position of the array, so the values are stored in position 1,2,3,...
Parameters:
NewValue New value
StrArray Array of string values
external procedure AddToStrArray(string,var array string);

global
function Boolean StockMovVc_PasteArtCode(var record StockMovVc StockMovp,Integer rownr,Integer changed,var array string aWarning)
BEGIN
  Boolean res;
  record INVc INr;
  row StockMovVc StockMovrw;
  string 60 sz,msk,mskrep;
  string 200 varsubset;
  Boolean itemfound;

  MatRowGet(StockMovp,rownr,StockMovrw);  
  if ((changed!=0) or ((blank(StockMovrw.Spec)) and (nonblank(StockMovrw.ArtCode)))) then begin
    res = true;
    itemfound = GetFirstItem(StockMovrw.ArtCode,INr);
    if (itemfound==false) then begin
      itemfound = ReadFirstItem(StockMovrw.ArtCode,INr,true,true);
      if (FindItemVAR(INr.Code,sz,msk,mskrep,varsubset)) then begin
        INr.Code = StockMovrw.ArtCode;
      end;
    end;
    if (itemfound) then begin
      StockMovrw.Coefficient = INr.UnitCoefficient;
      StockMovrw.ArtCode = INr.Code;
      StockMovrw.Spec = INr.Name;
      StockMovrw.BasePrice = INr.UPrice1;
      StockMovrw.Objects = FindINObjects(INr.Objects,INr.Group);
      StockMovrw.UnitXval = INr.Width;
      StockMovrw.UnitYval = INr.Height;
      StockMovrw.UnitZval = INr.Depth;
      MatRowPut(StockMovp,rownr,StockMovrw);
      AddToStrArray(INr.WarnText1,aWarning);
      if (INr.ItemType!=kItemTypeStocked) then begin
        AddToStrArray(USetStr(1301),aWarning);
      end;      
    end else begin
      if (nonblank(StockMovrw.ArtCode)) then begin
        AddToStrArray(USetStr(1120) & StockMovrw.ArtCode,aWarning);
      end;
    end;
  end;
  StockMovVc_PasteArtCode = res;
  RETURN;
END;
Related topics:
««