241 lines
6.2 KiB
ObjectPascal
241 lines
6.2 KiB
ObjectPascal
![]() |
unit U_CWKHDZList;
|
|||
|
|
|||
|
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, cxLookAndFeels, cxLookAndFeelPainters, cxNavigator,
|
|||
|
dxBarBuiltInMenu, cxPC, dxSkinsCore, dxSkinsDefaultPainters, dxDateRanges,
|
|||
|
U_BaseList;
|
|||
|
|
|||
|
type
|
|||
|
TfrmCWKHDZList = class(TfrmBaseList)
|
|||
|
ToolBar1: TToolBar;
|
|||
|
TBRafresh: TToolButton;
|
|||
|
TBClose: TToolButton;
|
|||
|
ADOQueryTemp: TADOQuery;
|
|||
|
ADOQueryCmd: TADOQuery;
|
|||
|
Panel1: TPanel;
|
|||
|
ToolButton2: TToolButton;
|
|||
|
ADOQueryMain: TADOQuery;
|
|||
|
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;
|
|||
|
v2Column5: TcxGridDBColumn;
|
|||
|
v2Column6: TcxGridDBColumn;
|
|||
|
v2Column1: TcxGridDBColumn;
|
|||
|
v2Column2: TcxGridDBColumn;
|
|||
|
v2Column3: TcxGridDBColumn;
|
|||
|
Label1: TLabel;
|
|||
|
ComTaiTou: TEdit;
|
|||
|
ToolButton3: TToolButton;
|
|||
|
ToolButton4: TToolButton;
|
|||
|
ADOQueryPrint: TADOQuery;
|
|||
|
cxTabControl1: TcxTabControl;
|
|||
|
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 ToolButton3Click(Sender: TObject);
|
|||
|
procedure ToolButton4Click(Sender: TObject);
|
|||
|
procedure cxTabControl1Change(Sender: TObject);
|
|||
|
private
|
|||
|
{ Private declarations }
|
|||
|
procedure InitGrid();
|
|||
|
public
|
|||
|
fmanage, FZKType: string;
|
|||
|
{ Public declarations }
|
|||
|
RKFlag, FCYID: string;
|
|||
|
end;
|
|||
|
|
|||
|
implementation
|
|||
|
|
|||
|
uses
|
|||
|
U_DataLink, U_RtFun, U_ZDYHelp, U_CWKHDZMXList;
|
|||
|
|
|||
|
|
|||
|
{$R *.dfm}
|
|||
|
|
|||
|
procedure TfrmCWKHDZList.InitGrid();
|
|||
|
begin
|
|||
|
try
|
|||
|
ADOQueryMain.DisableControls;
|
|||
|
with ADOQueryMain do
|
|||
|
begin
|
|||
|
Filtered := False;
|
|||
|
Close;
|
|||
|
SQL.Clear;
|
|||
|
sql.Add(' exec P_CW_YSSKHZ ');
|
|||
|
sql.Add(' @begdate=' + QuotedStr(Trim(FormatDateTime('yyyy-MM-dd', begdate.DateTime))));
|
|||
|
sql.Add(' ,@Enddate=' + QuotedStr(Trim(FormatDateTime('yyyy-MM-dd', Enddate.DateTime + 1))));
|
|||
|
case cxTabControl1.TabIndex of
|
|||
|
0:
|
|||
|
begin
|
|||
|
sql.Add(' ,@BZType=''$'' ');
|
|||
|
end;
|
|||
|
1:
|
|||
|
begin
|
|||
|
sql.Add(' ,@BZType=''<27><>'' ');
|
|||
|
end;
|
|||
|
2:
|
|||
|
begin
|
|||
|
sql.Add(' ,@BZType=''<27>'' ');
|
|||
|
end;
|
|||
|
end;
|
|||
|
|
|||
|
Open;
|
|||
|
end;
|
|||
|
SCreateCDS(ADOQueryMain, CDS_HZ);
|
|||
|
SInitCDSData(ADOQueryMain, CDS_HZ);
|
|||
|
finally
|
|||
|
ADOQueryMain.EnableControls;
|
|||
|
end;
|
|||
|
ToolButton2.Click;
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmCWKHDZList.FormClose(Sender: TObject; var Action: TCloseAction);
|
|||
|
begin
|
|||
|
inherited;
|
|||
|
Action := caFree;
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmCWKHDZList.TBCloseClick(Sender: TObject);
|
|||
|
begin
|
|||
|
WriteCxGrid(trim(self.Caption), Tv2, '<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>');
|
|||
|
Close;
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmCWKHDZList.FormShow(Sender: TObject);
|
|||
|
begin
|
|||
|
inherited;
|
|||
|
ReadCxGrid(trim(self.Caption), Tv2, '<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>');
|
|||
|
Enddate.DateTime := SGetServerDate(ADOQueryTemp);
|
|||
|
begdate.DateTime := Enddate.DateTime;
|
|||
|
InitGrid();
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmCWKHDZList.TBRafreshClick(Sender: TObject);
|
|||
|
begin
|
|||
|
InitGrid();
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmCWKHDZList.ToolButton2Click(Sender: TObject);
|
|||
|
var
|
|||
|
fsj: string;
|
|||
|
begin
|
|||
|
if ADOQueryMain.Active = False then
|
|||
|
Exit;
|
|||
|
|
|||
|
SDofilter(ADOQueryMain, Trim(SGetFilters(Panel1, 1, 2)));
|
|||
|
SCreateCDS(ADOQueryMain, CDS_HZ);
|
|||
|
SInitCDSData(ADOQueryMain, CDS_HZ);
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmCWKHDZList.FactoryNameChange(Sender: TObject);
|
|||
|
begin
|
|||
|
ToolButton2.Click;
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmCWKHDZList.ToolButton3Click(Sender: TObject);
|
|||
|
begin
|
|||
|
if CDS_HZ.IsEmpty then
|
|||
|
exit;
|
|||
|
frmCWKHDZMXList := TfrmCWKHDZMXList.Create(self);
|
|||
|
with frmCWKHDZMXList do
|
|||
|
begin
|
|||
|
begdate.DateTime := self.begdate.DateTime;
|
|||
|
enddate.DateTime := self.Enddate.DateTime;
|
|||
|
factoryName.Text := self.CDS_HZ.fieldbyname('factoryName').AsString;
|
|||
|
// factoryName.TxtCode := self.CDS_HZ.fieldbyname('factoryNo').AsString;
|
|||
|
FZKType := Self.FZKType;
|
|||
|
case cxTabControl1.TabIndex of
|
|||
|
0:
|
|||
|
begin
|
|||
|
FBZType := '$';
|
|||
|
end;
|
|||
|
1:
|
|||
|
begin
|
|||
|
FBZType := '<27><>';
|
|||
|
end;
|
|||
|
2:
|
|||
|
begin
|
|||
|
FBZType := '<27>';
|
|||
|
end;
|
|||
|
end;
|
|||
|
show;
|
|||
|
end;
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmCWKHDZList.ToolButton4Click(Sender: TObject);
|
|||
|
var
|
|||
|
filepath: string;
|
|||
|
mBegdate, mEnddate: string;
|
|||
|
begin
|
|||
|
mBegdate := FormatDateTime('yyyy-MM-dd', begdate.Date);
|
|||
|
mEnddate := FormatDateTime('yyyy-MM-dd', enddate.Date);
|
|||
|
if CDS_HZ.IsEmpty then
|
|||
|
exit;
|
|||
|
|
|||
|
with ADOQueryPrint do
|
|||
|
begin
|
|||
|
Close;
|
|||
|
SQL.Clear;
|
|||
|
with ADOQueryPrint do
|
|||
|
begin
|
|||
|
Close;
|
|||
|
SQL.Clear;
|
|||
|
Filtered := False;
|
|||
|
sql.Add(' exec P_YSSK_List @begdate=' + quotedstr(Trim(FormatDateTime('yyyy-MM-dd', begdate.DateTime))) + ',@Enddate=' + quotedstr(Trim(FormatDateTime('yyyy-MM-dd', Enddate.DateTime + 1))) + ',@flag=''<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>''');
|
|||
|
Open;
|
|||
|
end;
|
|||
|
Open;
|
|||
|
end;
|
|||
|
|
|||
|
try
|
|||
|
filepath := ExtractFilePath(Application.ExeName) + 'report\Ӧ<><D3A6><EFBFBD>˿<EFBFBD>.rmf';
|
|||
|
if not FileExists(Pchar(filepath)) then
|
|||
|
begin
|
|||
|
application.MessageBox(pchar('<27>ļ<EFBFBD>[' + filepath + ']<5D><><EFBFBD><EFBFBD><EFBFBD>ڣ<EFBFBD>'), '<27><>ʾ<EFBFBD><CABE>Ϣ', MB_IConError);
|
|||
|
exit;
|
|||
|
end;
|
|||
|
|
|||
|
RmVariables['begDate'] := FormatDateTime('yyyy-mm-dd', begDate.Date);
|
|||
|
RmVariables['enddate'] := FormatDateTime('yyyy-mm-dd', enddate.Date);
|
|||
|
RMVariables['ZDR'] := trim(DName);
|
|||
|
RM1.LoadFromFile(filepath);
|
|||
|
RM1.ShowReport;
|
|||
|
finally
|
|||
|
|
|||
|
end;
|
|||
|
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmCWKHDZList.cxTabControl1Change(Sender: TObject);
|
|||
|
begin
|
|||
|
InitGrid();
|
|||
|
end;
|
|||
|
|
|||
|
end.
|
|||
|
|