Смекни!
smekni.com

Разработка программного обеспечения по автоматизации учебного процесса в колледже (стр. 9 из 11)

unit Unit12;

interface

uses

Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,

Dialogs, Menus, DB, ADODB;

type

TForm12 = class(TForm)

MainMenu1: TMainMenu;

N1: TMenuItem;

N2: TMenuItem;

N3: TMenuItem;

N4: TMenuItem;

N8: TMenuItem;

N9: TMenuItem;

ADOConnection1: TADOConnection;

N10: TMenuItem;

N11: TMenuItem;

N12: TMenuItem;

procedure N9Click(Sender: TObject);

procedure N11Click(Sender: TObject);

procedure N12Click(Sender: TObject);

procedure FormCreate(Sender: TObject);

procedure N2Click(Sender: TObject);

procedure N3Click(Sender: TObject);

procedure N4Click(Sender: TObject);

private

{ Private declarations }

public

{ Public declarations }

end;

var

Form12: TForm12;

implementation

uses Unit13, Unit15, Unit14, Unit16, Unit17, Unit18;

{$R *.dfm}

procedure TForm12.N9Click(Sender: TObject);

begin

Form13.Show;

end;

procedure TForm12.N11Click(Sender: TObject);

begin

Form15.Show;

end;

procedure TForm12.N12Click(Sender: TObject);

begin

Form14.Show;

end;

procedure TForm12.FormCreate(Sender: TObject);

begin

//Form16.Show;

end;

procedure TForm12.N2Click(Sender: TObject);

begin

Form16.Show;

end;

procedure TForm12.N3Click(Sender: TObject);

begin

Form17.show;

end;

procedure TForm12.N4Click(Sender: TObject);

begin

Form18.show;

end;

end.

unit Unit13;

interfa

ceuses

Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls,Unit12, Forms,

Dialogs, ExcelXP, OleServer, Grids, DBGrids, StdCtrls, DB, ADODB;

type

TForm13 = class(TForm)

Label1: TLabel;

DBGrid1: TDBGrid;

ExcelWorkbook1: TExcelWorkbook;

ExcelApplication1: TExcelApplication;

ADOQuery1: TADOQuery;

DataSource1: TDataSource;

Button1: TButton;

ADOQuery2: TADOQuery;

ADOQuery1gruppa: TWideStringField;

ADOQuery1fio: TWideStringField;

ADOQuery1Datapr: TWideStringField;

ADOQuery1Prim: TWideStringField;

procedure Button1Click(Sender: TObject);

private

{ Private declarations }

public

{ Public declarations }

end;

var

Form13: TForm13;

implementation

{$R *.dfm}

procedure TForm13.Button1Click(Sender: TObject);

var n: OleVariant;

i:integer;

//S:String;

begin

ADOQuery2.ExecSQL;

AdoQuery1.Open;

n:='d:\55\spisok.xls';

ExcelApplication1.Workbooks.Add(n,0);

Excelworkbook1.ConnectTo(ExcelApplication1.ActiveWorkbook);

i:=2;

ADOQUERY1.Insert;

ExcelApplication1.Visible[0]:=False;

While i<2000 do

begin;

ADOQuery1.FieldByName('gruppa').AsString:=ExcelApplication1.Cells.Item[i,1].Value;

ADOQuery1.FieldByName('Fio').AsString:=ExcelApplication1.Cells.Item[i,2].Value;

ADOQuery1.FieldByName('Datapr').AsString:=ExcelApplication1.Cells.Item[i,3].Value;

ADOQuery1.FieldByName('Prim').AsString:=ExcelApplication1.Cells.Item[i,4].Value;

If ADOQuery1.FieldByName('gruppa').AsString='' then

begin

ADOQUERY1.Delete;

i:=2001;

end;

ADOQUERY1.Insert;

i:=i+1;

end;

ADOQuery1.Open;

Showmessage('Прием данных выполнен');

end;

end.

