source: cprs/branches/tmg-cprs/CPRS-Chart/Orders/fODMisc.pas@ 908

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

Initial upload of TMG-CPRS 1.0.26.69

File size: 4.8 KB
Line 
1//kt -- Modified with SourceScanner on 8/8/2007
2unit fODMisc;
3
4interface
5
6uses
7 Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
8 fODBase, StdCtrls, ORCtrls, ORDtTm, ComCtrls, ExtCtrls, ORFn, uConst,
9 DKLang;
10
11type
12 TfrmODMisc = class(TfrmODBase)
13 cboCare: TORComboBox;
14 lblStart: TLabel;
15 calStart: TORDateBox;
16 lblStop: TLabel;
17 calStop: TORDateBox;
18 lblCare: TLabel;
19 lblComment: TLabel;
20 txtComment: TCaptionEdit;
21 procedure ControlChange(Sender: TObject);
22 procedure FormCreate(Sender: TObject);
23 procedure cboCareNeedData(Sender: TObject; const StartFrom: String;
24 Direction, InsertAt: Integer);
25 private
26 //kt Begin Mod (change Consts to Vars) 8/8/2007
27 TX_NO_CAREITEM : string; //kt
28 TX_BAD_START : string; //kt
29 TX_BAD_STOP : string; //kt
30 TX_STOPSTART : string; //kt
31 //kt End Mod -------------------
32 procedure SetupVars; //kt
33 { }
34 protected
35 procedure InitDialog; override;
36 procedure Validate(var AnErrMsg: string); override;
37 public
38 procedure SetupDialog(OrderAction: Integer; const ID: string); override;
39 end;
40
41var
42 frmODMisc: TfrmODMisc;
43
44implementation
45
46{$R *.DFM}
47
48uses rODBase;
49
50//const
51//TX_NO_CAREITEM = 'A patient care item must be selected.'; <-- original line. //kt 8/8/2007
52//TX_BAD_START = 'The start date is not valid.'; <-- original line. //kt 8/8/2007
53//TX_BAD_STOP = 'The stop date is not valid.'; <-- original line. //kt 8/8/2007
54//TX_STOPSTART = 'The stop date must be after the start date.'; <-- original line. //kt 8/8/2007
55
56procedure TfrmODMisc.SetupVars;
57//kt Added entire function to replace constant declarations 8/8/2007
58begin
59 TX_NO_CAREITEM := DKLangConstW('fODMisc_A_patient_care_item_must_be_selectedx');
60 TX_BAD_START := DKLangConstW('fODMisc_The_start_date_is_not_validx');
61 TX_BAD_STOP := DKLangConstW('fODMisc_The_stop_date_is_not_validx');
62 TX_STOPSTART := DKLangConstW('fODMisc_The_stop_date_must_be_after_the_start_datex');
63end;
64
65procedure TfrmODMisc.FormCreate(Sender: TObject);
66begin
67 inherited;
68 FillerID := 'OR'; // does 'on Display' order check **KCM**
69//StatusText('Loading Dialog Definition'); <-- original line. //kt 8/8/2007
70 StatusText(DKLangConstW('fODMisc_Loading_Dialog_Definition')); //kt added 8/8/2007
71 Responses.Dialog := 'OR GXMISC GENERAL'; // loads formatting info
72//StatusText('Loading Default Values'); <-- original line. //kt 8/8/2007
73 StatusText(DKLangConstW('fODMisc_Loading_Default_Values')); //kt added 8/8/2007
74 //CtrlInits.LoadDefaults(ODForMisc); // there are no defaults for OR GXMISC
75 InitDialog;
76 StatusText('');
77end;
78
79procedure TfrmODMisc.InitDialog;
80begin
81 inherited;
82 cboCare.InitLongList('');
83 txtComment.Text := '';
84end;
85
86procedure TfrmODMisc.SetupDialog(OrderAction: Integer; const ID: string);
87begin
88 inherited;
89 if OrderAction in [ORDER_COPY, ORDER_EDIT, ORDER_QUICK] then with Responses do
90 begin
91 Changing := True;
92 SetControl(cboCare, 'ORDERABLE', 1);
93 SetControl(txtComment, 'COMMENT', 1);
94 SetControl(calStart, 'START', 1);
95 SetControl(calStop, 'STOP', 1);
96 Changing := False;
97 ControlChange(Self);
98 SetFocusedControl(txtComment);
99 end;
100end;
101
102procedure TfrmODMisc.Validate(var AnErrMsg: string);
103var
104 ErrMsg: string;
105
106 procedure SetError(const x: string);
107 begin
108 if Length(AnErrMsg) > 0 then AnErrMsg := AnErrMsg + CRLF;
109 AnErrMsg := AnErrMsg + x;
110 end;
111
112begin
113 SetupVars; //kt added 8/8/2007 to replace constants with vars.
114 if cboCare.ItemIEN <= 0 then SetError(TX_NO_CAREITEM);
115 calStart.Validate(ErrMsg);
116 if Length(ErrMsg) > 0 then SetError(TX_BAD_START);
117 with calStop do
118 begin
119 Validate(ErrMsg);
120 if Length(ErrMsg) > 0 then SetError(TX_BAD_STOP);
121 if (Length(Text) > 0) and (FMDateTime <= calStart.FMDateTime)
122 then SetError(TX_STOPSTART);
123 end; {with calStop}
124end;
125
126procedure TfrmODMisc.cboCareNeedData(Sender: TObject; const StartFrom: string;
127 Direction, InsertAt: Integer);
128begin
129 inherited;
130 cboCare.ForDataUse(SubSetOfOrderItems(StartFrom, Direction, 'S.NURS'));
131end;
132
133procedure TfrmODMisc.ControlChange(Sender: TObject);
134begin
135 inherited;
136 if Changing then Exit;
137 Responses.Clear;
138 with cboCare do if ItemIEN > 0 then Responses.Update('ORDERABLE', 1, ItemID, Text);
139 with txtComment do if Length(Text) > 0 then Responses.Update('COMMENT', 1, Text, Text);
140 with calStart do if Length(Text) > 0 then Responses.Update('START', 1, Text, Text);
141 with calStop do if Length(Text) > 0 then Responses.Update('STOP', 1, Text, Text);
142 memOrder.Text := Responses.OrderText;
143end;
144
145end.
Note: See TracBrowser for help on using the repository browser.