| 1 | //kt -- Modified with SourceScanner on 8/26/2007
 | 
|---|
| 2 | unit fCsltNote;
 | 
|---|
| 3 | 
 | 
|---|
| 4 | interface
 | 
|---|
| 5 | 
 | 
|---|
| 6 | uses Windows, SysUtils, Classes, Graphics, Forms, Controls, StdCtrls, 
 | 
|---|
| 7 |   Buttons, ORCtrls, ORfn, ExtCtrls, DKLang;
 | 
|---|
| 8 | 
 | 
|---|
| 9 | type
 | 
|---|
| 10 |   TfrmCsltNote = class(TForm)
 | 
|---|
| 11 |     cmdOK: TButton;
 | 
|---|
| 12 |     cmdCancel: TButton;
 | 
|---|
| 13 |     cboCsltNote: TORComboBox;
 | 
|---|
| 14 |     lblAction: TLabel;
 | 
|---|
| 15 |     pnlBase: TORAutoPanel;
 | 
|---|
| 16 |     procedure cmdOKClick(Sender: TObject);
 | 
|---|
| 17 |     procedure cmdCancelClick(Sender: TObject);
 | 
|---|
| 18 |   private
 | 
|---|
| 19 |     FNoteIEN: string  ;
 | 
|---|
| 20 |     FChanged: Boolean;
 | 
|---|
| 21 |   end;
 | 
|---|
| 22 | 
 | 
|---|
| 23 | procedure SelectNoteForProcessing(FontSize: Integer; ActionType: integer; NoteList: TStrings;
 | 
|---|
| 24 |            var NoteIEN: integer; CPStatus: integer) ;
 | 
|---|
| 25 | 
 | 
|---|
| 26 | implementation
 | 
|---|
| 27 | 
 | 
|---|
| 28 | {$R *.DFM}
 | 
|---|
| 29 | 
 | 
|---|
| 30 | uses rConsults, rCore, uCore, fConsults, uConsults;
 | 
|---|
| 31 | 
 | 
|---|
| 32 | //const
 | 
|---|
| 33 | //TX_NOTE_TEXT = 'Select a document or press Cancel.';  <-- original line.  //kt 8/26/2007
 | 
|---|
| 34 | //TX_NOTE_CAP = 'No Document Selected';  <-- original line.  //kt 8/26/2007
 | 
|---|
| 35 | 
 | 
|---|
| 36 | var
 | 
|---|
| 37 |   TX_NOTE_TEXT  : string;  //kt
 | 
|---|
| 38 |   TX_NOTE_CAP   : string;  //kt
 | 
|---|
| 39 | 
 | 
|---|
| 40 | procedure SetupVars;
 | 
|---|
| 41 | //kt Added entire function to replace constant declarations 8/26/2007
 | 
|---|
| 42 | begin
 | 
|---|
| 43 |   TX_NOTE_TEXT := DKLangConstW('fCsltNote_Select_a_document_or_press_Cancelx');
 | 
|---|
| 44 |   TX_NOTE_CAP := DKLangConstW('fCsltNote_No_Document_Selected');
 | 
|---|
| 45 | end;
 | 
|---|
| 46 | 
 | 
|---|
| 47 | procedure SelectNoteForProcessing(FontSize: Integer; ActionType: integer; NoteList: TStrings;
 | 
|---|
| 48 |            var NoteIEN: integer; CPStatus: integer) ;
 | 
|---|
| 49 | { displays progress note selection form and returns a record of the selection }
 | 
|---|
| 50 | var
 | 
|---|
| 51 |   frmCsltNote: TfrmCsltNote;
 | 
|---|
| 52 |   W, H, i: Integer;
 | 
|---|
| 53 | begin
 | 
|---|
| 54 |   frmCsltNote := TfrmCsltNote.Create(Application);
 | 
|---|
| 55 |   try
 | 
|---|
| 56 |     with frmCsltNote do
 | 
|---|
| 57 |     begin
 | 
|---|
| 58 |       Font.Size := FontSize;
 | 
|---|
| 59 |       W := ClientWidth;
 | 
|---|
| 60 |       H := ClientHeight;
 | 
|---|
| 61 |       ResizeToFont(FontSize, W, H);
 | 
|---|
| 62 |       ClientWidth  := W; pnlBase.Width  := W;
 | 
|---|
| 63 |       ClientHeight := H; pnlBase.Height := H;
 | 
|---|
| 64 |       FChanged := False;
 | 
|---|
| 65 |       //Caption := fConsults.ActionType[ActionType]; //kt
 | 
|---|
| 66 |       Caption := fConsults.ActionType(ActionType); //kt
 | 
|---|
| 67 |       case ActionType of
 | 
|---|
| 68 |         CN_ACT_CP_COMPLETE:
 | 
|---|
| 69 |           begin
 | 
|---|
| 70 |             if CPStatus = CP_INSTR_INCOMPLETE then
 | 
|---|
| 71 |               begin
 | 