unit Unit14;

interface

uses

Windows, Messages, SysUtils, Variants, Classes, Graphics,Unit12, Controls, Forms,

Dialogs, DB, ADODB, ExtCtrls, DBCtrls, Grids, DBGrids;

type

TForm14 = class(TForm)

DBGrid1: TDBGrid;

DBNavigator1: TDBNavigator;

DataSource1: TDataSource;

ADOQuery1: TADOQuery;

ADOQuery1Disziplina: TWideStringField;

procedure FormCreate(Sender: TObject);

private

{ Private declarations }

public

{ Public declarations }

end;

var

Form14: TForm14;

implementation

{$R *.dfm}

procedure TForm14.FormCreate(Sender: TObject);

begin

ADOQuery1.Active:=true;

end;

end.

unit Unit15;

interface

uses

Windows, Messages, SysUtils, Variants,Unit12,Classes, Graphics, Controls, Forms,

Dialogs, DB, ADODB, ExtCtrls, DBCtrls, Grids, DBGrids;

type

TForm15 = class(TForm)

ADOQuery1: TADOQuery;

DBGrid1: TDBGrid;

DBNavigator1: TDBNavigator;

DataSource1: TDataSource;

ADOQuery1Grupa: TWideStringField;

ADOQuery1Spez: TWideStringField;

procedure FormCreate(Sender: TObject);

private

{ Private declarations }

public

{ Public declarations }

end;

var

Form15: TForm15;

implementation

{$R *.dfm}

procedure TForm15.FormCreate(Sender: TObject);

begin

ADOQuery1.Active:=true;

end;

end.

unit Unit16;

interface

uses

Windows, Messages, SysUtils, Variants, Classes,Unit12, Graphics, Controls, Forms,

Dialogs, DB, ADODB, StdCtrls, ExtCtrls, DBCtrls, Grids, DBGrids;

type

TForm16 = class(TForm)

ADOQuery1: TADOQuery;

DBGrid1: TDBGrid;

DBNavigator1: TDBNavigator;

DataSource1: TDataSource;

ADOQuery1stud: TWideStringField;

ComboBox1: TComboBox;

ComboBox2: TComboBox;

ComboBox3: TComboBox;

ComboBox4: TComboBox;

ComboBox5: TComboBox;

Label1: TLabel;

Label2: TLabel;

Label3: TLabel;

Label4: TLabel;

Label5: TLabel;

Button1: TButton;

Dobav: TADOQuery;

ADOQuery1ozenka: TIntegerField;

ADOQuery1koddis: TWideStringField;

ADOQuery2: TADOQuery;

ADOTable1: TADOTable;

ADOTable2: TADOTable;

ADOTable1DSDesigner: TAutoIncField;

ADOTable1Grupa: TWideStringField;

ADOTable1Disziplina: TWideStringField;

procedure Button1Click(Sender: TObject);

procedure ComboBox4Change(Sender: TObject);

procedure FormCreate(Sender: TObject);

private

{ Private declarations }

public

{ Public declarations }

end;

var

Form16: TForm16;

implementation

{$R *.dfm}

procedure TForm16.Button1Click(Sender: TObject);

begin

Dobav.SQL.Clear;

ADOQuery2.SQL.Clear;

ADOQuery2.SQL.Text:='delete from ozenka where(ozenka.kodspez = "'+Combobox4.Text+'"and ozenka.koddis = "'+Combobox3.Text+'"and ozenka.mes = "'+Combobox1.Text+'"and ozenka.god = "'+Combobox2.Text+'" and ozenka.gruppa="'+Combobox5.Text+'")';

ADOQuery2.ExecSQL;

Dobav.SQL.Add('Insert Into Ozenka ( gruppa,stud)');

Dobav.SQL.Add('Select gruppa,fio');

Dobav.SQL.Add(' From stud where (gruppa="'+Combobox5.text+'")');

//ShowMessage(Dobav.SQL.Text); //Dobav.SQL.Add(''

