Смекни!
smekni.com

Разработка информационно-справочной системы по учету вагонов на подъездном пути предприятия (стр. 27 из 27)

pole7 := '';

pole8 := '';

pole9 := '';

pole10 := '';

pole11 := '';

pole12 := '';

pole13 := '';

ShowZapros;

Form3.ShowModal;

Tbl := 'Uslugi_sv';

Edit3.SetFocus;

end;

procedure TForm8.Edit3Enter(Sender: TObject);

begin

Form3.Caption := 'Цех исполнитель';

Form3.Label1.Caption:= Form3.Caption;

Tbl := 'Ceha';

pole1 := 'id';

pole2 := 'n_ceha';

pole3 := 'bal_schet';

pole4 := '';

pole5 := '';

pole6 := '';

pole7 := '';

pole8 := '';

pole9 := '';

pole10 := '';

pole11 := '';

pole12 := '';

pole13 := '';

ShowZapros;

Form3.ShowModal;

Tbl := 'Uslugi_sv';

DBGrid1.SetFocus;

end;

procedure TForm8.FormShow(Sender: TObject);

begin

if EditMode3 then

begin

Edit1.Text := DataModule2.Quslugi['zakaz'];

Edit2.Text := DataModule2.Quslugi['CS.n_ceha'];

Edit2.Tag := StrToInt(DataModule2.Quslugi['key_s']);

Edit3.Text := DataModule2.Quslugi['CNA.n_ceha'];

Edit3.Tag := StrToInt(DataModule2.Quslugi['key_na']);

end

else

begin

Edit1.Text := '';

Edit2.Text := '';

Edit2.Tag := 0;

Edit3.Text := '';

Edit3.Tag := 0;

end;

Tbl:='Stoimost';

ShowZapros();

TBL:='Uslugi_sv';

end;

procedure TForm8.DBGrid1DblClick(Sender: TObject);

begin

ToIns := Edit1.Text;

ToIns2 := DataModule2.QOSV['OSV.id'];

ToIns3 := DataModule2.QSelUs['ST.id'];

ToIns4 := IntToStr(Edit2.Tag);

ToIns5 := IntToStr(Edit3.Tag);

if MessageDlg('Перемножить стоимость заказа на вес?', mtConfirmation, [mbYes, mbNo], 0) = mrYes then

begin

// ToIns6 := IntToStr(StrToInt(DataModule2.QSelUs['stoimost']) * StrToInt(Form7.Edit3.Text));

ToIns6 := FloatToStr(StrToFloat(DataModule2.QSelUs['stoimost']) * StrToFloat(Form7.Edit3.Text));

Close;

end

else

ToIns6 := DataModule2.QSelUs['stoimost'];

If ((Edit1.Text<>'')and(Edit2.Text<>'')and(Edit3.Text<>'')) then

begin

if EditMode3 then

begin

ForEdit := DataModule2.Quslugi['USV.id'];

InsEdit5 := true;

InsertZapros();

ShowZapros();

end

else

begin

InsertZapros();

ShowZapros();

ForEdit := '-1';

end;

Form8.Close;

end

else

ShowMessage('Все поля обязательны к заполнению!');

end;

procedure TForm8.addExecute(Sender: TObject);

begin

Form5.Show;

end;

procedure TForm8.editExecute(Sender: TObject);

begin

if (DataModule2.QSelUs['ST.id']=Null) then

begin

ShowMessage('Нечего редактировать');

EditMode4 := false;

end

else

begin

EditMode4:=true;

Form5.Show;

end;

end;

procedure TForm8.delExecute(Sender: TObject);

begin

if (DataModule2.QSelUs['ST.id']=Null) then

begin

ShowMessage('Нечего удалять');

EditMode4 := false;

end

else

begin

Tbl:='Stoimost';

pole1 := 'id';

pole2 := 'key_vid_uslug';

pole3 := 'key_ves';

pole4 := 'stoimost';

pole5 := '';

pole6 := '';

pole7 := '';

pole8 := '';

pole9 := '';

pole10 := '';

pole11 := '';

pole12 := '';

pole13 := '';

ForDel := DataModule2.QSelUs['ST.id'];

DelZapros;

ShowZapros();

TBL:='Uslugi_sv';

end;

end;

procedure TForm8.FormClose(Sender: TObject; var Action: TCloseAction);

begin

if EditMode3 then

begin

EditMode3:=false;

end;

Tbl:='Operations_s_vagonom';

