source: cprs/branches/tmg-cprs/CPRS-Chart/fRenewOutMed.pas@ 568

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

Initial upload of TMG-CPRS 1.0.26.69

File size: 2.8 KB
RevLine 
[453]1//kt -- Modified with SourceScanner on 8/7/2007
2unit fRenewOutMed;
3
4interface
5
6uses
7 Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
8 fAutoSz, StdCtrls, ComCtrls, ORFn, rOrders, Mask, ORCtrls, ExtCtrls,
9 DKLang;
10
11type
12 TfrmRenewOutMed = class(TForm)
13 memOrder: TCaptionMemo;
14 pnlButtons: TPanel;
15 cmdOK: TButton;
16 cmdCancel: TButton;
17 pnlMiddle: TPanel;
18 cboPickup: TORComboBox;
19 lblPickup: TLabel;
20 txtRefills: TCaptionEdit;
21 lblRefills: TLabel;
22 DKLanguageController1: TDKLanguageController;
23 procedure FormCreate(Sender: TObject);
24 procedure cmdOKClick(Sender: TObject);
25 procedure cmdCancelClick(Sender: TObject);
26 private
27 OKPressed: Boolean;
28 end;
29
30function ExecuteRenewOutMed(var Refills: Integer; var Comments, Pickup: string;
31 AnOrder: TOrder): Boolean;
32
33implementation
34
35{$R *.DFM}
36
37//const
38//TX_ERR_REFILL = 'Refills must be a number from 0 to 11.'; <-- original line. //kt 8/7/2007
39//TC_ERR_REFILL = 'Refills'; <-- original line. //kt 8/7/2007
40
41var
42 TX_ERR_REFILL : string; //kt
43 TC_ERR_REFILL : string; //kt
44
45procedure SetupVars;
46//kt Added entire function to replace constant declarations 8/7/2007
47begin
48 TX_ERR_REFILL := DKLangConstW('fRenewOutMed_Refills_must_be_a_number_from_0_to_11x');
49 TC_ERR_REFILL := DKLangConstW('fRenewOutMed_Refills');
50end;
51
52function ExecuteRenewOutMed(var Refills: Integer; var Comments, Pickup: string;
53 AnOrder: TOrder): Boolean;
54var
55 frmRenewOutMed: TfrmRenewOutMed;
56begin
57 Result := False;
58 frmRenewOutMed := TfrmRenewOutMed.Create(Application);
59 try
60 ResizeFormToFont(TForm(frmRenewOutMed));
61 frmRenewOutMed.memOrder.SetTextBuf(PChar(AnOrder.Text));
62 frmRenewOutMed.txtRefills.Text := IntToStr(Refills);
63 frmRenewOutMed.cboPickup.SelectByID(Pickup);
64 frmRenewOutMed.ShowModal;
65 if frmRenewOutMed.OKPressed then
66 begin
67 Result := True;
68 Refills := StrToIntDef(frmRenewOutMed.txtRefills.Text, Refills);
69 Pickup := frmRenewOutMed.cboPickup.ItemID;
70 end;
71 finally
72 frmRenewOutMed.Release;
73 end;
74end;
75
76procedure TfrmRenewOutMed.FormCreate(Sender: TObject);
77begin
78 inherited;
79 OKPressed := False;
80 with cboPickup.Items do
81 begin
82 Add('W^at Window');
83 Add('M^by Mail');
84 Add('C^in Clinic');
85 end;
86end;
87
88procedure TfrmRenewOutMed.cmdOKClick(Sender: TObject);
89var
90 NumRefills: Integer;
91begin
92 SetupVars; //kt added 8/7/2007 to replace constants with vars.
93 inherited;
94 NumRefills := StrToIntDef(txtRefills.Text, -1);
95 if (NumRefills < 0) or (NumRefills > 11) then
96 begin
97 InfoBox(TX_ERR_REFILL, TC_ERR_REFILL, MB_OK);
98 Exit;
99 end;
100 OKPressed := True;
101 Close;
102end;
103
104procedure TfrmRenewOutMed.cmdCancelClick(Sender: TObject);
105begin
106 inherited;
107 Close;
108end;
109
110end.
Note: See TracBrowser for help on using the repository browser.