| 1 | unit uSurgery;
 | 
|---|
| 2 | 
 | 
|---|
| 3 | interface
 | 
|---|
| 4 | 
 | 
|---|
| 5 | uses
 | 
|---|
| 6 |   SysUtils, Windows, Messages, Controls, Classes, StdCtrls, ORfn, dialogs;
 | 
|---|
| 7 | 
 | 
|---|
| 8 | type
 | 
|---|
| 9 |   TSurgeryTitles = class
 | 
|---|
| 10 |     ClassName: string;
 | 
|---|
| 11 |     DfltTitle: Integer;
 | 
|---|
| 12 |     DfltTitleName: string;
 | 
|---|
| 13 |     ShortList: TStringList;
 | 
|---|
| 14 |     constructor Create;
 | 
|---|
| 15 |     destructor Destroy; override;
 | 
|---|
| 16 |   end;
 | 
|---|
| 17 | 
 | 
|---|
| 18 | function  MakeSurgeryCaseDisplayText(InputString: string): string;
 | 
|---|
| 19 | function  MakeSurgeryReportDisplayText(RawText: string): string;
 | 
|---|
| 20 | //procedure DisplayOpTop(ANoteIEN: integer);
 | 
|---|
| 21 | 
 | 
|---|
| 22 | const
 | 
