Смекни!
smekni.com

Разработка информационно-аналитической системы контакт-центра (стр. 11 из 13)

else DataModule2. ADOTable10. Filter: = 'Date >= '+Chr(39) + IntToStr(d) +' / '+ IntToStr(m) +' / '+ IntToStr(y) +' 00: 00: 00 AM'+Chr(39) + ' and Date < '+Chr(39) + IntToStr(d1) +' / '+ IntToStr(m1) +' / '+ IntToStr(y1) +' 00: 00: 00 AM'+Chr(39);

Form11. QRLabel1. Caption: = 'Отчет за текущую неделю';

Form11. QuickRep1. PreviewModal;

end;

procedure TForm1. N15Click(Sender: TObject);

Var n, y, m, d, y1, m1, d1: Word;

Date1, Date2: TDateTime;

begin

DataModule2. ADOTable10. Active: =false;

DataModule2. ADOTable10. Active: =true;

DecodeDate(Date(), y, m, d);

If m=12 then m1: =1 else m1: =m+1;

If m=12 then y1: =y+1 else y1: =y;

d: =1;

d1: =1;

If Form1. Label2. Caption='0' then DataModule2. ADOTable10. Filter: = 'Id_manager =' + Form1. Label1. Caption + ' and Date >= '+Chr(39) + IntToStr(d) +' / '+ IntToStr(m) +' / '+ IntToStr(y) +' 00: 00: 00 AM'+Chr(39) + ' and Date < '+Chr(39) + IntToStr(d1) +' / '+ IntToStr(m1) +' / '+ IntToStr(y1) +' 00: 00: 00 AM'+Chr(39)

else DataModule2. ADOTable10. Filter: = 'Date >= '+Chr(39) + IntToStr(d) +' / '+ IntToStr(m) +' / '+ IntToStr(y) +' 00: 00: 00 AM'+Chr(39) + ' and Date < '+Chr(39) + IntToStr(d1) +' / '+ IntToStr(m1) +' / '+ IntToStr(y1) +' 00: 00: 00 AM'+Chr(39);

Form11. QRLabel1. Caption: = 'Отчет за текущий месяц';

Form11. QuickRep1. PreviewModal;

end;

procedure TForm1. N16Click(Sender: TObject);

Var n, y, m, d, y1, m1, d1: Word;

Date1, Date2: TDateTime;

begin

DataModule2. ADOTable10. Active: =false;

DataModule2. ADOTable10. Active: =true;

DecodeDate(Date(), y, m, d);

d: =1;

d1: =1;

m: =1;

m1: =1;

y1: =y+1;

If Form1. Label2. Caption='0' then DataModule2. ADOTable10. Filter: = 'Id_manager =' + Form1. Label1. Caption + ' and Date >= '+Chr(39) + IntToStr(d) +' / '+ IntToStr(m) +' / '+ IntToStr(y) +' 00: 00: 00 AM'+Chr(39) + ' and Date < '+Chr(39) + IntToStr(d1) +' / '+ IntToStr(m1) +' / '+ IntToStr(y1) +' 00: 00: 00 AM'+Chr(39)

else DataModule2. ADOTable10. Filter: = 'Date >= '+Chr(39) + IntToStr(d) +' / '+ IntToStr(m) +' / '+ IntToStr(y) +' 00: 00: 00 AM'+Chr(39) + ' and Date < '+Chr(39) + IntToStr(d1) +' / '+ IntToStr(m1) +' / '+ IntToStr(y1) +' 00: 00: 00 AM'+Chr(39);

Form11. QRLabel1. Caption: = 'Отчет за текущий год';

Form11. QuickRep1. PreviewModal;

end;

end.

unit Unit2;

interface

uses

SysUtils, Classes, DB, ADODB;

type

TDataModule2 = class(TDataModule)

ADOConnection1: TADOConnection;

ADOTable1: TADOTable;

DataSource1: TDataSource;

ADOTable2: TADOTable;

DataSource2: TDataSource;

ADOQuery1: TADOQuery;

DataSource3: TDataSource;

ADOTable3: TADOTable;

ADOTable4: TADOTable;

DataSource4: TDataSource;

ADOTable5: TADOTable;

ADOTable6: TADOTable;

ADOTable7: TADOTable;

DataSource5: TDataSource;

DataSource6: TDataSource;

ADOQuery2: TADOQuery;

ADOQuery3: TADOQuery;

ADOTable8: TADOTable;

ADOTable9: TADOTable;

ADOTable10: TADOTable;

private

{ Private declarations }

public

{ Public declarations }

end;

var

DataModule2: TDataModule2;

implementation

{$R *. dfm}

end.

unit Unit3;

interface

uses

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