|---|
| 72 | //              lblAction.Caption := 'Interpret Clinical Procedure Results:';  <-- original line.  //kt 8/26/2007
 | 
|---|
| 73 |                 lblAction.Caption := DKLangConstW('fCsltNote_Interpret_Clinical_Procedure_Resultsx'); //kt added 8/26/2007
 | 
|---|
| 74 |                 cboCsltNote.Caption := lblAction.Caption;
 | 
|---|
| 75 |                 for i := 0 to NoteList.Count-1 do
 | 
|---|
| 76 |                   if ((not (Copy(Piece(Piece(NoteList[i], U, 1), ';', 2), 1, 4) = 'MCAR')) and
 | 
|---|
| 77 |                      (Piece(NoteList[i], U, 13) <> '%') and
 | 
|---|
| 78 | //                   (Piece(NoteList[i], U, 7)  <> 'completed')) then  <-- original line.  //kt 8/26/2007
 | 
|---|
| 79 |                      (Piece(NoteList[i], U, 7)  <> DKLangConstW('fCsltNote_completed'))) then //kt added 8/26/2007
 | 
|---|
| 80 |                        cboCsltNote.Items.Add(Piece(NoteList[i], U, 1) + U + MakeConsultNoteDisplayText(Notelist[i]));
 | 
|---|
| 81 |                 cboCsltNote.ItemIndex := 0;
 | 
|---|
| 82 |                 FNoteIEN := cboCsltNote.ItemID;
 | 
|---|
| 83 |                 //ShowModal;
 | 
|---|
| 84 |               end
 | 
|---|
| 85 |             else if CPStatus in [CP_NO_INSTRUMENT, CP_INSTR_COMPLETE] then
 | 
|---|
| 86 |               begin
 | 
|---|
| 87 | //              lblAction.Caption := 'Select incomplete note to continue with:';  <-- original line.  //kt 8/26/2007
 | 
|---|
| 88 |                 lblAction.Caption := DKLangConstW('fCsltNote_Select_incomplete_note_to_continue_withx'); //kt added 8/26/2007
 | 
|---|
| 89 |                 cboCsltNote.Caption := lblAction.Caption;
 | 
|---|
| 90 |                 for i := 0 to NoteList.Count-1 do
 | 
|---|
| 91 |                   if ((not (Copy(Piece(Piece(NoteList[i], U, 1), ';', 2), 1, 4) = 'MCAR')) and
 | 
|---|
| 92 | //                   (Piece(NoteList[i], U, 7)  <> 'completed') and  <-- original line.  //kt 8/26/2007
 | 
|---|
| 93 |                      (Piece(NoteList[i], U, 7)  <> DKLangConstW('fCsltNote_completed')) and //kt added 8/26/2007
 | 
|---|
| 94 |                      ((Piece(Piece(NoteList[i], U, 5), ';', 1) = IntToStr(User.DUZ)) or
 | 
|---|
| 95 |                      (Piece(Piece(NoteList[i], U, 5), ';', 1) = '0')))  then
 | 
|---|
| 96 |                     cboCsltNote.Items.Add(Piece(NoteList[i], U, 1) + U + MakeConsultNoteDisplayText(Notelist[i]));
 | 
|---|
| 97 | //              if cboCsltNote.Items.Count > 0 then cboCsltNote.Items.Insert(0, CN_NEW_CP_NOTE + '^<Create new note>');  <-- original line.  //kt 8/26/2007
 | 
|---|
| 98 |                 if cboCsltNote.Items.Count > 0 then cboCsltNote.Items.Insert(0, CN_NEW_CP_NOTE + '^'+DKLangConstW('fCsltNote_xCreate_new_notex')); //kt added 8/26/2007
 | 
|---|
| 99 |                 if cboCsltNote.Items.Count > 0 then
 | 
|---|
| 100 |                   ShowModal
 | 
|---|
| 101 |                 else
 | 
|---|
| 102 |                   FNoteIEN := CN_NEW_CP_NOTE;
 | 
|---|
| 103 |               end;
 | 
|---|
| 104 |           end;
 | 
|---|
| 105 |         CN_ACT_COMPLETE:
 | 
|---|
| 106 |           begin
 | 
|---|
| 107 | //          lblAction.Caption := 'Select incomplete note to continue with:';  <-- original line.  //kt 8/26/2007
 | 
|---|
| 108 |             lblAction.Caption := DKLangConstW('fCsltNote_Select_incomplete_note_to_continue_withx'); //kt added 8/26/2007
 | 
|---|
| 109 |             cboCsltNote.Caption := lblAction.Caption;
 | 
|---|
| 110 |             for i := 0 to NoteList.Count-1 do
 | 
