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

322 lines
9.3 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_YSMXlist;
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, dxSkinsCore, dxSkinBlack, dxSkinBlue,
dxSkinBlueprint, dxSkinCaramel, dxSkinCoffee, dxSkinDarkRoom,
dxSkinDarkSide, dxSkinDevExpressDarkStyle, dxSkinDevExpressStyle,
dxSkinFoggy, dxSkinGlassOceans, dxSkinHighContrast, dxSkiniMaginary,
dxSkinLilian, dxSkinLiquidSky, dxSkinLondonLiquidSky, dxSkinMcSkin,
dxSkinMetropolis, dxSkinMetropolisDark, dxSkinMoneyTwins,
dxSkinOffice2007Black, dxSkinOffice2007Blue, dxSkinOffice2007Green,
dxSkinOffice2007Pink, dxSkinOffice2007Silver, dxSkinOffice2010Black,
dxSkinOffice2010Blue, dxSkinOffice2010Silver, dxSkinOffice2013DarkGray,
dxSkinOffice2013LightGray, dxSkinOffice2013White, dxSkinPumpkin,
dxSkinSeven, dxSkinSevenClassic, dxSkinSharp, dxSkinSharpPlus,
dxSkinSilver, dxSkinSpringTime, dxSkinStardust, dxSkinSummer2008,
dxSkinTheAsphaltWorld, dxSkinsDefaultPainters, dxSkinValentine,
dxSkinVS2010, dxSkinWhiteprint, dxSkinXmas2008Blue, dxSkinscxPCPainter,
cxNavigator;
type
TfrmYSMXlist = class(TForm)
ToolBar1: TToolBar;
TBRafresh: TToolButton;
TBClose: TToolButton;
ADOQueryTemp: TADOQuery;
ADOQueryCmd: TADOQuery;
Panel1: TPanel;
ToolButton2: TToolButton;
Label1: TLabel;
MPRTCodeName: TEdit;
ADOQueryMain: TADOQuery;
ToolButton1: TToolButton;
Label3: TLabel;
OrderNo: 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;
v2Column1: TcxGridDBColumn;
v2ps: TcxGridDBColumn;
ToolButton3: TToolButton;
RMGridReport1: TRMGridReport;
RMDBDataSet1: TRMDBDataSet;
v2note: TcxGridDBColumn;
RMXLSExport1: TRMXLSExport;
v2DerateMoney: TcxGridDBColumn;
ADOQueryPrint: TADOQuery;
v2Column2: TcxGridDBColumn;
CheckBox1: TCheckBox;
v2Column3: TcxGridDBColumn;
YFName: TEdit;
Label7: TLabel;
Label8: TLabel;
ywy: TEdit;
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 OrderNoChange(Sender: TObject);
procedure MPRTCodeNameChange(Sender: TObject);
procedure FormCreate(Sender: TObject);
procedure ToolButton3Click(Sender: TObject);
procedure CheckBox1Click(Sender: TObject);
procedure factoryNameKeyPress(Sender: TObject; var Key: Char);
private
{ Private declarations }
procedure InitGrid();
public
{ Public declarations }
RKFlag,FCYID:String;
fsyrName,fstr2,fDParameters1,fDParameters3:string;
end;
var
frmYSMXlist: TfrmYSMXlist;
implementation
uses
U_DataLink,U_Fun,U_ZDYHelp, U_ProductOrderNewList;
{$R *.dfm}
procedure TfrmYSMXlist.InitGrid();
begin
try
ADOQueryMain.DisableControls;
with ADOQueryMain do
begin
Close;
SQL.Clear;
Filtered:=False;
sql.Add(' exec P_Qry_Ysk_mx :begdate,:enddate,:Type,:factoryName,:fstr2');
Parameters.ParamByName('begdate').Value:=Trim(FormatDateTime('yyyy-MM-dd',begdate.DateTime));
Parameters.ParamByName('Enddate').Value:=Trim(FormatDateTime('yyyy-MM-dd',Enddate.DateTime+1));
Parameters.ParamByName('Type').Value:=Trim(fsyrName);
Parameters.ParamByName('factoryName').Value:=Trim(factoryName.Text);
Parameters.ParamByName('fstr2').Value:=Trim(fstr2);
Open;
end;
SCreateCDS20(ADOQueryMain,CDS_HZ);
SInitCDSData20(ADOQueryMain,CDS_HZ);
finally
ADOQueryMain.EnableControls;
ToolButton2.Click;
end;
end;
procedure TfrmYSMXlist.FormDestroy(Sender: TObject);
begin
frmYSMXlist:=nil;
end;
procedure TfrmYSMXlist.FormClose(Sender: TObject; var Action: TCloseAction);
begin
Action:=caFree;
end;
procedure TfrmYSMXlist.TBCloseClick(Sender: TObject);
begin
WriteCxGrid(self.Caption,Tv2,'<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>');
Close;
end;
procedure TfrmYSMXlist.FormShow(Sender: TObject);
begin
ReadCxGrid(self.Caption,Tv2,'<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>');
Enddate.DateTime:=SGetServerDate(ADOQueryTemp);
begdate.DateTime:=Enddate.DateTime;
IF trim(fDParameters3)<>'' then
begin
factoryName.Text:=trim(fDParameters3);
factoryName.Enabled:=false;
end;
IF trim(fDParameters1)=<><D2B5>Ա<EFBFBD><D4B1>ѯ'then
begin
ywy.Text:=trim(DName);
ywy.Enabled:=false;
end;
InitGrid();
{ if fType='1' then
begin
VOrderNo.Caption:='<27><><EFBFBD>۵<EFBFBD><DBB5><EFBFBD>';
Label3.Caption:='<27><><EFBFBD>۵<EFBFBD><DBB5><EFBFBD>';
end; }
end;
procedure TfrmYSMXlist.TBRafreshClick(Sender: TObject);
begin
begdate.SetFocus;
{ IF trim(factoryName.Text)='' then
begin
application.MessageBox('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ͻ<EFBFBD><CDBB><EFBFBD>Ϣ<EFBFBD><CFA2>','<27><>ʾ<EFBFBD><CABE>Ϣ',MB_ICONERROR);
exit;
end; }
InitGrid();
end;
procedure TfrmYSMXlist.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 TfrmYSMXlist.P_OrderNo_YSK(Sender: TObject);
begin
ToolButton2.Click;
end;
procedure TfrmYSMXlist.ToolButton1Click(Sender: TObject);
begin
if ADOQueryMain.IsEmpty then Exit;
SelExportData(Tv2,ADOQueryMain,self.Caption);
end;
procedure TfrmYSMXlist.OrderNoChange(Sender: TObject);
begin
if Length(Trim(OrderNo.Text))<3 then Exit;
ToolButton2.Click;
end;
procedure TfrmYSMXlist.MPRTCodeNameChange(Sender: TObject);
begin
ToolButton2.Click;
end;
procedure TfrmYSMXlist.FormCreate(Sender: TObject);
begin
cxGrid2.Align:=AlClient;
end;
procedure TfrmYSMXlist.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_Ysk_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(fsyrName)+''' ');
sql.Add(',@factoryName='''+Trim(CDS_HZ.fieldbyname('factoryName').AsString)+''' ');
sql.Add(',@fstr2='''+Trim(fstr2)+''' ');
Open;
end;
try
IF trim(ADOQueryPrint.FieldByName('syrName').AsString)='<27><><EFBFBD>˷<EFBFBD>֯' then
filepath:=ExtractFilePath(Application.ExeName) + 'report\Ӧ<>տ<EFBFBD><D5BF><EFBFBD><EFBFBD>˵<EFBFBD>2.rmf'
else
IF trim(ADOQueryPrint.FieldByName('syrName').AsString)='һ<>׷<EFBFBD>֯' then
filepath:=ExtractFilePath(Application.ExeName) + 'report\Ӧ<>տ<EFBFBD><D5BF><EFBFBD><EFBFBD>˵<EFBFBD>1.rmf'
else
filepath:=ExtractFilePath(Application.ExeName) + 'report\Ӧ<>տ<EFBFBD><D5BF><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('DerateMoney').AsFloat ;
ADOQueryPrint.Last;
RmVariables['endNum'] :=ADOQueryPrint.fieldbyname('MoneyYe').AsString;
RMGridReport1.LoadFromFile(filepath);
// RMGridReport1.PrintReport;
RMGridReport1.ShowReport;
finally
end;
end;
procedure TfrmYSMXlist.CheckBox1Click(Sender: TObject);
begin
IF CheckBox1.Checked then
begin
factoryName.Tag:=1;
end
else
begin
factoryName.Tag:=2;
end;
ToolButton2.Click;
end;
procedure TfrmYSMXlist.factoryNameKeyPress(Sender: TObject; var Key: Char);
begin
IF key =#13 then
begin
TBRafresh.Click;
end;
end;
end.