Скачиваний:
9
Добавлен:
17.06.2023
Размер:
1.58 Mб
Скачать

n:=inttostr(length(s));

ADODataSet1.Active:=false;

ADODataSet1.CommandText:='select S_N,C_Kategoria, P_FIO,

D_Disciplina, G_Gruppa from Categoria, Disciplini, Gruppi, Prepodavateli, Svodnai where P_Kategoria=C_N and S_Prepodavatel=P_Tab_N and S_Gruppa=G_N and S_Disciplina=D_N and left(P_FIO,'+n+')='''+s+'''';

ADODataSet1.Active:=true;

end;

If ComboBox1.Text='Группа' then begin

s:=Edit1.Text;

n:=inttostr(length(s));

ADODataSet1.Active:=false;

ADODataSet1.CommandText:='select S_N,C_Kategoria, P_FIO,

D_Disciplina, G_Gruppa from Categoria, Disciplini, Gruppi, Prepodavateli, Svodnai where P_Kategoria=C_N and S_Prepodavatel=P_Tab_N and S_Gruppa=G_N and S_Disciplina=D_N and left(G_Gruppa,'+n+')='''+s+'''';

ADODataSet1.Active:=true;

end;

If ComboBox1.Text='Дисциплина' then begin

s:=Edit1.Text;

n:=inttostr(length(s));

ADODataSet1.Active:=false;

ADODataSet1.CommandText:='select S_N,C_Kategoria, P_FIO,

D_Disciplina, G_Gruppa from Categoria, Disciplini, Gruppi, Prepodavateli, Svodnai where P_Kategoria=C_N and S_Prepodavatel=P_Tab_N and S_Gruppa=G_N and S_Disciplina=D_N and left(D_Disciplina,'+n+')='''+s+'''';

ADODataSet1.Active:=true;

end;

end;

procedure TfmGrPrep.FormShow(Sender: TObject); begin

ADODataSet1.Active:=false;

ADODataSet1.CommandText:='select S_N,C_Kategoria, P_FIO,

D_Disciplina, G_Gruppa from Categoria, Disciplini, Gruppi, Prepodavateli, Svodnai where P_Kategoria=C_N and S_Prepodavatel=P_Tab_N and S_Gruppa=G_N and S_Disciplina=D_N';

ADODataSet1.Active:=true;

end;

procedure TfmGrPrep.Button6Click(Sender: TObject); begin

edit1.Clear;

Close;

end;

procedure TfmGrPrep.Button2Click(Sender: TObject); begin

If ComboBox2.Text='ФИО' then begin ADODataSet1.Active:=false;

ADODataSet1.CommandText:='select S_N, C_Kategoria, P_FIO, D_Disciplina, G_Gruppa from Categoria, Disciplini, Gruppi, Prepodavateli, Svodnai where P_Kategoria=C_N and S_Prepodavatel=P_Tab_N and S_Gruppa=G_N and S_Disciplina=D_N order by P_FIO';

ADODataSet1.Active:=true;

end;

If ComboBox2.Text='Группа' then begin ADODataSet1.Active:=false;

ADODataSet1.CommandText:='select S_N, C_Kategoria, P_FIO, D_Disciplina, G_Gruppa from Categoria, Disciplini, Gruppi, Prepodavateli, Svodnai where P_Kategoria=C_N and S_Prepodavatel=P_Tab_N and S_Gruppa=G_N and S_Disciplina=D_N order by G_Gruppa';

ADODataSet1.Active:=true;

end;

If ComboBox2.Text='Дисциплина' then begin

ADODataSet1.Active:=false;

ADODataSet1.CommandText:='select S_N, C_Kategoria, P_FIO,

D_Disciplina, G_Gruppa from Categoria, Disciplini, Gruppi, Prepodavateli, Svodnai where P_Kategoria=C_N and S_Prepodavatel=P_Tab_N and S_Gruppa=G_N and S_Disciplina=D_N order by D_Disciplina';

ADODataSet1.Active:=true;

end;

end;

procedure TfmGrPrep.ComboBox2KeyPress(Sender: TObject; var Key: Char);

begin case key of

'0'..'9':key:=#0; end;

end;

procedure TfmGrPrep.ComboBox1KeyPress(Sender: TObject; var Key: Char);

begin case key of

'0'..'9':key:=#0; end;

end;

procedure TfmGrPrep.Edit1KeyPress(Sender: TObject; var Key: Char);

