D7wmguihua/应收应付/U_YFMXlist.pas
DESKTOP-E401PHE\Administrator b4b5840f18 1
2025-01-18 16:22:10 +08:00

271 lines
7.5 KiB
ObjectPascal
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

unit U_YFMXlist;
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, cxDropDownEdit, RM_e_Xls, cxLookAndFeels,
cxLookAndFeelPainters, cxNavigator;
type
TfrmYFMXlist = class(TForm)
ToolBar1: TToolBar;
TBRafresh: TToolButton;
TBClose: TToolButton;
ADOQueryTemp: TADOQuery;
ADOQueryCmd: TADOQuery;
Panel1: TPanel;
ToolButton2: TToolButton;
Label1: TLabel;
P_CodeName: TEdit;
ADOQueryMain: TADOQuery;
ToolButton1: TToolButton;
RM1: TRMGridReport;
RMDB_Main: TRMDBDataSet;
Label3: TLabel;
conNo: TEdit;
cxGrid2: TcxGrid;
Tv2: TcxGridDBTableView;
cxCRTime: TcxGridDBColumn;
cxMoneyYe: TcxGridDBColumn;
cxQty: TcxGridDBColumn;
cxQtyUnit: TcxGridDBColumn;
cxGridLevel1: TcxGridLevel;
Label2: TLabel;
Label6: TLabel;
begdate: TDateTimePicker;
Enddate: TDateTimePicker;
cxGridPopupMenu2: TcxGridPopupMenu;
DS_HZ: TDataSource;
CDS_HZ: TClientDataSet;
v2Price: TcxGridDBColumn;
VMoney: TcxGridDBColumn;
VOrderNo: TcxGridDBColumn;
v2BBMoney: TcxGridDBColumn;
v2MPRTCodeName: TcxGridDBColumn;
Label4: TLabel;
OrdDefNote3: TComboBox;
v2factoryName: TcxGridDBColumn;
v2MRPTspec: TcxGridDBColumn;
v2YFName: TcxGridDBColumn;
Label5: TLabel;
factoryName: TEdit;
ToolButton3: TToolButton;
RMGridReport1: TRMGridReport;
RMDBDataSet1: TRMDBDataSet;
RMXLSExport1: TRMXLSExport;
v2gangNo: TcxGridDBColumn;
v2Column1: TcxGridDBColumn;
v2Column2: TcxGridDBColumn;
v2Column3: TcxGridDBColumn;
v2Column4: TcxGridDBColumn;
v2note: TcxGridDBColumn;
ADOQueryPrint: TADOQuery;
v2DerateMoney: TcxGridDBColumn;
v2T_Price: TcxGridDBColumn;
YFName: TEdit;
Label7: TLabel;
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 P_OrderNo_YSK(Sender: TObject);
procedure ToolButton1Click(Sender: TObject);
procedure conNoChange(Sender: TObject);
procedure P_CodeNameChange(Sender: TObject);
procedure FormCreate(Sender: TObject);
procedure ToolButton3Click(Sender: TObject);
procedure factoryNameKeyPress(Sender: TObject; var Key: Char);
private
{ Private declarations }
procedure InitGrid();
public
{ Public declarations }
RKFlag,FCYID:String;
fType:string;
end;
var
frmYFMXlist: TfrmYFMXlist;
implementation
uses
U_DataLink,U_Fun,U_ZDYHelp, U_ProductOrderNewList;
{$R *.dfm}
procedure TfrmYFMXlist.InitGrid();
begin
try
ADOQueryMain.DisableControls;
with ADOQueryMain do
begin
Close;
Filtered:=False;
SQL.Clear;
sql.Add(' exec P_Qry_Yfk_mx ');
sql.Add(' @begdate='''+FormatDateTime('yyyy-MM-dd',begdate.DateTime)+''' ');
sql.Add(',@Enddate='''+FormatDateTime('yyyy-MM-dd',Enddate.DateTime+1)+''' ');
sql.Add(',@Type='''+Trim(fType)+''' ');
sql.Add(',@factoryName='''+trim(factoryName.Text)+''' ');
sql.Add(',@P_CodeName='''+trim(P_CodeName.Text)+''' ');
Open;
end;
SCreateCDS20(ADOQueryMain,CDS_HZ);
SInitCDSData20(ADOQueryMain,CDS_HZ);
finally
ADOQueryMain.EnableControls;
ToolButton2.Click;
end;
end;
procedure TfrmYFMXlist.FormDestroy(Sender: TObject);
begin
frmYFMXlist:=nil;
end;
procedure TfrmYFMXlist.FormClose(Sender: TObject; var Action: TCloseAction);
begin
Action:=caFree;
end;
procedure TfrmYFMXlist.TBCloseClick(Sender: TObject);
begin
WriteCxGrid(self.Caption,Tv2,'<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>');
Close;
end;
procedure TfrmYFMXlist.FormShow(Sender: TObject);
begin
ReadCxGrid(self.Caption,Tv2,'<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>');
if fType='1' then
begin
VOrderNo.Caption:='<27><><EFBFBD><EFBFBD><E2B5A5>';
Label3.Caption:='<27><><EFBFBD><EFBFBD><E2B5A5>';
end;
Enddate.DateTime:=SGetServerDate(ADOQueryTemp);
begdate.DateTime:=Enddate.DateTime;
InitGrid();
end;
procedure TfrmYFMXlist.TBRafreshClick(Sender: TObject);
begin
begdate.SetFocus;
{ IF trim(factoryName.Text)='' then
begin
application.MessageBox('<27><>Ӧ<EFBFBD>̲<EFBFBD><CCB2><EFBFBD>Ϊ<EFBFBD>գ<EFBFBD>','<27><>ʾ<EFBFBD><CABE>Ϣ',0);
exit;
end; }
InitGrid();
end;
procedure TfrmYFMXlist.ToolButton2Click(Sender: TObject);
begin
if ADOQueryMain.Active then
begin
SDofilter(ADOQueryMain,SGetFilters(Panel1,1,2));
SCreateCDS20(ADOQueryMain,CDS_HZ);
SInitCDSData20(ADOQueryMain,CDS_HZ);
end;
end;
procedure TfrmYFMXlist.P_OrderNo_YSK(Sender: TObject);
begin
ToolButton2.Click;
end;
procedure TfrmYFMXlist.ToolButton1Click(Sender: TObject);
begin
if ADOQueryMain.IsEmpty then Exit;
SelExportData(Tv2,ADOQueryMain,self.Caption);
end;
procedure TfrmYFMXlist.conNoChange(Sender: TObject);
begin
ToolButton2.Click;
end;
procedure TfrmYFMXlist.P_CodeNameChange(Sender: TObject);
begin
ToolButton2.Click;
end;
procedure TfrmYFMXlist.FormCreate(Sender: TObject);
begin
cxGrid2.Align:=AlClient;
end;
procedure TfrmYFMXlist.ToolButton3Click(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;
sql.Add(' exec P_Qry_Yfk_mx_dz ');
sql.Add(' @begdate='''+Trim(FormatDateTime('yyyy-MM-dd',begdate.DateTime))+''' ');
sql.Add(',@enddate='''+Trim(FormatDateTime('yyyy-MM-dd',Enddate.DateTime+1))+''' ');
sql.Add(',@Type='''+Trim(fType)+''' ');
sql.Add(',@factoryName='''+Trim(CDS_HZ.fieldbyname('factoryName').AsString)+''' ');
Open;
end;
try
filepath:=ExtractFilePath(Application.ExeName) + 'report\Ӧ<><D3A6><EFBFBD><EFBFBD><EFBFBD><EFBFBD><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['dtxz'] :=FormatDateTime('yyyy-mm-dd',date());
// RmVariables['begDate'] :=FormatDateTime('yyyy-mm-dd',begDate.Date);
// RmVariables['enddate'] :=FormatDateTime('yyyy-mm-dd',enddate.Date);
RMVariables['zdr'] :=trim(DName);
RmVariables['begDate'] :=FormatDateTime('yymmdd',begDate.Date)+'-'+FormatDateTime('yymmdd',enddate.Date);
ADOQueryPrint.First;
RmVariables['QCNum'] :=ADOQueryPrint.fieldbyname('MoneyYe').AsFloat - ADOQueryPrint.fieldbyname('Money').AsFloat + ADOQueryPrint.fieldbyname('BBMoney').AsFloat + ADOQueryPrint.fieldbyname('T_money').AsFloat + ADOQueryPrint.fieldbyname('DerateMoney').AsFloat;
ADOQueryPrint.Last;
RmVariables['endNum'] :=ADOQueryPrint.fieldbyname('MoneyYe').AsString;
RMGridReport1.LoadFromFile(filepath);
// RMGridReport1.PrintReport;
RMGridReport1.ShowReport;
finally
end;
end;
procedure TfrmYFMXlist.factoryNameKeyPress(Sender: TObject; var Key: Char);
begin
IF key =#13 then
begin
TBRafresh.Click;
end;
end;
end.