source: cprs/branches/HealthSevak-CPRS/CPRS-Chart/fDefaultEvent.pas@ 1704

Last change on this file since 1704 was 830, checked in by Kevin Toppenberg, 14 years ago

Upgrading to version 27

File size: 3.5 KB
Line 
1unit fDefaultEvent;
2
3interface
4
5uses
6 Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
7 StdCtrls, ORCtrls, ExtCtrls, rOrders, ORFn, uCore, fBase508Form,
8 VA508AccessibilityManager;
9
10type
11 TfrmDefaultEvent = class(TfrmBase508Form)
12 pnlTop: TPanel;
13 lblCaption: TLabel;
14 cboEvents: TORComboBox;
15 pnlBottom: TPanel;
16 btnOK: TButton;
17 btnCancel: TButton;
18 procedure btnCancelClick(Sender: TObject);
19 procedure FormCreate(Sender: TObject);
20 procedure btnOKClick(Sender: TObject);
21 private
22 OKPressed: boolean;
23 FDefaultEvtName: string;
24 FPreDefaultEvtID: string;
25 FPreDefaultEvtName: string;
26 public
27 { Public declarations }
28 end;
29
30function ExcueteDefaultEvntSetting: string;
31
32var
33 frmDefaultEvent: TfrmDefaultEvent;
34
35implementation
36
37uses VAUtils;
38
39{$R *.DFM}
40
41function ExcueteDefaultEvntSetting: string;
42var
43 frmDefaultEvent: TfrmDefaultEvent;
44begin
45 frmDefaultEvent := TfrmDefaultEvent.Create(Application);
46 try
47 ResizeAnchoredFormToFont(frmDefaultEvent);
48 frmDefaultEvent.ShowModal;
49 Result := frmDefaultEvent.FDefaultEvtName;
50 finally
51 frmDefaultEvent.Free;
52 end;
53end;
54
55procedure TfrmDefaultEvent.btnCancelClick(Sender: TObject);
56begin
57 Close;
58end;
59
60procedure TfrmDefaultEvent.FormCreate(Sender: TObject);
61var
62 i : integer;
63begin
64 FPreDefaultEvtID := '';
65 FPreDefaultEvtName := '';
66 FDefaultEvtName := '';
67 FPreDefaultEvtID := GetDefaultEvt(IntToStr(User.DUZ));
68 ListSpecialtiesED(#0,cboEvents.Items);
69 with cboEvents do
70 begin
71 for i := 0 to Items.Count - 1 do
72 begin
73 if FPreDefaultEvtID = Piece(Items[i],'^',1) then
74 begin
75 ItemIndex := i;
76 FPreDefaultEvtName := Piece(Items[i],'^',9);
77 if Length(FPreDefaultEvtName)<1 then
78 FPreDefaultEvtName := Piece(Items[i],'^',2);
79 break;
80 end;
81 end;
82 end;
83 OKPressed := False;
84end;
85
86procedure TfrmDefaultEvent.btnOKClick(Sender: TObject);
87const
88 TXT_1 = 'Would you like to change the default event from "';
89 TXT_2 = '" to "';
90 TXT_3 = 'Would you like set your default event to "';
91var
92 errMsg: string;
93begin
94 if cboEvents.ItemIndex < 0 then
95 begin
96 ShowMsg('You have to select an event first!');
97 Exit;
98 end;
99 if (Piece(cboEvents.Items[cboEvents.ItemIndex],'^',1) <> FPreDefaultEvtID) and ( Length(FPreDefaultEvtID)>0 )then
100 begin
101 if InfoBox(TXT_1 + FPreDefaultEvtName + TXT_2 + cboEvents.Text + '"?','Warning', MB_OKCANCEL or MB_ICONWARNING) = IDOK then
102 begin
103 errMsg := '';
104 SetDefaultEvent(errMsg, Piece(cboEvents.Items[cboEvents.ItemIndex],'^',1));
105 if length(errMsg)>0 then
106 ShowMsg(errMsg)
107 else
108 ShowMsg('The default release event "' + cboEvents.Text + '" has been set successfully!');
109 FDefaultEvtName := cboEvents.Text;
110 OKPressed := True;
111 Close;
112 end;
113 end
114 else if (Piece(cboEvents.Items[cboEvents.ItemIndex],'^',1) <> FPreDefaultEvtID) and ( Length(FPreDefaultEvtID)=0 )then
115 begin
116 if InfoBox(TXT_3 + cboEvents.Text + '"?','Warning', MB_OKCANCEL or MB_ICONWARNING) = IDOK then
117 begin
118 errMsg := '';
119 SetDefaultEvent(errMsg, Piece(cboEvents.Items[cboEvents.ItemIndex],'^',1));
120 if length(errMsg)>0 then
121 ShowMsg(errMsg)
122 else
123 ShowMsg('The default release event "' + cboEvents.Text + '" has been set successfully!');
124 FDefaultEvtName := cboEvents.Text;
125 OKPressed := True;
126 Close;
127 end;
128 end;
129end;
130
131end.
Note: See TracBrowser for help on using the repository browser.