begin case key of

'0'..'9':key:=#0; end;

end;

procedure TfmGrPrep.BitBtn1Click(Sender: TObject); begin

fmGrPrepDob.ShowModal

end;

procedure TfmGrPrep.BitBtn2Click(Sender: TObject); begin

fmGP.showmodal;

end;

end.

unit Unit10; interface uses

Windows, Messages, SysUtils, Variants, Classes, Graphics,

Controls, Forms,

Dialogs, StdCtrls, Buttons, IniFiles;

type

TfmPut = class(TForm)

Edit1: TEdit;

Label1: TLabel;

Button1: TButton;

OpenDialog1: TOpenDialog;

BitBtn1: TBitBtn;

BitBtn2: TBitBtn;

Edit2: TEdit;

procedure Button1Click(Sender: TObject); procedure BitBtn1Click(Sender: TObject); procedure FormShow(Sender: TObject);

private

{Private declarations } public

{Public declarations } end;

var

fmPut: TfmPut;

implementation uses Unit1, Unit8; {$R *.dfm}

procedure TfmPut.Button1Click(Sender: TObject); begin

OpenDialog1.InitialDir:= Edit1.Text; if OpenDialog1.Execute then

begin Edit1.Text:=

ExtractFilePath(OpenDialog1.FileName)+'oplata.mdb';

Edit2.Text:=ExtractFilePath(OpenDialog1.FileName);

end;

end;

procedure TfmPut.BitBtn1Click(Sender: TObject); var

IniFile : TIniFile;

Baseput : string;

begin BasePut:=Edit1.Text;

fmID.ADOConnection1.Connected := False; fmID.ADOConnection1.ConnectionString := 'Provider=Microsoft.Jet.OLEDB.4.0;Data Source='+ BasePut+';Persist Security Info=False'; fmID.ADOConnection1.Connected:=True; IniFile:=TIniFile.Create(ExtractFilePath(Application.ExeName)+'o ptions.ini');

IniFile.WriteString('Options', 'DBPath', Edit2.Text);

IniFile.Free;

fmID.ADOConnection1.Connected := True; Close;

end;

procedure TfmPut.FormShow(Sender: TObject); begin

Edit2.Visible:=false;

end;

end.

unit Unit11; interface uses

Windows, Messages, SysUtils, Variants, Classes, Graphics,

Controls, Forms,

Dialogs,Unit8, DB, ADODB, Grids, DBGrids, StdCtrls, DBCtrls,

WordXP,

OleServer;

type

TfmNagruzka = class(TForm)

DBGrid1: TDBGrid;

DataSource1: TDataSource;

ADODataSet1: TADODataSet;

ADOQuery1: TADOQuery;

Button1: TButton;

Label1: TLabel;

ComboBox1: TComboBox;

Label2: TLabel;

Button2: TButton;

Button3: TButton;

Button4: TButton;

WordApplication1: TWordApplication;

WordDocument1: TWordDocument;

ComboBox3: TComboBox;

ComboBox2: TComboBox;

ADOQuery2: TADOQuery;

Button5: TButton;

ADOQuery3: TADOQuery;

procedure Button1Click(Sender: TObject); procedure Button3Click(Sender: TObject); procedure FormShow(Sender: TObject); procedure Button4Click(Sender: TObject); procedure Button2Click(Sender: TObject); procedure Button5Click(Sender: TObject);

procedure ComboBox1KeyPress(Sender: TObject; var Key: Char);

procedure ComboBox2KeyPress(Sender: TObject; var Key: Char);

procedure ComboBox3KeyPress(Sender: TObject; var Key: Char);

private

{ Private declarations } public

{ Public declarations } end;

var

fmNagruzka: TfmNagruzka; implementation

{$R *.dfm}

procedure TfmNagruzka.Button1Click(Sender: TObject); var s:string;

begin

if ComboBox1.Text='Четный' then begin ADODataSet1.Active:=false;

ADODataSet1.CommandText:='select P_FIO, C_Kategoria,Sum(iif(D_RZ,''1'',''0'')*G_kolvo*0.4*C_Tarif_v_Chas +iif(D_ikzamen,''1'',''0'')*G_kolvo*0.4*C_Tarif_v_Chas)'+

'as result from Categoria, Disciplini, Gruppi, Prepodavateli, Svodnai '+

'where P_Kategoria=C_N and

S_Prepodavatel=P_Tab_N'