end;

procedure TForm8.Edit1Exit(Sender: TObject);

begin

try

strtoint(Edit1.Text);

except

ShowMessage('Здесь должно быть число!!');

Edit1.SetFocus;

end;

end;

end.


unit Unit9;

interface

uses

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

Dialogs, StdCtrls, Grids, Menus, DBGrids;

type

TForm9 = class(TForm)

GroupBox1: TGroupBox;

MainMenu1: TMainMenu;

N1: TMenuItem;

N2: TMenuItem;

N3: TMenuItem;

N4: TMenuItem;

DBGrid1: TDBGrid;

N5: TMenuItem;

N6: TMenuItem;

procedure N1Click(Sender: TObject);

procedure N3Click(Sender: TObject);

procedure N4Click(Sender: TObject);

procedure N5Click(Sender: TObject);

procedure N6Click(Sender: TObject);

private

{ Private declarations }

public

{ Public declarations }

end;

var

Form9: TForm9;

implementation

uses Unit2, Unit10, Unit4, Unit1, Unit11;

{$R *.dfm}

procedure TForm9.N1Click(Sender: TObject);

var tmpRadio, MyI : integer;

begin

Form10.Caption := 'Сортировка';

ForSort := true;

ForFiltr := false;

Form10.RadioGroup2.Enabled := true;

Form10.Edit1.Enabled:=False;

Form10.Edit2.Enabled:=False;

Form10.Edit1.Clear;

Form10.Edit2.Clear;

Form10.Button3.Caption := 'Next';

Form10.RadioGroup1.ItemIndex := 0;

Form10.RadioGroup2.ItemIndex := 0;

ForOrder:='';

Form10.RadioGroup1.Items.Clear;

For MyI:=0 to Form9.DBGrid1.Columns.Count-1 do

begin

Form10.RadioGroup1.Items.Add(Form9.DBGrid1.Columns[MyI].Title.Caption);

end;

for tmpRadio:=0 to Form10.RadioGroup1.Items.Count-1 do

begin

TRadioButton(Form10.RadioGroup1.Controls[tmpRadio]).Enabled := true;

end;

Form10.RadioGroup1.ItemIndex := 0;

Form10.ShowModal;

end;

procedure TForm9.N3Click(Sender: TObject);

var tmpRadio, MyI : integer;

begin

Form10.Caption := 'Фильтрация';

Form10.RadioGroup2.ItemIndex := 0;

Form10.RadioGroup2.Enabled := false;

Diap := 'in';

ForSort := false;

ForFiltr := true;

Form10.Edit1.Enabled:=true;

Form10.Edit2.Enabled:=true;

Form10.Edit1.Clear;

Form10.Edit2.Clear;

Form10.Button3.Caption := 'Ok';

Form10.RadioGroup1.ItemIndex := 0;

Form10.RadioGroup1.Items.Clear;

For MyI:=0 to Form9.DBGrid1.Columns.Count-1 do

begin

Form10.RadioGroup1.Items.Add(Form9.DBGrid1.Columns[MyI].Title.Caption);

end;

for tmpRadio:=0 to Form10.RadioGroup1.Items.Count-1 do

begin

TRadioButton(Form10.RadioGroup1.Controls[tmpRadio]).Enabled := true;

end;

Form10.RadioGroup1.ItemIndex := 0;

Form10.ShowModal;

end;

procedure TForm9.N4Click(Sender: TObject);

var tmpRadio, MyI : integer;

begin

Form10.Caption := 'Фильтрация';

Form10.RadioGroup2.ItemIndex := 0;

Form10.RadioGroup2.Enabled := false;

Diap := 'out';

ForSort := false;

ForFiltr := true;

Form10.Edit1.Enabled:=true;

Form10.Edit2.Enabled:=true;

Form10.Edit1.Clear;

Form10.Edit2.Clear;

Form10.Button3.Caption := 'Ok';

Form10.RadioGroup1.ItemIndex := 0;

Form10.RadioGroup1.Items.Clear;

For MyI:=0 to Form9.DBGrid1.Columns.Count-1 do

begin

Form10.RadioGroup1.Items.Add(Form9.DBGrid1.Columns[MyI].Title.Caption);

end;

for tmpRadio:=0 to Form10.RadioGroup1.Items.Count-1 do

begin

TRadioButton(Form10.RadioGroup1.Controls[tmpRadio]).Enabled := true;

end;

