[453] | 1 | //kt -- Modified with SourceScanner on 8/7/2007
|
---|
| 2 | unit fRenewOutMed;
|
---|
| 3 |
|
---|
| 4 | interface
|
---|
| 5 |
|
---|
| 6 | uses
|
---|
| 7 | Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
|
---|
| 8 | fAutoSz, StdCtrls, ComCtrls, ORFn, rOrders, Mask, ORCtrls, ExtCtrls,
|
---|
| 9 | DKLang;
|
---|
| 10 |
|
---|
| 11 | type
|
---|
| 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 |
|
---|
| 30 | function ExecuteRenewOutMed(var Refills: Integer; var Comments, Pickup: string;
|
---|
| 31 | AnOrder: TOrder): Boolean;
|
---|
| 32 |
|
---|
| 33 | implementation
|
---|
| 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 |
|
---|
| 41 | var
|
---|
| 42 | TX_ERR_REFILL : string; //kt
|
---|
| 43 | TC_ERR_REFILL : string; //kt
|
---|
| 44 |
|
---|
| 45 | procedure SetupVars;
|
---|
| 46 | //kt Added entire function to replace constant declarations 8/7/2007
|
---|
| 47 | begin
|
---|
| 48 | TX_ERR_REFILL := DKLangConstW('fRenewOutMed_Refills_must_be_a_number_from_0_to_11x');
|
---|
| 49 | TC_ERR_REFILL := DKLangConstW('fRenewOutMed_Refills');
|
---|
| 50 | end;
|
---|
| 51 |
|
---|
| 52 | function ExecuteRenewOutMed(var Refills: Integer; var Comments, Pickup: string;
|
---|
| 53 | AnOrder: TOrder): Boolean;
|
---|
| 54 | var
|
---|
| 55 | frmRenewOutMed: TfrmRenewOutMed;
|
---|
| 56 | begin
|
---|
| 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;
|
---|
| 74 | end;
|
---|
| 75 |
|
---|
| 76 | procedure TfrmRenewOutMed.FormCreate(Sender: TObject);
|
---|
| 77 | begin
|
---|
| 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;
|
---|
| 86 | end;
|
---|
| 87 |
|
---|
| 88 | procedure TfrmRenewOutMed.cmdOKClick(Sender: TObject);
|
---|
| 89 | var
|
---|
| 90 | NumRefills: Integer;
|
---|
| 91 | begin
|
---|
| 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;
|
---|
| 102 | end;
|
---|
| 103 |
|
---|
| 104 | procedure TfrmRenewOutMed.cmdCancelClick(Sender: TObject);
|
---|
| 105 | begin
|
---|
| 106 | inherited;
|
---|
| 107 | Close;
|
---|
| 108 | end;
|
---|
| 109 |
|
---|
| 110 | end.
|
---|