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