Dialogs, StdCtrls, Buttons, ExtCtrls, unit2;

type

TForm3 = class(TForm)

Edit1: TEdit;

Edit2: TEdit;

Panel1: TPanel;

BitBtn1: TBitBtn;

Edit3: TEdit;

Label1: TLabel;

Label2: TLabel;

Label3: TLabel;

BitBtn2: TBitBtn;

procedure BitBtn1Click(Sender: TObject);

procedure BitBtn2Click(Sender: TObject);

private

{ Private declarations }

public

{ Public declarations }

end;

var

Form3: TForm3;

implementation

uses Unit1;

{$R *. dfm}

procedure TForm3. BitBtn1Click(Sender: TObject);

Var i, l, id: integer;

y, m, d, y1, m1, d1: Word;

pas: string;

begin

DataModule2. ADOConnection1. Connected: =false;

DataModule2. ADOConnection1. ConnectionString: ='';

DataModule2. ADOConnection1. ConnectionString: =DataModule2. ADOConnection1. ConnectionString+'Provider=SQLOLEDB.1; ';

DataModule2. ADOConnection1. ConnectionString: =DataModule2. ADOConnection1. ConnectionString+'Password=asdfghjkl; ';

DataModule2. ADOConnection1. ConnectionString: =DataModule2. ADOConnection1. ConnectionString+'Persist Security Info=True; ';

DataModule2. ADOConnection1. ConnectionString: =DataModule2. ADOConnection1. ConnectionString+'User ID=simp; ';

DataModule2. ADOConnection1. ConnectionString: =DataModule2. ADOConnection1. ConnectionString+'Initial Catalog=simpaza; ';

DataModule2. ADOConnection1. ConnectionString: =DataModule2. ADOConnection1. ConnectionString+'Data Source='+Edit3. Text;

DataModule2. ADOConnection1. Connected: =true;

DataModule2. ADOTable6. Active: =false;

DataModule2. ADOTable7. Active: =false;

DataModule2. ADOTable6. Active: =true;

DataModule2. ADOTable7. Active: =true;

/ / ïðîâåðêà ëîãèíà è ïàðîëÿ

If Edit2. Text='' then ShowMessage('Ââåäèòå ëîãèí') else

If Edit1. Text='' then ShowMessage('Ââåäèòå ïàðîëü')

else begin

DataModule2. ADOTable1. Active: =true;

DataModule2. ADOTable1. First;

pas: ='';

For i: =1 to DataModule2. ADOTable1. RecordCount do

begin

If DataModule2. ADOTable1. FieldByName('Login'). AsString = Edit2. Text

then begin

l: =DataModule2. ADOTable1. FieldByName('Level'). AsInteger;

pas: =DataModule2. ADOTable1. FieldByName('Pass'). AsString;

id: =DataModule2. ADOTable1. FieldByName('Id_manager'). AsInteger;

end;

DataModule2. ADOTable1. Next;

end;

If pas=Edit1. Text then

begin

If l=0 then Form1. N3. Visible: =false;

If l=1 then Form1. N10. Visible: =false;

Form1. Label1. Caption: =IntToStr(Id);

Form1. Label2. Caption: =IntToStr(l);

Form1. MonthCalendar1. Date: =Date();

DecodeDate(Date(), y, m, d);

DecodeDate(Date(), y1, m1, d1);

If l=0 then DataModule2. ADOTable6. Filter: = 'Id_manager =' + Form1. Label1. Caption + ' and Date >= '+Chr(39) + IntToStr(d) +' / '+ IntToStr(m) +' / '+ IntToStr(y) +' 00: 00: 00 AM'+Chr(39) + ' and Date < '+Chr(39) + IntToStr(d1) +' / '+ IntToStr(m1) +' / '+ IntToStr(y1) +' 00: 00: 00 AM'+Chr(39)

else DataModule2. ADOTable6. Filter: = 'Date >= '+Chr(39) + IntToStr(d) +' / '+ IntToStr(m) +' / '+ IntToStr(y) +' 00: 00: 00 AM'+Chr(39) + ' and Date < '+Chr(39) + IntToStr(d1) +' / '+ IntToStr(m1) +' / '+ IntToStr(y1) +' 00: 00: 00 AM'+Chr(39);

If l=0 then DataModule2. ADOTable7. Filter: = 'Id_manager =' + Form1. Label1. Caption + ' and Date >= '+Chr(39) + IntToStr(d) +' / '+ IntToStr(m) +' / '+ IntToStr(y) +' 00: 00: 00 AM'+Chr(39) + ' and Date < '+Chr(39) + IntToStr(d1) +' / '+ IntToStr(m1) +' / '+ IntToStr(y1) +' 00: 00: 00 AM'+Chr(39)

