179 lines
4.2 KiB
ObjectPascal
179 lines
4.2 KiB
ObjectPascal
unit U_CKEJK;
|
||
|
||
interface
|
||
|
||
uses
|
||
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
|
||
Dialogs, cxStyles, cxCustomData, cxGraphics, cxFilter, cxData,
|
||
cxDataStorage, cxEdit, DB, cxDBData, cxGridCustomTableView,
|
||
cxGridTableView, cxGridBandedTableView, cxGridDBBandedTableView,
|
||
cxGridLevel, cxClasses, cxControls, cxGridCustomView, cxGridDBTableView,
|
||
cxGrid, StdCtrls, ComCtrls, ExtCtrls, ToolWin, cxGridCustomPopupMenu,
|
||
cxGridPopupMenu, ADODB, DBClient, cxDropDownEdit, MovePanel;
|
||
|
||
type
|
||
TfrmCKEJK = class(TForm)
|
||
ToolBar1: TToolBar;
|
||
TBRafresh: TToolButton;
|
||
TBFind: TToolButton;
|
||
TBExport: TToolButton;
|
||
TBPrint: TToolButton;
|
||
TBClose: TToolButton;
|
||
Panel1: TPanel;
|
||
ADOQueryCmd: TADOQuery;
|
||
ADOQueryMain: TADOQuery;
|
||
ADOQueryTemp: TADOQuery;
|
||
DataSource1: TDataSource;
|
||
cxGridPopupMenu1: TcxGridPopupMenu;
|
||
Label3: TLabel;
|
||
Label4: TLabel;
|
||
C_CodeName: TEdit;
|
||
C_Color: TEdit;
|
||
Label1: TLabel;
|
||
Label2: TLabel;
|
||
BegDate: TDateTimePicker;
|
||
EndDate: TDateTimePicker;
|
||
CDS_Main: TClientDataSet;
|
||
Tv1: TcxGridDBTableView;
|
||
cxGrid2Level1: TcxGridLevel;
|
||
cxGrid2: TcxGrid;
|
||
Label5: TLabel;
|
||
conNO: TEdit;
|
||
Label6: TLabel;
|
||
MJID: TEdit;
|
||
Label8: TLabel;
|
||
KZ: TEdit;
|
||
Label9: TLabel;
|
||
MF: TEdit;
|
||
Label7: TLabel;
|
||
CPType: TComboBox;
|
||
MovePanel2: TMovePanel;
|
||
v1Column1: TcxGridDBColumn;
|
||
v1Column2: TcxGridDBColumn;
|
||
v1Column3: TcxGridDBColumn;
|
||
v1Column4: TcxGridDBColumn;
|
||
v1Column5: TcxGridDBColumn;
|
||
v1Column6: TcxGridDBColumn;
|
||
Label10: TLabel;
|
||
CKFlag: TComboBox;
|
||
procedure FormDestroy(Sender: TObject);
|
||
procedure FormClose(Sender: TObject; var Action: TCloseAction);
|
||
procedure FormCreate(Sender: TObject);
|
||
procedure TBRafreshClick(Sender: TObject);
|
||
procedure ConNoMChange(Sender: TObject);
|
||
procedure TBCloseClick(Sender: TObject);
|
||
procedure FormShow(Sender: TObject);
|
||
procedure TBExportClick(Sender: TObject);
|
||
procedure TBFindClick(Sender: TObject);
|
||
procedure C_CodeNameChange(Sender: TObject);
|
||
private
|
||
procedure InitGrid();
|
||
{ Private declarations }
|
||
public
|
||
{ Public declarations }
|
||
end;
|
||
|
||
var
|
||
frmCKEJK: TfrmCKEJK;
|
||
|
||
implementation
|
||
uses
|
||
U_DataLink,U_Fun;
|
||
|
||
{$R *.dfm}
|
||
|
||
procedure TfrmCKEJK.FormDestroy(Sender: TObject);
|
||
begin
|
||
frmCKEJK:=nil;
|
||
end;
|
||
|
||
procedure TfrmCKEJK.FormClose(Sender: TObject;
|
||
var Action: TCloseAction);
|
||
begin
|
||
Action:=caFree;
|
||
end;
|
||
|
||
procedure TfrmCKEJK.FormCreate(Sender: TObject);
|
||
begin
|
||
//cxGrid1.Align:=alClient;
|
||
BegDate.DateTime:=SGetServerDateTime(ADOQueryTemp);
|
||
enddate.DateTime:=begdate.DateTime;
|
||
// EndDate.DateTime:=SGetServerDateTime(ADOQueryTemp)
|
||
end;
|
||
|
||
procedure TfrmCKEJK.InitGrid();
|
||
begin
|
||
try
|
||
ADOQueryMain.DisableControls;
|
||
with ADOQueryMain do
|
||
begin
|
||
Close;
|
||
sql.Clear;
|
||
Filtered:=False;
|
||
sql.Add(' EXEC P_Qty_EJKDB ');
|
||
sql.Add(' @begdate='''+formatdateTime('yyyy-MM-dd',begdate.DateTime)+''' ');
|
||
sql.Add(',@enddate='''+formatdateTime('yyyy-MM-dd',enddate.DateTime+1)+''' ');
|
||
Open;
|
||
end;
|
||
SCreateCDS20(ADOQueryMain,CDS_Main);
|
||
SInitCDSData20(ADOQueryMain,CDS_Main);
|
||
finally
|
||
ADOQueryMain.EnableControls;
|
||
TBFind.Click;
|
||
end;
|
||
end;
|
||
|
||
procedure TfrmCKEJK.TBRafreshClick(Sender: TObject);
|
||
begin
|
||
//BegDate.SetFocus;
|
||
MovePanel2.Visible:=True;
|
||
MovePanel2.Refresh;
|
||
InitGrid();
|
||
MovePanel2.Visible:=False;
|
||
end;
|
||
|
||
procedure TfrmCKEJK.ConNoMChange(Sender: TObject);
|
||
begin
|
||
if ADOQueryMain.Active then
|
||
begin
|
||
SDofilter(ADOQueryMain,SGetFilters(Panel1,1,2));
|
||
end;
|
||
end;
|
||
|
||
procedure TfrmCKEJK.TBCloseClick(Sender: TObject);
|
||
begin
|
||
WriteCxGrid(self.Caption+tv1.Name,Tv1,'<27><>Ʒ<EFBFBD>ֿ<EFBFBD>');
|
||
Close;
|
||
end;
|
||
|
||
procedure TfrmCKEJK.FormShow(Sender: TObject);
|
||
begin
|
||
|
||
ReadCxGrid(self.Caption+tv1.Name,Tv1,'<27><>Ʒ<EFBFBD>ֿ<EFBFBD>');
|
||
|
||
//InitGrid();
|
||
end;
|
||
|
||
procedure TfrmCKEJK.TBExportClick(Sender: TObject);
|
||
begin
|
||
if ADOQueryMain.IsEmpty then exit;
|
||
TcxGridToExcel('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>б<EFBFBD>',cxGrid2);
|
||
end;
|
||
|
||
procedure TfrmCKEJK.TBFindClick(Sender: TObject);
|
||
begin
|
||
if ADOQueryMain.Active then
|
||
begin
|
||
SDofilter(ADOQueryMain,SGetFilters(Panel1,1,2));
|
||
SCreateCDS20(ADOQueryMain,CDS_Main);
|
||
SInitCDSData20(ADOQueryMain,CDS_Main);
|
||
end;
|
||
end;
|
||
|
||
procedure TfrmCKEJK.C_CodeNameChange(Sender: TObject);
|
||
begin
|
||
TBFind.Click;
|
||
end;
|
||
|
||
end.
|