153 lines
4.0 KiB
ObjectPascal
153 lines
4.0 KiB
ObjectPascal
|
unit U_ZdyAttachGYS;
|
|||
|
|
|||
|
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, dxSkinsCore,
|
|||
|
dxSkinsDefaultPainters, dxDateRanges, dxBarBuiltInMenu, U_BaseList;
|
|||
|
|
|||
|
type
|
|||
|
TfrmZdyAttachGYS = class(TForm )
|
|||
|
ToolBar1: TToolBar;
|
|||
|
TBRafresh: TToolButton;
|
|||
|
TBClose: TToolButton;
|
|||
|
ADOQueryTemp: TADOQuery;
|
|||
|
ADOQueryCmd: TADOQuery;
|
|||
|
Panel1: TPanel;
|
|||
|
ToolButton2: TToolButton;
|
|||
|
ADOQueryMain: TADOQuery;
|
|||
|
RM1: TRMGridReport;
|
|||
|
RMDB_Main: TRMDBDataSet;
|
|||
|
Label3: TLabel;
|
|||
|
CoName: TEdit;
|
|||
|
cxGridPopupMenu2: TcxGridPopupMenu;
|
|||
|
DS_HZ: TDataSource;
|
|||
|
CDS_HZ: TClientDataSet;
|
|||
|
Label1: TLabel;
|
|||
|
CoCode: TEdit;
|
|||
|
Label2: TLabel;
|
|||
|
FactType: TComboBox;
|
|||
|
cxGrid2: TcxGrid;
|
|||
|
Tv2: TcxGridDBTableView;
|
|||
|
v2Column2: TcxGridDBColumn;
|
|||
|
v2Column6: TcxGridDBColumn;
|
|||
|
v2Column15: TcxGridDBColumn;
|
|||
|
cxGridLevel1: TcxGridLevel;
|
|||
|
v2Column7: 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 CoNameChange(Sender: TObject);
|
|||
|
procedure Tv2DblClick(Sender: TObject);
|
|||
|
private
|
|||
|
{ Private declarations }
|
|||
|
procedure InitGrid();
|
|||
|
public
|
|||
|
FStatus: string;
|
|||
|
end;
|
|||
|
|
|||
|
var
|
|||
|
frmZdyAttachGYS: TfrmZdyAttachGYS;
|
|||
|
|
|||
|
implementation
|
|||
|
|
|||
|
uses
|
|||
|
U_DataLink, U_RTFun, U_ZDYHelp;
|
|||
|
|
|||
|
{$R *.dfm}
|
|||
|
|
|||
|
procedure TfrmZdyAttachGYS.InitGrid();
|
|||
|
begin
|
|||
|
try
|
|||
|
ADOQueryMain.DisableControls;
|
|||
|
with ADOQueryMain do
|
|||
|
begin
|
|||
|
Filtered := False;
|
|||
|
Close;
|
|||
|
SQL.Clear;
|
|||
|
sql.Add(' select * from Company A left join Company_contact B ');
|
|||
|
sql.Add(' on A.CoID=B.CoID and B.IsDefault=1 where A.CoType=''<27><>Ӧ<EFBFBD><D3A6>'' and A.Valid=''Y'' ');
|
|||
|
|
|||
|
// if FStatus = '<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>' then
|
|||
|
// begin
|
|||
|
// sql.Add(' and exists(select X.FromCoID from Company_GCFY X where X.FromCoID=A.CoID and F_XYZPF>0 ) ');
|
|||
|
// end;
|
|||
|
//
|
|||
|
// if FStatus = '<27>ư湫˾' then
|
|||
|
// begin
|
|||
|
// sql.Add(' and exists(select X.FromCoID from Company_MGFY X where X.FromCoID=A.CoID and F_MSMGFJ>0) ');
|
|||
|
// end;
|
|||
|
Open;
|
|||
|
end;
|
|||
|
SCreateCDS(ADOQueryMain, CDS_HZ);
|
|||
|
SInitCDSData(ADOQueryMain, CDS_HZ);
|
|||
|
finally
|
|||
|
ADOQueryMain.EnableControls;
|
|||
|
end;
|
|||
|
ToolButton2.Click;
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmZdyAttachGYS.FormDestroy(Sender: TObject);
|
|||
|
begin
|
|||
|
frmZdyAttachGYS := nil;
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmZdyAttachGYS.FormClose(Sender: TObject; var Action: TCloseAction);
|
|||
|
begin
|
|||
|
Action := caFree;
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmZdyAttachGYS.TBCloseClick(Sender: TObject);
|
|||
|
begin
|
|||
|
WriteCxGrid('<27><>Ӧ<EFBFBD><D3A6><EFBFBD><EFBFBD><EFBFBD><EFBFBD>', Tv2);
|
|||
|
Close;
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmZdyAttachGYS.FormShow(Sender: TObject);
|
|||
|
begin
|
|||
|
ReadCxGrid('<27><>Ӧ<EFBFBD><D3A6><EFBFBD><EFBFBD><EFBFBD><EFBFBD>', Tv2);
|
|||
|
InitGrid();
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmZdyAttachGYS.TBRafreshClick(Sender: TObject);
|
|||
|
begin
|
|||
|
InitGrid();
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmZdyAttachGYS.ToolButton2Click(Sender: TObject);
|
|||
|
begin
|
|||
|
if ADOQueryMain.Active then
|
|||
|
begin
|
|||
|
SDofilter(ADOQueryMain, SGetFilters(Panel1, 1, 2));
|
|||
|
SCreateCDS(ADOQueryMain, CDS_HZ);
|
|||
|
SInitCDSData(ADOQueryMain, CDS_HZ);
|
|||
|
end;
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmZdyAttachGYS.CoNameChange(Sender: TObject);
|
|||
|
begin
|
|||
|
ToolButton2.Click;
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmZdyAttachGYS.Tv2DblClick(Sender: TObject);
|
|||
|
begin
|
|||
|
if CDS_HZ.IsEmpty then
|
|||
|
exit;
|
|||
|
ModalResult := 1;
|
|||
|
end;
|
|||
|
|
|||
|
end.
|
|||
|
|