272 lines
6.8 KiB
ObjectPascal
272 lines
6.8 KiB
ObjectPascal
![]() |
unit U_GYSFPSelList;
|
|||
|
|
|||
|
interface
|
|||
|
|
|||
|
uses
|
|||
|
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
|
|||
|
Dialogs, StdCtrls, ExtCtrls, ComCtrls, ToolWin, cxStyles, cxCustomData,
|
|||
|
cxGraphics, cxFilter, cxData, cxDataStorage, cxEdit, DB, cxDBData, ADODB,
|
|||
|
cxGridCustomPopupMenu, cxGridPopupMenu, cxGridLevel, cxClasses,
|
|||
|
cxControls, cxGridCustomView, cxGridCustomTableView, cxGridTableView,
|
|||
|
cxGridDBTableView, cxGrid, DBClient, cxCalendar, cxButtonEdit, cxSplitter,
|
|||
|
RM_Common, RM_Class, RM_e_Xls, RM_Dataset, RM_System, RM_GridReport,
|
|||
|
cxTextEdit, cxPC, cxCheckBox, Menus;
|
|||
|
|
|||
|
|
|||
|
type
|
|||
|
TfrmGYSFPSelList = class(TForm)
|
|||
|
ToolBar1: TToolBar;
|
|||
|
TBRafresh: TToolButton;
|
|||
|
TBClose: TToolButton;
|
|||
|
cxGridPopupMenu1: TcxGridPopupMenu;
|
|||
|
ADOQueryCmd: TADOQuery;
|
|||
|
ADOQueryMain: TADOQuery;
|
|||
|
ADOQueryTemp: TADOQuery;
|
|||
|
DataSource1: TDataSource;
|
|||
|
TBExport: TToolButton;
|
|||
|
Order_Main: TClientDataSet;
|
|||
|
RM1: TRMGridReport;
|
|||
|
RMDBMain: TRMDBDataSet;
|
|||
|
RMXLSExport1: TRMXLSExport;
|
|||
|
CDS_PRT: TClientDataSet;
|
|||
|
ToolButton3: TToolButton;
|
|||
|
cxGridPopupMenu2: TcxGridPopupMenu;
|
|||
|
Panel1: TPanel;
|
|||
|
Label8: TLabel;
|
|||
|
BCOrderNo: TEdit;
|
|||
|
cxGrid1: TcxGrid;
|
|||
|
Tv1: TcxGridDBTableView;
|
|||
|
v1Column6: TcxGridDBColumn;
|
|||
|
v1Column5: TcxGridDBColumn;
|
|||
|
v1Column10: TcxGridDBColumn;
|
|||
|
v1Column2: TcxGridDBColumn;
|
|||
|
v1Column3: TcxGridDBColumn;
|
|||
|
v1Column12: TcxGridDBColumn;
|
|||
|
cxGrid1Level1: TcxGridLevel;
|
|||
|
ToolButton1: TToolButton;
|
|||
|
ToolButton4: TToolButton;
|
|||
|
Label5: TLabel;
|
|||
|
FPNO: TEdit;
|
|||
|
v1Column1: TcxGridDBColumn;
|
|||
|
v1Column9: TcxGridDBColumn;
|
|||
|
ADOQueryPrint: TADOQuery;
|
|||
|
v1Column18: TcxGridDBColumn;
|
|||
|
v1Column13: TcxGridDBColumn;
|
|||
|
v1Column20: TcxGridDBColumn;
|
|||
|
v1Column8: TcxGridDBColumn;
|
|||
|
Label4: TLabel;
|
|||
|
GHDanWei: TEdit;
|
|||
|
Label6: TLabel;
|
|||
|
FactoryName: TEdit;
|
|||
|
v1Column4: TcxGridDBColumn;
|
|||
|
v1Column7: TcxGridDBColumn;
|
|||
|
v1Column11: TcxGridDBColumn;
|
|||
|
v1Column14: TcxGridDBColumn;
|
|||
|
PopupMenu1: TPopupMenu;
|
|||
|
N1: TMenuItem;
|
|||
|
N2: TMenuItem;
|
|||
|
ToolButton2: TToolButton;
|
|||
|
v1Column15: TcxGridDBColumn;
|
|||
|
v1Column16: TcxGridDBColumn;
|
|||
|
procedure FormDestroy(Sender: TObject);
|
|||
|
procedure FormClose(Sender: TObject; var Action: TCloseAction);
|
|||
|
procedure TBCloseClick(Sender: TObject);
|
|||
|
procedure TBExportClick(Sender: TObject);
|
|||
|
procedure TBRafreshClick(Sender: TObject);
|
|||
|
procedure FormShow(Sender: TObject);
|
|||
|
procedure cxPageControl1Change(Sender: TObject);
|
|||
|
procedure ToolButton3Click(Sender: TObject);
|
|||
|
procedure FormCreate(Sender: TObject);
|
|||
|
procedure cxTabControl1Change(Sender: TObject);
|
|||
|
procedure WorkerChange(Sender: TObject);
|
|||
|
procedure ToolButton1Click(Sender: TObject);
|
|||
|
procedure N1Click(Sender: TObject);
|
|||
|
procedure N2Click(Sender: TObject);
|
|||
|
procedure ToolButton2Click(Sender: TObject);
|
|||
|
|
|||
|
private
|
|||
|
FInt,PFInt:Integer;
|
|||
|
canshu1,canshu2:string;
|
|||
|
FNowDate:TDateTime;
|
|||
|
procedure InitGrid();
|
|||
|
procedure InitForm();
|
|||
|
procedure InitGridWsql(fsj:string);
|
|||
|
{ Private declarations }
|
|||
|
public
|
|||
|
{ Public declarations }
|
|||
|
end;
|
|||
|
|
|||
|
var
|
|||
|
frmGYSFPSelList: TfrmGYSFPSelList;
|
|||
|
|
|||
|
implementation
|
|||
|
uses
|
|||
|
U_DataLink,U_RTFun,U_ModuleNote;
|
|||
|
|
|||
|
{$R *.dfm}
|
|||
|
|
|||
|
procedure TfrmGYSFPSelList.FormDestroy(Sender: TObject);
|
|||
|
begin
|
|||
|
frmGYSFPSelList:=nil;
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmGYSFPSelList.FormClose(Sender: TObject;
|
|||
|
var Action: TCloseAction);
|
|||
|
begin
|
|||
|
Action:=caFree;
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmGYSFPSelList.TBCloseClick(Sender: TObject);
|
|||
|
begin
|
|||
|
Close;
|
|||
|
WriteCxGrid('<27><>Ӧ<EFBFBD>̷<EFBFBD>Ʊ<EFBFBD>б<EFBFBD>',Tv1,'<27><>Ʊ<EFBFBD><C6B1><EFBFBD><EFBFBD>');
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmGYSFPSelList.InitGrid();
|
|||
|
var
|
|||
|
fsj:String;
|
|||
|
begin
|
|||
|
try
|
|||
|
ADOQueryMain.DisableControls;
|
|||
|
with ADOQueryMain do
|
|||
|
begin
|
|||
|
Filtered:=False;
|
|||
|
Close;
|
|||
|
sql.Clear;
|
|||
|
sql.Add(' select A.*,DHXMoney=A.Money-isnull(A.HXMoney,0)');
|
|||
|
sql.Add(',DHXQty=A.Qty-isnull(A.HXQty,0)');
|
|||
|
SQL.Add(' from FP_GYSNB A');
|
|||
|
sql.Add(' where (isnull(A.Money,0)<>isnull(A.HXMoney,0)');
|
|||
|
sql.Add(' or isnull(A.Qty,0)<>isnull(A.HXQty,0))');
|
|||
|
sql.Add(' and isnull(A.FMType,'''')=''GYS'' ');
|
|||
|
sql.Add(' and isnull(A.FPNO,'''') not like ''QC%'' ');
|
|||
|
sql.Add(' and isnull(A.FPNO,'''') not like ''%TZ%'' ');
|
|||
|
Open;
|
|||
|
end;
|
|||
|
SCreateCDS20(ADOQueryMain,Order_Main);
|
|||
|
SInitCDSData20(ADOQueryMain,Order_Main);
|
|||
|
finally
|
|||
|
ADOQueryMain.EnableControls;
|
|||
|
end;
|
|||
|
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmGYSFPSelList.InitForm();
|
|||
|
begin
|
|||
|
ReadCxGrid('<27><>Ӧ<EFBFBD>̷<EFBFBD>Ʊ<EFBFBD>б<EFBFBD>',Tv1,'<27><>Ʊ<EFBFBD><C6B1><EFBFBD><EFBFBD>');
|
|||
|
InitGrid();
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmGYSFPSelList.TBExportClick(Sender: TObject);
|
|||
|
begin
|
|||
|
if Order_Main.IsEmpty then Exit;
|
|||
|
TcxGridToExcel('<27><>Ӧ<EFBFBD>̷<EFBFBD>Ʊ',cxGrid1);
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmGYSFPSelList.TBRafreshClick(Sender: TObject);
|
|||
|
begin
|
|||
|
InitGrid();
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmGYSFPSelList.FormShow(Sender: TObject);
|
|||
|
begin
|
|||
|
InitForm();
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmGYSFPSelList.cxPageControl1Change(Sender: TObject);
|
|||
|
begin
|
|||
|
InitGrid();
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmGYSFPSelList.ToolButton3Click(Sender: TObject);
|
|||
|
begin
|
|||
|
try
|
|||
|
frmModuleNote:=TfrmModuleNote.Create(Application);
|
|||
|
with frmModuleNote do
|
|||
|
begin
|
|||
|
flag:='<27><>Ӧ<EFBFBD>̷<EFBFBD>Ʊ';
|
|||
|
if ShowModal=1 then
|
|||
|
begin
|
|||
|
|
|||
|
end;
|
|||
|
end;
|
|||
|
finally
|
|||
|
frmModuleNote.Free;
|
|||
|
end;
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmGYSFPSelList.FormCreate(Sender: TObject);
|
|||
|
begin
|
|||
|
canshu1:=Trim(DParameters1);
|
|||
|
canshu2:=Trim(DParameters2);
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmGYSFPSelList.InitGridWsql(fsj:string);
|
|||
|
begin
|
|||
|
try
|
|||
|
ADOQueryMain.DisableControls;
|
|||
|
with ADOQueryMain do
|
|||
|
begin
|
|||
|
Filtered:=False;
|
|||
|
Close;
|
|||
|
sql.Clear;
|
|||
|
sql.Add('select AA.* from (');
|
|||
|
sql.Add(' select A.*,DHXMoney=A.Money-isnull(A.HXMoney,0)');
|
|||
|
SQL.Add(' from FP_GYSNB A');
|
|||
|
sql.Add(' where isnull(A.FMType,'''')=''GYS'' ');
|
|||
|
//sql.Add(' left join JYOrder_BG B on A.BGId=B.BGId');
|
|||
|
sql.Add(' ) AA');
|
|||
|
sql.Add(' where 1=1 ');
|
|||
|
sql.Add(fsj);
|
|||
|
Open;
|
|||
|
end;
|
|||
|
SCreateCDS20(ADOQueryMain,Order_Main);
|
|||
|
SInitCDSData20(ADOQueryMain,Order_Main);
|
|||
|
finally
|
|||
|
ADOQueryMain.EnableControls;
|
|||
|
end;
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmGYSFPSelList.cxTabControl1Change(Sender: TObject);
|
|||
|
begin
|
|||
|
InitGrid();
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmGYSFPSelList.WorkerChange(Sender: TObject);
|
|||
|
begin
|
|||
|
if ADOQueryMain.Active=False then Exit;
|
|||
|
SDofilter(ADOQueryMain,SGetFilters(Panel1,1,2));
|
|||
|
SCreateCDS20(ADOQueryMain,Order_Main);
|
|||
|
SInitCDSData20(ADOQueryMain,Order_Main);
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmGYSFPSelList.ToolButton1Click(Sender: TObject);
|
|||
|
begin
|
|||
|
if ADOQueryMain.Active=False then Exit;
|
|||
|
SDofilter(ADOQueryMain,SGetFilters(Panel1,1,2));
|
|||
|
SCreateCDS20(ADOQueryMain,Order_Main);
|
|||
|
SInitCDSData20(ADOQueryMain,Order_Main);
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmGYSFPSelList.N1Click(Sender: TObject);
|
|||
|
begin
|
|||
|
SelOKNo(Order_Main,True);
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmGYSFPSelList.N2Click(Sender: TObject);
|
|||
|
begin
|
|||
|
SelOKNo(Order_Main,False);
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmGYSFPSelList.ToolButton2Click(Sender: TObject);
|
|||
|
begin
|
|||
|
if Order_Main.Locate('SSel',True,[])=False then
|
|||
|
begin
|
|||
|
Application.MessageBox('û<><C3BB>ѡ<EFBFBD><D1A1><EFBFBD><EFBFBD><EFBFBD><EFBFBD>!','<27><>ʾ',0);
|
|||
|
Exit;
|
|||
|
end;
|
|||
|
ModalResult:=1;
|
|||
|
end;
|
|||
|
|
|||
|
end.
|