source: cprs/branches/tmg-cprs/CPRS-Chart/fNoteCPFields.pas@ 1703

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

Initial upload of TMG-CPRS 1.0.26.69

File size: 7.0 KB
Line 
1//kt -- Modified with SourceScanner on 7/19/2007
2unit fNoteCPFields;
3
4interface
5
6uses
7 Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
8 fAutoSz, StdCtrls, ORCtrls, ORFn, ORDtTm, DKLang;
9
10type
11 TfrmNoteCPFields = class(TfrmAutoSz)
12 lblAuthor: TLabel;
13 cboAuthor: TORComboBox;
14 lblProcSummCode: TOROffsetLabel;
15 cboProcSummCode: TORComboBox;
16 lblProcDateTime: TOROffsetLabel;
17 calProcDateTime: TORDateBox;
18 cmdOK: TButton;
19 cmdCancel: TButton;
20 DKLanguageController1: TDKLanguageController;
21 procedure cmdCancelClick(Sender: TObject);
22 procedure FormCreate(Sender: TObject);
23 procedure cmdOKClick(Sender: TObject);
24 procedure cboAuthorNeedData(Sender: TObject; const StartFrom: String;
25 Direction, InsertAt: Integer);
26 private
27 //kt Begin Mod (change Consts to Vars) 7/19/2007
28 TC_REQ_FIELDS : string; //kt
29 TX_REQ_AUTHOR : string; //kt
30 TX_NO_FUTURE : string; //kt
31 TX_REQ_PROCSUMMCODE : string; //kt
32 TX_REQ_PROCDATETIME : string; //kt
33 TX_INVALID_PROCDATETIME : string; //kt
34 TX_NO_PROC_FUTURE : string; //kt
35 TX_REQ_CANCEL : string; //kt
36 //kt End Mod -------------------
37 FAuthor: int64;
38 FProcSummCode: integer;
39 FProcDateTime: TFMDateTime;
40 FCPStatusFlag: integer;
41 FOKPressed: Boolean;
42 procedure ValidateFields(var ErrMsg: string);
43 procedure SetupVars; //kt
44 end;
45
46//const
47//TC_REQ_FIELDS = 'Required Information'; <-- original line. //kt 7/19/2007
48//TX_REQ_AUTHOR = CRLF + 'The author of the note must be identified.'; <-- original line. //kt 7/19/2007
49//TX_NO_FUTURE = CRLF + 'A reference date/time in the future is not allowed.'; <-- original line. //kt 7/19/2007
50//TX_REQ_PROCSUMMCODE = CRLF + 'A procedure summary code for this procedure must be entered.'; <-- original line. //kt 7/19/2007
51//TX_REQ_PROCDATETIME = CRLF + 'A valid date/time for the procedure must be entered.'; <-- original line. //kt 7/19/2007
52//TX_INVALID_PROCDATETIME = CRLF + 'If entered, the date/time for the procedure must be in a valid format.'; <-- original line. //kt 7/19/2007
53//TX_NO_PROC_FUTURE = CRLF + 'A procedure date/time in the future is not allowed.'; <-- original line. //kt 7/19/2007
54//TX_REQ_CANCEL = 'You will be required to enter these fields before the note can be saved or signed.' + CRLF + <-- original line. //kt 7/19/2007
55// 'Click the "Change" button to enter this information at any time while editing.'; <-- original line. //kt 7/19/2007
56
57
58procedure EnterClinProcFields(ACPStatusFlag: integer; ErrMsg: string; var AProcSummCode: integer; var AProcDate: TFMDateTime; var AnAuthor: int64);
59
60implementation
61
62{$R *.DFM}
63
64uses rCore, uConst, uConsults, uCore;
65
66
67procedure TfrmNoteCPFields.SetupVars;
68//kt Added entire function to replace constant declarations 7/19/2007
69begin
70 TC_REQ_FIELDS := DKLangConstW('fNoteCPFields_Required_Information');
71 TX_REQ_AUTHOR := CRLF + DKLangConstW('fNoteCPFields_The_author_of_the_note_must_be_identifiedx');
72 TX_NO_FUTURE := CRLF + DKLangConstW('fNoteCPFields_A_reference_datextime_in_the_future_is_not_allowedx');
73 TX_REQ_PROCSUMMCODE := CRLF + DKLangConstW('fNoteCPFields_A_procedure_summary_code_for_this_procedure_must_be_enteredx');
74 TX_REQ_PROCDATETIME := CRLF + DKLangConstW('fNoteCPFields_A_valid_datextime_for_the_procedure_must_be_enteredx');
75 TX_INVALID_PROCDATETIME := CRLF + DKLangConstW('fNoteCPFields_If_enteredx_the_datextime_for_the_procedure_must_be_in_a_valid_formatx');
76 TX_NO_PROC_FUTURE := CRLF + DKLangConstW('fNoteCPFields_A_procedure_datextime_in_the_future_is_not_allowedx');
77 TX_REQ_CANCEL := DKLangConstW('fNoteCPFields_You_will_be_required_to_enter_these_fields_before_the_note_can_be_saved_or_signedx') + CRLF +
78 DKLangConstW('fNoteCPFields_Click_the_xChangex_button_to_enter_this_information_at_any_time_while_editingx');
79end;
80
81
82procedure EnterClinProcFields(ACPStatusFlag: integer; ErrMsg: string; var AProcSummCode: integer; var AProcDate: TFMDateTime; var AnAuthor: int64);
83var
84 frmNoteCPFields: TfrmNoteCPFields;
85begin
86 frmNoteCPFields := TfrmNoteCPFields.Create(Application);
87 with frmNoteCPFields do
88 try
89 ResizeFormToFont(TForm(frmNoteCPFields));
90 FCPStatusFlag := ACPStatusFlag;
91 FProcSummCode := AProcSummCode;
92 FProcDateTime := AProcDate;
93 cboProcSummCode.SelectByIEN(AProcSummCode);
94 calProcDateTime.FMDateTime := AProcDate;
95 ShowModal;
96 if FOKPressed then
97 begin
98 AnAuthor := FAuthor;
99 AProcSummCode := FProcSummCode;
100 AProcDate := FProcDateTime;
101 end;
102 finally
103 Release;
104 end;
105end;
106
107procedure TfrmNoteCPFields.FormCreate(Sender: TObject);
108begin
109 inherited;
110 FOKPressed := False;
111 cboAuthor.InitLongList(User.Name);
112 cboAuthor.SelectByIEN(User.DUZ);
113end;
114
115procedure TfrmNoteCPFields.cmdOKClick(Sender: TObject);
116var
117 ErrMsg: string;
118begin
119 SetupVars; //kt added 7/19/2007 to replace constants with vars.
120 inherited;
121 ValidateFields(ErrMsg);
122 if ShowMsgOn(Length(ErrMsg) > 0, ErrMsg, TC_REQ_FIELDS)
123 then Exit
124 else
125 begin
126 FOKPressed := True;
127 ModalResult := mrOK;
128 end;
129end;
130
131procedure TfrmNoteCPFields.ValidateFields(var ErrMsg: string);
132begin
133 SetupVars; //kt added 7/19/2007 to replace constants with vars.
134 if cboAuthor.ItemIEN = 0 then ErrMsg := ErrMsg + TX_REQ_AUTHOR else FAuthor := cboAuthor.ItemIEN;
135 if (FCPStatusFlag = CP_INSTR_INCOMPLETE) then
136 begin
137 if cboProcSummCode.ItemIEN = 0 then ErrMsg := ErrMsg + TX_REQ_PROCSUMMCODE
138 else FProcSummCode := cboProcSummCode.ItemIEN;
139 if not calProcDateTime.IsValid then ErrMsg := ErrMsg + TX_REQ_PROCDATETIME
140 else if calProcDateTime.IsValid and (calProcDateTime.FMDateTime > FMNow) then ErrMsg := ErrMsg + TX_NO_PROC_FUTURE
141 else FProcDateTime := calProcDateTime.FMDateTime;
142 end
143 else
144 begin
145 FProcSummCode := cboProcSummCode.ItemIEN;
146 if (calProcDateTime.FMDateTime > 0) then
147 begin
148 if (not calProcDateTime.IsValid) then ErrMsg := ErrMsg + TX_INVALID_PROCDATETIME
149 else if calProcDateTime.IsValid and (calProcDateTime.FMDateTime > FMNow) then ErrMsg := ErrMsg + TX_NO_PROC_FUTURE
150 else FProcDateTime := calProcDateTime.FMDateTime;
151 end;
152 end;
153end;
154
155procedure TfrmNoteCPFields.cmdCancelClick(Sender: TObject);
156var
157 ErrMsg: string;
158begin
159 SetupVars; //kt added 7/19/2007 to replace constants with vars.
160 inherited;
161 ValidateFields(ErrMsg);
162 if ErrMsg <> '' then
163 InfoBox(TX_REQ_CANCEL, TC_REQ_FIELDS, MB_OK or MB_ICONWARNING);
164 FOKPressed := False;
165 Close;
166end;
167
168procedure TfrmNoteCPFields.cboAuthorNeedData(Sender: TObject;
169 const StartFrom: String; Direction, InsertAt: Integer);
170begin
171 (Sender as TORComboBox).ForDataUse(SubSetOfPersons(StartFrom, Direction));
172end;
173
174end.
Note: See TracBrowser for help on using the repository browser.