+' and S_Gruppa=G_N and S_Disciplina=D_N' +' and D_N_semestra mod 2=0'+

//' D_N_semestra in ("2","4","6","8","10")'+

'Group by P_FIO, C_Kategoria'; ADODataSet1.Active:=true; DBGrid1.Columns[2].Visible:=false;

end else

begin

ADODataSet1.Active:=false;

ADODataSet1.CommandText:='select P_FIO,

C_Kategoria,Sum(iif(D_RZ,''1'',''0'')*G_kolvo*C_Tarif_V_Chas*0. 4+iif(D_ikzamen,''1'',''0'')*G_kolvo*C_Tarif_V_Chas*0.4)'+

'as result from Categoria, Disciplini, Gruppi, Prepodavateli, Svodnai '+

'where P_Kategoria=C_N and

S_Prepodavatel=P_Tab_N and S_Gruppa=G_N and

S_Disciplina=D_N'+

'and D_N_semestra mod 2>0'+

//' D_N_semestra in ("2","4","6","8","10")'+

'Group by P_FIO, C_Kategoria';

ADODataSet1.Active:=true;

DBGrid1.Columns[2].Visible:=false; end; end;

procedure TfmNagruzka.Button3Click(Sender: TObject); begin

ADODataSet1.Active:=false;

ADODataSet1.CommandText:='select P_FIO,

C_Kategoria,D_N_semestra,'+ ' Sum(iif(D_RZ,''1'',''0'')*G_kolvo*C_Tarif_v_chas*0.4+iif(D_ikzam en,''1'',''0'')*G_kolvo*C_Tarif_v_chas*0.4)'

+' as result from Categoria, Disciplini, Gruppi, Prepodavateli, Svodnai'+

' where P_Kategoria=C_N and S_Prepodavatel=P_Tab_N and S_Gruppa=G_N and S_Disciplina=D_N Group by P_FIO, C_Kategoria, D_N_semestra';

ADODataSet1.Active:=true;

DBGrid1.Columns[2].Visible:=true;

end;

procedure TfmNagruzka.FormShow(Sender: TObject); var s:string;

begin ADODataSet1.Active:=false;

ADODataSet1.CommandText:='select P_FIO,

C_Kategoria,D_N_semestra,'+

'

Sum(iif(D_RZ,''1'',''0'')*G_kolvo*C_Tarif_v_chas*0.4+iif(D_ikzam en,''1'',''0'')*G_kolvo*C_Tarif_v_chas*0.4)'

+' as result from Categoria, Disciplini, Gruppi, Prepodavateli, Svodnai'+

' where P_Kategoria=C_N and S_Prepodavatel=P_Tab_N and S_Gruppa=G_N and S_Disciplina=D_N Group by P_FIO, C_Kategoria, D_N_semestra';

ADODataSet1.Active:=true;

ADODataSet1.Active:=true;

ComboBox3.Visible:=false;

ComboBox3.Clear;

ComboBox2.Clear;

AdoQuery2.SQL.Clear;

ADOQuery2.Active:=false;

ADOQuery2.SQL.add('select p_tab_n ,p_fio from Prepodavateli order by p_fio');

ADOQuery2.Active:=true;

ADOQuery2.First;

while not (ADOQuery2.Eof) do begin s:=ADOQuery2.FieldValues['p_fio']; ComboBox2.Items.Add(s);

s:=ADOQuery2.FieldValues['p_tab_n']; ComboBox3.Items.Add(s); ADOQuery2.Next;

end;

end;

procedure TfmNagruzka.Button4Click(Sender: TObject); begin

Close;

end;

procedure TfmNagruzka.Button2Click(Sender: TObject); var s,n:string;

begin s:=Combobox3.Items[Combobox2.ItemIndex]; ADODataSet1.Active:=false;

ADODataSet1.CommandText:='select P_FIO, C_Kategoria,'+

'

Sum(iif(D_RZ,''1'',''0'')*G_kolvo*C_tarif_v_chas*0.4+iif(D_ikzam en,''1'',''0'')*G_kolvo*C_tarif_v_chas*0.4)'

+' as result from Categoria, Disciplini, Gruppi, Prepodavateli, Svodnai'+

' where P_Kategoria=C_N and S_Prepodavatel=P_Tab_N and S_Gruppa=G_N and S_Disciplina=D_N and p_tab_n="'+s+'" Group by P_FIO, C_Kategoria ';

