Procedure

GetNoteForEdit

Module

rTIU

Last Modified

7/15/2014 3:26:44 PM

Comments

Retrieves internal/external values for progress note fields & loads them into EditRec
  Fields: Title:.01, RefDate:1301, Author:1204, Cosigner:1208, Subject:1701, Location:1205 

x: string;

Scope

Interfaced

Declaration

procedure GetNoteForEdit(var EditRec: TEditNoteRec; IEN: Integer);

Calls Hierarchy


GetNoteForEdit
 ├FindInt
 ├FindExt
 ├FindDT
 ├FindInt64
 └FindVal

Called-By Hierarchy


                        GetNoteForEdit
            TfrmConsults.LoadForEdit┤ 
  TfrmConsults.mnuActNoteEditClick┘ │ 
TfrmConsults.mnuActCompleteClick┘   │ 
             TfrmSurgery.LoadForEdit┤ 
       TfrmSurgery.mnuActEditClick┘ │ 
               TfrmNotes.LoadForEdit┘ 
         TfrmNotes.mnuActEditClick┘   

Calls

Name Declaration Comments
FindDT function FindDT(const FieldID: string): TFMDateTime; -
FindExt function FindExt(const FieldID: string): string; -
FindInt function FindInt(const FieldID: string): Integer; -
FindInt64 function FindInt64(const FieldID: string): Int64; -
FindVal function FindVal(const FieldID: string): string; -

Called-By

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


Source

462   procedure GetNoteForEdit(var EditRec: TEditNoteRec; IEN: Integer);
463   { retrieves internal/external values for progress note fields & loads them into EditRec
464     Fields: Title:.01, RefDate:1301, Author:1204, Cosigner:1208, Subject:1701, Location:1205 }
465   var
466     i, j: Integer;
467     //x: string;
468   
469     function FindDT(const FieldID: string): TFMDateTime;
470     var
471       i: Integer;
472     begin
473       Result := 0;
474       with RPCBrokerV do for i := 0 to Results.Count - 1 do
475         if Piece(Results[i], U, 1) = FieldID then
476         begin
477           Result := MakeFMDateTime(Piece(Results[i], U, 2));
478           Break;
479         end;
480     end;
481   
482     function FindExt(const FieldID: string): string;
483     var
484       i: Integer;
485     begin
486       Result := '';
487       with RPCBrokerV do for i := 0 to Results.Count - 1 do
488         if Piece(Results[i], U, 1) = FieldID then
489         begin
490           Result := Piece(Results[i], U, 3);
491           Break;
492         end;
493     end;
494   
495     function FindInt(const FieldID: string): Integer;
496     var
497       i: Integer;
498     begin
499       Result := 0;
500       with RPCBrokerV do for i := 0 to Results.Count - 1 do
501         if Piece(Results[i], U, 1) = FieldID then
502         begin
503           Result := StrToIntDef(Piece(Results[i], U, 2), 0);
504           Break;
505         end;
506     end;
507   
508     function FindInt64(const FieldID: string): Int64;
509     var
510       i: Integer;
511     begin
512       Result := 0;
513       with RPCBrokerV do for i := 0 to Results.Count - 1 do
514         if Piece(Results[i], U, 1) = FieldID then
515         begin
516           Result := StrToInt64Def(Piece(Results[i], U, 2), 0);
517           Break;
518         end;
519     end;
520   
521     function FindVal(const FieldID: string): string;
522     var
523       i: Integer;
524     begin
525       Result := '';
526       with RPCBrokerV do for i := 0 to Results.Count - 1 do
527         if Piece(Results[i], U, 1) = FieldID then
528         begin
529           Result := Piece(Results[i], U, 2);
530           Break;
531         end;
532     end;
533   
534   begin
535     CallV('TIU LOAD RECORD FOR EDIT', [IEN, '.01;.06;.07;1301;1204;1208;1701;1205;1405;2101;70201;70202']);
536     FillChar(EditRec, SizeOf(EditRec), 0);
537     with EditRec do
538     begin
539       Title        := FindInt('.01');
540       TitleName    := FindExt('.01');
541       DateTime     := FindDT('1301');
542       Author       := FindInt64('1204');
543       AuthorName   := FindExt('1204');
544       Cosigner     := FindInt64('1208');
545       CosignerName := FindExt('1208');
546       Subject      := FindExt('1701');
547       Location     := FindInt('1205');
548       LocationName := FindExt('1205');
549       IDParent     := FindInt('2101');
550       ClinProcSummCode := FindInt('70201');
551       ClinProcDateTime := FindDT('70202');
552       VisitDate    := FindDT('.07');
553       PkgRef       := FindVal('1405');
554       PkgIEN       := StrToIntDef(Piece(PkgRef, ';', 1), 0);
555       PkgPtr       := Piece(PkgRef, ';', 2);
556       if Title = TYP_ADDENDUM then Addend := FindInt('.06');
557       with RPCBrokerV do
558       begin
559         for i := 0 to Results.Count - 1 do if Results[i] = '$TXT' then break;
560         for j := i downto 0 do Results.Delete(j);
561         // -------------------- v19.1 (RV) LOST NOTES?----------------------------
562         //Lines := Results;   'Lines' is being overwritten by subsequent Broker calls
563         if not Assigned(Lines) then Lines := TStringList.Create;
564         FastAssign(RPCBrokerV.Results, Lines);
565         // -----------------------------------------------------------------------
566       end;
567     end;
568   end;