Ignore:
Timestamp:
Jul 6, 2008, 8:20:14 PM (16 years ago)
Author:
Kevin Toppenberg
Message:

Uploading from OR_30_258

File:
1 edited

Legend:

Unmodified
Added
Removed
  • cprs/branches/foia-cprs/CPRS-Chart/Orders/uODBase.pas

    r459 r460  
    2222procedure PopKeyVars(NumLevels: Integer = 1);
    2323procedure PushKeyVars(const NewVals: string);
     24procedure ExpandOrderObjects(var Txt: string; var ContainsObjects: boolean; msg: string = '');
    2425
    2526implementation
     27
     28uses
     29  dShared, Windows, rTemplates;
    2630
    2731var
     
    118122end;
    119123
     124procedure ExpandOrderObjects(var Txt: string; var ContainsObjects: boolean; msg: string = '');
     125var
     126  ObjList: TStringList;
     127  Err: TStringList;
     128  i, j, k, oLen: integer;
     129  obj, ObjTxt: string;
     130const
     131  CRDelim = #13;
     132  TC_BOILER_ERR  = 'Order Boilerplate Object Error';
     133  TX_BOILER_ERR  = 'Contact IRM and inform them about this error.' + CRLF +
     134                   'Make sure you give them the name of the quick' + CRLF +
     135                   'order that you are processing.' ;
     136begin
     137  ObjList := TStringList.Create;
     138  try
     139    Err := nil;
     140    if(not dmodShared.BoilerplateOK(Txt, CRDelim, ObjList, Err)) and (assigned(Err)) then
     141    begin
     142      try
     143        Err.Add(CRLF + TX_BOILER_ERR);
     144        InfoBox(Err.Text, TC_BOILER_ERR, MB_OK + MB_ICONERROR);
     145      finally
     146        Err.Free;
     147      end;
     148    end;
     149    if(ObjList.Count > 0) then
     150    begin
     151      ContainsObjects := True;
     152      GetTemplateText(ObjList);
     153      i := 0;
     154      while (i < ObjList.Count) do
     155      begin
     156        if(pos(ObjMarker, ObjList[i]) = 1) then
     157        begin
     158          obj := copy(ObjList[i], ObjMarkerLen+1, MaxInt);
     159          if(obj = '') then break;
     160          j := i + 1;
     161          while (j < ObjList.Count) and (pos(ObjMarker, ObjList[j]) = 0) do
     162            inc(j);
     163          if((j - i) > 2) then
     164          begin
     165            ObjTxt := '';
     166            for k := i+1 to j-1 do
     167              ObjTxt := ObjTxt + #13 + ObjList[k];
     168          end
     169          else
     170            ObjTxt := ObjList[i+1];
     171          i := j;
     172          obj := '|' + obj + '|';
     173          oLen := length(obj);
     174          repeat
     175            j := pos(obj, Txt);
     176            if(j > 0) then
     177            begin
     178              delete(Txt, j, OLen);
     179              insert(ObjTxt, Txt, j);
     180            end;
     181          until(j = 0);
     182        end
     183        else
     184          inc(i);
     185      end
     186    end;
     187  finally
     188    ObjList.Free;
     189  end;
     190end;
     191
    120192initialization
    121193  uOrderEventType := #0;
Note: See TracChangeset for help on using the changeset viewer.