|---|
| 23 | (*  SG_ALL        = 1;                             // Case context - all cases
 | 
|---|
| 24 |   SG_BY_SURGEON = 2;                             // Case context - all cases by surgeon
 | 
|---|
| 25 |   SG_BY_DATE    = 3;                             // Case context - all cases by date range*)
 | 
|---|
| 26 | 
 | 
|---|
| 27 |   SG_TV_TEXT = 'Surgery Cases';
 | 
|---|
| 28 | 
 | 
|---|
| 29 |   OP_TOP_NEVER_SHOW   = 0;
 | 
|---|
| 30 |   OP_TOP_ALWAYS_SHOW  = 1;
 | 
|---|
| 31 |   OP_TOP_ASK_TO_SHOW  = 2;
 | 
|---|
| 32 | 
 | 
|---|
| 33 | implementation
 | 
|---|
| 34 | 
 | 
|---|
| 35 | uses
 | 
|---|
| 36 |   uConst, rSurgery, fRptBox;
 | 
|---|
| 37 | 
 | 
|---|
| 38 | constructor TSurgeryTitles.Create;
 | 
|---|
| 39 | { creates an object to store Surgery titles so only obtained from server once }
 | 
|---|
| 40 | begin
 | 
|---|
| 41 |   inherited Create;
 | 
|---|
| 42 |   ShortList := TStringList.Create;
 | 
|---|
| 43 | end;
 | 
|---|
| 44 | 
 | 
|---|
| 45 | destructor TSurgeryTitles.Destroy;
 | 
|---|
| 46 | { frees the lists that were used to store the Surgery titles }
 | 
|---|
| 47 | begin
 | 
|---|
| 48 |   ShortList.Free;
 | 
|---|
| 49 |   inherited Destroy;
 | 
|---|
| 50 | end;
 | 
|---|
| 51 | 
 | 
|---|
| 52 | function MakeSurgeryCaseDisplayText(InputString: string): string;
 | 
|---|
| 53 | (*
 | 
|---|
| 54 | CASE #^Operative Procedure^Date/Time of Operation^Surgeon^^^^^^^^^+^Context
 | 
|---|
| 55 | *)
 | 
|---|
| 56 | var
 | 
|---|
| 57 |   x: string;
 | 
|---|
| 58 | begin
 | 
|---|
| 59 |   x := InputString;
 | 
|---|
| 60 |   x := FormatFMDateTime('mmm dd yyyy', MakeFMDateTime(Piece(x, U, 3))) + '  ' + Piece(x, U, 2) +
 | 
|---|
| 61 |        ', ' + Piece(Piece(x, U, 4), ';', 2) + ', ' + 'Case #: ' + Piece(x, u, 1);
 | 
|---|
| 62 |   Result := x;
 | 
|---|
| 63 | end;
 | 
|---|
| 64 | 
 | 
|---|
| 65 | function MakeSurgeryReportDisplayText(RawText: string): string;
 | 
|---|
| 66 | var
 | 
|---|
| 67 |   x: string;
 | 
|---|
| 68 | begin
 | 
|---|
| 69 |   x := RawText;
 | 
|---|
| 70 |   x := FormatFMDateTime('mmm dd,yy', MakeFMDateTime(Piece(x, U, 3))) + '  ' + Piece(x, U, 2) +
 | 
|---|
| 71 |        ' (#' + Piece(x, U, 1) + '), ' + Piece(x, U, 6) + ', ' + Piece(Piece(x, U, 5), ';', 2);
 | 
|---|
| 72 |   Result := x;
 | 
|---|
| 73 | end;
 | 
|---|
| 74 | 
 | 
|---|
| 75 | (*procedure DisplayOpTop(ANoteIEN: integer);
 | 
|---|
| 76 | const
 | 
|---|
| 77 | { TODO -oRich V. -cSurgery/TIU : What should be the text of the prompt for display OpTop on signature? }
 | 
|---|
| 78 |   TX_OP_TOP_PROMPT = 'Would you like to first review the OpTop for this surgery report?';
 | 
|---|
| 79 | var
 | 
|---|
| 80 |   AList: TStringList;
 | 
|---|
| 81 |   ACaseIEN: integer;
 | 
|---|
| 82 |   IsNonORProc: boolean;
 | 
|---|
| 83 |   ShouldShowOpTop: integer;
 | 
|---|
| 84 |   x: string;
 | 
|---|
| 85 |   ShowReport: boolean;
 | 
|---|
| 86 | begin
 | 
|---|
| 87 |   AList := TStringList.Create;
 | 
|---|
| 88 |   try
 | 
|---|
| 89 |     ShowReport := False;
 | 
|---|
| 90 |     x := GetSurgCaseRefForNote(ANoteIEN);
 | 
|---|
| 91 |     ACaseIEN := StrToIntDef(Piece(x, ';', 1), 0);
 | 
|---|
| 92 |     ShouldShowOpTop := ShowOpTopOnSignature(ACaseIEN);
 | 
|---|
| 93 |     case ShouldShowOpTop of
 | 
|---|
| 94 |       OP_TOP_NEVER_SHOW   : ; // do nothing
 | 
|---|
| 95 |       OP_TOP_ALWAYS_SHOW  : begin
 | 
|---|
| 96 |                               x := GetSingleCaseListItemWithoutDocs(ANoteIEN);
 | 
|---|
| 97 |                               IsNonORProc := IsNonORProcedure(ACaseIEN);
 | 
|---|
| 98 |                               LoadOpTop(AList, ACaseIEN, IsNonORProc, ShowReport);
 | 
|---|
| 99 |                               ReportBox(AList, MakeSurgeryCaseDisplayText(x), True);
 | 
|---|
| 100 |                             end;
 | 
|---|
| 101 |       OP_TOP_ASK_TO_SHOW  :   if InfoBox(TX_OP_TOP_PROMPT, 'Confirmation', MB_YESNO or MB_ICONQUESTION) = IDYES then
 | 
|---|
| 102 |                                 begin
 | 
|---|
| 103 |                                   x := GetSingleCaseListItemWithoutDocs(ANoteIEN);
 | 
|---|
| 104 |                                   IsNonORProc := IsNonORProcedure(ACaseIEN);
 | 
|---|
| 105 |                                   LoadOpTop(AList, ACaseIEN, IsNonORProc, ShowReport);
 | 
|---|
| 106 |                                   ReportBox(AList, MakeSurgeryCaseDisplayText(x), True);
 | 
|---|
| 107 |                                 end;
 | 
|---|
| 108 |     end;
 | 
|---|
| 109 |   finally
 | 
|---|
| 110 |     AList.Free;
 | 
|---|
| 111 |   end;
 | 
|---|
| 112 | end;*)
 | 
|---|
| 113 | 
 | 
|---|
| 114 | end.
 | 
|---|