491 lines
13 KiB
ObjectPascal
491 lines
13 KiB
ObjectPascal
|
|
unit U_TatFlawQuery;
|
|||
|
|
|
|||
|
|
interface
|
|||
|
|
|
|||
|
|
uses
|
|||
|
|
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
|
|||
|
|
Dialogs, StdCtrls, ExtCtrls, ComCtrls, ToolWin, cxStyles, cxCustomData,
|
|||
|
|
cxGraphics, cxFilter, cxData, cxDataStorage, cxEdit, DB, cxDBData, ADODB,
|
|||
|
|
cxGridLevel, cxClasses, cxControls, cxGridCustomView, cxGridCustomTableView,
|
|||
|
|
cxGridTableView, cxGridDBTableView, cxGrid, DBClient, cxCheckBox, cxCalendar,
|
|||
|
|
cxPC, Math, U_BaseList, MovePanel, cxLookAndFeels, cxLookAndFeelPainters,
|
|||
|
|
cxNavigator, dxBarBuiltInMenu, dxSkinsCore, dxSkinsDefaultPainters,
|
|||
|
|
dxDateRanges, System.StrUtils, dxScrollbarAnnotations, dxSkinWXI;
|
|||
|
|
|
|||
|
|
type
|
|||
|
|
TfrmTatFlawQuery = class(TfrmBaseList)
|
|||
|
|
ToolBar1: TToolBar;
|
|||
|
|
TBRafresh: TToolButton;
|
|||
|
|
TBKFMod: TToolButton;
|
|||
|
|
TBExpSum: TToolButton;
|
|||
|
|
TBExpDet: TToolButton;
|
|||
|
|
TBSaveFmt: TToolButton;
|
|||
|
|
TBClose: TToolButton;
|
|||
|
|
Panel1: TPanel;
|
|||
|
|
Label1: TLabel;
|
|||
|
|
weaver_name: TEdit;
|
|||
|
|
Label2: TLabel;
|
|||
|
|
C_Code: TEdit;
|
|||
|
|
IsJYTime: TCheckBox;
|
|||
|
|
BegDate: TDateTimePicker;
|
|||
|
|
Label4: TLabel;
|
|||
|
|
EndDate: TDateTimePicker;
|
|||
|
|
cxPageControl1: TcxPageControl;
|
|||
|
|
TabSum: TcxTabSheet;
|
|||
|
|
cxGridS: TcxGrid;
|
|||
|
|
TvS: TcxGridDBTableView;
|
|||
|
|
TvSweaver_name: TcxGridDBColumn;
|
|||
|
|
TvSSumPoints: TcxGridDBColumn;
|
|||
|
|
cxGridSLevel1: TcxGridLevel;
|
|||
|
|
PanelS: TPanel;
|
|||
|
|
LabelS1: TLabel;
|
|||
|
|
TCBNORS: TComboBox;
|
|||
|
|
BTLPS: TButton;
|
|||
|
|
LBCPAPS: TLabel;
|
|||
|
|
BTNPS: TButton;
|
|||
|
|
TabDet: TcxTabSheet;
|
|||
|
|
cxGridD: TcxGrid;
|
|||
|
|
TvD: TcxGridDBTableView;
|
|||
|
|
TvDSSel: TcxGridDBColumn;
|
|||
|
|
TvDFillTime: TcxGridDBColumn;
|
|||
|
|
TvDC_Code: TcxGridDBColumn;
|
|||
|
|
TvDweaver_name: TcxGridDBColumn;
|
|||
|
|
TvDpoints: TcxGridDBColumn;
|
|||
|
|
TvDCIFName: TcxGridDBColumn;
|
|||
|
|
TvDFiller: TcxGridDBColumn;
|
|||
|
|
Tvcarno: TcxGridDBColumn;
|
|||
|
|
TvDCIID: TcxGridDBColumn;
|
|||
|
|
TvDCIFID: TcxGridDBColumn;
|
|||
|
|
cxGridDLevel1: TcxGridLevel;
|
|||
|
|
PanelD: TPanel;
|
|||
|
|
LabelD1: TLabel;
|
|||
|
|
TCBNORD: TComboBox;
|
|||
|
|
BTLPD: TButton;
|
|||
|
|
LBCPAPD: TLabel;
|
|||
|
|
BNTPD: TButton;
|
|||
|
|
MovePanel2: TMovePanel;
|
|||
|
|
ADOQSum: TADOQuery;
|
|||
|
|
ADOQDetail: TADOQuery;
|
|||
|
|
ADOQueryCmd: TADOQuery;
|
|||
|
|
ADOQueryTemp: TADOQuery;
|
|||
|
|
DS_S: TDataSource;
|
|||
|
|
DS_D: TDataSource;
|
|||
|
|
CDS_Sum: TClientDataSet;
|
|||
|
|
CDS_Detail: TClientDataSet;
|
|||
|
|
procedure FormClose(Sender: TObject; var Action: TCloseAction);
|
|||
|
|
procedure FormCreate(Sender: TObject);
|
|||
|
|
procedure FormShow(Sender: TObject);
|
|||
|
|
procedure TBRafreshClick(Sender: TObject);
|
|||
|
|
procedure TBKFModClick(Sender: TObject);
|
|||
|
|
procedure TBExpSumClick(Sender: TObject);
|
|||
|
|
procedure TBExpDetClick(Sender: TObject);
|
|||
|
|
procedure TBSaveFmtClick(Sender: TObject);
|
|||
|
|
procedure TBCloseClick(Sender: TObject);
|
|||
|
|
procedure weaver_nameKeyPress(Sender: TObject; var Key: Char);
|
|||
|
|
procedure C_CodeKeyPress(Sender: TObject; var Key: Char);
|
|||
|
|
procedure BTLPSClick(Sender: TObject);
|
|||
|
|
procedure BTNPSClick(Sender: TObject);
|
|||
|
|
procedure TCBNORSChange(Sender: TObject);
|
|||
|
|
procedure BTLPDClick(Sender: TObject);
|
|||
|
|
procedure BNTPDClick(Sender: TObject);
|
|||
|
|
procedure TCBNORDChange(Sender: TObject);
|
|||
|
|
procedure TvSCustomDrawIndicatorCell(Sender: TcxGridTableView;
|
|||
|
|
ACanvas: TcxCanvas; AViewInfo: TcxCustomGridIndicatorItemViewInfo;
|
|||
|
|
var ADone: Boolean);
|
|||
|
|
procedure TvDCustomDrawIndicatorCell(Sender: TcxGridTableView;
|
|||
|
|
ACanvas: TcxCanvas; AViewInfo: TcxCustomGridIndicatorItemViewInfo;
|
|||
|
|
var ADone: Boolean);
|
|||
|
|
private
|
|||
|
|
FWorkshop: string;
|
|||
|
|
CurrentPageS, RecordsNumberS, CurrentPageD, RecordsNumberD: Integer;
|
|||
|
|
function BuildCriteria(): string;
|
|||
|
|
procedure InitSum();
|
|||
|
|
procedure InitDetail();
|
|||
|
|
{ Private declarations }
|
|||
|
|
public
|
|||
|
|
{ Public declarations }
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
var
|
|||
|
|
frmTatFlawQuery: TfrmTatFlawQuery;
|
|||
|
|
|
|||
|
|
implementation
|
|||
|
|
|
|||
|
|
uses
|
|||
|
|
U_DataLink, U_RTFun;
|
|||
|
|
|
|||
|
|
{$R *.dfm}
|
|||
|
|
|
|||
|
|
procedure TfrmTatFlawQuery.FormClose(Sender: TObject; var Action: TCloseAction);
|
|||
|
|
begin
|
|||
|
|
inherited;
|
|||
|
|
Action := caFree;
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
procedure TfrmTatFlawQuery.FormCreate(Sender: TObject);
|
|||
|
|
begin
|
|||
|
|
inherited;
|
|||
|
|
FWorkshop := Trim(Self.fParameters3);
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
procedure TfrmTatFlawQuery.FormShow(Sender: TObject);
|
|||
|
|
begin
|
|||
|
|
inherited;
|
|||
|
|
CurrentPageS := 1;
|
|||
|
|
RecordsNumberS := 500;
|
|||
|
|
CurrentPageD := 1;
|
|||
|
|
RecordsNumberD := 500;
|
|||
|
|
ReadCxGrid(Trim(Self.Caption) + 'TvS', TvS, 'ó<><EFBFBD><D7BC><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>');
|
|||
|
|
ReadCxGrid(Trim(Self.Caption) + 'TvD', TvD, 'ó<><EFBFBD><D7BC><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>');
|
|||
|
|
EndDate.DateTime := SGetServerDate(ADOQueryTemp);
|
|||
|
|
BegDate.DateTime := EndDate.DateTime;
|
|||
|
|
InitSum();
|
|||
|
|
InitDetail();
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
function TfrmTatFlawQuery.BuildCriteria(): string;
|
|||
|
|
var
|
|||
|
|
WSql: string;
|
|||
|
|
begin
|
|||
|
|
WSql := SGetFilters(Panel1, 1, 2);
|
|||
|
|
if Trim(WSql) <> '' then
|
|||
|
|
WSql := ' and ' + Trim(WSql);
|
|||
|
|
|
|||
|
|
if Trim(FWorkshop) <> '' then
|
|||
|
|
WSql := WSql + ' and A.Workshop=' + QuotedStr(Trim(FWorkshop));
|
|||
|
|
|
|||
|
|
if IsJYTime.Checked then
|
|||
|
|
begin
|
|||
|
|
WSql := WSql + ' and A.FillTime>' + QuotedStr(FormatDateTime('yyyy-MM-dd', BegDate.DateTime));
|
|||
|
|
WSql := WSql + ' and A.FillTime<=' + QuotedStr(FormatDateTime('yyyy-MM-dd', EndDate.DateTime + 1));
|
|||
|
|
end
|
|||
|
|
else if Trim(WSql) = '' then
|
|||
|
|
WSql := ' and 1=2 ';
|
|||
|
|
|
|||
|
|
Result := WSql;
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
procedure TfrmTatFlawQuery.InitSum();
|
|||
|
|
var
|
|||
|
|
WSql: string;
|
|||
|
|
begin
|
|||
|
|
MovePanel2.Left := (Self.Width - MovePanel2.Width) div 2;
|
|||
|
|
MovePanel2.Visible := True;
|
|||
|
|
MovePanel2.Refresh;
|
|||
|
|
WSql := BuildCriteria();
|
|||
|
|
if Trim(WSql) = 'and 1=2' then
|
|||
|
|
Application.MessageBox('<27><>ѡ<EFBFBD><D1A1><EFBFBD><EFBFBD>ʱ<EFBFBD><CAB1><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>', '<27><>ʾ', 0);
|
|||
|
|
|
|||
|
|
try
|
|||
|
|
CDS_Sum.DisableControls;
|
|||
|
|
with ADOQSum do
|
|||
|
|
begin
|
|||
|
|
Close;
|
|||
|
|
SQL.Clear;
|
|||
|
|
SQL.Add('exec P_Tat_Flaw_Sum_Get_Page ');
|
|||
|
|
SQL.Add('@pageIndex=' + IntToStr(CurrentPageS));
|
|||
|
|
SQL.Add(',@pageSize=' + IntToStr(RecordsNumberS));
|
|||
|
|
SQL.Add(',@criteria=' + QuotedStr(WSql));
|
|||
|
|
Open;
|
|||
|
|
end;
|
|||
|
|
SCreateCDS(ADOQSum, CDS_Sum);
|
|||
|
|
SInitCDSData(ADOQSum, CDS_Sum);
|
|||
|
|
LBCPAPS.Caption := IntToStr(CurrentPageS) + '/' + IntToStr(Ceil(ADOQSum.FieldByName('TotalCount').AsInteger / RecordsNumberS));
|
|||
|
|
finally
|
|||
|
|
CDS_Sum.EnableControls;
|
|||
|
|
MovePanel2.Visible := False;
|
|||
|
|
end;
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
procedure TfrmTatFlawQuery.InitDetail();
|
|||
|
|
var
|
|||
|
|
WSql: string;
|
|||
|
|
begin
|
|||
|
|
MovePanel2.Left := (Self.Width - MovePanel2.Width) div 2;
|
|||
|
|
MovePanel2.Visible := True;
|
|||
|
|
MovePanel2.Refresh;
|
|||
|
|
WSql := BuildCriteria();
|
|||
|
|
if Trim(WSql) = 'and 1=2' then
|
|||
|
|
Application.MessageBox('<27><>ѡ<EFBFBD><D1A1><EFBFBD><EFBFBD>ʱ<EFBFBD><CAB1><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>', '<27><>ʾ', 0);
|
|||
|
|
|
|||
|
|
try
|
|||
|
|
CDS_Detail.DisableControls;
|
|||
|
|
with ADOQDetail do
|
|||
|
|
begin
|
|||
|
|
Close;
|
|||
|
|
SQL.Clear;
|
|||
|
|
SQL.Add('exec P_Tat_Flaw_Get_Page ');
|
|||
|
|
SQL.Add('@pageIndex=' + IntToStr(CurrentPageD));
|
|||
|
|
SQL.Add(',@pageSize=' + IntToStr(RecordsNumberD));
|
|||
|
|
SQL.Add(',@criteria=' + QuotedStr(WSql));
|
|||
|
|
Open;
|
|||
|
|
end;
|
|||
|
|
SCreateCDS(ADOQDetail, CDS_Detail);
|
|||
|
|
SInitCDSData(ADOQDetail, CDS_Detail);
|
|||
|
|
LBCPAPD.Caption := IntToStr(CurrentPageD) + '/' + IntToStr(Ceil(ADOQDetail.FieldByName('TotalCount').AsInteger / RecordsNumberD));
|
|||
|
|
finally
|
|||
|
|
CDS_Detail.EnableControls;
|
|||
|
|
MovePanel2.Visible := False;
|
|||
|
|
end;
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
procedure TfrmTatFlawQuery.TBRafreshClick(Sender: TObject);
|
|||
|
|
begin
|
|||
|
|
CurrentPageS := 1;
|
|||
|
|
CurrentPageD := 1;
|
|||
|
|
InitSum();
|
|||
|
|
InitDetail();
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
procedure TfrmTatFlawQuery.TBKFModClick(Sender: TObject);
|
|||
|
|
var
|
|||
|
|
MVal: string;
|
|||
|
|
MPoints: Double;
|
|||
|
|
MCIFIDS, MCIIDS, FOne, FRest: string;
|
|||
|
|
FP: Integer;
|
|||
|
|
begin
|
|||
|
|
if CDS_Detail.IsEmpty then
|
|||
|
|
Exit;
|
|||
|
|
if not CDS_Detail.Locate('SSel', True, []) then
|
|||
|
|
begin
|
|||
|
|
Application.MessageBox('û<><C3BB>ѡ<EFBFBD><D1A1><EFBFBD><EFBFBD><EFBFBD><EFBFBD>!', '<27><>ʾ', 0);
|
|||
|
|
Exit;
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
MVal := '';
|
|||
|
|
if not InputQuery('<27>۷<EFBFBD><DBB7><EFBFBD><EFBFBD><EFBFBD>', '<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>۷<EFBFBD><DBB7><EFBFBD>:', MVal) then
|
|||
|
|
Exit;
|
|||
|
|
if Trim(MVal) = '' then
|
|||
|
|
Exit;
|
|||
|
|
if not TryStrToFloat(Trim(MVal), MPoints) then
|
|||
|
|
begin
|
|||
|
|
Application.MessageBox('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ȷ<EFBFBD>Ŀ۷<C4BF><DBB7><EFBFBD>!', '<27><>ʾ', 0);
|
|||
|
|
Exit;
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
MCIFIDS := '';
|
|||
|
|
MCIIDS := '';
|
|||
|
|
CDS_Detail.DisableControls;
|
|||
|
|
try
|
|||
|
|
CDS_Detail.First;
|
|||
|
|
while not CDS_Detail.Eof do
|
|||
|
|
begin
|
|||
|
|
if CDS_Detail.FieldByName('SSel').AsBoolean then
|
|||
|
|
begin
|
|||
|
|
if MCIFIDS <> '' then
|
|||
|
|
MCIFIDS := MCIFIDS + ',';
|
|||
|
|
MCIFIDS := MCIFIDS + QuotedStr(Trim(CDS_Detail.FieldByName('CIFID').AsString));
|
|||
|
|
|
|||
|
|
if Pos(',' + QuotedStr(Trim(CDS_Detail.FieldByName('CIID').AsString)) + ',', ',' + MCIIDS + ',') = 0 then
|
|||
|
|
begin
|
|||
|
|
if MCIIDS <> '' then
|
|||
|
|
MCIIDS := MCIIDS + ',';
|
|||
|
|
MCIIDS := MCIIDS + QuotedStr(Trim(CDS_Detail.FieldByName('CIID').AsString));
|
|||
|
|
end;
|
|||
|
|
end;
|
|||
|
|
CDS_Detail.Next;
|
|||
|
|
end;
|
|||
|
|
finally
|
|||
|
|
CDS_Detail.EnableControls;
|
|||
|
|
end;
|
|||
|
|
if MCIFIDS = '' then
|
|||
|
|
Exit;
|
|||
|
|
|
|||
|
|
if Application.MessageBox('ȷ<><C8B7>Ҫ<EFBFBD>Ŀ۷<C4BF><DBB7><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>', '<27><>ʾ', 32 + 4) <> IDYES then
|
|||
|
|
Exit;
|
|||
|
|
|
|||
|
|
try
|
|||
|
|
ADOQueryCmd.Connection.BeginTrans;
|
|||
|
|
with ADOQueryCmd do
|
|||
|
|
begin
|
|||
|
|
Close;
|
|||
|
|
SQL.Clear;
|
|||
|
|
SQL.Add('update Tat_Cloth_Inspect_Flaw set points=' + FloatToStr(MPoints));
|
|||
|
|
SQL.Add(' where CIFID in (' + MCIFIDS + ')');
|
|||
|
|
ExecSQL;
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
//ͬ<><CDAC><EFBFBD><EFBFBD><EFBFBD>õ<EFBFBD><C3B5><EFBFBD><EFBFBD><EFBFBD>(<28><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>༭<EFBFBD><E0BCAD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>һ<EFBFBD><D2BB>)
|
|||
|
|
FRest := MCIIDS;
|
|||
|
|
while FRest <> '' do
|
|||
|
|
begin
|
|||
|
|
FP := Pos(',', FRest);
|
|||
|
|
if FP = 0 then
|
|||
|
|
begin
|
|||
|
|
FOne := FRest;
|
|||
|
|
FRest := '';
|
|||
|
|
end
|
|||
|
|
else
|
|||
|
|
begin
|
|||
|
|
FOne := Copy(FRest, 1, FP - 1);
|
|||
|
|
Delete(FRest, 1, FP);
|
|||
|
|
end;
|
|||
|
|
with ADOQueryCmd do
|
|||
|
|
begin
|
|||
|
|
Close;
|
|||
|
|
SQL.Clear;
|
|||
|
|
SQL.Add('exec P_Tat_Insp_Up @CIID=' + FOne);
|
|||
|
|
SQL.Add(',@InspType=' + QuotedStr('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>'));
|
|||
|
|
ExecSQL;
|
|||
|
|
end;
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
with ADOQueryCmd do
|
|||
|
|
begin
|
|||
|
|
Close;
|
|||
|
|
SQL.Clear;
|
|||
|
|
SQL.Add('insert into SY_SysLog(operor,opertime,Model,acction,opevent,result) values( ');
|
|||
|
|
SQL.Add(' ' + QuotedStr(Trim(DName)));
|
|||
|
|
SQL.Add(',getdate() ');
|
|||
|
|
SQL.Add(',' + QuotedStr(Trim(Self.Caption)));
|
|||
|
|
SQL.Add(',' + QuotedStr(Trim('<27>۷<EFBFBD><DBB7><EFBFBD><EFBFBD><EFBFBD>')));
|
|||
|
|
SQL.Add(',' + QuotedStr(Trim('<27>۷<EFBFBD><DBB7><EFBFBD>:' + MVal + ' ' + MCIFIDS)));
|
|||
|
|
SQL.Add(',' + QuotedStr(Trim('<27>ɹ<EFBFBD>')));
|
|||
|
|
SQL.Add(')');
|
|||
|
|
ExecSQL;
|
|||
|
|
end;
|
|||
|
|
ADOQueryCmd.Connection.CommitTrans;
|
|||
|
|
Application.MessageBox('<27><><EFBFBD><EFBFBD><EFBFBD>ɹ<EFBFBD>!', '<27><>ʾ', 0);
|
|||
|
|
CurrentPageD := 1;
|
|||
|
|
CurrentPageS := 1;
|
|||
|
|
InitDetail();
|
|||
|
|
InitSum();
|
|||
|
|
except
|
|||
|
|
ADOQueryCmd.Connection.RollbackTrans;
|
|||
|
|
Application.MessageBox(PChar(Exception(ExceptObject).Message), '<27><>ʾ<EFBFBD><CABE>Ϣ', 0);
|
|||
|
|
end;
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
procedure TfrmTatFlawQuery.TBExpSumClick(Sender: TObject);
|
|||
|
|
begin
|
|||
|
|
if CDS_Sum.IsEmpty then
|
|||
|
|
Exit;
|
|||
|
|
TcxGridToExcel(Trim(Self.Caption) + '-<2D><><EFBFBD><EFBFBD>', cxGridS);
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
procedure TfrmTatFlawQuery.TBExpDetClick(Sender: TObject);
|
|||
|
|
begin
|
|||
|
|
if CDS_Detail.IsEmpty then
|
|||
|
|
Exit;
|
|||
|
|
TcxGridToExcel(Trim(Self.Caption) + '-<2D><>ϸ', cxGridD);
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
procedure TfrmTatFlawQuery.TBSaveFmtClick(Sender: TObject);
|
|||
|
|
begin
|
|||
|
|
WriteCxGrid(Trim(Self.Caption) + 'TvS', TvS, 'ó<><EFBFBD><D7BC><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>');
|
|||
|
|
WriteCxGrid(Trim(Self.Caption) + 'TvD', TvD, 'ó<><EFBFBD><D7BC><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>');
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
procedure TfrmTatFlawQuery.TBCloseClick(Sender: TObject);
|
|||
|
|
begin
|
|||
|
|
Close;
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
procedure TfrmTatFlawQuery.weaver_nameKeyPress(Sender: TObject; var Key: Char);
|
|||
|
|
begin
|
|||
|
|
if Key = #13 then
|
|||
|
|
begin
|
|||
|
|
CurrentPageS := 1;
|
|||
|
|
CurrentPageD := 1;
|
|||
|
|
InitSum();
|
|||
|
|
InitDetail();
|
|||
|
|
end;
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
procedure TfrmTatFlawQuery.C_CodeKeyPress(Sender: TObject; var Key: Char);
|
|||
|
|
begin
|
|||
|
|
if Key = #13 then
|
|||
|
|
begin
|
|||
|
|
CurrentPageS := 1;
|
|||
|
|
CurrentPageD := 1;
|
|||
|
|
InitSum();
|
|||
|
|
InitDetail();
|
|||
|
|
end;
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
procedure TfrmTatFlawQuery.BTLPSClick(Sender: TObject);
|
|||
|
|
begin
|
|||
|
|
if CurrentPageS > 1 then
|
|||
|
|
CurrentPageS := CurrentPageS - 1;
|
|||
|
|
InitSum();
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
procedure TfrmTatFlawQuery.BTNPSClick(Sender: TObject);
|
|||
|
|
begin
|
|||
|
|
if CurrentPageS < ADOQSum.FieldByName('TotalCount').AsInteger / RecordsNumberS then
|
|||
|
|
CurrentPageS := CurrentPageS + 1;
|
|||
|
|
InitSum();
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
procedure TfrmTatFlawQuery.TCBNORSChange(Sender: TObject);
|
|||
|
|
begin
|
|||
|
|
RecordsNumberS := StrToInt(TCBNORS.Text);
|
|||
|
|
CurrentPageS := 1;
|
|||
|
|
InitSum();
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
procedure TfrmTatFlawQuery.BTLPDClick(Sender: TObject);
|
|||
|
|
begin
|
|||
|
|
if CurrentPageD > 1 then
|
|||
|
|
CurrentPageD := CurrentPageD - 1;
|
|||
|
|
InitDetail();
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
procedure TfrmTatFlawQuery.BNTPDClick(Sender: TObject);
|
|||
|
|
begin
|
|||
|
|
if CurrentPageD < ADOQDetail.FieldByName('TotalCount').AsInteger / RecordsNumberD then
|
|||
|
|
CurrentPageD := CurrentPageD + 1;
|
|||
|
|
InitDetail();
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
procedure TfrmTatFlawQuery.TCBNORDChange(Sender: TObject);
|
|||
|
|
begin
|
|||
|
|
RecordsNumberD := StrToInt(TCBNORD.Text);
|
|||
|
|
CurrentPageD := 1;
|
|||
|
|
InitDetail();
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
procedure TfrmTatFlawQuery.TvSCustomDrawIndicatorCell(Sender: TcxGridTableView;
|
|||
|
|
ACanvas: TcxCanvas; AViewInfo: TcxCustomGridIndicatorItemViewInfo;
|
|||
|
|
var ADone: Boolean);
|
|||
|
|
var
|
|||
|
|
FValue: string;
|
|||
|
|
FBounds: TRect;
|
|||
|
|
begin
|
|||
|
|
FBounds := AViewInfo.Bounds;
|
|||
|
|
if (AViewInfo is TcxGridIndicatorRowItemViewInfo) then
|
|||
|
|
begin
|
|||
|
|
ACanvas.FillRect(FBounds);
|
|||
|
|
ACanvas.DrawComplexFrame(FBounds, clBlack, clBlack, [bBottom, bLeft, bRight], 1);
|
|||
|
|
FValue := IntToStr(TcxGridIndicatorRowItemViewInfo(AViewInfo).GridRecord.Index + 1);
|
|||
|
|
InflateRect(FBounds, -3, -2);
|
|||
|
|
ACanvas.Font.Color := clBlack;
|
|||
|
|
ACanvas.Brush.Style := bsClear;
|
|||
|
|
ACanvas.DrawText(FValue, FBounds, cxAlignCenter or cxAlignTop);
|
|||
|
|
ADone := True;
|
|||
|
|
end;
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
procedure TfrmTatFlawQuery.TvDCustomDrawIndicatorCell(Sender: TcxGridTableView;
|
|||
|
|
ACanvas: TcxCanvas; AViewInfo: TcxCustomGridIndicatorItemViewInfo;
|
|||
|
|
var ADone: Boolean);
|
|||
|
|
var
|
|||
|
|
FValue: string;
|
|||
|
|
FBounds: TRect;
|
|||
|
|
begin
|
|||
|
|
FBounds := AViewInfo.Bounds;
|
|||
|
|
if (AViewInfo is TcxGridIndicatorRowItemViewInfo) then
|
|||
|
|
begin
|
|||
|
|
ACanvas.FillRect(FBounds);
|
|||
|
|
ACanvas.DrawComplexFrame(FBounds, clBlack, clBlack, [bBottom, bLeft, bRight], 1);
|
|||
|
|
FValue := IntToStr(TcxGridIndicatorRowItemViewInfo(AViewInfo).GridRecord.Index + 1);
|
|||
|
|
InflateRect(FBounds, -3, -2);
|
|||
|
|
ACanvas.Font.Color := clBlack;
|
|||
|
|
ACanvas.Brush.Style := bsClear;
|
|||
|
|
ACanvas.DrawText(FValue, FBounds, cxAlignCenter or cxAlignTop);
|
|||
|
|
ADone := True;
|
|||
|
|
end;
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
end.
|