source: cprs/branches/tmg-cprs/CPRS-Chart/fNoteBD.pas@ 1593

Last change on this file since 1593 was 453, checked in by Kevin Toppenberg, 16 years ago

Initial upload of TMG-CPRS 1.0.26.69

File size: 4.5 KB
RevLine 
[453]1//kt -- Modified with SourceScanner on 7/19/2007
2unit fNoteBD;
3
4interface
5
6uses
7 Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs, ORFN,
8 StdCtrls, ExtCtrls, ORCtrls, ORDtTm, uTIU, DKLang;
9
10type
11 TfrmNotesByDate = class(TForm)
12 pnlBase: TORAutoPanel;
13 lblBeginDate: TLabel;
14 calBeginDate: TORDateBox;
15 lblEndDate: TLabel;
16 calEndDate: TORDateBox;
17 radSort: TRadioGroup;
18 cmdOK: TButton;
19 cmdCancel: TButton;
20 DKLanguageController1: TDKLanguageController;
21 procedure cmdOKClick(Sender: TObject);
22 procedure cmdCancelClick(Sender: TObject);
23 procedure calBeginDateKeyPress(Sender: TObject; var Key: Char);
24 procedure calEndDateKeyPress(Sender: TObject; var Key: Char);
25 private
26 //kt Begin Mod (change Consts to Vars) 7/19/2007
27 TX_DATE_ERR : string; //kt
28 TX_DATE_ERR_CAP : string; //kt
29 //kt End Mod -------------------
30 FChanged: Boolean;
31 FBeginDate: string;
32 FFMBeginDate: TFMDateTime;
33 FEndDate: string;
34 FFMEndDate: TFMDateTime;
35 FAscending: Boolean;
36 procedure SetupVars; //kt
37 end;
38
39 TNoteDateRange = record
40 Changed: Boolean;
41 BeginDate: string;
42 FMBeginDate: TFMDateTime;
43 EndDate: string;
44 FMEndDate: TFMDateTime;
45 Ascending: Boolean;
46 end;
47
48procedure SelectNoteDateRange(FontSize: Integer; CurrentContext: TTIUContext; var NoteDateRange: TNoteDateRange);
49
50implementation
51
52{$R *.DFM}
53
54uses rCore, rTIU;
55
56//const
57//TX_DATE_ERR = 'Enter valid beginning and ending dates or press Cancel.'; <-- original line. //kt 7/19/2007
58//TX_DATE_ERR_CAP = 'Error in Date Range'; <-- original line. //kt 7/19/2007
59
60
61
62procedure TfrmNotesByDate.SetupVars;
63//kt Added entire function to replace constant declarations 7/19/2007
64begin
65 TX_DATE_ERR := DKLangConstW('fNoteBD_Enter_valid_beginning_and_ending_dates_or_press_Cancelx');
66 TX_DATE_ERR_CAP := DKLangConstW('fNoteBD_Error_in_Date_Range');
67end;
68
69procedure SelectNoteDateRange(FontSize: Integer; CurrentContext: TTIUContext; var NoteDateRange: TNoteDateRange);
70{ displays date range select form for progress notes and returns a record of the selection }
71var
72 frmNotesByDate: TfrmNotesByDate;
73 W, H: Integer;
74begin
75 frmNotesByDate := TfrmNotesByDate.Create(Application);
76 try
77 with frmNotesByDate do
78 begin
79 Font.Size := FontSize;
80 W := ClientWidth;
81 H := ClientHeight;
82 ResizeToFont(FontSize, W, H);
83 ClientWidth := W; pnlBase.Width := W;
84 ClientHeight := H; pnlBase.Height := W;
85 FChanged := False;
86 calBeginDate.Text := CurrentContext.BeginDate;
87 calEndDate.Text := CurrentContext.EndDate;
88// if calEndDate.Text = '' then calEndDate.Text := 'TODAY'; <-- original line. //kt 7/19/2007
89 if calEndDate.Text = '' then calEndDate.Text := DKLangConstW('fNoteBD_TODAY'); //kt added 7/19/2007
90 FAscending := CurrentContext.TreeAscending;
91 with radSort do if FAscending then ItemIndex := 0 else ItemIndex := 1;
92 ShowModal;
93 with NoteDateRange do
94 begin
95 Changed := FChanged;
96 BeginDate := FBeginDate;
97 FMBeginDate := FFMBeginDate;
98 EndDate := FEndDate;
99 FMEndDate := FFMEndDate;
100 Ascending := FAscending;
101 end; {with NoteDateRange}
102 end; {with frmNotesByDate}
103 finally
104 frmNotesByDate.Release;
105 end;
106end;
107
108procedure TfrmNotesByDate.cmdOKClick(Sender: TObject);
109var
110 bdate, edate: TFMDateTime;
111begin
112 SetupVars; //kt added 7/19/2007 to replace constants with vars.
113 if calBeginDate.Text <> '' then
114 bdate := StrToFMDateTime(calBeginDate.Text)
115 else
116 bdate := 0 ;
117
118 if calEndDate.Text <> '' then
119 edate := StrToFMDateTime(calEndDate.Text)
120 else
121 edate := 0 ;
122
123 if (bdate <= edate) then
124 begin
125 FChanged := True;
126 FBeginDate := calBeginDate.Text;
127 FFMBeginDate := bdate;
128 FEndDate := calEndDate.Text;
129 FFMEndDate := edate;
130 FAscending := radSort.ItemIndex = 0;
131 end
132 else
133 begin
134 InfoBox(TX_DATE_ERR, TX_DATE_ERR_CAP, MB_OK or MB_ICONWARNING);
135 Exit;
136 end;
137 Close;
138end;
139
140procedure TfrmNotesByDate.cmdCancelClick(Sender: TObject);
141begin
142 Close;
143end;
144
145procedure TfrmNotesByDate.calBeginDateKeyPress(Sender: TObject;
146 var Key: Char);
147begin
148 if (Key = #13) then cmdOKClick(Self);
149end;
150
151procedure TfrmNotesByDate.calEndDateKeyPress(Sender: TObject;
152 var Key: Char);
153begin
154 if (Key = #13) then cmdOKClick(Self);
155end;
156
157end.
Note: See TracBrowser for help on using the repository browser.