else DataModule2. ADOTable7. Filter: = 'Date >= '+Chr(39) + IntToStr(d) +' / '+ IntToStr(m) +' / '+ IntToStr(y) +' 00: 00: 00 AM'+Chr(39) + ' and Date < '+Chr(39) + IntToStr(d1) +' / '+ IntToStr(m1) +' / '+ IntToStr(y1) +' 00: 00: 00 AM'+Chr(39);

close;

end

else ShowMessage('Íåïðàâèëüíûé ëîãèí èëè ïàðîëü')

end;

/ / Close;

end;

procedure TForm3. BitBtn2Click(Sender: TObject);

begin

Form1. Close;

end;

end.

unit Unit4;

interface

uses

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

Dialogs, unit2, Grids, DBGrids, ExtCtrls, DBCtrls, StdCtrls, Buttons;

type

TForm4 = class(TForm)

DBGrid1: TDBGrid;

DBNavigator1: TDBNavigator;

BitBtn1: TBitBtn;

procedure BitBtn1Click(Sender: TObject);

private

{ Private declarations }

public

{ Public declarations }

end;

var

Form4: TForm4;

implementation

{$R *. dfm}

procedure TForm4. BitBtn1Click(Sender: TObject);

begin

DataModule2. ADOTable1. Cancel;

DataModule2. ADOTable1. Active: =false;

Close;

end;

end.

unit Unit5;

interface

uses

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

Dialogs, ExtCtrls, DBCtrls, Grids, DBGrids, unit2, StdCtrls, Buttons,

Mask;

type

TForm5 = class(TForm)

DBGrid1: TDBGrid;

DBNavigator1: TDBNavigator;

DBEdit1: TDBEdit;

DBEdit2: TDBEdit;

DBEdit3: TDBEdit;

DBEdit4: TDBEdit;

DBEdit5: TDBEdit;

DBEdit6: TDBEdit;

DBEdit7: TDBEdit;

DBEdit8: TDBEdit;

BitBtn1: TBitBtn;

DBLookupComboBox1: TDBLookupComboBox;

Label1: TLabel;

Label2: TLabel;

Label3: TLabel;

Label4: TLabel;

Label5: TLabel;

Label6: TLabel;

Label7: TLabel;

Label8: TLabel;

Label9: TLabel;

procedure BitBtn1Click(Sender: TObject);

procedure BitBtn2Click(Sender: TObject);

private

{ Private declarations }

public

{ Public declarations }

end;

var

Form5: TForm5;

implementation

{$R *. dfm}

procedure TForm5. BitBtn1Click(Sender: TObject);

begin

DataModule2. ADOTable5. Cancel;

Close;

end;

procedure TForm5. BitBtn2Click(Sender: TObject);

begin

DataModule2. ADOTable5. Edit;

DataModule2. ADOTable5. FieldByName('Id_status'). AsString: =DBLookupComboBox1. KeyValue;

DataModule2. ADOTable5. Post;

end;

end.

unit Unit6;

interface

uses

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

Dialogs, unit2, StdCtrls, Buttons, ExtCtrls, DBCtrls, Grids, DBGrids;

type

TForm6 = class(TForm)

DBGrid1: TDBGrid;

DBNavigator1: TDBNavigator;

BitBtn1: TBitBtn;

procedure BitBtn1Click(Sender: TObject);

private

{ Private declarations }

public

{ Public declarations }

end;

var

Form6: TForm6;

implementation

{$R *. dfm}

procedure TForm6. BitBtn1Click(Sender: TObject);

begin

DataModule2. ADOTable2. Cancel;

DataModule2. ADOTable2. Active: =false;

Close;

end;

end.

unit Unit7;

interface

uses

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

Dialogs, StdCtrls, Buttons, DBCtrls, Unit2;

type

TForm7 = class(TForm)

Edit2: TEdit;

Edit3: TEdit;

Edit4: TEdit;

Edit5: TEdit;

Edit6: TEdit;

Edit7: TEdit;

Edit8: TEdit;

Edit9: TEdit;

BitBtn1: TBitBtn;

BitBtn2: TBitBtn;

DBLookupComboBox1: TDBLookupComboBox;

Label1: TLabel;

Label2: TLabel;

Label3: TLabel;

Label4: TLabel;

Label5: TLabel;

Label6: TLabel;

Label7: TLabel;

Label8: TLabel;

Label9: TLabel;

procedure BitBtn2Click(Sender: TObject);

procedure BitBtn1Click(Sender: TObject);

private

{ Private declarations }

public

{ Public declarations }

end;

var

Form7: TForm7;

implementation

uses Unit1;

{$R *. dfm}

procedure TForm7. BitBtn2Click(Sender: TObject);

