211 lines
5.4 KiB
ObjectPascal
211 lines
5.4 KiB
ObjectPascal
unit U_YFZDList_MX;
|
||
|
||
interface
|
||
|
||
uses
|
||
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
|
||
Dialogs, cxGraphics, cxCustomData, cxStyles, cxTL, cxMaskEdit, DB, ADODB,
|
||
cxInplaceContainer, cxDBTL, cxControls, cxTLData, ComCtrls, ToolWin,
|
||
StdCtrls, cxFilter, cxData, cxDataStorage, cxEdit, cxDBData, DBClient,
|
||
cxGridCustomTableView, cxGridTableView, cxGridDBTableView, ExtCtrls,
|
||
cxSplitter, cxGridLevel, cxClasses, cxGridCustomView, cxGrid,
|
||
cxGridCustomPopupMenu, cxGridPopupMenu, RM_Dataset, RM_System, RM_Common,
|
||
RM_Class, RM_GridReport, IdBaseComponent, IdComponent, IdTCPConnection,
|
||
IdTCPClient, IdFTP,ShellAPI,IniFiles, cxCheckBox, cxCalendar,
|
||
cxButtonEdit, cxTextEdit;
|
||
|
||
type
|
||
TfrmYFZDList_MX = class(TForm)
|
||
ToolBar1: TToolBar;
|
||
TBRafresh: TToolButton;
|
||
TBClose: TToolButton;
|
||
ADOQueryTemp: TADOQuery;
|
||
ADOQueryCmd: TADOQuery;
|
||
Panel1: TPanel;
|
||
ToolButton2: TToolButton;
|
||
ADOQueryMain: TADOQuery;
|
||
ToolButton1: TToolButton;
|
||
RM1: TRMGridReport;
|
||
RMDB_Main: TRMDBDataSet;
|
||
Label3: TLabel;
|
||
FactoryName: TEdit;
|
||
cxGrid2: TcxGrid;
|
||
Tv2: TcxGridDBTableView;
|
||
cxGridLevel1: TcxGridLevel;
|
||
Label2: TLabel;
|
||
Label6: TLabel;
|
||
begdate: TDateTimePicker;
|
||
Enddate: TDateTimePicker;
|
||
cxGridPopupMenu2: TcxGridPopupMenu;
|
||
DS_HZ: TDataSource;
|
||
CDS_HZ: TClientDataSet;
|
||
Label1: TLabel;
|
||
ComTaiTou: TEdit;
|
||
v2Column1: TcxGridDBColumn;
|
||
v2Column2: TcxGridDBColumn;
|
||
v2Column5: TcxGridDBColumn;
|
||
v2Column6: TcxGridDBColumn;
|
||
v2Column7: TcxGridDBColumn;
|
||
v2Column8: TcxGridDBColumn;
|
||
v2Column9: TcxGridDBColumn;
|
||
v2Column10: TcxGridDBColumn;
|
||
v2Column4: TcxGridDBColumn;
|
||
v2ps: TcxGridDBColumn;
|
||
procedure FormDestroy(Sender: TObject);
|
||
procedure FormClose(Sender: TObject; var Action: TCloseAction);
|
||
procedure TBCloseClick(Sender: TObject);
|
||
procedure FormShow(Sender: TObject);
|
||
procedure TBRafreshClick(Sender: TObject);
|
||
procedure ToolButton2Click(Sender: TObject);
|
||
procedure FactoryNameChange(Sender: TObject);
|
||
procedure ToolButton1Click(Sender: TObject);
|
||
procedure FormCreate(Sender: TObject);
|
||
private
|
||
{ Private declarations }
|
||
procedure InitGrid();
|
||
public
|
||
{ Public declarations }
|
||
RKFlag,FCYID:String;
|
||
|
||
end;
|
||
|
||
var
|
||
frmYFZDList_MX: TfrmYFZDList_MX;
|
||
|
||
implementation
|
||
uses
|
||
U_DataLink,U_Fun,U_ZDYHelp;
|
||
|
||
{$R *.dfm}
|
||
|
||
|
||
|
||
procedure TfrmYFZDList_MX.InitGrid();
|
||
begin
|
||
try
|
||
ADOQueryMain.DisableControls;
|
||
with ADOQueryMain do
|
||
begin
|
||
Filtered:=False;
|
||
Close;
|
||
SQL.Clear;
|
||
sql.Add('exec P_Get_zk_MX ');
|
||
sql.Add('@begdate='''+Trim(FormatDateTime('yyyy-MM-dd',begdate.DateTime))+''' ');
|
||
sql.Add(',@enddate='''+Trim(FormatDateTime('yyyy-MM-dd',enddate.DateTime+1))+''' ');
|
||
sql.Add(',@FactoryName='+quotedstr(trim(FactoryName.Text)));
|
||
sql.Add(',@sfFlag='+quotedstr(trim('0')));
|
||
sql.Add(',@isgd='+quotedstr(trim('0')));
|
||
Open;
|
||
end;
|
||
SCreateCDS20(ADOQueryMain,CDS_HZ);
|
||
SInitCDSData20(ADOQueryMain,CDS_HZ);
|
||
finally
|
||
ADOQueryMain.EnableControls;
|
||
end;
|
||
end;
|
||
|
||
|
||
procedure TfrmYFZDList_MX.FormDestroy(Sender: TObject);
|
||
begin
|
||
frmYFZDList_MX:=nil;
|
||
end;
|
||
|
||
procedure TfrmYFZDList_MX.FormClose(Sender: TObject; var Action: TCloseAction);
|
||
begin
|
||
Action:=caFree;
|
||
end;
|
||
|
||
procedure TfrmYFZDList_MX.TBCloseClick(Sender: TObject);
|
||
begin
|
||
WriteCxGrid(self.Caption,Tv2,'<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>');
|
||
Close;
|
||
end;
|
||
procedure TfrmYFZDList_MX.FormShow(Sender: TObject);
|
||
begin
|
||
ReadCxGrid(self.Caption,Tv2,'<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>');
|
||
Enddate.DateTime:=SGetServerDate(ADOQueryTemp);
|
||
begdate.DateTime:=Enddate.DateTime-7;
|
||
{ if Trim(DParameters5)='<27><>Ʊ' then
|
||
begin
|
||
v2BQKP.Hidden:=False;
|
||
v2BQKP.Visible:=True;
|
||
v2WKP.Hidden:=False;
|
||
v2WKP.Visible:=True;
|
||
end else
|
||
begin
|
||
v2BQKP.Hidden:=True;
|
||
v2BQKP.Visible:=False;
|
||
v2WKP.Hidden:=True;
|
||
v2WKP.Visible:=False;
|
||
end;
|
||
if Trim(DParameters9)='֧<><D6A7>̨ͷ' then
|
||
begin
|
||
v2GSTT.Hidden:=False;
|
||
v2GSTT.Visible:=True;
|
||
Label1.Visible:=True;
|
||
ComTaiTou.Visible:=True;
|
||
end else
|
||
begin
|
||
v2GSTT.Hidden:=True;
|
||
v2GSTT.Visible:=False;
|
||
Label1.Visible:=False;
|
||
ComTaiTou.Visible:=False;
|
||
end;
|
||
}
|
||
|
||
InitGrid();
|
||
end;
|
||
|
||
procedure TfrmYFZDList_MX.TBRafreshClick(Sender: TObject);
|
||
begin
|
||
InitGrid();
|
||
end;
|
||
|
||
procedure TfrmYFZDList_MX.ToolButton2Click(Sender: TObject);
|
||
var
|
||
fsj:string;
|
||
begin
|
||
if ADOQueryMain.Active=False then Exit;
|
||
if Trim(SGetFilters(Panel1,1,2))='' then
|
||
begin
|
||
if Trim(FactoryName.Text)<>'' then
|
||
begin
|
||
fsj:=' FactoryName like '''+'%'+Trim(FactoryName.Text)+'%'+''''
|
||
+' or KHZJM like '''+'%'+Trim(FactoryName.Text)+'%'+'''';
|
||
end;
|
||
|
||
end else
|
||
begin
|
||
if Trim(FactoryName.Text)<>'' then
|
||
begin
|
||
fsj:=SGetFilters(Panel1,1,2)+' and (FactoryName like '''+'%'+Trim(FactoryName.Text)+'%'+''''
|
||
+' or KHZJM like '''+'%'+Trim(FactoryName.Text)+'%'+''')';
|
||
end;
|
||
end;
|
||
fsj:='';
|
||
if Trim(FactoryName.Text)<>'' then
|
||
fsj:=' FactoryName like '''+'%'+Trim(FactoryName.Text)+'%'+'''';
|
||
SDofilter(ADOQueryMain,fsj);
|
||
SCreateCDS20(ADOQueryMain,CDS_HZ);
|
||
SInitCDSData20(ADOQueryMain,CDS_HZ);
|
||
end;
|
||
|
||
procedure TfrmYFZDList_MX.FactoryNameChange(Sender: TObject);
|
||
begin
|
||
ToolButton2.Click;
|
||
end;
|
||
|
||
procedure TfrmYFZDList_MX.ToolButton1Click(Sender: TObject);
|
||
begin
|
||
if ADOQueryMain.IsEmpty then Exit;
|
||
TcxGridToExcel(self.Caption,cxgrid2);
|
||
// SelExportData(Tv2,ADOQueryMain,'Ӧ<><D3A6><EFBFBD><EFBFBD><EEB8B6>ͳ<EFBFBD><CDB3><EFBFBD>б<EFBFBD>');
|
||
end;
|
||
|
||
procedure TfrmYFZDList_MX.FormCreate(Sender: TObject);
|
||
begin
|
||
cxGrid2.Align:=AlClient;
|
||
end;
|
||
|
||
end.
|