Procedure

PutAddendum

Module

rTIU

Last Modified

7/15/2014 3:26:44 PM

Comments

Create a new addendum for note identified in AddendumTo, returns IEN of new document
  load broker directly since there isn't a good way to set up mutilple subscript arrays 

var
  i: Integer;

Scope

Interfaced

Declaration

procedure PutAddendum(var CreatedDoc: TCreatedDoc; const NoteRec: TNoteRec; AddendumTo: Integer);

Calls Hierarchy


PutAddendum
 └SetText
   └InitParams

Called-By Hierarchy


                             PutAddendum
           TfrmConsults.InsertAddendum┤ 
TfrmConsults.mnuActMakeAddendumClick┘ │ 
            TfrmSurgery.InsertAddendum┤ 
       TfrmSurgery.mnuActAddendClick┘ │ 
              TfrmNotes.InsertAddendum┘ 
         TfrmNotes.mnuActAddendClick┘   

Calls

Name Declaration Comments
SetText procedure SetText(var ErrMsg: string; NoteText: TStrings; NoteIEN: Int64; Suppress: Integer); -

Called-By

Name Declaration Comments
TfrmConsults.InsertAddendum procedure InsertAddendum; -
TfrmSurgery.InsertAddendum procedure InsertAddendum; -
TfrmNotes.InsertAddendum procedure InsertAddendum; -


Source

736   procedure PutAddendum(var CreatedDoc: TCreatedDoc; const NoteRec: TNoteRec; AddendumTo: Integer);
737   { create a new addendum for note identified in AddendumTo, returns IEN of new document
738     load broker directly since there isn't a good way to set up mutilple subscript arrays }
739   (*var
740     i: Integer;*)
741   var
742     ErrMsg: string;
743   begin
744     with RPCBrokerV do
745     begin
746       ClearParameters := True;
747       RemoteProcedure := 'TIU CREATE ADDENDUM RECORD';
748       Param[0].PType := literal;
749       Param[0].Value := IntToStr(AddendumTo);
750       Param[1].PType := list;
751       with Param[1] do
752       begin
753         Mult['1202'] := IntToStr(NoteRec.Author);
754         Mult['1301'] := FloatToStr(NoteRec.DateTime);
755         if NoteRec.Cosigner > 0 then Mult['1208'] := IntToStr(NoteRec.Cosigner);
756   (*      if NoteRec.Lines <> nil then
757           for i := 0 to NoteRec.Lines.Count - 1 do
758             Mult['"TEXT",' + IntToStr(i+1) + ',0'] := FilteredString(NoteRec.Lines[i]);*)
759       end;
760       Param[2].PType := literal;
761       Param[2].Value := '1';  // suppress commit logic
762       CallBroker;
763       CreatedDoc.IEN := StrToIntDef(Piece(Results[0], U, 1), 0);
764       CreatedDoc.ErrorText := Piece(Results[0], U, 2);
765     end;
766     if ( NoteRec.Lines <> nil ) and ( CreatedDoc.IEN <> 0 ) then
767     begin
768       SetText(ErrMsg, NoteRec.Lines, CreatedDoc.IEN, 1);
769       if ErrMsg <> '' then
770       begin
771         CreatedDoc.IEN := 0;
772         CreatedDoc.ErrorText := ErrMsg;
773       end;
774     end;
775   end;