begin

Close;

end;

procedure TForm7. BitBtn1Click(Sender: TObject);

begin

DataModule2. ADOTable4. Active: =true;

DataModule2. ADOTable4. InsertRecord([Edit2. Text, Edit3. Text, Edit4. Text, Edit5. Text, Edit6. Text, Edit7. Text, Edit8. Text, Edit9. Text, Form1. Label1. Caption, DBLookupComboBox1. KeyValue]);

Close;

end;

end.

unit Unit8;

interface

uses

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

Dialogs, Unit2, DBCtrls, ExtCtrls, Grids, DBGrids, StdCtrls, Buttons,

Mask;

type

TForm8 = class(TForm)

DBLookupComboBox1: TDBLookupComboBox;

Label1: TLabel;

BitBtn1: TBitBtn;

BitBtn2: TBitBtn;

Label2: TLabel;

Label3: TLabel;

Edit2: TEdit;

MaskEdit1: TMaskEdit;

procedure BitBtn1Click(Sender: TObject);

procedure BitBtn2Click(Sender: TObject);

private

{ Private declarations }

public

{ Public declarations }

end;

var

Form8: TForm8;

implementation

{$R *. dfm}

procedure TForm8. BitBtn1Click(Sender: TObject);

begin

Close;

end;

procedure TForm8. BitBtn2Click(Sender: TObject);

Var max_num: integer;

begin

DataModule2. ADOQuery2. Active: =false;

DataModule2. ADOQuery2. Active: =true;

DataModule2. ADOTable8. Active: =true;

DataModule2. ADOTable8. InsertRecord([MaskEdit1. Text, DBLookupComboBox1. KeyValue, Edit2. Text]);

Close;

end;

end.

unit Unit9;

interface

uses

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

Dialogs, StdCtrls, Buttons, ExtCtrls, DBCtrls, Grids, DBGrids, Mask;

type

TForm9 = class(TForm)

DBLookupComboBox1: TDBLookupComboBox;

Label1: TLabel;

BitBtn1: TBitBtn;

Label2: TLabel;

Label3: TLabel;

Edit2: TEdit;

MaskEdit1: TMaskEdit;

BitBtn2: TBitBtn;

Label4: TLabel;

Edit1: TEdit;

procedure BitBtn1Click(Sender: TObject);

procedure BitBtn2Click(Sender: TObject);

private

{ Private declarations }

public

{ Public declarations }

end;

var

Form9: TForm9;

implementation

uses Unit2;

{$R *. dfm}

procedure TForm9. BitBtn1Click(Sender: TObject);

begin

Close;

end;

procedure TForm9. BitBtn2Click(Sender: TObject);

begin

DataModule2. ADOTable9. Active: =true;

DataModule2. ADOTable9. InsertRecord([MaskEdit1. Text, DBLookupComboBox1. KeyValue, Edit2. Text, Edit1. Text]);

Close;

end;

end.

unit Unit10;

interface

uses

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

Dialogs, unit2, ExtCtrls, QuickRpt, QRCtrls;

type

TForm10 = class(TForm)

QuickRep1: TQuickRep;

TitleBand1: TQRBand;

QRLabel1: TQRLabel;

PageFooterBand1: TQRBand;

DetailBand1: TQRBand;

QRLabel2: TQRLabel;

QRLabel3: TQRLabel;

QRDBText1: TQRDBText;

QRDBText2: TQRDBText;

QRSysData1: TQRSysData;

QRSysData2: TQRSysData;

private

{ Private declarations }

public

{ Public declarations }

end;

var

Form10: TForm10;

implementation

{$R *. dfm}

end.

unit Unit11;

interface

uses

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

Dialogs, unit2, ExtCtrls, QuickRpt, QRCtrls;

type

TForm11 = class(TForm)

QuickRep1: TQuickRep;

TitleBand1: TQRBand;

PageFooterBand1: TQRBand;

DetailBand1: TQRBand;

ColumnHeaderBand1: TQRBand;

QRLabel1: TQRLabel;

QRLabel4: TQRLabel;

QRLabel3: TQRLabel;

QRLabel5: TQRLabel;

QRDBText1: TQRDBText;

QRDBText2: TQRDBText;

QRDBText3: TQRDBText;

QRDBText4: TQRDBText;

QRSysData2: TQRSysData;

QRSysData1: TQRSysData;

private

{ Private declarations }

public

{ Public declarations }

end;

var

Form11: TForm11;

implementation

{$R *. dfm}

end.


Приложение 3. ЛИСТИНГСКРИПТОВБАЗЫДАННЫХ

USE [master]

GO

/ ****** Object: Database [simpaza] Script Date: 04/06/2009 06: 34: 09 ****** /