[541] | 1 | //kt -- Modified with SourceScanner on 7/19/2007, also 8/09
|
---|
[453] | 2 | unit fNotes;
|
---|
| 3 | {$O-}
|
---|
| 4 |
|
---|
| 5 | interface
|
---|
| 6 |
|
---|
| 7 | uses
|
---|
| 8 | Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
|
---|
| 9 | fHSplit, StdCtrls, ExtCtrls, Menus, ComCtrls, ORCtrls, ORFn, uConst, ORDtTm,
|
---|
| 10 | uPCE, ORClasses, fDrawers, ImgList, rTIU, uTIU, uDocTree, fRptBox, fPrintList,
|
---|
[541] | 11 | MSHTML,TMGHTML2,ActiveX, //kt added this line 8/09 for HTML editing
|
---|
| 12 | fNoteST, ORNet, fNoteSTStop, OleCtrls, SHDocVw, DKLang, Buttons, ToolWin;
|
---|
[453] | 13 |
|
---|
| 14 | type
|
---|
[541] | 15 | TEditModes = (emNone,emText,emHTML); //kt 8/09
|
---|
| 16 | TViewModes = (vmEdit,vmView,vmText,vmHTML); //kt 8/09
|
---|
| 17 | TViewModeSet = Set of TViewModes; //kt 8/09
|
---|
| 18 | const
|
---|
| 19 | vmHTML_MODE : array [false..true] of TViewModes = (vmText,vmHTML); //kt 8/09
|
---|
| 20 | emHTML_MODE : array [false..true] of TEditModes = (emText,emHTML); //kt 8/09
|
---|
| 21 |
|
---|
| 22 | type
|
---|
[453] | 23 | TfrmNotes = class(TfrmHSplit)
|
---|
| 24 | mnuNotes: TMainMenu;
|
---|
| 25 | mnuView: TMenuItem;
|
---|
| 26 | mnuViewChart: TMenuItem;
|
---|
| 27 | mnuChartReports: TMenuItem;
|
---|
| 28 | mnuChartLabs: TMenuItem;
|
---|
| 29 | mnuChartDCSumm: TMenuItem;
|
---|
| 30 | mnuChartCslts: TMenuItem;
|
---|
| 31 | mnuChartNotes: TMenuItem;
|
---|
| 32 | mnuChartOrders: TMenuItem;
|
---|
| 33 | mnuChartMeds: TMenuItem;
|
---|
| 34 | mnuChartProbs: TMenuItem;
|
---|
| 35 | mnuChartCover: TMenuItem;
|
---|
| 36 | Z1: TMenuItem;
|
---|
| 37 | mnuViewDetail: TMenuItem;
|
---|
| 38 | mnuAct: TMenuItem;
|
---|
| 39 | mnuActNew: TMenuItem;
|
---|
| 40 | Z2: TMenuItem;
|
---|
| 41 | mnuActSave: TMenuItem;
|
---|
| 42 | mnuActDelete: TMenuItem;
|
---|
| 43 | mnuActEdit: TMenuItem;
|
---|
| 44 | mnuActSign: TMenuItem;
|
---|
| 45 | mnuActAddend: TMenuItem;
|
---|
| 46 | lblNotes: TOROffsetLabel;
|
---|
| 47 | pnlRead: TPanel;
|
---|
| 48 | lblTitle: TOROffsetLabel;
|
---|
| 49 | memNote: TRichEdit;
|
---|
| 50 | pnlWrite: TPanel;
|
---|
| 51 | memNewNote: TRichEdit;
|
---|
| 52 | WebBrowser1: TWebBrowser; //kt added (and WebBrowser1 object in form file)
|
---|
| 53 | Z3: TMenuItem;
|
---|
| 54 | mnuViewAll: TMenuItem;
|
---|
| 55 | mnuViewByAuthor: TMenuItem;
|
---|
| 56 | mnuViewByDate: TMenuItem;
|
---|
| 57 | mnuViewUncosigned: TMenuItem;
|
---|
| 58 | mnuViewUnsigned: TMenuItem;
|
---|
| 59 | mnuActSignList: TMenuItem;
|
---|
| 60 | cmdNewNote: TORAlignButton;
|
---|
| 61 | cmdPCE: TORAlignButton;
|
---|
| 62 | lblSpace1: TLabel;
|
---|
| 63 | popNoteMemo: TPopupMenu;
|
---|
| 64 | popNoteMemoCut: TMenuItem;
|
---|
| 65 | popNoteMemoCopy: TMenuItem;
|
---|
| 66 | popNoteMemoPaste: TMenuItem;
|
---|
| 67 | Z10: TMenuItem;
|
---|
| 68 | popNoteMemoSignList: TMenuItem;
|
---|
| 69 | popNoteMemoDelete: TMenuItem;
|
---|
| 70 | popNoteMemoEdit: TMenuItem;
|
---|
| 71 | popNoteMemoSave: TMenuItem;
|
---|
| 72 | popNoteMemoSign: TMenuItem;
|
---|
| 73 | popNoteList: TPopupMenu;
|
---|
| 74 | popNoteListAll: TMenuItem;
|
---|
| 75 | popNoteListByAuthor: TMenuItem;
|
---|
| 76 | popNoteListByDate: TMenuItem;
|
---|
| 77 | popNoteListUncosigned: TMenuItem;
|
---|
| 78 | popNoteListUnsigned: TMenuItem;
|
---|
| 79 | sptVert: TSplitter;
|
---|
| 80 | memPCEShow: TRichEdit;
|
---|
| 81 | mnuActIdentifyAddlSigners: TMenuItem;
|
---|
| 82 | popNoteMemoAddlSign: TMenuItem;
|
---|
| 83 | Z11: TMenuItem;
|
---|
| 84 | popNoteMemoSpell: TMenuItem;
|
---|
| 85 | popNoteMemoGrammar: TMenuItem;
|
---|
| 86 | mnuViewCustom: TMenuItem;
|
---|
| 87 | N1: TMenuItem;
|
---|
| 88 | mnuViewSaveAsDefault: TMenuItem;
|
---|
| 89 | ReturntoDefault1: TMenuItem;
|
---|
| 90 | pnlDrawers: TPanel;
|
---|
| 91 | lstNotes: TORListBox;
|
---|
| 92 | splDrawers: TSplitter;
|
---|
| 93 | popNoteMemoTemplate: TMenuItem;
|
---|
| 94 | Z12: TMenuItem;
|
---|
| 95 | mnuOptions: TMenuItem;
|
---|
| 96 | mnuEditTemplates: TMenuItem;
|
---|
| 97 | mnuNewTemplate: TMenuItem;
|
---|
| 98 | N2: TMenuItem;
|
---|
| 99 | mnuEditSharedTemplates: TMenuItem;
|
---|
| 100 | mnuNewSharedTemplate: TMenuItem;
|
---|
| 101 | popNoteMemoAddend: TMenuItem;
|
---|
| 102 | pnlFields: TPanel;
|
---|
| 103 | lblNewTitle: TStaticText;
|
---|
| 104 | lblRefDate: TStaticText;
|
---|
| 105 | lblAuthor: TStaticText;
|
---|
| 106 | lblVisit: TStaticText;
|
---|
| 107 | lblCosigner: TStaticText;
|
---|
| 108 | cmdChange: TButton;
|
---|
| 109 | lblSubject: TStaticText;
|
---|
| 110 | txtSubject: TCaptionEdit;
|
---|
| 111 | timAutoSave: TTimer;
|
---|
| 112 | popNoteMemoPaste2: TMenuItem;
|
---|
| 113 | popNoteMemoReformat: TMenuItem;
|
---|
| 114 | Z4: TMenuItem;
|
---|
| 115 | mnuActChange: TMenuItem;
|
---|
| 116 | mnuActLoadBoiler: TMenuItem;
|
---|
| 117 | bvlNewTitle: TBevel;
|
---|
| 118 | popNoteMemoSaveContinue: TMenuItem;
|
---|
| 119 | N3: TMenuItem;
|
---|
| 120 | mnuEditDialgFields: TMenuItem;
|
---|
| 121 | tvNotes: TORTreeView;
|
---|
| 122 | lvNotes: TCaptionListView;
|
---|
| 123 | sptList: TSplitter;
|
---|
| 124 | N4: TMenuItem;
|
---|
| 125 | popNoteListExpandSelected: TMenuItem;
|
---|
| 126 | popNoteListExpandAll: TMenuItem;
|
---|
| 127 | popNoteListCollapseSelected: TMenuItem;
|
---|
| 128 | popNoteListCollapseAll: TMenuItem;
|
---|
| 129 | popNoteListCustom: TMenuItem;
|
---|
| 130 | mnuActDetachFromIDParent: TMenuItem;
|
---|
| 131 | N5: TMenuItem;
|
---|
| 132 | popNoteListDetachFromIDParent: TMenuItem;
|
---|
| 133 | popNoteListAddIDEntry: TMenuItem;
|
---|
| 134 | mnuActAddIDEntry: TMenuItem;
|
---|
| 135 | mnuIconLegend: TMenuItem;
|
---|
| 136 | N6: TMenuItem;
|
---|
| 137 | popNoteMemoFind: TMenuItem;
|
---|
| 138 | dlgFindText: TFindDialog;
|
---|
| 139 | dlgReplaceText: TReplaceDialog;
|
---|
| 140 | popNoteMemoReplace: TMenuItem;
|
---|
| 141 | N7: TMenuItem;
|
---|
| 142 | mnuChartSurgery: TMenuItem;
|
---|
| 143 | mnuActAttachtoIDParent: TMenuItem;
|
---|
| 144 | popNoteListAttachtoIDParent: TMenuItem;
|
---|
| 145 | N8: TMenuItem;
|
---|
| 146 | popNoteMemoPreview: TMenuItem;
|
---|
| 147 | popNoteMemoInsTemplate: TMenuItem;
|
---|
| 148 | popNoteMemoEncounter: TMenuItem;
|
---|
| 149 | mnuSearchForText: TMenuItem;
|
---|
| 150 | popSearchForText: TMenuItem;
|
---|
| 151 | mnuViewInformation: TMenuItem;
|
---|
| 152 | mnuViewDemo: TMenuItem;
|
---|
| 153 | mnuViewVisits: TMenuItem;
|
---|
| 154 | mnuViewPrimaryCare: TMenuItem;
|
---|
| 155 | mnuViewMyHealtheVet: TMenuItem;
|
---|
| 156 | mnuInsurance: TMenuItem;
|
---|
| 157 | mnuViewFlags: TMenuItem;
|
---|
| 158 | mnuViewReminders: TMenuItem;
|
---|
| 159 | mnuViewRemoteData: TMenuItem;
|
---|
| 160 | mnuViewPostings: TMenuItem;
|
---|
[541] | 161 | pnlHtmlViewer: TPanel; //kt 8/09
|
---|
| 162 | pnlTextWrite: TPanel; //kt 8/09
|
---|
| 163 | popNoteMemoHTMLFormat: TMenuItem; //kt 8/09
|
---|
| 164 | pnlHTMLWrite: TPanel; //kt 8/09
|
---|
| 165 | pnlHTMLEdit: TPanel; //kt 8/09
|
---|
| 166 | ToolBar: TToolBar; //kt 8/09
|
---|
| 167 | cbFontNames: TComboBox; //kt 8/09
|
---|
| 168 | cbFontSize: TComboBox; //kt 8/09
|
---|
| 169 | btnFonts: TSpeedButton; //kt 8/09
|
---|
| 170 | btnItalic: TSpeedButton; //kt 8/09
|
---|
| 171 | btnBold: TSpeedButton; //kt 8/09
|
---|
| 172 | btnUnderline: TSpeedButton; //kt 8/09
|
---|
| 173 | btnBullets: TSpeedButton; //kt 8/09
|
---|
| 174 | btnNumbers: TSpeedButton; //kt 8/09
|
---|
| 175 | btnLeftAlign: TSpeedButton; //kt 8/09
|
---|
| 176 | btnCenterAlign: TSpeedButton; //kt 8/09
|
---|
| 177 | btnRightAlign: TSpeedButton; //kt 8/09
|
---|
| 178 | btnMoreIndent: TSpeedButton; //kt 8/09
|
---|
| 179 | btnLessIndent: TSpeedButton; //kt 8/09
|
---|
| 180 | btnTextColor: TSpeedButton; //kt 8/09
|
---|
| 181 | btnBackColor: TSpeedButton; //kt 8/09
|
---|
[453] | 182 | procedure mnuChartTabClick(Sender: TObject);
|
---|
| 183 | procedure lstNotesClick(Sender: TObject);
|
---|
| 184 | procedure pnlRightResize(Sender: TObject);
|
---|
| 185 | procedure cmdNewNoteClick(Sender: TObject);
|
---|
| 186 | procedure mnuActNewClick(Sender: TObject);
|
---|
| 187 | procedure mnuActAddIDEntryClick(Sender: TObject);
|
---|
| 188 | procedure mnuActSaveClick(Sender: TObject);
|
---|
| 189 | procedure mnuViewClick(Sender: TObject);
|
---|
| 190 | procedure mnuActAddendClick(Sender: TObject);
|
---|
| 191 | procedure mnuActDetachFromIDParentClick(Sender: TObject);
|
---|
| 192 | procedure mnuActSignListClick(Sender: TObject);
|
---|
| 193 | procedure mnuActDeleteClick(Sender: TObject);
|
---|
| 194 | procedure mnuActEditClick(Sender: TObject);
|
---|
| 195 | procedure mnuActSignClick(Sender: TObject);
|
---|
| 196 | procedure cmdPCEClick(Sender: TObject);
|
---|
| 197 | procedure popNoteMemoCutClick(Sender: TObject);
|
---|
| 198 | procedure popNoteMemoCopyClick(Sender: TObject);
|
---|
| 199 | procedure popNoteMemoPasteClick(Sender: TObject);
|
---|
| 200 | procedure popNoteMemoPopup(Sender: TObject);
|
---|
| 201 | procedure pnlWriteResize(Sender: TObject);
|
---|
| 202 | procedure FormCreate(Sender: TObject);
|
---|
| 203 | procedure mnuViewDetailClick(Sender: TObject);
|
---|
| 204 | procedure FormClose(Sender: TObject; var Action: TCloseAction);
|
---|
| 205 | procedure mnuActIdentifyAddlSignersClick(Sender: TObject);
|
---|
| 206 | procedure popNoteMemoAddlSignClick(Sender: TObject);
|
---|
| 207 | procedure popNoteMemoSpellClick(Sender: TObject);
|
---|
| 208 | procedure popNoteMemoGrammarClick(Sender: TObject);
|
---|
| 209 | procedure mnuViewSaveAsDefaultClick(Sender: TObject);
|
---|
| 210 | procedure mnuViewReturntoDefaultClick(Sender: TObject);
|
---|
| 211 | procedure popNoteMemoTemplateClick(Sender: TObject);
|
---|
| 212 | procedure mnuEditTemplatesClick(Sender: TObject);
|
---|
| 213 | procedure mnuNewTemplateClick(Sender: TObject);
|
---|
| 214 | procedure mnuEditSharedTemplatesClick(Sender: TObject);
|
---|
| 215 | procedure mnuNewSharedTemplateClick(Sender: TObject);
|
---|
| 216 | procedure mnuOptionsClick(Sender: TObject);
|
---|
| 217 | procedure FormDestroy(Sender: TObject);
|
---|
| 218 | procedure cmdChangeClick(Sender: TObject);
|
---|
| 219 | procedure pnlFieldsResize(Sender: TObject);
|
---|
| 220 | procedure timAutoSaveTimer(Sender: TObject);
|
---|
| 221 | procedure memNewNoteChange(Sender: TObject);
|
---|
| 222 | procedure popNoteMemoReformatClick(Sender: TObject);
|
---|
| 223 | procedure mnuActChangeClick(Sender: TObject);
|
---|
| 224 | procedure mnuActLoadBoilerClick(Sender: TObject);
|
---|
| 225 | procedure popNoteMemoSaveContinueClick(Sender: TObject);
|
---|
| 226 | procedure mnuEditDialgFieldsClick(Sender: TObject);
|
---|
| 227 | procedure tvNotesChange(Sender: TObject; Node: TTreeNode);
|
---|
| 228 | procedure tvNotesClick(Sender: TObject);
|
---|
| 229 | procedure tvNotesCollapsed(Sender: TObject; Node: TTreeNode);
|
---|
| 230 | procedure tvNotesExpanded(Sender: TObject; Node: TTreeNode);
|
---|
| 231 | procedure tvNotesStartDrag(Sender: TObject;
|
---|
| 232 | var DragObject: TDragObject);
|
---|
| 233 | procedure tvNotesDragDrop(Sender, Source: TObject; X, Y: Integer);
|
---|
| 234 | procedure tvNotesDragOver(Sender, Source: TObject; X, Y: Integer;
|
---|
| 235 | State: TDragState; var Accept: Boolean);
|
---|
| 236 | procedure lvNotesColumnClick(Sender: TObject; Column: TListColumn);
|
---|
| 237 | procedure lvNotesCompare(Sender: TObject; Item1, Item2: TListItem; Data: Integer; var Compare: Integer);
|
---|
| 238 | procedure lvNotesSelectItem(Sender: TObject; Item: TListItem; Selected: Boolean);
|
---|
| 239 | procedure popNoteListExpandAllClick(Sender: TObject);
|
---|
| 240 | procedure popNoteListCollapseAllClick(Sender: TObject);
|
---|
| 241 | procedure popNoteListExpandSelectedClick(Sender: TObject);
|
---|
| 242 | procedure popNoteListCollapseSelectedClick(Sender: TObject);
|
---|
| 243 | procedure popNoteListPopup(Sender: TObject);
|
---|
| 244 | procedure lvNotesResize(Sender: TObject);
|
---|
| 245 | procedure mnuIconLegendClick(Sender: TObject);
|
---|
| 246 | procedure popNoteMemoFindClick(Sender: TObject);
|
---|
| 247 | procedure dlgFindTextFind(Sender: TObject);
|
---|
| 248 | procedure popNoteMemoReplaceClick(Sender: TObject);
|
---|
| 249 | procedure dlgReplaceTextReplace(Sender: TObject);
|
---|
| 250 | procedure dlgReplaceTextFind(Sender: TObject);
|
---|
| 251 | procedure mnuActAttachtoIDParentClick(Sender: TObject);
|
---|
| 252 | procedure memNewNoteKeyDown(Sender: TObject; var Key: Word; Shift: TShiftState);
|
---|
| 253 | procedure sptHorzCanResize(Sender: TObject; var NewSize: Integer; var Accept: Boolean);
|
---|
[541] | 254 | //kt procedure WebBrowser1DocumentComplete(Sender: TObject; const pDisp: IDispatch; var URL: OleVariant); //kt added
|
---|
[453] | 255 | procedure popNoteMemoInsTemplateClick(Sender: TObject);
|
---|
| 256 | procedure popNoteMemoPreviewClick(Sender: TObject);
|
---|
| 257 | procedure tvNotesAddition(Sender: TObject; Node: TTreeNode);
|
---|
| 258 | procedure tvNotesDeletion(Sender: TObject; Node: TTreeNode);
|
---|
| 259 | procedure tvNotesExit(Sender: TObject);
|
---|
| 260 | procedure pnlReadExit(Sender: TObject);
|
---|
| 261 | procedure cmdNewNoteExit(Sender: TObject);
|
---|
| 262 | procedure FormHide(Sender: TObject);
|
---|
| 263 | procedure FormShow(Sender: TObject);
|
---|
| 264 | procedure FormMouseMove(Sender: TObject; Shift: TShiftState; X,
|
---|
| 265 | Y: Integer);
|
---|
| 266 | procedure memNewNoteKeyPress(Sender: TObject; var Key: Char);
|
---|
| 267 | procedure memNewNoteKeyUp(Sender: TObject; var Key: Word;
|
---|
| 268 | Shift: TShiftState);
|
---|
| 269 | procedure memPCEShowExit(Sender: TObject);
|
---|
| 270 | procedure cmdChangeExit(Sender: TObject);
|
---|
| 271 | procedure cmdPCEExit(Sender: TObject);
|
---|
| 272 | procedure ViewInfo(Sender: TObject);
|
---|
| 273 | procedure mnuViewInformationClick(Sender: TObject);
|
---|
[541] | 274 | procedure btnBackColorClick(Sender: TObject); //kt 8/09
|
---|
| 275 | procedure btnBoldClick(Sender: TObject); //kt 8/09
|
---|
| 276 | procedure btnBulletsClick(Sender: TObject); //kt 8/09
|
---|
| 277 | procedure btnCenterAlignClick(Sender: TObject); //kt 8/09
|
---|
| 278 | procedure btnFontsClick(Sender: TObject); //kt 8/09
|
---|
| 279 | procedure btnItalicClick(Sender: TObject); //kt 8/09
|
---|
| 280 | procedure btnLeftAlignClick(Sender: TObject); //kt 8/09
|
---|
| 281 | procedure btnLessIndentClick(Sender: TObject); //kt 8/09
|
---|
| 282 | procedure btnMoreIndentClick(Sender: TObject); //kt 8/09
|
---|
| 283 | procedure btnNumbersClick(Sender: TObject); //kt 8/09
|
---|
| 284 | procedure btnRightAlignClick(Sender: TObject); //kt 8/09
|
---|
| 285 | procedure btnTextColorClick(Sender: TObject); //kt 8/09
|
---|
| 286 | procedure btnUnderlineClick(Sender: TObject); //kt 8/09
|
---|
| 287 | procedure cbFontNamesChange(Sender: TObject); //kt 8/09
|
---|
| 288 | procedure cbFontSizeChange(Sender: TObject); //kt 8/09
|
---|
| 289 | procedure popNoteMemoHTMLFormatClick(Sender: TObject); //kt 8/09
|
---|
[453] | 290 | private
|
---|
| 291 | FNavigatingTab : Boolean; //Currently Using tab to navigate
|
---|
| 292 | FEditingIndex: Integer; // index of note being currently edited
|
---|
| 293 | FChanged: Boolean; // true if any text has changed in the note
|
---|
| 294 | FEditCtrl: TCustomEdit;
|
---|
| 295 | FSilent: Boolean;
|
---|
| 296 | FCurrentContext: TTIUContext;
|
---|
| 297 | FDefaultContext: TTIUContext;
|
---|
| 298 | FOrderID: string;
|
---|
| 299 | FImageFlag: TBitmap;
|
---|
| 300 | FEditNote: TEditNoteRec;
|
---|
[541] | 301 | FViewNote : TStringList; //kt 8/09
|
---|
| 302 | FWarmedUp : boolean; //kt 8/09
|
---|
[453] | 303 | FVerifyNoteTitle: Integer;
|
---|
| 304 | FDocList: TStringList;
|
---|
| 305 | FConfirmed: boolean;
|
---|
| 306 | FLastNoteID: string;
|
---|
| 307 | FNewIDChild: boolean;
|
---|
| 308 | FEditingNotePCEObj: boolean;
|
---|
| 309 | FDeleted: boolean;
|
---|
| 310 | FOldFramePnlPatientExit: TNotifyEvent;
|
---|
| 311 | FOldDrawerPnlTemplatesButtonExit: TNotifyEvent;
|
---|
| 312 | FOldDrawerPnlEncounterButtonExit: TNotifyEvent;
|
---|
| 313 | FOldDrawerEdtSearchExit: TNotifyEvent;
|
---|
| 314 | FMousing: TDateTime;
|
---|
| 315 | FStarting: boolean;
|
---|
| 316 | LastAuthor: Int64; //kt 6-1-05
|
---|
| 317 | LastAuthorName: string; //kt 6-1-05
|
---|
[541] | 318 | FHTMLEditMode : TEditModes; //kt 7/09 This is the mode of the note being edited (even if not actively displayed)
|
---|
| 319 | FViewMode : TViewModeSet; //kt 7/09 This is the status of the display
|
---|
[453] | 320 | procedure frmFramePnlPatientExit(Sender: TObject);
|
---|
| 321 | procedure frmDrawerPnlTemplatesButtonExit(Sender: TObject);
|
---|
| 322 | procedure frmDrawerPnlEncounterButtonExit(Sender: TObject);
|
---|
| 323 | procedure frmDrawerEdtSearchExit(Sender: TObject);
|
---|
| 324 | procedure ClearEditControls;
|
---|
| 325 | procedure DoAutoSave(Suppress: integer = 1);
|
---|
| 326 | function GetTitleText(AnIndex: Integer): string;
|
---|
| 327 | procedure InsertAddendum;
|
---|
| 328 | procedure InsertNewNote(IsIDChild: boolean; AnIDParent: integer);
|
---|
| 329 | function LacksRequiredForCreate: Boolean;
|
---|
| 330 | procedure LoadForEdit;
|
---|
| 331 | function LockConsultRequest(AConsult: Integer): Boolean;
|
---|
| 332 | function LockConsultRequestAndNote(AnIEN: Int64): Boolean;
|
---|
| 333 | procedure RemovePCEFromChanges(IEN: Int64; AVisitStr: string = '');
|
---|
| 334 | procedure SaveEditedNote(var Saved: Boolean);
|
---|
| 335 | procedure SaveCurrentNote(var Saved: Boolean);
|
---|
| 336 | procedure SetEditingIndex(const Value: Integer);
|
---|
| 337 | procedure SetSubjectVisible(ShouldShow: Boolean);
|
---|
| 338 | procedure ShowPCEControls(ShouldShow: Boolean);
|
---|
| 339 | function StartNewEdit(NewNoteType: integer): Boolean;
|
---|
| 340 | procedure UnlockConsultRequest(ANote: Int64; AConsult: Integer = 0);
|
---|
| 341 | procedure ProcessNotifications;
|
---|
| 342 | procedure SetViewContext(AContext: TTIUContext);
|
---|
| 343 | property EditingIndex: Integer read FEditingIndex write SetEditingIndex;
|
---|
| 344 | function GetDrawers: TFrmDrawers;
|
---|
| 345 | function CanFinishReminder: boolean;
|
---|
| 346 | procedure DisplayPCE;
|
---|
| 347 | function VerifyNoteTitle: Boolean;
|
---|
| 348 | // added for treeview
|
---|
| 349 | procedure LoadNotes;
|
---|
| 350 | procedure UpdateTreeView(DocList: TStringList; Tree: TORTreeView);
|
---|
| 351 | procedure EnableDisableIDNotes;
|
---|
| 352 | procedure ShowPCEButtons(Editing: boolean);
|
---|
| 353 | procedure DoAttachIDChild(AChild, AParent: TORTreeNode);
|
---|
| 354 | function SetNoteTreeLabel(AContext: TTIUContext): string;
|
---|
| 355 | procedure UpdateNoteAuthor(DocInfo: string);
|
---|
[541] | 356 | procedure SetHTMLEditMode(HTMLEditMode : boolean; Quiet : Boolean=false); //kt
|
---|
| 357 | procedure ToggleHTMLEditMode; //kt
|
---|
| 358 | procedure BroadcastImages(Note: TStrings); //kt
|
---|
| 359 | procedure ProperRepaint(Editing : Boolean); //kt
|
---|
| 360 | procedure SetEditorFocus; //kt
|
---|
| 361 | function EditorHasText : boolean; //kt
|
---|
[453] | 362 | public
|
---|
[541] | 363 | HtmlEditor : THtmlObj; //kt 8/09
|
---|
| 364 | HtmlViewer : THtmlObj; //kt 8/09
|
---|
| 365 | procedure SetDisplayToHTMLvsText(Mode :TViewModeSet; Lines : TStrings; ActivateOnly : boolean=False); //kt 8/09
|
---|
[453] | 366 | function ActiveEditOf(AnIEN: Int64; ARequest: integer): Boolean;
|
---|
| 367 | function AllowContextChange(var WhyNot: string): Boolean; override;
|
---|
| 368 | procedure ClearPtData; override;
|
---|
| 369 | procedure DisplayPage; override;
|
---|
| 370 | procedure RequestPrint; override;
|
---|
| 371 | procedure RequestMultiplePrint(AForm: TfrmPrintList);
|
---|
| 372 | procedure SetFontSize(NewFontSize: Integer); override;
|
---|
| 373 | procedure SaveSignItem(const ItemID, ESCode: string);
|
---|
| 374 | procedure AssignRemForm;
|
---|
| 375 | property OrderID: string read FOrderID;
|
---|
[541] | 376 | property ViewMode :TViewModeSet read FViewMode; //kt 8/09
|
---|
[453] | 377 | procedure LstNotesToPrint;
|
---|
[541] | 378 | constructor Create(AOwner: TComponent); override; //kt 8/09
|
---|
| 379 | destructor Destroy; override; //kt 8/09
|
---|
[453] | 380 | published
|
---|
| 381 | property Drawers: TFrmDrawers read GetDrawers; // Keep Drawers published
|
---|
| 382 | end;
|
---|
| 383 |
|
---|
| 384 | var
|
---|
| 385 | frmNotes: TfrmNotes;
|
---|
| 386 | SearchTextStopFlag: Boolean; // Text Search CQ: HDS00002856
|
---|
| 387 |
|
---|
| 388 | implementation
|
---|
| 389 |
|
---|
| 390 | {$R *.DFM}
|
---|
| 391 |
|
---|
| 392 | uses fFrame, fVisit, fEncnt, rCore, uCore, fNoteBA, fNoteBD, fSignItem, fEncounterFrame,
|
---|
| 393 | rPCE, Clipbrd, fNoteCslt, fNotePrt, rVitals, fAddlSigners, fNoteDR, fConsults, uSpell,
|
---|
| 394 | fTIUView, fTemplateEditor, uReminders, fReminderDialog, uOrders, rConsults, fReminderTree,
|
---|
| 395 | fNoteProps, fNotesBP, fTemplateFieldEditor, dShared, rTemplates,
|
---|
| 396 | FIconLegend, fPCEEdit, fNoteIDParents, rSurgery, uSurgery, uTemplates,
|
---|
| 397 | uAccessibleTreeView, uAccessibleTreeNode, fTemplateDialog, DateUtils,
|
---|
| 398 | StrUtils {//KT added 1-1-05},
|
---|
[541] | 399 | //fImages, {//kt added 9-20-05}
|
---|
| 400 | fOptionsNotes, //kt 8/09
|
---|
[453] | 401 | rHTMLTools; {//kt added 5-27-05 for IsHTMLDocument}
|
---|
| 402 |
|
---|
| 403 | const
|
---|
| 404 |
|
---|
| 405 | NT_NEW_NOTE = -10; // Holder IEN for a new note
|
---|
| 406 | NT_ADDENDUM = -20; // Holder IEN for a new addendum
|
---|
| 407 |
|
---|
| 408 | NT_ACT_NEW_NOTE = 2;
|
---|
| 409 | NT_ACT_ADDENDUM = 3;
|
---|
| 410 | NT_ACT_EDIT_NOTE = 4;
|
---|
| 411 | NT_ACT_ID_ENTRY = 5;
|
---|
| 412 |
|
---|
[541] | 413 | VIEW_ACTIVATE_ONLY = true; //kt 8/09
|
---|
| 414 |
|
---|
[453] | 415 | //TX_NEED_VISIT = 'A visit is required before creating a new progress note.'; <-- original line. //kt 7/19/2007
|
---|
| 416 | //TX_CREATE_ERR = 'Error Creating Note'; <-- original line. //kt 7/19/2007
|
---|
| 417 | //TX_UPDATE_ERR = 'Error Updating Note'; <-- original line. //kt 7/19/2007
|
---|
| 418 | //TX_NO_NOTE = 'No progress note is currently being edited'; <-- original line. //kt 7/19/2007
|
---|
| 419 | //TX_SAVE_NOTE = 'Save Progress Note'; <-- original line. //kt 7/19/2007
|
---|
| 420 | //TX_ADDEND_NO = 'Cannot make an addendum to a note that is being edited'; <-- original line. //kt 7/19/2007
|
---|
| 421 | //TX_DEL_OK = CRLF + CRLF + 'Delete this progress note?'; <-- original line. //kt 7/19/2007
|
---|
| 422 | //TX_DEL_ERR = 'Unable to Delete Note'; <-- original line. //kt 7/19/2007
|
---|
| 423 | //TX_SIGN = 'Sign Note'; <-- original line. //kt 7/19/2007
|
---|
| 424 | //TX_COSIGN = 'Cosign Note'; <-- original line. //kt 7/19/2007
|
---|
| 425 | //TX_SIGN_ERR = 'Unable to Sign Note'; <-- original line. //kt 7/19/2007
|
---|
| 426 | // TX_SCREQD = 'This progress note title requires the service connected questions to be '+
|
---|
| 427 | // 'answered. The Encounter form will now be opened. Please answer all '+
|
---|
| 428 | // 'service connected questions.';
|
---|
| 429 | // TX_SCREQD_T = 'Response required for SC questions.';
|
---|
| 430 | //TX_NONOTE = 'No progress note is currently selected.'; <-- original line. //kt 7/19/2007
|
---|
| 431 | //TX_NONOTE_CAP = 'No Note Selected'; <-- original line. //kt 7/19/2007
|
---|
| 432 | //TX_NOPRT_NEW = 'This progress note may not be printed until it is saved'; <-- original line. //kt 7/19/2007
|
---|
| 433 | //TX_NOPRT_NEW_CAP = 'Save Progress Note'; <-- original line. //kt 7/19/2007
|
---|
| 434 | //TX_NO_ALERT = 'There is insufficient information to process this alert.' + CRLF + <-- original line. //kt 7/19/2007
|
---|
| 435 | // 'Either the alert has already been deleted, or it contained invalid data.' + CRLF + CRLF + <-- original line. //kt 7/19/2007
|
---|
| 436 | // 'Click the NEXT button if you wish to continue processing more alerts.'; <-- original line. //kt 7/19/2007
|
---|
| 437 | //TX_CAP_NO_ALERT = 'Unable to Process Alert'; <-- original line. //kt 7/19/2007
|
---|
| 438 | //TX_ORDER_LOCKED = 'This record is locked by an action underway on the Consults tab'; <-- original line. //kt 7/19/2007
|
---|
| 439 | //TC_ORDER_LOCKED = 'Unable to access record'; <-- original line. //kt 7/19/2007
|
---|
| 440 | //TX_NO_ORD_CHG = 'The note is still associated with the previously selected request.' + CRLF + <-- original line. //kt 7/19/2007
|
---|
| 441 | // 'Finish the pending action on the consults tab, then try again.'; <-- original line. //kt 7/19/2007
|
---|
| 442 | //TC_NO_ORD_CHG = 'Locked Consult Request'; <-- original line. //kt 7/19/2007
|
---|
| 443 | //TX_NEW_SAVE1 = 'You are currently editing:' + CRLF + CRLF; <-- original line. //kt 7/19/2007
|
---|
| 444 | //TX_NEW_SAVE2 = CRLF + CRLF + 'Do you wish to save this note and begin a new one?'; <-- original line. //kt 7/19/2007
|
---|
| 445 | //TX_NEW_SAVE3 = CRLF + CRLF + 'Do you wish to save this note and begin a new addendum?'; <-- original line. //kt 7/19/2007
|
---|
| 446 | //TX_NEW_SAVE4 = CRLF + CRLF + 'Do you wish to save this note and edit the one selected?'; <-- original line. //kt 7/19/2007
|
---|
| 447 | //TX_NEW_SAVE5 = CRLF + CRLF + 'Do you wish to save this note and begin a new Interdisciplinary entry?'; <-- original line. //kt 7/19/2007
|
---|
| 448 | //TC_NEW_SAVE2 = 'Create New Note'; <-- original line. //kt 7/19/2007
|
---|
| 449 | //TC_NEW_SAVE3 = 'Create New Addendum'; <-- original line. //kt 7/19/2007
|
---|
| 450 | //TC_NEW_SAVE4 = 'Edit Different Note'; <-- original line. //kt 7/19/2007
|
---|
| 451 | //TC_NEW_SAVE5 = 'Create New Interdisciplinary Entry'; <-- original line. //kt 7/19/2007
|
---|
| 452 | //TX_EMPTY_NOTE = CRLF + CRLF + 'This note contains no text and will not be saved.' + CRLF + <-- original line. //kt 7/19/2007
|
---|
| 453 | // 'Do you wish to delete this note?'; <-- original line. //kt 7/19/2007
|
---|
| 454 | //TC_EMPTY_NOTE = 'Empty Note'; <-- original line. //kt 7/19/2007
|
---|
| 455 | //TX_EMPTY_NOTE1 = 'This note contains no text and can not be signed.'; <-- original line. //kt 7/19/2007
|
---|
| 456 | //TC_NO_LOCK = 'Unable to Lock Note'; <-- original line. //kt 7/19/2007
|
---|
| 457 | //TX_ABSAVE = 'It appears the session terminated abnormally when this' + CRLF + <-- original line. //kt 7/19/2007
|
---|
| 458 | // 'note was last edited. Some text may not have been saved.' + CRLF + CRLF + <-- original line. //kt 7/19/2007
|
---|
| 459 | // 'Do you wish to continue and sign the note?'; <-- original line. //kt 7/19/2007
|
---|
| 460 | //TC_ABSAVE = 'Possible Missing Text'; <-- original line. //kt 7/19/2007
|
---|
| 461 | //TX_NO_BOIL = 'There is no boilerplate text associated with this title.'; <-- original line. //kt 7/19/2007
|
---|
| 462 | //TC_NO_BOIL = 'Load Boilerplate Text'; <-- original line. //kt 7/19/2007
|
---|
| 463 | //TX_BLR_CLEAR = 'Do you want to clear the previously loaded boilerplate text?'; <-- original line. //kt 7/19/2007
|
---|
| 464 | //TC_BLR_CLEAR = 'Clear Previous Boilerplate Text'; <-- original line. //kt 7/19/2007
|
---|
| 465 | //TX_DETACH_CNF = 'Confirm Detachment'; <-- original line. //kt 7/19/2007
|
---|
| 466 | //TX_DETACH_FAILURE = 'Detach failed'; <-- original line. //kt 7/19/2007
|
---|
| 467 | //TX_RETRACT_CAP = 'Retraction Notice'; <-- original line. //kt 7/19/2007
|
---|
| 468 | //TX_RETRACT = 'This document will now be RETRACTED. As Such, it has been removed' +CRLF + <-- original line. //kt 7/19/2007
|
---|
| 469 | // ' from public view, and from typical Releases of Information,' +CRLF + <-- original line. //kt 7/19/2007
|
---|
| 470 | // ' but will remain indefinitely discoverable to HIMS.' +CRLF +CRLF; <-- original line. //kt 7/19/2007
|
---|
| 471 | //TX_AUTH_SIGNED = 'Author has not signed, are you SURE you want to sign.' +CRLF; <-- original line. //kt 7/19/2007
|
---|
| 472 | {
|
---|
| 473 | type
|
---|
| 474 | //CQ8300
|
---|
| 475 | ClipboardData = record
|
---|
| 476 | Text: array[0..255] of char;
|
---|
| 477 | end;
|
---|
| 478 | }
|
---|
| 479 |
|
---|
| 480 |
|
---|
| 481 | var
|
---|
| 482 | TX_NEED_VISIT : string; //kt
|
---|
| 483 | TX_CREATE_ERR : string; //kt
|
---|
| 484 | TX_UPDATE_ERR : string; //kt
|
---|
| 485 | TX_NO_NOTE : string; //kt
|
---|
| 486 | TX_SAVE_NOTE : string; //kt
|
---|
| 487 | TX_ADDEND_NO : string; //kt
|
---|
| 488 | TX_DEL_OK : string; //kt
|
---|
| 489 | TX_DEL_ERR : string; //kt
|
---|
| 490 | TX_SIGN : string; //kt
|
---|
| 491 | TX_COSIGN : string; //kt
|
---|
| 492 | TX_SIGN_ERR : string; //kt
|
---|
| 493 | TX_NONOTE : string; //kt
|
---|
| 494 | TX_NONOTE_CAP : string; //kt
|
---|
| 495 | TX_NOPRT_NEW : string; //kt
|
---|
| 496 | TX_NOPRT_NEW_CAP : string; //kt
|
---|
| 497 | TX_NO_ALERT : string; //kt
|
---|
| 498 | TX_CAP_NO_ALERT : string; //kt
|
---|
| 499 | TX_ORDER_LOCKED : string; //kt
|
---|
| 500 | TC_ORDER_LOCKED : string; //kt
|
---|
| 501 | TX_NO_ORD_CHG : string; //kt
|
---|
| 502 | TC_NO_ORD_CHG : string; //kt
|
---|
| 503 | TX_NEW_SAVE1 : string; //kt
|
---|
| 504 | TX_NEW_SAVE2 : string; //kt
|
---|
| 505 | TX_NEW_SAVE3 : string; //kt
|
---|
| 506 | TX_NEW_SAVE4 : string; //kt
|
---|
| 507 | TX_NEW_SAVE5 : string; //kt
|
---|
| 508 | TC_NEW_SAVE2 : string; //kt
|
---|
| 509 | TC_NEW_SAVE3 : string; //kt
|
---|
| 510 | TC_NEW_SAVE4 : string; //kt
|
---|
| 511 | TC_NEW_SAVE5 : string; //kt
|
---|
| 512 | TX_EMPTY_NOTE : string; //kt
|
---|
| 513 | TC_EMPTY_NOTE : string; //kt
|
---|
| 514 | TX_EMPTY_NOTE1 : string; //kt
|
---|
| 515 | TC_NO_LOCK : string; //kt
|
---|
| 516 | TX_ABSAVE : string; //kt
|
---|
| 517 | TC_ABSAVE : string; //kt
|
---|
| 518 | TX_NO_BOIL : string; //kt
|
---|
| 519 | TC_NO_BOIL : string; //kt
|
---|
| 520 | TX_BLR_CLEAR : string; //kt
|
---|
| 521 | TC_BLR_CLEAR : string; //kt
|
---|
| 522 | TX_DETACH_CNF : string; //kt
|
---|
| 523 | TX_DETACH_FAILURE : string; //kt
|
---|
| 524 | TX_RETRACT_CAP : string; //kt
|
---|
| 525 | TX_RETRACT : string; //kt
|
---|
| 526 | TX_AUTH_SIGNED : string; //kt
|
---|
| 527 |
|
---|
| 528 | procedure SetupVars;
|
---|
| 529 | //kt Added entire function to replace constant declarations 7/19/2007
|
---|
| 530 | begin
|
---|
| 531 | TX_NEED_VISIT := DKLangConstW('fNotes_A_visit_is_required_before_creating_a_new_progress_notex');
|
---|
| 532 | TX_CREATE_ERR := DKLangConstW('fNotes_Error_Creating_Note');
|
---|
| 533 | TX_UPDATE_ERR := DKLangConstW('fNotes_Error_Updating_Note');
|
---|
| 534 | TX_NO_NOTE := DKLangConstW('fNotes_No_progress_note_is_currently_being_edited');
|
---|
| 535 | TX_SAVE_NOTE := DKLangConstW('fNotes_Save_Progress_Note');
|
---|
| 536 | TX_ADDEND_NO := DKLangConstW('fNotes_Cannot_make_an_addendum_to_a_note_that_is_being_edited');
|
---|
| 537 | TX_DEL_OK := CRLF + CRLF + DKLangConstW('fNotes_Delete_this_progress_notex');
|
---|
| 538 | TX_DEL_ERR := DKLangConstW('fNotes_Unable_to_Delete_Note');
|
---|
| 539 | TX_SIGN := DKLangConstW('fNotes_Sign_Note');
|
---|
| 540 | TX_COSIGN := DKLangConstW('fNotes_Cosign_Note');
|
---|
| 541 | TX_SIGN_ERR := DKLangConstW('fNotes_Unable_to_Sign_Note');
|
---|
| 542 | TX_NONOTE := DKLangConstW('fNotes_No_progress_note_is_currently_selectedx');
|
---|
| 543 | TX_NONOTE_CAP := DKLangConstW('fNotes_No_Note_Selected');
|
---|
| 544 | TX_NOPRT_NEW := DKLangConstW('fNotes_This_progress_note_may_not_be_printed_until_it_is_saved');
|
---|
| 545 | TX_NOPRT_NEW_CAP := DKLangConstW('fNotes_Save_Progress_Note');
|
---|
| 546 | TX_NO_ALERT := DKLangConstW('fNotes_There_is_insufficient_information_to_process_this_alertx') + CRLF +
|
---|
| 547 | DKLangConstW('fNotes_Either_the_alert_has_already_been_deletedx_or_it_contained_invalid_datax') + CRLF + CRLF +
|
---|
| 548 | DKLangConstW('fNotes_Click_the_NEXT_button_if_you_wish_to_continue_processing_more_alertsx');
|
---|
| 549 | TX_CAP_NO_ALERT := DKLangConstW('fNotes_Unable_to_Process_Alert');
|
---|
| 550 | TX_ORDER_LOCKED := DKLangConstW('fNotes_This_record_is_locked_by_an_action_underway_on_the_Consults_tab');
|
---|
| 551 | TC_ORDER_LOCKED := DKLangConstW('fNotes_Unable_to_access_record');
|
---|
| 552 | TX_NO_ORD_CHG := DKLangConstW('fNotes_The_note_is_still_associated_with_the_previously_selected_requestx') + CRLF +
|
---|
| 553 | DKLangConstW('fNotes_Finish_the_pending_action_on_the_consults_tabx_then_try_againx');
|
---|
| 554 | TC_NO_ORD_CHG := DKLangConstW('fNotes_Locked_Consult_Request');
|
---|
| 555 | TX_NEW_SAVE1 := DKLangConstW('fNotes_You_are_currently_editingx') + CRLF + CRLF;
|
---|
| 556 | TX_NEW_SAVE2 := CRLF + CRLF + DKLangConstW('fNotes_Do_you_wish_to_save_this_note_and_begin_a_new_onex');
|
---|
| 557 | TX_NEW_SAVE3 := CRLF + CRLF + DKLangConstW('fNotes_Do_you_wish_to_save_this_note_and_begin_a_new_addendumx');
|
---|
| 558 | TX_NEW_SAVE4 := CRLF + CRLF + DKLangConstW('fNotes_Do_you_wish_to_save_this_note_and_edit_the_one_selectedx');
|
---|
| 559 | TX_NEW_SAVE5 := CRLF + CRLF + DKLangConstW('fNotes_Do_you_wish_to_save_this_note_and_begin_a_new_Interdisciplinary_entryx');
|
---|
| 560 | TC_NEW_SAVE2 := DKLangConstW('fNotes_Create_New_Note');
|
---|
| 561 | TC_NEW_SAVE3 := DKLangConstW('fNotes_Create_New_Addendum');
|
---|
| 562 | TC_NEW_SAVE4 := DKLangConstW('fNotes_Edit_Different_Note');
|
---|
| 563 | TC_NEW_SAVE5 := DKLangConstW('fNotes_Create_New_Interdisciplinary_Entry');
|
---|
| 564 | TX_EMPTY_NOTE := CRLF + CRLF + DKLangConstW('fNotes_This_note_contains_no_text_and_will_not_be_savedx') + CRLF +
|
---|
| 565 | DKLangConstW('fNotes_Do_you_wish_to_delete_this_notex');
|
---|
| 566 | TC_EMPTY_NOTE := DKLangConstW('fNotes_Empty_Note');
|
---|
| 567 | TX_EMPTY_NOTE1 := DKLangConstW('fNotes_This_note_contains_no_text_and_can_not_be_signedx');
|
---|
| 568 | TC_NO_LOCK := DKLangConstW('fNotes_Unable_to_Lock_Note');
|
---|
| 569 | TX_ABSAVE := DKLangConstW('fNotes_It_appears_the_session_terminated_abnormally_when_this') + CRLF +
|
---|
| 570 | DKLangConstW('fNotes_note_was_last_editedx_Some_text_may_not_have_been_savedx') + CRLF + CRLF +
|
---|
| 571 | DKLangConstW('fNotes_Do_you_wish_to_continue_and_sign_the_notex');
|
---|
| 572 | TC_ABSAVE := DKLangConstW('fNotes_Possible_Missing_Text');
|
---|
| 573 | TX_NO_BOIL := DKLangConstW('fNotes_There_is_no_boilerplate_text_associated_with_this_titlex');
|
---|
| 574 | TC_NO_BOIL := DKLangConstW('fNotes_Load_Boilerplate_Text');
|
---|
| 575 | TX_BLR_CLEAR := DKLangConstW('fNotes_Do_you_want_to_clear_the_previously_loaded_boilerplate_textx');
|
---|
| 576 | TC_BLR_CLEAR := DKLangConstW('fNotes_Clear_Previous_Boilerplate_Text');
|
---|
| 577 | TX_DETACH_CNF := DKLangConstW('fNotes_Confirm_Detachment');
|
---|
| 578 | TX_DETACH_FAILURE := DKLangConstW('fNotes_Detach_failed');
|
---|
| 579 | TX_RETRACT_CAP := DKLangConstW('fNotes_Retraction_Notice');
|
---|
| 580 | TX_RETRACT := DKLangConstW('fNotes_This_document_will_now_be_RETRACTEDx__As_Suchx_it_has_been_removed') +CRLF +
|
---|
| 581 | DKLangConstW('fNotes_from_public_viewx_and_from_typical_Releases_of_Informationx') +CRLF +
|
---|
| 582 | DKLangConstW('fNotes_but_will_remain_indefinitely_discoverable_to_HIMSx') +CRLF +CRLF;
|
---|
| 583 | TX_AUTH_SIGNED := DKLangConstW('fNotes_Author_has_not_signedx_are_you_SURE_you_want_to_signx') +CRLF;
|
---|
| 584 | end;
|
---|
| 585 |
|
---|
| 586 | var
|
---|
| 587 | uPCEShow, uPCEEdit: TPCEData;
|
---|
| 588 | ViewContext: Integer;
|
---|
| 589 | frmDrawers: TfrmDrawers;
|
---|
| 590 | uTIUContext: TTIUContext;
|
---|
| 591 | ColumnToSort: Integer;
|
---|
| 592 | ColumnSortForward: Boolean;
|
---|
| 593 | uChanging: Boolean;
|
---|
| 594 | uIDNotesActive: Boolean;
|
---|
| 595 |
|
---|
[541] | 596 | constructor TfrmNotes.Create(AOwner: TComponent);
|
---|
| 597 | //kt Added function 8/09
|
---|
| 598 | begin
|
---|
| 599 | inherited Create(AOwner);
|
---|
| 600 | FViewNote := TStringList.Create;
|
---|
| 601 | end;
|
---|
[453] | 602 |
|
---|
[541] | 603 | destructor TfrmNotes.Destroy;
|
---|
| 604 | //kt Added function 8/09
|
---|
| 605 | begin
|
---|
| 606 | FViewNote.Free;
|
---|
| 607 | FEditNote.Lines.Free; //kt
|
---|
| 608 | inherited Destroy;
|
---|
| 609 | end;
|
---|
| 610 |
|
---|
| 611 |
|
---|
[453] | 612 | { TPage common methods --------------------------------------------------------------------- }
|
---|
| 613 | function TfrmNotes.AllowContextChange(var WhyNot: string): Boolean;
|
---|
| 614 | begin
|
---|
| 615 | dlgFindText.CloseDialog;
|
---|
| 616 | Result := inherited AllowContextChange(WhyNot); // sets result = true
|
---|
| 617 | if Assigned(frmTemplateDialog) then
|
---|
| 618 | if Screen.ActiveForm = frmTemplateDialog then
|
---|
| 619 | //if (fsModal in frmTemplateDialog.FormState) then
|
---|
| 620 | case BOOLCHAR[frmFrame.CCOWContextChanging] of
|
---|
| 621 | '1': begin
|
---|
| 622 | // WhyNot := 'A template in progress will be aborted. '; <-- original line. //kt 7/19/2007
|
---|
| 623 | WhyNot := DKLangConstW('fNotes_A_template_in_progress_will_be_abortedx'); //kt added 7/19/2007
|
---|
| 624 | Result := False;
|
---|
| 625 | end;
|
---|
| 626 | '0': begin
|
---|
| 627 | // if WhyNot = 'COMMIT' then <-- original line. //kt 7/19/2007
|
---|
| 628 | if WhyNot = DKLangConstW('fNotes_COMMIT') then //kt added 7/19/2007
|
---|
| 629 | begin
|
---|
| 630 | FSilent := True;
|
---|
| 631 | frmTemplateDialog.Silent := True;
|
---|
| 632 | frmTemplateDialog.ModalResult := mrCancel;
|
---|
| 633 | end;
|
---|
| 634 | end;
|
---|
| 635 | end;
|
---|
| 636 | if Assigned(frmRemDlg) then
|
---|
| 637 | case BOOLCHAR[frmFrame.CCOWContextChanging] of
|
---|
| 638 | '1': begin
|
---|
| 639 | // WhyNot := 'All current reminder processing information will be discarded. '; <-- original line. //kt 7/19/2007
|
---|
| 640 | WhyNot := DKLangConstW('fNotes_All_current_reminder_processing_information_will_be_discardedx'); //kt added 7/19/2007
|
---|
| 641 | Result := False;
|
---|
| 642 | end;
|
---|
| 643 | '0': begin
|
---|
| 644 | if WhyNot = 'COMMIT' then
|
---|
| 645 | begin
|
---|
| 646 | FSilent := True;
|
---|
| 647 | frmRemDlg.Silent := True;
|
---|
| 648 | frmRemDlg.btnCancelClick(Self);
|
---|
| 649 | end;
|
---|
| 650 | end;
|
---|
| 651 | end;
|
---|
| 652 | if EditingIndex <> -1 then
|
---|
| 653 | case BOOLCHAR[frmFrame.CCOWContextChanging] of
|
---|
| 654 | '1': begin
|
---|
[541] | 655 | if ((vmHTML in FViewMode) and (HTMLEditor.Text <> '')) //kt 8/09
|
---|
| 656 | or ((not (vmHTML in FViewMode)) and (memNewNote.GetTextLen > 0 )) then begin //kt
|
---|
[453] | 657 | // WhyNot := WhyNot + 'A note in progress will be saved as unsigned. ' <-- original line. //kt 7/19/2007
|
---|
| 658 | WhyNot := WhyNot + DKLangConstW('fNotes_A_note_in_progress_will_be_saved_as_unsignedx') //kt added 7/19/2007
|
---|
[541] | 659 | end else begin //kt
|
---|
[453] | 660 | // WhyNot := WhyNot + 'An empty note in progress will be deleted. '; <-- original line. //kt 7/19/2007
|
---|
| 661 | WhyNot := WhyNot + DKLangConstW('fNotes_An_empty_note_in_progress_will_be_deletedx'); //kt added 7/19/2007
|
---|
[541] | 662 | end; //kt
|
---|
[453] | 663 | Result := False;
|
---|
| 664 | end;
|
---|
| 665 | '0': begin
|
---|
| 666 | // if WhyNot = 'COMMIT' then FSilent := True; <-- original line. //kt 7/19/2007
|
---|
| 667 | if WhyNot = DKLangConstW('fNotes_COMMIT') then FSilent := True; //kt added 7/19/2007
|
---|
| 668 | SaveCurrentNote(Result)
|
---|
| 669 | end;
|
---|
| 670 | end;
|
---|
| 671 | if Assigned(frmEncounterFrame) then
|
---|
| 672 | if Screen.ActiveForm = frmEncounterFrame then
|
---|
| 673 | //if (fsModal in frmEncounterFrame.FormState) then
|
---|
| 674 | case BOOLCHAR[frmFrame.CCOWContextChanging] of
|
---|
| 675 | '1': begin
|
---|
| 676 | // WhyNot := WhyNot + 'Encounter information being edited will not be saved'; <-- original line. //kt 7/19/2007
|
---|
| 677 | WhyNot := WhyNot + DKLangConstW('fNotes_Encounter_information_being_edited_will_not_be_saved'); //kt added 7/19/2007
|
---|
| 678 | Result := False;
|
---|
| 679 | end;
|
---|
| 680 | '0': begin
|
---|
| 681 | if WhyNot = 'COMMIT' then
|
---|
| 682 | begin
|
---|
| 683 | FSilent := True;
|
---|
| 684 | frmEncounterFrame.Abort := False;
|
---|
| 685 | frmEncounterFrame.Cancel := True;
|
---|
| 686 | end;
|
---|
| 687 | end;
|
---|
| 688 | end;
|
---|
| 689 | end;
|
---|
| 690 |
|
---|
| 691 | procedure TfrmNotes.LstNotesToPrint;
|
---|
| 692 | var
|
---|
| 693 | AParentID: string;
|
---|
| 694 | SavedDocID: string;
|
---|
| 695 | Saved: boolean;
|
---|
| 696 | begin
|
---|
| 697 | inherited;
|
---|
| 698 | if not uIDNotesActive then exit;
|
---|
| 699 | if lstNotes.ItemIEN = 0 then exit;
|
---|
| 700 | SavedDocID := lstNotes.ItemID;
|
---|
| 701 | if EditingIndex <> -1 then
|
---|
| 702 | begin
|
---|
| 703 | SaveCurrentNote(Saved);
|
---|
| 704 | if not Saved then Exit;
|
---|
| 705 | LoadNotes;
|
---|
| 706 | with tvNotes do Selected := FindPieceNode(SavedDocID, U, Items.GetFirstNode);
|
---|
| 707 | end;
|
---|
| 708 | if tvNotes.Selected = nil then exit;
|
---|
| 709 | AParentID := frmPrintList.SelectParentFromList(tvNotes,CT_NOTES);
|
---|
| 710 | if AParentID = '' then exit;
|
---|
| 711 | with tvNotes do Selected := FindPieceNode(AParentID, 1, U, Items.GetFirstNode);
|
---|
| 712 | end;
|
---|
| 713 |
|
---|
| 714 | procedure TfrmNotes.ClearPtData;
|
---|
| 715 | { clear all controls that contain patient specific information }
|
---|
| 716 | begin
|
---|
| 717 | inherited ClearPtData;
|
---|
| 718 | ClearEditControls;
|
---|
| 719 | uChanging := True;
|
---|
| 720 | tvNotes.Items.BeginUpdate;
|
---|
| 721 | KilldocTreeObjects(tvNotes);
|
---|
| 722 | tvNotes.Items.Clear;
|
---|
| 723 | tvNotes.Items.EndUpdate;
|
---|
| 724 | lvNotes.Items.Clear;
|
---|
| 725 | uChanging := False;
|
---|
| 726 | lstNotes.Clear;
|
---|
| 727 | memNote.Clear;
|
---|
[541] | 728 | HTMLViewer.Clear; //kt
|
---|
| 729 | HTMLEditor.Clear; //kt
|
---|
| 730 | FWarmedUp := false; //kt
|
---|
| 731 | SetDisplayToHTMLvsText([vmText,vmView],nil,VIEW_ACTIVATE_ONLY); //kt
|
---|
[453] | 732 | memPCEShow.Clear;
|
---|
| 733 | uPCEShow.Clear;
|
---|
| 734 | uPCEEdit.Clear;
|
---|
| 735 | frmDrawers.ResetTemplates;
|
---|
| 736 | end;
|
---|
| 737 |
|
---|
| 738 | procedure TfrmNotes.DisplayPage;
|
---|
| 739 | { causes page to be visible and conditionally executes initialization code }
|
---|
| 740 | begin
|
---|
| 741 | inherited DisplayPage;
|
---|
| 742 | frmFrame.ShowHideChartTabMenus(mnuViewChart);
|
---|
| 743 | frmFrame.mnuFilePrint.Tag := CT_NOTES;
|
---|
| 744 | frmFrame.mnuFilePrint.Enabled := True;
|
---|
| 745 | frmFrame.mnuFilePrintSetup.Enabled := True;
|
---|
| 746 | frmFrame.mnuFilePrintSelectedItems.Enabled := True;
|
---|
| 747 | if InitPage then
|
---|
| 748 | begin
|
---|
| 749 | EnableDisableIDNotes;
|
---|
| 750 | FDefaultContext := GetCurrentTIUContext;
|
---|
| 751 | FCurrentContext := FDefaultContext;
|
---|
| 752 | popNoteMemoSpell.Visible := SpellCheckAvailable;
|
---|
| 753 | popNoteMemoGrammar.Visible := popNoteMemoSpell.Visible;
|
---|
| 754 | Z11.Visible := popNoteMemoSpell.Visible;
|
---|
| 755 | timAutoSave.Interval := User.AutoSave * 1000; // convert seconds to milliseconds
|
---|
| 756 | SetEqualTabStops(memNewNote);
|
---|
| 757 | end;
|
---|
| 758 | // to indent the right margin need to set Paragraph.RightIndent for each paragraph?
|
---|
| 759 | if InitPatient and not (CallingContext = CC_NOTIFICATION) then
|
---|
| 760 | begin
|
---|
| 761 | SetViewContext(FDefaultContext);
|
---|
| 762 | end;
|
---|
| 763 | case CallingContext of
|
---|
| 764 | CC_INIT_PATIENT: if not InitPatient then
|
---|
| 765 | begin
|
---|
| 766 | SetViewContext(FDefaultContext);
|
---|
| 767 | end;
|
---|
| 768 | CC_NOTIFICATION: ProcessNotifications;
|
---|
| 769 | end;
|
---|
| 770 | end;
|
---|
| 771 |
|
---|
| 772 | procedure TfrmNotes.RequestPrint;
|
---|
| 773 | var
|
---|
| 774 | Saved: Boolean;
|
---|
| 775 | begin
|
---|
| 776 | SetupVars; //kt added 7/19/2007 to replace constants with vars.
|
---|
| 777 | with lstNotes do
|
---|
| 778 | begin
|
---|
| 779 | if ItemIndex = EditingIndex then
|
---|
| 780 | //if ItemIEN < 0 then
|
---|
| 781 | begin
|
---|
| 782 | SaveCurrentNote(Saved);
|
---|
| 783 | if not Saved then Exit;
|
---|
| 784 | end;
|
---|
| 785 | if ItemIEN > 0 then PrintNote(ItemIEN, MakeNoteDisplayText(Items[ItemIndex])) else
|
---|
| 786 | begin
|
---|
| 787 | if ItemIEN = 0 then InfoBox(TX_NONOTE, TX_NONOTE_CAP, MB_OK);
|
---|
| 788 | if ItemIEN < 0 then InfoBox(TX_NOPRT_NEW, TX_NOPRT_NEW_CAP, MB_OK);
|
---|
| 789 | end;
|
---|
| 790 | end;
|
---|
| 791 | end;
|
---|
| 792 |
|
---|
| 793 | {for printing multiple notes}
|
---|
| 794 | procedure TfrmNotes.RequestMultiplePrint(AForm: TfrmPrintList);
|
---|
| 795 | var
|
---|
| 796 | NoteIEN: int64;
|
---|
| 797 | i: integer;
|
---|
| 798 | begin
|
---|
| 799 | SetupVars; //kt added 7/19/2007 to replace constants with vars.
|
---|
| 800 | with AForm.lbIDParents do
|
---|
| 801 | begin
|
---|
| 802 | for i := 0 to Items.Count - 1 do
|
---|
| 803 | begin
|
---|
| 804 | if Selected[i] then
|
---|
| 805 | begin
|
---|
| 806 | NoteIEN := StrToInt64def(Piece(TStringList(Items.Objects[i])[0],U,1),0);
|
---|
| 807 | if NoteIEN > 0 then PrintNote(NoteIEN, Items[i], TRUE) else
|
---|
| 808 | begin
|
---|
| 809 | if NoteIEN = 0 then InfoBox(TX_NONOTE, TX_NONOTE_CAP, MB_OK);
|
---|
| 810 | if NoteIEN < 0 then InfoBox(TX_NOPRT_NEW, TX_NOPRT_NEW_CAP, MB_OK);
|
---|
| 811 | end;
|
---|
| 812 | end; {if selected}
|
---|
| 813 | end; {for}
|
---|
| 814 | end; {with}
|
---|
| 815 | end;
|
---|
| 816 |
|
---|
| 817 | procedure TfrmNotes.SetFontSize(NewFontSize: Integer);
|
---|
| 818 | { adjusts the font size of any controls that don't have ParentFont = True }
|
---|
| 819 | begin
|
---|
| 820 | inherited SetFontSize(NewFontSize);
|
---|
| 821 | frmDrawers.Font.Size := NewFontSize;
|
---|
| 822 | SetEqualTabStops(memNewNote);
|
---|
| 823 | end;
|
---|
| 824 |
|
---|
| 825 | procedure TfrmNotes.mnuChartTabClick(Sender: TObject);
|
---|
| 826 | { reroute to Chart Tab menu of the parent form: frmFrame }
|
---|
| 827 | begin
|
---|
| 828 | inherited;
|
---|
| 829 | frmFrame.mnuChartTabClick(Sender);
|
---|
| 830 | end;
|
---|
| 831 |
|
---|
| 832 | { General procedures ----------------------------------------------------------------------- }
|
---|
| 833 |
|
---|
| 834 | procedure TfrmNotes.ClearEditControls;
|
---|
| 835 | { resets controls used for entering a new progress note }
|
---|
| 836 | begin
|
---|
| 837 | // clear FEditNote (should FEditNote be an object with a clear method?)
|
---|
| 838 | with FEditNote do
|
---|
| 839 | begin
|
---|
| 840 | DocType := 0;
|
---|
| 841 | Title := 0;
|
---|
| 842 | TitleName := '';
|
---|
| 843 | DateTime := 0;
|
---|
| 844 | Author := 0;
|
---|
| 845 | AuthorName := '';
|
---|
| 846 | Cosigner := 0;
|
---|
| 847 | CosignerName := '';
|
---|
| 848 | Subject := '';
|
---|
| 849 | Location := 0;
|
---|
| 850 | LocationName := '';
|
---|
| 851 | PkgIEN := 0;
|
---|
| 852 | PkgPtr := '';
|
---|
| 853 | PkgRef := '';
|
---|
| 854 | NeedCPT := False;
|
---|
| 855 | Addend := 0;
|
---|
| 856 | {LastCosigner & LastCosignerName aren't cleared because they're used as default for next note.}
|
---|
[541] | 857 | //kt 8/09 Lines := nil;
|
---|
| 858 | if Assigned (Lines) then Lines.Clear; //kt 8/09
|
---|
[453] | 859 | PRF_IEN := 0;
|
---|
| 860 | ActionIEN := '';
|
---|
| 861 | end;
|
---|
| 862 | // clear the editing controls (also clear the new labels?)
|
---|
| 863 | txtSubject.Text := '';
|
---|
| 864 | if memNewNote <> nil then memNewNote.Clear; //CQ7012 Added test for nil
|
---|
[541] | 865 | HTMLEditor.Clear; //kt 8/09
|
---|
| 866 | HTMLViewer.Clear; //kt 8/09
|
---|
| 867 | FHTMLEditMode := emNone; //kt 8/09
|
---|
[453] | 868 | timAutoSave.Enabled := False;
|
---|
| 869 | // clear the PCE object for editing
|
---|
| 870 | uPCEEdit.Clear;
|
---|
| 871 | // set the tracking variables to initial state
|
---|
| 872 | EditingIndex := -1;
|
---|
| 873 | FChanged := False;
|
---|
| 874 | end;
|
---|
| 875 |
|
---|
| 876 | procedure TfrmNotes.ShowPCEControls(ShouldShow: Boolean);
|
---|
| 877 | begin
|
---|
| 878 | sptVert.Visible := ShouldShow;
|
---|
| 879 | memPCEShow.Visible := ShouldShow;
|
---|
| 880 | if(ShouldShow) then
|
---|
| 881 | sptVert.Top := memPCEShow.Top - sptVert.Height;
|
---|
[541] | 882 | if (vmHTML in FViewMode) then begin //kt 8/09
|
---|
| 883 | HTMLViewer.Invalidate; //kt 8/09
|
---|
| 884 | end else begin //kt 8/09
|
---|
| 885 | memNote.Invalidate;
|
---|
| 886 | end; //kt 8/09
|
---|
[453] | 887 | end;
|
---|
| 888 |
|
---|
| 889 | procedure TfrmNotes.DisplayPCE;
|
---|
| 890 | { displays PCE information if appropriate & enables/disabled editing of PCE data }
|
---|
| 891 | var
|
---|
| 892 | EnableList, ShowList: TDrawers;
|
---|
| 893 | VitalStr: TStringlist;
|
---|
| 894 | NoPCE: boolean;
|
---|
| 895 | ActionSts: TActionRec;
|
---|
| 896 | AnIEN: integer;
|
---|
| 897 | begin
|
---|
| 898 | memPCEShow.Clear;
|
---|
| 899 | with lstNotes do if ItemIndex = EditingIndex then
|
---|
| 900 | begin
|
---|
| 901 | with uPCEEdit do
|
---|
| 902 | begin
|
---|
| 903 | AddStrData(memPCEShow.Lines);
|
---|
| 904 | NoPCE := (memPCEShow.Lines.Count = 0);
|
---|
| 905 | VitalStr := TStringList.create;
|
---|
| 906 | try
|
---|
| 907 | GetVitalsFromDate(VitalStr, uPCEEdit);
|
---|
| 908 | AddVitalData(VitalStr, memPCEShow.Lines);
|
---|
| 909 | finally
|
---|
| 910 | VitalStr.free;
|
---|
| 911 | end;
|
---|
| 912 | ShowPCEButtons(TRUE);
|
---|
| 913 | ShowPCEControls(cmdPCE.Enabled or (memPCEShow.Lines.Count > 0));
|
---|
| 914 | if(NoPCE and memPCEShow.Visible) then
|
---|
| 915 | memPCEShow.Lines.Insert(0, TX_NOPCE);
|
---|
| 916 | memPCEShow.SelStart := 0;
|
---|
| 917 |
|
---|
| 918 | if(InteractiveRemindersActive) then
|
---|
| 919 | begin
|
---|
| 920 | if(GetReminderStatus = rsNone) then
|
---|
| 921 | EnableList := [odTemplates]
|
---|
| 922 | else
|
---|
| 923 | EnableList := [odTemplates, odReminders];
|
---|
| 924 | ShowList := [odTemplates, odReminders];
|
---|
| 925 | end
|
---|
| 926 | else
|
---|
| 927 | begin
|
---|
| 928 | EnableList := [odTemplates];
|
---|
| 929 | ShowList := [odTemplates];
|
---|
| 930 | end;
|
---|
| 931 | frmDrawers.DisplayDrawers(TRUE, EnableList, ShowList);
|
---|
| 932 | end;
|
---|
| 933 | end else
|
---|
| 934 | begin
|
---|
| 935 | ShowPCEButtons(FALSE);
|
---|
| 936 | frmDrawers.DisplayDrawers(TRUE, [odTemplates], [odTemplates]);
|
---|
| 937 | AnIEN := lstNotes.ItemIEN;
|
---|
| 938 | ActOnDocument(ActionSts, AnIEN, 'VIEW');
|
---|
| 939 | if ActionSts.Success then
|
---|
| 940 | begin
|
---|
| 941 | // StatusText('Retrieving encounter information...'); <-- original line. //kt 7/19/2007
|
---|
| 942 | StatusText(DKLangConstW('fNotes_Retrieving_encounter_informationxxx')); //kt added 7/19/2007
|
---|
| 943 | with uPCEShow do
|
---|
| 944 | begin
|
---|
| 945 | NoteDateTime := MakeFMDateTime(Piece(lstNotes.Items[lstNotes.ItemIndex], U, 3));
|
---|
| 946 | PCEForNote(AnIEN, uPCEEdit);
|
---|
| 947 | AddStrData(memPCEShow.Lines);
|
---|
| 948 | NoPCE := (memPCEShow.Lines.Count = 0);
|
---|
| 949 | VitalStr := TStringList.create;
|
---|
| 950 | try
|
---|
| 951 | GetVitalsFromNote(VitalStr, uPCEShow, AnIEN);
|
---|
| 952 | AddVitalData(VitalStr, memPCEShow.Lines);
|
---|
| 953 | finally
|
---|
| 954 | VitalStr.free;
|
---|
| 955 | end;
|
---|
| 956 | ShowPCEControls(memPCEShow.Lines.Count > 0);
|
---|
| 957 | if(NoPCE and memPCEShow.Visible) then
|
---|
| 958 | memPCEShow.Lines.Insert(0, TX_NOPCE);
|
---|
| 959 | memPCEShow.SelStart := 0;
|
---|
| 960 | end;
|
---|
| 961 | StatusText('');
|
---|
| 962 | end
|
---|
| 963 | else
|
---|
| 964 | ShowPCEControls(FALSE);
|
---|
| 965 | end; {if ItemIndex}
|
---|
| 966 | end;
|
---|
| 967 |
|
---|
| 968 | { supporting calls for writing notes }
|
---|
| 969 |
|
---|
| 970 | function TfrmNotes.GetTitleText(AnIndex: Integer): string;
|
---|
| 971 | { returns non-tabbed text for the title of a note given the ItemIndex in lstNotes }
|
---|
| 972 | begin
|
---|
| 973 | with lstNotes do
|
---|
| 974 | Result := FormatFMDateTime('mmm dd,yy', MakeFMDateTime(Piece(Items[AnIndex], U, 3))) +
|
---|
| 975 | ' ' + Piece(Items[AnIndex], U, 2) + ', ' + Piece(Items[AnIndex], U, 6) + ', ' +
|
---|
| 976 | Piece(Piece(Items[AnIndex], U, 5), ';', 2)
|
---|
| 977 | end;
|
---|
| 978 |
|
---|
| 979 | function TfrmNotes.LacksRequiredForCreate: Boolean;
|
---|
| 980 | { determines if the fields required to create the note are present }
|
---|
| 981 | var
|
---|
| 982 | CurTitle: Integer;
|
---|
| 983 | begin
|
---|
| 984 | Result := False;
|
---|
| 985 | with FEditNote do
|
---|
| 986 | begin
|
---|
| 987 | if Title <= 0 then Result := True;
|
---|
| 988 | if Author <= 0 then Result := True;
|
---|
| 989 | if DateTime <= 0 then Result := True;
|
---|
| 990 | if IsConsultTitle(Title) and (PkgIEN = 0) then Result := True;
|
---|
| 991 | if IsSurgeryTitle(Title) and (PkgIEN = 0) then Result := True;
|
---|
| 992 | if IsPRFTitle(Title) and (PRF_IEN = 0) and (not DocType = TYP_ADDENDUM) then Result := True;
|
---|
| 993 | if (DocType = TYP_ADDENDUM) then
|
---|
| 994 | begin
|
---|
| 995 | if AskCosignerForDocument(Addend, Author) and (Cosigner <= 0) then Result := True;
|
---|
| 996 | end else
|
---|
| 997 | begin
|
---|
| 998 | if Title > 0 then CurTitle := Title else CurTitle := DocType;
|
---|
| 999 | if AskCosignerForTitle(CurTitle, Author, DateTime) and (Cosigner <= 0) then Result := True;
|
---|
| 1000 | end;
|
---|
| 1001 | end;
|
---|
| 1002 | end;
|
---|
| 1003 |
|
---|
| 1004 | function TfrmNotes.VerifyNoteTitle: Boolean;
|
---|
| 1005 | const
|
---|
| 1006 | VNT_UNKNOWN = 0;
|
---|
| 1007 | VNT_NO = 1;
|
---|
| 1008 | VNT_YES = 2;
|
---|
| 1009 | var
|
---|
| 1010 | AParam: string;
|
---|
| 1011 | begin
|
---|
| 1012 | if FVerifyNoteTitle = VNT_UNKNOWN then
|
---|
| 1013 | begin
|
---|
| 1014 | AParam := GetUserParam('ORWOR VERIFY NOTE TITLE');
|
---|
| 1015 | if AParam = '1' then FVerifyNoteTitle := VNT_YES else FVerifyNoteTitle := VNT_NO;
|
---|
| 1016 | end;
|
---|
| 1017 | Result := FVerifyNoteTitle = VNT_YES;
|
---|
| 1018 | end;
|
---|
| 1019 |
|
---|
| 1020 | procedure TfrmNotes.SetSubjectVisible(ShouldShow: Boolean);
|
---|
| 1021 | { hide/show subject & resize panel accordingly - leave 6 pixel margin above memNewNote }
|
---|
| 1022 | begin
|
---|
| 1023 | if ShouldShow then
|
---|
| 1024 | begin
|
---|
| 1025 | lblSubject.Visible := True;
|
---|
| 1026 | txtSubject.Visible := True;
|
---|
| 1027 | pnlFields.Height := txtSubject.Top + txtSubject.Height + 6;
|
---|
| 1028 | end else
|
---|
| 1029 | begin
|
---|
| 1030 | lblSubject.Visible := False;
|
---|
| 1031 | txtSubject.Visible := False;
|
---|
| 1032 | pnlFields.Height := lblVisit.Top + lblVisit.Height + 6;
|
---|
| 1033 | end;
|
---|
| 1034 | end;
|
---|
| 1035 |
|
---|
| 1036 | { consult request and note locking }
|
---|
| 1037 |
|
---|
| 1038 | function TfrmNotes.LockConsultRequest(AConsult: Integer): Boolean;
|
---|
| 1039 | { returns true if consult successfully locked }
|
---|
| 1040 | begin
|
---|
| 1041 | SetupVars; //kt added 7/19/2007 to replace constants with vars.
|
---|
| 1042 | // *** I'm not sure about the FOrderID field - if the user is editing one note and
|
---|
| 1043 | // deletes another, FOrderID will be for editing note, then delete note, then null
|
---|
| 1044 | Result := True;
|
---|
| 1045 | FOrderID := GetConsultOrderIEN(AConsult);
|
---|
| 1046 | if (FOrderID <> '') and (FOrderID = frmConsults.OrderID) then
|
---|
| 1047 | begin
|
---|
| 1048 | InfoBox(TX_ORDER_LOCKED, TC_ORDER_LOCKED, MB_OK);
|
---|
| 1049 | Result := False;
|
---|
| 1050 | Exit;
|
---|
| 1051 | end;
|
---|
| 1052 | if (FOrderId <> '') then
|
---|
| 1053 | if not OrderCanBeLocked(FOrderID) then Result := False;
|
---|
| 1054 | if not Result then FOrderID := '';
|
---|
| 1055 | end;
|
---|
| 1056 |
|
---|
| 1057 | function TfrmNotes.LockConsultRequestAndNote(AnIEN: Int64): Boolean;
|
---|
| 1058 | { returns true if note and associated request successfully locked }
|
---|
| 1059 | var
|
---|
| 1060 | AConsult: Integer;
|
---|
| 1061 | LockMsg, x: string;
|
---|
| 1062 | begin
|
---|
| 1063 | SetupVars; //kt added 7/19/2007 to replace constants with vars.
|
---|
| 1064 | Result := True;
|
---|
| 1065 | AConsult := 0;
|
---|
| 1066 | if frmConsults.ActiveEditOf(AnIEN) then
|
---|
| 1067 | begin
|
---|
| 1068 | InfoBox(TX_ORDER_LOCKED, TC_ORDER_LOCKED, MB_OK);
|
---|
| 1069 | Result := False;
|
---|
| 1070 | Exit;
|
---|
| 1071 | end;
|
---|
| 1072 | if Changes.Exist(CH_DOC, IntToStr(AnIEN)) then Exit; // already locked
|
---|
| 1073 | // try to lock the consult request first, if there is one
|
---|
| 1074 | if IsConsultTitle(TitleForNote(AnIEN)) then
|
---|
| 1075 | begin
|
---|
| 1076 | x := GetPackageRefForNote(lstNotes.ItemIEN);
|
---|
| 1077 | AConsult := StrToIntDef(Piece(x, ';', 1), 0);
|
---|
| 1078 | Result := LockConsultRequest(AConsult);
|
---|
| 1079 | end;
|
---|
| 1080 | // now try to lock the note
|
---|
| 1081 | if Result then
|
---|
| 1082 | begin
|
---|
| 1083 | LockDocument(AnIEN, LockMsg);
|
---|
| 1084 | if LockMsg <> '' then
|
---|
| 1085 | begin
|
---|
| 1086 | Result := False;
|
---|
| 1087 | // if can't lock the note, unlock the consult request that was just locked
|
---|
| 1088 | if AConsult > 0 then
|
---|
| 1089 | begin
|
---|
| 1090 | UnlockOrderIfAble(FOrderID);
|
---|
| 1091 | FOrderID := '';
|
---|
| 1092 | end;
|
---|
| 1093 | InfoBox(LockMsg, TC_NO_LOCK, MB_OK);
|
---|
| 1094 | end;
|
---|
| 1095 | end;
|
---|
| 1096 | end;
|
---|
| 1097 |
|
---|
| 1098 | procedure TfrmNotes.UnlockConsultRequest(ANote: Int64; AConsult: Integer = 0);
|
---|
| 1099 | (*var
|
---|
| 1100 | x: string;*)
|
---|
| 1101 | begin
|
---|
| 1102 | (* if (AConsult = 0) and IsConsultTitle(TitleForNote(ANote)) then
|
---|
| 1103 | begin
|
---|
| 1104 | x := GetPackageRefForNote(ANote);
|
---|
| 1105 | AConsult := StrToIntDef(Piece(x, ';', 1), 0);
|
---|
| 1106 | end;
|
---|
| 1107 | if AConsult = 0 then Exit;*)
|
---|
| 1108 | if AConsult = 0 then AConsult := GetConsultIENForNote(ANote);
|
---|
| 1109 | if AConsult <= 0 then exit;
|
---|
| 1110 | FOrderID := GetConsultOrderIEN(AConsult);
|
---|
| 1111 | UnlockOrderIfAble(FOrderID);
|
---|
| 1112 | FOrderID := '';
|
---|
| 1113 | end;
|
---|
| 1114 |
|
---|
| 1115 | function TfrmNotes.ActiveEditOf(AnIEN: Int64; ARequest: integer): Boolean;
|
---|
| 1116 | begin
|
---|
| 1117 | Result := False;
|
---|
| 1118 | if EditingIndex < 0 then Exit;
|
---|
| 1119 | if lstNotes.GetIEN(EditingIndex) = AnIEN then
|
---|
| 1120 | begin
|
---|
| 1121 | Result := True;
|
---|
| 1122 | Exit;
|
---|
| 1123 | end;
|
---|
| 1124 | with FEditNote do if (PkgIEN = ARequest) and (PkgPtr = PKG_CONSULTS) then Result := True;
|
---|
| 1125 | end;
|
---|
| 1126 |
|
---|
| 1127 | { create, edit & save notes }
|
---|
| 1128 |
|
---|
| 1129 | procedure TfrmNotes.InsertNewNote(IsIDChild: boolean; AnIDParent: integer);
|
---|
| 1130 | { creates the editing context for a new progress note & inserts stub into top of view list }
|
---|
| 1131 | var
|
---|
| 1132 | EnableAutosave, HaveRequired: Boolean;
|
---|
| 1133 | CreatedNote: TCreatedDoc;
|
---|
| 1134 | TmpBoilerPlate: TStringList;
|
---|
| 1135 | tmpNode: TTreeNode;
|
---|
| 1136 | x, WhyNot, DocInfo: string;
|
---|
| 1137 | tempPos : integer; //kt 6-1-05
|
---|
[541] | 1138 | Mode : TViewModeSet; //kt 8/09
|
---|
| 1139 | BoilerplateIsHTML : boolean;//kt 8/09
|
---|
[453] | 1140 |
|
---|
| 1141 | begin
|
---|
| 1142 | SetupVars; //kt added 7/19/2007 to replace constants with vars.
|
---|
| 1143 | if frmFrame.Timedout then Exit;
|
---|
| 1144 |
|
---|
| 1145 | FNewIDChild := IsIDChild;
|
---|
| 1146 | EnableAutosave := FALSE;
|
---|
| 1147 | TmpBoilerPlate := nil;
|
---|
| 1148 | try
|
---|
| 1149 | ClearEditControls;
|
---|
[541] | 1150 | FEditNote.Lines.Free; //(done d/t full wipe-out on line below} //kt 8/09
|
---|
[453] | 1151 | FillChar(FEditNote, SizeOf(FEditNote), 0); //v15.7
|
---|
[541] | 1152 | FEditNote.Lines := TStringList.Create; //Freed in Destructor //kt 8/09
|
---|
[453] | 1153 | with FEditNote do
|
---|
| 1154 | begin
|
---|
| 1155 | DocType := TYP_PROGRESS_NOTE;
|
---|
| 1156 | IsNewNote := True;
|
---|
| 1157 | Title := DfltNoteTitle;
|
---|
| 1158 | TitleName := DfltNoteTitleName;
|
---|
| 1159 | if IsIDChild and (not CanTitleBeIDChild(Title, WhyNot)) then
|
---|
| 1160 | begin
|
---|
| 1161 | Title := 0;
|
---|
| 1162 | TitleName := '';
|
---|
| 1163 | end;
|
---|
| 1164 | if IsSurgeryTitle(Title) then // Don't want surgery title sneaking in unchallenged
|
---|
| 1165 | begin
|
---|
| 1166 | Title := 0;
|
---|
| 1167 | TitleName := '';
|
---|
| 1168 | end;
|
---|
[541] | 1169 | //DateTime := FMNow; //kt 6-1-05
|
---|
| 1170 | DateTime := Encounter.DateTime; //kt 6-1-05
|
---|
[453] | 1171 | //kt begin changes -------------- 6-1-05
|
---|
| 1172 | if LastAuthor<>0 then begin
|
---|
| 1173 | Author := LastAuthor;
|
---|
| 1174 | AuthorName := LastAuthorName;
|
---|
| 1175 | end else begin
|
---|
| 1176 | Author := User.DUZ;
|
---|
| 1177 | AuthorName := User.Name;
|
---|
| 1178 | end;
|
---|
| 1179 | //kt 6-1-05 Author := User.DUZ;
|
---|
| 1180 | //kt 6-1-05 AuthorName := User.Name;
|
---|
| 1181 | //kt end changes -------------- 6-1-05
|
---|
| 1182 | Location := Encounter.Location;
|
---|
| 1183 | LocationName := Encounter.LocationName;
|
---|
| 1184 | VisitDate := Encounter.DateTime;
|
---|
| 1185 | if IsIDChild then
|
---|
| 1186 | IDParent := AnIDParent
|
---|
| 1187 | else
|
---|
| 1188 | IDParent := 0;
|
---|
| 1189 | // Cosigner & PkgRef, if needed, will be set by fNoteProps
|
---|
| 1190 | end;
|
---|
| 1191 | // check to see if interaction necessary to get required fields
|
---|
| 1192 | GetUnresolvedConsultsInfo;
|
---|
| 1193 | if LacksRequiredForCreate or VerifyNoteTitle or uUnresolvedConsults.UnresolvedConsultsExist
|
---|
| 1194 | then HaveRequired := ExecuteNoteProperties(FEditNote, CT_NOTES, IsIDChild, FNewIDChild, '', 0)
|
---|
| 1195 | else HaveRequired := True;
|
---|
| 1196 | //kt begin addition 6-1-05 -----------------
|
---|
| 1197 | LastAuthor := FEditNote.Author;
|
---|
| 1198 | LastAuthorName := FEditNote.AuthorName;
|
---|
| 1199 | tempPos := Pos(' - ',LastAuthorName);
|
---|
| 1200 | if tempPos>0 then begin //trim off title, e.g. "Jones,John - Physician
|
---|
| 1201 | LastAuthorName:=UpperCase(Trim(MidStr(LastAuthorName,1,tempPos)));
|
---|
| 1202 | end;
|
---|
| 1203 | //kt end addition 6-1-05 -----------------
|
---|
| 1204 | // lock the consult request if there is a consult
|
---|
| 1205 | with FEditNote do if (PkgIEN > 0) and (PkgPtr = PKG_CONSULTS) then HaveRequired := LockConsultRequest(PkgIEN);
|
---|
| 1206 | if HaveRequired then
|
---|
| 1207 | begin
|
---|
| 1208 | // set up uPCEEdit for entry of new note
|
---|
| 1209 | uPCEEdit.UseEncounter := True;
|
---|
| 1210 | uPCEEdit.NoteDateTime := FEditNote.DateTime;
|
---|
| 1211 | uPCEEdit.PCEForNote(USE_CURRENT_VISITSTR, uPCEShow);
|
---|
| 1212 | FEditNote.NeedCPT := uPCEEdit.CPTRequired;
|
---|
| 1213 | // create the note
|
---|
| 1214 | PutNewNote(CreatedNote, FEditNote);
|
---|
| 1215 | uPCEEdit.NoteIEN := CreatedNote.IEN;
|
---|
| 1216 | if CreatedNote.IEN > 0 then LockDocument(CreatedNote.IEN, CreatedNote.ErrorText);
|
---|
| 1217 | if CreatedNote.ErrorText = '' then
|
---|
| 1218 | begin
|
---|
| 1219 | //x := $$RESOLVE^TIUSRVLO formatted string
|
---|
| 1220 | //7348^Note Title^3000913^NERD, YOURA (N0165)^1329;Rich Vertigan;VERTIGAN,RICH^8E REHAB MED^complete^Adm: 11/05/98;2981105.095547^ ;^^0^^^2
|
---|
| 1221 | with FEditNote do
|
---|
| 1222 | begin
|
---|
| 1223 | x := IntToStr(CreatedNote.IEN) + U + TitleName + U + FloatToStr(FEditNote.DateTime) + U +
|
---|
| 1224 | Patient.Name + U + IntToStr(Author) + ';' + AuthorName + U + LocationName + U + 'new' + U +
|
---|
| 1225 | U + U + U + U + U + U + U;
|
---|
| 1226 | //Link Note to PRF Action
|
---|
| 1227 | if PRF_IEN <> 0 then
|
---|
| 1228 | if sCallV('TIU LINK TO FLAG', [CreatedNote.IEN,PRF_IEN,ActionIEN,Patient.DFN]) = '0' then
|
---|
| 1229 | ShowMessage('TIU LINK TO FLAG: FAILED');
|
---|
| 1230 | end;
|
---|
| 1231 |
|
---|
| 1232 | lstNotes.Items.Insert(0, x);
|
---|
| 1233 | uChanging := True;
|
---|
| 1234 | tvNotes.Items.BeginUpdate;
|
---|
| 1235 | if IsIDChild then
|
---|
| 1236 | begin
|
---|
| 1237 | tmpNode := tvNotes.FindPieceNode(IntToStr(AnIDParent), 1, U, tvNotes.Items.GetFirstNode);
|
---|
| 1238 | tmpNode.ImageIndex := IMG_IDNOTE_OPEN;
|
---|
| 1239 | tmpNode.SelectedIndex := IMG_IDNOTE_OPEN;
|
---|
| 1240 | tmpNode := tvNotes.Items.AddChildObjectFirst(tmpNode, MakeNoteDisplayText(x), MakeNoteTreeObject(x));
|
---|
| 1241 | tmpNode.ImageIndex := IMG_ID_CHILD;
|
---|
| 1242 | tmpNode.SelectedIndex := IMG_ID_CHILD;
|
---|
| 1243 | end
|
---|
| 1244 | else
|
---|
| 1245 | begin
|
---|
| 1246 | // tmpNode := tvNotes.Items.AddObjectFirst(tvNotes.Items.GetFirstNode, 'New Note in Progress', <-- original line. //kt 7/19/2007
|
---|
| 1247 | tmpNode := tvNotes.Items.AddObjectFirst(tvNotes.Items.GetFirstNode, DKLangConstW('fNotes_New_Note_in_Progress'), //kt added 7/19/2007
|
---|
| 1248 | MakeNoteTreeObject('NEW^New Note in Progress^^^^^^^^^^^%^0'));
|
---|
| 1249 | TORTreeNode(tmpNode).StringData := 'NEW^New Note in Progress^^^^^^^^^^^%^0';
|
---|
| 1250 | tmpNode.ImageIndex := IMG_TOP_LEVEL;
|
---|
| 1251 | tmpNode := tvNotes.Items.AddChildObjectFirst(tmpNode, MakeNoteDisplayText(x), MakeNoteTreeObject(x));
|
---|
| 1252 | tmpNode.ImageIndex := IMG_SINGLE;
|
---|
| 1253 | tmpNode.SelectedIndex := IMG_SINGLE;
|
---|
| 1254 | end;
|
---|
| 1255 | tmpNode.StateIndex := IMG_NO_IMAGES;
|
---|
| 1256 | TORTreeNode(tmpNode).StringData := x;
|
---|
| 1257 | tvNotes.Selected := tmpNode;
|
---|
| 1258 | tvNotes.Items.EndUpdate;
|
---|
| 1259 | uChanging := False;
|
---|
| 1260 | Changes.Add(CH_DOC, IntToStr(CreatedNote.IEN), GetTitleText(0), '', CH_SIGN_YES);
|
---|
| 1261 | lstNotes.ItemIndex := 0;
|
---|
| 1262 | EditingIndex := 0;
|
---|
| 1263 | SetSubjectVisible(AskSubjectForNotes);
|
---|
| 1264 | if not assigned(TmpBoilerPlate) then
|
---|
| 1265 | TmpBoilerPlate := TStringList.Create;
|
---|
| 1266 | LoadBoilerPlate(TmpBoilerPlate, FEditNote.Title);
|
---|
| 1267 | FChanged := False;
|
---|
| 1268 | cmdChangeClick(Self); // will set captions, sign state for Changes
|
---|
[541] | 1269 | Mode := [vmEdit] + [vmHTML_MODE[fOptionsNotes.DefaultEditHTMLMode]]; //kt 8/09
|
---|
| 1270 | SetDisplayToHTMLvsText(Mode, nil, VIEW_ACTIVATE_ONLY); // kt 8/09
|
---|
[453] | 1271 | lstNotesClick(Self); // will make pnlWrite visible
|
---|
| 1272 | if timAutoSave.Interval <> 0 then EnableAutosave := TRUE;
|
---|
[541] | 1273 | //kt 6/3/09 original --> if txtSubject.Visible then txtSubject.SetFocus else memNewNote.SetFocus;
|
---|
| 1274 | if txtSubject.Visible then begin //kt 8/09
|
---|
| 1275 | txtSubject.SetFocus; //kt 8/09
|
---|
| 1276 | end else begin //kt 8/09
|
---|
| 1277 | SetEditorFocus; //kt memNewNote.SetFocus; //kt 8/09
|
---|
| 1278 | end; //kt 8/09
|
---|
[453] | 1279 | end else
|
---|
| 1280 | begin
|
---|
| 1281 | // if note creation failed or failed to get note lock (both unlikely), unlock consult
|
---|
| 1282 | with FEditNote do if (PkgIEN > 0) and (PkgPtr = PKG_CONSULTS) then UnlockConsultRequest(0, PkgIEN);
|
---|
| 1283 | InfoBox(CreatedNote.ErrorText, TX_CREATE_ERR, MB_OK);
|
---|
| 1284 | HaveRequired := False;
|
---|
| 1285 | end; {if CreatedNote.IEN}
|
---|
| 1286 | end; {if HaveRequired}
|
---|
| 1287 | if not HaveRequired then
|
---|
| 1288 | begin
|
---|
| 1289 | ClearEditControls;
|
---|
| 1290 | ShowPCEButtons(False);
|
---|
| 1291 | end;
|
---|
| 1292 | finally
|
---|
| 1293 | if assigned(TmpBoilerPlate) then
|
---|
| 1294 | begin
|
---|
| 1295 | DocInfo := MakeXMLParamTIU(IntToStr(CreatedNote.IEN), FEditNote);
|
---|
| 1296 | ExecuteTemplateOrBoilerPlate(TmpBoilerPlate, FEditNote.Title, ltTitle, Self, 'Title: ' + FEditNote.TitleName, DocInfo);
|
---|
[541] | 1297 | //kt original --> memNewNote.Lines.Assign(TmpBoilerPlate);
|
---|
| 1298 | BoilerplateIsHTML := rHTMLTools.IsHTML(TmpBoilerPlate.Text); //kt 8/09
|
---|
| 1299 | FEditNote.Lines.Assign(TmpBoilerPlate); //kt 8/09
|
---|
| 1300 | if not ((vmHTML in FViewMode)) and BoilerplateIsHTML then begin //kt 8/09
|
---|
| 1301 | FViewMode := FViewMode - [vmText] + [vmHTML]; //kt 8/09
|
---|
| 1302 | end; //kt 8/09
|
---|
| 1303 | SetDisplayToHTMLvsText(FViewMode,FEditNote.Lines); //kt 8/09
|
---|
| 1304 | if (vmHTML in FViewMode) then begin //kt 8/09
|
---|
| 1305 | HtmlEditor.MoveCaretToEnd; //kt 8/09
|
---|
| 1306 | Application.ProcessMessages; //kt 8/09
|
---|
| 1307 | end; //kt 8/09
|
---|
[453] | 1308 | UpdateNoteAuthor(DocInfo);
|
---|
| 1309 | TmpBoilerPlate.Free;
|
---|
| 1310 | end;
|
---|
| 1311 | if EnableAutosave then // Don't enable autosave until after dialog fields have been resolved
|
---|
| 1312 | timAutoSave.Enabled := True;
|
---|
| 1313 | end;
|
---|
| 1314 | frmNotes.pnlWriteResize(Self);
|
---|
| 1315 | end;
|
---|
| 1316 |
|
---|
[541] | 1317 |
|
---|
| 1318 | procedure TfrmNotes.SetEditorFocus;
|
---|
| 1319 | //kt added function 8/09
|
---|
| 1320 | begin
|
---|
| 1321 | try
|
---|
| 1322 | if (vmHTML in FViewMode) then begin //kt 8/09
|
---|
| 1323 | HtmlEditor.SetFocus; //kt 8/09
|
---|
| 1324 | end else begin //kt 8/09
|
---|
| 1325 | memNewNote.SetFocus;
|
---|
| 1326 | end; //kt 8/09
|
---|
| 1327 | except
|
---|
| 1328 | on E: Exception do begin
|
---|
| 1329 | // ignore error. Info in E
|
---|
| 1330 | end;
|
---|
| 1331 | end;
|
---|
| 1332 | end;
|
---|
| 1333 |
|
---|
| 1334 |
|
---|
[453] | 1335 | procedure TfrmNotes.InsertAddendum;
|
---|
| 1336 | { sets up fields of pnlWrite to write an addendum for the selected note }
|
---|
| 1337 | const
|
---|
| 1338 | AS_ADDENDUM = True;
|
---|
| 1339 | IS_ID_CHILD = False;
|
---|
| 1340 | var
|
---|
| 1341 | HaveRequired: Boolean;
|
---|
| 1342 | CreatedNote: TCreatedDoc;
|
---|
| 1343 | tmpNode: TTreeNode;
|
---|
| 1344 | x: string;
|
---|
| 1345 | begin
|
---|
| 1346 | SetupVars; //kt added 7/19/2007 to replace constants with vars.
|
---|
| 1347 | ClearEditControls;
|
---|
| 1348 | with FEditNote do
|
---|
| 1349 | begin
|
---|
| 1350 | DocType := TYP_ADDENDUM;
|
---|
| 1351 | IsNewNote := False;
|
---|
| 1352 | Title := TitleForNote(lstNotes.ItemIEN);
|
---|
| 1353 | TitleName := Piece(lstNotes.Items[lstNotes.ItemIndex], U, 2);
|
---|
| 1354 | if Copy(TitleName,1,1) = '+' then TitleName := Copy(TitleName, 3, 199);
|
---|
| 1355 | DateTime := FMNow;
|
---|
| 1356 | Author := User.DUZ;
|
---|
| 1357 | AuthorName := User.Name;
|
---|
| 1358 | x := GetPackageRefForNote(lstNotes.ItemIEN);
|
---|
| 1359 | if Piece(x, U, 1) <> '-1' then
|
---|
| 1360 | begin
|
---|
| 1361 | PkgRef := GetPackageRefForNote(lstNotes.ItemIEN);
|
---|
| 1362 | PkgIEN := StrToIntDef(Piece(PkgRef, ';', 1), 0);
|
---|
| 1363 | PkgPtr := Piece(PkgRef, ';', 2);
|
---|
| 1364 | end;
|
---|
| 1365 | Addend := lstNotes.ItemIEN;
|
---|
| 1366 | //Lines := memNewNote.Lines;
|
---|
| 1367 | // Cosigner, if needed, will be set by fNoteProps
|
---|
| 1368 | // Location info will be set after the encounter is loaded
|
---|
| 1369 | end;
|
---|
| 1370 | // check to see if interaction necessary to get required fields
|
---|
| 1371 | if LacksRequiredForCreate
|
---|
| 1372 | then HaveRequired := ExecuteNoteProperties(FEditNote, CT_NOTES, IS_ID_CHILD, False, '', 0)
|
---|
| 1373 | else HaveRequired := True;
|
---|
| 1374 | // lock the consult request if there is a consult
|
---|
| 1375 | if HaveRequired then
|
---|
| 1376 | with FEditNote do
|
---|
| 1377 | if (PkgIEN > 0) and (PkgPtr = PKG_CONSULTS) then HaveRequired := LockConsultRequest(PkgIEN);
|
---|
| 1378 | if HaveRequired then
|
---|
| 1379 | begin
|
---|
| 1380 | uPCEEdit.NoteDateTime := FEditNote.DateTime;
|
---|
| 1381 | uPCEEdit.PCEForNote(FEditNote.Addend, uPCEShow);
|
---|
| 1382 | FEditNote.Location := uPCEEdit.Location;
|
---|
| 1383 | FEditNote.LocationName := ExternalName(uPCEEdit.Location, 44);
|
---|
| 1384 | FEditNote.VisitDate := uPCEEdit.DateTime;
|
---|
| 1385 | PutAddendum(CreatedNote, FEditNote, FEditNote.Addend);
|
---|
| 1386 | uPCEEdit.NoteIEN := CreatedNote.IEN;
|
---|
| 1387 | if CreatedNote.IEN > 0 then LockDocument(CreatedNote.IEN, CreatedNote.ErrorText);
|
---|
| 1388 | if CreatedNote.ErrorText = '' then
|
---|
| 1389 | begin
|
---|
| 1390 | with FEditNote do
|
---|
| 1391 | begin
|
---|
| 1392 | x := IntToStr(CreatedNote.IEN) + U + 'Addendum to ' + TitleName + U + FloatToStr(DateTime) + U +
|
---|
| 1393 | Patient.Name + U + IntToStr(Author) + ';' + AuthorName + U + LocationName + U + 'new' + U +
|
---|
| 1394 | U + U + U + U + U + U + U;
|
---|
| 1395 | end;
|
---|
| 1396 |
|
---|
| 1397 | lstNotes.Items.Insert(0, x);
|
---|
| 1398 | uChanging := True;
|
---|
| 1399 | tvNotes.Items.BeginUpdate;
|
---|
| 1400 | // tmpNode := tvNotes.Items.AddObjectFirst(tvNotes.Items.GetFirstNode, 'New Addendum in Progress', <-- original line. //kt 7/19/2007
|
---|
| 1401 | tmpNode := tvNotes.Items.AddObjectFirst(tvNotes.Items.GetFirstNode, DKLangConstW('fNotes_New_Addendum_in_Progress'), //kt added 7/19/2007
|
---|
| 1402 | MakeNoteTreeObject('ADDENDUM^New Addendum in Progress^^^^^^^^^^^%^0'));
|
---|
| 1403 | TORTreeNode(tmpNode).StringData := 'ADDENDUM^New Addendum in Progress^^^^^^^^^^^%^0';
|
---|
| 1404 | tmpNode.ImageIndex := IMG_TOP_LEVEL;
|
---|
| 1405 | tmpNode := tvNotes.Items.AddChildObjectFirst(tmpNode, MakeNoteDisplayText(x), MakeNoteTreeObject(x));
|
---|
| 1406 | TORTreeNode(tmpNode).StringData := x;
|
---|
| 1407 |
|
---|
| 1408 | tmpNode.ImageIndex := IMG_ADDENDUM;
|
---|
| 1409 | tmpNode.SelectedIndex := IMG_ADDENDUM;
|
---|
| 1410 | tvNotes.Selected := tmpNode;
|
---|
| 1411 | tvNotes.Items.EndUpdate;
|
---|
| 1412 | uChanging := False;
|
---|
| 1413 | Changes.Add(CH_DOC, IntToStr(CreatedNote.IEN), GetTitleText(0), '', CH_SIGN_YES);
|
---|
| 1414 | lstNotes.ItemIndex := 0;
|
---|
| 1415 | EditingIndex := 0;
|
---|
| 1416 | SetSubjectVisible(AskSubjectForNotes);
|
---|
| 1417 | cmdChangeClick(Self); // will set captions, sign state for Changes
|
---|
| 1418 | lstNotesClick(Self); // will make pnlWrite visible
|
---|
| 1419 | if timAutoSave.Interval <> 0 then timAutoSave.Enabled := True;
|
---|
[541] | 1420 | SetEditorFocus; //kt memNewNote.SetFocus; //kt 8/09
|
---|
[453] | 1421 | end else
|
---|
| 1422 | begin
|
---|
| 1423 | // if note creation failed or failed to get note lock (both unlikely), unlock consult
|
---|
| 1424 | with FEditNote do if (PkgIEN > 0) and (PkgPtr = PKG_CONSULTS) then UnlockConsultRequest(0, PkgIEN);
|
---|
| 1425 | InfoBox(CreatedNote.ErrorText, TX_CREATE_ERR, MB_OK);
|
---|
| 1426 | HaveRequired := False;
|
---|
| 1427 | end; {if CreatedNote.IEN}
|
---|
| 1428 | end; {if HaveRequired}
|
---|
| 1429 | if not HaveRequired then ClearEditControls;
|
---|
| 1430 | end;
|
---|
| 1431 |
|
---|
| 1432 | procedure TfrmNotes.LoadForEdit;
|
---|
| 1433 | { retrieves an existing note and places the data in the fields of pnlWrite }
|
---|
| 1434 | var
|
---|
| 1435 | tmpNode: TTreeNode;
|
---|
| 1436 | x: string;
|
---|
[541] | 1437 | Mode : TViewModeSet; //kt
|
---|
| 1438 |
|
---|
[453] | 1439 | begin
|
---|
| 1440 | ClearEditControls;
|
---|
| 1441 | if not LockConsultRequestAndNote(lstNotes.ItemIEN) then Exit;
|
---|
| 1442 | EditingIndex := lstNotes.ItemIndex;
|
---|
| 1443 | Changes.Add(CH_DOC, lstNotes.ItemID, GetTitleText(EditingIndex), '', CH_SIGN_YES);
|
---|
| 1444 | GetNoteForEdit(FEditNote, lstNotes.ItemIEN);
|
---|
[541] | 1445 | Mode := [vmEdit] + [vmHTML_MODE[IsHTML(FEditNote.Lines) or (vmHTML in FViewMode)]]; //kt 8/09
|
---|
| 1446 | SetDisplayToHTMLvsText(Mode,FEditNote.Lines); //kt 8/09
|
---|
| 1447 | //kt memNewNote.Lines.Assign(FEditNote.Lines); //kt 8/09
|
---|
[453] | 1448 | FChanged := False;
|
---|
| 1449 | if FEditNote.Title = TYP_ADDENDUM then
|
---|
| 1450 | begin
|
---|
| 1451 | FEditNote.DocType := TYP_ADDENDUM;
|
---|
| 1452 | FEditNote.TitleName := Piece(lstNotes.Items[lstNotes.ItemIndex], U, 2);
|
---|
| 1453 | if Copy(FEditNote.TitleName,1,1) = '+' then FEditNote.TitleName := Copy(FEditNote.TitleName, 3, 199);
|
---|
| 1454 | // if CompareText(Copy(FEditNote.TitleName, 1, 8), 'Addendum') <> 0 <-- original line. //kt 7/19/2007
|
---|
| 1455 | if CompareText(Copy(FEditNote.TitleName, 1, 8), DKLangConstW('fNotes_Addendum')) <> 0 //kt added 7/19/2007
|
---|
| 1456 | // then FEditNote.TitleName := FEditNote.TitleName + 'Addendum to '; <-- original line. //kt 7/19/2007
|
---|
| 1457 | then FEditNote.TitleName := FEditNote.TitleName + DKLangConstW('fNotes_Addendum_to'); //kt added 7/19/2007
|
---|
| 1458 | end;
|
---|
| 1459 |
|
---|
| 1460 | uChanging := True;
|
---|
| 1461 | tvNotes.Items.BeginUpdate;
|
---|
| 1462 |
|
---|
| 1463 | tmpNode := tvNotes.FindPieceNode('EDIT', 1, U, nil);
|
---|
| 1464 | if tmpNode = nil then
|
---|
| 1465 | begin
|
---|
| 1466 | // tmpNode := tvNotes.Items.AddObjectFirst(tvNotes.Items.GetFirstNode, 'Note being edited', <-- original line. //kt 7/19/2007
|
---|
| 1467 | tmpNode := tvNotes.Items.AddObjectFirst(tvNotes.Items.GetFirstNode, DKLangConstW('fNotes_Note_being_edited'), //kt added 7/19/2007
|
---|
| 1468 | MakeNoteTreeObject('EDIT^Note being edited^^^^^^^^^^^%^0'));
|
---|
| 1469 | TORTreeNode(tmpNode).StringData := 'EDIT^Note being edited^^^^^^^^^^^%^0';
|
---|
| 1470 | end
|
---|
| 1471 | else
|
---|
| 1472 | tmpNode.DeleteChildren;
|
---|
| 1473 | x := lstNotes.Items[lstNotes.ItemIndex];
|
---|
| 1474 | tmpNode.ImageIndex := IMG_TOP_LEVEL;
|
---|
| 1475 | tmpNode := tvNotes.Items.AddChildObjectFirst(tmpNode, MakeNoteDisplayText(x), MakeNoteTreeObject(x));
|
---|
| 1476 | TORTreeNode(tmpNode).StringData := x;
|
---|
| 1477 | //if CompareText(Copy(FEditNote.TitleName, 1, 8), 'Addendum') <> 0 then <-- original line. //kt 7/19/2007
|
---|
| 1478 | if CompareText(Copy(FEditNote.TitleName, 1, 8), DKLangConstW('fNotes_Addendum')) <> 0 then //kt added 7/19/2007
|
---|
| 1479 | tmpNode.ImageIndex := IMG_SINGLE
|
---|
| 1480 | else
|
---|
| 1481 | tmpNode.ImageIndex := IMG_ADDENDUM;
|
---|
| 1482 | tmpNode.SelectedIndex := tmpNode.ImageIndex;
|
---|
| 1483 | tvNotes.Selected := tmpNode;
|
---|
| 1484 | tvNotes.Items.EndUpdate;
|
---|
| 1485 | uChanging := False;
|
---|
| 1486 |
|
---|
| 1487 | uPCEEdit.NoteDateTime := MakeFMDateTime(Piece(lstNotes.Items[lstNotes.ItemIndex], U, 3));
|
---|
| 1488 | uPCEEdit.PCEForNote(lstNotes.ItemIEN, uPCEShow);
|
---|
| 1489 | FEditNote.NeedCPT := uPCEEdit.CPTRequired;
|
---|
| 1490 | txtSubject.Text := FEditNote.Subject;
|
---|
| 1491 | SetSubjectVisible(AskSubjectForNotes);
|
---|
| 1492 | cmdChangeClick(Self); // will set captions, sign state for Changes
|
---|
| 1493 | lstNotesClick(Self); // will make pnlWrite visible
|
---|
| 1494 | if timAutoSave.Interval <> 0 then timAutoSave.Enabled := True;
|
---|
[541] | 1495 | SetEditorFocus; //kt memNewNote.SetFocus; //kt 8/09
|
---|
[453] | 1496 | end;
|
---|
| 1497 |
|
---|
| 1498 | procedure TfrmNotes.SaveEditedNote(var Saved: Boolean);
|
---|
| 1499 | { validates fields and sends the updated note to the server }
|
---|
| 1500 | var
|
---|
| 1501 | UpdatedNote: TCreatedDoc;
|
---|
| 1502 | x: string;
|
---|
[541] | 1503 | EmptyNote : boolean; //kt
|
---|
| 1504 |
|
---|
[453] | 1505 | begin
|
---|
| 1506 | SetupVars; //kt added 7/19/2007 to replace constants with vars.
|
---|
| 1507 | Saved := False;
|
---|
[541] | 1508 | if not (vmHTML in FViewMode) then begin //kt 8/09
|
---|
| 1509 | EmptyNote := (memNewNote.GetTextLen = 0) //kt 8/09
|
---|
| 1510 | or (not ContainsVisibleChar(memNewNote.Text)); //kt 8/09
|
---|
| 1511 | end else begin //kt 8/09
|
---|
| 1512 | EmptyNote := (HtmlEditor.GetTextLen = 0) //kt 8/09
|
---|
| 1513 | or (not ContainsVisibleChar(HtmlEditor.Text)); //kt 8/09
|
---|
| 1514 | end; //kt 8/09
|
---|
| 1515 | //kt 8/09 if (memNewNote.GetTextLen = 0) or (not ContainsVisibleChar(memNewNote.Text)) then
|
---|
| 1516 | //kt 8/09 begin
|
---|
| 1517 | if EmptyNote then begin
|
---|
[453] | 1518 | lstNotes.ItemIndex := EditingIndex;
|
---|
| 1519 | x := lstNotes.ItemID;
|
---|
| 1520 | uChanging := True;
|
---|
| 1521 | tvNotes.Selected := tvNotes.FindPieceNode(x, 1, U, tvNotes.Items.GetFirstNode);
|
---|
| 1522 | uChanging := False;
|
---|
| 1523 | tvNotesChange(Self, tvNotes.Selected);
|
---|
| 1524 | if FSilent or
|
---|
| 1525 | ((not FSilent) and
|
---|
| 1526 | (InfoBox(GetTitleText(EditingIndex) + TX_EMPTY_NOTE, TC_EMPTY_NOTE, MB_YESNO) = IDYES))
|
---|
| 1527 | then
|
---|
| 1528 | begin
|
---|
| 1529 | FConfirmed := True;
|
---|
| 1530 | mnuActDeleteClick(Self);
|
---|
| 1531 | Saved := True;
|
---|
| 1532 | FDeleted := True;
|
---|
| 1533 | end
|
---|
| 1534 | else
|
---|
| 1535 | FConfirmed := False;
|
---|
| 1536 | Exit;
|
---|
| 1537 | end;
|
---|
| 1538 | //ExpandTabsFilter(memNewNote.Lines, TAB_STOP_CHARS);
|
---|
[541] | 1539 | if FEditNote.Lines = nil then FEditNote.Lines := TStringList.Create; //kt
|
---|
| 1540 | //kt 8/09 FEditNote.Lines := memNewNote.Lines;
|
---|
| 1541 | if (vmHTML in FViewMode) then begin //kt 8/09
|
---|
| 1542 | SplitToArray(WrapHTML(HtmlEditor.HTMLText), FEditNote.Lines); //kt 8/09
|
---|
| 1543 | end else begin //kt 8/09
|
---|
| 1544 | FEditNote.Lines.Assign(memNewNote.Lines); //kt 8/09
|
---|
| 1545 | end; //kt 8/09
|
---|
[453] | 1546 | //FEditNote.Lines:= SetLinesTo74ForSave(memNewNote.Lines, Self);
|
---|
| 1547 | FEditNote.Subject := txtSubject.Text;
|
---|
| 1548 | FEditNote.NeedCPT := uPCEEdit.CPTRequired;
|
---|
| 1549 | timAutoSave.Enabled := False;
|
---|
| 1550 | try
|
---|
| 1551 | PutEditedNote(UpdatedNote, FEditNote, lstNotes.GetIEN(EditingIndex));
|
---|
| 1552 | finally
|
---|
| 1553 | timAutoSave.Enabled := True;
|
---|
| 1554 | end;
|
---|
| 1555 | // there's no unlocking here since the note is still in Changes after a save
|
---|
| 1556 | if UpdatedNote.IEN > 0 then
|
---|
| 1557 | begin
|
---|
| 1558 | if lstNotes.ItemIndex = EditingIndex then
|
---|
| 1559 | begin
|
---|
| 1560 | EditingIndex := -1;
|
---|
| 1561 | lstNotesClick(Self);
|
---|
| 1562 | end;
|
---|
| 1563 | EditingIndex := -1; // make sure EditingIndex reset even if not viewing edited note
|
---|
| 1564 | Saved := True;
|
---|
| 1565 | FNewIDChild := False;
|
---|
| 1566 | FChanged := False;
|
---|
[541] | 1567 | HTMLEditor.KeyStruck := false; //kt
|
---|
[453] | 1568 | end else
|
---|
| 1569 | begin
|
---|
| 1570 | if not FSilent then
|
---|
| 1571 | InfoBox(TX_SAVE_ERROR1 + UpdatedNote.ErrorText + TX_SAVE_ERROR2, TC_SAVE_ERROR, MB_OK or MB_ICONWARNING);
|
---|
| 1572 | end;
|
---|
| 1573 | end;
|
---|
| 1574 |
|
---|
| 1575 | procedure TfrmNotes.SaveCurrentNote(var Saved: Boolean);
|
---|
| 1576 | { called whenever a note should be saved - uses IEN to call appropriate save logic }
|
---|
| 1577 | begin
|
---|
| 1578 | if EditingIndex < 0 then Exit;
|
---|
| 1579 | SaveEditedNote(Saved);
|
---|
| 1580 | end;
|
---|
| 1581 |
|
---|
| 1582 | { Form events ------------------------------------------------------------------------------ }
|
---|
| 1583 |
|
---|
| 1584 | procedure TfrmNotes.FormCreate(Sender: TObject);
|
---|
| 1585 | var
|
---|
| 1586 | CacheDir : AnsiString; //kt 9-05
|
---|
| 1587 | begin
|
---|
| 1588 | inherited;
|
---|
[541] | 1589 | //kt --- Begin Modification 9-2005, 8/09 -------------
|
---|
[453] | 1590 | CacheDir := ExtractFilePath(ParamStr(0))+ 'Cache'; //kt 9-05
|
---|
[541] | 1591 | if not DirectoryExists(CacheDir) then CreateDir(CacheDir);
|
---|
| 1592 | //kt HTMLfilename := CacheDir + '\html_note.html'; //kt 5-05
|
---|
[453] | 1593 | LastAuthor :=0; //kt 5-05
|
---|
| 1594 | LastAuthorName:=''; //kt 5-05
|
---|
[541] | 1595 | DesiredHTMLFontSize := 2; //Used later to downsize during printing.
|
---|
| 1596 | SetRegHTMLFontSize(DesiredHTMLFontSize); //0=SMALLEST ... 4=LARGEST
|
---|
| 1597 | //kt Note: On creation, THtmlObj will remember Application.OnMessage. But if
|
---|
| 1598 | // another object (say a prior THtmlObj) has become active and already
|
---|
| 1599 | // changed the handler, then there will be a problem. So probably best
|
---|
| 1600 | // to create them all at one. //kt
|
---|
| 1601 | HtmlViewer := THtmlObj.Create(pnlHTMLViewer,Application);
|
---|
| 1602 | HtmlEditor := THtmlObj.Create(pnlHTMLEdit,Application);
|
---|
| 1603 | TWinControl(HtmlViewer).Parent:=pnlHTMLViewer;
|
---|
| 1604 | TWinControl(HtmlViewer).Align:=alClient;
|
---|
| 1605 | HtmlEditor.PrevControl := cmdPCE;
|
---|
| 1606 | HtmlEditor.NextControl := cmdChange;
|
---|
| 1607 | //Note: A 'loaded' function will initialize the THtmlObj's, but it can't be
|
---|
| 1608 | // done until after this constructor is done, and this TfrmNotes has been
|
---|
| 1609 | // assigned a parent. So done elsewhere.
|
---|
| 1610 | HtmlViewer.PopupMenu := popNoteMemo;
|
---|
| 1611 | TWinControl(HtmlEditor).Parent:=pnlHTMLEdit;
|
---|
| 1612 | TWinControl(HtmlEditor).Align:=alClient;
|
---|
| 1613 | HtmlEditor.PopupMenu := popNoteMemo;
|
---|
| 1614 | cbFontNames.Items.Assign(Screen.Fonts);
|
---|
| 1615 | FViewMode := [vmView,vmText];
|
---|
| 1616 | FHTMLEditMode := emNone;
|
---|
| 1617 | HTMLViewer.BackgroundColor := ReadOnlyColor;
|
---|
| 1618 | //kt --- End Modification 9-2005, 8/09 ------
|
---|
[453] | 1619 | PageID := CT_NOTES;
|
---|
| 1620 | memNote.Color := ReadOnlyColor;
|
---|
| 1621 | memPCEShow.Color := ReadOnlyColor;
|
---|
| 1622 | lblNewTitle.Color := ReadOnlyColor;
|
---|
| 1623 | EditingIndex := -1;
|
---|
| 1624 | FEditNote.LastCosigner := 0;
|
---|
| 1625 | FEditNote.LastCosignerName := '';
|
---|
| 1626 | FLastNoteID := '';
|
---|
| 1627 | frmDrawers := TfrmDrawers.CreateDrawers(Self, pnlDrawers, [],[]);
|
---|
| 1628 | frmDrawers.Align := alBottom;
|
---|
| 1629 | frmDrawers.RichEditControl := memNewNote;
|
---|
[541] | 1630 | frmDrawers.HTMLEditControl := HtmlEditor; //kt 8/09
|
---|
| 1631 | frmDrawers.HTMLModeSwitcher := SetHTMLEditMode; //kt 8/09
|
---|
[453] | 1632 | frmDrawers.NewNoteButton := cmdNewNote;
|
---|
| 1633 | frmDrawers.Splitter := splDrawers;
|
---|
| 1634 | frmDrawers.DefTempPiece := 1;
|
---|
| 1635 | tvNotes.Images := dmodShared.imgNotes;
|
---|
| 1636 | tvNotes.StateImages := dmodShared.imgImages;
|
---|
| 1637 | lvNotes.StateImages := dmodShared.imgImages;
|
---|
| 1638 | lvNotes.SmallImages := dmodShared.imgNotes;
|
---|
| 1639 | FImageFlag := TBitmap.Create;
|
---|
| 1640 | FDocList := TStringList.Create;
|
---|
| 1641 | TAccessibleTreeView.WrapControl(tvNotes);
|
---|
[541] | 1642 | RestoreRegHTMLFontSize; //kt, elh 8/09
|
---|
[453] | 1643 | end;
|
---|
| 1644 |
|
---|
| 1645 | procedure TfrmNotes.pnlRightResize(Sender: TObject);
|
---|
| 1646 | { memNote (TRichEdit) doesn't repaint appropriately unless it's parent panel is refreshed }
|
---|
| 1647 | begin
|
---|
| 1648 | inherited;
|
---|
| 1649 | pnlRight.Refresh;
|
---|
[541] | 1650 | if (vmHTML in FViewMode) then begin //kt 8/09
|
---|
| 1651 | HTMLViewer.Repaint; //kt 8/09
|
---|
| 1652 | end else begin //kt 8/09
|
---|
| 1653 | memNote.Repaint
|
---|
| 1654 | end; //kt 8/09
|
---|
[453] | 1655 | end;
|
---|
| 1656 |
|
---|
| 1657 | procedure TfrmNotes.pnlWriteResize(Sender: TObject);
|
---|
| 1658 | const
|
---|
| 1659 | LEFT_MARGIN = 4;
|
---|
| 1660 | begin
|
---|
| 1661 | inherited;
|
---|
[541] | 1662 | //kt NOTE: I don't know how to do the equivalent for HTML. Actually, I don't think it applies.
|
---|
[453] | 1663 | LimitEditWidth(memNewNote, MAX_PROGRESSNOTE_WIDTH - 1);
|
---|
| 1664 |
|
---|
| 1665 | //CQ7012 Added test for nil
|
---|
| 1666 | if memNewNote <> nil then
|
---|
| 1667 | memNewNote.Constraints.MinWidth := TextWidthByFont(memNewNote.Font.Handle, StringOfChar('X', MAX_PROGRESSNOTE_WIDTH)) + (LEFT_MARGIN * 2) + ScrollBarWidth;
|
---|
| 1668 | //CQ7012 Added test for nil
|
---|
| 1669 | if (Self <> nil) and (pnlLeft <> nil) and (pnlWrite <> nil) and (sptHorz <> nil) then
|
---|
| 1670 | pnlLeft.Width := self.ClientWidth - pnlWrite.Width - sptHorz.Width;
|
---|
| 1671 | end;
|
---|
| 1672 |
|
---|
| 1673 | { Left panel (selector) events ------------------------------------------------------------- }
|
---|
| 1674 |
|
---|
| 1675 | procedure TfrmNotes.lstNotesClick(Sender: TObject);
|
---|
| 1676 | { loads the text for the selected note or displays the editing panel for the selected note }
|
---|
| 1677 | var
|
---|
[541] | 1678 | Note : TStrings; //kt 6/09. Will be pointer to FViewNote, or FEditNote.Lines
|
---|
| 1679 | Editing : boolean; //kt 8/09
|
---|
| 1680 | Mode : TViewModeSet; //kt 8/09
|
---|
| 1681 | IsHTML : boolean; //kt 8/09
|
---|
| 1682 |
|
---|
[453] | 1683 | begin
|
---|
| 1684 | inherited;
|
---|
[541] | 1685 | //kt 8/09 with lstNotes do if ItemIndex = -1 then Exit
|
---|
| 1686 | //kt 8/09 else if ItemIndex = EditingIndex then
|
---|
[453] | 1687 |
|
---|
[541] | 1688 | with lstNotes do begin //kt 8/09
|
---|
| 1689 | if ItemIndex = -1 then Exit; //kt 8/09
|
---|
| 1690 | Editing := (ItemIndex = EditingIndex); //kt 8/09
|
---|
| 1691 | if Editing then begin //kt 8/09
|
---|
| 1692 | if FEditNote.Lines = nil then FEditNote.Lines := TStringList.Create; //kt 8/09
|
---|
| 1693 | Note := FEditNote.Lines; //kt 8/09
|
---|
| 1694 | {pnlWrite.Visible := True; //kt 8/09
|
---|
| 1695 | pnlRead.Visible := False; } //kt done in SetHTMLorTextEditor //kt 8/09
|
---|
| 1696 | mnuViewDetail.Enabled := False;
|
---|
| 1697 | if (FEditNote.IDParent <> 0) and (not FNewIDChild) then
|
---|
| 1698 | mnuActChange.Enabled := False
|
---|
| 1699 | else
|
---|
| 1700 | mnuActChange.Enabled := True;
|
---|
| 1701 | mnuActLoadBoiler.Enabled := True;
|
---|
| 1702 | UpdateReminderFinish;
|
---|
| 1703 | Mode := [vmEdit] + [vmHTML_MODE[(FHTMLEditMode=emHTML)]]; //kt 8/09
|
---|
| 1704 | SetDisplayToHTMLvsText(Mode,FEditNote.Lines,VIEW_ACTIVATE_ONLY); //kt 8/09
|
---|
| 1705 | FWarmedUp := true; //kt 8/09
|
---|
| 1706 | end else begin
|
---|
| 1707 | // StatusText('Retrieving selected progress note...'); <-- original line. //kt 7/19/2007
|
---|
| 1708 | StatusText(DKLangConstW('fNotes_Retrieving_selected_progress_notexxx')); //kt added 7/19/2007
|
---|
| 1709 | Screen.Cursor := crAppStart; //kt changed from crHourGlass; 1/1/05
|
---|
| 1710 | //kt 8/09 pnlRead.Visible := True;
|
---|
| 1711 | //kt 8/09 pnlWrite.Visible := False;
|
---|
| 1712 | UpdateReminderFinish;
|
---|
| 1713 | lblTitle.Caption := Piece(Piece(Items[ItemIndex], U, 8), ';', 1) + #9 + Piece(Items[ItemIndex], U, 2) + ', ' +
|
---|
| 1714 | Piece(Items[ItemIndex], U, 6) + ', ' + Piece(Piece(Items[ItemIndex], U, 5), ';', 2) +
|
---|
| 1715 | ' (' + FormatFMDateTime('mmm dd,yy@hh:nn', MakeFMDateTime(Piece(Items[ItemIndex], U, 3)))
|
---|
| 1716 | + ')';
|
---|
| 1717 | lvNotes.Caption := lblTitle.Caption;
|
---|
| 1718 | //kt 8/09 LoadDocumentText(memNote.Lines, ItemIEN);
|
---|
| 1719 | LoadDocumentText(FViewNote, ItemIEN); //kt 8/09
|
---|
| 1720 | Note := FViewNote; //kt 8/09
|
---|
| 1721 | memNote.SelStart := 0;
|
---|
| 1722 | mnuViewDetail.Enabled := True;
|
---|
| 1723 | mnuViewDetail.Checked := False;
|
---|
| 1724 | mnuActChange.Enabled := False;
|
---|
| 1725 | mnuActLoadBoiler.Enabled := False;
|
---|
| 1726 | Screen.Cursor := crDefault;
|
---|
| 1727 | StatusText('');
|
---|
| 1728 | IsHTML := rHTMLTools.IsHTML(FViewNote); //kt 8/09
|
---|
| 1729 | Mode := [vmView] + [vmHTML_MODE[IsHTML]]; //kt 8/09
|
---|
| 1730 | SetDisplayToHTMLvsText(Mode,FViewNote); //kt 8/09
|
---|
| 1731 | if not FWarmedUp and IsHTML then begin //kt 8/09
|
---|
| 1732 | FWarmedUp := true; //kt 8/09
|
---|
| 1733 | //First HTML page won't display without this... //kt 8/09
|
---|
| 1734 | SetDisplayToHTMLvsText(Mode,FViewNote); //kt 8/09
|
---|
| 1735 | end; //kt 8/09
|
---|
| 1736 | end;
|
---|
| 1737 | end; //kt 8/09
|
---|
[453] | 1738 |
|
---|
[541] | 1739 | if(assigned(frmReminderTree)) then frmReminderTree.EnableActions;
|
---|
[453] | 1740 | //DisplayPCE; //kt 5-31-05 (moved down below)
|
---|
| 1741 | pnlRight.Refresh;
|
---|
[541] | 1742 | ProperRepaint(Editing); //kt 8/09
|
---|
| 1743 | //kt 8/09 memNewNote.Repaint;
|
---|
| 1744 | //kt 8/09 memNote.Repaint;
|
---|
[453] | 1745 | NotifyOtherApps(NAE_REPORT, 'TIU^' + lstNotes.ItemID);
|
---|
[541] | 1746 | //kt RESTORE LATER... frmImages.NewNoteSelected(Editing); //kt 9/05
|
---|
| 1747 | DisplayPCE; //kt 5-31-05 (move down from above)
|
---|
| 1748 | BroadcastImages(Note); //kt 8/09
|
---|
[453] | 1749 |
|
---|
| 1750 | //-----------------------------
|
---|
[541] | 1751 | //kt RESTORE LATER... frmImages.NewNoteSelected(lstNotes.ItemIndex=EditingIndex); //kt added 9-20-05
|
---|
| 1752 | end;
|
---|
| 1753 |
|
---|
| 1754 | procedure TfrmNotes.ProperRepaint(Editing : Boolean);
|
---|
| 1755 | //kt Added function 8/09
|
---|
| 1756 | begin
|
---|
| 1757 | if Editing then begin
|
---|
| 1758 | if (vmHTML in FViewMode) then begin
|
---|
| 1759 | HtmlEditor.Repaint;
|
---|
| 1760 | end else begin
|
---|
| 1761 | memNewNote.Repaint;
|
---|
| 1762 | end;
|
---|
| 1763 | end else begin
|
---|
| 1764 | if (vmHTML in FViewMode) then begin
|
---|
| 1765 | HtmlViewer.Repaint;
|
---|
| 1766 | end else begin
|
---|
| 1767 | memNote.Repaint;
|
---|
| 1768 | end;
|
---|
| 1769 | end;
|
---|
| 1770 | Application.ProcessMessages;
|
---|
| 1771 | end;
|
---|
| 1772 |
|
---|
| 1773 | procedure TfrmNotes.BroadcastImages(Note: TStrings);
|
---|
| 1774 | //kt added function 8/09
|
---|
| 1775 | var
|
---|
| 1776 | ImageList : TStringList;
|
---|
| 1777 | i : integer;
|
---|
| 1778 | begin
|
---|
[453] | 1779 | ImageList := TStringList.Create;
|
---|
[541] | 1780 | if rHTMLTools.CheckForImageLink(Note, ImageList) then begin
|
---|
[453] | 1781 | for i:= 0 to ImageList.Count-1 do begin
|
---|
| 1782 | NotifyOtherApps(NAE_REPORT, 'IMAGE^' + ImageList.Strings[i]);
|
---|
| 1783 | end;
|
---|
| 1784 | end;
|
---|
| 1785 | ImageList.Free;
|
---|
| 1786 | end;
|
---|
| 1787 |
|
---|
[541] | 1788 | function TfrmNotes.EditorHasText : boolean;
|
---|
| 1789 | //kt added function 8/09
|
---|
| 1790 | begin
|
---|
| 1791 | if (vmHTML in FViewMode) then begin
|
---|
| 1792 | Result := (HTMLViewer.Text <> '');
|
---|
| 1793 | end else begin
|
---|
| 1794 | Result := (memNote.Lines.Count > 0);
|
---|
| 1795 | end;
|
---|
| 1796 | end;
|
---|
| 1797 |
|
---|
[453] | 1798 | procedure TfrmNotes.cmdNewNoteClick(Sender: TObject);
|
---|
| 1799 | //{ maps 'New Note' button to the New Progress Note menu item } <-- original line. //kt 7/19/2007
|
---|
| 1800 | { maps DKLangConstW('fNotes_New_Note') button to the New Progress Note menu item } //kt added 7/19/2007
|
---|
| 1801 | begin
|
---|
| 1802 | inherited;
|
---|
| 1803 | mnuActNewClick(Self);
|
---|
| 1804 | end;
|
---|
| 1805 |
|
---|
| 1806 | procedure TfrmNotes.cmdPCEClick(Sender: TObject);
|
---|
| 1807 | var
|
---|
| 1808 | Refresh: boolean;
|
---|
| 1809 | ActionSts: TActionRec;
|
---|
| 1810 | AnIEN: integer;
|
---|
| 1811 | PCEObj, tmpPCEEdit: TPCEData;
|
---|
| 1812 |
|
---|
| 1813 | procedure UpdateEncounterInfo;
|
---|
| 1814 | begin
|
---|
| 1815 | if not FEditingNotePCEObj then
|
---|
| 1816 | begin
|
---|
| 1817 | PCEObj := nil;
|
---|
| 1818 | AnIEN := lstNotes.ItemIEN;
|
---|
[541] | 1819 | //kt 8/09 if (AnIEN <> 0) and (memNote.Lines.Count > 0) then
|
---|
| 1820 | if (AnIEN <> 0) and EditorHasText then //kt 8/09
|
---|
[453] | 1821 | begin
|
---|
| 1822 | ActOnDocument(ActionSts, AnIEN, 'VIEW');
|
---|
| 1823 | if ActionSts.Success then
|
---|
| 1824 | begin
|
---|
| 1825 | uPCEShow.CopyPCEData(uPCEEdit);
|
---|
| 1826 | PCEObj := uPCEEdit;
|
---|
| 1827 | end;
|
---|
| 1828 | end;
|
---|
| 1829 | Refresh := EditPCEData(PCEObj);
|
---|
| 1830 | end
|
---|
| 1831 | else
|
---|
| 1832 | begin
|
---|
| 1833 | UpdatePCE(uPCEEdit);
|
---|
| 1834 | Refresh := TRUE;
|
---|
| 1835 | end;
|
---|
| 1836 | if Refresh and (not frmFrame.Closing) then
|
---|
| 1837 | DisplayPCE;
|
---|
| 1838 | end;
|
---|
| 1839 |
|
---|
| 1840 | begin
|
---|
| 1841 | inherited;
|
---|
| 1842 | cmdPCE.Enabled := FALSE;
|
---|
| 1843 | if lstNotes.ItemIndex <> EditingIndex then
|
---|
| 1844 | // save uPCEEdit for note being edited, before updating current note's encounter, then restore (RV - TAM-0801-31056)
|
---|
| 1845 | begin
|
---|
| 1846 | tmpPCEEdit := TPCEData.Create;
|
---|
| 1847 | try
|
---|
| 1848 | uPCEEdit.CopyPCEData(tmpPCEEdit);
|
---|
| 1849 | UpdateEncounterInfo;
|
---|
| 1850 | tmpPCEEdit.CopyPCEData(uPCEEdit);
|
---|
| 1851 | finally
|
---|
| 1852 | tmpPCEEdit.Free;
|
---|
| 1853 | end;
|
---|
| 1854 | end
|
---|
| 1855 | else
|
---|
| 1856 | // no other note being edited, so just proceed as before.
|
---|
| 1857 | UpdateEncounterInfo;
|
---|
| 1858 | if cmdPCE <> nil then
|
---|
| 1859 | cmdPCE.Enabled := TRUE
|
---|
| 1860 | end;
|
---|
| 1861 |
|
---|
| 1862 | { Right panel (editor) events -------------------------------------------------------------- }
|
---|
| 1863 |
|
---|
| 1864 | procedure TfrmNotes.mnuActChangeClick(Sender: TObject);
|
---|
| 1865 | begin
|
---|
| 1866 | inherited;
|
---|
| 1867 | if (FEditingIndex < 0) or (lstNotes.ItemIndex <> FEditingIndex) then Exit;
|
---|
| 1868 | cmdChangeClick(Sender);
|
---|
| 1869 | end;
|
---|
| 1870 |
|
---|
| 1871 | procedure TfrmNotes.mnuActLoadBoilerClick(Sender: TObject);
|
---|
| 1872 | var
|
---|
| 1873 | NoteEmpty: Boolean;
|
---|
| 1874 | BoilerText: TStringList;
|
---|
| 1875 | DocInfo: string;
|
---|
| 1876 |
|
---|
| 1877 | procedure AssignBoilerText;
|
---|
| 1878 | begin
|
---|
| 1879 | ExecuteTemplateOrBoilerPlate(BoilerText, FEditNote.Title, ltTitle, Self, 'Title: ' + FEditNote.TitleName, DocInfo);
|
---|
[541] | 1880 | SetDisplayToHTMLvsText([vmHTML,vmEdit],BoilerText); //kt 8/09
|
---|
| 1881 | //kt 8/09 memNewNote.Lines.Assign(BoilerText);
|
---|
[453] | 1882 | UpdateNoteAuthor(DocInfo);
|
---|
| 1883 | FChanged := False;
|
---|
| 1884 | end;
|
---|
| 1885 |
|
---|
| 1886 | begin
|
---|
| 1887 | SetupVars; //kt added 7/19/2007 to replace constants with vars.
|
---|
| 1888 | inherited;
|
---|
| 1889 | if (FEditingIndex < 0) or (lstNotes.ItemIndex <> FEditingIndex) then Exit;
|
---|
| 1890 | BoilerText := TStringList.Create;
|
---|
| 1891 | try
|
---|
[541] | 1892 | if (vmHTML in FViewMode) then begin //kt 8/09
|
---|
| 1893 | NoteEmpty := (HTMLEditor.Text = ''); //kt 8/09
|
---|
| 1894 | end else begin //kt 8/09
|
---|
| 1895 | NoteEmpty := memNewNote.Text = '';
|
---|
| 1896 | end; //kt 8/09
|
---|
[453] | 1897 | LoadBoilerPlate(BoilerText, FEditNote.Title);
|
---|
| 1898 | if (BoilerText.Text <> '') or
|
---|
| 1899 | assigned(GetLinkedTemplate(IntToStr(FEditNote.Title), ltTitle)) then
|
---|
| 1900 | begin
|
---|
| 1901 | DocInfo := MakeXMLParamTIU(IntToStr(lstNotes.ItemIEN), FEditNote);
|
---|
| 1902 | if NoteEmpty then AssignBoilerText else
|
---|
| 1903 | begin
|
---|
| 1904 | case QueryBoilerPlate(BoilerText) of
|
---|
| 1905 | 0: { do nothing } ; // ignore
|
---|
| 1906 | 1: begin
|
---|
| 1907 | ExecuteTemplateOrBoilerPlate(BoilerText, FEditNote.Title, ltTitle, Self, 'Title: ' + FEditNote.TitleName, DocInfo);
|
---|
[541] | 1908 | if (vmHTML in FViewMode) then begin //kt 8/09
|
---|
| 1909 | HTMLEditor.Text := HTMLEditor.Text + Text2HTML(BoilerText); //kt 8/09
|
---|
| 1910 | end else begin //kt 8/09
|
---|
| 1911 | memNewNote.Lines.AddStrings(BoilerText); // append
|
---|
| 1912 | end; //kt 8/09
|
---|
[453] | 1913 | UpdateNoteAuthor(DocInfo);
|
---|
| 1914 | end;
|
---|
| 1915 | 2: AssignBoilerText; // replace
|
---|
| 1916 | end;
|
---|
| 1917 | end;
|
---|
| 1918 | end else
|
---|
| 1919 | begin
|
---|
| 1920 | if Sender = mnuActLoadBoiler
|
---|
| 1921 | then InfoBox(TX_NO_BOIL, TC_NO_BOIL, MB_OK)
|
---|
| 1922 | else
|
---|
| 1923 | begin
|
---|
| 1924 | if not NoteEmpty then
|
---|
| 1925 | // if not FChanged and (InfoBox(TX_BLR_CLEAR, TC_BLR_CLEAR, MB_YESNO) = ID_YES)
|
---|
[541] | 1926 | if (InfoBox(TX_BLR_CLEAR, TC_BLR_CLEAR, MB_YESNO) = ID_YES) then begin
|
---|
| 1927 | if (vmHTML in FViewMode) then begin //kt 8/09
|
---|
| 1928 | HTMLEditor.Clear; //kt 8/09
|
---|
| 1929 | end else begin //kt 8/09
|
---|
| 1930 | memNewNote.Lines.Clear;
|
---|
| 1931 | end; //kt 8/09
|
---|
| 1932 | end;
|
---|
[453] | 1933 | end;
|
---|
| 1934 | end; {if BoilerText.Text <> ''}
|
---|
| 1935 | finally
|
---|
| 1936 | BoilerText.Free;
|
---|
| 1937 | end;
|
---|
| 1938 | end;
|
---|
| 1939 |
|
---|
| 1940 | procedure TfrmNotes.cmdChangeClick(Sender: TObject);
|
---|
| 1941 | var
|
---|
| 1942 | LastTitle, LastConsult: Integer;
|
---|
| 1943 | OKPressed, IsIDChild: Boolean;
|
---|
| 1944 | x: string;
|
---|
| 1945 | DisAssoText : String;
|
---|
| 1946 | begin
|
---|
| 1947 | SetupVars; //kt added 7/19/2007 to replace constants with vars.
|
---|
| 1948 | inherited;
|
---|
| 1949 | IsIDChild := uIDNotesActive and (FEditNote.IDParent > 0);
|
---|
| 1950 | LastTitle := FEditNote.Title;
|
---|
| 1951 | FEditNote.IsNewNote := False;
|
---|
| 1952 | DisAssoText := '';
|
---|
| 1953 | if (FEditNote.PkgPtr = PKG_CONSULTS) then
|
---|
| 1954 | // DisAssoText := 'Consults'; <-- original line. //kt 7/19/2007
|
---|
| 1955 | DisAssoText := DKLangConstW('fNotes_Consults'); //kt added 7/19/2007
|
---|
| 1956 | if (FEditNote.PkgPtr = PKG_PRF) then
|
---|
| 1957 | // DisAssoText := 'Patient Record Flags'; <-- original line. //kt 7/19/2007
|
---|
| 1958 | DisAssoText := DKLangConstW('fNotes_Patient_Record_Flags'); //kt added 7/19/2007
|
---|
| 1959 | if (DisAssoText <> '') and (Sender <> Self) then
|
---|
| 1960 | // if InfoBox('If this title is changed, Any '+DisAssoText+' will be disassociated'+ <-- original line. //kt 7/19/2007
|
---|
| 1961 | if InfoBox(DKLangConstW('fNotes_If_this_title_is_changedx_Any')+' '+DisAssoText+DKLangConstW('fNotes_will_be_disassociated')+ //kt added 7/19/2007
|
---|
| 1962 | // ' with this note', <-- original line. //kt 7/19/2007
|
---|
| 1963 | DKLangConstW('fNotes_with_this_note'), //kt added 7/19/2007
|
---|
| 1964 | // 'Disassociate '+DisAssoText+'?',MB_OKCANCEL) = IDCANCEL then <-- original line. //kt 7/19/2007
|
---|
| 1965 | DKLangConstW('fNotes_Disassociate')+DisAssoText+'?',MB_OKCANCEL) = IDCANCEL then //kt added 7/19/2007
|
---|
| 1966 | exit;
|
---|
| 1967 | if FEditNote.PkgPtr = PKG_CONSULTS then LastConsult := FEditNote.PkgIEN else LastConsult := 0;;
|
---|
| 1968 | if Sender <> Self then OKPressed := ExecuteNoteProperties(FEditNote, CT_NOTES, IsIDChild, FNewIDChild, '', 0)
|
---|
| 1969 | else OKPressed := True;
|
---|
| 1970 | if not OKPressed then Exit;
|
---|
| 1971 | // update display fields & uPCEEdit
|
---|
| 1972 | lblNewTitle.Caption := ' ' + FEditNote.TitleName + ' ';
|
---|
| 1973 | //if (FEditNote.Addend > 0) and (CompareText(Copy(lblNewTitle.Caption, 2, 8), 'Addendum') <> 0) <-- original line. //kt 7/19/2007
|
---|
| 1974 | if (FEditNote.Addend > 0) and (CompareText(Copy(lblNewTitle.Caption, 2, 8), DKLangConstW('fNotes_Addendum')) <> 0) //kt added 7/19/2007
|
---|
| 1975 | // then lblNewTitle.Caption := ' Addendum to:' + lblNewTitle.Caption; <-- original line. //kt 7/19/2007
|
---|
| 1976 | then lblNewTitle.Caption := DKLangConstW('fNotes_Addendum_tox') + lblNewTitle.Caption; //kt added 7/19/2007
|
---|
| 1977 | with lblNewTitle do bvlNewTitle.SetBounds(Left - 1, Top - 1, Width + 2, Height + 2);
|
---|
| 1978 | lblRefDate.Caption := FormatFMDateTime('mmm dd,yyyy@hh:nn', FEditNote.DateTime);
|
---|
| 1979 | lblAuthor.Caption := FEditNote.AuthorName;
|
---|
| 1980 | if uPCEEdit.Inpatient then x := 'Adm: ' else x := 'Vst: ';
|
---|
| 1981 | x := x + FormatFMDateTime('mm/dd/yy', FEditNote.VisitDate) + ' ' + FEditNote.LocationName;
|
---|
| 1982 | lblVisit.Caption := x;
|
---|
| 1983 | if Length(FEditNote.CosignerName) > 0
|
---|
| 1984 | // then lblCosigner.Caption := 'Expected Cosigner: ' + FEditNote.CosignerName <-- original line. //kt 7/19/2007
|
---|
| 1985 | then lblCosigner.Caption := DKLangConstW('fNotes_Expected_Cosignerx') + FEditNote.CosignerName //kt added 7/19/2007
|
---|
| 1986 | else lblCosigner.Caption := '';
|
---|
| 1987 | uPCEEdit.NoteTitle := FEditNote.Title;
|
---|
| 1988 | // modify signature requirements if author or cosigner changed
|
---|
| 1989 | if (User.DUZ <> FEditNote.Author) and (User.DUZ <> FEditNote.Cosigner)
|
---|
| 1990 | then Changes.ReplaceSignState(CH_DOC, lstNotes.ItemID, CH_SIGN_NA)
|
---|
| 1991 | else Changes.ReplaceSignState(CH_DOC, lstNotes.ItemID, CH_SIGN_YES);
|
---|
| 1992 | x := lstNotes.Items[EditingIndex];
|
---|
| 1993 | SetPiece(x, U, 2, lblNewTitle.Caption);
|
---|
| 1994 | SetPiece(x, U, 3, FloatToStr(FEditNote.DateTime));
|
---|
| 1995 | tvNotes.Selected.Text := MakeNoteDisplayText(x);
|
---|
| 1996 | TORTreeNode(tvNotes.Selected).StringData := x;
|
---|
| 1997 | lstNotes.Items[EditingIndex] := x;
|
---|
| 1998 | Changes.ReplaceText(CH_DOC, lstNotes.ItemID, GetTitleText(EditingIndex));
|
---|
| 1999 | with FEditNote do
|
---|
| 2000 | begin
|
---|
| 2001 | if (PkgPtr = PKG_CONSULTS) and (LastConsult <> PkgIEN) then
|
---|
| 2002 | begin
|
---|
| 2003 | // try to lock the new consult, reset to previous if unable
|
---|
| 2004 | if (PkgIEN > 0) and not LockConsultRequest(PkgIEN) then
|
---|
| 2005 | begin
|
---|
| 2006 | Infobox(TX_NO_ORD_CHG, TC_NO_ORD_CHG, MB_OK);
|
---|
| 2007 | PkgIEN := LastConsult;
|
---|
| 2008 | end else
|
---|
| 2009 | begin
|
---|
| 2010 | // unlock the previous consult
|
---|
| 2011 | if LastConsult > 0 then UnlockOrderIfAble(GetConsultOrderIEN(LastConsult));
|
---|
| 2012 | if PkgIEN = 0 then FOrderID := '';
|
---|
| 2013 | end;
|
---|
| 2014 | end;
|
---|
| 2015 | //Link Note to PRF Action
|
---|
| 2016 | if PRF_IEN <> 0 then
|
---|
| 2017 | if sCallV('TIU LINK TO FLAG', [lstNotes.ItemIEN,PRF_IEN,ActionIEN,Patient.DFN]) = '0' then
|
---|
| 2018 | ShowMessage('TIU LINK TO FLAG: FAILED');
|
---|
| 2019 | end;
|
---|
| 2020 |
|
---|
| 2021 | if LastTitle <> FEditNote.Title then mnuActLoadBoilerClick(Self);
|
---|
| 2022 | end;
|
---|
| 2023 |
|
---|
| 2024 | procedure TfrmNotes.memNewNoteChange(Sender: TObject);
|
---|
| 2025 | begin
|
---|
| 2026 | inherited;
|
---|
[541] | 2027 | //kt 8/09 NOTE: the equivalent functionality for HTML is HTMLEditor.Keystruck. Don't have to set here.
|
---|
[453] | 2028 | FChanged := True;
|
---|
| 2029 | end;
|
---|
| 2030 |
|
---|
| 2031 | procedure TfrmNotes.pnlFieldsResize(Sender: TObject);
|
---|
| 2032 | { center the reference date on the panel }
|
---|
| 2033 | begin
|
---|
| 2034 | inherited;
|
---|
| 2035 | lblRefDate.Left := (pnlFields.Width - lblRefDate.Width) div 2;
|
---|
| 2036 | if lblRefDate.Left < (lblNewTitle.Left + lblNewTitle.Width + 6)
|
---|
| 2037 | then lblRefDate.Left := (lblNewTitle.Left + lblNewTitle.Width);
|
---|
| 2038 | end;
|
---|
| 2039 |
|
---|
| 2040 | procedure TfrmNotes.DoAutoSave(Suppress: integer = 1);
|
---|
| 2041 | var
|
---|
| 2042 | ErrMsg: string;
|
---|
[541] | 2043 | Changed : boolean; //kt 8/09
|
---|
[453] | 2044 | begin
|
---|
[541] | 2045 | Changed := false; //kt 8/09
|
---|
| 2046 | if (vmHTML in FViewMode) then begin //kt 8/09
|
---|
| 2047 | Changed := HTMLEditor.KeyStruck; //kt 8/09
|
---|
| 2048 | end else begin //kt 8/09
|
---|
| 2049 | Changed := FChanged; //kt 8/09
|
---|
| 2050 | end; //kt 8/09
|
---|
| 2051 | //kt 8/09 if (EditingIndex > -1) and FChanged then
|
---|
| 2052 | if (EditingIndex > -1) and Changed then //kt 8/09
|
---|
[453] | 2053 | begin
|
---|
| 2054 | // StatusText('Autosaving note...'); <-- original line. //kt 7/19/2007
|
---|
| 2055 | StatusText(DKLangConstW('fNotes_Autosaving_notexxx')); //kt added 7/19/2007
|
---|
| 2056 | //PutTextOnly(ErrMsg, memNewNote.Lines, lstNotes.GetIEN(EditingIndex));
|
---|
| 2057 | timAutoSave.Enabled := False;
|
---|
| 2058 | try
|
---|
[541] | 2059 | if (vmHTML in FViewMode) then begin //kt
|
---|
| 2060 | rHTMLTools.SplitToArray (HTMLEditor.HTMLText, FEditNote.Lines); //kt
|
---|
| 2061 | SetText(ErrMsg, FEditNote.Lines, lstNotes.GetIEN(EditingIndex),Suppress);//kt
|
---|
| 2062 | end else begin //kt
|
---|
[453] | 2063 | SetText(ErrMsg, memNewNote.Lines, lstNotes.GetIEN(EditingIndex), Suppress);
|
---|
[541] | 2064 | end; //kt
|
---|
[453] | 2065 | finally
|
---|
| 2066 | timAutoSave.Enabled := True;
|
---|
| 2067 | end;
|
---|
| 2068 | FChanged := False;
|
---|
[541] | 2069 | HTMLEditor.KeyStruck := false; //kt
|
---|
[453] | 2070 | StatusText('');
|
---|
| 2071 | end;
|
---|
| 2072 | if ErrMsg <> '' then
|
---|
| 2073 | InfoBox(TX_SAVE_ERROR1 + ErrMsg + TX_SAVE_ERROR2, TC_SAVE_ERROR, MB_OK or MB_ICONWARNING);
|
---|
| 2074 | //Assert(ErrMsg = '', 'AutoSave: ' + ErrMsg);
|
---|
| 2075 | end;
|
---|
| 2076 |
|
---|
| 2077 | procedure TfrmNotes.timAutoSaveTimer(Sender: TObject);
|
---|
| 2078 | begin
|
---|
| 2079 | inherited;
|
---|
| 2080 | DoAutoSave;
|
---|
| 2081 | end;
|
---|
| 2082 |
|
---|
| 2083 | { View menu events ------------------------------------------------------------------------- }
|
---|
| 2084 |
|
---|
| 2085 | procedure TfrmNotes.mnuViewClick(Sender: TObject);
|
---|
| 2086 | { changes the list of notes available for viewing }
|
---|
| 2087 | var
|
---|
| 2088 | AuthCtxt: TAuthorContext;
|
---|
| 2089 | SearchCtxt: TSearchContext; // Text Search CQ: HDS00002856
|
---|
| 2090 | DateRange: TNoteDateRange;
|
---|
| 2091 | Saved: Boolean;
|
---|
| 2092 | begin
|
---|
| 2093 | inherited;
|
---|
| 2094 | // save note at EditingIndex?
|
---|
| 2095 | if EditingIndex <> -1 then
|
---|
| 2096 | begin
|
---|
| 2097 | SaveCurrentNote(Saved);
|
---|
| 2098 | if not Saved then Exit;
|
---|
| 2099 | end;
|
---|
| 2100 | FLastNoteID := lstNotes.ItemID;
|
---|
| 2101 | mnuViewDetail.Checked := False;
|
---|
| 2102 | //StatusText('Retrieving progress note list...'); <-- original line. //kt 7/19/2007
|
---|
| 2103 | StatusText(DKLangConstW('fNotes_Retrieving_progress_note_listxxx')); //kt added 7/19/2007
|
---|
| 2104 | if Sender is TMenuItem then ViewContext := TMenuItem(Sender).Tag
|
---|
| 2105 | else if FCurrentContext.Status <> '' then ViewContext := NC_CUSTOM
|
---|
| 2106 | else ViewContext := NC_RECENT;
|
---|
| 2107 | case ViewContext of
|
---|
| 2108 | NC_RECENT: begin
|
---|
| 2109 | FillChar(FCurrentContext, SizeOf(FCurrentContext), 0);
|
---|
| 2110 | // lblNotes.Caption := 'Last ' + IntToStr(ReturnMaxNotes) + ' Notes'; <-- original line. //kt 7/19/2007
|
---|
| 2111 | lblNotes.Caption := DKLangConstW('fNotes_Last') + IntToStr(ReturnMaxNotes) + DKLangConstW('fNotes_Notes'); //kt added 7/19/2007
|
---|
| 2112 | FCurrentContext.Status := IntToStr(ViewContext);
|
---|
| 2113 | FCurrentContext.MaxDocs := ReturnMaxNotes;
|
---|
| 2114 | LoadNotes;
|
---|
| 2115 | end;
|
---|
| 2116 | NC_ALL: begin
|
---|
| 2117 | FillChar(FCurrentContext, SizeOf(FCurrentContext), 0);
|
---|
| 2118 | // lblNotes.Caption := 'All Signed Notes'; <-- original line. //kt 7/19/2007
|
---|
| 2119 | lblNotes.Caption := DKLangConstW('fNotes_All_Signed_Notes'); //kt added 7/19/2007
|
---|
| 2120 | FCurrentContext.Status := IntToStr(ViewContext);
|
---|
| 2121 | LoadNotes;
|
---|
| 2122 | end;
|
---|
| 2123 | NC_UNSIGNED: begin
|
---|
| 2124 | FillChar(FCurrentContext, SizeOf(FCurrentContext), 0);
|
---|
| 2125 | // lblNotes.Caption := 'Unsigned Notes'; <-- original line. //kt 7/19/2007
|
---|
| 2126 | lblNotes.Caption := DKLangConstW('fNotes_Unsigned_Notes'); //kt added 7/19/2007
|
---|
| 2127 | FCurrentContext.Status := IntToStr(ViewContext);
|
---|
| 2128 | LoadNotes;
|
---|
| 2129 | end;
|
---|
| 2130 | // Text Search CQ: HDS00002856 --------------------
|
---|
| 2131 | NC_SEARCHTEXT: begin;
|
---|
| 2132 | SearchTextStopFlag := False;
|
---|
| 2133 | SelectSearchText(Font.Size, FCurrentContext.SearchString, SearchCtxt );
|
---|
| 2134 | with SearchCtxt do if Changed then
|
---|
| 2135 | begin
|
---|
| 2136 | //FCurrentContext.Status := IntToStr(ViewContext);
|
---|
| 2137 | frmSearchStop.Show;
|
---|
| 2138 | // lblNotes.Caption := 'Search: '+ SearchString; <-- original line. //kt 7/19/2007
|
---|
| 2139 | lblNotes.Caption := DKLangConstW('fNotes_Searchx')+ SearchString; //kt added 7/19/2007
|
---|
| 2140 | frmSearchStop.lblSearchStatus.Caption := lblNotes.Caption;
|
---|
| 2141 | FCurrentContext.SearchString := SearchString;
|
---|
| 2142 | LoadNotes;
|
---|
| 2143 | end;
|
---|
| 2144 | // Only do LoadNotes if something changed
|
---|
| 2145 | end;
|
---|
| 2146 | // Text Search CQ: HDS00002856 --------------------
|
---|
| 2147 | NC_UNCOSIGNED: begin
|
---|
| 2148 | FillChar(FCurrentContext, SizeOf(FCurrentContext), 0);
|
---|
| 2149 | // lblNotes.Caption := 'Uncosigned Notes'; <-- original line. //kt 7/19/2007
|
---|
| 2150 | lblNotes.Caption := DKLangConstW('fNotes_Uncosigned_Notes'); //kt added 7/19/2007
|
---|
| 2151 | FCurrentContext.Status := IntToStr(ViewContext);
|
---|
| 2152 | LoadNotes;
|
---|
| 2153 | end;
|
---|
| 2154 | NC_BY_AUTHOR: begin
|
---|
| 2155 | SelectAuthor(Font.Size, FCurrentContext, AuthCtxt);
|
---|
| 2156 | with AuthCtxt do if Changed then
|
---|
| 2157 | begin
|
---|
| 2158 | FillChar(FCurrentContext, SizeOf(FCurrentContext), 0);
|
---|
| 2159 | // lblNotes.Caption := AuthorName + ': Signed Notes'; <-- original line. //kt 7/19/2007
|
---|
| 2160 | lblNotes.Caption := AuthorName + DKLangConstW('fNotes_x_Signed_Notes'); //kt added 7/19/2007
|
---|
| 2161 | FCurrentContext.Status := IntToStr(NC_BY_AUTHOR);
|
---|
| 2162 | FCurrentContext.Author := Author;
|
---|
| 2163 | FCurrentContext.TreeAscending := Ascending;
|
---|
| 2164 | LoadNotes;
|
---|
| 2165 | end;
|
---|
| 2166 | end;
|
---|
| 2167 | NC_BY_DATE: begin
|
---|
| 2168 | SelectNoteDateRange(Font.Size, FCurrentContext, DateRange);
|
---|
| 2169 | with DateRange do if Changed then
|
---|
| 2170 | begin
|
---|
| 2171 | FillChar(FCurrentContext, SizeOf(FCurrentContext), 0);
|
---|
| 2172 | lblNotes.Caption := FormatFMDateTime('mmm dd,yy', FMBeginDate) + ' to ' +
|
---|
| 2173 | FormatFMDateTime('mmm dd,yy', FMEndDate) + ': Signed Notes';
|
---|
| 2174 | FCurrentContext.BeginDate := BeginDate;
|
---|
| 2175 | FCurrentContext.EndDate := EndDate;
|
---|
| 2176 | FCurrentContext.FMBeginDate := FMBeginDate;
|
---|
| 2177 | FCurrentContext.FMEndDate := FMEndDate;
|
---|
| 2178 | FCurrentContext.TreeAscending := Ascending;
|
---|
| 2179 | FCurrentContext.Status := IntToStr(NC_BY_DATE);
|
---|
| 2180 | LoadNotes;
|
---|
| 2181 | end;
|
---|
| 2182 | end;
|
---|
| 2183 | NC_CUSTOM: begin
|
---|
| 2184 | if Sender is TMenuItem then
|
---|
| 2185 | begin
|
---|
| 2186 | SelectTIUView(Font.Size, True, FCurrentContext, uTIUContext);
|
---|
| 2187 | //lblNotes.Caption := 'Custom List';
|
---|
| 2188 | end;
|
---|
| 2189 | with uTIUContext do if Changed then
|
---|
| 2190 | begin
|
---|
| 2191 | //if not (Sender is TMenuItem) then lblNotes.Caption := 'Default List';
|
---|
| 2192 | //if MaxDocs = 0 then MaxDocs := ReturnMaxNotes;
|
---|
| 2193 | FCurrentContext.BeginDate := BeginDate;
|
---|
| 2194 | FCurrentContext.EndDate := EndDate;
|
---|
| 2195 | FCurrentContext.FMBeginDate := FMBeginDate;
|
---|
| 2196 | FCurrentContext.FMEndDate := FMEndDate;
|
---|
| 2197 | FCurrentContext.Status := Status;
|
---|
| 2198 | FCurrentContext.Author := Author;
|
---|
| 2199 | FCurrentContext.MaxDocs := MaxDocs;
|
---|
| 2200 | FCurrentContext.ShowSubject := ShowSubject;
|
---|
| 2201 | // NEW PREFERENCES:
|
---|
| 2202 | FCurrentContext.SortBy := SortBy;
|
---|
| 2203 | FCurrentContext.ListAscending := ListAscending;
|
---|
| 2204 | FCurrentContext.GroupBy := GroupBy;
|
---|
| 2205 | FCurrentContext.TreeAscending := TreeAscending;
|
---|
| 2206 | FCurrentContext.SearchField := SearchField;
|
---|
| 2207 | FCurrentContext.Keyword := Keyword;
|
---|
| 2208 | FCurrentContext.Filtered := Filtered;
|
---|
| 2209 | LoadNotes;
|
---|
| 2210 | end;
|
---|
| 2211 | end;
|
---|
| 2212 | end; {case}
|
---|
| 2213 | lblNotes.Caption := SetNoteTreeLabel(FCurrentContext);
|
---|
| 2214 | // Text Search CQ: HDS00002856 --------------------
|
---|
| 2215 | If FCurrentContext.SearchString <> '' then
|
---|
| 2216 | // lblNotes.Caption := lblNotes.Caption+', containing "'+FCurrentContext.SearchString+'"'; <-- original line. //kt 7/19/2007
|
---|
| 2217 | lblNotes.Caption := lblNotes.Caption+DKLangConstW('fNotes_x_containing_x')+FCurrentContext.SearchString+'"'; //kt added 7/19/2007
|
---|
| 2218 | If SearchTextStopFlag=True then begin;
|
---|
| 2219 | // lblNotes.Caption := 'Search for "'+FCurrentContext.SearchString+'" was stopped!'; <-- original line. //kt 7/19/2007
|
---|
| 2220 | lblNotes.Caption := DKLangConstW('fNotes_Search_for_x')+FCurrentContext.SearchString+DKLangConstW('fNotes_x_was_stoppedx'); //kt added 7/19/2007
|
---|
| 2221 | end;
|
---|
| 2222 | frmSearchStop.Hide;
|
---|
| 2223 | // Text Search CQ: HDS00002856 --------------------
|
---|
| 2224 | lblNotes.hint := lblNotes.Caption;
|
---|
| 2225 | tvNotes.Caption := lblNotes.Caption;
|
---|
| 2226 | StatusText('');
|
---|
| 2227 | end;
|
---|
| 2228 |
|
---|
| 2229 | { Action menu events ----------------------------------------------------------------------- }
|
---|
| 2230 |
|
---|
| 2231 | function TfrmNotes.StartNewEdit(NewNoteType: integer): Boolean;
|
---|
| 2232 | { if currently editing a note, returns TRUE if the user wants to start a new one }
|
---|
| 2233 | var
|
---|
| 2234 | Saved: Boolean;
|
---|
| 2235 | Msg, CapMsg: string;
|
---|
| 2236 | begin
|
---|
| 2237 | SetupVars; //kt added 7/19/2007 to replace constants with vars.
|
---|
| 2238 | FStarting := False;
|
---|
| 2239 | Result := True;
|
---|
| 2240 | cmdNewNote.Enabled := False;
|
---|
| 2241 | if EditingIndex > -1 then
|
---|
| 2242 | begin
|
---|
| 2243 | FStarting := True;
|
---|
| 2244 | case NewNoteType of
|
---|
| 2245 | NT_ACT_ADDENDUM: begin
|
---|
| 2246 | Msg := TX_NEW_SAVE1 + MakeNoteDisplayText(lstNotes.Items[EditingIndex]) + TX_NEW_SAVE3;
|
---|
| 2247 | CapMsg := TC_NEW_SAVE3;
|
---|
| 2248 | end;
|
---|
| 2249 | NT_ACT_EDIT_NOTE: begin
|
---|
| 2250 | Msg := TX_NEW_SAVE1 + MakeNoteDisplayText(lstNotes.Items[EditingIndex]) + TX_NEW_SAVE4;
|
---|
| 2251 | CapMsg := TC_NEW_SAVE4;
|
---|
| 2252 | end;
|
---|
| 2253 | NT_ACT_ID_ENTRY: begin
|
---|
| 2254 | Msg := TX_NEW_SAVE1 + MakeNoteDisplayText(lstNotes.Items[EditingIndex]) + TX_NEW_SAVE5;
|
---|
| 2255 | CapMsg := TC_NEW_SAVE5;
|
---|
| 2256 | end;
|
---|
| 2257 | else
|
---|
| 2258 | begin
|
---|
| 2259 | Msg := TX_NEW_SAVE1 + MakeNoteDisplayText(lstNotes.Items[EditingIndex]) + TX_NEW_SAVE2;
|
---|
| 2260 | CapMsg := TC_NEW_SAVE2;
|
---|
| 2261 | end;
|
---|
| 2262 | end;
|
---|
| 2263 | if InfoBox(Msg, CapMsg, MB_YESNO) = IDNO then
|
---|
| 2264 | begin
|
---|
| 2265 | Result := False;
|
---|
| 2266 | FStarting := False;
|
---|
| 2267 | end
|
---|
| 2268 | else
|
---|
| 2269 | begin
|
---|
| 2270 | SaveCurrentNote(Saved);
|
---|
| 2271 | if not Saved then Result := False else LoadNotes;
|
---|
| 2272 | FStarting := False;
|
---|
| 2273 | end;
|
---|
| 2274 | end;
|
---|
| 2275 | cmdNewNote.Enabled := (Result = False) and (FStarting = False);
|
---|
| 2276 | end;
|
---|
| 2277 |
|
---|
| 2278 | procedure TfrmNotes.mnuActNewClick(Sender: TObject);
|
---|
| 2279 | const
|
---|
| 2280 | IS_ID_CHILD = False;
|
---|
| 2281 | { switches to current new note or creates a new note if none is being edited already }
|
---|
| 2282 | begin
|
---|
| 2283 | SetupVars; //kt added 7/19/2007 to replace constants with vars.
|
---|
| 2284 | inherited;
|
---|
| 2285 | if not StartNewEdit(NT_ACT_NEW_NOTE) then Exit;
|
---|
| 2286 | //LoadNotes;
|
---|
| 2287 | // make sure a visit (time & location) is available before creating the note
|
---|
| 2288 | if Encounter.NeedVisit then
|
---|
| 2289 | begin
|
---|
| 2290 | UpdateVisit(Font.Size, DfltTIULocation);
|
---|
| 2291 | frmFrame.DisplayEncounterText;
|
---|
| 2292 | end;
|
---|
| 2293 | if Encounter.NeedVisit then
|
---|
| 2294 | begin
|
---|
| 2295 | InfoBox(TX_NEED_VISIT, TX_NO_VISIT, MB_OK or MB_ICONWARNING);
|
---|
| 2296 | ShowPCEButtons(False);
|
---|
| 2297 | Exit;
|
---|
| 2298 | end;
|
---|
| 2299 | InsertNewNote(IS_ID_CHILD, 0);
|
---|
| 2300 | end;
|
---|
| 2301 |
|
---|
| 2302 | procedure TfrmNotes.mnuActAddIDEntryClick(Sender: TObject);
|
---|
| 2303 | const
|
---|
| 2304 | IS_ID_CHILD = True;
|
---|
| 2305 | var
|
---|
| 2306 | AnIDParent: integer;
|
---|
| 2307 | { switches to current new note or creates a new note if none is being edited already }
|
---|
| 2308 | begin
|
---|
| 2309 | SetupVars; //kt added 7/19/2007 to replace constants with vars.
|
---|
| 2310 | inherited;
|
---|
| 2311 | AnIDParent := lstNotes.ItemIEN;
|
---|
| 2312 | if not StartNewEdit(NT_ACT_ID_ENTRY) then Exit;
|
---|
| 2313 | //LoadNotes;
|
---|
| 2314 | with tvNotes do Selected := FindPieceNode(IntToStr(AnIDParent), U, Items.GetFirstNode);
|
---|
| 2315 | // make sure a visit (time & location) is available before creating the note
|
---|
| 2316 | if Encounter.NeedVisit then
|
---|
| 2317 | begin
|
---|
| 2318 | UpdateVisit(Font.Size, DfltTIULocation);
|
---|
| 2319 | frmFrame.DisplayEncounterText;
|
---|
| 2320 | end;
|
---|
| 2321 | if Encounter.NeedVisit then
|
---|
| 2322 | begin
|
---|
| 2323 | InfoBox(TX_NEED_VISIT, TX_NO_VISIT, MB_OK or MB_ICONWARNING);
|
---|
| 2324 | Exit;
|
---|
| 2325 | end;
|
---|
| 2326 | InsertNewNote(IS_ID_CHILD, AnIDParent);
|
---|
| 2327 | end;
|
---|
| 2328 |
|
---|
| 2329 | procedure TfrmNotes.mnuActAddendClick(Sender: TObject);
|
---|
| 2330 | { make an addendum to an existing note }
|
---|
| 2331 | var
|
---|
| 2332 | ActionSts: TActionRec;
|
---|
| 2333 | ANoteID: string;
|
---|
| 2334 | begin
|
---|
| 2335 | SetupVars; //kt added 7/19/2007 to replace constants with vars.
|
---|
| 2336 | inherited;
|
---|
| 2337 | if lstNotes.ItemIEN <= 0 then Exit;
|
---|
| 2338 | ANoteID := lstNotes.ItemID;
|
---|
| 2339 | if not StartNewEdit(NT_ACT_ADDENDUM) then Exit;
|
---|
| 2340 | //LoadNotes;
|
---|
| 2341 | with tvNotes do Selected := FindPieceNode(ANoteID, 1, U, Items.GetFirstNode);
|
---|
| 2342 | if lstNotes.ItemIndex = EditingIndex then
|
---|
| 2343 | begin
|
---|
| 2344 | InfoBox(TX_ADDEND_NO, TX_ADDEND_MK, MB_OK);
|
---|
| 2345 | Exit;
|
---|
| 2346 | end;
|
---|
| 2347 | ActOnDocument(ActionSts, lstNotes.ItemIEN, 'MAKE ADDENDUM');
|
---|
| 2348 | if not ActionSts.Success then
|
---|
| 2349 | begin
|
---|
| 2350 | InfoBox(ActionSts.Reason, TX_IN_AUTH, MB_OK);
|
---|
| 2351 | Exit;
|
---|
| 2352 | end;
|
---|
| 2353 | with lstNotes do if TitleForNote(lstNotes.ItemIEN) = TYP_ADDENDUM then
|
---|
| 2354 | begin
|
---|
| 2355 | InfoBox(TX_ADDEND_AD, TX_ADDEND_MK, MB_OK);
|
---|
| 2356 | Exit;
|
---|
| 2357 | end;
|
---|
| 2358 | InsertAddendum;
|
---|
| 2359 | end;
|
---|
| 2360 |
|
---|
| 2361 | procedure TfrmNotes.mnuActDetachFromIDParentClick(Sender: TObject);
|
---|
| 2362 | var
|
---|
| 2363 | DocID, WhyNot: string;
|
---|
| 2364 | Saved: boolean;
|
---|
| 2365 | SavedDocID: string;
|
---|
| 2366 | begin
|
---|
| 2367 | SetupVars; //kt added 7/19/2007 to replace constants with vars.
|
---|
| 2368 | if lstNotes.ItemIEN = 0 then exit;
|
---|
| 2369 | SavedDocID := lstNotes.ItemID;
|
---|
| 2370 | if EditingIndex <> -1 then
|
---|
| 2371 | begin
|
---|
| 2372 | SaveCurrentNote(Saved);
|
---|
| 2373 | if not Saved then Exit;
|
---|
| 2374 | LoadNotes;
|
---|
| 2375 | with tvNotes do Selected := FindPieceNode(SavedDocID, U, Items.GetFirstNode);
|
---|
| 2376 | end;
|
---|
| 2377 | if not CanBeAttached(PDocTreeObject(tvNotes.Selected.Data)^.DocID, WhyNot) then
|
---|
| 2378 | begin
|
---|
| 2379 | WhyNot := StringReplace(WhyNot, 'ATTACH', 'DETACH', [rfIgnoreCase]);
|
---|
| 2380 | WhyNot := StringReplace(WhyNot, 'to an ID', 'from an ID', [rfIgnoreCase]);
|
---|
| 2381 | InfoBox(WhyNot, TX_DETACH_FAILURE, MB_OK);
|
---|
| 2382 | Exit;
|
---|
| 2383 | end;
|
---|
| 2384 | if (InfoBox('DETACH: ' + tvNotes.Selected.Text + CRLF + CRLF +
|
---|
| 2385 | ' FROM: ' + tvNotes.Selected.Parent.Text + CRLF + CRLF +
|
---|
| 2386 | // 'Are you sure?', TX_DETACH_CNF, MB_YESNO or MB_DEFBUTTON2 or MB_ICONQUESTION) <> IDYES) <-- original line. //kt 7/19/2007
|
---|
| 2387 | DKLangConstW('fNotes_Are_you_surex'), TX_DETACH_CNF, MB_YESNO or MB_DEFBUTTON2 or MB_ICONQUESTION) <> IDYES) //kt added 7/19/2007
|
---|
| 2388 | then Exit;
|
---|
| 2389 | DocID := PDocTreeObject(tvNotes.Selected.Data)^.DocID;
|
---|
| 2390 | SavedDocID := PDocTreeObject(tvNotes.Selected.Parent.Data)^.DocID;
|
---|
| 2391 | if DetachEntryFromParent(DocID, WhyNot) then
|
---|
| 2392 | begin
|
---|
| 2393 | LoadNotes;
|
---|
| 2394 | with tvNotes do Selected := FindPieceNode(SavedDocID, U, Items.GetFirstNode);
|
---|
| 2395 | if tvNotes.Selected <> nil then tvNotes.Selected.Expand(False);
|
---|
| 2396 | end
|
---|
| 2397 | else
|
---|
| 2398 | begin
|
---|
| 2399 | WhyNot := StringReplace(WhyNot, 'ATTACH', 'DETACH', [rfIgnoreCase]);
|
---|
| 2400 | WhyNot := StringReplace(WhyNot, 'to an ID', 'from an ID', [rfIgnoreCase]);
|
---|
| 2401 | InfoBox(WhyNot, TX_DETACH_FAILURE, MB_OK);
|
---|
| 2402 | end;
|
---|
| 2403 | end;
|
---|
| 2404 |
|
---|
| 2405 | procedure TfrmNotes.mnuActSignListClick(Sender: TObject);
|
---|
| 2406 | { add the note to the Encounter object, see mnuActSignClick - copied}
|
---|
| 2407 | const
|
---|
| 2408 | SIG_COSIGN = 'COSIGNATURE';
|
---|
| 2409 | SIG_SIGN = 'SIGNATURE';
|
---|
| 2410 | var
|
---|
| 2411 | ActionType, SignTitle: string;
|
---|
| 2412 | ActionSts: TActionRec;
|
---|
| 2413 | begin
|
---|
| 2414 | SetupVars; //kt added 7/19/2007 to replace constants with vars.
|
---|
| 2415 | inherited;
|
---|
| 2416 | if lstNotes.ItemIEN = 0 then Exit;
|
---|
| 2417 | if lstNotes.ItemIndex = EditingIndex then Exit; // already in signature list
|
---|
| 2418 | if not NoteHasText(lstNotes.ItemIEN) then
|
---|
| 2419 | begin
|
---|
| 2420 | InfoBox(TX_EMPTY_NOTE1, TC_EMPTY_NOTE, MB_OK or MB_ICONERROR);
|
---|
| 2421 | Exit;
|
---|
| 2422 | end;
|
---|
| 2423 | if not LastSaveClean(lstNotes.ItemIEN) and
|
---|
| 2424 | (InfoBox(TX_ABSAVE, TC_ABSAVE, MB_YESNO or MB_DEFBUTTON2 or MB_ICONWARNING) <> IDYES) then Exit;
|
---|
| 2425 | if CosignDocument(lstNotes.ItemIEN) then
|
---|
| 2426 | begin
|
---|
| 2427 | SignTitle := TX_COSIGN;
|
---|
| 2428 | ActionType := SIG_COSIGN;
|
---|
| 2429 | end else
|
---|
| 2430 | begin
|
---|
| 2431 | SignTitle := TX_SIGN;
|
---|
| 2432 | ActionType := SIG_SIGN;
|
---|
| 2433 | end;
|
---|
| 2434 | ActOnDocument(ActionSts, lstNotes.ItemIEN, ActionType);
|
---|
| 2435 | if not ActionSts.Success then
|
---|
| 2436 | begin
|
---|
| 2437 | InfoBox(ActionSts.Reason, TX_IN_AUTH, MB_OK);
|
---|
| 2438 | Exit;
|
---|
| 2439 | end;
|
---|
| 2440 | LockConsultRequestAndNote(lstNotes.ItemIEN);
|
---|
| 2441 | with lstNotes do Changes.Add(CH_DOC, ItemID, GetTitleText(ItemIndex), '', CH_SIGN_YES);
|
---|
| 2442 | end;
|
---|
| 2443 |
|
---|
| 2444 | procedure TfrmNotes.RemovePCEFromChanges(IEN: Int64; AVisitStr: string = '');
|
---|
| 2445 | begin
|
---|
| 2446 | if IEN = NT_ADDENDUM then Exit; // no PCE information entered for an addendum
|
---|
| 2447 | // do we need to call DeletePCE(AVisitStr), as was done with NT_NEW_NOTE (ien=-10)???
|
---|
| 2448 | if AVisitStr = '' then AVisitStr := VisitStrForNote(IEN);
|
---|
| 2449 | Changes.Remove(CH_PCE, 'V' + AVisitStr);
|
---|
| 2450 | Changes.Remove(CH_PCE, 'P' + AVisitStr);
|
---|
| 2451 | Changes.Remove(CH_PCE, 'D' + AVisitStr);
|
---|
| 2452 | Changes.Remove(CH_PCE, 'I' + AVisitStr);
|
---|
| 2453 | Changes.Remove(CH_PCE, 'S' + AVisitStr);
|
---|
| 2454 | Changes.Remove(CH_PCE, 'A' + AVisitStr);
|
---|
| 2455 | Changes.Remove(CH_PCE, 'H' + AVisitStr);
|
---|
| 2456 | Changes.Remove(CH_PCE, 'E' + AVisitStr);
|
---|
| 2457 | Changes.Remove(CH_PCE, 'T' + AVisitStr);
|
---|
| 2458 | end;
|
---|
| 2459 |
|
---|
| 2460 | procedure TfrmNotes.mnuActDeleteClick(Sender: TObject);
|
---|
| 2461 | { delete the selected progress note & remove from the Encounter object if necessary }
|
---|
| 2462 | var
|
---|
| 2463 | DeleteSts, ActionSts: TActionRec;
|
---|
| 2464 | SaveConsult, SavedDocIEN: Integer;
|
---|
| 2465 | ReasonForDelete, AVisitStr, SavedDocID, x: string;
|
---|
| 2466 | Saved: boolean;
|
---|
| 2467 | begin
|
---|
| 2468 | SetupVars; //kt added 7/19/2007 to replace constants with vars.
|
---|
| 2469 | inherited;
|
---|
| 2470 | if lstNotes.ItemIEN = 0 then Exit;
|
---|
| 2471 | ActOnDocument(ActionSts, lstNotes.ItemIEN, 'DELETE RECORD');
|
---|
| 2472 | if ShowMsgOn(not ActionSts.Success, ActionSts.Reason, TX_IN_AUTH) then Exit;
|
---|
| 2473 | ReasonForDelete := SelectDeleteReason(lstNotes.ItemIEN);
|
---|
| 2474 | if ReasonForDelete = DR_CANCEL then Exit;
|
---|
| 2475 | // suppress prompt for deletion when called from SaveEditedNote (Sender = Self)
|
---|
| 2476 | if (Sender <> Self) and (InfoBox(MakeNoteDisplayText(lstNotes.Items[lstNotes.ItemIndex]) + TX_DEL_OK,
|
---|
| 2477 | TX_DEL_CNF, MB_YESNO or MB_DEFBUTTON2 or MB_ICONQUESTION) <> IDYES) then Exit;
|
---|
| 2478 | // do the appropriate locking
|
---|
| 2479 | if not LockConsultRequestAndNote(lstNotes.ItemIEN) then Exit;
|
---|
| 2480 | // retraction notification message
|
---|
| 2481 | if JustifyDocumentDelete(lstNotes.ItemIEN) then
|
---|
| 2482 | InfoBox(TX_RETRACT, TX_RETRACT_CAP, MB_OK);
|
---|
| 2483 | SavedDocID := lstNotes.ItemID;
|
---|
| 2484 | SavedDocIEN := lstNotes.ItemIEN;
|
---|
| 2485 | if (EditingIndex > -1) and (not FConfirmed) and (lstNotes.ItemIndex <> EditingIndex) and (memNewNote.GetTextLen > 0) then
|
---|
| 2486 | begin
|
---|
| 2487 | SaveCurrentNote(Saved);
|
---|
| 2488 | if not Saved then Exit;
|
---|
| 2489 | end;
|
---|
| 2490 | EditingIndex := -1;
|
---|
| 2491 | FConfirmed := False;
|
---|
| 2492 | (* if Saved then
|
---|
| 2493 | begin
|
---|
| 2494 | EditingIndex := -1;
|
---|
| 2495 | mnuViewClick(Self);
|
---|
| 2496 | with tvNotes do Selected := FindPieceNode(SavedDocID, U, Items.GetFirstNode);
|
---|
| 2497 | end;*)
|
---|
| 2498 | // remove the note
|
---|
| 2499 | DeleteSts.Success := True;
|
---|
| 2500 | x := GetPackageRefForNote(SavedDocIEN);
|
---|
| 2501 | SaveConsult := StrToIntDef(Piece(x, ';', 1), 0);
|
---|
| 2502 | AVisitStr := VisitStrForNote(SavedDocIEN);
|
---|
| 2503 | RemovePCEFromChanges(SavedDocIEN, AVisitStr);
|
---|
| 2504 | if (SavedDocIEN > 0) and (lstNotes.ItemIEN = SavedDocIEN) then DeleteDocument(DeleteSts, SavedDocIEN, ReasonForDelete);
|
---|
| 2505 | if not Changes.Exist(CH_DOC, SavedDocID) then UnlockDocument(SavedDocIEN);
|
---|
| 2506 | Changes.Remove(CH_DOC, SavedDocID); // this will unlock the document if in Changes
|
---|
| 2507 | UnlockConsultRequest(0, SaveConsult); // note has been deleted, so 1st param = 0
|
---|
| 2508 | // reset the display now that the note is gone
|
---|
| 2509 | if DeleteSts.Success then
|
---|
| 2510 | begin
|
---|
| 2511 | DeletePCE(AVisitStr); // removes PCE data if this was the only note pointing to it
|
---|
| 2512 | ClearEditControls;
|
---|
| 2513 | //ClearPtData; WRONG - fixed in v15.10 - RV
|
---|
| 2514 | LoadNotes;
|
---|
| 2515 | (* with tvNotes do Selected := FindPieceNode(SavedDocID, U, Items.GetFirstNode);
|
---|
| 2516 | if tvNotes.Selected <> nil then tvNotesChange(Self, tvNotes.Selected) else
|
---|
| 2517 | begin*)
|
---|
[541] | 2518 | FHTMLEditMode := emNone; //kt 8/09
|
---|
[453] | 2519 | pnlWrite.Visible := False;
|
---|
| 2520 | pnlRead.Visible := True;
|
---|
| 2521 | UpdateReminderFinish;
|
---|
| 2522 | ShowPCEControls(False);
|
---|
| 2523 | frmDrawers.DisplayDrawers(TRUE, [odTemplates], [odTemplates]); //FALSE);
|
---|
| 2524 | ShowPCEButtons(FALSE);
|
---|
| 2525 | //end; {if ItemIndex}
|
---|
| 2526 | end {if DeleteSts}
|
---|
| 2527 | else InfoBox(DeleteSts.Reason, TX_DEL_ERR, MB_OK or MB_ICONWARNING);
|
---|
| 2528 | end;
|
---|
| 2529 |
|
---|
| 2530 | procedure TfrmNotes.mnuActEditClick(Sender: TObject);
|
---|
| 2531 | { load the selected progress note for editing }
|
---|
| 2532 | var
|
---|
| 2533 | ActionSts: TActionRec;
|
---|
| 2534 | ANoteID: string;
|
---|
| 2535 | begin
|
---|
| 2536 | inherited;
|
---|
| 2537 | if lstNotes.ItemIndex = EditingIndex then Exit;
|
---|
| 2538 | ANoteID := lstNotes.ItemID;
|
---|
| 2539 | if not StartNewEdit(NT_ACT_EDIT_NOTE) then Exit;
|
---|
| 2540 | //LoadNotes;
|
---|
| 2541 | with tvNotes do Selected := FindPieceNode(ANoteID, 1, U, Items.GetFirstNode);
|
---|
| 2542 | ActOnDocument(ActionSts, lstNotes.ItemIEN, 'EDIT RECORD');
|
---|
| 2543 | if not ActionSts.Success then
|
---|
| 2544 | begin
|
---|
| 2545 | InfoBox(ActionSts.Reason, TX_IN_AUTH, MB_OK);
|
---|
| 2546 | Exit;
|
---|
| 2547 | end;
|
---|
| 2548 | LoadForEdit;
|
---|
| 2549 | end;
|
---|
| 2550 |
|
---|
| 2551 | procedure TfrmNotes.mnuActSaveClick(Sender: TObject);
|
---|
| 2552 | { saves the note that is currently being edited }
|
---|
| 2553 | var
|
---|
| 2554 | Saved: Boolean;
|
---|
| 2555 | SavedDocID: string;
|
---|
| 2556 | begin
|
---|
| 2557 | SetupVars; //kt added 7/19/2007 to replace constants with vars.
|
---|
| 2558 | inherited;
|
---|
| 2559 | if EditingIndex > -1 then
|
---|
| 2560 | begin
|
---|
| 2561 | SavedDocID := Piece(lstNotes.Items[EditingIndex], U, 1);
|
---|
| 2562 | FLastNoteID := SavedDocID;
|
---|
| 2563 | SaveCurrentNote(Saved);
|
---|
| 2564 | if Saved and (EditingIndex < 0) and (not FDeleted) then
|
---|
| 2565 | //if Saved then
|
---|
| 2566 | begin
|
---|
| 2567 | LoadNotes;
|
---|
| 2568 | with tvNotes do Selected := FindPieceNode(SavedDocID, U, Items.GetFirstNode);
|
---|
| 2569 | end;
|
---|
| 2570 | end
|
---|
| 2571 | else InfoBox(TX_NO_NOTE, TX_SAVE_NOTE, MB_OK or MB_ICONWARNING);
|
---|
| 2572 | end;
|
---|
| 2573 |
|
---|
| 2574 | procedure TfrmNotes.mnuActSignClick(Sender: TObject);
|
---|
| 2575 | { sign the currently selected note, save first if necessary }
|
---|
| 2576 | const
|
---|
| 2577 | SIG_COSIGN = 'COSIGNATURE';
|
---|
| 2578 | SIG_SIGN = 'SIGNATURE';
|
---|
| 2579 | var
|
---|
| 2580 | Saved, NoteUnlocked: Boolean;
|
---|
| 2581 | ActionType, ESCode, SignTitle: string;
|
---|
| 2582 | ActionSts, SignSts: TActionRec;
|
---|
| 2583 | OK: boolean;
|
---|
| 2584 | SavedDocID, tmpItem: string;
|
---|
| 2585 | EditingID: string; //v22.12 - RV
|
---|
| 2586 | tmpNode: TTreeNode;
|
---|
| 2587 | begin
|
---|
| 2588 | SetupVars; //kt added 7/19/2007 to replace constants with vars.
|
---|
| 2589 | inherited;
|
---|
| 2590 | (* if lstNotes.ItemIndex = EditingIndex then //v22.12 - RV
|
---|
| 2591 | begin //v22.12 - RV
|
---|
| 2592 | SaveCurrentNote(Saved); //v22.12 - RV
|
---|
| 2593 | if (not Saved) or FDeleted then Exit; //v22.12 - RV
|
---|
| 2594 | end //v22.12 - RV
|
---|
| 2595 | else if EditingIndex > -1 then //v22.12 - RV
|
---|
| 2596 | tmpItem := lstNotes.Items[EditingIndex]; //v22.12 - RV
|
---|
| 2597 | SavedDocID := lstNotes.ItemID;*) //v22.12 - RV
|
---|
| 2598 | SavedDocID := lstNotes.ItemID; //v22.12 - RV
|
---|
| 2599 | FLastNoteID := SavedDocID; //v22.12 - RV
|
---|
| 2600 | if lstNotes.ItemIndex = EditingIndex then //v22.12 - RV
|
---|
| 2601 | begin //v22.12 - RV
|
---|
| 2602 | SaveCurrentNote(Saved); //v22.12 - RV
|
---|
| 2603 | if (not Saved) or FDeleted then Exit; //v22.12 - RV
|
---|
| 2604 | end //v22.12 - RV
|
---|
| 2605 | else if EditingIndex > -1 then //v22.12 - RV
|
---|
| 2606 | begin //v22.12 - RV
|
---|
| 2607 | tmpItem := lstNotes.Items[EditingIndex]; //v22.12 - RV
|
---|
| 2608 | EditingID := Piece(tmpItem, U, 1); //v22.12 - RV
|
---|
| 2609 | end; //v22.12 - RV
|
---|
| 2610 | if not NoteHasText(lstNotes.ItemIEN) then
|
---|
| 2611 | begin
|
---|
| 2612 | InfoBox(TX_EMPTY_NOTE1, TC_EMPTY_NOTE, MB_OK or MB_ICONERROR);
|
---|
| 2613 | Exit;
|
---|
| 2614 | end;
|
---|
| 2615 | if not LastSaveClean(lstNotes.ItemIEN) and
|
---|
| 2616 | (InfoBox(TX_ABSAVE, TC_ABSAVE, MB_YESNO or MB_DEFBUTTON2 or MB_ICONWARNING) <> IDYES) then Exit;
|
---|
| 2617 | if CosignDocument(lstNotes.ItemIEN) then
|
---|
| 2618 | begin
|
---|
| 2619 | SignTitle := TX_COSIGN;
|
---|
| 2620 | ActionType := SIG_COSIGN;
|
---|
| 2621 | end else
|
---|
| 2622 | begin
|
---|
| 2623 | SignTitle := TX_SIGN;
|
---|
| 2624 | ActionType := SIG_SIGN;
|
---|
| 2625 | end;
|
---|
| 2626 | if not LockConsultRequestAndNote(lstNotes.ItemIEN) then Exit;
|
---|
| 2627 | // no exits after things are locked
|
---|
| 2628 | NoteUnlocked := False;
|
---|
| 2629 | ActOnDocument(ActionSts, lstNotes.ItemIEN, ActionType);
|
---|
| 2630 | if ActionSts.Success then
|
---|
| 2631 | begin
|
---|
| 2632 | OK := IsOK2Sign(uPCEShow, lstNotes.ItemIEN);
|
---|
| 2633 | if frmFrame.Closing then exit;
|
---|
| 2634 | if(uPCEShow.Updated) then
|
---|
| 2635 | begin
|
---|
| 2636 | uPCEShow.CopyPCEData(uPCEEdit);
|
---|
| 2637 | uPCEShow.Updated := FALSE;
|
---|
| 2638 | lstNotesClick(Self);
|
---|
| 2639 | end;
|
---|
| 2640 | if not AuthorSignedDocument(lstNotes.ItemIEN) then
|
---|
| 2641 | begin
|
---|
| 2642 | if (InfoBox(TX_AUTH_SIGNED +
|
---|
| 2643 | GetTitleText(lstNotes.ItemIndex),TX_SIGN ,MB_YESNO)= ID_NO) then exit;
|
---|
| 2644 | end;
|
---|
| 2645 | if(OK) then
|
---|
| 2646 | begin
|
---|
| 2647 | with lstNotes do SignatureForItem(Font.Size, MakeNoteDisplayText(Items[ItemIndex]), SignTitle, ESCode);
|
---|
| 2648 | if Length(ESCode) > 0 then
|
---|
| 2649 | begin
|
---|
| 2650 | SignDocument(SignSts, lstNotes.ItemIEN, ESCode);
|
---|
| 2651 | RemovePCEFromChanges(lstNotes.ItemIEN);
|
---|
| 2652 | NoteUnlocked := Changes.Exist(CH_DOC, lstNotes.ItemID);
|
---|
| 2653 | Changes.Remove(CH_DOC, lstNotes.ItemID); // this will unlock if in Changes
|
---|
| 2654 | if SignSts.Success then
|
---|
| 2655 | begin
|
---|
| 2656 | SendMessage(frmConsults.Handle, UM_NEWORDER, ORDER_SIGN, 0); {*REV*}
|
---|
| 2657 | lstNotesClick(Self);
|
---|
| 2658 | end
|
---|
| 2659 | else InfoBox(SignSts.Reason, TX_SIGN_ERR, MB_OK);
|
---|
| 2660 | end {if Length(ESCode)}
|
---|
| 2661 | else
|
---|
| 2662 | NoteUnlocked := Changes.Exist(CH_DOC, lstNotes.ItemID);
|
---|
| 2663 | end;
|
---|
| 2664 | end
|
---|
| 2665 | else InfoBox(ActionSts.Reason, TX_IN_AUTH, MB_OK);
|
---|
| 2666 | if not NoteUnlocked then UnlockDocument(lstNotes.ItemIEN);
|
---|
| 2667 | UnlockConsultRequest(lstNotes.ItemIEN);
|
---|
| 2668 | //SetViewContext(FCurrentContext); //v22.12 - RV
|
---|
| 2669 | LoadNotes; //v22.12 - RV
|
---|
| 2670 | //if EditingIndex > -1 then //v22.12 - RV
|
---|
| 2671 | if (EditingID <> '') then //v22.12 - RV
|
---|
| 2672 | begin
|
---|
| 2673 | lstNotes.Items.Insert(0, tmpItem);
|
---|
| 2674 | // tmpNode := tvNotes.Items.AddObjectFirst(tvNotes.Items.GetFirstNode, 'Note being edited', <-- original line. //kt 7/19/2007
|
---|
| 2675 | tmpNode := tvNotes.Items.AddObjectFirst(tvNotes.Items.GetFirstNode, DKLangConstW('fNotes_Note_being_edited'), //kt added 7/19/2007
|
---|
| 2676 | MakeNoteTreeObject('EDIT^Note being edited^^^^^^^^^^^%^0'));
|
---|
| 2677 | TORTreeNode(tmpNode).StringData := 'EDIT^Note being edited^^^^^^^^^^^%^0';
|
---|
| 2678 | tmpNode.ImageIndex := IMG_TOP_LEVEL;
|
---|
| 2679 | tmpNode := tvNotes.Items.AddChildObjectFirst(tmpNode, MakeNoteDisplayText(tmpItem), MakeNoteTreeObject(tmpItem));
|
---|
| 2680 | TORTreeNode(tmpNode).StringData := tmpItem;
|
---|
| 2681 | SetTreeNodeImagesAndFormatting(TORTreeNode(tmpNode), FCurrentContext, CT_NOTES);
|
---|
| 2682 | EditingIndex := lstNotes.SelectByID(EditingID); //v22.12 - RV
|
---|
| 2683 | end;
|
---|
| 2684 | //with tvNotes do Selected := FindPieceNode(SavedDocID, U, Items.GetFirstNode); //v22.12 - RV
|
---|
| 2685 | with tvNotes do //v22.12 - RV
|
---|
| 2686 | begin //v22.12 - RV
|
---|
| 2687 | Selected := FindPieceNode(FLastNoteID, U, Items.GetFirstNode); //v22.12 - RV
|
---|
| 2688 | if Selected <> nil then
|
---|
| 2689 | tvNotesChange(Self, Selected) //v22.12 - RV
|
---|
| 2690 | else
|
---|
| 2691 | tvNotes.Selected := tvNotes.Items[0]; //first Node in treeview
|
---|
| 2692 | end; //v22.12 - RV
|
---|
| 2693 | end;
|
---|
| 2694 |
|
---|
| 2695 | procedure TfrmNotes.SaveSignItem(const ItemID, ESCode: string);
|
---|
| 2696 | { saves and optionally signs a progress note or addendum }
|
---|
| 2697 | const
|
---|
| 2698 | SIG_COSIGN = 'COSIGNATURE';
|
---|
| 2699 | SIG_SIGN = 'SIGNATURE';
|
---|
| 2700 | var
|
---|
| 2701 | AnIndex, IEN, i: Integer;
|
---|
| 2702 | Saved, ContinueSign: Boolean; {*RAB* 8/26/99}
|
---|
| 2703 | ActionSts, SignSts: TActionRec;
|
---|
| 2704 | APCEObject: TPCEData;
|
---|
| 2705 | OK: boolean;
|
---|
| 2706 | ActionType, SignTitle: string;
|
---|
| 2707 | begin
|
---|
| 2708 | SetupVars; //kt added 7/19/2007 to replace constants with vars.
|
---|
| 2709 | AnIndex := -1;
|
---|
| 2710 | IEN := StrToIntDef(ItemID, 0);
|
---|
| 2711 | if IEN = 0 then Exit;
|
---|
| 2712 | if frmFrame.TimedOut and (EditingIndex <> -1) then FSilent := True;
|
---|
| 2713 | with lstNotes do for i := 0 to Items.Count - 1 do if lstNotes.GetIEN(i) = IEN then
|
---|
| 2714 | begin
|
---|
| 2715 | AnIndex := i;
|
---|
| 2716 | break;
|
---|
| 2717 | end;
|
---|
| 2718 | if (AnIndex > -1) and (AnIndex = EditingIndex) then
|
---|
| 2719 | begin
|
---|
| 2720 | SaveCurrentNote(Saved);
|
---|
| 2721 | if not Saved then Exit;
|
---|
| 2722 | if FDeleted then
|
---|
| 2723 | begin
|
---|
| 2724 | FDeleted := False;
|
---|
| 2725 | Exit;
|
---|
| 2726 | end;
|
---|
| 2727 | AnIndex := lstNotes.SelectByIEN(IEN);
|
---|
| 2728 | //IEN := lstNotes.GetIEN(AnIndex); // saving will change IEN
|
---|
| 2729 | end;
|
---|
| 2730 | if Length(ESCode) > 0 then
|
---|
| 2731 | begin
|
---|
| 2732 | if CosignDocument(IEN) then
|
---|
| 2733 | begin
|
---|
| 2734 | SignTitle := TX_COSIGN;
|
---|
| 2735 | ActionType := SIG_COSIGN;
|
---|
| 2736 | end else
|
---|
| 2737 | begin
|
---|
| 2738 | SignTitle := TX_SIGN;
|
---|
| 2739 | ActionType := SIG_SIGN;
|
---|
| 2740 | end;
|
---|
| 2741 | ActOnDocument(ActionSts, IEN, ActionType);
|
---|
| 2742 | if not ActionSts.Success then
|
---|
| 2743 | begin
|
---|
| 2744 | InfoBox(ActionSts.Reason, TX_IN_AUTH, MB_OK);
|
---|
| 2745 | ContinueSign := False;
|
---|
| 2746 | end
|
---|
| 2747 | else if not NoteHasText(IEN) then
|
---|
| 2748 | begin
|
---|
| 2749 | InfoBox(TX_EMPTY_NOTE1, TC_EMPTY_NOTE, MB_OK or MB_ICONERROR);
|
---|
| 2750 | ContinueSign := False;
|
---|
| 2751 | end
|
---|
| 2752 | else if not LastSaveClean(IEN) and
|
---|
| 2753 | (InfoBox(TX_ABSAVE, TC_ABSAVE, MB_YESNO or MB_DEFBUTTON2 or MB_ICONWARNING) <> IDYES)
|
---|
| 2754 | then ContinueSign := False
|
---|
| 2755 | else ContinueSign := True;
|
---|
| 2756 | if ContinueSign then
|
---|
| 2757 | begin
|
---|
| 2758 | if (AnIndex >= 0) and (AnIndex = lstNotes.ItemIndex) then
|
---|
| 2759 | APCEObject := uPCEShow
|
---|
| 2760 | else
|
---|
| 2761 | APCEObject := nil;
|
---|
| 2762 | OK := IsOK2Sign(APCEObject, IEN);
|
---|
| 2763 | if frmFrame.Closing then exit;
|
---|
| 2764 | if(assigned(APCEObject)) and (uPCEShow.Updated) then
|
---|
| 2765 | begin
|
---|
| 2766 | uPCEShow.CopyPCEData(uPCEEdit);
|
---|
| 2767 | uPCEShow.Updated := FALSE;
|
---|
| 2768 | lstNotesClick(Self);
|
---|
| 2769 | end
|
---|
| 2770 | else
|
---|
| 2771 | uPCEEdit.Clear;
|
---|
| 2772 | if(OK) then
|
---|
| 2773 | begin
|
---|
| 2774 | //if ((not FSilent) and IsSurgeryTitle(TitleForNote(IEN))) then DisplayOpTop(IEN);
|
---|
| 2775 | SignDocument(SignSts, IEN, ESCode);
|
---|
| 2776 | if not SignSts.Success then InfoBox(SignSts.Reason, TX_SIGN_ERR, MB_OK);
|
---|
| 2777 | end; {if OK}
|
---|
| 2778 | end; {if ContinueSign}
|
---|
| 2779 | end; {if Length(ESCode)}
|
---|
| 2780 |
|
---|
| 2781 | UnlockConsultRequest(IEN);
|
---|
| 2782 | if (AnIndex = lstNotes.ItemIndex) and (not frmFrame.ContextChanging) then
|
---|
| 2783 | begin
|
---|
| 2784 | LoadNotes;
|
---|
| 2785 | with tvNotes do Selected := FindPieceNode(IntToStr(IEN), U, Items.GetFirstNode);
|
---|
| 2786 | end;
|
---|
| 2787 | end;
|
---|
| 2788 |
|
---|
| 2789 | procedure TfrmNotes.popNoteMemoPopup(Sender: TObject);
|
---|
[541] | 2790 | const FORMAT_MODE : array[false..true] of string = ('fNotes_Formatted_Text','fNotes_Plain_Text'); //kt 8/09
|
---|
[453] | 2791 | begin
|
---|
| 2792 | inherited;
|
---|
| 2793 | if PopupComponent(Sender, popNoteMemo) is TCustomEdit
|
---|
| 2794 | then FEditCtrl := TCustomEdit(PopupComponent(Sender, popNoteMemo))
|
---|
| 2795 | else FEditCtrl := nil;
|
---|
| 2796 | if FEditCtrl <> nil then
|
---|
| 2797 | begin
|
---|
| 2798 | popNoteMemoCut.Enabled := FEditCtrl.SelLength > 0;
|
---|
| 2799 | popNoteMemoCopy.Enabled := popNoteMemoCut.Enabled;
|
---|
| 2800 | popNoteMemoPaste.Enabled := (not TORExposedCustomEdit(FEditCtrl).ReadOnly) and
|
---|
| 2801 | Clipboard.HasFormat(CF_TEXT);
|
---|
| 2802 | popNoteMemoTemplate.Enabled := frmDrawers.CanEditTemplates and popNoteMemoCut.Enabled;
|
---|
| 2803 | popNoteMemoFind.Enabled := FEditCtrl.GetTextLen > 0;
|
---|
| 2804 | end else
|
---|
| 2805 | begin
|
---|
[541] | 2806 | popNoteMemoHTMLFormat.Enabled := False; //kt 8/09
|
---|
[453] | 2807 | popNoteMemoCut.Enabled := False;
|
---|
| 2808 | popNoteMemoCopy.Enabled := False;
|
---|
| 2809 | popNoteMemoPaste.Enabled := False;
|
---|
| 2810 | popNoteMemoTemplate.Enabled := False;
|
---|
| 2811 | end;
|
---|
[541] | 2812 | popNoteMemoHTMLFormat.Caption := DKLangConstW('fNotes_Change_Edit_Mode_To') + ' ' + //kt 8/09
|
---|
| 2813 | DKLangConstW(FORMAT_MODE[(vmHTML in FViewMode)]); //kt 8/09
|
---|
| 2814 | popNoteMemoHTMLFormat.Enabled := pnlWrite.Visible; //kt 8/09
|
---|
[453] | 2815 | if pnlWrite.Visible then
|
---|
| 2816 | begin
|
---|
[541] | 2817 | //kt 8/09 popNoteMemoSpell.Enabled := True;
|
---|
| 2818 | //kt 8/09 popNoteMemoGrammar.Enabled := True;
|
---|
| 2819 | //kt 8/09 popNoteMemoReformat.Enabled := True;
|
---|
| 2820 | popNoteMemoSpell.Enabled := not pnlHTMLWrite.Visible; //kt 8/09
|
---|
| 2821 | popNoteMemoGrammar.Enabled := not pnlHTMLWrite.Visible; //kt 8/09
|
---|
| 2822 | popNoteMemoReformat.Enabled := not pnlHTMLWrite.Visible; //kt 8/09
|
---|
[453] | 2823 | popNoteMemoReplace.Enabled := (FEditCtrl.GetTextLen > 0);
|
---|
| 2824 | popNoteMemoPreview.Enabled := (frmDrawers.TheOpenDrawer = odTemplates) and Assigned(frmDrawers.tvTemplates.Selected);
|
---|
| 2825 | popNoteMemoInsTemplate.Enabled := (frmDrawers.TheOpenDrawer = odTemplates) and Assigned(frmDrawers.tvTemplates.Selected);
|
---|
| 2826 | end else
|
---|
| 2827 | begin
|
---|
| 2828 | popNoteMemoSpell.Enabled := False;
|
---|
| 2829 | popNoteMemoGrammar.Enabled := False;
|
---|
| 2830 | popNoteMemoReformat.Enabled := False;
|
---|
| 2831 | popNoteMemoReplace.Enabled := False;
|
---|
| 2832 | popNoteMemoPreview.Enabled := False;
|
---|
| 2833 | popNoteMemoInsTemplate.Enabled := False;
|
---|
| 2834 | end;
|
---|
| 2835 | end;
|
---|
| 2836 |
|
---|
[541] | 2837 | (*//kt 8/09 NOTICE:
|
---|
| 2838 | On the form, popNoteMenu was edited to add a new item as below
|
---|
| 2839 | popNoteMemoHTMLFormat : TMenuItem
|
---|
| 2840 | Captions: ~ Edit as Formatted Text
|
---|
| 2841 | OnClick -- popNoteMemoHTMLFormatClick
|
---|
| 2842 | *)
|
---|
| 2843 |
|
---|
| 2844 | procedure TfrmNotes.popNoteMemoHTMLFormatClick(Sender: TObject);
|
---|
| 2845 | //kt added function 8/09
|
---|
| 2846 | begin
|
---|
| 2847 | inherited;
|
---|
| 2848 | ToggleHTMLEditMode;
|
---|
| 2849 | end;
|
---|
| 2850 |
|
---|
[453] | 2851 | procedure TfrmNotes.popNoteMemoCutClick(Sender: TObject);
|
---|
| 2852 | begin
|
---|
| 2853 | inherited;
|
---|
| 2854 | FEditCtrl.CutToClipboard;
|
---|
| 2855 | end;
|
---|
| 2856 |
|
---|
| 2857 | procedure TfrmNotes.popNoteMemoCopyClick(Sender: TObject);
|
---|
| 2858 | begin
|
---|
| 2859 | inherited;
|
---|
| 2860 | FEditCtrl.CopyToClipboard;
|
---|
| 2861 | end;
|
---|
| 2862 |
|
---|
| 2863 | procedure TfrmNotes.popNoteMemoPasteClick(Sender: TObject);
|
---|
| 2864 | begin
|
---|
| 2865 | inherited;
|
---|
| 2866 | FEditCtrl.SelText := Clipboard.AsText; {*KCM*}
|
---|
| 2867 | frmNotes.pnlWriteResize(Self);
|
---|
| 2868 | //FEditCtrl.PasteFromClipboard; // use AsText to prevent formatting
|
---|
| 2869 | end;
|
---|
| 2870 |
|
---|
| 2871 | procedure TfrmNotes.popNoteMemoReformatClick(Sender: TObject);
|
---|
| 2872 | begin
|
---|
| 2873 | inherited;
|
---|
| 2874 | if Screen.ActiveControl <> memNewNote then Exit;
|
---|
| 2875 | ReformatMemoParagraph(memNewNote);
|
---|
| 2876 | end;
|
---|
| 2877 |
|
---|
| 2878 | procedure TfrmNotes.popNoteMemoSaveContinueClick(Sender: TObject);
|
---|
| 2879 | begin
|
---|
| 2880 | inherited;
|
---|
| 2881 | FChanged := True;
|
---|
| 2882 | DoAutoSave;
|
---|
| 2883 | end;
|
---|
| 2884 |
|
---|
| 2885 | procedure TfrmNotes.popNoteMemoFindClick(Sender: TObject);
|
---|
| 2886 | //var
|
---|
| 2887 | //hData: THandle; //CQ8300
|
---|
| 2888 | //pData: ^ClipboardData; //CQ8300
|
---|
| 2889 | begin
|
---|
| 2890 | inherited;
|
---|
| 2891 | SendMessage(TRichEdit(popNoteMemo.PopupComponent).Handle, WM_VSCROLL, SB_TOP, 0);
|
---|
| 2892 | with dlgFindText do
|
---|
| 2893 | begin
|
---|
| 2894 | Position := Point(Application.MainForm.Left + pnlLeft.Width, Application.MainForm.Top);
|
---|
| 2895 | FindText := '';
|
---|
| 2896 | Options := [frDown, frHideUpDown];
|
---|
| 2897 | {
|
---|
| 2898 | //CQ8300
|
---|
| 2899 | OpenClipboard(dlgFindText.Handle);
|
---|
| 2900 | hData := GetClipboardData(CF_TEXT);
|
---|
| 2901 | pData := GlobalLock(hData);
|
---|
| 2902 | FindText := pData^.Text;
|
---|
| 2903 | GlobalUnlock(hData);
|
---|
| 2904 | CloseClipboard;
|
---|
| 2905 | //end CQ8300
|
---|
| 2906 | }
|
---|
| 2907 | Execute;
|
---|
| 2908 | end;
|
---|
| 2909 | end;
|
---|
| 2910 |
|
---|
| 2911 | procedure TfrmNotes.dlgFindTextFind(Sender: TObject);
|
---|
| 2912 | begin
|
---|
| 2913 | dmodShared.FindRichEditText(dlgFindText, TRichEdit(popNoteMemo.PopupComponent));
|
---|
| 2914 | end;
|
---|
| 2915 |
|
---|
| 2916 | procedure TfrmNotes.popNoteMemoReplaceClick(Sender: TObject);
|
---|
| 2917 | begin
|
---|
| 2918 | inherited;
|
---|
| 2919 | SendMessage(TRichEdit(popNoteMemo.PopupComponent).Handle, WM_VSCROLL, SB_TOP, 0);
|
---|
| 2920 | with dlgReplaceText do
|
---|
| 2921 | begin
|
---|
| 2922 | Position := Point(Application.MainForm.Left + pnlLeft.Width, Application.MainForm.Top);
|
---|
| 2923 | FindText := '';
|
---|
| 2924 | ReplaceText := '';
|
---|
| 2925 | Options := [frDown, frHideUpDown];
|
---|
| 2926 | Execute;
|
---|
| 2927 | end;
|
---|
| 2928 | end;
|
---|
| 2929 |
|
---|
| 2930 | procedure TfrmNotes.dlgReplaceTextFind(Sender: TObject);
|
---|
| 2931 | begin
|
---|
| 2932 | inherited;
|
---|
| 2933 | dmodShared.FindRichEditText(dlgFindText, TRichEdit(popNoteMemo.PopupComponent));
|
---|
| 2934 | end;
|
---|
| 2935 |
|
---|
| 2936 | procedure TfrmNotes.dlgReplaceTextReplace(Sender: TObject);
|
---|
| 2937 | begin
|
---|
| 2938 | inherited;
|
---|
| 2939 | dmodShared.ReplaceRichEditText(dlgReplaceText, TRichEdit(popNoteMemo.PopupComponent));
|
---|
| 2940 | end;
|
---|
| 2941 |
|
---|
| 2942 | procedure TfrmNotes.popNoteMemoSpellClick(Sender: TObject);
|
---|
| 2943 | begin
|
---|
| 2944 | inherited;
|
---|
| 2945 | DoAutoSave(0);
|
---|
| 2946 | timAutoSave.Enabled := False;
|
---|
| 2947 | try
|
---|
| 2948 | SpellCheckForControl(memNewNote);
|
---|
| 2949 | finally
|
---|
| 2950 | FChanged := True;
|
---|
| 2951 | DoAutoSave(0);
|
---|
| 2952 | timAutoSave.Enabled := True;
|
---|
| 2953 | end;
|
---|
| 2954 | end;
|
---|
| 2955 |
|
---|
| 2956 | procedure TfrmNotes.popNoteMemoGrammarClick(Sender: TObject);
|
---|
| 2957 | begin
|
---|
| 2958 | inherited;
|
---|
| 2959 | DoAutoSave(0);
|
---|
| 2960 | timAutoSave.Enabled := False;
|
---|
| 2961 | try
|
---|
| 2962 | GrammarCheckForControl(memNewNote);
|
---|
| 2963 | finally
|
---|
| 2964 | FChanged := True;
|
---|
| 2965 | DoAutoSave(0);
|
---|
| 2966 | timAutoSave.Enabled := True;
|
---|
| 2967 | end;
|
---|
| 2968 | end;
|
---|
| 2969 |
|
---|
| 2970 | procedure TfrmNotes.mnuViewDetailClick(Sender: TObject);
|
---|
| 2971 | begin
|
---|
| 2972 | inherited;
|
---|
| 2973 | if lstNotes.ItemIEN <= 0 then Exit;
|
---|
| 2974 | mnuViewDetail.Checked := not mnuViewDetail.Checked;
|
---|
| 2975 | if mnuViewDetail.Checked then
|
---|
| 2976 | begin
|
---|
| 2977 | // StatusText('Retrieving progress note details...'); <-- original line. //kt 7/19/2007
|
---|
| 2978 | StatusText(DKLangConstW('fNotes_Retrieving_progress_note_detailsxxx')); //kt added 7/19/2007
|
---|
| 2979 | Screen.Cursor := crAppStart; //kt, was crHourGlass;
|
---|
[541] | 2980 | //kt LoadDetailText(memNote.Lines, lstNotes.ItemIEN);
|
---|
| 2981 | LoadDetailText(FViewNote, lstNotes.ItemIEN); //kt 8/09
|
---|
| 2982 | SetDisplayToHTMLvsText(FViewMode,FViewNote); //kt 8/09
|
---|
[453] | 2983 | Screen.Cursor := crDefault;
|
---|
| 2984 | StatusText('');
|
---|
| 2985 | memNote.SelStart := 0;
|
---|
[541] | 2986 | if not (vmHTML in FViewMode) then //kt 8/09
|
---|
| 2987 | memNote.Repaint;
|
---|
[453] | 2988 | end
|
---|
| 2989 | else
|
---|
| 2990 | lstNotesClick(Self);
|
---|
[541] | 2991 | if (vmHTML in FViewMode) then begin //kt 8/09
|
---|
| 2992 | SendMessage(HTMLViewer.Handle, WM_VSCROLL, SB_TOP, 0); //kt 8/09
|
---|
| 2993 | end else begin //kt 8/09
|
---|
| 2994 | SendMessage(memNote.Handle, WM_VSCROLL, SB_TOP, 0);
|
---|
| 2995 | end; //kt 8/09
|
---|
[453] | 2996 | end;
|
---|
| 2997 |
|
---|
| 2998 | procedure TfrmNotes.FormClose(Sender: TObject; var Action: TCloseAction);
|
---|
| 2999 | var
|
---|
| 3000 | Saved: Boolean;
|
---|
| 3001 | IEN: Int64;
|
---|
| 3002 | ErrMsg: string;
|
---|
| 3003 | DeleteSts: TActionRec;
|
---|
| 3004 | begin
|
---|
| 3005 | inherited;
|
---|
| 3006 | if frmFrame.TimedOut and (EditingIndex <> -1) then
|
---|
| 3007 | begin
|
---|
| 3008 | FSilent := True;
|
---|
[541] | 3009 | //kt 8/09 if memNewNote.GetTextLen > 0 then SaveCurrentNote(Saved)
|
---|
| 3010 | if EditorHasText then SaveCurrentNote(Saved) //kt 8/09
|
---|
[453] | 3011 | else
|
---|
| 3012 | begin
|
---|
| 3013 | IEN := lstNotes.GetIEN(EditingIndex);
|
---|
| 3014 | if not LastSaveClean(IEN) then // means note hasn't been committed yet
|
---|
| 3015 | begin
|
---|
| 3016 | LockDocument(IEN, ErrMsg);
|
---|
| 3017 | if ErrMsg = '' then
|
---|
| 3018 | begin
|
---|
| 3019 | DeleteDocument(DeleteSts, IEN, '');
|
---|
| 3020 | UnlockDocument(IEN);
|
---|
| 3021 | end; {if ErrMsg}
|
---|
| 3022 | end; {if not LastSaveClean}
|
---|
| 3023 | end; {else}
|
---|
| 3024 | end; {if frmFrame}
|
---|
| 3025 | end;
|
---|
| 3026 |
|
---|
| 3027 | procedure TfrmNotes.mnuActIdentifyAddlSignersClick(Sender: TObject);
|
---|
| 3028 | var
|
---|
| 3029 | Exclusions: TStrings;
|
---|
| 3030 | Saved, x, y: boolean;
|
---|
| 3031 | SignerList: TSignerList;
|
---|
| 3032 | ActionSts: TActionRec;
|
---|
| 3033 | SigAction: integer;
|
---|
| 3034 | SavedDocID: string;
|
---|
| 3035 | ARefDate: TFMDateTime;
|
---|
| 3036 | begin
|
---|
| 3037 | inherited;
|
---|
| 3038 | if lstNotes.ItemIEN = 0 then exit;
|
---|
| 3039 | SavedDocID := lstNotes.ItemID;
|
---|
| 3040 | if lstNotes.ItemIndex = EditingIndex then
|
---|
| 3041 | begin
|
---|
| 3042 | SaveCurrentNote(Saved);
|
---|
| 3043 | if not Saved then Exit;
|
---|
| 3044 | LoadNotes;
|
---|
| 3045 | with tvNotes do Selected := FindPieceNode(SavedDocID, U, Items.GetFirstNode);
|
---|
| 3046 | end;
|
---|
| 3047 | x := CanChangeCosigner(lstNotes.ItemIEN);
|
---|
| 3048 | ActOnDocument(ActionSts, lstNotes.ItemIEN, 'IDENTIFY SIGNERS');
|
---|
| 3049 | y := ActionSts.Success;
|
---|
| 3050 | if x and not y then
|
---|
| 3051 | begin
|
---|
| 3052 | if InfoBox(ActionSts.Reason + CRLF + CRLF +
|
---|
| 3053 | // 'Would you like to change the cosigner?', <-- original line. //kt 7/19/2007
|
---|
| 3054 | DKLangConstW('fNotes_Would_you_like_to_change_the_cosignerx'), //kt added 7/19/2007
|
---|
| 3055 | TX_IN_AUTH, MB_YESNO or MB_DEFBUTTON2 or MB_ICONQUESTION) = ID_YES then
|
---|
| 3056 | SigAction := SG_COSIGNER
|
---|
| 3057 | else
|
---|
| 3058 | Exit;
|
---|
| 3059 | end
|
---|
| 3060 | else if y and not x then SigAction := SG_ADDITIONAL
|
---|
| 3061 | else if x and y then SigAction := SG_BOTH
|
---|
| 3062 | else
|
---|
| 3063 | begin
|
---|
| 3064 | InfoBox(ActionSts.Reason, TX_IN_AUTH, MB_OK);
|
---|
| 3065 | Exit;
|
---|
| 3066 | end;
|
---|
| 3067 |
|
---|
| 3068 | if not LockConsultRequestAndNote(lstNotes.ItemIEN) then Exit;
|
---|
| 3069 | Exclusions := GetCurrentSigners(lstNotes.ItemIEN);
|
---|
| 3070 | ARefDate := StrToFloat(Piece(lstNotes.Items[lstNotes.ItemIndex], U, 3));
|
---|
| 3071 | SelectAdditionalSigners(Font.Size, lstNotes.ItemIEN, SigAction, Exclusions, SignerList, CT_NOTES, ARefDate);
|
---|
| 3072 | with SignerList do
|
---|
| 3073 | begin
|
---|
| 3074 | case SigAction of
|
---|
| 3075 | SG_ADDITIONAL: if Changed and (Signers <> nil) and (Signers.Count > 0) then
|
---|
| 3076 | UpdateAdditionalSigners(lstNotes.ItemIEN, Signers);
|
---|
| 3077 | SG_COSIGNER: if Changed then ChangeCosigner(lstNotes.ItemIEN, Cosigner);
|
---|
| 3078 | SG_BOTH: if Changed then
|
---|
| 3079 | begin
|
---|
| 3080 | if (Signers <> nil) and (Signers.Count > 0) then
|
---|
| 3081 | UpdateAdditionalSigners(lstNotes.ItemIEN, Signers);
|
---|
| 3082 | ChangeCosigner(lstNotes.ItemIEN, Cosigner);
|
---|
| 3083 | end;
|
---|
| 3084 | end;
|
---|
| 3085 | lstNotesClick(Self);
|
---|
| 3086 | end;
|
---|
| 3087 | UnlockDocument(lstNotes.ItemIEN);
|
---|
| 3088 | UnlockConsultRequest(lstNotes.ItemIEN);
|
---|
| 3089 | end;
|
---|
| 3090 |
|
---|
| 3091 | procedure TfrmNotes.popNoteMemoAddlSignClick(Sender: TObject);
|
---|
| 3092 | begin
|
---|
| 3093 | inherited;
|
---|
| 3094 | mnuActIdentifyAddlSignersClick(Self);
|
---|
| 3095 | end;
|
---|
| 3096 |
|
---|
| 3097 | procedure TfrmNotes.ProcessNotifications;
|
---|
| 3098 | var
|
---|
| 3099 | x: string;
|
---|
| 3100 | Saved: boolean;
|
---|
| 3101 | tmpNode: TTreeNode;
|
---|
| 3102 | AnObject: PDocTreeObject;
|
---|
| 3103 | begin
|
---|
| 3104 | SetupVars; //kt added 7/19/2007 to replace constants with vars.
|
---|
| 3105 | if EditingIndex <> -1 then
|
---|
| 3106 | begin
|
---|
| 3107 | SaveCurrentNote(Saved);
|
---|
| 3108 | if not Saved then Exit;
|
---|
| 3109 | end;
|
---|
| 3110 | lblNotes.Caption := Notifications.Text;
|
---|
| 3111 | tvNotes.Caption := Notifications.Text;
|
---|
| 3112 | EditingIndex := -1;
|
---|
| 3113 | lstNotes.Enabled := True ;
|
---|
| 3114 | pnlRead.BringToFront ;
|
---|
| 3115 | // show ALL unsigned/uncosigned for a patient, not just the alerted one
|
---|
| 3116 | // what about cosignature? How to get correct list? ORB FOLLOWUP TYPE = OR alerts only
|
---|
| 3117 | x := Notifications.AlertData;
|
---|
| 3118 | if StrToIntDef(Piece(x, U, 1), 0) = 0 then
|
---|
| 3119 | begin
|
---|
| 3120 | InfoBox(TX_NO_ALERT, TX_CAP_NO_ALERT, MB_OK);
|
---|
| 3121 | Exit;
|
---|
| 3122 | end;
|
---|
| 3123 | uChanging := True;
|
---|
| 3124 | tvNotes.Items.BeginUpdate;
|
---|
| 3125 | lstNotes.Clear;
|
---|
| 3126 | KillDocTreeObjects(tvNotes);
|
---|
| 3127 | tvNotes.Items.Clear;
|
---|
| 3128 | lstNotes.Items.Add(x);
|
---|
| 3129 | AnObject := MakeNoteTreeObject('ALERT^Alerted Note^^^^^^^^^^^%^0');
|
---|
| 3130 | tmpNode := tvNotes.Items.AddObjectFirst(tvNotes.Items.GetFirstNode, AnObject.NodeText, AnObject);
|
---|
| 3131 | TORTreeNode(tmpNode).StringData := 'ALERT^Alerted Note^^^^^^^^^^^%^0';
|
---|
| 3132 | tmpNode.ImageIndex := IMG_TOP_LEVEL;
|
---|
| 3133 | AnObject := MakeNoteTreeObject(x);
|
---|
| 3134 | tmpNode := tvNotes.Items.AddChildObjectFirst(tmpNode, AnObject.NodeText, AnObject);
|
---|
| 3135 | TORTreeNode(tmpNode).StringData := x;
|
---|
| 3136 | SetTreeNodeImagesAndFormatting(TORTreeNode(tmpNode), FCurrentContext, CT_NOTES);
|
---|
| 3137 | tvNotes.Selected := tmpNode;
|
---|
| 3138 | tvNotes.Items.EndUpdate;
|
---|
| 3139 | uChanging := False;
|
---|
| 3140 | tvNotesChange(Self, tvNotes.Selected);
|
---|
| 3141 | case Notifications.Followup of
|
---|
| 3142 | NF_NOTES_UNSIGNED_NOTE: ; //Automatically deleted by sig action!!!
|
---|
| 3143 | end;
|
---|
| 3144 | if Copy(Piece(Notifications.RecordID, U, 2), 1, 6) = 'TIUADD' then Notifications.Delete;
|
---|
| 3145 | if Copy(Piece(Notifications.RecordID, U, 2), 1, 5) = 'TIUID' then Notifications.Delete;
|
---|
| 3146 | end;
|
---|
| 3147 |
|
---|
| 3148 | procedure TfrmNotes.SetViewContext(AContext: TTIUContext);
|
---|
| 3149 | var
|
---|
| 3150 | Saved: boolean;
|
---|
| 3151 | begin
|
---|
| 3152 | if EditingIndex <> -1 then
|
---|
| 3153 | begin
|
---|
| 3154 | SaveCurrentNote(Saved);
|
---|
| 3155 | if not Saved then Exit;
|
---|
| 3156 | end;
|
---|
| 3157 | FCurrentContext := AContext;
|
---|
| 3158 | EditingIndex := -1;
|
---|
| 3159 | tvNotes.Enabled := True ;
|
---|
| 3160 | pnlRead.BringToFront ;
|
---|
| 3161 | if FCurrentContext.Status <> '' then with uTIUContext do
|
---|
| 3162 | begin
|
---|
| 3163 | BeginDate := FCurrentContext.BeginDate;
|
---|
| 3164 | EndDate := FCurrentContext.EndDate;
|
---|
| 3165 | FMBeginDate := FCurrentContext.FMBeginDate;
|
---|
| 3166 | FMEndDate := FCurrentContext.FMEndDate;
|
---|
| 3167 | Status := FCurrentContext.Status;
|
---|
| 3168 | Author := FCurrentContext.Author;
|
---|
| 3169 | MaxDocs := FCurrentContext.MaxDocs;
|
---|
| 3170 | ShowSubject := FCurrentContext.ShowSubject;
|
---|
| 3171 | GroupBy := FCurrentContext.GroupBy;
|
---|
| 3172 | SortBy := FCurrentContext.SortBy;
|
---|
| 3173 | ListAscending := FCurrentContext.ListAscending;
|
---|
| 3174 | TreeAscending := FCurrentContext.TreeAscending;
|
---|
| 3175 | Keyword := FCurrentContext.Keyword;
|
---|
| 3176 | SearchField := FCurrentContext.SearchField;
|
---|
| 3177 | Filtered := FCurrentContext.Filtered;
|
---|
| 3178 | Changed := True;
|
---|
| 3179 | mnuViewClick(Self);
|
---|
| 3180 | end
|
---|
| 3181 | else
|
---|
| 3182 | begin
|
---|
| 3183 | ViewContext := NC_RECENT ;
|
---|
| 3184 | mnuViewClick(Self);
|
---|
| 3185 | end;
|
---|
| 3186 | end;
|
---|
| 3187 |
|
---|
| 3188 | procedure TfrmNotes.mnuViewSaveAsDefaultClick(Sender: TObject);
|
---|
| 3189 | //const
|
---|
| 3190 | //TX_NO_MAX = 'You have not specified a maximum number of notes to be returned.' + CRLF + <-- original line. //kt 7/19/2007
|
---|
| 3191 | // 'If you save this preference, the result will be that ALL notes for every' + CRLF + <-- original line. //kt 7/19/2007
|
---|
| 3192 | // 'patient will be saved as your default view.' + CRLF + CRLF + <-- original line. //kt 7/19/2007
|
---|
| 3193 | // 'For patients with large numbers of notes, this could result in some lengthy' + CRLF + <-- original line. //kt 7/19/2007
|
---|
| 3194 | // 'delays in loading the list of notes.' + CRLF + CRLF + <-- original line. //kt 7/19/2007
|
---|
| 3195 | // 'Are you sure you mean to do this?'; <-- original line. //kt 7/19/2007
|
---|
| 3196 | //TX_REPLACE = 'Replace current defaults?'; <-- original line. //kt 7/19/2007
|
---|
| 3197 | var
|
---|
| 3198 | TX_NO_MAX : string; //kt
|
---|
| 3199 | TX_REPLACE : string; //kt
|
---|
| 3200 |
|
---|
| 3201 | begin
|
---|
| 3202 | inherited;
|
---|
| 3203 | TX_NO_MAX := DKLangConstW('fNotes_You_have_not_specified_a_maximum_number_of_notes_to_be_returnedx') + CRLF + //kt added 7/19/2007
|
---|
| 3204 | DKLangConstW('fNotes_If_you_save_this_preferencex_the_result_will_be_that_ALL_notes_for_every') + CRLF + //kt added 7/19/2007
|
---|
| 3205 | DKLangConstW('fNotes_patient_will_be_saved_as_your_default_viewx') + CRLF + CRLF + //kt added 7/19/2007
|
---|
| 3206 | DKLangConstW('fNotes_For_patients_with_large_numbers_of_notesx_this_could_result_in_some_lengthy') + CRLF + //kt added 7/19/2007
|
---|
| 3207 | DKLangConstW('fNotes_delays_in_loading_the_list_of_notesx') + CRLF + CRLF + //kt added 7/19/2007
|
---|
| 3208 | DKLangConstW('fNotes_Are_you_sure_you_mean_to_do_thisx'); //kt added 7/19/2007
|
---|
| 3209 | TX_REPLACE := DKLangConstW('fNotes_Replace_current_defaultsx'); //kt added 7/19/2007
|
---|
| 3210 | if FCurrentContext.MaxDocs = 0 then
|
---|
| 3211 | if InfoBox(TX_NO_MAX,'Warning', MB_YESNO or MB_ICONWARNING) = IDNO then
|
---|
| 3212 | begin
|
---|
| 3213 | mnuViewClick(mnuViewCustom);
|
---|
| 3214 | Exit;
|
---|
| 3215 | end;
|
---|
| 3216 | if InfoBox(TX_REPLACE,'Confirmation', MB_YESNO or MB_ICONQUESTION) = IDYES then
|
---|
| 3217 | begin
|
---|
| 3218 | SaveCurrentTIUContext(FCurrentContext);
|
---|
| 3219 | FDefaultContext := FCurrentContext;
|
---|
| 3220 | //lblNotes.Caption := 'Default List';
|
---|
| 3221 | end;
|
---|
| 3222 | end;
|
---|
| 3223 |
|
---|
| 3224 | procedure TfrmNotes.mnuViewReturntoDefaultClick(Sender: TObject);
|
---|
| 3225 | begin
|
---|
| 3226 | inherited;
|
---|
| 3227 | SetViewContext(FDefaultContext);
|
---|
| 3228 | end;
|
---|
| 3229 |
|
---|
| 3230 | procedure TfrmNotes.popNoteMemoTemplateClick(Sender: TObject);
|
---|
| 3231 | begin
|
---|
| 3232 | inherited;
|
---|
| 3233 | EditTemplates(Self, TRUE, FEditCtrl.SelText);
|
---|
| 3234 | end;
|
---|
| 3235 |
|
---|
| 3236 | procedure TfrmNotes.popNoteListPopup(Sender: TObject);
|
---|
| 3237 | begin
|
---|
| 3238 | inherited;
|
---|
| 3239 | N4.Visible := (popNoteList.PopupComponent is TORTreeView);
|
---|
| 3240 | popNoteListExpandAll.Visible := N4.Visible;
|
---|
| 3241 | popNoteListExpandSelected.Visible := N4.Visible;
|
---|
| 3242 | popNoteListCollapseAll.Visible := N4.Visible;
|
---|
| 3243 | popNoteListCollapseSelected.Visible := N4.Visible;
|
---|
| 3244 | end;
|
---|
| 3245 |
|
---|
| 3246 | procedure TfrmNotes.popNoteListExpandAllClick(Sender: TObject);
|
---|
| 3247 | begin
|
---|
| 3248 | inherited;
|
---|
| 3249 | tvNotes.FullExpand;
|
---|
| 3250 | end;
|
---|
| 3251 |
|
---|
| 3252 | procedure TfrmNotes.popNoteListCollapseAllClick(Sender: TObject);
|
---|
| 3253 | begin
|
---|
| 3254 | inherited;
|
---|
| 3255 | tvNotes.Selected := nil;
|
---|
| 3256 | lvNotes.Items.Clear;
|
---|
| 3257 | memNote.Clear;
|
---|
[541] | 3258 | HTMLViewer.Clear; //kt 8/09
|
---|
[453] | 3259 | tvNotes.FullCollapse;
|
---|
| 3260 | tvNotes.Selected := tvNotes.TopItem;
|
---|
| 3261 | end;
|
---|
| 3262 |
|
---|
| 3263 | procedure TfrmNotes.popNoteListExpandSelectedClick(Sender: TObject);
|
---|
| 3264 | begin
|
---|
| 3265 | inherited;
|
---|
| 3266 | if tvNotes.Selected = nil then exit;
|
---|
| 3267 | with tvNotes.Selected do if HasChildren then Expand(True);
|
---|
| 3268 | end;
|
---|
| 3269 |
|
---|
| 3270 | procedure TfrmNotes.popNoteListCollapseSelectedClick(Sender: TObject);
|
---|
| 3271 | begin
|
---|
| 3272 | inherited;
|
---|
| 3273 | if tvNotes.Selected = nil then exit;
|
---|
| 3274 | with tvNotes.Selected do if HasChildren then Collapse(True);
|
---|
| 3275 | end;
|
---|
| 3276 |
|
---|
| 3277 | procedure TfrmNotes.mnuEditTemplatesClick(Sender: TObject);
|
---|
| 3278 | begin
|
---|
| 3279 | inherited;
|
---|
| 3280 | EditTemplates(Self);
|
---|
| 3281 | end;
|
---|
| 3282 |
|
---|
| 3283 | procedure TfrmNotes.mnuNewTemplateClick(Sender: TObject);
|
---|
| 3284 | begin
|
---|
| 3285 | inherited;
|
---|
| 3286 | EditTemplates(Self, TRUE);
|
---|
| 3287 | end;
|
---|
| 3288 |
|
---|
| 3289 | procedure TfrmNotes.mnuEditSharedTemplatesClick(Sender: TObject);
|
---|
| 3290 | begin
|
---|
| 3291 | inherited;
|
---|
| 3292 | EditTemplates(Self, FALSE, '', TRUE);
|
---|
| 3293 | end;
|
---|
| 3294 |
|
---|
| 3295 | procedure TfrmNotes.mnuNewSharedTemplateClick(Sender: TObject);
|
---|
| 3296 | begin
|
---|
| 3297 | inherited;
|
---|
| 3298 | EditTemplates(Self, TRUE, '', TRUE);
|
---|
| 3299 | end;
|
---|
| 3300 |
|
---|
| 3301 | procedure TfrmNotes.mnuOptionsClick(Sender: TObject);
|
---|
| 3302 | begin
|
---|
| 3303 | inherited;
|
---|
| 3304 | mnuEditTemplates.Enabled := frmDrawers.CanEditTemplates;
|
---|
| 3305 | mnuNewTemplate.Enabled := frmDrawers.CanEditTemplates;
|
---|
| 3306 | mnuEditSharedTemplates.Enabled := frmDrawers.CanEditShared;
|
---|
| 3307 | mnuNewSharedTemplate.Enabled := frmDrawers.CanEditShared;
|
---|
| 3308 | mnuEditDialgFields.Enabled := CanEditTemplateFields;
|
---|
| 3309 | end;
|
---|
| 3310 |
|
---|
| 3311 | procedure TfrmNotes.SetEditingIndex(const Value: Integer);
|
---|
| 3312 | begin
|
---|
| 3313 | FEditingIndex := Value;
|
---|
| 3314 | if(FEditingIndex < 0) then
|
---|
| 3315 | KillReminderDialog(Self);
|
---|
| 3316 | if(assigned(frmReminderTree)) then
|
---|
| 3317 | frmReminderTree.EnableActions;
|
---|
| 3318 | end;
|
---|
| 3319 |
|
---|
| 3320 | function TfrmNotes.CanFinishReminder: boolean;
|
---|
| 3321 | begin
|
---|
| 3322 | if(EditingIndex < 0) then
|
---|
| 3323 | Result := FALSE
|
---|
| 3324 | else
|
---|
| 3325 | Result := (lstNotes.ItemIndex = EditingIndex);
|
---|
| 3326 | end;
|
---|
| 3327 |
|
---|
| 3328 | procedure TfrmNotes.FormDestroy(Sender: TObject);
|
---|
| 3329 | begin
|
---|
| 3330 | //kt note: The Images tab will delete all files in .\Cache, which
|
---|
| 3331 | // might include HTMLfilename. No harm if already deleted.
|
---|
[541] | 3332 | //kt 8/09 DeleteFile(HTMLfilename); //kt added 5-2-05
|
---|
[453] | 3333 | TAccessibleTreeView.UnwrapControl(tvNotes);
|
---|
| 3334 | FDocList.Free;
|
---|
| 3335 | FImageFlag.Free;
|
---|
| 3336 | KillDocTreeObjects(tvNotes);
|
---|
[541] | 3337 | HtmlEditor.Free; //kt 6/7/09
|
---|
| 3338 | HtmlViewer.Free; //kt 6/7/09
|
---|
[453] | 3339 | inherited;
|
---|
| 3340 | end;
|
---|
| 3341 |
|
---|
| 3342 | function TfrmNotes.GetDrawers: TFrmDrawers;
|
---|
| 3343 | begin
|
---|
| 3344 | Result := frmDrawers;
|
---|
| 3345 | end;
|
---|
| 3346 |
|
---|
| 3347 | procedure TfrmNotes.AssignRemForm;
|
---|
| 3348 | begin
|
---|
[541] | 3349 | //kt 8/09 ReminderDialog interaction has not yet been debugged with HTML formatted text.
|
---|
[453] | 3350 | with RemForm do
|
---|
| 3351 | begin
|
---|
| 3352 | Form := Self;
|
---|
| 3353 | PCEObj := uPCEEdit;
|
---|
| 3354 | RightPanel := pnlRight;
|
---|
| 3355 | CanFinishProc := CanFinishReminder;
|
---|
| 3356 | DisplayPCEProc := DisplayPCE;
|
---|
| 3357 | Drawers := frmDrawers;
|
---|
| 3358 | NewNoteRE := memNewNote;
|
---|
[541] | 3359 | NewNoteHTMLE := HTMLEditor; //kt
|
---|
[453] | 3360 | NoteList := lstNotes;
|
---|
| 3361 | end;
|
---|
| 3362 | end;
|
---|
| 3363 |
|
---|
| 3364 | procedure TfrmNotes.mnuEditDialgFieldsClick(Sender: TObject);
|
---|
| 3365 | begin
|
---|
| 3366 | inherited;
|
---|
| 3367 | EditDialogFields;
|
---|
| 3368 | end;
|
---|
| 3369 |
|
---|
| 3370 | //=================== Added for sort/search enhancements ======================
|
---|
| 3371 | procedure TfrmNotes.LoadNotes;
|
---|
| 3372 | const
|
---|
| 3373 | INVALID_ID = -1;
|
---|
| 3374 | INFO_ID = 1;
|
---|
| 3375 | var
|
---|
| 3376 | tmpList: TStringList;
|
---|
| 3377 | ANode: TORTreeNode;
|
---|
| 3378 | x,xx,noteId: integer; // Text Search CQ: HDS00002856
|
---|
| 3379 | Dest: TStrings; // Text Search CQ: HDS00002856
|
---|
| 3380 | KeepFlag: Boolean; // Text Search CQ: HDS00002856
|
---|
| 3381 | NoteCount, NoteMatches: integer; // Text Search CQ: HDS00002856
|
---|
| 3382 | begin
|
---|
| 3383 | tmpList := TStringList.Create;
|
---|
| 3384 | try
|
---|
| 3385 | FDocList.Clear;
|
---|
| 3386 | uChanging := True;
|
---|
| 3387 | RedrawSuspend(memNote.Handle);
|
---|
[541] | 3388 | RedrawSuspend(HTMLViewer.Handle); //kt 8/09
|
---|
[453] | 3389 | RedrawSuspend(lvNotes.Handle);
|
---|
| 3390 | tvNotes.Items.BeginUpdate;
|
---|
| 3391 | lstNotes.Items.Clear;
|
---|
| 3392 | KillDocTreeObjects(tvNotes);
|
---|
| 3393 | tvNotes.Items.Clear;
|
---|
| 3394 | tvNotes.Items.EndUpdate;
|
---|
| 3395 | lvNotes.Items.Clear;
|
---|
| 3396 | memNote.Clear;
|
---|
[541] | 3397 | HTMLViewer.Clear; //kt 8/09
|
---|
[453] | 3398 | memNote.Invalidate;
|
---|
| 3399 | lblTitle.Caption := '';
|
---|
| 3400 | lvNotes.Caption := '';
|
---|
| 3401 | with FCurrentContext do
|
---|
| 3402 | begin
|
---|
| 3403 | if Status <> IntToStr(NC_UNSIGNED) then
|
---|
| 3404 | begin
|
---|
| 3405 | ListNotesForTree(tmpList, NC_UNSIGNED, 0, 0, 0, 0, TreeAscending);
|
---|
| 3406 | if tmpList.Count > 0 then
|
---|
| 3407 | begin
|
---|
| 3408 | CreateListItemsforDocumentTree(FDocList, tmpList, NC_UNSIGNED, GroupBy, TreeAscending, CT_NOTES);
|
---|
| 3409 | UpdateTreeView(FDocList, tvNotes);
|
---|
| 3410 | end;
|
---|
| 3411 | tmpList.Clear;
|
---|
| 3412 | FDocList.Clear;
|
---|
| 3413 | end;
|
---|
| 3414 | if Status <> IntToStr(NC_UNCOSIGNED) then
|
---|
| 3415 | begin
|
---|
| 3416 | ListNotesForTree(tmpList, NC_UNCOSIGNED, 0, 0, 0, 0, TreeAscending);
|
---|
| 3417 | if tmpList.Count > 0 then
|
---|
| 3418 | begin
|
---|
| 3419 | CreateListItemsforDocumentTree(FDocList, tmpList, NC_UNCOSIGNED, GroupBy, TreeAscending, CT_NOTES);
|
---|
| 3420 | UpdateTreeView(FDocList, tvNotes);
|
---|
| 3421 | end;
|
---|
| 3422 | tmpList.Clear;
|
---|
| 3423 | FDocList.Clear;
|
---|
| 3424 | end;
|
---|
| 3425 | ListNotesForTree(tmpList, StrToIntDef(Status, 0), FMBeginDate, FMEndDate, Author, MaxDocs, TreeAscending);
|
---|
| 3426 | CreateListItemsforDocumentTree(FDocList, tmpList, StrToIntDef(Status, 0), GroupBy, TreeAscending, CT_NOTES);
|
---|
| 3427 |
|
---|
| 3428 | // Text Search CQ: HDS00002856 ---------------------------------------
|
---|
| 3429 | if FCurrentContext.SearchString<>'' then // Text Search CQ: HDS00002856
|
---|
| 3430 | begin
|
---|
| 3431 | NoteMatches := 0;
|
---|
| 3432 | Dest:=TStringList.Create;
|
---|
| 3433 | NoteCount:=FDocList.Count-1;
|
---|
| 3434 | if FDocList.Count>0 then
|
---|
| 3435 | for x := FDocList.Count-1 downto 1 do begin; // Don't do 0, because it's informational
|
---|
| 3436 | KeepFlag:=False;
|
---|
| 3437 | // lblNotes.Caption:='Scanning '+IntToStr(NoteCount-x+1)+' of '+IntToStr(NoteCount)+', '+IntToStr(NoteMatches); <-- original line. //kt 7/19/2007
|
---|
| 3438 | lblNotes.Caption:=DKLangConstW('fNotes_Scanning')+' '+IntToStr(NoteCount-x+1)+DKLangConstW('fNotes_of')+IntToStr(NoteCount)+', '+IntToStr(NoteMatches); //kt added 7/19/2007
|
---|
| 3439 | If NoteMatches=1 then lblNotes.Caption:=lblNotes.Caption+' match' else
|
---|
| 3440 | lblNotes.Caption:=lblNotes.Caption+' matches';
|
---|
| 3441 | frmSearchStop.lblSearchStatus.Caption := lblNotes.Caption;
|
---|
| 3442 | frmSearchStop.lblSearchStatus.Repaint;
|
---|
| 3443 | lblNotes.Repaint;
|
---|
| 3444 | // Free up some ticks so they can click the "Stop" button
|
---|
| 3445 | application.processmessages;
|
---|
| 3446 | application.processmessages;
|
---|
| 3447 | application.processmessages;
|
---|
| 3448 | If SearchTextStopFlag = False then begin
|
---|
| 3449 | noteId := StrToIntDef(Piece(FDocList.Strings[x],'^',1),-1);
|
---|
| 3450 | if (noteId = INVALID_ID) or (noteId = INFO_ID) then
|
---|
| 3451 | Continue;
|
---|
| 3452 | CallV('TIU GET RECORD TEXT', [Piece(FDocList.Strings[x],'^',1)]);
|
---|
| 3453 | Dest.Assign(RPCBrokerV.Results);
|
---|
| 3454 | If Dest.Count > 0 then
|
---|
| 3455 | for xx := 0 to Dest.Count-1 do
|
---|
| 3456 | begin
|
---|
| 3457 | //Dest.Strings[xx] := StringReplace(Dest.Strings[xx],'#13',' ',[rfReplaceAll, rfIgnoreCase]);
|
---|
| 3458 | if Pos(Uppercase(FCurrentContext.SearchString),Uppercase(Dest.Strings[xx]))>0 then
|
---|
| 3459 | keepflag:=true;
|
---|
| 3460 | end;
|
---|
| 3461 | If KeepFlag=False then begin;
|
---|
| 3462 | if FDocList.Count >= x then
|
---|
| 3463 | FDocList.Delete(x);
|
---|
| 3464 | if (tmpList.Count >= x) and (x > 0) then
|
---|
| 3465 | tmpList.Delete(x-1);
|
---|
| 3466 | end else
|
---|
| 3467 | Inc(NoteMatches);
|
---|
| 3468 | end;
|
---|
| 3469 | end;
|
---|
| 3470 | Dest.Free;
|
---|
| 3471 | end;
|
---|
| 3472 | // Text Search CQ: HDS00002856 ---------------------------------------
|
---|
| 3473 |
|
---|
| 3474 | UpdateTreeView(FDocList, tvNotes);
|
---|
| 3475 | end;
|
---|
| 3476 | with tvNotes do
|
---|
| 3477 | begin
|
---|
| 3478 | uChanging := True;
|
---|
| 3479 | tvNotes.Items.BeginUpdate;
|
---|
| 3480 | RemoveParentsWithNoChildren(tvNotes, FCurrentContext); // moved here in v15.9 (RV)
|
---|
| 3481 | if FLastNoteID <> '' then
|
---|
| 3482 | Selected := FindPieceNode(FLastNoteID, 1, U, nil);
|
---|
| 3483 | if Selected = nil then
|
---|
| 3484 | begin
|
---|
| 3485 | if (FCurrentContext.GroupBy <> '') or (FCurrentContext.Filtered) then
|
---|
| 3486 | begin
|
---|
| 3487 | ANode := TORTreeNode(Items.GetFirstNode);
|
---|
| 3488 | while ANode <> nil do
|
---|
| 3489 | begin
|
---|
| 3490 | ANode.Expand(False);
|
---|
| 3491 | Selected := ANode;
|
---|
| 3492 | ANode := TORTreeNode(ANode.GetNextSibling);
|
---|
| 3493 | end;
|
---|
| 3494 | end
|
---|
| 3495 | else
|
---|
| 3496 | begin
|
---|
| 3497 | ANode := tvNotes.FindPieceNode(FCurrentContext.Status, 1, U, nil);
|
---|
| 3498 | if ANode <> nil then ANode.Expand(False);
|
---|
| 3499 | ANode := tvNotes.FindPieceNode(IntToStr(NC_UNSIGNED), 1, U, nil);
|
---|
| 3500 | if ANode = nil then
|
---|
| 3501 | ANode := tvNotes.FindPieceNode(IntToStr(NC_UNCOSIGNED), 1, U, nil);
|
---|
| 3502 | if ANode = nil then
|
---|
| 3503 | ANode := tvNotes.FindPieceNode(FCurrentContext.Status, 1, U, nil);
|
---|
| 3504 | if ANode <> nil then
|
---|
| 3505 | begin
|
---|
| 3506 | if ANode.getFirstChild <> nil then
|
---|
| 3507 | Selected := ANode.getFirstChild
|
---|
| 3508 | else
|
---|
| 3509 | Selected := ANode;
|
---|
| 3510 | end;
|
---|
| 3511 | end;
|
---|
| 3512 | end;
|
---|
| 3513 | memNote.Clear;
|
---|
[541] | 3514 | HTMLViewer.Clear; //kt 8/09
|
---|
[453] | 3515 | with lvNotes do
|
---|
| 3516 | begin
|
---|
| 3517 | Selected := nil;
|
---|
| 3518 | if FCurrentContext.SortBy <> '' then
|
---|
| 3519 | ColumnToSort := Pos(FCurrentContext.SortBy, 'RDSAL') - 1;
|
---|
| 3520 | if not FCurrentContext.ShowSubject then
|
---|
| 3521 | begin
|
---|
| 3522 | Columns[1].Width := 2 * (Width div 5);
|
---|
| 3523 | Columns[2].Width := 0;
|
---|
| 3524 | end
|
---|
| 3525 | else
|
---|
| 3526 | begin
|
---|
| 3527 | Columns[1].Width := Width div 5;
|
---|
| 3528 | Columns[2].Width := Columns[1].Width;
|
---|
| 3529 | end;
|
---|
| 3530 | end;
|
---|
| 3531 | //RemoveParentsWithNoChildren(tvNotes, FCurrentContext); // moved FROM here in v15.9 (RV)
|
---|
| 3532 | tvNotes.Items.EndUpdate;
|
---|
| 3533 | uChanging := False;
|
---|
| 3534 | SendMessage(tvNotes.Handle, WM_VSCROLL, SB_TOP, 0);
|
---|
| 3535 | if Selected <> nil then tvNotesChange(Self, Selected);
|
---|
| 3536 | end;
|
---|
| 3537 | finally
|
---|
[541] | 3538 | //kt NOTE: Is this enough??
|
---|
| 3539 | if (vmHTML in FViewMode) then begin //kt 8/09
|
---|
| 3540 | RedrawActivate(HtmlViewer.Handle); //kt 8/09
|
---|
| 3541 | end else begin //kt 8/09
|
---|
| 3542 | RedrawActivate(memNote.Handle);
|
---|
| 3543 | end; //kt 8/09
|
---|
[453] | 3544 | RedrawActivate(lvNotes.Handle);
|
---|
| 3545 | tmpList.Free;
|
---|
| 3546 | end;
|
---|
| 3547 | end;
|
---|
| 3548 |
|
---|
| 3549 | procedure TfrmNotes.UpdateTreeView(DocList: TStringList; Tree: TORTreeView);
|
---|
| 3550 | begin
|
---|
| 3551 | with Tree do
|
---|
| 3552 | begin
|
---|
| 3553 | uChanging := True;
|
---|
| 3554 | Items.BeginUpdate;
|
---|
| 3555 | lstNotes.Items.AddStrings(DocList);
|
---|
| 3556 | BuildDocumentTree(DocList, '0', Tree, nil, FCurrentContext, CT_NOTES);
|
---|
| 3557 | Items.EndUpdate;
|
---|
| 3558 | uChanging := False;
|
---|
| 3559 | end;
|
---|
| 3560 | end;
|
---|
| 3561 |
|
---|
| 3562 | procedure TfrmNotes.tvNotesChange(Sender: TObject; Node: TTreeNode);
|
---|
| 3563 | var
|
---|
| 3564 | x, MySearch, MyNodeID: string;
|
---|
| 3565 | i: integer;
|
---|
| 3566 | WhyNot: string;
|
---|
[541] | 3567 | Mode : TViewModeSet; //kt 8/09
|
---|
[453] | 3568 | begin
|
---|
| 3569 | if uChanging then Exit;
|
---|
| 3570 | //This gives the change a chance to occur when keyboarding, so that WindowEyes
|
---|
| 3571 | //doesn't use the old value.
|
---|
| 3572 | Application.ProcessMessages;
|
---|
| 3573 | with tvNotes do
|
---|
| 3574 | begin
|
---|
| 3575 | memNote.Clear;
|
---|
[541] | 3576 | HTMLViewer.Clear; //kt 8/09
|
---|
[453] | 3577 | if Selected = nil then Exit;
|
---|
| 3578 | if uIDNotesActive then
|
---|
| 3579 | begin
|
---|
| 3580 | mnuActDetachFromIDParent.Enabled := (Selected.ImageIndex in [IMG_ID_CHILD, IMG_ID_CHILD_ADD]);
|
---|
| 3581 | popNoteListDetachFromIDParent.Enabled := mnuActDetachFromIDParent.Enabled;
|
---|
| 3582 | if (Selected.ImageIndex in [IMG_SINGLE, IMG_PARENT, IMG_ID_CHILD, IMG_ID_CHILD_ADD]) then
|
---|
| 3583 | mnuActAttachtoIDParent.Enabled := CanBeAttached(PDocTreeObject(Selected.Data)^.DocID, WhyNot)
|
---|
| 3584 | else
|
---|
| 3585 | mnuActAttachtoIDParent.Enabled := False;
|
---|
| 3586 | popNoteListAttachtoIDParent.Enabled := mnuActAttachtoIDParent.Enabled;
|
---|
| 3587 | if (Selected.ImageIndex in [IMG_SINGLE, IMG_PARENT,
|
---|
| 3588 | IMG_IDNOTE_OPEN, IMG_IDNOTE_SHUT,
|
---|
| 3589 | IMG_IDPAR_ADDENDA_OPEN, IMG_IDPAR_ADDENDA_SHUT]) then
|
---|
| 3590 | mnuActAddIDEntry.Enabled := CanReceiveAttachment(PDocTreeObject(Selected.Data)^.DocID, WhyNot)
|
---|
| 3591 | else
|
---|
| 3592 | mnuActAddIDEntry.Enabled := False;
|
---|
| 3593 | popNoteListAddIDEntry.Enabled := mnuActAddIDEntry.Enabled
|
---|
| 3594 | end;
|
---|
| 3595 | RedrawSuspend(lvNotes.Handle);
|
---|
| 3596 | RedrawSuspend(memNote.Handle);
|
---|
[541] | 3597 | RedrawSuspend(HTMLViewer.Handle); //kt 8/09
|
---|
[453] | 3598 | popNoteListExpandSelected.Enabled := Selected.HasChildren;
|
---|
| 3599 | popNoteListCollapseSelected.Enabled := Selected.HasChildren;
|
---|
| 3600 | x := TORTreeNode(Selected).StringData;
|
---|
| 3601 | if (Selected.ImageIndex in [IMG_TOP_LEVEL, IMG_GROUP_OPEN, IMG_GROUP_SHUT]) then
|
---|
| 3602 | begin
|
---|
| 3603 | lvNotes.Visible := True;
|
---|
| 3604 | lvNotes.Items.Clear;
|
---|
| 3605 | lvNotes.Height := (2 * lvNotes.Parent.Height) div 5;
|
---|
| 3606 | with lblTitle do
|
---|
| 3607 | begin
|
---|
| 3608 | Caption := Trim(Selected.Text);
|
---|
| 3609 | if (FCurrentContext.SearchField <> '') and (FCurrentContext.Filtered) then
|
---|
| 3610 | begin
|
---|
| 3611 | case FCurrentContext.SearchField[1] of
|
---|
| 3612 | 'T': MySearch := 'TITLE';
|
---|
| 3613 | 'S': MySearch := 'SUBJECT';
|
---|
| 3614 | 'B': MySearch := 'TITLE or SUBJECT';
|
---|
| 3615 | end;
|
---|
| 3616 | // Caption := Caption + ' where ' + MySearch + ' contains "' + UpperCase(FCurrentContext.Keyword) + '"'; <-- original line. //kt 7/19/2007
|
---|
| 3617 | Caption := Caption + DKLangConstW('fNotes_where') + MySearch + DKLangConstW('fNotes_contains_x') + UpperCase(FCurrentContext.Keyword) + '"'; //kt added 7/19/2007
|
---|
| 3618 | end;
|
---|
| 3619 | lvNotes.Caption := Caption;
|
---|
| 3620 | end;
|
---|
| 3621 |
|
---|
| 3622 | if Selected.ImageIndex = IMG_TOP_LEVEL then
|
---|
| 3623 | MyNodeID := Piece(TORTreeNode(Selected).StringData, U, 1)
|
---|
| 3624 | else if Selected.Parent.ImageIndex = IMG_TOP_LEVEL then
|
---|
| 3625 | MyNodeID := Piece(TORTreeNode(Selected.Parent).StringData, U, 1)
|
---|
| 3626 | else if Selected.Parent.Parent.ImageIndex = IMG_TOP_LEVEL then
|
---|
| 3627 | MyNodeID := Piece(TORTreeNode(Selected.Parent.Parent).StringData, U, 1);
|
---|
| 3628 |
|
---|
| 3629 | uChanging := True;
|
---|
| 3630 | TraverseTree(tvNotes, lvNotes, Selected.GetFirstChild, MyNodeID, FCurrentContext);
|
---|
| 3631 | with lvNotes do
|
---|
| 3632 | begin
|
---|
| 3633 | for i := 0 to Columns.Count - 1 do
|
---|
| 3634 | Columns[i].ImageIndex := IMG_NONE;
|
---|
| 3635 | ColumnSortForward := FCurrentContext.ListAscending;
|
---|
| 3636 | if ColumnToSort = 5 then ColumnToSort := 0;
|
---|
| 3637 | if ColumnSortForward then
|
---|
| 3638 | Columns[ColumnToSort].ImageIndex := IMG_ASCENDING
|
---|
| 3639 | else
|
---|
| 3640 | Columns[ColumnToSort].ImageIndex := IMG_DESCENDING;
|
---|
| 3641 | if ColumnToSort = 0 then ColumnToSort := 5;
|
---|
| 3642 | AlphaSort;
|
---|
| 3643 | Columns[5].Width := 0;
|
---|
| 3644 | Columns[6].Width := 0;
|
---|
| 3645 | end;
|
---|
| 3646 | uChanging := False;
|
---|
| 3647 | with lvNotes do
|
---|
| 3648 | if Items.Count > 0 then
|
---|
| 3649 | begin
|
---|
| 3650 | Selected := Items[0];
|
---|
| 3651 | lvNotesSelectItem(Self, Selected, True);
|
---|
| 3652 | end
|
---|
| 3653 | else
|
---|
| 3654 | begin
|
---|
| 3655 | Selected := nil;
|
---|
| 3656 | lstNotes.ItemIndex := -1;
|
---|
| 3657 | memPCEShow.Clear;
|
---|
| 3658 | ShowPCEControls(False);
|
---|
| 3659 | end;
|
---|
[541] | 3660 | //kt 8/09
|
---|
| 3661 | //kt NOTE: At this point the list has changed. But what is the new note-to-view's format?
|
---|
| 3662 | // We can't just use FViewMode. Because that just states what mode was used on the last note.
|
---|
| 3663 | Mode := [vmView] + [vmHTML_MODE[vmHTML in FViewMode]]; //kt 8/09
|
---|
| 3664 | SetDisplayToHTMLvsText(Mode,nil,VIEW_ACTIVATE_ONLY); //kt 8/09
|
---|
| 3665 | //kt 8/09 pnlWrite.Visible := False;
|
---|
| 3666 | //kt 8/09 pnlRead.Visible := True;
|
---|
[453] | 3667 | // uncommented next 4 lines in v17.5 (RV)
|
---|
| 3668 | //-----------------------------
|
---|
| 3669 | UpdateReminderFinish;
|
---|
| 3670 | ShowPCEControls(False);
|
---|
| 3671 | frmDrawers.DisplayDrawers(TRUE, [odTemplates], [odTemplates]); //FALSE);
|
---|
| 3672 | ShowPCEButtons(FALSE);
|
---|
| 3673 | //-----------------------------
|
---|
| 3674 | //memNote.Clear;
|
---|
| 3675 | end
|
---|
| 3676 | else if StrToIntDef(Piece(x, U, 1), 0) > 0 then
|
---|
| 3677 | begin
|
---|
| 3678 | memNote.Clear;
|
---|
[541] | 3679 | HTMLViewer.Clear; //kt 8/09
|
---|
[453] | 3680 | lvNotes.Visible := False;
|
---|
| 3681 | lstNotes.SelectByID(Piece(x, U, 1));
|
---|
| 3682 | lstNotesClick(Self);
|
---|
[541] | 3683 | if (vmHTML in FViewMode) then begin //kt 8/09
|
---|
| 3684 | SendMessage(HTMLViewer.Handle, WM_VSCROLL, SB_TOP, 0); //kt 8/09
|
---|
| 3685 | end else begin //kt 8/09
|
---|
| 3686 | SendMessage(memNote.Handle, WM_VSCROLL, SB_TOP, 0);
|
---|
| 3687 | end; //kt 8/09
|
---|
[453] | 3688 | end;
|
---|
| 3689 | SendMessage(tvNotes.Handle, WM_HSCROLL, SB_THUMBTRACK, 0);
|
---|
| 3690 | RedrawActivate(lvNotes.Handle);
|
---|
[541] | 3691 | if (vmHTML in FViewMode) then begin //kt 8/09
|
---|
| 3692 | RedrawActivate(HtmlViewer.Handle); //kt 8/09
|
---|
| 3693 | end else begin //kt 8/09
|
---|
| 3694 | RedrawActivate(memNote.Handle);
|
---|
| 3695 | end; //kt 8/09
|
---|
[453] | 3696 | end;
|
---|
| 3697 | end;
|
---|
| 3698 |
|
---|
| 3699 | procedure TfrmNotes.tvNotesCollapsed(Sender: TObject; Node: TTreeNode);
|
---|
| 3700 | begin
|
---|
| 3701 | with Node do
|
---|
| 3702 | begin
|
---|
| 3703 | if (ImageIndex in [IMG_GROUP_OPEN, IMG_IDNOTE_OPEN, IMG_IDPAR_ADDENDA_OPEN]) then
|
---|
| 3704 | ImageIndex := ImageIndex - 1;
|
---|
| 3705 | if (SelectedIndex in [IMG_GROUP_OPEN, IMG_IDNOTE_OPEN, IMG_IDPAR_ADDENDA_OPEN]) then
|
---|
| 3706 | SelectedIndex := SelectedIndex - 1;
|
---|
| 3707 | end;
|
---|
| 3708 | end;
|
---|
| 3709 |
|
---|
| 3710 | procedure TfrmNotes.tvNotesExpanded(Sender: TObject; Node: TTreeNode);
|
---|
| 3711 |
|
---|
| 3712 | function SortByTitle(Node1, Node2: TTreeNode; Data: Longint): Integer; stdcall;
|
---|
| 3713 | begin
|
---|
| 3714 | { Within an ID parent node, sorts in ascending order by title
|
---|
| 3715 | BUT - addenda to parent document are always at the top of the sort, in date order}
|
---|
| 3716 | if (Copy(PDocTreeObject(Node1.Data)^.DocTitle, 1, 8) = 'Addendum') and
|
---|
| 3717 | (Copy(PDocTreeObject(Node2.Data)^.DocTitle, 1, 8) = 'Addendum') then
|
---|
| 3718 | begin
|
---|
| 3719 | Result := AnsiStrIComp(PChar(PDocTreeObject(Node1.Data)^.DocFMDate),
|
---|
| 3720 | PChar(PDocTreeObject(Node2.Data)^.DocFMDate));
|
---|
| 3721 | end
|
---|
| 3722 | else if Copy(PDocTreeObject(Node1.Data)^.DocTitle, 1, 8) = 'Addendum' then Result := -1
|
---|
| 3723 | else if Copy(PDocTreeObject(Node2.Data)^.DocTitle, 1, 8) = 'Addendum' then Result := 1
|
---|
| 3724 | else
|
---|
| 3725 | begin
|
---|
| 3726 | if Data = 0 then
|
---|
| 3727 | Result := AnsiStrIComp(PChar(PDocTreeObject(Node1.Data)^.DocTitle),
|
---|
| 3728 | PChar(PDocTreeObject(Node2.Data)^.DocTitle))
|
---|
| 3729 | else
|
---|
| 3730 | Result := -AnsiStrIComp(PChar(PDocTreeObject(Node1.Data)^.DocTitle),
|
---|
| 3731 | PChar(PDocTreeObject(Node2.Data)^.DocTitle));
|
---|
| 3732 | end
|
---|
| 3733 | end;
|
---|
| 3734 |
|
---|
| 3735 | function SortByDate(Node1, Node2: TTreeNode; Data: Longint): Integer; stdcall;
|
---|
| 3736 | begin
|
---|
| 3737 | { Within an ID parent node, sorts in ascending order by document date
|
---|
| 3738 | BUT - addenda to parent document are always at the top of the sort, in date order}
|
---|
| 3739 | if (Copy(PDocTreeObject(Node1.Data)^.DocTitle, 1, 8) = 'Addendum') and
|
---|
| 3740 | (Copy(PDocTreeObject(Node2.Data)^.DocTitle, 1, 8) = 'Addendum') then
|
---|
| 3741 | begin
|
---|
| 3742 | Result := AnsiStrIComp(PChar(PDocTreeObject(Node1.Data)^.DocFMDate),
|
---|
| 3743 | PChar(PDocTreeObject(Node2.Data)^.DocFMDate));
|
---|
| 3744 | end
|
---|
| 3745 | else if Copy(PDocTreeObject(Node1.Data)^.DocTitle, 1, 8) = 'Addendum' then Result := -1
|
---|
| 3746 | else if Copy(PDocTreeObject(Node2.Data)^.DocTitle, 1, 8) = 'Addendum' then Result := 1
|
---|
| 3747 | else
|
---|
| 3748 | begin
|
---|
| 3749 | if Data = 0 then
|
---|
| 3750 | Result := AnsiStrIComp(PChar(PDocTreeObject(Node1.Data)^.DocFMDate),
|
---|
| 3751 | PChar(PDocTreeObject(Node2.Data)^.DocFMDate))
|
---|
| 3752 | else
|
---|
| 3753 | Result := -AnsiStrIComp(PChar(PDocTreeObject(Node1.Data)^.DocFMDate),
|
---|
| 3754 | PChar(PDocTreeObject(Node2.Data)^.DocFMDate));
|
---|
| 3755 | end;
|
---|
| 3756 | end;
|
---|
| 3757 |
|
---|
| 3758 | begin
|
---|
| 3759 | with Node do
|
---|
| 3760 | begin
|
---|
| 3761 | if Assigned(Data) then
|
---|
| 3762 | if (Pos('<', PDocTreeObject(Data)^.DocHasChildren) > 0) then
|
---|
| 3763 | begin
|
---|
| 3764 | if (PDocTreeObject(Node.Data)^.OrderByTitle) then
|
---|
| 3765 | CustomSort(@SortByTitle, 0)
|
---|
| 3766 | else
|
---|
| 3767 | CustomSort(@SortByDate, 0);
|
---|
| 3768 | end;
|
---|
| 3769 | if (ImageIndex in [IMG_GROUP_SHUT, IMG_IDNOTE_SHUT, IMG_IDPAR_ADDENDA_SHUT]) then
|
---|
| 3770 | ImageIndex := ImageIndex + 1;
|
---|
| 3771 | if (SelectedIndex in [IMG_GROUP_SHUT, IMG_IDNOTE_SHUT, IMG_IDPAR_ADDENDA_SHUT]) then
|
---|
| 3772 | SelectedIndex := SelectedIndex + 1;
|
---|
| 3773 | end;
|
---|
| 3774 | end;
|
---|
| 3775 |
|
---|
| 3776 | procedure TfrmNotes.tvNotesClick(Sender: TObject);
|
---|
| 3777 | begin
|
---|
| 3778 | (* if tvNotes.Selected = nil then exit;
|
---|
| 3779 | if (tvNotes.Selected.ImageIndex in [IMG_TOP_LEVEL, IMG_GROUP_OPEN, IMG_GROUP_SHUT]) then
|
---|
| 3780 | begin
|
---|
| 3781 | uChanging := True;
|
---|
| 3782 | lvNotes.Selected := nil;
|
---|
| 3783 | uChanging := False;
|
---|
| 3784 | memNote.Clear;
|
---|
| 3785 | end;*)
|
---|
| 3786 | end;
|
---|
| 3787 |
|
---|
| 3788 | procedure TfrmNotes.tvNotesDragOver(Sender, Source: TObject; X, Y: Integer; State: TDragState; var Accept: Boolean);
|
---|
| 3789 | var
|
---|
| 3790 | AnItem: TORTreeNode;
|
---|
| 3791 | begin
|
---|
| 3792 | Accept := False;
|
---|
| 3793 | if not uIDNotesActive then exit;
|
---|
| 3794 | AnItem := TORTreeNode(tvNotes.GetNodeAt(X, Y));
|
---|
| 3795 | if (AnItem = nil) or (AnItem.ImageIndex in [IMG_GROUP_OPEN, IMG_GROUP_SHUT, IMG_TOP_LEVEL]) then Exit;
|
---|
| 3796 | with tvNotes.Selected do
|
---|
| 3797 | if (ImageIndex in [IMG_SINGLE, IMG_PARENT, IMG_ID_CHILD, IMG_ID_CHILD_ADD]) then
|
---|
| 3798 | Accept := (AnItem.ImageIndex in [IMG_SINGLE, IMG_PARENT,
|
---|
| 3799 | IMG_IDNOTE_OPEN, IMG_IDNOTE_SHUT,
|
---|
| 3800 | IMG_IDPAR_ADDENDA_OPEN, IMG_IDPAR_ADDENDA_SHUT])
|
---|
| 3801 | else if (ImageIndex in [IMG_IDNOTE_OPEN, IMG_IDNOTE_SHUT, IMG_IDPAR_ADDENDA_OPEN, IMG_IDPAR_ADDENDA_SHUT]) then
|
---|
| 3802 | Accept := (AnItem.ImageIndex in [IMG_GROUP_OPEN, IMG_GROUP_SHUT, IMG_TOP_LEVEL])
|
---|
| 3803 | else if (ImageIndex in [IMG_ADDENDUM, IMG_GROUP_OPEN, IMG_GROUP_SHUT, IMG_TOP_LEVEL]) then
|
---|
| 3804 | Accept := False;
|
---|
| 3805 | end;
|
---|
| 3806 |
|
---|
| 3807 | procedure TfrmNotes.tvNotesDragDrop(Sender, Source: TObject; X, Y: Integer);
|
---|
| 3808 | var
|
---|
| 3809 | HT: THitTests;
|
---|
| 3810 | Saved: boolean;
|
---|
| 3811 | ADestNode: TORTreeNode;
|
---|
| 3812 | begin
|
---|
| 3813 | if not uIDNotesActive then
|
---|
| 3814 | begin
|
---|
| 3815 | CancelDrag;
|
---|
| 3816 | exit;
|
---|
| 3817 | end;
|
---|
| 3818 | if tvNotes.Selected = nil then exit;
|
---|
| 3819 | if EditingIndex <> -1 then
|
---|
| 3820 | begin
|
---|
| 3821 | SaveCurrentNote(Saved);
|
---|
| 3822 | if not Saved then Exit;
|
---|
| 3823 | end;
|
---|
| 3824 | HT := tvNotes.GetHitTestInfoAt(X, Y);
|
---|
| 3825 | ADestNode := TORTreeNode(tvNotes.GetNodeAt(X, Y));
|
---|
| 3826 | DoAttachIDChild(TORTreeNode(tvNotes.Selected), ADestNode);
|
---|
| 3827 | end;
|
---|
| 3828 |
|
---|
| 3829 | procedure TfrmNotes.tvNotesStartDrag(Sender: TObject; var DragObject: TDragObject);
|
---|
| 3830 | //const
|
---|
| 3831 | //TX_CAP_NO_DRAG = 'Item cannot be moved'; <-- original line. //kt 7/19/2007
|
---|
| 3832 | //TX_NO_EDIT_DRAG = 'Items can not be dragged while a note is being edited.'; <-- original line. //kt 7/19/2007
|
---|
| 3833 | var
|
---|
| 3834 | WhyNot: string;
|
---|
| 3835 | //Saved: boolean;
|
---|
| 3836 | TX_CAP_NO_DRAG : string; //kt
|
---|
| 3837 | TX_NO_EDIT_DRAG : string; //kt
|
---|
| 3838 | begin
|
---|
| 3839 | TX_CAP_NO_DRAG := DKLangConstW('fNotes_Item_cannot_be_moved'); //kt added 7/19/2007
|
---|
| 3840 | TX_NO_EDIT_DRAG := DKLangConstW('fNotes_Items_can_not_be_dragged_while_a_note_is_being_editedx'); //kt added 7/19/2007
|
---|
| 3841 | if EditingIndex <> -1 then
|
---|
| 3842 | begin
|
---|
| 3843 | InfoBox(TX_NO_EDIT_DRAG, TX_CAP_NO_DRAG, MB_ICONERROR or MB_OK);
|
---|
| 3844 | CancelDrag;
|
---|
| 3845 | Exit;
|
---|
| 3846 | end;
|
---|
| 3847 | if (tvNotes.Selected.ImageIndex in [IMG_ADDENDUM, IMG_GROUP_OPEN, IMG_GROUP_SHUT, IMG_TOP_LEVEL]) or
|
---|
| 3848 | (not uIDNotesActive) or
|
---|
| 3849 | (lstNotes.ItemIEN = 0) then
|
---|
| 3850 | begin
|
---|
| 3851 | CancelDrag;
|
---|
| 3852 | Exit;
|
---|
| 3853 | end;
|
---|
| 3854 | (* if EditingIndex <> -1 then
|
---|
| 3855 | begin
|
---|
| 3856 | SaveCurrentNote(Saved);
|
---|
| 3857 | if not Saved then Exit;
|
---|
| 3858 | end;*)
|
---|
| 3859 | if not CanBeAttached(PDocTreeObject(tvNotes.Selected.Data)^.DocID, WhyNot) then
|
---|
| 3860 | begin
|
---|
| 3861 | InfoBox(WhyNot, TX_CAP_NO_DRAG, MB_OK);
|
---|
| 3862 | CancelDrag;
|
---|
| 3863 | end;
|
---|
| 3864 | end;
|
---|
| 3865 |
|
---|
| 3866 | //===================== Listview events =================================
|
---|
| 3867 |
|
---|
| 3868 | procedure TfrmNotes.lvNotesColumnClick(Sender: TObject; Column: TListColumn);
|
---|
| 3869 | var
|
---|
| 3870 | i, ClickedColumn: Integer;
|
---|
| 3871 | begin
|
---|
| 3872 | if Column.Index = 0 then ClickedColumn := 5 else ClickedColumn := Column.Index;
|
---|
| 3873 | if ClickedColumn = ColumnToSort then
|
---|
| 3874 | ColumnSortForward := not ColumnSortForward
|
---|
| 3875 | else
|
---|
| 3876 | ColumnSortForward := True;
|
---|
| 3877 | for i := 0 to lvNotes.Columns.Count - 1 do
|
---|
| 3878 | lvNotes.Columns[i].ImageIndex := IMG_NONE;
|
---|
| 3879 | if ColumnSortForward then lvNotes.Columns[Column.Index].ImageIndex := IMG_ASCENDING
|
---|
| 3880 | else lvNotes.Columns[Column.Index].ImageIndex := IMG_DESCENDING;
|
---|
| 3881 | ColumnToSort := ClickedColumn;
|
---|
| 3882 | case ColumnToSort of
|
---|
| 3883 | 5: FCurrentContext.SortBy := 'R';
|
---|
| 3884 | 1: FCurrentContext.SortBy := 'D';
|
---|
| 3885 | 2: FCurrentContext.SortBy := 'S';
|
---|
| 3886 | 3: FCurrentContext.SortBy := 'A';
|
---|
| 3887 | 4: FCurrentContext.SortBy := 'L';
|
---|
| 3888 | else
|
---|
| 3889 | FCurrentContext.SortBy := 'R';
|
---|
| 3890 | end;
|
---|
| 3891 | FCurrentContext.ListAscending := ColumnSortForward;
|
---|
| 3892 | (Sender as TCustomListView).AlphaSort;
|
---|
| 3893 | //with lvNotes do if Selected <> nil then Scroll(0, Selected.Top - TopItem.Top);
|
---|
| 3894 | end;
|
---|
| 3895 |
|
---|
| 3896 | procedure TfrmNotes.lvNotesCompare(Sender: TObject; Item1, Item2: TListItem; Data: Integer; var Compare: Integer);
|
---|
| 3897 | var
|
---|
| 3898 | ix: Integer;
|
---|
| 3899 | begin
|
---|
| 3900 | if ColumnToSort = 0 then
|
---|
| 3901 | Compare := CompareText(Item1.Caption,Item2.Caption)
|
---|
| 3902 | else begin
|
---|
| 3903 | ix := ColumnToSort - 1;
|
---|
| 3904 | Compare := CompareText(Item1.SubItems[ix],Item2.SubItems[ix]);
|
---|
| 3905 | end;
|
---|
| 3906 | if not ColumnSortForward then Compare := -Compare;
|
---|
| 3907 | end;
|
---|
| 3908 |
|
---|
| 3909 | procedure TfrmNotes.lvNotesSelectItem(Sender: TObject; Item: TListItem;
|
---|
| 3910 | Selected: Boolean);
|
---|
| 3911 | begin
|
---|
| 3912 | if uChanging or (not Selected) then Exit;
|
---|
| 3913 | with lvNotes do
|
---|
| 3914 | begin
|
---|
| 3915 | // StatusText('Retrieving selected progress note...'); <-- original line. //kt 7/19/2007
|
---|
| 3916 | StatusText(DKLangConstW('fNotes_Retrieving_selected_progress_notexxx')); //kt added 7/19/2007
|
---|
| 3917 | lstNotes.SelectByID(Item.SubItems[5]);
|
---|
| 3918 | lstNotesClick(Self);
|
---|
[541] | 3919 | if (vmHTML in FViewMode) then begin //kt 8/09
|
---|
| 3920 | SendMessage(HTMLViewer.Handle, WM_VSCROLL, SB_TOP, 0); //kt 8/09
|
---|
| 3921 | end else begin //kt 8/09
|
---|
| 3922 | SendMessage(memNote.Handle, WM_VSCROLL, SB_TOP, 0);
|
---|
| 3923 | end; //kt 8/09
|
---|
[453] | 3924 | end;
|
---|
| 3925 | end;
|
---|
| 3926 |
|
---|
| 3927 | procedure TfrmNotes.lvNotesResize(Sender: TObject);
|
---|
| 3928 | begin
|
---|
| 3929 | inherited;
|
---|
| 3930 | with lvNotes do
|
---|
| 3931 | begin
|
---|
| 3932 | if not FCurrentContext.ShowSubject then
|
---|
| 3933 | begin
|
---|
| 3934 | Columns[1].Width := 2 * (Width div 5);
|
---|
| 3935 | Columns[2].Width := 0;
|
---|
| 3936 | end
|
---|
| 3937 | else
|
---|
| 3938 | begin
|
---|
| 3939 | Columns[1].Width := Width div 5;
|
---|
| 3940 | Columns[2].Width := Columns[1].Width;
|
---|
| 3941 | end;
|
---|
| 3942 | end;
|
---|
| 3943 | end;
|
---|
| 3944 |
|
---|
| 3945 | procedure TfrmNotes.EnableDisableIDNotes;
|
---|
| 3946 | begin
|
---|
| 3947 | uIDNotesActive := IDNotesInstalled;
|
---|
| 3948 | mnuActDetachFromIDParent.Visible := uIDNotesActive;
|
---|
| 3949 | popNoteListDetachFromIDParent.Visible := uIDNotesActive;
|
---|
| 3950 | mnuActAddIDEntry.Visible := uIDNotesActive;
|
---|
| 3951 | popNoteListAddIDEntry.Visible := uIDNotesActive;
|
---|
| 3952 | mnuActAttachtoIDParent.Visible := uIDNotesActive;
|
---|
| 3953 | popNoteListAttachtoIDParent.Visible := uIDNotesActive;
|
---|
| 3954 | if uIDNotesActive then
|
---|
| 3955 | tvNotes.DragMode := dmAutomatic
|
---|
| 3956 | else
|
---|
| 3957 | tvNotes.DragMode := dmManual;
|
---|
| 3958 | end;
|
---|
| 3959 |
|
---|
| 3960 | procedure TfrmNotes.ShowPCEButtons(Editing: boolean);
|
---|
| 3961 | begin
|
---|
| 3962 | if frmFrame.Timedout then Exit;
|
---|
| 3963 |
|
---|
| 3964 | FEditingNotePCEObj := Editing;
|
---|
| 3965 | if Editing or AnytimeEncounters then
|
---|
| 3966 | begin
|
---|
| 3967 | cmdPCE.Visible := TRUE;
|
---|
| 3968 | if Editing then
|
---|
| 3969 | begin
|
---|
| 3970 | cmdPCE.Enabled := CanEditPCE(uPCEEdit);
|
---|
| 3971 | cmdNewNote.Visible := AnytimeEncounters;
|
---|
| 3972 | cmdNewNote.Enabled := FALSE;
|
---|
| 3973 | end
|
---|
| 3974 | else
|
---|
| 3975 | begin
|
---|
| 3976 | cmdPCE.Enabled := (GetAskPCE(0) <> apDisable);
|
---|
| 3977 | cmdNewNote.Visible := TRUE;
|
---|
| 3978 | cmdNewNote.Enabled := (FStarting = False); //TRUE;
|
---|
| 3979 | end;
|
---|
| 3980 | if cmdNewNote.Visible then
|
---|
| 3981 | cmdPCE.Top := cmdNewNote.Top-cmdPCE.Height;
|
---|
| 3982 | end
|
---|
| 3983 | else
|
---|
| 3984 | begin
|
---|
| 3985 | cmdPCE.Enabled := FALSE;
|
---|
| 3986 | cmdPCE.Visible := FALSE;
|
---|
| 3987 | cmdNewNote.Visible := TRUE;
|
---|
| 3988 | cmdNewNote.Enabled := (FStarting = False); //TRUE;
|
---|
| 3989 | end;
|
---|
| 3990 | if cmdPCE.Visible then
|
---|
| 3991 | lblSpace1.Top := cmdPCE.Top - lblSpace1.Height
|
---|
| 3992 | else
|
---|
| 3993 | lblSpace1.Top := cmdNewNote.Top - lblSpace1.Height;
|
---|
| 3994 | popNoteMemoEncounter.Enabled := cmdPCE.Enabled;
|
---|
| 3995 | popNoteMemoEncounter.Visible := cmdPCE.Visible;
|
---|
| 3996 | end;
|
---|
| 3997 |
|
---|
| 3998 | procedure TfrmNotes.mnuIconLegendClick(Sender: TObject);
|
---|
| 3999 | begin
|
---|
| 4000 | inherited;
|
---|
| 4001 | ShowIconLegend(ilNotes);
|
---|
| 4002 | end;
|
---|
| 4003 |
|
---|
| 4004 | procedure TfrmNotes.mnuActAttachtoIDParentClick(Sender: TObject);
|
---|
| 4005 | var
|
---|
| 4006 | AChildNode: TORTreeNode;
|
---|
| 4007 | AParentID: string;
|
---|
| 4008 | SavedDocID: string;
|
---|
| 4009 | Saved: boolean;
|
---|
| 4010 | begin
|
---|
| 4011 | inherited;
|
---|
| 4012 | if not uIDNotesActive then exit;
|
---|
| 4013 | if lstNotes.ItemIEN = 0 then exit;
|
---|
| 4014 | SavedDocID := lstNotes.ItemID;
|
---|
| 4015 | if EditingIndex <> -1 then
|
---|
| 4016 | begin
|
---|
| 4017 | SaveCurrentNote(Saved);
|
---|
| 4018 | if not Saved then Exit;
|
---|
| 4019 | LoadNotes;
|
---|
| 4020 | with tvNotes do Selected := FindPieceNode(SavedDocID, U, Items.GetFirstNode);
|
---|
| 4021 | end;
|
---|
| 4022 | if tvNotes.Selected = nil then exit;
|
---|
| 4023 | AChildNode := TORTreeNode(tvNotes.Selected);
|
---|
| 4024 | AParentID := SelectParentNodeFromList(tvNotes);
|
---|
| 4025 | if AParentID = '' then exit;
|
---|
| 4026 | with tvNotes do Selected := FindPieceNode(AParentID, 1, U, Items.GetFirstNode);
|
---|
| 4027 | DoAttachIDChild(AChildNode, TORTreeNode(tvNotes.Selected));
|
---|
| 4028 | end;
|
---|
| 4029 |
|
---|
| 4030 | procedure TfrmNotes.DoAttachIDChild(AChild, AParent: TORTreeNode);
|
---|
| 4031 | //const
|
---|
| 4032 | //TX_ATTACH_CNF = 'Confirm Attachment'; <-- original line. //kt 7/19/2007
|
---|
| 4033 | //TX_ATTACH_FAILURE = 'Attachment failed'; <-- original line. //kt 7/19/2007
|
---|
| 4034 | var
|
---|
| 4035 | ErrMsg, WhyNot: string;
|
---|
| 4036 | SavedDocID: string;
|
---|
| 4037 | TX_ATTACH_CNF : string; //kt
|
---|
| 4038 | TX_ATTACH_FAILURE : string; //kt
|
---|
| 4039 | begin
|
---|
| 4040 | SetupVars; //kt added 7/19/2007 to replace constants with vars.
|
---|
| 4041 | TX_ATTACH_CNF := DKLangConstW('fNotes_Confirm_Attachment'); //kt added 7/19/2007
|
---|
| 4042 | TX_ATTACH_FAILURE := DKLangConstW('fNotes_Attachment_failed'); //kt added 7/19/2007
|
---|
| 4043 | if (AChild = nil) or (AParent = nil) then exit;
|
---|
| 4044 | ErrMsg := '';
|
---|
| 4045 | if not CanBeAttached(PDocTreeObject(AChild.Data)^.DocID, WhyNot) then
|
---|
| 4046 | ErrMsg := ErrMsg + WhyNot + CRLF + CRLF;
|
---|
| 4047 | if not CanReceiveAttachment(PDocTreeObject(AParent.Data)^.DocID, WhyNot) then
|
---|
| 4048 | ErrMsg := ErrMsg + WhyNot;
|
---|
| 4049 | if ErrMsg <> '' then
|
---|
| 4050 | begin
|
---|
| 4051 | InfoBox(ErrMsg, TX_ATTACH_FAILURE, MB_OK);
|
---|
| 4052 | Exit;
|
---|
| 4053 | end
|
---|
| 4054 | else
|
---|
| 4055 | begin
|
---|
| 4056 | WhyNot := '';
|
---|
| 4057 | if (InfoBox('ATTACH: ' + AChild.Text + CRLF + CRLF +
|
---|
| 4058 | ' TO: ' + AParent.Text + CRLF + CRLF +
|
---|
| 4059 | // 'Are you sure?', TX_ATTACH_CNF, MB_YESNO or MB_DEFBUTTON2 or MB_ICONQUESTION) <> IDYES) <-- original line. //kt 7/19/2007
|
---|
| 4060 | DKLangConstW('fNotes_Are_you_surex'), TX_ATTACH_CNF, MB_YESNO or MB_DEFBUTTON2 or MB_ICONQUESTION) <> IDYES) //kt added 7/19/2007
|
---|
| 4061 | then Exit;
|
---|
| 4062 | SavedDocID := PDocTreeObject(AParent.Data)^.DocID;
|
---|
| 4063 | end;
|
---|
| 4064 | if AChild.ImageIndex in [IMG_ID_CHILD, IMG_ID_CHILD_ADD] then
|
---|
| 4065 | begin
|
---|
| 4066 | if DetachEntryFromParent(PDocTreeObject(AChild.Data)^.DocID, WhyNot) then
|
---|
| 4067 | begin
|
---|
| 4068 | if AttachEntryToParent(PDocTreeObject(AChild.Data)^.DocID, PDocTreeObject(AParent.Data)^.DocID, WhyNot) then
|
---|
| 4069 | begin
|
---|
| 4070 | LoadNotes;
|
---|
| 4071 | with tvNotes do Selected := FindPieceNode(SavedDocID, U, Items.GetFirstNode);
|
---|
| 4072 | if tvNotes.Selected <> nil then tvNotes.Selected.Expand(False);
|
---|
| 4073 | end
|
---|
| 4074 | else
|
---|
| 4075 | InfoBox(WhyNot, TX_ATTACH_FAILURE, MB_OK);
|
---|
| 4076 | end
|
---|
| 4077 | else
|
---|
| 4078 | begin
|
---|
| 4079 | WhyNot := StringReplace(WhyNot, 'ATTACH', 'DETACH', [rfIgnoreCase]);
|
---|
| 4080 | WhyNot := StringReplace(WhyNot, 'to an ID', 'from an ID', [rfIgnoreCase]);
|
---|
| 4081 | InfoBox(WhyNot, TX_DETACH_FAILURE, MB_OK);
|
---|
| 4082 | Exit;
|
---|
| 4083 | end;
|
---|
| 4084 | end
|
---|
| 4085 | else
|
---|
| 4086 | begin
|
---|
| 4087 | if AttachEntryToParent(PDocTreeObject(AChild.Data)^.DocID, PDocTreeObject(AParent.Data)^.DocID, WhyNot) then
|
---|
| 4088 | begin
|
---|
| 4089 | LoadNotes;
|
---|
| 4090 | with tvNotes do Selected := FindPieceNode(SavedDocID, U, Items.GetFirstNode);
|
---|
| 4091 | if tvNotes.Selected <> nil then tvNotes.Selected.Expand(False);
|
---|
| 4092 | end
|
---|
| 4093 | else
|
---|
| 4094 | InfoBox(WhyNot, TX_ATTACH_FAILURE, MB_OK);
|
---|
| 4095 | end;
|
---|
| 4096 | end;
|
---|
| 4097 |
|
---|
| 4098 | function TfrmNotes.SetNoteTreeLabel(AContext: TTIUContext): string;
|
---|
| 4099 | var
|
---|
| 4100 | x: string;
|
---|
| 4101 |
|
---|
| 4102 | function SetDateRangeText(AContext: TTIUContext): string;
|
---|
| 4103 | var
|
---|
| 4104 | x1: string;
|
---|
| 4105 | begin
|
---|
| 4106 | with AContext do
|
---|
| 4107 | if BeginDate <> '' then
|
---|
| 4108 | begin
|
---|
| 4109 | x1 := ' from ' + UpperCase(BeginDate);
|
---|
| 4110 | // if EndDate <> '' then x1 := x1 + ' to ' + UpperCase(EndDate) <-- original line. //kt 7/19/2007
|
---|
| 4111 | if EndDate <> '' then x1 := x1 + DKLangConstW('fNotes_to') + UpperCase(EndDate) //kt added 7/19/2007
|
---|
| 4112 | else x1 := x1 + ' to TODAY';
|
---|
| 4113 | end;
|
---|
| 4114 | Result := x1;
|
---|
| 4115 | end;
|
---|
| 4116 |
|
---|
| 4117 | begin
|
---|
| 4118 | with AContext do
|
---|
| 4119 | begin
|
---|
| 4120 | // if MaxDocs > 0 then x := 'Last ' + IntToStr(MaxDocs) + ' ' else x := 'All '; <-- original line. //kt 7/19/2007
|
---|
| 4121 | if MaxDocs > 0 then x := DKLangConstW('fNotes_Last') + IntToStr(MaxDocs) + ' ' else x := DKLangConstW('fNotes_All'); //kt added 7/19/2007
|
---|
| 4122 | case StrToIntDef(Status, 0) of
|
---|
| 4123 | // NC_ALL : x := x + 'Signed Notes'; <-- original line. //kt 7/19/2007
|
---|
| 4124 | NC_ALL : x := x + DKLangConstW('fNotes_Signed_Notes'); //kt added 7/19/2007
|
---|
| 4125 | NC_UNSIGNED : begin
|
---|
| 4126 | // x := x + 'Unsigned Notes for '; <-- original line. //kt 7/19/2007
|
---|
| 4127 | x := x + DKLangConstW('fNotes_Unsigned_Notes_for'); //kt added 7/19/2007
|
---|
| 4128 | if Author > 0 then x := x + ExternalName(Author, 200)
|
---|
| 4129 | else x := x + User.Name;
|
---|
| 4130 | x := x + SetDateRangeText(AContext);
|
---|
| 4131 | end;
|
---|
| 4132 | NC_UNCOSIGNED : begin
|
---|
| 4133 | // x := x + 'Uncosigned Notes for '; <-- original line. //kt 7/19/2007
|
---|
| 4134 | x := x + DKLangConstW('fNotes_Uncosigned_Notes_for'); //kt added 7/19/2007
|
---|
| 4135 | if Author > 0 then x := x + ExternalName(Author, 200)
|
---|
| 4136 | else x := x + User.Name;
|
---|
| 4137 | x := x + SetDateRangeText(AContext);
|
---|
| 4138 | end;
|
---|
| 4139 | // NC_BY_AUTHOR : x := x + 'Signed Notes for ' + ExternalName(Author, 200) + SetDateRangeText(AContext); <-- original line. //kt 7/19/2007
|
---|
| 4140 | NC_BY_AUTHOR : x := x + DKLangConstW('fNotes_Signed_Notes_for') + ExternalName(Author, 200) + SetDateRangeText(AContext); //kt added 7/19/2007
|
---|
| 4141 | // NC_BY_DATE : x := x + 'Signed Notes ' + SetDateRangeText(AContext); <-- original line. //kt 7/19/2007
|
---|
| 4142 | NC_BY_DATE : x := x + DKLangConstW('fNotes_Signed_Notes') + SetDateRangeText(AContext); //kt added 7/19/2007
|
---|
| 4143 | else
|
---|
| 4144 | // x := 'Custom List'; <-- original line. //kt 7/19/2007
|
---|
| 4145 | x := DKLangConstW('fNotes_Custom_List'); //kt added 7/19/2007
|
---|
| 4146 | end;
|
---|
| 4147 | end;
|
---|
| 4148 | Result := x;
|
---|
| 4149 | end;
|
---|
| 4150 |
|
---|
| 4151 | procedure TfrmNotes.memNewNoteKeyDown(Sender: TObject; var Key: Word;
|
---|
| 4152 | Shift: TShiftState);
|
---|
| 4153 | begin
|
---|
| 4154 | inherited;
|
---|
| 4155 | FNavigatingTab := (Key = VK_TAB) and ([ssShift,ssCtrl] * Shift <> []);
|
---|
| 4156 | if FNavigatingTab then
|
---|
| 4157 | Key := 0;
|
---|
| 4158 | end;
|
---|
| 4159 |
|
---|
| 4160 | procedure TfrmNotes.UpdateNoteAuthor(DocInfo: string);
|
---|
| 4161 | //const
|
---|
| 4162 | //TX_INVALID_AUTHOR1 = 'The author returned by the template ('; <-- original line. //kt 7/19/2007
|
---|
| 4163 | //TX_INVALID_AUTHOR2 = ') is not valid.' + #13#10 + 'The note''s author will remain as '; <-- original line. //kt 7/19/2007
|
---|
| 4164 | //TC_INVALID_AUTHOR = 'Invalid Author'; <-- original line. //kt 7/19/2007
|
---|
| 4165 | //TX_COSIGNER_REQD = ' requires a cosigner for this note.'; <-- original line. //kt 7/19/2007
|
---|
| 4166 | //TC_COSIGNER_REQD = 'Cosigner Required'; <-- original line. //kt 7/19/2007
|
---|
| 4167 | var
|
---|
| 4168 | NewAuth, NewAuthName, AuthNameCheck, x: string;
|
---|
| 4169 | ADummySender: TObject;
|
---|
| 4170 | TX_INVALID_AUTHOR1 : string; //kt
|
---|
| 4171 | TX_INVALID_AUTHOR2 : string; //kt
|
---|
| 4172 | TC_INVALID_AUTHOR : string; //kt
|
---|
| 4173 | TX_COSIGNER_REQD : string; //kt
|
---|
| 4174 | TC_COSIGNER_REQD : string; //kt
|
---|
| 4175 | begin
|
---|
| 4176 | TX_INVALID_AUTHOR1 := DKLangConstW('fNotes_The_author_returned_by_the_template_x'); //kt added 7/19/2007
|
---|
| 4177 | TX_INVALID_AUTHOR2 := DKLangConstW('fNotes_x_is_not_validx') + #13#10 + DKLangConstW('fNotes_The_notexxs_author_will_remain_as'); //kt added 7/19/2007
|
---|
| 4178 | TC_INVALID_AUTHOR := DKLangConstW('fNotes_Invalid_Author'); //kt added 7/19/2007
|
---|
| 4179 | TX_COSIGNER_REQD := DKLangConstW('fNotes_requires_a_cosigner_for_this_notex'); //kt added 7/19/2007
|
---|
| 4180 | TC_COSIGNER_REQD := DKLangConstW('fNotes_Cosigner_Required'); //kt added 7/19/2007
|
---|
| 4181 | SetupVars; //kt added 7/19/2007 to replace constants with vars.
|
---|
| 4182 | if DocInfo = '' then Exit;
|
---|
| 4183 | NewAuth := GetXMLParamReturnValueTIU(DocInfo, 'AUTHOR_IEN');
|
---|
| 4184 | if NewAuth = '' then Exit;
|
---|
| 4185 | AuthNameCheck := ExternalName(StrToInt64Def(NewAuth, 0), 200);
|
---|
| 4186 | if AuthNameCheck = '' then
|
---|
| 4187 | begin
|
---|
| 4188 | NewAuthName := GetXMLParamReturnValueTIU(DocInfo, 'AUTHOR_NAME');
|
---|
| 4189 | InfoBox(TX_INVALID_AUTHOR1 + UpperCase(NewAuthName) + TX_INVALID_AUTHOR2 + UpperCase(FEditNote.AuthorName),
|
---|
| 4190 | TC_INVALID_AUTHOR, MB_OK and MB_ICONERROR);
|
---|
| 4191 | Exit;
|
---|
| 4192 | end;
|
---|
| 4193 | with FEditNote do if StrToInt64Def(NewAuth, 0) <> Author then
|
---|
| 4194 | begin
|
---|
| 4195 | Author := StrToInt64Def(NewAuth, 0);
|
---|
| 4196 | AuthorName := AuthNameCheck;
|
---|
| 4197 | x := lstNotes.Items[EditingIndex];
|
---|
| 4198 | SetPiece(x, U, 5, NewAuth + ';' + AuthNameCheck);
|
---|
| 4199 | lstNotes.Items[EditingIndex] := x;
|
---|
| 4200 | if AskCosignerForTitle(Title, Author, DateTime) then
|
---|
| 4201 | begin
|
---|
| 4202 | InfoBox(UpperCase(AuthNameCheck) + TX_COSIGNER_REQD, TC_COSIGNER_REQD, MB_OK);
|
---|
| 4203 | //Cosigner := 0; CosignerName := ''; // not sure about this yet
|
---|
| 4204 | ADummySender := TObject.Create;
|
---|
| 4205 | try
|
---|
| 4206 | cmdChangeClick(ADummySender);
|
---|
| 4207 | finally
|
---|
| 4208 | FreeAndNil(ADummySender);
|
---|
| 4209 | end;
|
---|
| 4210 | end
|
---|
| 4211 | else cmdChangeClick(Self);
|
---|
| 4212 | end;
|
---|
| 4213 | end;
|
---|
| 4214 |
|
---|
| 4215 | procedure TfrmNotes.sptHorzCanResize(Sender: TObject; var NewSize: Integer;
|
---|
| 4216 | var Accept: Boolean);
|
---|
| 4217 | begin
|
---|
| 4218 | inherited;
|
---|
| 4219 | if pnlWrite.Visible then
|
---|
| 4220 | if NewSize > frmNotes.ClientWidth - memNewNote.Constraints.MinWidth - sptHorz.Width then
|
---|
| 4221 | NewSize := frmNotes.ClientWidth - memNewNote.Constraints.MinWidth - sptHorz.Width;
|
---|
| 4222 | end;
|
---|
| 4223 |
|
---|
[541] | 4224 | (*
|
---|
[453] | 4225 | //kt 5-2-05 added following function (initially copied from fReports.pas)
|
---|
| 4226 | procedure TfrmNotes.WebBrowser1DocumentComplete(Sender: TObject;
|
---|
| 4227 | const pDisp: IDispatch; var URL: OleVariant);
|
---|
| 4228 | var
|
---|
| 4229 | WebDoc: IHtmlDocument2;
|
---|
| 4230 | v: variant;
|
---|
| 4231 | begin
|
---|
| 4232 | {
|
---|
| 4233 | inherited;
|
---|
| 4234 | if uHTMLDoc = '' then Exit;
|
---|
| 4235 | if not(uReportType = 'H') then Exit; //this can be removed if & when browser replaces memtext control
|
---|
| 4236 | if not Assigned(WebBrowser1.Document) then Exit;
|
---|
| 4237 | WebDoc := WebBrowser1.Document as IHtmlDocument2;
|
---|
| 4238 | v := VarArrayCreate([0, 0], varVariant);
|
---|
| 4239 | v[0] := uHTMLDoc;
|
---|
| 4240 | WebDoc.write(PSafeArray(TVarData(v).VArray));
|
---|
| 4241 | WebDoc.close;
|
---|
| 4242 | //uHTMLDoc := '';
|
---|
| 4243 | }
|
---|
| 4244 | end;
|
---|
[541] | 4245 | *)
|
---|
[453] | 4246 |
|
---|
| 4247 | procedure TfrmNotes.popNoteMemoInsTemplateClick(Sender: TObject);
|
---|
| 4248 | begin
|
---|
| 4249 | frmDrawers.mnuInsertTemplateClick(Sender);
|
---|
| 4250 | end;
|
---|
| 4251 |
|
---|
| 4252 | procedure TfrmNotes.popNoteMemoPreviewClick(Sender: TObject);
|
---|
| 4253 | begin
|
---|
| 4254 | frmDrawers.mnuPreviewTemplateClick(Sender);
|
---|
| 4255 | end;
|
---|
| 4256 |
|
---|
| 4257 | procedure TfrmNotes.tvNotesAddition(Sender: TObject; Node: TTreeNode);
|
---|
| 4258 | begin
|
---|
| 4259 | inherited;
|
---|
| 4260 | TAccessibleTreeNode.WrapControl(Node as TORTreeNode);
|
---|
| 4261 | end;
|
---|
| 4262 |
|
---|
| 4263 | procedure TfrmNotes.tvNotesDeletion(Sender: TObject; Node: TTreeNode);
|
---|
| 4264 | begin
|
---|
| 4265 | TAccessibleTreeNode.UnwrapControl(Node as TORTreeNode);
|
---|
| 4266 | inherited;
|
---|
| 4267 | end;
|
---|
| 4268 |
|
---|
| 4269 | {Tab Order tricks. Need to change
|
---|
| 4270 | tvNotes
|
---|
| 4271 |
|
---|
| 4272 | frmDrawers.pnlTemplateButton
|
---|
| 4273 | frmDrawers.pnlEncounterButton
|
---|
| 4274 | cmdNewNote
|
---|
| 4275 | cmdPCE
|
---|
| 4276 |
|
---|
| 4277 | lvNotes
|
---|
| 4278 | memNote
|
---|
| 4279 |
|
---|
| 4280 | to
|
---|
| 4281 | tvNotes
|
---|
| 4282 |
|
---|
| 4283 | lvNotes
|
---|
| 4284 | memNote
|
---|
| 4285 |
|
---|
| 4286 | frmDrawers.pnlTemplateButton
|
---|
| 4287 | frmDrawers.pnlEncounterButton
|
---|
| 4288 | cmdNewNote
|
---|
| 4289 | cmdPCE
|
---|
| 4290 | }
|
---|
| 4291 |
|
---|
| 4292 | procedure TfrmNotes.tvNotesExit(Sender: TObject);
|
---|
| 4293 | begin
|
---|
| 4294 | if IncSecond(FMousing,1) < Now then
|
---|
| 4295 | begin
|
---|
| 4296 | if (Screen.ActiveControl = frmDrawers.pnlTemplatesButton) or
|
---|
| 4297 | (Screen.ActiveControl = frmDrawers.pnlEncounterButton) or
|
---|
| 4298 | (Screen.ActiveControl = cmdNewNote) or
|
---|
| 4299 | (Screen.ActiveControl = cmdPCE) then
|
---|
| 4300 | FindNextControl( cmdPCE, True, True, False).SetFocus;
|
---|
| 4301 | end;
|
---|
| 4302 | FMousing := 0;
|
---|
| 4303 | end;
|
---|
| 4304 |
|
---|
| 4305 | procedure TfrmNotes.pnlReadExit(Sender: TObject);
|
---|
| 4306 | begin
|
---|
| 4307 | inherited;
|
---|
| 4308 | if IncSecond(FMousing,1) < Now then
|
---|
| 4309 | begin
|
---|
| 4310 | if (Screen.ActiveControl = frmFrame.pnlPatient) then
|
---|
| 4311 | FindNextControl( tvNotes, True, True, False).SetFocus
|
---|
| 4312 | else
|
---|
| 4313 | if (Screen.ActiveControl = frmDrawers.pnlTemplatesButton) or
|
---|
| 4314 | (Screen.ActiveControl = frmDrawers.pnlEncounterButton) or
|
---|
| 4315 | (Screen.ActiveControl = cmdNewNote) or
|
---|
| 4316 | (Screen.ActiveControl = cmdPCE) then
|
---|
| 4317 | FindNextControl( frmDrawers.pnlTemplatesButton, False, True, False).SetFocus;
|
---|
| 4318 | end;
|
---|
| 4319 | FMousing := 0;
|
---|
| 4320 | end;
|
---|
| 4321 |
|
---|
| 4322 | procedure TfrmNotes.cmdNewNoteExit(Sender: TObject);
|
---|
| 4323 | begin
|
---|
| 4324 | inherited;
|
---|
| 4325 | if IncSecond(FMousing,1) < Now then
|
---|
| 4326 | begin
|
---|
| 4327 | if (Screen.ActiveControl = lvNotes) or
|
---|
| 4328 | (Screen.ActiveControl = memNote) then
|
---|
| 4329 | frmFrame.pnlPatient.SetFocus
|
---|
| 4330 | else
|
---|
| 4331 | if (Screen.ActiveControl = tvNotes) then
|
---|
| 4332 | FindNextControl( frmFrame.pnlPatient, False, True, False).SetFocus;
|
---|
| 4333 | end;
|
---|
| 4334 | FMousing := 0;
|
---|
| 4335 | end;
|
---|
| 4336 |
|
---|
| 4337 | procedure TfrmNotes.frmFramePnlPatientExit(Sender: TObject);
|
---|
| 4338 | begin
|
---|
| 4339 | FOldFramePnlPatientExit(Sender);
|
---|
| 4340 | if IncSecond(FMousing,1) < Now then
|
---|
| 4341 | begin
|
---|
| 4342 | if (Screen.ActiveControl = lvNotes) or
|
---|
| 4343 | (Screen.ActiveControl = memNote) then
|
---|
| 4344 | FindNextControl( lvNotes, False, True, False).SetFocus;
|
---|
| 4345 | end;
|
---|
| 4346 | FMousing := 0;
|
---|
| 4347 | end;
|
---|
| 4348 |
|
---|
| 4349 | procedure TfrmNotes.FormHide(Sender: TObject);
|
---|
| 4350 | begin
|
---|
| 4351 | inherited;
|
---|
| 4352 | frmFrame.pnlPatient.OnExit := FOldFramePnlPatientExit;
|
---|
| 4353 | frmDrawers.pnlTemplatesButton.OnExit := FOldDrawerPnlTemplatesButtonExit;
|
---|
| 4354 | frmDrawers.pnlEncounterButton.OnExit := FOldDrawerPnlEncounterButtonExit;
|
---|
| 4355 | frmDrawers.edtSearch.OnExit := FOldDrawerEdtSearchExit;
|
---|
| 4356 | end;
|
---|
| 4357 |
|
---|
| 4358 | procedure TfrmNotes.FormShow(Sender: TObject);
|
---|
| 4359 | begin
|
---|
| 4360 | inherited;
|
---|
| 4361 | FOldFramePnlPatientExit := frmFrame.pnlPatient.OnExit;
|
---|
| 4362 | frmFrame.pnlPatient.OnExit := frmFramePnlPatientExit;
|
---|
| 4363 | FOldDrawerPnlTemplatesButtonExit := frmDrawers.pnlTemplatesButton.OnExit;
|
---|
| 4364 | frmDrawers.pnlTemplatesButton.OnExit := frmDrawerPnlTemplatesButtonExit;
|
---|
| 4365 | FOldDrawerPnlEncounterButtonExit := frmDrawers.pnlEncounterButton.OnExit;
|
---|
| 4366 | frmDrawers.pnlEncounterButton.OnExit := frmDrawerPnlEncounterButtonExit;
|
---|
| 4367 | FOldDrawerEdtSearchExit := frmDrawers.edtSearch.OnExit;
|
---|
| 4368 | frmDrawers.edtSearch.OnExit := frmDrawerEdtSearchExit;
|
---|
| 4369 | end;
|
---|
| 4370 |
|
---|
| 4371 | procedure TfrmNotes.frmDrawerEdtSearchExit(Sender: TObject);
|
---|
| 4372 | begin
|
---|
| 4373 | FOldDrawerEdtSearchExit(Sender);
|
---|
| 4374 | cmdNewNoteExit(Sender);
|
---|
| 4375 | end;
|
---|
| 4376 |
|
---|
| 4377 | procedure TfrmNotes.frmDrawerPnlTemplatesButtonExit(Sender: TObject);
|
---|
| 4378 | begin
|
---|
| 4379 | FOldDrawerPnlTemplatesButtonExit(Sender);
|
---|
| 4380 | if Boolean(Hi(GetKeyState(VK_TAB))) and (memNewNote.CanFocus) and
|
---|
| 4381 | Boolean(Hi(GetKeyState(VK_SHIFT))) then
|
---|
| 4382 | memNewNote.SetFocus
|
---|
| 4383 | else
|
---|
| 4384 | cmdNewNoteExit(Sender);
|
---|
| 4385 | end;
|
---|
| 4386 |
|
---|
| 4387 | procedure TfrmNotes.frmDrawerPnlEncounterButtonExit(Sender: TObject);
|
---|
| 4388 | begin
|
---|
| 4389 | FOldDrawerPnlEncounterButtonExit(Sender);
|
---|
| 4390 | cmdNewNoteExit(Sender);
|
---|
| 4391 | end;
|
---|
| 4392 |
|
---|
| 4393 | procedure TfrmNotes.FormMouseMove(Sender: TObject; Shift: TShiftState; X,
|
---|
| 4394 | Y: Integer);
|
---|
| 4395 | begin
|
---|
| 4396 | inherited;
|
---|
| 4397 | FMousing := Now;
|
---|
| 4398 | end;
|
---|
| 4399 |
|
---|
[541] | 4400 | procedure TfrmNotes.SetHTMLEditMode(HTMLEditMode : boolean; Quiet : boolean);
|
---|
| 4401 | //kt added function 7/09
|
---|
| 4402 | var Mode : TViewModeSet; //kt
|
---|
| 4403 | const HTML_MODE_S : Array[false..true] of string[16] = ('PLAIN','FORMATTED');
|
---|
| 4404 | begin
|
---|
| 4405 | if FEditNote.Lines = nil then FEditNote.Lines := TStringList.Create; //kt
|
---|
| 4406 | if HTMLEditMode then begin
|
---|
| 4407 | if (FViewMode = [vmHTML,vmEdit]) then exit; //no change needed.
|
---|
| 4408 | FEditNote.Lines.Assign(memNewNote.Lines);
|
---|
| 4409 | end else begin
|
---|
| 4410 | if (FViewMode = [vmText,vmEdit]) then exit; //no change needed.
|
---|
| 4411 | if HtmlEditor.GetTextLen > 0 then begin
|
---|
| 4412 | if MessageDlg('Do you want to convert this note to PLAIN TEXT?'+#10#13+
|
---|
| 4413 | '(May cause loss of formatting information.)',mtWarning, mbOKCancel,0) <> mrOK then begin
|
---|
| 4414 | exit;
|
---|
| 4415 | end;
|
---|
| 4416 | end;
|
---|
| 4417 | FEditNote.Lines.Text := HTMLEditor.Text;
|
---|
| 4418 | end;
|
---|
| 4419 | Mode := [vmEdit] + [vmHTML_MODE[HTMLEditMode]]; //kt
|
---|
| 4420 | SetDisplayToHTMLvsText(Mode,FEditNote.Lines);
|
---|
| 4421 | if not Quiet then begin
|
---|
| 4422 | if MessageDlg('Start new notes in '+HTML_MODE_S[HTMLEditMode]+' TEXT by default?',mtConfirmation,[mbYES,mbNO],0) = mrYES then begin
|
---|
| 4423 | fOptionsNotes.SetDefaultEditHTMLMode(HTMLEditMode);
|
---|
| 4424 | end;
|
---|
| 4425 | end;
|
---|
| 4426 | end;
|
---|
| 4427 |
|
---|
| 4428 | procedure TfrmNotes.ToggleHTMLEditMode;
|
---|
| 4429 | //kt added function 6/09
|
---|
| 4430 | var NewHTMLMode: boolean;
|
---|
| 4431 | begin
|
---|
| 4432 | if not (vmEdit in FViewMode) then exit; //quit if not in edit mode
|
---|
| 4433 | NewHTMLMode := not (vmHTML in FViewMode);
|
---|
| 4434 | SetHTMLEditMode(NewHTMLMode);
|
---|
| 4435 | end;
|
---|
| 4436 |
|
---|
| 4437 |
|
---|
| 4438 | procedure TfrmNotes.SetDisplayToHTMLvsText(Mode : TViewModeSet;
|
---|
| 4439 | Lines : TStrings;
|
---|
| 4440 | ActivateOnly : boolean {default=False});
|
---|
| 4441 | //kt added function 7/09
|
---|
| 4442 | //If ActivateOnly=True, then the visibility is set, but the control is not filled with text.
|
---|
| 4443 |
|
---|
| 4444 | type
|
---|
| 4445 | TPanelVisibilityMode = (pvmReadMode, pvmWriteMode); //kt
|
---|
| 4446 |
|
---|
| 4447 | procedure SetPanelVisibility(Mode: TPanelVisibilityMode; HTMLMode : boolean);
|
---|
| 4448 |
|
---|
| 4449 | procedure SetpnlReadVisibility(Visible : boolean; HTMLMode : boolean);
|
---|
| 4450 | begin
|
---|
| 4451 | pnlRead.Visible := Visible;
|
---|
| 4452 | if Visible then begin
|
---|
| 4453 | memNote.Visible := not HTMLMode;
|
---|
| 4454 | memNote.TabStop := not HTMLMode;
|
---|
| 4455 | pnlHTMLViewer.Visible := HTMLMode;
|
---|
| 4456 | HTMLViewer.Visible := HTMLMode;
|
---|
| 4457 | if HTMLMode then begin
|
---|
| 4458 | HtmlViewer.BringToFront;
|
---|
| 4459 | end else begin
|
---|
| 4460 | MemNote.BringToFront;
|
---|
| 4461 | end;
|
---|
| 4462 | end else begin
|
---|
| 4463 | memNote.Visible := false;
|
---|
| 4464 | memNote.TabStop := false;
|
---|
| 4465 | pnlHTMLViewer.Visible := false;
|
---|
| 4466 | HTMLViewer.Visible := false;
|
---|
| 4467 | end;
|
---|
| 4468 | end; {SetDisplayToHTMLvsText.SetPanelVisibility.SetpnlReadVisibility}
|
---|
| 4469 |
|
---|
| 4470 | procedure SetpnlWriteVisibility(Visible : boolean; HTMLMode : boolean);
|
---|
| 4471 | begin
|
---|
| 4472 | pnlWrite.Visible := Visible;
|
---|
| 4473 | if Visible then begin
|
---|
| 4474 | pnlHTMLWrite.Visible := HTMLMode;
|
---|
| 4475 | pnlHTMLEdit.Visible := HTMLMode;
|
---|
| 4476 | HTMLEditor.Visible := HTMLMode;
|
---|
| 4477 | pnlTextWrite.Visible := not HTMLMode;
|
---|
| 4478 | MemNewNote.Visible := not HTMLMode;
|
---|
| 4479 | if HTMLMode then begin
|
---|
| 4480 | HTMLEditor.BringToFront;
|
---|
| 4481 | end else begin
|
---|
| 4482 | MemNewNote.BringToFront;
|
---|
| 4483 | end;
|
---|
| 4484 | end else begin
|
---|
| 4485 | pnlHTMLWrite.Visible := false;
|
---|
| 4486 | pnlHTMLEdit.Visible := false;
|
---|
| 4487 | HTMLEditor.Visible := false;
|
---|
| 4488 | pnlTextWrite.Visible := false;
|
---|
| 4489 | memNewNote.Visible := false;
|
---|
| 4490 | end;
|
---|
| 4491 | end; {SetDisplayToHTMLvsText.SetPanelVisibility.SetpnlWriteVisibility}
|
---|
| 4492 |
|
---|
| 4493 | begin {SetDisplayToHTMLvsText.SetPanelVisibility}
|
---|
| 4494 | SetpnlReadVisibility ((Mode=pvmReadMode), HTMLMode);
|
---|
| 4495 | SetpnlWriteVisibility((Mode=pvmWriteMode),HTMLMode);
|
---|
| 4496 | Application.ProcessMessages;
|
---|
| 4497 | end; {SetDisplayToHTMLvsText.SetPanelVisibility}
|
---|
| 4498 |
|
---|
| 4499 | procedure SetHTMLorTextEditor(HTMLEditMode : boolean;
|
---|
| 4500 | Lines : TStrings;
|
---|
| 4501 | ActivateOnly : boolean {default=False});
|
---|
| 4502 | procedure ActivateHtmlEditor(Lines : TStrings);
|
---|
| 4503 | var HTMLText : string;
|
---|
| 4504 | begin
|
---|
| 4505 | HtmlEditor.Editable := true;
|
---|
| 4506 | if ActivateOnly=false then begin
|
---|
| 4507 | if Lines <> nil then begin
|
---|
| 4508 | if rHTMLTools.IsHTML(Lines) then begin
|
---|
| 4509 | HTMLText := Lines.Text;
|
---|
| 4510 | end else begin
|
---|
| 4511 | HTMLText := Text2HTML(Lines);
|
---|
| 4512 | if HTMLText='' then HTMLText := ' ';
|
---|
| 4513 | end;
|
---|
| 4514 | end else HTMLText := ' ';
|
---|
| 4515 | HtmlEditor.HTMLText := HTMLText;
|
---|
| 4516 | HTMLEditor.KeyStruck := false;
|
---|
| 4517 | end;
|
---|
| 4518 | end; {SetDisplayToHTMLvsText.SetHTMLorTextEditor.ActivateHtmlEditor}
|
---|
| 4519 |
|
---|
| 4520 | procedure ActiveMemoEditor(Lines : TStrings);
|
---|
| 4521 | begin
|
---|
| 4522 | if ActivateOnly=false then begin
|
---|
| 4523 | memNewNote.Lines.Assign(Lines); //kt new
|
---|
| 4524 | end;
|
---|
| 4525 | //kt HtmlEditor.Active := false; //stop intercepting OnMessages
|
---|
| 4526 | HtmlEditor.Clear;
|
---|
| 4527 | end; {SetDisplayToHTMLvsText.SetHTMLorTextEditor.ActiveMemoEditor}
|
---|
| 4528 |
|
---|
| 4529 | begin {SetDisplayToHTMLvsText.SetHTMLorTextEditor}
|
---|
| 4530 | FHTMLEditMode := emHTML_MODE[HTMLEditMode];
|
---|
| 4531 | FViewMode := [vmEdit] + [vmHTML_MODE[HTMLEditMode]];
|
---|
| 4532 | SetPanelVisibility(pvmWriteMode,HTMLEditMode);
|
---|
| 4533 | pnlRight.Repaint; //kt TEMP
|
---|
| 4534 | if HTMLEditMode then begin
|
---|
| 4535 | ActivateHtmlEditor(Lines);
|
---|
| 4536 | end else begin
|
---|
| 4537 | ActiveMemoEditor(Lines);
|
---|
| 4538 | end;
|
---|
| 4539 | pnlRight.Repaint; //kt TEMP
|
---|
| 4540 | end; {SetDisplayToHTMLvsText.SetHTMLorTextEditor}
|
---|
| 4541 |
|
---|
| 4542 | procedure SetHTMLorTextViewer(HTMLViewMode : boolean;
|
---|
| 4543 | Lines : TStrings;
|
---|
| 4544 | ActivateOnly : boolean); //kt
|
---|
| 4545 | //Set forms such that either HTML Viewer is visible, or standard edit window.
|
---|
| 4546 | procedure ActivateHtmlViewer(Lines : TStrings);
|
---|
| 4547 | begin
|
---|
| 4548 | with frmNotes do begin
|
---|
| 4549 | //ScanForSubs(MemNote.Lines);
|
---|
| 4550 | pnlHtmlViewer.Visible := true;
|
---|
| 4551 | //memNote.Visible := false;
|
---|
| 4552 | //memNote.TabStop := false;
|
---|
| 4553 | HtmlViewer.BringToFront;
|
---|
| 4554 | if ActivateOnly=False then begin
|
---|
| 4555 | FixHTML(Lines);
|
---|
| 4556 | HtmlViewer.HTMLText := Lines.Text;
|
---|
| 4557 | end;
|
---|
| 4558 | HtmlViewer.Editable := false;
|
---|
| 4559 | HtmlViewer.BackgroundColor := clCream;
|
---|
| 4560 | HtmlViewer.TabStop := true;
|
---|
| 4561 | RedrawActivate(HtmlViewer.Handle);
|
---|
| 4562 | end;
|
---|
| 4563 | end; {SetDisplayToHTMLvsText.SetHTMLorTextViewer.ActivateHtmlViewer}
|
---|
| 4564 |
|
---|
| 4565 | procedure ActivateMemoViewer(Lines : TStrings);
|
---|
| 4566 | begin
|
---|
| 4567 | with frmNotes do begin
|
---|
| 4568 | pnlHtmlViewer.Visible := false;
|
---|
| 4569 | HtmlViewer.Clear;
|
---|
| 4570 | //HtmlEditor.Clear; //don't this here. Only clear in ClearEditControls...
|
---|
| 4571 | HtmlViewer.TabStop := false;
|
---|
| 4572 | if ActivateOnly=False then memNote.Lines.Assign(Lines); //new
|
---|
| 4573 | memNote.Visible := true;
|
---|
| 4574 | memNote.TabStop := true;
|
---|
| 4575 | memNote.BringToFront;
|
---|
| 4576 | RedrawActivate(memNote.Handle);
|
---|
| 4577 | end;
|
---|
| 4578 | end; {SetDisplayToHTMLvsText.SetHTMLorTextViewer.ActivateMemoViewer}
|
---|
| 4579 |
|
---|
| 4580 | begin {SetHTMLorTextViewer}
|
---|
| 4581 | FViewMode := [vmView] + [vmHTML_MODE[HTMLViewMode]];
|
---|
| 4582 | SetPanelVisibility(pvmReadMode,HTMLviewMode);
|
---|
| 4583 | //pnlRight.Repaint; //kt TEMP
|
---|
| 4584 | if HTMLViewMode then begin
|
---|
| 4585 | ActivateHtmlViewer(Lines);
|
---|
| 4586 | end else begin
|
---|
| 4587 | ActivateMemoViewer(Lines);
|
---|
| 4588 | HtmlViewer.Clear;
|
---|
| 4589 | end;
|
---|
| 4590 | pnlRight.Repaint; //kt TEMP
|
---|
| 4591 | end; {SetDisplayToHTMLvsText.SetHTMLorTextViewer}
|
---|
| 4592 |
|
---|
| 4593 | begin {SetDisplayToHTMLvsText}
|
---|
| 4594 | if vmEdit in Mode then begin
|
---|
| 4595 | SetHTMLorTextEditor((vmHTML in Mode),Lines,ActivateOnly);
|
---|
| 4596 | end else begin
|
---|
| 4597 | SetHTMLorTextViewer((vmHTML in Mode),Lines,ActivateOnly);
|
---|
| 4598 | end;
|
---|
| 4599 | end; {SetDisplayToHTMLvsText}
|
---|
| 4600 |
|
---|
| 4601 | procedure TfrmNotes.btnBoldClick(Sender: TObject);
|
---|
| 4602 | //kt added function
|
---|
| 4603 | begin
|
---|
| 4604 | inherited;
|
---|
| 4605 | HtmlEditor.ToggleBold;
|
---|
| 4606 | end;
|
---|
| 4607 |
|
---|
| 4608 | procedure TfrmNotes.btnItalicClick(Sender: TObject);
|
---|
| 4609 | //kt added function
|
---|
| 4610 | begin
|
---|
| 4611 | inherited;
|
---|
| 4612 | HtmlEditor.ToggleItalic;
|
---|
| 4613 | end;
|
---|
| 4614 |
|
---|
| 4615 | procedure TfrmNotes.btnLessIndentClick(Sender: TObject);
|
---|
| 4616 | //kt added function
|
---|
| 4617 | begin
|
---|
| 4618 | inherited;
|
---|
| 4619 | HtmlEditor.Outdent;
|
---|
| 4620 | end;
|
---|
| 4621 |
|
---|
| 4622 | procedure TfrmNotes.btnMoreIndentClick(Sender: TObject);
|
---|
| 4623 | //kt added function
|
---|
| 4624 | begin
|
---|
| 4625 | inherited;
|
---|
| 4626 | HtmlEditor.Indent;
|
---|
| 4627 | end;
|
---|
| 4628 |
|
---|
| 4629 | procedure TfrmNotes.btnRightAlignClick(Sender: TObject);
|
---|
| 4630 | //kt added function
|
---|
| 4631 | begin
|
---|
| 4632 | inherited;
|
---|
| 4633 | HtmlEditor.AlignRight;
|
---|
| 4634 | end;
|
---|
| 4635 |
|
---|
| 4636 | procedure TfrmNotes.btnCenterAlignClick(Sender: TObject);
|
---|
| 4637 | //kt added function
|
---|
| 4638 | begin
|
---|
| 4639 | inherited;
|
---|
| 4640 | HtmlEditor.AlignCenter;
|
---|
| 4641 | end;
|
---|
| 4642 |
|
---|
| 4643 | procedure TfrmNotes.btnLeftAlignClick(Sender: TObject);
|
---|
| 4644 | //kt added function
|
---|
| 4645 | begin
|
---|
| 4646 | inherited;
|
---|
| 4647 | HtmlEditor.AlignLeft;
|
---|
| 4648 | end;
|
---|
| 4649 |
|
---|
| 4650 | procedure TfrmNotes.btnNumbersClick(Sender: TObject);
|
---|
| 4651 | //kt added function
|
---|
| 4652 | begin
|
---|
| 4653 | inherited;
|
---|
| 4654 | HtmlEditor.ToggleNumbering;
|
---|
| 4655 | end;
|
---|
| 4656 |
|
---|
| 4657 | procedure TfrmNotes.btnBulletsClick(Sender: TObject);
|
---|
| 4658 | //kt added function
|
---|
| 4659 | begin
|
---|
| 4660 | inherited;
|
---|
| 4661 | HtmlEditor.ToggleBullet;
|
---|
| 4662 | end;
|
---|
| 4663 |
|
---|
| 4664 | procedure TfrmNotes.btnUnderlineClick(Sender: TObject);
|
---|
| 4665 | //kt added function
|
---|
| 4666 | begin
|
---|
| 4667 | inherited;
|
---|
| 4668 | HtmlEditor.ToggleUnderline;
|
---|
| 4669 | end;
|
---|
| 4670 |
|
---|
| 4671 | procedure TfrmNotes.btnTextColorClick(Sender: TObject);
|
---|
| 4672 | //kt added function
|
---|
| 4673 | begin
|
---|
| 4674 | inherited;
|
---|
| 4675 | HtmlEditor.TextForeColorDialog;
|
---|
| 4676 | end;
|
---|
| 4677 |
|
---|
| 4678 | procedure TfrmNotes.btnBackColorClick(Sender: TObject);
|
---|
| 4679 | //kt added function
|
---|
| 4680 | begin
|
---|
| 4681 | inherited;
|
---|
| 4682 | HtmlEditor.TextBackColorDialog;
|
---|
| 4683 | end;
|
---|
| 4684 |
|
---|
| 4685 | procedure TfrmNotes.btnFontsClick(Sender: TObject);
|
---|
| 4686 | //kt added function
|
---|
| 4687 | begin
|
---|
| 4688 | inherited;
|
---|
| 4689 | HtmlEditor.FontDialog;
|
---|
| 4690 | end;
|
---|
| 4691 |
|
---|
| 4692 | procedure TfrmNotes.cbFontSizeChange(Sender: TObject);
|
---|
| 4693 | //kt added function
|
---|
| 4694 | const
|
---|
| 4695 | FontSizes : array [0..6] of byte = (8,10,12,14,18,24,36);
|
---|
| 4696 | begin
|
---|
| 4697 | inherited;
|
---|
| 4698 | //HtmlEditor.FontSize := StrToInt(cbFontSize.Text);
|
---|
| 4699 | HtmlEditor.FontSize := FontSizes[cbFontSize.ItemIndex];
|
---|
| 4700 | end;
|
---|
| 4701 |
|
---|
| 4702 | procedure TfrmNotes.cbFontNamesChange(Sender: TObject);
|
---|
| 4703 | //kt added function
|
---|
| 4704 | var i : integer;
|
---|
| 4705 | FontName : string;
|
---|
| 4706 | const
|
---|
| 4707 | TEXT_BAR = '---------------';
|
---|
| 4708 | begin
|
---|
| 4709 | inherited;
|
---|
| 4710 | if cbFontNames.Text[1]='<' then exit;
|
---|
| 4711 | FontName := cbFontNames.Text;
|
---|
| 4712 | HtmlEditor.FontName := FontName;
|
---|
| 4713 | i := cbFontNames.Items.IndexOf(TEXT_BAR);
|
---|
| 4714 | if i < 1 then cbFontNames.Items.Insert(0,TEXT_BAR);
|
---|
| 4715 | if i > 5 then cbFontNames.Items.Delete(5);
|
---|
| 4716 | if cbFontNames.Items.IndexOf(FontName)> i then begin
|
---|
| 4717 | cbFontNames.Items.Insert(0,FontName);
|
---|
| 4718 | end;
|
---|
| 4719 | end;
|
---|
| 4720 |
|
---|
| 4721 | (*
|
---|
[453] | 4722 | //kt made this entire temp function
|
---|
| 4723 | procedure TfrmNotes.WebBrowser1CommandStateChange(Sender: TObject;
|
---|
| 4724 | Command: Integer; Enable: WordBool);
|
---|
| 4725 |
|
---|
| 4726 | var
|
---|
| 4727 | s,ts: String;
|
---|
| 4728 | Buff : array[0..255] of char;
|
---|
| 4729 | pBuff : pChar;
|
---|
| 4730 |
|
---|
| 4731 | begin
|
---|
| 4732 | inherited;
|
---|
| 4733 | pBuff := @Buff;
|
---|
| 4734 | case Command of
|
---|
| 4735 | // CSC_UPDATECOMMANDS: ts := '<Some property>'; <-- original line. //kt 7/19/2007
|
---|
| 4736 | // CSC_UPDATECOMMANDS: ts := DKLangConstW('fNotes_xSome_propertyx'); //kt added 7/19/2007
|
---|
| 4737 | -1: ts := DKLangConstW('fNotes_xSome_propertyx'); //kt changed 9/7/07
|
---|
| 4738 | CSC_NAVIGATEFORWARD: ts := ''; //'<Navigate Forward>';
|
---|
| 4739 | CSC_NAVIGATEBACK: ts := ''; //'<Nagivate Backwards>';
|
---|
| 4740 | else ts := '??';
|
---|
| 4741 | end; {case}
|
---|
| 4742 | if ts<>'' then begin
|
---|
| 4743 | // s := 'Browser Status change: ' + ts + '; Enabled= ' + BoolToStr(Enable); <-- original line. //kt 7/19/2007
|
---|
| 4744 | s := DKLangConstW('fNotes_Browser_Status_changex')+' ' + ts + DKLangConstW('fNotes_x_Enabledx') + BoolToStr(Enable); //kt added 7/19/2007
|
---|
| 4745 | //Application.MessageBox(StrPCopy(pBuff,s),'Note');
|
---|
| 4746 | end;
|
---|
| 4747 | end;
|
---|
[541] | 4748 | *)
|
---|
[453] | 4749 |
|
---|
| 4750 | procedure TfrmNotes.memNewNoteKeyPress(Sender: TObject; var Key: Char);
|
---|
| 4751 | begin
|
---|
| 4752 | inherited;
|
---|
| 4753 | if FNavigatingTab then
|
---|
| 4754 | Key := #0; //Disable shift-tab processinend;
|
---|
| 4755 | end;
|
---|
| 4756 |
|
---|
| 4757 | procedure TfrmNotes.memNewNoteKeyUp(Sender: TObject; var Key: Word;
|
---|
| 4758 | Shift: TShiftState);
|
---|
| 4759 | begin
|
---|
| 4760 | inherited;
|
---|
| 4761 | if FNavigatingTab then
|
---|
| 4762 | begin
|
---|
| 4763 | if ssShift in Shift then
|
---|
| 4764 | FindNextControl(Sender as TWinControl, False, True, False).SetFocus //previous control
|
---|
| 4765 | else if ssCtrl in Shift then
|
---|
| 4766 | if frmDrawers.pnlTemplatesButton.CanFocus then
|
---|
| 4767 | frmDrawers.pnlTemplatesButton.SetFocus
|
---|
| 4768 | else
|
---|
| 4769 | FindNextControl(Sender as TWinControl, True, True, False).SetFocus; //next control
|
---|
| 4770 | FNavigatingTab := False;
|
---|
| 4771 | end;
|
---|
| 4772 | if (key = VK_ESCAPE) then begin
|
---|
| 4773 | FindNextControl(Sender as TWinControl, False, True, False).SetFocus; //previous control
|
---|
| 4774 | key := 0;
|
---|
| 4775 | end;
|
---|
| 4776 | end;
|
---|
| 4777 |
|
---|
| 4778 | procedure TfrmNotes.memPCEShowExit(Sender: TObject);
|
---|
| 4779 | begin
|
---|
| 4780 | inherited;
|
---|
| 4781 | //Fix the Tab Order Make Drawers Buttons Accessible
|
---|
| 4782 | if Boolean(Hi(GetKeyState(VK_TAB))) then
|
---|
| 4783 | if Boolean(Hi(GetKeyState(VK_SHIFT))) then
|
---|
| 4784 | cmdPCE.SetFocus
|
---|
| 4785 | else
|
---|
| 4786 | frmFrame.pnlPatient.SetFocus;
|
---|
| 4787 | end;
|
---|
| 4788 |
|
---|
| 4789 | procedure TfrmNotes.cmdChangeExit(Sender: TObject);
|
---|
| 4790 | begin
|
---|
| 4791 | inherited;
|
---|
| 4792 | //Fix the Tab Order Make Drawers Buttons Accessible
|
---|
| 4793 | if Boolean(Hi(GetKeyState(VK_TAB))) and
|
---|
| 4794 | Boolean(Hi(GetKeyState(VK_SHIFT))) then
|
---|
| 4795 | tvNotes.SetFocus;
|
---|
| 4796 | end;
|
---|
| 4797 |
|
---|
| 4798 | procedure TfrmNotes.cmdPCEExit(Sender: TObject);
|
---|
| 4799 | begin
|
---|
| 4800 | inherited;
|
---|
| 4801 | //Fix the Tab Order Make Drawers Buttons Accessible
|
---|
| 4802 | if Boolean(Hi(GetKeyState(VK_TAB))) and
|
---|
| 4803 | Not Boolean(Hi(GetKeyState(VK_SHIFT))) then
|
---|
| 4804 | if memPCEShow.Visible then //CQ7120
|
---|
| 4805 | memPCEShow.SetFocus; //CQ7120
|
---|
| 4806 | end;
|
---|
| 4807 |
|
---|
| 4808 | procedure TfrmNotes.ViewInfo(Sender: TObject);
|
---|
| 4809 | begin
|
---|
| 4810 | inherited;
|
---|
| 4811 | frmFrame.ViewInfo(Sender);
|
---|
| 4812 | end;
|
---|
| 4813 |
|
---|
| 4814 | procedure TfrmNotes.mnuViewInformationClick(Sender: TObject);
|
---|
| 4815 | begin
|
---|
| 4816 | inherited;
|
---|
| 4817 | mnuViewDemo.Enabled := frmFrame.pnlPatient.Enabled;
|
---|
| 4818 | mnuViewVisits.Enabled := frmFrame.pnlVisit.Enabled;
|
---|
| 4819 | mnuViewPrimaryCare.Enabled := frmFrame.pnlPrimaryCare.Enabled;
|
---|
| 4820 | mnuViewMyHealtheVet.Enabled := not (Copy(frmFrame.laMHV.Hint, 1, 2) = 'No');
|
---|
| 4821 | mnuInsurance.Enabled := not (Copy(frmFrame.laVAA2.Hint, 1, 2) = 'No');
|
---|
| 4822 | mnuViewFlags.Enabled := frmFrame.lblFlag.Enabled;
|
---|
| 4823 | mnuViewRemoteData.Enabled := frmFrame.lblCirn.Enabled;
|
---|
| 4824 | mnuViewReminders.Enabled := frmFrame.pnlReminders.Enabled;
|
---|
| 4825 | mnuViewPostings.Enabled := frmFrame.pnlPostings.Enabled;
|
---|
| 4826 | end;
|
---|
| 4827 |
|
---|
| 4828 | initialization
|
---|
| 4829 | uPCEEdit := TPCEData.Create;
|
---|
| 4830 | uPCEShow := TPCEData.Create;
|
---|
| 4831 |
|
---|
| 4832 | finalization
|
---|
| 4833 | if (uPCEEdit <> nil) then uPCEEdit.Free; //CQ7012 Added test for nil
|
---|
| 4834 | if (uPCEShow <> nil) then uPCEShow.Free; //CQ7012 Added test for nil
|
---|
| 4835 |
|
---|
| 4836 | end.
|
---|
| 4837 |
|
---|