source: cprs/branches/tmg-cprs/CPRS-Chart/Orders/fODChangeUnreleasedRenew.~pas@ 712

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

Initial upload of TMG-CPRS 1.0.26.69

File size: 6.0 KB
RevLine 
[453]1//kt -- Modified with SourceScanner on 8/8/2007
2unit fODChangeUnreleasedRenew;
3
4interface
5
6uses
7 Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
8 Dialogs, ExtCtrls, StdCtrls, ORCtrls, fAutoSz, uOrders, ORFn, ORDtTm, rOrders,
9 DKLang;
10
11type
12 TfrmODChangeUnreleasedRenew = class(TFrmAutoSz)
13 memOrder: TCaptionMemo;
14 Panel1: TPanel;
15 btnOK: TButton;
16 btnCancel: TButton;
17 Panel2: TPanel;
18 edtRefill: TCaptionEdit;
19 lblRefill: TLabel;
20 lblPickUp: TLabel;
21 cboPickup: TORComboBox;
22 Panel3: TPanel;
23 Label1: TLabel;
24 Label2: TLabel;
25 txtStart: TORDateBox;
26 txtStop: TORDateBox;
27 DKLanguageController1: TDKLanguageController;
28 procedure FormCreate(Sender: TObject);
29 procedure btnCancelClick(Sender: TObject);
30 procedure btnOKClick(Sender: TObject);
31 private
32 OKPressed: boolean;
33 FCategory: integer;
34 public
35 { Public declarations }
36 end;
37
38procedure ExecuteChangeRenewedOrder(const AnID: string; var param1, param2: string; Category: integer);
39
40implementation
41
42{$R *.dfm}
43//const
44//TX_ERR_REFILL = 'Refills must be a number from 0 to 11.'; <-- original line. //kt 8/8/2007
45//TC_ERR_REFILL = 'Refills'; <-- original line. //kt 8/8/2007
46//TC_INVALID_DATE = 'Unable to interpret date/time entry.'; <-- original line. //kt 8/8/2007
47//TX_BAD_START = 'The start date is not valid.'; <-- original line. //kt 8/8/2007
48//TX_BAD_STOP = 'The stop date is not valid.'; <-- original line. //kt 8/8/2007
49//TX_STOPSTART = 'The stop date must be after the start date.'; <-- original line. //kt 8/8/2007
50
51var
52 TX_ERR_REFILL : string; //kt
53 TC_ERR_REFILL : string; //kt
54 TC_INVALID_DATE : string; //kt
55 TX_BAD_START : string; //kt
56 TX_BAD_STOP : string; //kt
57 TX_STOPSTART : string; //kt
58
59
60procedure SetupVars;
61//kt Added entire function to replace constant declarations 8/8/2007
62begin
63 TX_ERR_REFILL := DKLangConstW('fODChangeUnreleasedRenew_Refills_must_be_a_number_from_0_to_11x');
64 TC_ERR_REFILL := DKLangConstW('fODChangeUnreleasedRenew_Refills');
65 TC_INVALID_DATE := DKLangConstW('fODChangeUnreleasedRenew_Unable_to_interpret_datextime_entryx');
66 TX_BAD_START := DKLangConstW('fODChangeUnreleasedRenew_The_start_date_is_not_validx');
67 TX_BAD_STOP := DKLangConstW('fODChangeUnreleasedRenew_The_stop_date_is_not_validx');
68 TX_STOPSTART := DKLangConstW('fODChangeUnreleasedRenew_The_stop_date_must_be_after_the_start_datex');
69end;
70
71procedure ExecuteChangeRenewedOrder(const AnID: string; var param1, param2: string; Category: integer);
72var
73 frmODChangeUnreleasedRenew: TfrmODChangeUnreleasedRenew;
74 theText: string;
75 tmpRefills: integer;
76begin
77 tmpRefills := 0;
78 theText := Trim(RetrieveOrderText(AnID));
79 if Pos('>> RENEW', UpperCase(theText)) = 1 then Delete(theText,1,length('>> RENEW'))
80 else if Pos('RENEW',UpperCase(theText))= 1 then Delete(theText,1,length('RENEW'));
81 frmODChangeUnreleasedRenew := TfrmODChangeUnreleasedRenew.Create(Application);
82 try
83 frmODChangeUnreleasedRenew.FCategory := Category;
84 ResizeFormToFont(TForm(frmODChangeUnreleasedRenew));
85 if Category = 0 then
86 begin
87 frmODChangeUnreleasedRenew.Panel3.Visible := False;
88 tmpRefills := StrToIntDef(param1,0);
89 frmODChangeUnreleasedRenew.edtRefill.Text := param1;
90 frmODChangeUnreleasedRenew.cboPickup.SelectByID(param2);
91 frmODChangeUnreleasedRenew.memOrder.SetTextBuf(PChar(theText));
92 end
93 else if Category = 1 then
94 begin
95 frmODChangeUnreleasedRenew.Panel2.Visible := false;
96 frmODChangeUnreleasedRenew.txtStart.Text := param1;
97 frmODChangeUnreleasedRenew.txtStop.Text := param2;
98 frmODChangeUnreleasedRenew.memOrder.SetTextBuf(PChar(theText));
99 end;
100 frmODChangeUnreleasedRenew.ShowModal;
101 if frmODChangeUnreleasedRenew.OKPressed then
102 begin
103 if Category = 0 then
104 begin
105 tmpRefills := StrToIntDef(frmODChangeUnreleasedRenew.edtRefill.Text, tmpRefills);
106 param1 := IntToStr(tmpRefills);
107 param2 := frmODChangeUnreleasedRenew.cboPickup.ItemID;
108 end
109 else if Category = 1 then
110 begin
111 param1 := frmODChangeUnreleasedRenew.txtStart.Text;
112 param2 := frmODChangeUnreleasedRenew.txtStop.Text;
113 end;
114 end;
115 finally
116 frmODChangeUnreleasedRenew.Release;
117 end;
118end;
119
120procedure TfrmODChangeUnreleasedRenew.FormCreate(Sender: TObject);
121begin
122 inherited;
123 OKPressed := False;
124 with cboPickup.Items do
125 begin
126// Add('W^at Window'); <-- original line. //kt 8/8/2007
127 Add(W^'+DKLangConstW('fODChangeUnreleasedRenew_at_Window')); //kt added 8/8/2007
128// Add('M^by Mail'); <-- original line. //kt 8/8/2007
129 Add('M^'+DKLangConstW('fODChangeUnreleasedRenew_by_Mail')); //kt added 8/8/2007
130// Add('C^in Clinic'); <-- original line. //kt 8/8/2007
131 Add('C^'+DKLangConstW('fODChangeUnreleasedRenew_in_Clinic')); //kt added 8/8/2007
132 end;
133end;
134
135procedure TfrmODChangeUnreleasedRenew.btnCancelClick(Sender: TObject);
136begin
137 inherited;
138 Close;
139end;
140
141procedure TfrmODChangeUnreleasedRenew.btnOKClick(Sender: TObject);
142var
143 NumRefills: Integer;
144 x, ErrMsg: string;
145begin
146 SetupVars; //kt added 8/8/2007 to replace constants with vars.
147 inherited;
148 if panel2.Visible then
149 begin
150 NumRefills := StrToIntDef(edtRefill.Text, -1);
151 if (NumRefills < 0) or (NumRefills > 11) then
152 begin
153 InfoBox(TX_ERR_REFILL, TC_ERR_REFILL, MB_OK);
154 Exit;
155 end;
156 end
157 else if panel3.Visible then
158 begin
159 ErrMsg := '';
160 txtStart.Validate(x);
161 if Length(x) > 0 then ErrMsg := ErrMsg + TX_BAD_START + CRLF;
162 with txtStop do
163 begin
164 Validate(x);
165 if Length(x) > 0 then ErrMsg := ErrMsg + TX_BAD_STOP + CRLF;
166 if (Length(Text) > 0) and (FMDateTime <= txtStart.FMDateTime)
167 then ErrMsg := ErrMsg + TX_STOPSTART;
168 end;
169 if Length(ErrMsg) > 0 then
170 begin
171 InfoBox(ErrMsg, TC_INVALID_DATE, MB_OK);
172 Exit;
173 end;
174 end;
175 OKPressed := True;
176 Close;
177end;
178
179end.
Note: See TracBrowser for help on using the repository browser.