Главная страница Случайная страница Разделы сайта АвтомобилиАстрономияБиологияГеографияДом и садДругие языкиДругоеИнформатикаИсторияКультураЛитератураЛогикаМатематикаМедицинаМеталлургияМеханикаОбразованиеОхрана трудаПедагогикаПолитикаПравоПсихологияРелигияРиторикаСоциологияСпортСтроительствоТехнологияТуризмФизикаФилософияФинансыХимияЧерчениеЭкологияЭкономикаЭлектроника |
💸 Как сделать бизнес проще, а карман толще?
Тот, кто работает в сфере услуг, знает — без ведения записи клиентов никуда. Мало того, что нужно видеть свое раписание, но и напоминать клиентам о визитах тоже.
Проблема в том, что средняя цена по рынку за такой сервис — 800 руб/мес или почти 15 000 руб за год. И это минимальный функционал.
Нашли самый бюджетный и оптимальный вариант: сервис VisitTime.⚡️ Для новых пользователей первый месяц бесплатно. А далее 290 руб/мес, это в 3 раза дешевле аналогов. За эту цену доступен весь функционал: напоминание о визитах, чаевые, предоплаты, общение с клиентами, переносы записей и так далее. ✅ Уйма гибких настроек, которые помогут вам зарабатывать больше и забыть про чувство «что-то мне нужно было сделать». Сомневаетесь? нажмите на текст, запустите чат-бота и убедитесь во всем сами! Текст программы. Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, ⇐ ПредыдущаяСтр 8 из 8
unit Unit1;
interface
uses Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, Dialogs, Grids, DBGrids, DB, DBTables, Menus, ExtCtrls, DBCtrls, StdCtrls, Buttons, Mask, RpRave, RpDefine, RpCon, RpConDS;
type TForm1 = class(TForm) Table1: TTable; Table2: TTable; Table3: TTable; Table4: TTable; DataSource1: TDataSource; DataSource2: TDataSource; DataSource3: TDataSource; DataSource4: TDataSource; Table1Kod_tovara: TSmallintField; Table1Tovar_name: TStringField; Table1Tovar_cost: TIntegerField; Table1Poshlina: TSmallintField; Table2Declaration_number: TSmallintField; Table2Kod_tovara: TSmallintField; Table2Kolvo: TFloatField; Table2Declaration_Data: TDateField; Table2FIO_grazhdanina: TStringField; Table2Kod_sotrudnika: TSmallintField; Table4Kod_dolzhnosti: TSmallintField; Table4Naimen_dolzhnosti: TStringField; Table4Oklad: TCurrencyField; Table3Kod_sotrudnika: TSmallintField; Table3Kod_dolzhnosti: TSmallintField; Table3FiO_sotrudnika: TStringField; Table3Adress_sotrudnika: TStringField; Table3Telefon: TStringField; Table3Birthyear: TIntegerField; Table3Obrazovanie: TStringField; PopupMenu1: TPopupMenu; N11: TMenuItem; N21: TMenuItem; N31: TMenuItem; N41: TMenuItem; DBNavigator1: TDBNavigator; BitBtn1: TBitBtn; BitBtn2: TBitBtn; BitBtn3: TBitBtn; MainMenu1: TMainMenu; Table1Poshlina2: TSmallintField; Label1: TLabel; Edit1: TEdit; BitBtn4: TBitBtn; N1: TMenuItem; N2: TMenuItem; N3: TMenuItem; N4: TMenuItem; N5: TMenuItem; BitBtn5: TBitBtn; N6: TMenuItem; N12: TMenuItem; N22: TMenuItem; N32: TMenuItem; N42: TMenuItem; N7: TMenuItem; N8: TMenuItem; N9: TMenuItem; N10: TMenuItem; N13: TMenuItem; N14: TMenuItem; N15: TMenuItem; N20101: TMenuItem; N20111: TMenuItem; N16: TMenuItem; Query1: TQuery; DBGrid1: TDBGrid; DataSource5: TDataSource; BitBtn6: TBitBtn; N17: TMenuItem; N18: TMenuItem; N23: TMenuItem; N33: TMenuItem; N43: TMenuItem; N19: TMenuItem; N20: TMenuItem; N24: TMenuItem; N25: TMenuItem; N26: TMenuItem; N27: TMenuItem; N28: TMenuItem; N29: TMenuItem; N30: TMenuItem; N34: TMenuItem; C1: TMenuItem; N35: TMenuItem; N36: TMenuItem; N37: TMenuItem; N38: TMenuItem; N39: TMenuItem; N40: TMenuItem; N44: TMenuItem; N45: TMenuItem; N46: TMenuItem; N47: TMenuItem; RVConnect1: TRvDataSetConnection; RvProject1: TRvProject; N48: TMenuItem; procedure FormMouseDown(Sender: TObject; Button: TMouseButton; Shift: TShiftState; X, Y: Integer); procedure N11Click(Sender: TObject); procedure N21Click(Sender: TObject); procedure N31Click(Sender: TObject); procedure N41Click(Sender: TObject); procedure BitBtn1Click(Sender: TObject); procedure BitBtn2Click(Sender: TObject); procedure BitBtn3Click(Sender: TObject); procedure Table1CalcFields(DataSet: TDataSet); procedure BitBtn4Click(Sender: TObject); procedure N5Click(Sender: TObject); procedure N10Click(Sender: TObject); procedure N14Click(Sender: TObject); procedure N15Click(Sender: TObject); procedure N13Click(Sender: TObject); procedure BitBtn6Click(Sender: TObject); procedure N19Click(Sender: TObject); procedure N20Click(Sender: TObject); procedure N24Click(Sender: TObject); procedure N25Click(Sender: TObject); procedure N26Click(Sender: TObject); procedure N27Click(Sender: TObject); procedure N28Click(Sender: TObject); procedure N29Click(Sender: TObject); procedure N30Click(Sender: TObject); procedure N34Click(Sender: TObject); procedure N35Click(Sender: TObject); procedure N36Click(Sender: TObject); procedure N37Click(Sender: TObject); procedure N38Click(Sender: TObject); procedure N39Click(Sender: TObject); procedure N20101Click(Sender: TObject); procedure N20111Click(Sender: TObject); procedure N16Click(Sender: TObject); procedure N40Click(Sender: TObject); procedure N45Click(Sender: TObject); procedure N47Click(Sender: TObject); procedure N46Click(Sender: TObject); private { Private declarations } public { Public declarations } end;
var Form1: TForm1;
implementation
uses Unit2, Unit3, Unit4, Unit5, Unit6, Unit7;
{$R *.dfm}
procedure TForm1.FormMouseDown(Sender: TObject; Button: TMouseButton; Shift: TShiftState; X, Y: Integer); var P: TPoint; begin P: =GetClientOrigin; if Button=mbRight then PopupMenu1.Popup(P.X+x, P.y+y); end;
procedure TForm1.N11Click(Sender: TObject); begin Table2.IndexFieldNames: =''; Table4.IndexFieldNames: =''; Form7.Label1.Tag: =0; DBGrid1.DataSource: =DataSource1; Table1.Active: =true; DBNavigator1.DataSource: =DataSource1; end;
procedure TForm1.N21Click(Sender: TObject); begin Table2.IndexFieldNames: =''; Table4.IndexFieldNames: =''; Form7.Label1.Tag: =0; Table1.Filtered: =false; DBGrid1.DataSource: =DataSource2; Table2.Active: =true; DBNavigator1.DataSource: =DataSource2; end;
procedure TForm1.N31Click(Sender: TObject); begin Table2.IndexFieldNames: =''; Table4.IndexFieldNames: =''; Form7.Label1.Tag: =0; Table1.Filtered: =false; DBGrid1.DataSource: =DataSource3; Table3.Active: =true; DBNavigator1.DataSource: =DataSource3; end;
procedure TForm1.N41Click(Sender: TObject); begin Table2.IndexFieldNames: =''; Table4.IndexFieldNames: =''; Form7.Label1.Tag: =0; Table1.Filtered: =false; DBGrid1.DataSource: =DataSource4; Table4.Active: =true; DBNavigator1.DataSource: =DataSource4; end;
procedure TForm1.BitBtn1Click(Sender: TObject); begin BitBtn2.Tag: =0; Form2.NaimenEdit.Clear; Form2.CostEdit.Clear; Form2.PoshlinaEdit.Clear; Form3.DataEdit.Clear; Form3.FIOEdit.Clear; Form3.KodTEdit.Clear; Form3.KodSEdit.Clear; Form3.NDEdit.Clear; Form4.EducEdit.Clear; Form4.AdressEdit.Clear; Form4.FiOEdit.Clear; Form4.KodSEdit.Clear; Form4.KodDEdit.Clear; Form4.TelefonEdit.Clear; Form4.BirthyearEdit.Clear; Form5.KodDEdit.Clear; Form5.NaimenEdit.Clear; Form5.OkladEdit.Clear; If DBGrid1.Datasource=DataSource1 then Begin Table1.Append; Form2.show; End; If DBGrid1.Datasource=DataSource2 then Begin Table2.Append; Form3.show; End; If DBGrid1.Datasource=DataSource3 then Begin Table3.Append; Form4.show; End; If DBGrid1.Datasource=DataSource4 then Begin Table4.Append; Form5.show; End; end;
procedure TForm1.BitBtn2Click(Sender: TObject); begin BitBtn2.Tag: =1; If DBGrid1.Datasource=DataSource1 then Begin Form2.KodTEdit.Text: =inttostr(Form1.Table1.FieldByName('Kod_tovara').Value); Form2.NaimenEdit.Text: =Form1.Table1.FieldByName('Tovar_name').Value; Form2.CostEdit.Text: =inttostr(Form1.Table1.FieldByName('Tovar_cost').Value); Form2.PoshlinaEdit.Text: =inttostr(Form1.Table1.FieldByName('Poshlina').Value); Form2.Show; end; If DBGrid1.Datasource=DataSource2 then Begin Form3.DataEdit.Text: =datetostr(Form1.Table2.FieldByName('Declaration_Data').Value); Form3.FiOEdit.Text: =Form1.Table2.FieldByName('FIO_grazhdanina').Value; Form3.KodSEdit.Text: =inttostr(Form1.Table2.FieldByName('Kod_sotrudnika').Value); Form3.KodTEdit.Text: =inttostr(Form1.Table2.FieldByName('Kod_tovara').Value); Form3.KolEdit.Text: =inttostr(Form1.Table2.FieldByName('Kolvo').Value); Form3.NDEdit.Text: =inttostr(Form1.Table2.FieldByName('Declaration_number').Value); Form3.Show; end; If DBGrid1.Datasource=DataSource3 then begin Form4.EducEdit.Text: =Form1.Table3.FieldByName('Obrazovanie').Value; Form4.AdressEdit.Text: =Form1.Table3.FieldByName('Adress_sotrudnika').Value; Form4.FiOEdit.Text: =Form1.Table3.FieldByName('FiO_sotrudnika').Value; Form4.KodSEdit.Text: =inttostr(Form1.Table3.FieldByName('Kod_sotrudnika').Value); Form4.KodDEdit.Text: =inttostr(Form1.Table3.FieldByName('Kod_dolzhnosti').Value); Form4.TelefonEdit.Text: =Form1.Table3.FieldByName('Telefon').Value; Form4.BirthyearEdit.Text: =inttostr(Form1.Table3.FieldByName('Birthyear').Value); Form4.Show; end; If DBGrid1.Datasource=DataSource4 then begin Form5.KodDEdit.Text: =inttostr(Form1.Table4.FieldByName('Kod_dolzhnosti').Value); Form5.NaimenEdit.Text: =Form1.Table4.FieldByName('Naimen_dolzhnosti').Value; Form5.OkladEdit.Text: =inttostr(Form1.Table4.FieldByName('Oklad').Value); Form5.Show; end; End;
procedure TForm1.BitBtn3Click(Sender: TObject); begin If DBGrid1.Datasource=DataSource1 then Begin Table1.Delete; end; If DBGrid1.Datasource=DataSource2 then Begin Table2.Delete; end; If DBGrid1.Datasource=DataSource3 then Begin Table3.Delete; end; If DBGrid1.Datasource=DataSource4 then Begin Table4.Delete; end; end;
procedure TForm1.Table1CalcFields(DataSet: TDataSet); begin Table1.FieldByName('Poshlina%').Value: = (Table1.FieldByName('Poshlina').Value/ Table1.FieldByName('Tovar_cost').Value)*100; end;
procedure TForm1.BitBtn4Click(Sender: TObject); var Cost: longint; begin DBGrid1.DataSource: =DataSource1; Cost: =0; Table1.First; with Table1 do while not eof do begin Cost: =Cost+Table1.FieldByName('Tovar_cost').Value; Next; end; Edit1.Text: =inttostr(Cost); end;
procedure TForm1.N5Click(Sender: TObject); begin Form1.Close; end;
procedure TForm1.N10Click(Sender: TObject); begin Form6.Edit1.Clear; Form6.Label1.Caption: ='№ декларации: '; Form6.Show; Form6.BitBtn1.Tag: =1; end;
procedure TForm1.N14Click(Sender: TObject); begin Form6.Edit1.Clear; Form6.Label1.Caption: ='Название должности: '; Form6.Show; Form6.BitBtn1.Tag: =3; end;
procedure TForm1.N15Click(Sender: TObject); begin Form1.Query1.Close; Form1.Query1.SQL.Clear; Form1.Query1.SQL.Add('Select count(distinct(Kod_sotrudnika))'); Form1.Query1.SQL.Add('From Table2 where Declaration_Data between " 01.01.2016" and " 31.12.2016" '); Form1.Query1.Active: =true; Form1.DBGrid1.DataSource: =Form1.DataSource5; end;
procedure TForm1.N20101Click(Sender: TObject); begin Form1.Query1.Close; Form1.Query1.SQL.Clear; Form1.Query1.SQL.Add('Select FiO_sotrudnika, Adress_sotrudnika, Telefon, Obrazovanie, Naimen_dolzhnosti, sum(kolvo)'); Form1.Query1.SQL.Add('from table2, table3, table4'); Form1.Query1.SQL.Add('where (table2.kod_sotrudnika=table3.kod_sotrudnika) and (table3.kod_dolzhnosti=table4.kod_dolzhnosti) and (Declaration_Data between " 01.01.2010" and " 31.12.2010")'); Form1.Query1.Sql.Add('group by FiO_sotrudnika, Adress_sotrudnika, Telefon, Obrazovanie, Naimen_dolzhnosti'); Form1.Query1.Active: =true; Form1.DBGrid1.DataSource: =Form1.DataSource5; end;
procedure TForm1.N16Click(Sender: TObject); begin Form1.Query1.Close; Form1.Query1.SQL.Clear; Form1.Query1.SQL.Add('Select FiO_sotrudnika, Adress_sotrudnika, Telefon, Obrazovanie, Naimen_dolzhnosti'); Form1.Query1.SQL.Add('from table3, table4'); Form1.Query1.SQL.Add('where (table3.kod_dolzhnosti=table4.kod_dolzhnosti) and (Birthyear is null)'); Form1.Query1.Active: =true; Form1.DBGrid1.DataSource: =Form1.DataSource5; end;
procedure TForm1.N13Click(Sender: TObject); begin Form6.Edit1.Clear; Form6.Label1.Caption: ='Наименование товара: '; Form6.Show; Form6.BitBtn1.Tag: =2; end;
procedure TForm1.BitBtn6Click(Sender: TObject); begin BitBtn2.Tag: =0; Form2.NaimenEdit.Clear; Form2.CostEdit.Clear; Form2.PoshlinaEdit.Clear; Form3.DataEdit.Clear; Form3.FIOEdit.Clear; Form3.KodTEdit.Clear; Form3.KodSEdit.Clear; Form3.NDEdit.Clear; Form4.EducEdit.Clear; Form4.AdressEdit.Clear; Form4.FiOEdit.Clear; Form4.KodSEdit.Clear; Form4.KodDEdit.Clear; Form4.TelefonEdit.Clear; Form4.BirthyearEdit.Clear; Form5.KodDEdit.Clear; Form5.NaimenEdit.Clear; Form5.OkladEdit.Clear; If DBGrid1.Datasource=DataSource1 then Begin Table1.Insert; Form2.show; End; If DBGrid1.Datasource=DataSource2 then Begin Table2.Insert; Form3.show; End; If DBGrid1.Datasource=DataSource3 then Begin Table3.Insert; Form4.show; End; If DBGrid1.Datasource=DataSource4 then Begin Table4.Insert; Form5.show; End; end;
procedure TForm1.N19Click(Sender: TObject); begin if Form1.DBGrid1.DataSource< > Form1.DataSource1 then begin ShowMessage('Не выбрана нужная таблица! '); exit; end; Form7.Label1.Caption: ='Tovar_name'; Form7.Label1.Tag: =1; Form7.Show; end;
procedure TForm1.N20Click(Sender: TObject); begin if Form1.DBGrid1.DataSource< > Form1.DataSource1 then begin ShowMessage('Не выбрана нужная таблица! '); exit; end; Form7.Label1.Caption: ='Tovar_cost'; Form7.Label1.Tag: =1; Form7.Show; end;
procedure TForm1.N24Click(Sender: TObject); begin if Form1.DBGrid1.DataSource< > Form1.DataSource2 then begin ShowMessage('Не выбрана нужная таблица! '); exit; end; Form7.Label1.Caption: ='Kod_tovara'; Form7.Label1.Tag: =2; Form7.Show; end;
procedure TForm1.N25Click(Sender: TObject); begin if Form1.DBGrid1.DataSource< > Form1.DataSource2 then begin ShowMessage('Не выбрана нужная таблица! '); exit; end; Form7.Label1.Caption: ='Kolvo'; Form7.Label1.Tag: =2; Form7.Show; end;
procedure TForm1.N26Click(Sender: TObject); begin if Form1.DBGrid1.DataSource< > Form1.DataSource2 then begin ShowMessage('Не выбрана нужная таблица! '); exit; end; Form7.Label1.Caption: ='Declaration_Data'; Form7.Label1.Tag: =2; Form7.Show; end;
procedure TForm1.N27Click(Sender: TObject); begin if Form1.DBGrid1.DataSource< > Form1.DataSource3 then begin ShowMessage('Не выбрана нужная таблица! '); exit; end; Form7.Label1.Caption: ='Kod_dolzhnosti'; Form7.Label1.Tag: =3; Form7.Show; end;
procedure TForm1.N28Click(Sender: TObject); begin if Form1.DBGrid1.DataSource< > Form1.DataSource3 then begin ShowMessage('Не выбрана нужная таблица! '); exit; end; Form7.Label1.Caption: ='FiO_sotrudnika'; Form7.Label1.Tag: =3; Form7.Show; end;
procedure TForm1.N29Click(Sender: TObject); begin if Form1.DBGrid1.DataSource< > Form1.DataSource3 then begin ShowMessage('Не выбрана нужная таблица! '); exit; end; Form7.Label1.Caption: ='Birthyear'; Form7.Label1.Tag: =3; Form7.Show; end;
procedure TForm1.N30Click(Sender: TObject); begin if Form1.DBGrid1.DataSource< > Form1.DataSource3 then begin ShowMessage('Не выбрана нужная таблица! '); exit; end; Form7.Label1.Caption: ='Adress_sotrudnika'; Form7.Label1.Tag: =3; Form7.Show; end;
procedure TForm1.N34Click(Sender: TObject); begin if Form1.DBGrid1.DataSource< > Form1.DataSource4 then begin ShowMessage('Не выбрана нужная таблица! '); exit; end; Form7.Label1.Caption: ='Oklad'; Form7.Label1.Tag: =4; Form7.Show; end;
procedure TForm1.N35Click(Sender: TObject); begin N21.Click; Table2.IndexFieldNames: =''; end;
procedure TForm1.N36Click(Sender: TObject); begin N21.Click; Table2.IndexName: ='DNumber'; end;
procedure TForm1.N37Click(Sender: TObject); begin N21.Click; Table2.IndexName: ='IKolvo'; end;
procedure TForm1.N38Click(Sender: TObject); begin N21.Click; Table2.Active: =false; Table2.Exclusive: =true; Table2.AddIndex('KodS', 'Kod_sotrudnika', [ixCaseInsensitive, ixDescending], ''); Table2.Exclusive: =false; Table2.Active: =true; Table2.IndexName: ='KodS'; end;
procedure TForm1.N39Click(Sender: TObject); begin N41.Click; Table4.Active: =false; Table4.Exclusive: =true; Table4.AddIndex('IKodD', 'Kod_dolzhnosti', [ixDescending]); Table4.Exclusive: =false; Table4.Active: =true; Table4.IndexName: ='IKodD'; end;
procedure TForm1.N20111Click(Sender: TObject); begin Form1.Query1.Close; Form1.Query1.SQL.Clear; Form1.Query1.SQL.Add('select Tovar_name, tovar_cost, sum(kolvo) from table1, table2'); Form1.Query1.SQL.Add('where (Table1.kod_tovara=Table2.kod_tovara) and (Declaration_Data between " 01.06.2011" and " 30.06.2011")'); Form1.Query1.SQL.Add('group by Tovar_name, tovar_cost'); Form1.Query1.Active: =true; Form1.DBGrid1.DataSource: =DataSource5; end;
procedure TForm1.N40Click(Sender: TObject); begin Form1.Query1.Close; Form1.Query1.SQL.Clear; Form1.Query1.SQL.Add('select FiO_sotrudnika, Obrazovanie, Tovar_name, Tovar_cost, sum(tovar_cost) from table1, table2, table3'); Form1.Query1.SQL.Add('where (Table1.kod_tovara=Table2.kod_tovara) and (table2.kod_sotrudnika=Table3.kod_sotrudnika)'); Form1.Query1.SQL.Add('group by FiO_sotrudnika, Obrazovanie, Tovar_name, Tovar_cost'); Form1.Query1.Active: =true; Form1.DBGrid1.DataSource: =DataSource5; end;
procedure TForm1.N45Click(Sender: TObject); begin Form1.RvProject1.Close; Form1.RVConnect1.DataSet: =Form1.Table1; Form1.RVProject1.ProjectFile: =ExtractFilePath(Application.Exename)+'Ot1.rav'; Form1.RVProject1.Execute; end;
procedure TForm1.N47Click(Sender: TObject); begin Form1.Query1.Close; Form1.Query1.SQL.Clear; Form1.Query1.SQL.Add('select FiO_sotrudnika, Obrazovanie, Tovar_name, Tovar_cost, sum(tovar_cost) from table1, table2, table3'); Form1.Query1.SQL.Add('where (Table1.kod_tovara=Table2.kod_tovara) and (table2.kod_sotrudnika=Table3.kod_sotrudnika)'); Form1.Query1.SQL.Add('group by FiO_sotrudnika, Obrazovanie, Tovar_name, Tovar_cost'); Form1.Query1.Active: =true; Form1.RvProject1.Close; RVConnect1.DataSet: =Query1; Form1.RVProject1.ProjectFile: =ExtractFilePath(Application.Exename)+'GroupOt.rav'; Form1.RVProject1.Execute; end;
procedure TForm1.N46Click(Sender: TObject); begin Form1.Query1.Close; Form1.Query1.SQL.Clear; Form1.Query1.SQL.Add('Select FiO_sotrudnika, Adress_sotrudnika, Telefon, Obrazovanie, Naimen_dolzhnosti'); Form1.Query1.SQL.Add('from table3, table4'); Form1.Query1.SQL.Add('where (table3.kod_dolzhnosti=table4.kod_dolzhnosti) and (Birthyear is null)'); Form1.Query1.Active: =true; Form1.RvProject1.Close; RVConnect1.DataSet: =Query1; Form1.RVProject1.ProjectFile: =ExtractFilePath(Application.Exename)+'Ot2.rav'; Form1.RVProject1.Execute; end;
end. Рис. Б.1 - Основная форма unit Unit2;
interface
uses Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, Dialogs, StdCtrls, Buttons;
type TForm2 = class(TForm) Label1: TLabel; Label2: TLabel; Label3: TLabel; NaimenEdit: TEdit; PoshlinaEdit: TEdit; CostEdit: TEdit; SaveBtn1: TBitBtn; Label4: TLabel; KodTEdit: TEdit; procedure SaveBtn1Click(Sender: TObject); private { Private declarations } public { Public declarations } end;
var Form2: TForm2;
implementation
uses Unit1;
{$R *.dfm}
procedure TForm2.SaveBtn1Click(Sender: TObject); begin if Form1.BitBtn2.Tag=1 then Form1.Table1.Edit; if KodTEdit.Text< > '' then Form1.Table1.FieldByName('Kod_tovara').Value: =strtoint(KodTEdit.Text); Form1.Table1.FieldByName('Tovar_name').Value: =NaimenEdit.Text; Form1.Table1.FieldByName('Tovar_cost').Value: =strtoint(CostEdit.Text); Form1.Table1.FieldByName('Poshlina').Value: =strtoint(PoshlinaEdit.Text); Form1.Table1.Post; Form2.Close; end; end. Рис. Б.2 - Форма для добавления или изменения данных в первой таблице
unit Unit3;
interface
uses Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, Dialogs, StdCtrls, Buttons;
type TForm3 = class(TForm) Label1: TLabel; Label2: TLabel; Label3: TLabel; Label4: TLabel; Label5: TLabel; Label6: TLabel; NDEdit: TEdit; KodTEdit: TEdit; KolEdit: TEdit; DataEdit: TEdit; FIOEdit: TEdit; KodSEdit: TEdit; SaveBtn2: TBitBtn; procedure SaveBtn2Click(Sender: TObject); private { Private declarations } public { Public declarations } end;
var Form3: TForm3;
implementation
uses Unit1, Unit2;
{$R *.dfm}
procedure TForm3.SaveBtn2Click(Sender: TObject); begin if Form1.BitBtn2.Tag=1 then Form1.Table2.Edit; Form1.Table2.FieldByName('Declaration_Data').Value: =strtodate(Form3.DataEdit.Text); Form1.Table2.FieldByName('FIO_grazhdanina').Value: =Form3.FiOEdit.Text; Form1.Table2.FieldByName('Kod_sotrudnika').Value: =strtoint(Form3.KodSEdit.Text); Form1.Table2.FieldByName('Kod_tovara').Value: =strtoint(Form3.KodTEdit.Text); Form1.Table2.FieldByName('Kolvo').Value: =strtoint(Form3.KolEdit.Text); Form1.Table2.FieldByName('Declaration_number').Value: =strtoint(Form3.NDEdit.Text); Form1.Table2.Post; Form3.Close; end;
end.
Рис. Б.3 - Форма для добавления или изменения данных во второй таблице
unit Unit4;
interface
uses Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, Dialogs, StdCtrls, Buttons;
type TForm4 = class(TForm) Label1: TLabel; Label2: TLabel; Label3: TLabel; Label4: TLabel; Label5: TLabel; Label6: TLabel; Label7: TLabel; KodSEdit: TEdit; KodDEdit: TEdit; FIOEdit: TEdit; AdressEdit: TEdit; TelefonEdit: TEdit; BirthyearEdit: TEdit; EducEdit: TEdit; SaveBtn3: TBitBtn; procedure SaveBtn3Click(Sender: TObject); private { Private declarations } public { Public declarations } end;
var Form4: TForm4;
implementation
uses Unit1, Unit3;
{$R *.dfm}
procedure TForm4.SaveBtn3Click(Sender: TObject); begin if Form1.BitBtn2.Tag=1 then Form1.Table3.Edit; Form1.Table3.FieldByName('Obrazovanie').Value: =Form4.EducEdit.Text; Form1.Table3.FieldByName('Adress_sotrudnika').Value: =Form4.AdressEdit.Text; Form1.Table3.FieldByName('FiO_sotrudnika').Value: =Form4.FiOEdit.Text; Form1.Table3.FieldByName('Kod_sotrudnika').Value: =strtoint(Form4.KodSEdit.Text); Form1.Table3.FieldByName('Kod_dolzhnosti').Value: =strtoint(Form4.KodDEdit.Text); Form1.Table3.FieldByName('Telefon').Value: =Form4.TelefonEdit.Text; Form1.Table3.FieldByName('Birthyear').Value: =strtoint(Form4.BirthyearEdit.Text); Form1.Table3.Post; Form4.Close; end;
end. Рис. Б.4 - Форма для добавления или изменения данных в третьей таблице
unit Unit5;
interface
uses Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, Dialogs, StdCtrls, Buttons;
type TForm5 = class(TForm) Label1: TLabel; Label2: TLabel; Label3: TLabel; KodDEdit: TEdit; NaimenEdit: TEdit; OkladEdit: TEdit; SaveBtn4: TBitBtn; procedure SaveBtn4Click(Sender: TObject); private { Private declarations } public { Public declarations } end;
var Form5: TForm5;
implementation
uses Unit1, Unit4;
{$R *.dfm}
procedure TForm5.SaveBtn4Click(Sender: TObject); begin if Form1.BitBtn2.Tag=1 then Form1.Table4.Edit; Form1.Table4.FieldByName('Kod_dolzhnosti').Value: =strtoint(KodDEdit.Text); Form1.Table4.FieldByName('Naimen_dolzhnosti').Value: =NaimenEdit.Text; Form1.Table4.FieldByName('Oklad').Value: =strtoint(OkladEdit.Text); Form1.Table4.Post; Form5.Close; end; end.
Рис. Б.5 - Форма для добавления или изменения данных в четвёртой таблице
unit Unit7;
interface
uses DB, Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, Dialogs, StdCtrls, Buttons;
type TForm7 = class(TForm) Label1: TLabel; Edit1: TEdit; CheckBox1: TCheckBox; BitBtn1: TBitBtn; procedure BitBtn1Click(Sender: TObject); private { Private declarations } public { Public declarations } end;
var Form7: TForm7;
implementation
uses Unit1;
{$R *.dfm}
procedure TForm7.BitBtn1Click(Sender: TObject); begin if CheckBox1.Checked then begin case Label1.Tag of 1: begin Form1.Table1.Filtered: = false; Form1.Table1.Filter: =Label1.Caption+'='+#39+Edit1.Text+#39; Form1.Table1.Filtered: =true; end; 2: begin Form1.Table2.Filtered: = false; Form1.Table2.Filter: =Label1.Caption+'='+#39+Edit1.Text+#39; Form1.Table2.Filtered: =true; end; 3: begin Form1.Table3.Filtered: = false; Form1.Table3.Filter: =Label1.Caption+'='+#39+Edit1.Text+#39; Form1.Table3.Filtered: =true; end; 4: begin Form1.Table4.Filtered: = false; Form1.Table4.Filter: =Label1.Caption+'='+#39+Edit1.Text+#39; Form1.Table4.Filtered: =true; end; end; //end case block end else begin Form1.Table1.Filtered: =false; Form1.Table1.Filter: =''; Form1.Table2.Filter: =''; Form1.Table3.Filter: =''; Form1.Table4.Filter: =''; end; if (Form7.Label1.Tag=1) and not(Form1.Table1.Locate(Label1.Caption, Edit1.Text, [])) then ShowMessage('Запись не найдена'); if (Form7.Label1.Tag=2) and not(Form1.Table2.Locate(Label1.Caption, Edit1.Text, [])) then ShowMessage('Запись не найдена'); if (Form7.Label1.Tag=3) and not(Form1.Table3.Locate(Label1.Caption, Edit1.Text, [])) then ShowMessage('Запись не найдена'); if (Form7.Label1.Tag=4) and not(Form1.Table4.Locate(Label1.Caption, Edit1.Text, [])) then ShowMessage('Запись не найдена'); Form7.Close; end;
end. Рис. Б.6 – Форма для поиска и фильтрации unit Unit6;
interface
uses Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, Dialogs, StdCtrls, Buttons;
type TForm6 = class(TForm) Edit1: TEdit; BitBtn1: TBitBtn; Label1: TLabel; procedure BitBtn1Click(Sender: TObject); private { Private declarations } public { Public declarations } end;
var Form6: TForm6;
implementation
uses Unit1;
{$R *.dfm}
procedure TForm6.BitBtn1Click(Sender: TObject); begin if Form6.BitBtn1.Tag=1 then begin Form1.Query1.Close; Form1.Query1.SQL.Clear; Form1.Query1.SQL.Add('SELECT Table3.FiO_sotrudnika, Table3.Adress_sotrudnika, Table3.Telefon, Table3.Birthyear'); Form1.Query1.SQL.Add('FROM " Table2.DB" Table2'); Form1.Query1.SQL.Add('INNER JOIN " Table3.db" Table3'); Form1.Query1.SQL.Add('ON (Table2.Kod_sotrudnika = Table3.Kod_sotrudnika)'); Form1.Query1.SQL.Add('WHERE Table2.Declaration_number=: Par'); Form1.Query1.ParamByName('Par').AsInteger: =strtoint(Form6.Edit1.Text); Form1.Query1.Active: =true; Form6.Close; Form1.DBGrid1.DataSource: =Form1.DataSource5; end; if Form6.BitBtn1.Tag=3 then begin Form1.Query1.Close; Form1.Query1.SQL.Clear; Form1.Query1.SQL.Add('Select count(Table3.Kod_dolzhnosti), Oklad'); Form1.Query1.SQL.Add('From Table3, Table4'); Form1.Query1.SQL.Add('where (Table3.Kod_dolzhnosti=Table4.Kod_dolzhnosti) and (Naimen_dolzhnosti=: Par)'); Form1.Query1.SQL.Add('group by Oklad'); Form1.Query1.ParamByName('Par').AsString: =Form6.Edit1.Text; Form1.Query1.Active: =true; Form6.Close; Form1.DBGrid1.DataSource: =Form1.DataSource5; end; if Form6.BitBtn1.Tag=2 then begin Form1.Query1.Close; Form1.Query1.SQL.Clear; Form1.Query1.SQL.Add('Select FiO_sotrudnika, Adress_sotrudnika, Telefon, Obrazovanie, Naimen_dolzhnosti'); Form1.Query1.SQL.Add('From Table1, Table2, Table3, Table4'); Form1.Query1.SQL.Add('where (Tovar_name=: Par) and (Table1.Kod_tovara=Table2.Kod_tovara) and (Table2.Kod_sotrudnika=Table3.Kod_sotrudnika) and (Table3.Kod_dolzhnosti=Table4.Kod_dolzhnosti)'); Form1.Query1.ParamByName('Par').AsString: =Form6.Edit1.Text; Form1.Query1.Active: =true; Form6.Close; Form1.DBGrid1.DataSource: =Form1.DataSource5; end; end; end. Рис. Б.7 - Форма для работы с динамическими запросами
|