Проектування АІС для обслуговування та ремонту автомобілів
Курсовой проект - Компьютеры, программирование
Другие курсовые по предмету Компьютеры, программирование
(dat2) +Label1. Caption);
DataModule1. IBQuery1. Open;
sum: =0;
for i: =1 to DataModule1. IBQuery1. RecordCount do
begin
sum: =sum+DataModule1. IBQuery1. fieldbyname (F_1). AsFloat;
DataModule1. IBQuery1. Next;
end;
Edit1. Text: =FloatToStr (sum);
end;
procedure TForm8. FormClose (Sender: TObject; var Action: TCloseAction);
begin
DataModule1. IBQuery1. Close;
end;
end.
unit UPrint;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, QRCtrls, QuickRpt, ExtCtrls;
type
TfmPrint = class (TForm)
QuickRep1: TQuickRep;
QRBand1: TQRBand;
QRBand2: TQRBand;
QRSubDetail1: TQRSubDetail;
QRLabel1: TQRLabel;
QRLabel2: TQRLabel;
QRLabel3: TQRLabel;
QRLabel4: TQRLabel;
QRLabel5: TQRLabel;
QRLabel6: TQRLabel;
QRLabel7: TQRLabel;
QRLabel8: TQRLabel;
QRLabel9: TQRLabel;
QRLabel10: TQRLabel;
QRLabel11: TQRLabel;
QRLabel12: TQRLabel;
QRLabel13: TQRLabel;
QRDBText1: TQRDBText;
QRDBText2: TQRDBText;
QRDBText3: TQRDBText;
QRDBText4: TQRDBText;
QRDBText5: TQRDBText;
QRDBText6: TQRDBText;
QRDBText7: TQRDBText;
QRBand3: TQRBand;
QRLabel14: TQRLabel;
QRSysData1: TQRSysData;
QRLabel15: TQRLabel;
QRLabel17: TQRLabel;
QRLabel16: TQRLabel;
QRLabel18: TQRLabel;
QRSysData2: TQRSysData;
QRLabel19: TQRLabel;
private
{ Private declarations }
public
{ Public declarations }
end;
var
fmPrint: TfmPrint;
implementation
uses UZaputPoslyg, Unit1, UZvit1;
{$R *. dfm}
end.
unit UZvit1;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls, Grids, DBGrids, ExtCtrls, ComCtrls;
type
TForm9 = class (TForm)
GroupBox1: TGroupBox;
Label2: TLabel;
Label3: TLabel;
Label4: TLabel;
DBGrid1: TDBGrid;
Button1: TButton;
Button2: TButton;
Label1: TLabel;
Edit3: TEdit;
Label5: TLabel;
Label6: TLabel;
Edit4: TEdit;
Label7: TLabel;
Label8: TLabel;
Edit5: TEdit;
Label9: TLabel;
Panel1: TPanel;
Button3: TButton;
Picker1: TDateTimePicker;
Picker2: TDateTimePicker;
procedure Button1Click (Sender: TObject);
procedure FormClose (Sender: TObject; var Action: TCloseAction);
procedure Button2Click (Sender: TObject);
procedure Button3Click (Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form9: TForm9;
i: integer;
sum: real;
dat1,dat2: TDate;
implementation
uses Unit1, UPrint, DB;
{$R *. dfm}
procedure TForm9. Button1Click (Sender: TObject);
begin
dat1: =Picker1. Date;
dat2: =Picker2. Date;
DataModule1. IBQuery2. Close;
DataModule1. IBQuery2. SQL. Clear;
DataModule1. IBQuery2. SQL. Add (select id_zakazy, poslyga as poslyga, price_poslygu as price, name_zapchastun as zapchastunu, price_zapchastun as price, count_zapchastun as kount, (price_poslygu+price_zapchastun*count_zapchastun) as syma);
DataModule1. IBQuery2. SQL. Add (from zakaz, poslygu, zapchastunu);
DataModule1. IBQuery2. SQL. Add (where zapchastunu. id_zapchastun=zakaz. id_zapchastun and poslygu. id_poslygu=zakaz. id_poslygu);
DataModule1. IBQuery2. SQL. Add (and data_oplatu between+Label1. Caption+DateToStr (dat1) +Label1. Caption+and+Label1. Caption+DateToStr (dat2) +Label1. Caption);
DataModule1. IBQuery2. Open;
sum: =0;
for i: =1 to DataModule1. IBQuery2. RecordCount do
begin
sum: =sum+DataModule1. IBQuery2. fieldbyname (syma). AsFloat;
DataModule1. IBQuery2. Next;
end;
Edit3. Text: =FloatToStr (sum);
end;
procedure TForm9. FormClose (Sender: TObject; var Action: TCloseAction);
begin
DataModule1. IBQuery2. Close;
Edit3. Text: =;
Edit5. Text: =;
end;
procedure TForm9. Button2Click (Sender: TObject);
begin
if DataModule1. IBQuery2. Active=false
then MessageDlg (Виконайте запит, mtWarning, mbOKCancel, 0)
else begin
fmPrint: =TfmPrint. Create (Self);
fmPrint. QRLabel4. Caption: =DateToStr (Picker1. Date);
fmPrint. QRLabel6. Caption: =DateToStr (Picker2. Date);
fmPrint. QRLabel17. Caption: =Form9. Edit3. Text+ гpн. ;
fmPrint. QRLabel18. Caption: =Form9. Edit5. Text+ гpн. ;
fmPrint. QuickRep1. Preview;
fmPrint. Free;
end;
end;
procedure TForm9. Button3Click (Sender: TObject);
begin
if DataModule1. IBQuery2. Active=false
then MessageDlg (Виконайте запит, mtWarning, mbOKCancel, 0)
else begin
Edit5. Text: =FloatToStr (StrToFloat (Edit3. Text) *StrToFloat (0,+Edit4. Text));
end;
end;
end.
unit UZvit2;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls, Grids, DBGrids, ExtCtrls, ComObj;
type
TForm10 = class (TForm)
GroupBox1: TGroupBox;
Label2: TLabel;
Label4: TLabel;
DBGrid1: TDBGrid;
Button1: TButton;
Edit1: TEdit;
Edit2: TEdit;
Button2: TButton;
Label1: TLabel;
Label3: TLabel;
Edit3: TEdit;
Panel1: TPanel;
Label5: TLabel;
Edit4: TEdit;
Edit5: TEdit;
Label6: TLabel;
Edit6: TEdit;
Label7: TLabel;
procedure Button1Click (Sender: TObject);
procedure FormClose (Sender: TObject; var Action: TCloseAction);
procedure Button2Click (Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form10: TForm10;
sum,sum1,sum2: real;
i: integer;
implementation
uses Unit1, UPrint1;
{$R *. dfm}
procedure TForm10. Button1Click (Sender: TObject);
begin
if (Edit1. Text=) or (Edit2. Text=) or (Edit3. Text=) then MessageDlg (Введiть значення в поля, mtWarning, [mbOk], 0) else
begin
DataModule1. IBQuery3. Close;
DataModule1. IBQuery3. SQL. Clear;
DataModule1. IBQuery3. SQL. Add (select id_zakazy, poslyga as poslyga, price_poslygu as price, name_zapchastun as zapchastunu, price_zapchastun as price, count_zapchastun as kount, (price_zapchastun*count_zapchastun) as syma1, (price_poslygu+price_zapchastun*count_zapchastun) as syma);
DataModule1. IBQuery3. SQL. Add (from zakaz, poslygu, zapchastunu, avto, clientu);
DataModule1. IBQuery3. SQL. Add (where zapchastunu. id_zapchastun=zakaz. id_zapchastun and poslygu. id_poslygu=zakaz. id_poslygu);
DataModule1. IBQuery3. SQL. Add (and avto. nomer_reestracii=zakaz. id_avto and clientu. id_clienta=avto. id_clienta);
DataModule1. IBQuery3. SQL. Add (and first_name=+Label1. Caption+Edit1. Text+Label1. Caption+and nomer_reestracii=+Label1. Caption+Edit2. Text+Label1. Caption+and marka=+Label1. Caption+Edit3. Text+Label1. Caption);
DataModule1. IBQuery3. Open;
sum: =0;
sum1: =0;
sum2: =0;
for i: =1 to DataModule1. IBQuery3. RecordCount do
begin
sum: =sum+DataModule1. IBQuery3. fieldbyname (syma). AsFloat;
sum1: =sum1+DataModule1. IBQuery3. fieldbyname (price). AsFloat;
sum2: =sum2+DataModule1. IBQuery3. fieldbyname (syma1). AsFloat;
DataModule1. IBQuery3. Next;
end;
Edit4. Text: =FloatToStr (sum);
Edit5. Text: =FloatToStr (sum1);
Edit6. Text: =FloatToStr (sum2);
end;
end;
procedure TForm10. FormClose (Sender: TObject; var Action: TCloseAction);
begin
DataModule1. IBQuery3. Close;
end;
procedure TForm10. Button2Click (Sender: TObject);
var
Exc,Colum: OleVariant;
i,jj,j: byte;
begin
if DataModule1. IBQuery3. Active=false
then MessageDlg (Виконайте запит, mtWarning, mbOKCancel, 0)
else begin
Exc: =CreateOleObject (Excel. Application);
// Exc. WorkBooks. Open (D: \Документи\ХПК\мої куpcаки\куpcак - ПАIC\InterBase-паpктика\пpоект\akt. xls);
Exc. Visible: =true;
Exc. Workbooks. Add (-4167);
Exc. Workbooks [1]. WorkSheets [1]. Name: =Отчёт;
Colum: =Exc. Workbooks [1]. WorkSheets [Отчёт]. Columns;
Colum. Columns [1]. ColumnWidth: =7;
Colum. Columns [2]. ColumnWidth: =25;
Colum. Columns [3]. ColumnWidth: =10;
Colum. Columns [4]. ColumnWidth: =25;
Colum. Columns [5]. ColumnWidth: =10;
Colum. Columns [6]. ColumnWidth: =7;
Colum. Columns [7]. ColumnWidth: =10;
j: =1;
for i: =0 to DBGrid1. Columns. Count-1 do
begin
Exc. Cells [1,j]: =DBGrid1. Columns [i]. Title. Caption;
Ex