Table of Content
HAL Forum
string GetFileNameInDir (
string DirectoryName,integer filenumber)
Description:
Gives the name of the file from the specified directory
Parameters:
DirectoryName Directory Name
filenumber file number
global
updating procedure CUST_AttachFileMn(record RcVc RepSpec)
begin
  Boolean found,testf;
  record INVc INr;
  record INVc oldINr;
  string 20 frin,toin;
  Integer cnt;
  String 100 fname;
  LongInt longvar;
  Integer i,numoffiles;
  
  if (blank(RepSpec.f1)) then begin
    frin = "00000000";
    toin = "ZZZZZZZZ";
  end;
  frin = FirstInRange(RepSpec.f1,20);
  toin = LastInRange(RepSpec.f1,20);
  INr.Code = frin;
  found = true;
  while (LoopMain(INr,1,found)) begin 
    if (nonblank(RepSpec.f1)) then begin 
      if (INr.Code>toin) then begin found = false; end;
    end;
    if (found) then begin
      if (blank(INr.AlternativeCode)) then begin
        goto LAttachFileMn2;
      end;
      numoffiles = CountFilesInDir("Pictures");
      for (i=0;i<numoffiles;i=i+1) begin
        fname = GetFileNameInDir("Pictures",i);
        if (Left(fname,Len(INr.AlternativeCode)+1) == INr.AlternativeCode & ".") then begin
          if (RecordLinkFile("Pictures/" & fname,0,INr,CurrentCompany)) then begin
             LogText(0,"File attached for Item " &  INr.Code &": " & fname);
          end;
          goto LAttachFileMn2;
        end;
      end;
    end;
LAttachFileMn2:;
  end;
LAttachFileMn:;  
  return;
end;
Related topics:
««