|---|
| 111 |               if ((not (Copy(Piece(Piece(NoteList[i], U, 1), ';', 2), 1, 4) = 'MCAR')) and
 | 
|---|
| 112 | //               (Piece(NoteList[i], U, 7)  <> 'completed') and  <-- original line.  //kt 8/26/2007
 | 
|---|
| 113 |                  (Piece(NoteList[i], U, 7)  <> DKLangConstW('fCsltNote_completed')) and //kt added 8/26/2007
 | 
|---|
| 114 |                  (Piece(Piece(NoteList[i], U, 5), ';', 1) = IntToStr(User.DUZ)))  then
 | 
|---|
| 115 |                 cboCsltNote.Items.Add(Piece(NoteList[i], U, 1) + U + MakeConsultNoteDisplayText(Notelist[i]));
 | 
|---|
| 116 | //          if cboCsltNote.Items.Count > 0 then cboCsltNote.Items.Insert(0, CN_NEW_CSLT_NOTE + '^<Create new note>');  <-- original line.  //kt 8/26/2007
 | 
|---|
| 117 |             if cboCsltNote.Items.Count > 0 then cboCsltNote.Items.Insert(0, CN_NEW_CSLT_NOTE + '^'+DKLangConstW('fCsltNote_xCreate_new_notex')); //kt added 8/26/2007
 | 
|---|
| 118 |             if cboCsltNote.Items.Count > 0 then
 | 
|---|
| 119 |               ShowModal
 | 
|---|
| 120 |             else
 | 
|---|
| 121 |               FNoteIEN := CN_NEW_CSLT_NOTE;
 | 
|---|
| 122 |           end;
 | 
|---|
| 123 | (*      CN_ACT_ADDENDUM:     //  no longer called in v15
 | 
|---|
| 124 |           begin
 | 
|---|
| 125 | //          lblAction.Caption := 'Select completed note to addend to:';  <-- original line.  //kt 8/26/2007
 | 
|---|
| 126 |             lblAction.Caption := DKLangConstW('fCsltNote_Select_completed_note_to_addend_tox'); //kt added 8/26/2007
 | 
|---|
| 127 |             for i := 0 to NoteList.Count-1 do
 | 
|---|
| 128 |               begin
 | 
|---|
| 129 | //              if Copy(Piece(NoteList[i], U, 2), 1, 8) = 'Addendum' then continue;  <-- original line.  //kt 8/26/2007
 | 
|---|
| 130 |                 if Copy(Piece(NoteList[i], U, 2), 1, 8) = DKLangConstW('fCsltNote_Addendum') then continue; //kt added 8/26/2007
 | 
|---|
| 131 |                 if Piece(NoteList[i], U, 13) = '%' then continue;
 | 
|---|
| 132 |                 cboCsltNote.Items.Add(Piece(NoteList[i], U, 1) + U + MakeConsultNoteDisplayText(Notelist[i]));
 | 
|---|
| 133 |               end;
 | 
|---|
| 134 |             if cboCsltNote.Items.Count > 0 then
 | 
|---|
| 135 |               ShowModal
 | 
|---|
| 136 |             else
 | 
|---|
| 137 |               FNoteIEN := '-30';
 | 
|---|
| 138 |           end;*)
 | 
|---|
| 139 |       end; {case}
 | 
|---|
| 140 | 
 | 
|---|
| 141 |       NoteIEN:= StrToIntDef(FNoteIEN, -1) ;
 | 
|---|
| 142 |     end; {with frmCsltNote}
 | 
|---|
| 143 |   finally
 | 
|---|
| 144 |     frmCsltNote.Release;
 | 
|---|
| 145 |   end;
 | 
|---|
| 146 | end;
 | 
|---|
| 147 | 
 | 
|---|
| 148 | procedure TfrmCsltNote.cmdCancelClick(Sender: TObject);
 | 
|---|
| 149 | begin
 | 
|---|
| 150 |   FNoteIEN := '-1';
 | 
|---|
| 151 |   Close;
 | 
|---|
| 152 | end;
 | 
|---|
| 153 | 
 | 
|---|
| 154 | procedure TfrmCsltNote.cmdOKClick(Sender: TObject);
 | 
|---|
| 155 | begin
 | 
|---|
| 156 |   SetupVars;  //kt added 8/26/2007 to replace constants with vars.
 | 
|---|
| 157 |  with cboCsltNote do
 | 
|---|
| 158 |    begin
 | 
|---|
| 159 |      if ItemIEN = 0 then
 | 
|---|
| 160 |        begin
 | 
|---|
| 161 |          InfoBox(TX_NOTE_TEXT, TX_NOTE_CAP, MB_OK or MB_ICONWARNING);
 | 
|---|
| 162 |          FChanged := False ;
 | 
|---|
| 163 |          FNoteIEN := '-1';
 | 
|---|
| 164 |          Exit;
 | 
|---|
| 165 |        end;
 | 
|---|
| 166 |      FChanged := True;
 | 
|---|
| 167 |      FNoteIEN := Piece(Items[ItemIndex],U,1);
 | 
|---|
| 168 |      Close;
 | 
|---|
| 169 |    end ;
 | 
|---|
| 170 | end;
 | 
|---|
| 171 | 
 | 
|---|
| 172 | end.
 | 
|---|