-
Notifications
You must be signed in to change notification settings - Fork 0
/
Main.pas
682 lines (604 loc) · 19.3 KB
/
Main.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
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
unit Main;
interface
uses
Winapi.Windows, Winapi.Messages, System.SysUtils, System.Variants, System.Classes, Vcl.Graphics,
Vcl.Controls, Vcl.Forms, Vcl.Dialogs, Vcl.ComCtrls, Data.DB, Data.Win.ADODB,
Vcl.ExtCtrls, Vcl.ToolWin, Vcl.Menus, Vcl.StdCtrls, Vcl.Buttons, Vcl.Grids, ShellApi,
Vcl.DBGrids, Vcl.DBCtrls, Vcl.Themes, Vcl.Mask;
type
TMainForm = class(TForm)
PageControl1: TPageControl;
TabSheet1: TTabSheet;
TabSheet2: TTabSheet;
TabSheet3: TTabSheet;
BotPanel: TPanel;
StatusBar1: TStatusBar;
Panel1: TPanel;
Panel2: TPanel;
TopPanel: TPanel;
Splitter1: TSplitter;
MainMenu1: TMainMenu;
N1: TMenuItem;
ExitAppMenuItem: TMenuItem;
ChangeUserMenuItem: TMenuItem;
N4: TMenuItem;
N5: TMenuItem;
AboutMenuItem: TMenuItem;
RightPanel: TPanel;
Image1: TImage;
LeftPanel: TPanel;
Splitter2: TSplitter;
Splitter3: TSplitter;
MidPanel: TPanel;
ToolBar1: TToolBar;
ToolButton1: TToolButton;
ToolButton2: TToolButton;
ToolButton3: TToolButton;
ToolButton5: TToolButton;
ToolButton6: TToolButton;
ToolButton7: TToolButton;
BitBtnAdd: TBitBtn;
BitBtnEdit: TBitBtn;
BitBtnDelete: TBitBtn;
PageControl2: TPageControl;
TabSheet7: TTabSheet;
TabSheet8: TTabSheet;
TabSheet9: TTabSheet;
LeftTopPanel: TPanel;
RightBotPanel: TPanel;
EditFilter: TEdit;
EditFilterCat: TEdit;
ToolButton8: TToolButton;
ToolButton9: TToolButton;
ToolButton10: TToolButton;
ToolButton11: TToolButton;
ToolButton4: TToolButton;
ToolButton12: TToolButton;
DBGridProduct: TDBGrid;
DBGridClient: TDBGrid;
DBGrid3: TDBGrid;
DBRichEdit1: TDBRichEdit;
DBRichEdit2: TDBRichEdit;
DBRichEdit3: TDBRichEdit;
LabelSubHeadLine: TLabel;
LabelSubHead: TLabel;
LabelSubCat: TLabel;
LabelURL: TLabel;
ComboBox1: TComboBox;
ToolButton15: TToolButton;
ExportPriceMenuItem: TMenuItem;
DBEdit1: TDBEdit;
EditClientFilter: TEdit;
EditOrderFilter: TEdit;
OrderByCatMenuItem: TMenuItem;
OrderByNameMenuItem: TMenuItem;
OrderByPriceMenuItem: TMenuItem;
OrderByClientNameMenuItem: TMenuItem;
OrderByOrderTotalMenuItem: TMenuItem;
ExportClientList: TMenuItem;
ExportListOrder: TMenuItem;
CopySelectedProductToClipboard: TMenuItem;
Label1: TLabel;
Label2: TLabel;
Label3: TLabel;
Label4: TLabel;
procedure ToolButton11Click(Sender: TObject);
procedure ToolButton1Click(Sender: TObject);
procedure ToolButton5Click(Sender: TObject);
procedure ToolButton3Click(Sender: TObject);
procedure ToolButton9Click(Sender: TObject);
procedure EditFilterChange(Sender: TObject);
procedure EditFilterCatChange(Sender: TObject);
procedure LabelURLClick(Sender: TObject);
procedure FormShow(Sender: TObject); // Çàãðóçêà òåêñòà â ëåáåëû
procedure StatusBarUpdate;
procedure PageControl1Change(Sender: TObject);
procedure LoadImage;
procedure LabelLoadText; // Çàãðóçêà òåêñòà â ëåáåëû
procedure SetGridView; // Íàñòðîéêà øèðèíû êîëîíîê
procedure Image1Click(Sender: TObject);
procedure DBGridProductDrawColumnCell(Sender: TObject; const Rect: TRect;
DataCol: Integer; Column: TColumn; State: TGridDrawState);
procedure DBGridClientDrawDataCell(Sender: TObject; const Rect: TRect;
Field: TField; State: TGridDrawState);
procedure BitBtnAddClick(Sender: TObject);
procedure BitBtnDeleteClick(Sender: TObject);
procedure BitBtnEditClick(Sender: TObject);
procedure ToolButton7Click(Sender: TObject);
procedure ComboBox1Change(Sender: TObject);
procedure ToolButton15Click(Sender: TObject);
procedure FillStyleCombobox;
procedure EditClientFilterChange(Sender: TObject);
procedure EditOrderFilterChange(Sender: TObject);
procedure FormCloseQuery(Sender: TObject; var CanClose: Boolean);
procedure MenuItemClick(Sender: TObject);
procedure DBGridProductTitleClick(Column: TColumn);
procedure DBGridClientTitleClick(Column: TColumn);
procedure DBGrid3TitleClick(Column: TColumn);
private
{ Private declarations }
public
{ Public declarations }
end;
THandleMenuFunc = class(TForm) // Ôóíêöèè ìåíþ
private
procedure ExitFromApp; // Âûõîä
procedure UserChange; // Ñìåíà ïîëüçîâàòåëÿ
/// <summary>
/// Ñîðòèðîâêà ïî êàòåãîðèè
/// </summary>
/// <param name = "desc: Boolean">
/// True - ñîðòèðîâêà ïî âîçðàñòàíèþ False - Ñîðòèðîâêà ïî óáûâàíèþ
/// </param>
procedure SortByCat(desc : Boolean = True);// Ñîðòèðîâêè
procedure SortByName(desc : Boolean = True);
procedure SortByPrice(desc : Boolean = True);
procedure SortByClient;
procedure SortByOrderPrice;
procedure ExportPrice; // Ýêñïîðò ïðàéñ
procedure ShowAbout; // Î ïðîãðàììå
procedure AddBookmark; // Äîáàâèòü çàêëàäêó
procedure CopyToClipBoard; // Êîïèðîâàíèå âûäåëåííûõ çàïèñåé â áóôåð îáìåíà
procedure CopySelectedToClipBoard; // Êîïèðîâàíèå âûäåëåííûõ çàïèñåé â áóôåð îáìåíà
end;
var
MainForm: TMainForm;
HandleMenuFunc: THandleMenuFunc;
implementation
{$R *.dfm}
uses RecCir, SkinTypeTest, ClientPrograms, Events, Schedule, SubMain, DM,
ShowModalImage, EditProduct, EditClient, EditOrder, OrderAdd, Stat, Notes,
About, Login;
procedure TMainForm.BitBtnAddClick(Sender: TObject); //Êíîïêà äîáàâëåíèÿ
begin
if PageControl1.ActivePageIndex = 0 then
if Application.MessageBox('Äîáàâèòü?','',MB_YESNO)=IDYES then
begin
DMl.ADOStoredProcMainView.Append;
FormEditProduct.ShowModal;
end;
if PageControl1.ActivePageIndex = 1 then
if Application.MessageBox('Äîáàâèòü?','',MB_YESNO)=IDYES then
begin
DMl.ADOQueryGetClient.Append;
FormEditClient.ShowModal;
end;
if PageControl1.ActivePageIndex = 2 then
if Application.MessageBox('Äîáàâèòü?','',MB_YESNO)=IDYES then
//DMl.ADOStoredProcGetOrder.Append;
FormOrderAdd.ShowModal;
end;
procedure TMainForm.BitBtnDeleteClick(Sender: TObject); //Êíîïêà óäàëåíèÿ
begin
if PageControl1.ActivePageIndex = 0 then
if Application.MessageBox('Óäàëèòü?','',MB_YESNO)=IDYES then
DMl.ADOStoredProcMainView.Delete;
if PageControl1.ActivePageIndex = 1 then
if Application.MessageBox('Óäàëèòü?','',MB_YESNO)=IDYES then
DMl.ADOQueryGetClient.Delete;
if PageControl1.ActivePageIndex = 2 then
if Application.MessageBox('Óäàëèòü?','',MB_YESNO)=IDYES then
DMl.ADOStoredProcGetOrder.Delete;
end;
procedure TMainForm.BitBtnEditClick(Sender: TObject); //Êíîïêà ðåäàêòèðîâàíèÿ
begin
if PageControl1.ActivePageIndex = 0 then
FormEditProduct.ShowModal;
if PageControl1.ActivePageIndex = 1 then
FormEditClient.ShowModal;
if PageControl1.ActivePageIndex = 2 then
FormOrderAdd.ShowModal;
end;
procedure TMainForm.ComboBox1Change(Sender: TObject); // Ñìåíà ñòèëÿ
begin
TStyleManager.TrySetStyle(ComboBox1.Items[ComboBox1.ItemIndex]);
end;
procedure TMainForm.DBGrid3TitleClick(Column: TColumn);
{$J+}
const PreviousColumnIndex : integer = -1;
{$J-}
var
Index: ShortString;
begin
// ÑÎÐÒÈÐÎÂÊÀ ÏÎ ÊËÈÊÓ ÍÀ ÇÀÃÎËÎÂÎÊ
if DBGrid3.DataSource.DataSet is TCustomADODataSet then
with TCustomADODataSet(DBGrid3.DataSource.DataSet) do
begin
try
DBGrid3.Columns[PreviousColumnIndex].title.Font.Style :=
DBGrid3.Columns[PreviousColumnIndex].title.Font.Style - [fsBold];
except
end;
Column.title.Font.Style :=
Column.title.Font.Style + [fsBold];
PreviousColumnIndex := Column.Index;
if (ANSIPos('['+ Column.Field.FieldName + ']', Sort) = 1)
and (ANSIPos(' DESC', Sort)= 0) then
Sort := '['+ Column.Field.FieldName + ']' + ' DESC'
else
Sort := '[' + Column.Field.FieldName + ']' +' ASC';
end;
end;
procedure TMainForm.DBGridClientDrawDataCell(Sender: TObject; const Rect: TRect;
Field: TField; State: TGridDrawState);
var
Grid : TStringGrid;
Texto : String;
Rectangulo : TRect;
begin
Rectangulo:=Rect;
Grid := TStringGrid(Sender);
if Field.IsBlob then begin
Grid.Canvas.FillRect(Rect);
Texto := Field.AsString;
DrawText( Grid.Canvas.Handle,
PChar(Texto),
StrLen(PChar(Texto)),
Rectangulo,
DT_WORDBREAK);
end;
end;
procedure TMainForm.DBGridClientTitleClick(Column: TColumn);
{$J+}
const PreviousColumnIndex : integer = -1;
{$J-}
var
Index: ShortString;
begin
// ÑÎÐÒÈÐÎÂÊÀ ÏÎ ÊËÈÊÓ ÍÀ ÇÀÃÎËÎÂÎÊ
if DBGridClient.DataSource.DataSet is TCustomADODataSet then
with TCustomADODataSet(DBGridClient.DataSource.DataSet) do
begin
try
DBGridClient.Columns[PreviousColumnIndex].title.Font.Style :=
DBGridClient.Columns[PreviousColumnIndex].title.Font.Style - [fsBold];
except
end;
Column.title.Font.Style :=
Column.title.Font.Style + [fsBold];
PreviousColumnIndex := Column.Index;
if (ANSIPos('['+ Column.Field.FieldName + ']', Sort) = 1)
and (ANSIPos(' DESC', Sort)= 0) then
Sort := '['+ Column.Field.FieldName + ']' + ' DESC'
else
Sort := '[' + Column.Field.FieldName + ']' +' ASC';
end;
end;
procedure TMainForm.DBGridProductDrawColumnCell(Sender: TObject;
const Rect: TRect; DataCol: Integer; Column: TColumn; State: TGridDrawState);
const
clPaleGreen = TColor($CCFFCC);
clPaleRed = TColor($CCCCFF);
// Âûäåëåíèå ñòðîêè öâåòîì
begin
if Column.Field.Dataset.FieldByName('Áàçîâàÿ öåíà').AsString > Column.Field.Dataset.FieldByName('Òåêóùàÿ öåíà').AsString then
if (gdFocused in State) then //èìååò ëè ÿ÷åéêà ôîêóñ?
DBGridProduct.Canvas.Brush.Color := clSkyBlue //èìååò ôîêóñ
else
DBGridProduct.Canvas.Brush.Color := clPaleGreen; //íå èìååò ôîêóñà
//Òåïåðü äàâàéòå çàêðàñèì ÿ÷åéêó èñïîëüçóÿ ñòàíäàðòíûé ìåòîä:
DBGridProduct.DefaultDrawColumnCell(Rect, DataCol, Column, State)
end;
procedure TMainForm.DBGridProductTitleClick(Column: TColumn);
{$J+}
const PreviousColumnIndex : integer = -1;
{$J-}
var
Index: ShortString;
begin
// ÑÎÐÒÈÐÎÂÊÀ ÏÎ ÊËÈÊÓ ÍÀ ÇÀÃÎËÎÂÎÊ
if DBGridProduct.DataSource.DataSet is TCustomADODataSet then
with TCustomADODataSet(DBGridProduct.DataSource.DataSet) do
begin
try
DBGridProduct.Columns[PreviousColumnIndex].title.Font.Style :=
DBGridProduct.Columns[PreviousColumnIndex].title.Font.Style - [fsBold];
except
end;
Column.title.Font.Style :=
Column.title.Font.Style + [fsBold];
PreviousColumnIndex := Column.Index;
if (ANSIPos('['+ Column.Field.FieldName + ']', Sort) = 1)
and (ANSIPos(' DESC', Sort)= 0) then
Sort := '['+ Column.Field.FieldName + ']' + ' DESC'
else
Sort := '[' + Column.Field.FieldName + ']' +' ASC';
end;
end;
procedure TMainForm.EditClientFilterChange(Sender: TObject);
begin
// Ôèëüòð äëÿ ôàìèëèè êëèåíòîâ
if Length(EditClientFilter.Text) >0 then
begin
DMl.ADOQueryGetClient.Filter := '[Ôàìèëèÿ] LIKE '''+'*'+ EditClientFilter.Text+'*' + '''';
DMl.ADOQueryGetClient.Filtered := True;
end
else
begin
DMl.ADOQueryGetClient.Filtered := False;
end;
end;
procedure TMainForm.EditFilterCatChange(Sender: TObject);
begin
// Ôèëüòð äëÿ êàòåãîðèé
if Length(EditFilterCat.Text) >0 then
begin
DMl.ADOStoredProcMainView.Filter := '[Êàòåãîðèÿ] LIKE '''+'*'+ EditFilterCat.Text+'*' + '''';
DMl.ADOStoredProcMainView.Filtered := True;
end
else
begin
DMl.ADOStoredProcMainView.Filtered := False;
end;
end;
procedure TMainForm.EditFilterChange(Sender: TObject);
begin
// Ôèëüòð äëÿ íàçâàíè ïðîäóêòîâ
if Length(EditFilter.Text) >0 then
begin
DMl.ADOStoredProcMainView.Filter := '[Ïðîäóêò] LIKE '''+'*'+ EditFilter.Text+'*' + '''';
DMl.ADOStoredProcMainView.Filtered := True;
end
else
begin
DMl.ADOStoredProcMainView.Filtered := False;
end;
end;
procedure TMainForm.EditOrderFilterChange(Sender: TObject);
begin
// Ôèëüòð äëÿ íîìåðà çàêàçà
if Length(EditOrderFilter.Text) >0 then
begin
DMl.ADOStoredProcGetOrder.Filter := '[ID] = ' + EditOrderFilter.Text + '';
DMl.ADOStoredProcGetOrder.Filtered := True;
end
else
begin
DMl.ADOStoredProcGetOrder.Filtered := False;
end;
end;
procedure TMainForm.MenuItemClick(Sender: TObject); // Êëèê ïî ìåíþ àéòåìñó
begin
//
case (Sender as TMenuItem).Tag of
1: HandleMenuFunc.ExitFromApp; // Âûõîä èç ïðîãðàììû
2: HandleMenuFunc.UserChange ; // Ñìåíà ïîëüçîâàòåëÿ
12: HandleMenuFunc.ShowAbout ; // Î ïðîãðàììå
7: HandleMenuFunc.SortByCat(); // Ñîðòèðîâêà ïî êàòåãîðèè
8: HandleMenuFunc.SortByName(); // Ñîðòèðîâêà ïî íàçâàíèþ ïðîäóêòà
9: HandleMenuFunc.SortByPrice(); // Ñîðòèðîâêà ïî öåíå ïðîäóêòà
10: HandleMenuFunc.SortByClient; // Ñîðòèðîâêà ïî ôàìèëèè êëèåíòà
11: HandleMenuFunc.SortByOrderPrice; // Ñîðòèðîâêà ïî ñòîèìîñòè çàêàçà
end;
end;
procedure TMainForm.FillStyleCombobox;
var
s: string;
begin
ComboBox1.Items.BeginUpdate;
try
ComboBox1.Items.Clear;
for s in TStyleManager.StyleNames do
ComboBox1.Items.Add(s);
ComboBox1.Sorted := True;
// Select the style that's currently in use in the combobox
ComboBox1.ItemIndex := ComboBox1.Items.IndexOf(TStyleManager.ActiveStyle.Name);
finally
ComboBox1.Items.EndUpdate;
end;
end;
procedure TMainForm.FormCloseQuery(Sender: TObject; var CanClose: Boolean);
begin
CanClose := False;
if Application.MessageBox('Çàêðûòü?','Âûõîä èç ïðîãðàììû', MB_YESNO+MB_ICONQUESTION) = IDYES then
begin
CanClose := True;
end;
end;
procedure TMainForm.FormShow(Sender: TObject);
var
s: string;
begin
SetGridView;
StatusBarUpdate;
FillStyleCombobox;
end;
procedure TMainForm.Image1Click(Sender: TObject);
begin
FormShowModalImage.ShowModal;
end;
procedure TMainForm.LabelLoadText;
begin
try
LabelURL.Caption := DMl.ADOStoredProcMainView.FieldByName('URL').Value;
except
LabelURL.Caption := ' ';
end;
try
LabelSubHeadline.Caption := DMl.ADOStoredProcMainView.FieldByName('ïîäçàãîëîâîê').Value;
except
LabelSubHeadline.Caption := ' ';
end;
try
LabelSubHead.Caption := DMl.ADOStoredProcMainView.FieldByName('êàòåãîðèÿ').Value;
except
LabelSubHead.Caption := ' ';
end;
try
LabelSubCat.Caption := DMl.ADOStoredProcMainView.FieldByName('ïîäêàòåãîðèÿ').Value;
except
LabelSubCat.Caption := ' ';
end;
end;
procedure TMainForm.LabelURLClick(Sender: TObject);
begin
ShellExecute(Application.Handle, PChar('open'), PChar(LabelURL.Caption),
nil, nil, SW_SHOW);
end;
procedure TMainForm.LoadImage;
begin
try
image1.Picture.LoadFromFile(GetCurrentDir+'/Images/'+DMl.ADOStoredProcMainView.FieldByName('Image').Text);
except
image1.Picture.LoadFromFile(GetCurrentDir+ '\Images\no-image-large.jpg');
end;
end;
procedure TMainForm.PageControl1Change(Sender: TObject);
begin
StatusBarUpdate;
SetGridView;
end;
procedure TMainForm.SetGridView;
begin
if PageControl1.ActivePageIndex = 0 then // Ïðîäóêòû
begin
DBGridProduct.Columns[0].Visible := False;
DBGridProduct.Columns[1].Width := 40;
DBGridProduct.Columns[2].Width := 300;
DBGridProduct.Columns[3].Width := 40;
DBGridProduct.Columns[4].Width := 80;
DBGridProduct.Columns[5].Width := 80;
DBGridProduct.Columns[6].Width := 500;
DBGridProduct.Columns[7].Visible := False;
DBGridProduct.Columns[8].Visible := False;
DBGridProduct.Columns[9].Visible := False;
DBGridProduct.Columns[10].Width := 300;
DBGridProduct.Columns[11].Visible := False;
DBGridProduct.Columns[12].Visible := False;
DBGridProduct.Columns[13].Visible := False;
DBGridProduct.Columns[14].Visible := False;
DBGridProduct.Columns[15].Visible := False;
end;
if PageControl1.ActivePageIndex = 1 then // Êëèåíòû
begin
DBGridClient.Columns[0].Visible := False;
DBGridClient.Columns[1].Width := 100;
DBGridClient.Columns[2].Width := 100;
DBGridClient.Columns[3].Width := 100;
DBGridClient.Columns[4].Width := 100;
DBGridClient.Columns[5].Width := 200;
DBGridClient.Columns[6].Width := 100;
DBGridClient.Columns[7].Visible := False;
end;
if PageControl1.ActivePageIndex = 2 then // Çàêàçû
begin
try
DBGrid3.Columns[0].Width := 40;
DBGrid3.Columns[1].Width := 100;
DBGrid3.Columns[2].Width := 100;
DBGrid3.Columns[3].Width := 100;
DBGrid3.Columns[4].Visible := False;
DBGrid3.Columns[5].Visible := False;
DBGrid3.Columns[6].Visible := False;
except
end;
end;
end;
procedure TMainForm.StatusBarUpdate; // Îáíîâëåíèå ñòàòóñ áàðà
begin
if PageControl1.ActivePageIndex = 0 then
begin
try
StatusBar1.Panels.Items[0].Text := 'Íîìåð òåêóùåé çàïèñè: '+ IntToStr(DMl.ADOStoredProcMainView.RecNo);
except
end;
StatusBar1.Panels.Items[1].Text := 'Êîëè÷åñòâî çàïèñåé: '+ IntToStr(DMl.ADOStoredProcMainView.RecordCount);
end;
if PageControl1.ActivePageIndex = 1 then
begin
try
StatusBar1.Panels.Items[0].Text := 'Íîìåð òåêóùåé çàïèñè: '+ IntToStr(DMl.ADOQueryGetClient.RecNo);
except
end;
StatusBar1.Panels.Items[1].Text := 'Êîëè÷åñòâî çàïèñåé: '+ IntToStr(DMl.ADOQueryGetClient.RecordCount);
end;
if PageControl1.ActivePageIndex = 2 then
begin
StatusBar1.Panels.Items[0].Text := 'Íîìåð òåêóùåé çàïèñè: '+ IntToStr(DMl.ADOStoredProcGetOrder.RecNo);
StatusBar1.Panels.Items[1].Text := 'Êîëè÷åñòâî çàïèñåé: '+ IntToStr(DMl.ADOStoredProcGetOrder.RecordCount);
end;
end;
procedure TMainForm.ToolButton11Click(Sender: TObject);
begin
FormSkinType.ShowModal;
end;
procedure TMainForm.ToolButton15Click(Sender: TObject);
begin
FormNotes.Show;
end;
procedure TMainForm.ToolButton1Click(Sender: TObject);
begin
ClientProgramsForm.ShowModal; // Ïðîãðàììû êîìïàíèè
end;
procedure TMainForm.ToolButton3Click(Sender: TObject);
begin // Ðàñïèñàíèå
FormSchedule.ShowModal;
end;
procedure TMainForm.ToolButton5Click(Sender: TObject);
begin
FormEvents.ShowModal; // Ñîáûòèÿ êîìïàíèè
end;
procedure TMainForm.ToolButton7Click(Sender: TObject);
begin
StatForm.ShowModal;
end;
procedure TMainForm.ToolButton9Click(Sender: TObject);
begin
SubMainForm.ShowModal;
end;
{ THandleMenuFunc }
procedure THandleMenuFunc.AddBookmark;
begin
end;
procedure THandleMenuFunc.CopySelectedToClipBoard;
begin
end;
procedure THandleMenuFunc.CopyToClipBoard;
begin
end;
procedure THandleMenuFunc.ExitFromApp;
begin
Close;
end;
procedure THandleMenuFunc.ExportPrice;
begin
end;
procedure THandleMenuFunc.ShowAbout;
begin
AboutForm.ShowModal;
end;
procedure THandleMenuFunc.SortByCat(desc: Boolean);
begin
if desc = True then
DMl.ADOStoredProcMainView.Sort := 'Êàòåãîðèÿ'
else
DMl.ADOStoredProcMainView.Sort := 'Êàòåãîðèÿ DESC';
end;
procedure THandleMenuFunc.SortByClient;
begin
DMl.ADOQueryGetClient.Sort := '['+'Ôàìèëèÿ'+']'
end;
procedure THandleMenuFunc.SortByName(desc: Boolean);
begin
if desc = True then
DMl.ADOStoredProcMainView.Sort := 'Ïðîäóêò'
else
DMl.ADOStoredProcMainView.Sort := 'Ïðîäóêò DESC';
end;
procedure THandleMenuFunc.SortByOrderPrice; { TODO : Èñïðàâèòü }
begin
//DMl.ADOStoredProcGetOrder.Sort := '['+' '+']'
end;
procedure THandleMenuFunc.SortByPrice(desc: Boolean);
begin
if desc = True then
DMl.ADOStoredProcGuestView.Sort := '['+'áàçîâàÿ öåíà'+']'
else
DMl.ADOStoredProcGuestView.Sort := '['+'áàçîâàÿ öåíà'+']'+ ' DESC';
end;
procedure THandleMenuFunc.UserChange;
begin
LoginForm.Show;
MainForm.Visible := False;
end;
end.