Table of Content
HAL Forum
function boolean IsLetter (
string Char)
Description:
Returns TRUE if the specified string variable (len:1) holds an alphabetic value
Parameters:
Char String that holds the value that will be checked
function Boolean VIDClassInvoiceNrEFAfter(Integer wn,Integer changedf)
begin
  record VIVc VIr;
  record VIVc VI2r;
  string 255 c;
  string 255 t1,t2,t3;
  Integer i,l;

  if (changedf!=0) then begin  
    GetWindowRecord(wn,VIr);
    switch (GetVATLaw) begin
      case vatArgentinean:
        l = len(VIr.InvoiceNr);
        if (l<15) then begin
          for (i=0;i<l;i=i+1) begin
            c = Mid(VIr.InvoiceNr,i,1);
            if (IsLetter(c)==false) then begin
              goto LVIDClassInvoiceNrEFAfter1;
            end;
            t1 = t1 & c;
          end;
LVIDClassInvoiceNrEFAfter1:;          
          for (i=len(t1)+1;i<l;i=i+1) begin
            c = Mid(VIr.InvoiceNr,i,1);
            if (IsDigit(c)==false) then begin
              goto LVIDClassInvoiceNrEFAfter2;
            end;
            t2 = t2 & c;
          end;
LVIDClassInvoiceNrEFAfter2:;          
          for (i=len(t1)+1+len(t2)+1;i<l;i=i+1) begin
            c = Mid(VIr.InvoiceNr,i,1);
            if (IsDigit(c)==false) then begin
              goto LVIDClassInvoiceNrEFAfter3;
            end;
            t3 = t3 & c;
          end;
          if (len(t2)<4) then begin
             M4PadString(t2,4,"0",true,t2);
          end;
          if (len(t3)<8) then begin
             M4PadString(t3,8,"0",true,t3);
          end;
          if (IsCapitalLetter(t1)==false) then begin
            t1 = chr(asc(t1)-32);            
          end;
          VIr.InvoiceNr = t1 & "-" & t2 & "-" & t3;
LVIDClassInvoiceNrEFAfter3:;          
        end;
        if (ValidSuppInvNo_Argentina(VIr.InvoiceNr)==false) then begin
          MessageBox(20858,"");
        end;
        VI2r.InvoiceNr = VIr.InvoiceNr;
        VI2r.VECode = VIr.VECode;    
        if (ReadFirstKey("InvoiceNr",VI2r,2,true)) then begin
          if (VI2r.InvType!=kInvoiceTypeCredit) then begin
            MessageBox(1547,"");
          end;
        end;
    end;
LVIDClassInvoiceNrEFAfter:;
    PutWindowRecord(wn,VIr);
  end;
  VIDClassInvoiceNrEFAfter = true;
  return;
end;
Related topics:
««