Table of Content
HAL Forum
procedure RecordCheckError (
integer ErrorMessageId,string ExtraData,integer RowNr,string FieldName)
Description:
Creates a message box with predefined error message and activates the specified record field in active record view window
Parameters:
ErrorMessageId Predefined error message ID. (defined with SString function) Automatically translated into active language.
ExtraData Extra data to be shown in the message box that will be opened. Mostly used for adding field value with the error message.
RowNr The record matrix row number (from 0). Used when activating a matrix field. Use -1 when activating normal record fields.
FieldName The name of the field that will be activated
global
function LongInt PayTypeVcRecordCheck(Var Record PayTypeVc PTr,Record PayTypeVc PT2r,LongInt long3,LongInt long4)
begin

  LongInt res;
  Record PayTypeGroupVc PTGr;
  Record AccVc Accr;
  Integer insertMode,updateMode;
  Integer errCode;
  String 255 errStr;

  res = 0;
  insertMode = 1;
  updateMode = 2;
  // nonblanks
  if (blank(PTr.Code)) then begin
    recordCheckError(23001,"",-1,"Code");
    res = -1;
    goTo LPayTypeVcRecordCheck;
  end;
  if ((long3 == updateMode) and (PTr.Code != PT2r.Code)) then begin
    recordCheckError(23017,"",-1,"Code");
    res = -1;
    goTo LPayTypeVcRecordCheck;
  end;
  if (blank(PTr.PayTypeGroup)) then begin
    recordCheckError(23011,"",-1,"PayTypeGroup");
    res = -1;
    goTo LPayTypeVcRecordCheck;
  end else begin
    PTGr.Code = PTr.PayTypeGroup;
    if (readFirstMain(PTGr,1,true) == false) then begin
      recordCheckError(23012,PTr.PayTypeGroup,-1,"PayTypeGroup");
      res = -1;
      goto LPayTypeVcRecordCheck;
    end;
  end;
  if (nonBlank(PTr.Objects)) then begin
    errCode = CheckObjs("",PTr.Objects,errStr);
    if (errCode != 0) then begin
      recordCheckError(errCode,errStr,-1,"Objects");
      res = -1;
      goTo LPayTypeVcRecordCheck;
    end;
  end;
  if (nonBlank(PTr.CostAcc)) then begin
    Accr.AccNumber = PTr.CostAcc;
    resetLoop(Accr);
    if (readFirstMain(Accr,1,true) == false) then begin
      recordCheckError(1007,PTr.CostAcc,-1,"CostAcc");
      res = -1;
      goTo LPayTypeVcRecordCheck;
    end else begin
      if ((Accr.blockedFlag != 0) or (Accr.GroupAcc != 0)) then begin
        recordCheckError(1084,PTr.CostAcc,-1,"CostAcc");
        res = -1;
        goTo LPayTypeVcRecordCheck;
      end;
    end;
  end;
  LPayTypeVcRecordCheck:;

  PayTypeVcRecordCheck = res;

  return;
end;



Related topics:
««