ADODataSet1.Active:=true;

end;

procedure TfmNagruzka.Button5Click(Sender: TObject); var

Template:OleVariant; Table1: Table; flag:boolean; a,s,d,n:string;

begin

If Combobox2.Text<>'' then begin

a:=Combobox3.Items[Combobox2.ItemIndex];;

ADOQuery3.SQl.Clear;

ADOQuery3.Active:=false;

WordApplication1.Connect; Template:=ExtractFilePath(Application.EXEName)+'Нагрузка.dot '; //путь к шаблону документа

WordApplication1.Documents.Add(Template,EmptyParam,Empt yParam,EmptyParam);// создаем документ на основе шаблона

WordDocument1.ConnectTo(WordApplication1.ActiveDocumen

case key of

t); //Связываем компонент WordDocument1 c активным

'0'..'9' :key:=#0;

документом (т.е. с только что созданным документом)

end;

Table1:=WordDocument1.Tables.Item(1);

end;

Table1.Cell(1,2).Range.Text :=a;

procedure TfmNagruzka.ComboBox3KeyPress(Sender: TObject;

Table1.Cell(2,2).Range.Text :=Combobox2.Text;

var Key: Char);

AdoQuery3.SQL.Add('select C_Kategoria from Categoria,

begin

Prepodavateli where P_Kategoria=C_N and p_tab_n="'+a+'"');

case key of

ADOQuery3.Active:=true;

'0'..'9' :key:=#0;

d:= AdoQuery3.FieldValues['C_Kategoria'];

end;

Table1.Cell(3,2).Range.Text :=d;

end;

ADOQuery3.SQl.Clear;

end.

ADOQuery3.Active:=false;

unit Unit12;

AdoQuery3.SQl.Add('select P_FIO, C_Kategoria,'+

interface

'

uses

Sum(iif(D_RZ,''1'',''0'')*G_kolvo*C_tarif_v_chas*0.4+iif(D_ikzam

Windows, Messages, SysUtils, Variants, Classes, Graphics,

en,''1'',''0'')*G_kolvo*C_tarif_v_chas*0.4)'

Controls, Forms,

+' as result from Categoria, Disciplini, Gruppi,

Dialogs,Unit8, DB, ADODB, Grids, DBGrids, StdCtrls, Buttons,

Prepodavateli, Svodnai'+

WordXP,

' where P_Kategoria=C_N and

OleServer,DBCtrls;

S_Prepodavatel=P_Tab_N and S_Gruppa=G_N and

type

S_Disciplina=D_N and p_tab_n="'+a+'" Group by P_FIO,

TfmOplata = class(TForm)

C_Kategoria ');

ADODataSet1: TADODataSet;

ADOQuery3.Active:=true ;

DataSource1: TDataSource;

s:= AdoQuery3.FieldValues['Result'];

Button1: TButton;

if s='' then s:='0';

Label1: TLabel;

Table1.Cell(5,2).Range.Text := s;

ComboBox1: TComboBox;

 

Label2: TLabel;

WordApplication1.Visible:=true; //делаем приложение MS

Button2: TButton;

Word видимым

DBGrid1: TDBGrid;

WordApplication1.Disconnect; // Разрываем связь с сервером

ADOQuery1: TADOQuery;

end

ComboBox3: TComboBox;

else ShowMessage('Введите ФИО преподавателя');

ADOQuery2: TADOQuery;

end;

Button3: TButton;

procedure TfmNagruzka.ComboBox1KeyPress(Sender: TObject;

Button4: TButton;

var Key: Char);

WordApplication1: TWordApplication;

begin

WordDocument1: TWordDocument;

case key of

Button5: TButton;

'0'..'9' :key:=#0;

ADOQuery3: TADOQuery;

end;

ComboBox2: TComboBox;

end;

Button6: TButton;

procedure TfmNagruzka.ComboBox2KeyPress(Sender: TObject;

Button7: TButton;

var Key: Char);

Button8: TButton;

begin

procedure Button1Click(Sender: TObject);

procedure FormShow(Sender: TObject); procedure Button3Click(Sender: TObject); procedure Button2Click(Sender: TObject); procedure Button4Click(Sender: TObject); procedure Button5Click(Sender: TObject); procedure Button7Click(Sender: TObject); procedure Button6Click(Sender: TObject); procedure Button8Click(Sender: TObject);

procedure ComboBox1KeyPress(Sender: TObject; var Key: Char);

procedure ComboBox3KeyPress(Sender: TObject; var Key: Char);

procedure ComboBox2KeyPress(Sender: TObject; var Key: Char);

private

{Private declarations } public

{Public declarations } end;

var

fmOplata: TfmOplata; implementation

uses Unit19; {$R *.dfm}

procedure TfmOplata.Button1Click(Sender: TObject); var

i:integer; begin

If ComboBox1.Text='Четный' then begin ADODataSet1.Active:=false;

ADODataSet1.CommandText:='select P_FIO, C_Kategoria,Sum((D_Laboratornii+D_Practica+D_Lekcii)*C_Tarif _v_chas) as result from Categoria, Disciplini, Gruppi, Prepodavateli, Svodnai'+

'where'+

'P_Kategoria=C_N and'+

'S_Prepodavatel=P_Tab_N and'+

'S_Gruppa=G_N and'+

'S_Disciplina=D_N and'+

'D_N_semestra mod 2=0'+

//' D_N_semestra in ("2","4","6","8","10")'+

'Group by P_FIO,C_Kategoria';

ADODataSet1.Active:=true;

DBGrid1.Columns[2].Visible:=false;

end else begin

ADODataSet1.Active:=false;

ADODataSet1.CommandText:='select P_FIO,

C_Kategoria,Sum((D_Laboratornii+D_Practica+D_Lekcii)*C_Tarif _v_chas) as result from Categoria, Disciplini, Gruppi, Prepodavateli, Svodnai'+

'where'+

'P_Kategoria=C_N and'+

'S_Prepodavatel=P_Tab_N and'+

'S_Gruppa=G_N and'+

'S_Disciplina=D_N and'+

'D_N_semestra mod 2>0'+

//' D_N_semestra in ("2","4","6","8","10")'+

'Group by P_FIO,C_Kategoria';

ADODataSet1.Active:=true;

DBGrid1.Columns[2].Visible:=false;

end;

end;

procedure TfmOplata.FormShow(Sender: TObject); var s:string;

begin ADODataSet1.Active:=false;

ADODataSet1.CommandText:='select P_FIO,C_Kategoria,

D_N_semestra,'

+' Sum((D_Laboratornii+D_Practica+D_Lekcii)*C_Tarif_v_chas) as result'

+' from Categoria, Disciplini, Gruppi, Prepodavateli, Svodnai' +' where P_Kategoria=C_N and S_Prepodavatel=P_Tab_N and S_Gruppa=G_N and'

+' S_Disciplina=D_N Group by P_FIO,C_Kategoria,D_N_semestra';

ADODataSet1.Active:=true;

ComboBox3.Visible:=false;

ComboBox3.Clear;

ComboBox2.Clear;

AdoQuery3.SQL.Clear;

ADOQuery3.Active:=false;

ADOQuery3.SQL.add('select p_tab_n ,p_fio from Prepodavateli

order by p_fio');

ADOQuery3.Active:=true;

ADOQuery3.First;

while not (ADOQuery3.Eof) do begin s:=ADOQuery3.FieldValues['p_fio']; ComboBox2.Items.Add(s);

s:=ADOQuery3.FieldValues['p_tab_n']; ComboBox3.Items.Add(s); ADOQuery3.Next;

end;

end;

procedure TfmOplata.Button3Click(Sender: TObject); begin

Close;

end;

procedure TfmOplata.Button2Click(Sender: TObject); var d,n:string;

begin

If Combobox2.Text<>'' then begin

d:=ComboBox3.Items[Combobox2.ItemIndex]; If ComboBox1.Text='Четный' then

begin ADODataSet1.Active:=false;

ADODataSet1.CommandText:='select P_FIO, C_Kategoria,Sum((D_Laboratornii+D_Practica+D_Lekcii)*C_Tarif _v_chas) as result'

+' from Categoria, Disciplini, Gruppi, Prepodavateli, Svodnai'+

'where'+

'P_Kategoria=C_N '+

'and S_Prepodavatel=P_Tab_N and

S_Gruppa=G_N and'+

'D_N_semestra mod 2=0 and'+

'S_Disciplina=D_N and P_Tab_N="'+d+'" Group

by P_FIO,C_Kategoria, D_N_Semestra'; ADODataSet1.Active:=true; DBGrid1.Columns[2].Visible:=false; end

else begin

ADODataSet1.Active:=false;

ADODataSet1.CommandText:='select p_FIO,C_Kategoria,

D_N_Semestra,

Sum((D_Laboratornii+D_Practica+D_Lekcii)*C_Tarif_v_chas) as

result from Categoria, Disciplini, Gruppi, Prepodavateli, Svodnai'+

'where'+

'P_Kategoria=C_N '+

'and S_Prepodavatel=P_Tab_N and

S_Gruppa=G_N and'+

'D_N_semestra mod 2>0 and'+

'S_Disciplina=D_N and P_Tab_N="'+d+'" Group

by P_FIO,C_Kategoria, D_N_Semestra'; ADODataSet1.Active:=true; DBGrid1.Columns[2].Visible:=false; end; end

else

Showmessage('Введите ФИО преподавателя!'); end;

procedure TfmOplata.Button4Click(Sender: TObject); var d,n:string;

begin

If Combobox2.Text<>'' then begin

d:=Combobox3.Items[Combobox2.ItemIndex];

ADODataSet1.Active:=false;

ADODataSet1.CommandText:='select P_FIO, C_Kategoria,'+

'

Sum((D_Laboratornii+D_Practica+D_Lekcii)*C_Tarif_v_chas)'

+' as result from Categoria, Disciplini, Gruppi,

Prepodavateli, Svodnai'+

' where P_Kategoria=C_N and S_Prepodavatel=P_Tab_N and S_Gruppa=G_N and S_Disciplina=D_N and p_Tab_N="'+d+'" Group by P_FIO,C_Kategoria';

ADODataSet1.Active:=true;

DBGrid1.Columns[2].Visible:=false; end

else

Showmessage('Введите преподавателя!'); end;

procedure TfmOplata.Button5Click(Sender: TObject); var

Template:OleVariant; Table1: Table; flag:boolean; a,s,d,n:string;

begin

If Combobox2.Text<>'' then begin

a:=Combobox3.Items[Combobox2.ItemIndex];;

ADOQuery2.SQl.Clear;

ADOQuery2.Active:=false;

WordApplication1.Connect; Template:=ExtractFilePath(Application.EXEName)+'Квиток для оплаты.dot'; //путь к шаблону документа

WordApplication1.Documents.Add(Template,EmptyParam,Empt yParam,EmptyParam);// создаем документ на основе шаблона

WordDocument1.ConnectTo(WordApplication1.ActiveDocumen t); //Связываем компонент WordDocument1 c активным документом (т.е. с только что созданным документом)

Table1:=WordDocument1.Tables.Item(1);

Table1.Cell(1,2).Range.Text :=a;

Table1.Cell(2,2).Range.Text :=Combobox2.Text;

AdoQuery2.SQL.Add('select C_Kategoria from Categoria, Prepodavateli where P_Kategoria=C_N and p_tab_n="'+a+'"');

ADOQuery2.Active:=true;

d:= AdoQuery2.FieldValues['C_Kategoria']; Table1.Cell(3,2).Range.Text :=d; ADOQuery2.SQl.Clear; ADOQuery2.Active:=false; AdoQuery2.SQl.Add('select

Sum((iif(D_RZ,''1'',''0'')*G_kolvo*0.4+iif(D_ikzamen,''1'',''0'')*G_ kolvo*0.4+D_Laboratornii+D_Practica+D_Lekcii )*C_Tarif_v_chas )'

+ ' as result from Categoria, Disciplini, Gruppi, Prepodavateli, Svodnai'+

' where P_Kategoria=C_N and S_Prepodavatel=P_Tab_N and S_Gruppa=G_N and S_Disciplina=D_N and P_Tab_N="' +

a+'" Group by P_FIO,C_Kategoria'); ADOQuery2.Active:=true ;

s:= AdoQuery2.FieldValues['Result']; Table1.Cell(5,2).Range.Text := s;

ADOQuery2.SQl.Clear;

ADOQuery2.Active:=false;

AdoQuery2.SQl.Add('select Sum(D_Lekcii*C_Tarif_v_chas)'

+ ' as result from Categoria, Disciplini, Gruppi, Prepodavateli, Svodnai'+

' where P_Kategoria=C_N and S_Prepodavatel=P_Tab_N and S_Gruppa=G_N and S_Disciplina=D_N and P_Tab_N="' +

a+'" Group by P_FIO,C_Kategoria'); ADOQuery2.Active:=true ;

s:= AdoQuery2.FieldValues['Result']; Table1.Cell(6,2).Range.Text := s; ADOQuery2.SQl.Clear;

ADOQuery2.Active:=false;

AdoQuery2.SQl.Add('select Sum(D_Practica*C_Tarif_v_chas)'

+ ' as result from Categoria, Disciplini, Gruppi,

Prepodavateli, Svodnai'+

' where P_Kategoria=C_N and S_Prepodavatel=P_Tab_N and S_Gruppa=G_N and S_Disciplina=D_N and P_Tab_N="' +

a+'" Group by P_FIO,C_Kategoria'); ADOQuery2.Active:=true ;

s:= AdoQuery2.FieldValues['Result']; Table1.Cell(7,2).Range.Text := s; ADOQuery2.SQl.Clear;

ADOQuery2.Active:=false;

AdoQuery2.SQl.Add('select

Sum(D_Laboratornii*C_Tarif_v_chas)'

+ ' as result from Categoria, Disciplini, Gruppi, Prepodavateli, Svodnai'+

' where P_Kategoria=C_N and S_Prepodavatel=P_Tab_N and S_Gruppa=G_N and S_Disciplina=D_N and P_Tab_N="' +

a+'" Group by P_FIO,C_Kategoria'); ADOQuery2.Active:=true ;

s:= AdoQuery2.FieldValues['Result']; Table1.Cell(8,2).Range.Text := s; ADOQuery2.SQl.Clear;

ADOQuery2.Active:=false;

AdoQuery2.SQl.Add('select

Sum(iif(D_RZ,''1'',''0'')*G_kolvo*C_Tarif_v_chas*0.4)'

+ ' as result from Categoria, Disciplini, Gruppi, Prepodavateli, Svodnai'+

' where P_Kategoria=C_N and S_Prepodavatel=P_Tab_N and S_Gruppa=G_N and S_Disciplina=D_N and P_Tab_N="' +

a+'" Group by P_FIO,C_Kategoria'); ADOQuery2.Active:=true ;

s:= AdoQuery2.FieldValues['Result']; Table1.Cell(9,2).Range.Text := s; ADOQuery2.SQl.Clear; ADOQuery2.Active:=false; AdoQuery2.SQl.Add('select

Sum(iif(D_ikzamen,''1'',''0'')*G_kolvo*C_Tarif_v_chas*0.4)'

+ ' as result from Categoria, Disciplini, Gruppi, Prepodavateli, Svodnai'+

' where P_Kategoria=C_N and S_Prepodavatel=P_Tab_N and S_Gruppa=G_N and S_Disciplina=D_N and P_Tab_N="' +

a+'" Group by P_FIO,C_Kategoria'); ADOQuery2.Active:=true ;

s:= AdoQuery2.FieldValues['Result']; Table1.Cell(10,2).Range.Text := s; WordApplication1.Visible:=true; //делаем приложение MS Word видимым

WordApplication1.Disconnect; // Разрываем связь с сервером end

else ShowMessage('Введите ФИО преподавателя'); end;

procedure TfmOplata.Button7Click(Sender: TObject); var d,n:string;

begin

If Combobox2.Text<>'' then begin

d:=Combobox3.Items[Combobox2.ItemIndex];

ADODataSet1.Active:=false;

ADODataSet1.CommandText:='select P_FIO, C_Kategoria,'+

'

Sum((iif(D_RZ,''1'',''0'')*G_kolvo*0.4+iif(D_ikzamen,''1'',''0'')*G_ kolvo*0.4+D_Laboratornii+D_Practica+D_Lekcii)*C_Tarif_v_chas )'

+' as result from Categoria, Disciplini, Gruppi, Prepodavateli, Svodnai'+

' where P_Kategoria=C_N and S_Prepodavatel=P_Tab_N and S_Gruppa=G_N and S_Disciplina=D_N and p_Tab_N="'+d+'" Group by P_FIO,C_Kategoria';

ADODataSet1.Active:=true;

DBGrid1.Columns[2].Visible:=false;

end

else

Showmessage('Введите преподавателя!'); end;

procedure TfmOplata.Button6Click(Sender: TObject); var d,n:string;

begin

If Combobox2.Text<>'' then begin

d:=ComboBox3.Items[Combobox2.ItemIndex]; If ComboBox1.Text='Четный' then

begin ADODataSet1.Active:=false;

ADODataSet1.CommandText:='select P_FIO, C_Kategoria,Sum((iif(D_RZ,''1'',''0'')*G_kolvo*0.4+iif(D_ikzamen, ''1'',''0'')*G_kolvo*0.4+D_Laboratornii+D_Practica+D_Lekcii)*C_ Tarif_v_chas) as result'

+' from Categoria, Disciplini, Gruppi, Prepodavateli, Svodnai'+

'where'+

'P_Kategoria=C_N '+

'and S_Prepodavatel=P_Tab_N and

S_Gruppa=G_N and'+

'D_N_semestra mod 2=0 and'+

'S_Disciplina=D_N and P_Tab_N="'+d+'" Group

by P_FIO,C_Kategoria, D_N_Semestra'; ADODataSet1.Active:=true; DBGrid1.Columns[2].Visible:=false; end;

If ComboBox1.Text='Нечетный' then begin

d:=ComboBox3.Items[Combobox2.ItemIndex];

ADODataSet1.Active:=false;

ADODataSet1.CommandText:='select p_FIO,C_Kategoria,

D_N_Semestra, Sum((iif(D_RZ,''1'',''0'')*G_kolvo*0.4+iif(D_ikzamen,''1'',''0'')*G_ kolvo*0.4+D_Laboratornii+D_Practica+D_Lekcii)*C_Tarif_v_chas ) as result from Categoria, Disciplini, Gruppi, Prepodavateli, Svodnai'+

'where'+

'P_Kategoria=C_N '+

'and S_Prepodavatel=P_Tab_N and

S_Gruppa=G_N and'+

' D_N_semestra mod 2>0 and'+

' S_Disciplina=D_N and P_Tab_N="'+d+'" Group by P_FIO,C_Kategoria, D_N_Semestra';

ADODataSet1.Active:=true;

DBGrid1.Columns[2].Visible:=false; end; end

else

Showmessage('Введите ФИО преподавателя!'); end;

procedure TfmOplata.Button8Click(Sender: TObject); begin

ADODataSet1.Active:=false;

ADODataSet1.CommandText:='select P_FIO,C_Kategoria,

D_N_semestra,'

+' Sum((D_Laboratornii+D_Practica+D_Lekcii)*C_Tarif_v_chas) as result'

+' from Categoria, Disciplini, Gruppi, Prepodavateli, Svodnai' +' where P_Kategoria=C_N and S_Prepodavatel=P_Tab_N and S_Gruppa=G_N and'

+' S_Disciplina=D_N Group by P_FIO,C_Kategoria,D_N_semestra';

ADODataSet1.Active:=true;

end;

procedure TfmOplata.ComboBox1KeyPress(Sender: TObject; var Key: Char);

begin case key of

'0'..'9' :key:=#0; end;

end;

procedure TfmOplata.ComboBox3KeyPress(Sender: TObject; var Key: Char);

begin case key of

'0'..'9' :key:=#0; end;

end;

procedure TfmOplata.ComboBox2KeyPress(Sender: TObject; var Key: Char);

begin case key of

'0'..'9' :key:=#0; end;

end;

end.

unit Unit13; interface uses

Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,Dialogs, StdCtrls, DB, ADODB,Unit8;

type

TfmDisRed = class(TForm)

Label1: TLabel;

Label2: TLabel;

Label3: TLabel;

Label4: TLabel;

Label5: TLabel;

Label6: TLabel;

Label7: TLabel;

Edit1: TEdit;

Edit3: TEdit;

Edit4: TEdit;

Edit5: TEdit;

ComboBox1: TComboBox;

ComboBox2: TComboBox;

Edit2: TEdit;

Button1: TButton;

Button2: TButton;

ADOQuery1: TADOQuery;

procedure Button1Click(Sender: TObject); procedure Button2Click(Sender: TObject); procedure FormShow(Sender: TObject);

procedure Edit2KeyPress(Sender: TObject; var Key: Char); procedure Edit3KeyPress(Sender: TObject; var Key: Char); procedure Edit4KeyPress(Sender: TObject; var Key: Char); procedure Edit5KeyPress(Sender: TObject; var Key: Char); procedure ComboBox1KeyPress(Sender: TObject; var Key:

Char);

procedure ComboBox2KeyPress(Sender: TObject; var Key: Char);

private

{Private declarations } public

{Public declarations } end;

var

fmDisRed: TfmDisRed; implementation

Соседние файлы в папке Курсовые работы