Dobav.ExecSQL;

Dobav.SQL.Clear;

Dobav.SQL.Add('UPDATE ozenka SET ozenka.kodspez = "'+Combobox4.Text+'", ozenka.koddis = "'+Combobox3.Text+'", ozenka.mes = "'+Combobox1.Text+'", ozenka.god = "'+Combobox2.Text+'" WHERE (((ozenka.gruppa)="'+Combobox5.Text+'")and(ozenka.koddis is null ));');

Dobav.ExecSQL;

ADOQUERY1.SQL.Clear;

ADOQUERY1.SQL.Add('Select* from ozenka where(ozenka.kodspez = "'+Combobox4.Text+'"and ozenka.koddis = "'+Combobox3.Text+'"and ozenka.mes = "'+Combobox1.Text+'"and ozenka.god = "'+Combobox2.Text+'" and ozenka.gruppa="'+Combobox5.Text+'")');

//ShowMessage(ADOQUERY1.SQL.Text);

ADOQUERY1.Active:=True;

end;

procedure TForm16.ComboBox4Change(Sender: TObject);

begin

ADOTable2.Open;

ADOTable2.First;

ComboBox5.Items.Clear;

While not ADOTable2.Eof do

begin

if ADOTable2.Fieldbyname('Spez').AsString=ComboBox4.Text Then

ComboBox5.Items.Add(ADOTable2.fieldbyname('grupa').AsString);

ADOTable2.Next;

end;

ADOTable2.Close;

ComboBox5.Sorted:=True;

end;

procedure TForm16.FormCreate(Sender: TObject);

begin

ADOTable1.Open;

ADOTable1.First;

ComboBox3.Items.Clear;

While not ADOTable1.Eof do

begin

ComboBox3.Items.Add(ADOTable1.fieldbyname('disziplina').AsString);

//ShowMessage(ADOTable1.fieldbyname('disziplina').AsString);

ADOTable1.Next;

end;

ADOTable1.Close;

ComboBox3.Sorted:=True;

end;

end.

unit Unit17;

interface

uses

Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,

Dialogs, DB, ADODB, StdCtrls, ExtCtrls, DBCtrls, Grids, DBGrids;

type

TForm17 = class(TForm)

DBGrid1: TDBGrid;

DBNavigator1: TDBNavigator;

Label1: TLabel;

Label2: TLabel;

Label3: TLabel;

Label4: TLabel;

Label5: TLabel;

ComboBox1: TComboBox;

ComboBox2: TComboBox;

ComboBox3: TComboBox;

ComboBox5: TComboBox;

Button1: TButton;

ADOQuery1: TADOQuery;

ADOQuery1stud: TWideStringField;

DataSource1: TDataSource;

ADOQuery1ozenka: TIntegerField;

ADOQuery1koddis: TWideStringField;

ComboBox4: TComboBox;

ADOTable1: TADOTable;

ADOTable2: TADOTable;

procedure Button1Click(Sender: TObject);

procedure FormCreate(Sender: TObject);

procedure ComboBox4Change(Sender: TObject);

private

{ Private declarations }

public

{ Public declarations }

end;

var

Form17: TForm17;

implementation

{$R *.dfm}

procedure TForm17.Button1Click(Sender: TObject);

begin

ADOQUERY1.SQL.Clear;

ADOQUERY1.SQL.Add('Select* from ozenka where(ozenka.kodspez = "'+Combobox4.Text+'"and ozenka.koddis = "'+Combobox3.Text+'"and ozenka.mes = "'+Combobox1.Text+'"and ozenka.god = "'+Combobox2.Text+'" and ozenka.gruppa="'+Combobox5.Text+'")');

//ShowMessage(ADOQUERY1.SQL.Text);

ADOQUERY1.Active:=True;

end;

procedure TForm17.FormCreate(Sender: TObject);

begin

ADOTable1.Open;

ADOTable1.First;

