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
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
| unit Unit1;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, Menus, ComCtrls, Grids, DBGrids, ToolWin, ImgList,
ExtCtrls, StdCtrls, DB, ADODB;
type
TForm1 = class(TForm)
MainMenu1: TMainMenu;
N1: TMenuItem;
N2: TMenuItem;
N3: TMenuItem;
N4: TMenuItem;
N5: TMenuItem;
N6: TMenuItem;
N7: TMenuItem;
N8: TMenuItem;
N9: TMenuItem;
N10: TMenuItem;
StatusBar1: TStatusBar;
ImageList1: TImageList;
ToolBar1: TToolBar;
ToolButton1: TToolButton;
ToolButton2: TToolButton;
ToolButton3: TToolButton;
ToolButton5: TToolButton;
ToolButton6: TToolButton;
N13: TMenuItem;
N14: TMenuItem;
N15: TMenuItem;
N16: TMenuItem;
ToolButton7: TToolButton;
ToolButton8: TToolButton;
ToolButton9: TToolButton;
Panel2: TPanel;
ToolBar3: TToolBar;
ToolButton15: TToolButton;
ToolButton16: TToolButton;
ToolButton17: TToolButton;
ToolButton18: TToolButton;
ToolButton19: TToolButton;
DBGrid2: TDBGrid;
ToolButton10: TToolButton;
ToolButton11: TToolButton;
DBGrid1: TDBGrid;
Splitter1: TSplitter;
N20: TMenuItem;
N19: TMenuItem;
N21: TMenuItem;
N23: TMenuItem;
procedure N2Click(Sender: TObject);
procedure N6Click(Sender: TObject);
procedure N9Click(Sender: TObject);
procedure N8Click(Sender: TObject);
procedure N7Click(Sender: TObject);
procedure N10Click(Sender: TObject);
procedure DBGrid2DblClick(Sender: TObject);
procedure ToolButton17Click(Sender: TObject);
procedure ToolButton15Click(Sender: TObject);
procedure N21Click(Sender: TObject);
procedure N19Click(Sender: TObject);
procedure ToolButton19Click(Sender: TObject);
procedure N5Click(Sender: TObject);
procedure N14Click(Sender: TObject);
procedure N15Click(Sender: TObject);
procedure N16Click(Sender: TObject);
procedure ToolButton7Click(Sender: TObject);
procedure ToolButton8Click(Sender: TObject);
procedure ToolButton9Click(Sender: TObject);
procedure DBGrid1DblClick(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
procedure MaterialP();
procedure UslugaP();
implementation
uses DataUnit, SotrUnit, KlientUnit, ObjectUnit,
EditSotr, KlientEditUnit, MaterialUnit, ObjectEditUnit,
UslugaEditTableUnit, UslugaEditUnit, MaterialEditUnit, AboutUnit,
ZakazEditUnit;
{$R *.dfm}
procedure MaterialP();
var
PosicionUsluga:integer;
StoimostMaterialov:real;
begin
{todo -o -cPaul :услугизапрос на обновление суммы услуги = SUM((Кол-во_мтовара)*(Цена_товара))}
PosicionUsluga := datamodule2.ADOTable4KeyUsluga.AsInteger;
with FormUslugaEdit.ADOQuery1 do
begin
close;
sql.Clear;
sql.Add('SELECT Sum([UslugaMaterialS]![Kolichestvo]*[MaterialS]![CurrentMaterialEdinica])');
sql.Add('FROM MaterialS INNER JOIN UslugaMaterialS ON MaterialS.KeyMaterial = UslugaMaterialS.Material');
sql.Add('WHERE (((UslugaMaterialS.Usluga)= '+inttostr(PosicionUsluga)+' ));');
open;
end;
if datamodule2.ADOTable7.RecordCount = 0 then
StoimostMaterialov := 0;
StoimostMaterialov := FormUslugaEdit.ADOQuery1Expr1000.AsFloat;
try
with datamodule2.QueryUpdate do
begin
close;
sql.Clear;
SQL.Add('UPDATE UslugaS ');
SQL.Add('SET UslugaS.CurrentMaterial = '+ floattostr(StoimostMaterialov));
SQL.Add('WHERE UslugaS.KeyUsluga = '+inttostr(PosicionUsluga));
// showmessage(SQL.Text);
execSQL;
end;
datamodule2.ADOTable4.Refresh;
except
end;
end;
procedure UslugaP();
var
PosicionZakaz:integer;
StoimostUslug:real;
begin
{todo -o -cPaul :ЗАКАЗАзапрос на обновление суммы ЗАКАЗА = SUM((СТОИМОСТЬ_товара)+(СТОИМОСТЬ_ДОСТАВКИ))}
PosicionZakaz := datamodule2.ADOTable6KeyDogovorD.AsInteger;
with datamodule2.ADOQuery1 do
begin
close;
sql.Clear;
sql.Add('SELECT Sum([UslugaS]![CurrentMaterial]+[UslugaS]![StoimostRabot]) ');
sql.Add('FROM UslugaS');
sql.Add('WHERE (((UslugaS.Zakaz)= '+inttostr(PosicionZakaz)+' ));');
open;
end;
if datamodule2.ADOTable7.RecordCount = 0 then
StoimostUslug := 0;
StoimostUslug := datamodule2.ADOQuery1Expr1000.AsFloat;
try
with datamodule2.QueryUpdate do
begin
close;
sql.Clear;
SQL.Add('UPDATE DogovorORemonteU ');
SQL.Add('SET DogovorORemonteU.SumZakaza = '+ floattostr(StoimostUslug));
SQL.Add('WHERE DogovorORemonteU.KeyDogovorD = '+inttostr(PosicionZakaz));
// showmessage(SQL.Text);
execSQL;
end;
datamodule2.ADOTable6.Refresh;
except
end;
end;
procedure TForm1.N2Click(Sender: TObject);
begin
close;
end;
procedure TForm1.N6Click(Sender: TObject);
begin
FormSotr.ShowModal;
end;
procedure TForm1.N9Click(Sender: TObject);
begin
FormKlient.ShowModal;
end;
procedure TForm1.N8Click(Sender: TObject);
begin
FormObject.ShowModal;
end;
procedure TForm1.N7Click(Sender: TObject);
begin
FormUslugaEdit.Caption := 'Услуга на заказ № '+datamodule2.ADOTable6NumberD.AsString+' - '+datamodule2.ADOTable4NameUsluga.AsString;
FormUslugaEdit.showmodal;
end;
procedure TForm1.N10Click(Sender: TObject);
begin
FormMaterial.ShowModal;
end;
procedure TForm1.DBGrid2DblClick(Sender: TObject);
begin
FormUslugaEdit.Caption := 'Услуга на заказ № '+datamodule2.ADOTable6NumberD.AsString+' - '+datamodule2.ADOTable4NameUsluga.AsString;
FormUslugaEdit.showmodal;
end;
procedure TForm1.ToolButton17Click(Sender: TObject);
begin
FormUslugaEdit.Caption := 'Услуга на заказ № '+datamodule2.ADOTable6NumberD.AsString+' - '+datamodule2.ADOTable4NameUsluga.AsString;
FormUslugaEdit.showmodal;
end;
procedure TForm1.ToolButton15Click(Sender: TObject);
begin
datamodule2.ADOTable4.Insert;
FormUslugaEdit.Caption := 'Услуга на заказ № '+datamodule2.ADOTable6NumberD.AsString+' - НОВАЯ *';
FormUslugaEdit.showmodal;
end;
procedure TForm1.N21Click(Sender: TObject);
begin
case application.MessageBox('Вы действительно хотите удалить выбранную услугу?','Подтверждение удаления',MB_YESNO+mb_IconExclamation) of
idYes : datamodule2.ADOTable4.Delete;
idNo : exit;
end;
end;
procedure TForm1.N19Click(Sender: TObject);
begin
datamodule2.ADOTable4.Insert;
FormUslugaEdit.Caption := 'Услуга на заказ № '+datamodule2.ADOTable6NumberD.AsString+' - НОВАЯ *';
FormUslugaEdit.showmodal;
end;
procedure TForm1.ToolButton19Click(Sender: TObject);
begin
case application.MessageBox('Вы действительно хотите удалить выбранную услугу?','Подтверждение удаления',MB_YESNO+mb_IconExclamation) of
idYes : datamodule2.ADOTable4.Delete;
idNo : exit;
end;
end;
procedure TForm1.N5Click(Sender: TObject);
begin
aboutbox.ShowModal;
end;
procedure TForm1.N14Click(Sender: TObject);
begin
FormZakazEdit.Caption := 'Заказ - НОВЫЙ *';
datamodule2.ADOTable6.Insert;
FormZakazEdit.ShowModal;
end;
procedure TForm1.N15Click(Sender: TObject);
begin
FormZakazEdit.Caption := 'Заказ № '+datamodule2.ADOTable6NumberD.AsString;
FormZakazEdit.showmodal;
end;
procedure TForm1.N16Click(Sender: TObject);
begin
case application.MessageBox('Вы действительно хотите удалить выбранный заказ?','Подтверждение удаления',MB_YESNO+mb_IconExclamation) of
idYes : datamodule2.ADOTable6.Delete;
idNo : exit;
end;
end;
procedure TForm1.ToolButton7Click(Sender: TObject);
begin
FormZakazEdit.Caption := 'Заказ - НОВЫЙ *';
datamodule2.ADOTable6.Insert;
FormZakazEdit.ShowModal;
end;
procedure TForm1.ToolButton8Click(Sender: TObject);
begin
FormZakazEdit.Caption := 'Заказ № '+datamodule2.ADOTable6NumberD.AsString;
FormZakazEdit.showmodal;
end;
procedure TForm1.ToolButton9Click(Sender: TObject);
begin
case application.MessageBox('Вы действительно хотите удалить выбранный заказ?','Подтверждение удаления',MB_YESNO+mb_IconExclamation) of
idYes : datamodule2.ADOTable6.Delete;
idNo : exit;
end;
end;
procedure TForm1.DBGrid1DblClick(Sender: TObject);
begin
FormZakazEdit.Caption := 'Заказ № '+datamodule2.ADOTable6NumberD.AsString;
FormZakazEdit.showmodal;
end;
end.
unit Inform;
interface
uses Windows, SysUtils, Classes, Graphics, Forms, Controls, StdCtrls,
Buttons, ExtCtrls;
type
TAboutBox = class(TForm)
Panel1: TPanel;
ProductName: TLabel;
Version: TLabel;
Copyright: TLabel;
Comments: TLabel;
OKButton: TButton;
private
{ Private declarations }
public
{ Public declarations }
end;
var
AboutBox: TAboutBox;
implementation
{$R *.dfm}
end.
unit DataUnit;
interface
uses
SysUtils, Classes, Menus, DB, ADODB;
type
TDataModule2 = class(TDataModule)
ADOConnection1: TADOConnection;
ADOTable1: TADOTable;
ADOTable2: TADOTable;
ADOTable3: TADOTable;
ADOTable4: TADOTable;
ADOTable5: TADOTable;
DataSource1: TDataSource;
DataSource2: TDataSource;
DataSource3: TDataSource;
DataSource4: TDataSource;
DataSource5: TDataSource;
ADOTable6: TADOTable;
DataSource6: TDataSource;
ADOTable6KeyDogovorD: TAutoIncField;
ADOTable6DateZakazaD: TDateTimeField;
ADOTable6DateBeginD: TDateTimeField;
ADOTable6DateEndD: TDateTimeField;
ADOTable6SotrudnikD: TIntegerField;
ADOTable6KlientD: TIntegerField;
ADOTable6ObjectD: TIntegerField;
ADOTable6Sotr: TStringField;
ADOTable6Klie: TStringField;
ADOTable6Obj: TStringField;
ADOTable6NumberD: TWideStringField;
ADOTable1KeySotrudnik: TAutoIncField;
ADOTable1NameSotrudnik: TWideStringField;
ADOTable1FamoliaSotrudnik: TWideStringField;
ADOTable1VaterSotrudnik: TWideStringField;
ADOTable1BirthDay: TDateTimeField;
ADOTable2KeyClient: TAutoIncField;
ADOTable2Name: TWideStringField;
ADOTable2Phone: TWideStringField;
ADOTable2Adress: TWideStringField;
ADOTable3KeyObject: TAutoIncField;
ADOTable3NameObject: TWideStringField;
ADOTable3AdressObject: TWideStringField;
ADOTable3Description: TWideStringField;
ADOTable7: TADOTable;
DataSource7: TDataSource;
ADOTable4KeyUsluga: TAutoIncField;
ADOTable4NameUsluga: TWideStringField;
ADOTable4CurrentMaterial: TFloatField;
ADOTable4StoimostRabot: TFloatField;
ADOTable4Description: TWideStringField;
ADOTable4Days: TSmallintField;
ADOTable4AllSumma: TCurrencyField;
ADOTable7KeyUslugaMaterial: TAutoIncField;
ADOTable7Usluga: TIntegerField;
ADOTable7Material: TIntegerField;
ADOTable7Kolichestvo: TSmallintField;
ADOTable7Description: TWideStringField;
ADOTable7Mater: TStringField;
ADOTable7Cena: TCurrencyField;
ADOTable7Summa: TCurrencyField;
ADOTable5KeyMaterial: TAutoIncField;
ADOTable5NameMaterial: TWideStringField;
ADOTable5CurrentMaterialEdinica: TFloatField;
ADOTable5Description: TWideStringField;
ADOTable4Zakaz: TIntegerField;
ADOTable6SumZakaza: TFloatField;
ADOQuery1: TADOQuery;
ADOQuery1Expr1000: TFloatField;
QueryUpdate: TADOQuery;
ADOTable8Reports: TADOTable;
ADOTable8ReportsNumberD: TWideStringField;
ADOTable8ReportsDateZakazaD: TDateTimeField;
ADOTable8ReportsDateBeginD: TDateTimeField;
ADOTable8ReportsDateEndD: TDateTimeField;
ADOTable8ReportsName: TWideStringField;
ADOTable8ReportsNameObject: TWideStringField;
ADOTable8ReportsFamoliaSotrudnik: TWideStringField;
ADOTable8ReportsSumZakaza: TFloatField;
DataSource8Reports: TDataSource;
procedure ADOTable4CalcFields(DataSet: TDataSet);
procedure ADOTable7CalcFields(DataSet: TDataSet);
private
{ Private declarations }
public
{ Public declarations }
end;
var
DataModule2: TDataModule2;
implementation
uses EditSotr, KlientEditUnit, KlientUnit, ObjectEditUnit, ObjectUnit,
SotrUnit, Unit1;
{$R *.dfm}
procedure TDataModule2.ADOTable4CalcFields(DataSet: TDataSet);
begin
//
DataModule2.ADOTable4AllSumma.AsCurrency := DataModule2.ADOTable4CurrentMaterial.AsCurrency + DataModule2.ADOTable4StoimostRabot.AsCurrency;
end;
procedure TDataModule2.ADOTable7CalcFields(DataSet: TDataSet);
begin
DataModule2.ADOTable7Summa.AsCurrency := DataModule2.ADOTable7Cena.AsCurrency * DataModule2.ADOTable7Kolichestvo.AsInteger;
end;
end.
unit EditSotr;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls, Mask, DBCtrls, ExtCtrls, Buttons;
type
TFormSotrEdit = class(TForm)
DBEdit1: TDBEdit;
DBEdit2: TDBEdit;
DBEdit3: TDBEdit;
DBEdit4: TDBEdit;
Label1: TLabel;
Label2: TLabel;
Label3: TLabel;
Label4: TLabel;
Bevel1: TBevel;
BitBtn1: TBitBtn;
BitBtn2: TBitBtn;
procedure BitBtn1Click(Sender: TObject);
procedure BitBtn2Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
FormSotrEdit: TFormSotrEdit;
implementation
uses DataUnit, SotrUnit, Unit1;
{$R *.dfm}
procedure TFormSotrEdit.BitBtn1Click(Sender: TObject);
begin
if datamodule2.ADOTable1.Modified
then datamodule2.ADOTable1.Post;
end;
procedure TFormSotrEdit.BitBtn2Click(Sender: TObject);
begin
if datamodule2.ADOTable1.Modified
then datamodule2.ADOTable1.Cancel;
end;
end.
unit KlientRed;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls, Mask, DBCtrls, Buttons, ExtCtrls;
type
TFormKlientEdit = class(TForm)
DBEdit1: TDBEdit;
DBEdit2: TDBEdit;
DBEdit3: TDBEdit;
Label1: TLabel;
Label2: TLabel;
Label3: TLabel;
BitBtn2: TBitBtn;
BitBtn1: TBitBtn;
Bevel1: TBevel;
procedure BitBtn1Click(Sender: TObject);
procedure BitBtn2Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
FormKlientEdit: TFormKlientEdit;
implementation
uses DataUnit, EditSotr, KlientUnit, SotrUnit, Unit1;
{$R *.dfm}
procedure TFormKlientEdit.BitBtn1Click(Sender: TObject);
begin
if datamodule2.ADOTable2.Modified
then datamodule2.ADOTable2.Post;
end;
procedure TFormKlientEdit.BitBtn2Click(Sender: TObject);
begin
if datamodule2.ADOTable2.Modified
then datamodule2.ADOTable2.Cancel;
end;
end.
nit KlientUnit;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, ComCtrls, ToolWin, Grids, DBGrids;
type
TFormKlient = class(TForm)
ToolBar1: TToolBar;
ToolButton1: TToolButton;
ToolButton2: TToolButton;
ToolButton3: TToolButton;
ToolButton4: TToolButton;
ToolButton5: TToolButton;
DBGrid1: TDBGrid;
procedure ToolButton1Click(Sender: TObject);
procedure ToolButton3Click(Sender: TObject);
procedure ToolButton5Click(Sender: TObject);
procedure DBGrid1DblClick(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
FormKlient: TFormKlient;
implementation
uses DataUnit, EditSotr, SotrUnit, Unit1, KlientEditUnit;
{$R *.dfm}
procedure TFormKlient.ToolButton1Click(Sender: TObject);
begin
datamodule2.ADOTable2.Insert;
FormKlientEdit.ShowModal;
end;
procedure TFormKlient.ToolButton3Click(Sender: TObject);
begin
FormKlientEdit.ShowModal;
end;
procedure TFormKlient.ToolButton5Click(Sender: TObject);
begin
case application.MessageBox('Вы действительно хотите удалить выбранного клиента?','Подтверждение удаления',MB_YESNO+mb_IconExclamation) of
idYes : datamodule2.ADOTable2.Delete;
idNo : exit;
end;
end;
procedure TFormKlient.DBGrid1DblClick(Sender: TObject);
begin
FormKlientEdit.ShowModal;
end;
end.
unit TovarEditUnit;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls, Mask, DBCtrls, ExtCtrls, Buttons;
type
TFormMaterialEdit = class(TForm)
DBEdit1: TDBEdit;
DBEdit2: TDBEdit;
Label1: TLabel;
Label2: TLabel;
Bevel1: TBevel;
BitBtn1: TBitBtn;
BitBtn2: TBitBtn;
procedure BitBtn1Click(Sender: TObject);
procedure BitBtn2Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
FormMaterialEdit: TFormMaterialEdit;
implementation
uses DataUnit, EditSotr, KlientEditUnit, KlientUnit, MaterialUnit,
ObjectEditUnit, ObjectUnit, SotrUnit, Unit1,
UslugaEditTableUnit, UslugaEditUnit;
{$R *.dfm}
procedure TFormMaterialEdit.BitBtn1Click(Sender: TObject);
begin
if datamodule2.ADOTable5.Modified
then datamodule2.ADOTable5.Post;
end;
procedure TFormMaterialEdit.BitBtn2Click(Sender: TObject);
begin
if datamodule2.ADOTable5.Modified
then datamodule2.ADOTable5.Cancel;
end;
end.
unit TovarUnit;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, Grids, DBGrids, ComCtrls, ToolWin;
type
TFormMaterial = class(TForm)
DBGrid1: TDBGrid;
ToolBar1: TToolBar;
ToolButton1: TToolButton;
ToolButton2: TToolButton;
ToolButton3: TToolButton;
ToolButton4: TToolButton;
ToolButton5: TToolButton;
procedure ToolButton1Click(Sender: TObject);
procedure ToolButton3Click(Sender: TObject);
procedure ToolButton5Click(Sender: TObject);
procedure DBGrid1DblClick(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
FormMaterial: TFormMaterial;
implementation
uses DataUnit, EditSotr, KlientEditUnit, KlientUnit, ObjectEditUnit,
ObjectUnit, SotrUnit, Unit1, UslugaEditTableUnit,
UslugaEditUnit, MaterialEditUnit;
{$R *.dfm}
procedure TFormMaterial.ToolButton1Click(Sender: TObject);
begin
datamodule2.ADOTable5.Insert;
FormMaterialEdit.ShowModal;
end;
procedure TFormMaterial.ToolButton3Click(Sender: TObject);
begin
datamodule2.ADOTable5.Edit;
FormMaterialEdit.ShowModal;
end;
procedure TFormMaterial.ToolButton5Click(Sender: TObject);
begin
case application.MessageBox('Вы действительно хотите удалить выбранный товар?','Подтверждение удаления',MB_YESNO+mb_IconExclamation) of
idYes : datamodule2.ADOTable5.Delete;
idNo : exit;
end;
end;
procedure TFormMaterial.DBGrid1DblClick(Sender: TObject);
begin
FormMaterialEdit.ShowModal;
end;
end.
unit ObjRedUnit;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls, Mask, DBCtrls, ExtCtrls, Buttons;
type
TFormObjectEdit = class(TForm)
Label1: TLabel;
Label2: TLabel;
DBEdit1: TDBEdit;
DBEdit2: TDBEdit;
Bevel1: TBevel;
BitBtn2: TBitBtn;
BitBtn1: TBitBtn;
procedure BitBtn1Click(Sender: TObject);
procedure BitBtn2Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
FormObjectEdit: TFormObjectEdit;
implementation
uses DataUnit, EditSotr, KlientEditUnit, KlientUnit, ObjectUnit,
SotrUnit, Unit1;
{$R *.dfm}
procedure TFormObjectEdit.BitBtn1Click(Sender: TObject);
begin
if datamodule2.ADOTable3.Modified
then datamodule2.ADOTable3.Post;
end;
procedure TFormObjectEdit.BitBtn2Click(Sender: TObject);
begin
if datamodule2.ADOTable3.Modified
then datamodule2.ADOTable3.Cancel;
end;
end.
unit ObjUnit;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, Grids, DBGrids, ComCtrls, ToolWin;
type
TFormObject = class(TForm)
DBGrid1: TDBGrid;
ToolBar1: TToolBar;
ToolButton1: TToolButton;
ToolButton2: TToolButton;
ToolButton3: TToolButton;
ToolButton4: TToolButton;
ToolButton5: TToolButton;
procedure ToolButton1Click(Sender: TObject);
procedure ToolButton3Click(Sender: TObject);
procedure ToolButton5Click(Sender: TObject);
procedure DBGrid1DblClick(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
FormObject: TFormObject;
implementation
uses DataUnit, EditSotr, KlientEditUnit, KlientUnit,
SotrUnit, Unit1, ObjectEditUnit;
{$R *.dfm}
procedure TFormObject.ToolButton1Click(Sender: TObject);
begin
datamodule2.ADOTable3.Insert;
FormObjectEdit.ShowModal;
end;
procedure TFormObject.ToolButton3Click(Sender: TObject);
begin
FormObjectEdit.ShowModal;
end;
procedure TFormObject.ToolButton5Click(Sender: TObject);
begin
case application.MessageBox('Вы действительно хотите удалить выбранный объект?','Подтверждение удаления',MB_YESNO+mb_IconExclamation) of
idYes : datamodule2.ADOTable3.Delete;
idNo : exit;
end;
end;
procedure TFormObject.DBGrid1DblClick(Sender: TObject);
begin
FormObjectEdit.ShowModal;
end;
end.
unit SotrUnit;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, ComCtrls, ToolWin, Grids, DBGrids;
type
TFormSotr = class(TForm)
ToolBar1: TToolBar;
ToolButton1: TToolButton;
ToolButton2: TToolButton;
ToolButton3: TToolButton;
ToolButton4: TToolButton;
ToolButton5: TToolButton;
DBGrid1: TDBGrid;
procedure ToolButton1Click(Sender: TObject);
procedure ToolButton3Click(Sender: TObject);
procedure ToolButton5Click(Sender: TObject);
procedure DBGrid1DblClick(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
FormSotr: TFormSotr;
implementation
uses DataUnit, Unit1, EditSotr;
{$R *.dfm}
procedure TFormSotr.ToolButton1Click(Sender: TObject);
begin
datamodule2.ADOTable1.Insert;
FormSotrEdit.ShowModal;
end;
procedure TFormSotr.ToolButton3Click(Sender: TObject);
begin
FormSotrEdit.ShowModal;
end;
procedure TFormSotr.ToolButton5Click(Sender: TObject);
begin
case application.MessageBox('Вы действительно хотите удалить выбранного сотрудника?','Подтверждение удаления',MB_YESNO+mb_IconExclamation) of
idYes : datamodule2.ADOTable1.Delete;
idNo : exit;
end;
end;
procedure TFormSotr.DBGrid1DblClick(Sender: TObject);
begin
FormSotrEdit.ShowModal;
end;
end.
unit UslygaTablRed;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls, DBCtrls, Mask, ExtCtrls, Buttons;
type
TFormUslugaEditTable = class(TForm)
DBEdit3: TDBEdit;
DBText1: TDBText;
DBEdit4: TDBEdit;
Label1: TLabel;
Label2: TLabel;
Label3: TLabel;
Label4: TLabel;
Label5: TLabel;
DBLookupComboBox1: TDBLookupComboBox;
Bevel1: TBevel;
BitBtn1: TBitBtn;
BitBtn2: TBitBtn;
DBText2: TDBText;
procedure BitBtn1Click(Sender: TObject);
procedure BitBtn2Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
FormUslugaEditTable: TFormUslugaEditTable;
implementation
uses DataUnit, EditSotr, KlientEditUnit, KlientUnit, ObjectEditUnit,
ObjectUnit, SotrUnit, Unit1, UslugaEditUnit;
{$R *.dfm}
procedure TFormUslugaEditTable.BitBtn1Click(Sender: TObject);
begin
if datamodule2.ADOTable7.Modified then
datamodule2.ADOTable7.Post;
end;
procedure TFormUslugaEditTable.BitBtn2Click(Sender: TObject);
begin
datamodule2.ADOTable7.Cancel;
end;
end.
unit UslygaRed;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls, Mask, DBCtrls, ComCtrls, ToolWin, Grids, DBGrids,
ExtCtrls, Buttons, DB, ADODB;
type
TFormUslugaEdit = class(TForm)
Panel1: TPanel;
DBGrid2: TDBGrid;
ToolBar2: TToolBar;
ToolButton6: TToolButton;
ToolButton7: TToolButton;
ToolButton8: TToolButton;
ToolButton9: TToolButton;
ToolButton10: TToolButton;
Button1: TButton;
Panel2: TPanel;
DBEdit1: TDBEdit;
DBEdit2: TDBEdit;
DBText1: TDBText;
DBEdit3: TDBEdit;
DBText2: TDBText;
Label1: TLabel;
Label2: TLabel;
Label3: TLabel;
Label4: TLabel;
Label5: TLabel;
Label6: TLabel;
BitBtn1: TBitBtn;
BitBtn2: TBitBtn;
DBEdit4: TDBEdit;
ADOQuery1: TADOQuery;
ADOQuery1Expr1000: TFloatField;
procedure Button1Click(Sender: TObject);
procedure BitBtn1Click(Sender: TObject);
procedure BitBtn2Click(Sender: TObject);
procedure ToolButton6Click(Sender: TObject);
procedure ToolButton8Click(Sender: TObject);
procedure ToolButton10Click(Sender: TObject);
procedure DBGrid2DblClick(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
FormUslugaEdit: TFormUslugaEdit;
implementation
uses DataUnit, EditSotr, KlientEditUnit, KlientUnit, ObjectEditUnit,
ObjectUnit, SotrUnit, Unit1,
UslugaEditTableUnit;
{$R *.dfm}
procedure TFormUslugaEdit.Button1Click(Sender: TObject);
begin
//AutoMaterial();
end;
procedure TFormUslugaEdit.BitBtn1Click(Sender: TObject);
begin
if datamodule2.ADOTable4.Modified then
datamodule2.ADOTable4.Post;
MaterialP();
UslugaP();
end;
procedure TFormUslugaEdit.BitBtn2Click(Sender: TObject);
begin
datamodule2.ADOTable4.Cancel;
end;
procedure TFormUslugaEdit.ToolButton6Click(Sender: TObject);
begin
if datamodule2.ADOTable4.Modified then
datamodule2.ADOTable4.Post;
datamodule2.ADOTable7.Insert;
datamodule2.ADOTable7.Edit;
FormUslugaEditTable.ShowModal;
end;
procedure TFormUslugaEdit.ToolButton8Click(Sender: TObject);
begin
datamodule2.ADOTable7.edit;
FormUslugaEditTable.ShowModal;
end;
procedure TFormUslugaEdit.ToolButton10Click(Sender: TObject);
begin
case application.MessageBox('Вы действительно хотите удалить выбранный товар?','Подтверждение удаления',MB_YESNO+mb_IconExclamation) of
idYes : datamodule2.ADOTable7.Delete;
idNo : exit;
end;
end;
procedure TFormUslugaEdit.DBGrid2DblClick(Sender: TObject);
begin
datamodule2.ADOTable7.edit;
FormUslugaEditTable.ShowModal;
end;
end.
unit ZakazRed;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, DBCtrls, StdCtrls, Mask, ExtCtrls, Grids, DBGrids, ComCtrls,
ToolWin, Buttons;
type
TFormZakazEdit = class(TForm)
Panel1: TPanel;
Label4: TLabel;
Label3: TLabel;
Label2: TLabel;
Label1: TLabel;
DBEdit1: TDBEdit;
DBEdit2: TDBEdit;
DBEdit3: TDBEdit;
DBEdit4: TDBEdit;
Label8: TLabel;
Label7: TLabel;
Label6: TLabel;
Label5: TLabel;
DBText1: TDBText;
DBLookupComboBox1: TDBLookupComboBox;
DBLookupComboBox2: TDBLookupComboBox;
DBLookupComboBox3: TDBLookupComboBox;
Panel2: TPanel;
ToolBar3: TToolBar;
ToolButton15: TToolButton;
ToolButton16: TToolButton;
ToolButton17: TToolButton;
ToolButton18: TToolButton;
ToolButton19: TToolButton;
ToolButton13: TToolButton;
Button1: TButton;
DBGrid2: TDBGrid;
Bevel1: TBevel;
BitBtn1: TBitBtn;
BitBtn2: TBitBtn;
procedure Button1Click(Sender: TObject);
procedure ToolButton15Click(Sender: TObject);
procedure ToolButton17Click(Sender: TObject);
procedure ToolButton19Click(Sender: TObject);
procedure BitBtn1Click(Sender: TObject);
procedure BitBtn2Click(Sender: TObject);
procedure DBGrid2DblClick(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
FormZakazEdit: TFormZakazEdit;
implementation
uses DataUnit, Unit1, UslugaEditUnit;
{$R *.dfm}
procedure TFormZakazEdit.Button1Click(Sender: TObject);
begin
//AutoZakaz();
end;
procedure TFormZakazEdit.ToolButton15Click(Sender: TObject);
begin
if datamodule2.ADOTable6.Modified then
begin
datamodule2.ADOTable6.Post;
datamodule2.ADOTable6.Edit;
end;
datamodule2.ADOTable4.Insert;
FormUslugaEdit.Caption := 'Услуга на заказ № '+datamodule2.ADOTable6NumberD.AsString+' - НОВАЯ *';
FormUslugaEdit.showmodal;
end;
procedure TFormZakazEdit.ToolButton17Click(Sender: TObject);
begin
FormUslugaEdit.Caption := 'Услуга на заказ № '+datamodule2.ADOTable6NumberD.AsString+' - '+datamodule2.ADOTable4NameUsluga.AsString;
FormUslugaEdit.showmodal;
end;
procedure TFormZakazEdit.ToolButton19Click(Sender: TObject);
begin
case application.MessageBox('Вы действительно хотите удалить выбранную услугу?','Подтверждение удаления',MB_YESNO+mb_IconExclamation) of
idYes : datamodule2.ADOTable4.Delete;
idNo : exit;
end;
end;
procedure TFormZakazEdit.BitBtn1Click(Sender: TObject);
begin
// AutoZakaz();
if datamodule2.ADOTable6.Modified then
datamodule2.ADOTable6.Post;
UslugaP();
end;
procedure TFormZakazEdit.BitBtn2Click(Sender: TObject);
begin
datamodule2.ADOTable6.Cancel;
end;
procedure TFormZakazEdit.DBGrid2DblClick(Sender: TObject);
begin
FormUslugaEdit.Caption := 'Услуга на заказ № '+datamodule2.ADOTable6NumberD.AsString+' - '+datamodule2.ADOTable4NameUsluga.AsString;
FormUslugaEdit.showmodal;
end;
end. |