| 1 | //kt -- Modified with SourceScanner on 7/19/2007 | 
|---|
| 2 | unit fNoteBA; | 
|---|
| 3 |  | 
|---|
| 4 | interface | 
|---|
| 5 |  | 
|---|
| 6 | uses | 
|---|
| 7 | Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs, | 
|---|
| 8 | ExtCtrls, ORCtrls, StdCtrls, ORFn, uTIU, DKLang; | 
|---|
| 9 |  | 
|---|
| 10 | type | 
|---|
| 11 | TfrmNotesByAuthor = class(TForm) | 
|---|
| 12 | pnlBase: TORAutoPanel; | 
|---|
| 13 | lblAuthor: TLabel; | 
|---|
| 14 | radSort: TRadioGroup; | 
|---|
| 15 | cboAuthor: TORComboBox; | 
|---|
| 16 | cmdOK: TButton; | 
|---|
| 17 | cmdCancel: TButton; | 
|---|
| 18 | DKLanguageController1: TDKLanguageController; | 
|---|
| 19 | procedure cboAuthorNeedData(Sender: TObject; const StartFrom: string; | 
|---|
| 20 | Direction, InsertAt: Integer); | 
|---|
| 21 | procedure cmdCancelClick(Sender: TObject); | 
|---|
| 22 | procedure cmdOKClick(Sender: TObject); | 
|---|
| 23 | private | 
|---|
| 24 | //kt Begin Mod (change Consts to Vars) 7/19/2007 | 
|---|
| 25 | TX_AUTH_TEXT  : string;  //kt | 
|---|
| 26 | TX_AUTH_CAP   : string;  //kt | 
|---|
| 27 | //kt End Mod ------------------- | 
|---|
| 28 | FChanged: Boolean; | 
|---|
| 29 | FAuthor: Int64; | 
|---|
| 30 | FAuthorName: string; | 
|---|
| 31 | FAscending: Boolean; | 
|---|
| 32 | procedure SetupVars;  //kt | 
|---|
| 33 | end; | 
|---|
| 34 |  | 
|---|
| 35 | TAuthorContext = record | 
|---|
| 36 | Changed: Boolean; | 
|---|
| 37 | Author: Int64; | 
|---|
| 38 | AuthorName: string; | 
|---|
| 39 | Ascending: Boolean; | 
|---|
| 40 | end; | 
|---|
| 41 |  | 
|---|
| 42 | procedure SelectAuthor(FontSize: Integer; CurrentContext: TTIUContext; var AuthorContext: TAuthorContext); | 
|---|
| 43 |  | 
|---|
| 44 | implementation | 
|---|
| 45 |  | 
|---|
| 46 | {$R *.DFM} | 
|---|
| 47 |  | 
|---|
| 48 | uses rTIU, rCore, uCore; | 
|---|
| 49 |  | 
|---|
| 50 | //const | 
|---|
| 51 | //TX_AUTH_TEXT = 'Select a progress note author or press Cancel.';  <-- original line.  //kt 7/19/2007 | 
|---|
| 52 | //TX_AUTH_CAP = 'Missing Author';  <-- original line.  //kt 7/19/2007 | 
|---|
| 53 |  | 
|---|
| 54 |  | 
|---|
| 55 |  | 
|---|
| 56 | procedure TfrmNotesByAuthor.SetupVars; | 
|---|
| 57 | //kt Added entire function to replace constant declarations 7/19/2007 | 
|---|
| 58 | begin | 
|---|
| 59 | TX_AUTH_TEXT := DKLangConstW('fNoteBA_Select_a_progress_note_author_or_press_Cancelx'); | 
|---|
| 60 | TX_AUTH_CAP := DKLangConstW('fNoteBA_Missing_Author'); | 
|---|
| 61 | end; | 
|---|
| 62 |  | 
|---|
| 63 | procedure SelectAuthor(FontSize: Integer; CurrentContext: TTIUContext; var AuthorContext: TAuthorContext); | 
|---|
| 64 | { displays author select form for progress notes and returns a record of the selection } | 
|---|
| 65 | var | 
|---|
| 66 | frmNotesByAuthor: TfrmNotesByAuthor; | 
|---|
| 67 | W, H: integer; | 
|---|
| 68 | CurrentAuthor: Int64; | 
|---|
| 69 | begin | 
|---|
| 70 | frmNotesByAuthor := TfrmNotesByAuthor.Create(Application); | 
|---|
| 71 | try | 
|---|
| 72 | with frmNotesByAuthor do | 
|---|
| 73 | begin | 
|---|
| 74 | Font.Size := FontSize; | 
|---|
| 75 | W := ClientWidth; | 
|---|
| 76 | H := ClientHeight; | 
|---|
| 77 | ResizeToFont(FontSize, W, H); | 
|---|
| 78 | ClientWidth  := W; pnlBase.Width  := W; | 
|---|
| 79 | ClientHeight := H; pnlBase.Height := W; | 
|---|
| 80 | FChanged := False; | 
|---|
| 81 | CurrentAuthor := CurrentContext.Author; | 
|---|
| 82 | with cboAuthor do | 
|---|
| 83 | if CurrentAuthor > 0 then | 
|---|
| 84 | begin | 
|---|
| 85 | InitLongList(ExternalName(CurrentAuthor, 200)); | 
|---|
| 86 | SelectByIEN(CurrentAuthor); | 
|---|
| 87 | end | 
|---|
| 88 | else | 
|---|
| 89 | begin | 
|---|
| 90 | InitLongList(User.Name); | 
|---|
| 91 | SelectByIEN(User.DUZ); | 
|---|
| 92 | end; | 
|---|
| 93 | FAscending := CurrentContext.TreeAscending; | 
|---|
| 94 | with radSort do if FAscending then ItemIndex := 0 else ItemIndex := 1; | 
|---|
| 95 | ShowModal; | 
|---|
| 96 | with AuthorContext do | 
|---|
| 97 | begin | 
|---|
| 98 | Changed := FChanged; | 
|---|
| 99 | Author := FAuthor; | 
|---|
| 100 | AuthorName := FAuthorName; | 
|---|
| 101 | Ascending := FAscending; | 
|---|
| 102 | end; {with AuthorContext} | 
|---|
| 103 | end; {with frmNotesByAuthor} | 
|---|
| 104 | finally | 
|---|
| 105 | frmNotesByAuthor.Release; | 
|---|
| 106 | end; | 
|---|
| 107 | end; | 
|---|
| 108 |  | 
|---|
| 109 | procedure TfrmNotesByAuthor.cboAuthorNeedData(Sender: TObject; const StartFrom: string; | 
|---|
| 110 | Direction, InsertAt: Integer); | 
|---|
| 111 | begin | 
|---|
| 112 | cboAuthor.ForDataUse(SubSetOfActiveAndInactivePersons(StartFrom, Direction)); | 
|---|
| 113 | end; | 
|---|
| 114 |  | 
|---|
| 115 | procedure TfrmNotesByAuthor.cmdCancelClick(Sender: TObject); | 
|---|
| 116 | begin | 
|---|
| 117 | Close; | 
|---|
| 118 | end; | 
|---|
| 119 |  | 
|---|
| 120 | procedure TfrmNotesByAuthor.cmdOKClick(Sender: TObject); | 
|---|
| 121 | begin | 
|---|
| 122 | SetupVars;  //kt added 7/19/2007 to replace constants with vars. | 
|---|
| 123 | if cboAuthor.ItemIEN = 0 then | 
|---|
| 124 | begin | 
|---|
| 125 | InfoBox(TX_AUTH_TEXT, TX_AUTH_CAP, MB_OK or MB_ICONWARNING); | 
|---|
| 126 | Exit; | 
|---|
| 127 | end; | 
|---|
| 128 | FChanged := True; | 
|---|
| 129 | FAuthor := cboAuthor.ItemIEN; | 
|---|
| 130 | FAuthorName := cboAuthor.DisplayText[cboAuthor.ItemIndex]; | 
|---|
| 131 | FAscending := radSort.ItemIndex = 0; | 
|---|
| 132 | Close; | 
|---|
| 133 | end; | 
|---|
| 134 |  | 
|---|
| 135 | end. | 
|---|