Form10.RadioGroup1.ItemIndex := 0;

Form10.ShowModal;

end;

procedure TForm9.N5Click(Sender: TObject);

begin

ForReport();

end;

procedure TForm9.N6Click(Sender: TObject);

begin

Form11.QuickRep1.PreviewModal;

end;

end.


unit Unit10;

interface

uses

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

Dialogs, StdCtrls, ExtCtrls;

type

TForm10 = class(TForm)

RadioGroup2: TRadioGroup;

Edit2: TEdit;

Edit1: TEdit;

Button3: TButton;

Button2: TButton;

RadioGroup3: TRadioGroup;

RadioGroup1: TRadioGroup;

procedure Button3Click(Sender: TObject);

procedure Button2Click(Sender: TObject);

procedure Sort();

procedure Filtr();

private

{ Private declarations }

public

{ Public declarations }

end;

var

Form10: TForm10;

implementation

Uses Unit4;

{$R *.dfm}

procedure TForm10.Sort();

var tmpRadio, myNumb: integer;

QueryString: string;

tmp, Napr: String;

begin

if RadioGroup2.ItemIndex = 0 then

Napr := ''

else

Napr := ' Desc ';

TRadioButton(RadioGroup1.Controls[RadioGroup1.ItemIndex]).Enabled := False;

if (ForOrder='') then

ForOrder := RadioGroup3.Items[RadioGroup1.ItemIndex] + Napr

else

ForOrder := ForOrder + ','+ RadioGroup3.Items[RadioGroup1.ItemIndex] + Napr;

for tmpRadio:=0 to RadioGroup1.Items.Count-1 do

begin

myNumb := -1;

if (TRadioButton(RadioGroup1.Controls[tmpRadio]).Enabled) then

begin

MyNumb := tmpRadio;

Break;

end;

end;

if (myNumb<>-1) then

RadioGroup1.ItemIndex := myNumb

else

Button3.Caption := 'Выполнить';

if (myNumb=-1) then

begin

ForReport();

Form10.Close;

ForSort := false;

end;

end;

procedure TForm10.Filtr();

begin

if Diap='in' then

tmpFiltr := RadioGroup3.Items[RadioGroup1.ItemIndex] + ' BETWEEN :Par1 AND :Par2'

else

tmpFiltr := RadioGroup3.Items[RadioGroup1.ItemIndex] + ' NOT BETWEEN :Par1 AND :Par2';

ForReport();

Edit1.Enabled:=False;

Edit2.Enabled:=False;

ForFiltr := False;

Form10.Close;

end;

procedure TForm10.Button3Click(Sender: TObject);

begin

if ForSort = true then Sort();

if ForFiltr = true then Filtr();

end;

procedure TForm10.Button2Click(Sender: TObject);

begin

If ForSort then

begin

if RadioGroup2.ItemIndex = 0 then

ForOrder := RadioGroup3.Items[RadioGroup1.ItemIndex]

else

ForOrder := RadioGroup3.Items[RadioGroup1.ItemIndex] + ' Desc';

ForReport();

end;

ForSort := false;

ForFiltr := False;

Form10.Close;

end;

end.


unit Unit11;

interface

uses

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

Dialogs, ExtCtrls, QuickRpt, QRCtrls;

type

TForm11 = class(TForm)

QuickRep1: TQuickRep;

ColumnHeaderBand1: TQRBand;

DetailBand1: TQRBand;

PageFooterBand1: TQRBand;

QRExpr1: TQRExpr;

QRExpr2: TQRExpr;

QRExpr3: TQRExpr;

QRExpr4: TQRExpr;

QRExpr5: TQRExpr;

QRExpr7: TQRExpr;

QRExpr8: TQRExpr;

QRExpr10: TQRExpr;

QRExpr11: TQRExpr;

QRExpr14: TQRExpr;

QRExpr15: TQRExpr;

QRExpr16: TQRExpr;

QRExpr17: TQRExpr;

QRExpr18: TQRExpr;

QRExpr19: TQRExpr;

QRExpr9: TQRExpr;

QRExpr12: TQRExpr;

QRExpr6: TQRExpr;

QRExpr13: TQRExpr;

QRExpr20: TQRExpr;

private

{ Private declarations }

public

{ Public declarations }

end;

var

Form11: TForm11;

implementation

Uses Unit2, Unit9;

{$R *.dfm}

end.

Приложение 3

Результаты работы программы

Форма формирования отчета

Форма печати отчетов