ComboBox3.Items.Clear;

While not ADOTable1.Eof do

begin

ComboBox3.Items.Add(ADOTable1.fieldbyname('disziplina').AsString);

//ShowMessage(ADOTable1.fieldbyname('disziplina').AsString);

ADOTable1.Next;

end;

ADOTable1.Close;

ComboBox3.Sorted:=True;

end;

procedure TForm17.ComboBox4Change(Sender: TObject);

begin

ADOTable2.Open;

ADOTable2.First;

ComboBox5.Items.Clear;

While not ADOTable2.Eof do

begin

if ADOTable2.Fieldbyname('Spez').AsString=ComboBox4.Text Then

ComboBox5.Items.Add(ADOTable2.fieldbyname('grupa').AsString);

ADOTable2.Next;

end;

ADOTable2.Close;

ComboBox5.Sorted:=True;

end;

end.

unit Unit18;

interface

uses

Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,

Dialogs, StdCtrls, DB, ADODB, Buttons, ExtCtrls, ComCtrls, ExcelXP,

OleServer, Grids, DBGrids;

type

TForm18 = class(TForm)

PageControl1: TPageControl;

TabSheet1: TTabSheet;

TabSheet2: TTabSheet;

TabSheet3: TTabSheet;

RadioGroup1: TRadioGroup;

BitBtn1: TBitBtn;

Label1: TLabel;

Label2: TLabel;

ComboBox1: TComboBox;

ComboBox2: TComboBox;

Label4: TLabel;

Label5: TLabel;

ADOQuery1: TADOQuery;

Edit1: TEdit;

Edit2: TEdit;

Label3: TLabel;

Label6: TLabel;

Label7: TLabel;

ComboBox3: TComboBox;

ComboBox6: TComboBox;

Label8: TLabel;

Label9: TLabel;

RadioGroup3: TRadioGroup;

ExcelWorkbook1: TExcelWorkbook;

ExcelApplication1: TExcelApplication;

BitBtn2: TBitBtn;

ADOQuery2: TADOQuery;

ComboBox7: TComboBox;

ComboBox8: TComboBox;

Label10: TLabel;

Label11: TLabel;

BitBtn3: TBitBtn;

ADOQuery3: TADOQuery;

ADOQuery4: TADOQuery;

ADOQuery5: TADOQuery;

ADOTable2: TADOTable;

ComboBox4: TComboBox;

ComboBox5: TComboBox;

DataSource1: TDataSource;

ADOQuery6: TADOQuery;

ADOTable6: TADOTable;

Button1: TButton;

procedure BitBtn1Click(Sender: TObject);

procedure BitBtn2Click(Sender: TObject);

procedure BitBtn3Click(Sender: TObject);

procedure Button1Click(Sender: TObject);

procedure ComboBox4Change(Sender: TObject);

// procedure ComboBox4Change(Sender: TObject);

private

{ Private declarations }

public

{ Public declarations }

end;

var

Form18: TForm18;

implementation

{$R *.dfm}

procedure TForm18.BitBtn1Click(Sender: TObject);

var

k1:integer;

k2:integer;

k3:integer;

k4,k:double;

begin

//по группе

If radiogroup1.ItemIndex=0

then begin

ADOQuery1.SQL.Clear;

AdoQuery1.SQL.Add('SELECT Count(ozenka.stud) AS [Count1] FROM ozenka where (((ozenka.ozenka)>3))GROUP BY ozenka.mes, ozenka.god, ozenka.gruppa ');

AdoQuery1.SQL.Add('HAVING (((ozenka.mes)="'+Combobox1.Text+'") AND ((ozenka.god)="'+Combobox2.Text+'") AND ((ozenka.gruppa)="'+Combobox5.Text+'"))');

AdoQuery1.Active:=True;

k1:=AdoQuery1.fieldbyname('Count1').AsInteger;

ADOQuery1.SQL.Clear;

