-
Notifications
You must be signed in to change notification settings - Fork 9
/
Copy pathobjHomeCustomer.pas
339 lines (295 loc) · 14.1 KB
/
objHomeCustomer.pas
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
unit objHomeCustomer;
interface
uses
Windows
, Messages
, SysUtils
, Variants
, Classes
, Contnrs
, Dialogs
, ADODB
, uUtils
, cmpRoomerDataSet
, cmpRoomerConnection
, uAlerts
;
TYPE
//****** DataLayout *******//
//ID int NO Auto
//Customer nvarchar(15) NO
//Surname nvarchar(100) YES
//Name nvarchar(100) YES
//PID nvarchar(15) YES
//Address1 nvarchar(100) YES
//Address2 nvarchar(100) YES
//Address3 nvarchar(100) YES
//Address4 nvarchar(100) YES
//Tel1 nvarchar(15) YES
//Tel2 nvarchar(15) YES
//Fax nvarchar(15) YES
{From country}
//Country nvarchar(2) YES
{From CustomerType}
//CustomerType nvarchar(5) YES
//DiscountPercent float YES
{From ReserVation}
//EmailAddress nvarchar(100) YES
//Homepage nvarchar(100) YES
//ContactPerson nvarchar(100) YES
{From ReserVation}
{From ReserVation}
{From ReserVation}
//TravelAgency bit NO
//Currency nvarchar(5) YES
{??}
//pcID int YES
{From pcId}
//Active bit YES
{$M+}
THomeCustomer = class(TObject)
private
FCustomerID : Integer ;
FCustomer : string ;
FCustomerName : string ;
FCustomerRatePlanId : Integer ;
FDisplayName : string ;
FPID : string ;
FAddress1 : string ;
FAddress2 : string ;
FAddress3 : string ;
FAddress4 : string ;
FTel1 : string ;
FTel2 : string ;
FFax : string ;
FCountryName : string ;
FCountry : string ;
FMarketSegmentName : string ;
FMarketSegmentCode : string ;
FDiscountPerc : double ;
FEmailAddress : string ;
FHomePage : string ;
FContactPerson : string ;
FContactAddress1 : string ;
FContactAddress2 : string ;
FContactAddress3 : string ;
FContactAddress4 : string ;
FContactEmail : string ;
FContactPhone : string ;
FContactFax : string ;
FisTravelAgency : boolean ;
FCurrency : string ;
FCustMemoText : string ;
FpriceCodeId : integer ;
FpcCode : string ;
FActive : boolean ;
//This fiekds are used when making
//Quick reservation
FisReservation : boolean ;
FReservationName : string ;
FGuestName : string ;
FroomStatus : string ;
FReservationPaymentInfo : string ;
FReservationGeneralInfo : string ;
FisGroupInvoice : boolean ;
FShowDiscountOnInvoice : boolean ;
//new 2013-01-14
FRoomResDiscount : double ;
FisRoomResDiscountPrec : boolean;
FinvRefrence : string;
FHotelCode : string;
FContactIsMainGuest : boolean;
FContactCountry: string;
FPersonProfileId: Integer;
FCreatePersonProfileId: Boolean;
procedure initVaribles;
function Customer_Get(customer : string) : boolean;
protected
public
constructor Create(const HotelCode, Customer : string); overload;
constructor Create(const HotelCode, customer : string; contactAddress1,contactAddress2,contactAddress3,contactAddress4 : string); overload;
constructor Create(const HotelCode : string; Reservation, RoomReservation : integer); overload;
function Customer_update(customer : string) : boolean;
destructor Destroy; override;
published
property CustomerID : Integer read FCustomerID write FCustomerID ;
property Customer : string read FCustomer write FCustomer ;
property CustomerName : string read FCustomerName write FCustomerName ;
property DisplayName : string read FDisplayName write FDisplayName ;
property PID : string read FPID write FPID ;
property Address1 : string read FAddress1 write FAddress1 ;
property Address2 : string read FAddress2 write FAddress2 ;
property Address3 : string read FAddress3 write FAddress3 ;
property Address4 : string read FAddress4 write FAddress4 ;
property Tel1 : string read FTel1 write FTel1 ;
property Tel2 : string read FTel2 write FTel2 ;
property Fax : string read FFax write FFax ;
property CountryName : string read FCountryName write FCountryName ;
property Country : string read FCountry write FCountry ;
property MarketSegmentName : string read FMarketSegmentName write FMarketSegmentName ;
property MarketSegmentCode : string read FMarketSegmentCode write FMarketSegmentCode ;
property DiscountPerc : double read FDiscountPerc write FDiscountPerc ;
property EmailAddress : string read FEmailAddress write FEmailAddress ;
property HomePage : string read FHomePage write FHomePage ;
property ContactPerson : string read FContactPerson write FContactPerson ;
property ContactAddress1 : string read FContactAddress1 write FContactAddress1 ;
property ContactAddress2 : string read FContactAddress2 write FContactAddress2 ;
property ContactAddress3 : string read FContactAddress3 write FContactAddress3 ;
property ContactAddress4 : string read FContactAddress4 write FContactAddress4 ;
property ContactCountry : string read FContactCountry write FContactCountry ;
property PersonProfileId : Integer read FPersonProfileId write FPersonProfileId ;
property CreatePersonProfileId : Boolean read FCreatePersonProfileId write FCreatePersonProfileId ;
property ContactEmail : string read FContactEmail write FContactEmail ;
property ContactPhone : string read FContactPhone write FContactPhone ;
property ContactFax : string read FContactFax write FContactFax ;
property isTravelAgency : boolean read FisTravelAgency write FisTravelAgency ;
property Currency : string read FCurrency write FCurrency ;
property CustMemoText : string read FCustMemoText write FCustMemoText ;
property priceCodeId : integer read FpriceCodeId write FpriceCodeId ;
property pcCode : string read FpcCode write FpcCode ;
property Active : boolean read FActive write FActive ;
property isReservation : boolean read FisReservation write FisReservation ;
property ReservationName : string read FReservationName write FReservationName ;
property GuestName : string read FGuestName write FGuestName
;
property roomStatus : string read FroomStatus write FroomStatus ;
property ReservationPaymentInfo : string read FReservationPaymentInfo write FReservationPaymentInfo ;
property ReservationGeneralInfo : string read FReservationGeneralInfo write FReservationGeneralInfo ;
property isGroupInvoice : boolean read FisGroupInvoice write FisGroupInvoice ;
property ShowDiscountOnInvoice : boolean read FShowDiscountOnInvoice write FShowDiscountOnInvoice ;
property RoomResDiscount : double read FRoomResDiscount write FRoomResDiscount ;
property isRoomResDiscountPrec : boolean read FisRoomResDiscountPrec write FisRoomResDiscountPrec ;
property invRefrence : string read FinvRefrence write FinvRefrence;
property HotelCode : string read FHotelCode write FHotelCode ;
property contactIsMainGuest : boolean read FContactIsMainGuest write FContactIsMainGuest ;
property CustomerRatePlanId : Integer read FCustomerRatePlanId write FCustomerRatePlanId ;
end;
implementation
{ THomeCustomer }
uses
_glob
, hData
, ud
, ug
,uSqlDefinitions
,uAppGlobal
;
constructor THomeCustomer.Create(const HotelCode, customer : string);
begin
FHotelCode := HotelCode;
FCustomer := Customer;
Customer_Get(FCustomer);
end;
constructor THomeCustomer.Create(const HotelCode : string; Reservation, RoomReservation : integer);
begin
FHotelCode := HotelCode;
FCustomer := '';
Customer_Get(FCustomer);
end;
constructor THomeCustomer.Create(const HotelCode,customer : string; contactAddress1,contactAddress2,contactAddress3,contactAddress4 : string);
begin
FHotelCode := HotelCode;
FCustomer := '';
Customer_Get(FCustomer);
FContactAddress1 := ContactAddress1;
FContactAddress2 := ContactAddress2;
FContactAddress3 := ContactAddress3;
FContactAddress4 := ContactAddress4;
end;
destructor THomeCustomer.Destroy;
begin
//
inherited;
end;
procedure THomeCustomer.initVaribles;
begin
if Fcustomer='' then
begin
FCustomer := hData.ctrlGetString('rackCustomer')
end;
FCustomerName := '';
FDisplayName := '';
FPID := '';
FAddress1 := '';
FAddress2 := '';
FAddress3 := '';
FAddress4 := '';
FTel1 := '';
FTel2 := '';
FFax := '';
FCountryName := '';
FCountry := hdata.Country_GetDefault();
FMarketSegmentName := '';
FMarketSegmentCode := hdata.CustomerTypes_GetDefault();
FDiscountPerc := 0.00; // * //**
FEmailAddress := '';
FHomePage := '';
FContactPerson := '';
FContactEmail := '';
FContactPhone := '';
FContactFax := '';
FisTravelAgency := false;
FCurrency := hdata.ctrlGetString('NativeCurrency');
FCustMemoText := '';
FpriceCodeId := hdata.PriceCodes_GETRack();
FpcCode := '';
// This is just if making reservation
FisReservation := false;
FReservationName := '';
FGuestName := '';
FroomStatus := '';
FReservationPaymentInfo := '';
FReservationGeneralInfo := '';
FisGroupInvoice := false;
FContactIsMainGuest := true;
FShowDiscountOnInvoice := True;
FRoomResDiscount := 0.00;
FisRoomResDiscountPrec := true;
FinvRefrence := '';
end;
function THomeCustomer.Customer_Get(customer : string) : boolean;
begin
result := False;
FCustomer := Customer;
initVaribles;
if glb.CustomersSet.Locate('Customer',customer,[]) then
begin
FCustomer := glb.CustomersSet.FieldByName('Customer').AsString;
FCustomerID := glb.CustomersSet.FieldByName('ID').AsInteger;
FCustomerName := glb.CustomersSet.FieldByName('Surname').AsString;
FDisplayName := glb.CustomersSet.FieldByName('Name').AsString;
FPID := glb.CustomersSet.FieldByName('PID').AsString;
FAddress1 := glb.CustomersSet.FieldByName('Address1').AsString;
FAddress2 := glb.CustomersSet.FieldByName('Address2').AsString;
FAddress3 := glb.CustomersSet.FieldByName('Address3').AsString;
FAddress4 := glb.CustomersSet.FieldByName('Address4').AsString;
FTel1 := glb.CustomersSet.FieldByName('Tel1').AsString;
FTel2 := glb.CustomersSet.FieldByName('Tel2').AsString;
FFax := glb.CustomersSet.FieldByName('Fax').AsString;
FCountry := glb.CustomersSet.FieldByName('Country').AsString;
FMarketSegmentCode := glb.CustomersSet.FieldByName('CustomerType').AsString;
FDiscountPerc := LocalFloatValue(glb.CustomersSet.FieldByName('DiscountPercent').AsString);
FEmailAddress := glb.CustomersSet.FieldByName('EmailAddress').AsString;
FHomePage := glb.CustomersSet.FieldByName('Homepage').AsString;
FContactPerson := glb.CustomersSet.FieldByName('ContactPerson').AsString;
FisTravelAgency := glb.CustomersSet['TravelAgency'];
FCurrency := glb.CustomersSet.FieldByName('Currency').AsString;
FpriceCodeId := glb.CustomersSet.FieldByName('pcID').AsInteger;
FCustomerRatePlanId := glb.CustomersSet.FieldByName('RatePlanId').AsInteger;
FpcCode := PriceCode_Code(FPriceCodeId);
if glb.CustomertypesSet.Locate('CustomerType',FMarketSegmentCode,[]) then
begin
FMarketSegmentName := glb.CustomertypesSet.FieldByName('Description').AsString;
end;
if glb.Countries.Locate('country',FCountry,[]) then
begin
FCountryName := glb.Countries.FieldByName('CountryName').AsString;
end;
end;
end;
function THomeCustomer.Customer_update(customer: string): boolean;
begin
FCustomer := Customer;
result := Customer_Get(FCustomer);
end;
end.