AdoQuery1.SQL.Add('SELECT Count(ozenka.stud) AS [Count2] FROM ozenka where (((ozenka.ozenka)>0))GROUP BY ozenka.mes, ozenka.god, ozenka.gruppa ');

AdoQuery1.SQL.Add('HAVING (((ozenka.mes)="'+Combobox1.Text+'") AND ((ozenka.god)="'+Combobox2.Text+'") AND ((ozenka.gruppa)="'+Combobox5.Text+'"))');

AdoQuery1.Active:=True;

k2:=AdoQuery1.fieldbyname('Count2').AsInteger;

ADOQuery1.SQL.Clear;

AdoQuery1.SQL.Add('SELECT Count(ozenka.stud) AS [Count3] FROM ozenka where (((ozenka.ozenka)>2))GROUP BY ozenka.mes, ozenka.god, ozenka.gruppa ');

AdoQuery1.SQL.Add('HAVING (((ozenka.mes)="'+Combobox1.Text+'") AND ((ozenka.god)="'+Combobox2.Text+'") AND ((ozenka.gruppa)="'+Combobox5.Text+'"))');

AdoQuery1.Active:=True;

k3:=AdoQuery1.fieldbyname('Count3').AsInteger;

k4:=Round((k3/k2*100)*100)/100;

k:=Round((k1/k2*100)*100)/100;

Edit1.Text:=FloatToStr(k4);

Edit2.Text:=FloatToStr(k);

end;

//по специальности

If radiogroup1.ItemIndex=1

then begin

ADOQuery1.SQL.Clear;

AdoQuery1.SQL.Add('SELECT Count(ozenka.stud) AS [Count1] FROM ozenka where (((ozenka.ozenka)>3))GROUP BY ozenka.mes, ozenka.god, ozenka.kodspez ');

AdoQuery1.SQL.Add('HAVING (((ozenka.mes)="'+Combobox1.Text+'") AND ((ozenka.god)="'+Combobox2.Text+'") AND ((ozenka.kodspez)="'+Combobox4.Text+'"))');

AdoQuery1.Active:=True;

k1:=AdoQuery1.fieldbyname('Count1').AsInteger;

ADOQuery1.SQL.Clear;

AdoQuery1.SQL.Add('SELECT Count(ozenka.stud) AS [Count2] FROM ozenka where (((ozenka.ozenka)>0))GROUP BY ozenka.mes, ozenka.god, ozenka.kodspez ');

AdoQuery1.SQL.Add('HAVING (((ozenka.mes)="'+Combobox1.Text+'") AND ((ozenka.god)="'+Combobox2.Text+'") AND ((ozenka.kodspez)="'+Combobox4.Text+'"))');

AdoQuery1.Active:=True;

k2:=AdoQuery1.fieldbyname('Count2').AsInteger;

ADOQuery1.SQL.Clear;

AdoQuery1.SQL.Add('SELECT Count(ozenka.stud) AS [Count3] FROM ozenka where (((ozenka.ozenka)>2))GROUP BY ozenka.mes, ozenka.god, ozenka.kodspez ');

AdoQuery1.SQL.Add('HAVING (((ozenka.mes)="'+Combobox1.Text+'") AND ((ozenka.god)="'+Combobox2.Text+'") AND ((ozenka.kodspez)="'+Combobox4.Text+'"))');

AdoQuery1.Active:=True;

k3:=AdoQuery1.fieldbyname('Count3').AsInteger;

k4:=Round((k3/k2*100)*100)/100;

k:=Round((k1/k2*100)*100)/100;

Edit1.Text:=FloatToStr(k4);

Edit2.Text:=FloatToStr(k);

end;

//по колледжу

If radiogroup1.ItemIndex=2

then begin

ADOQuery1.SQL.Clear;

AdoQuery1.SQL.Add('SELECT Count(ozenka.stud) AS [Count1] FROM ozenka where (((ozenka.ozenka)>3))GROUP BY ozenka.mes, ozenka.god ');