170 lines
4.1 KiB
ObjectPascal
170 lines
4.1 KiB
ObjectPascal
|
|
unit U_CompanyContactSel;
|
|||
|
|
|
|||
|
|
interface
|
|||
|
|
|
|||
|
|
uses
|
|||
|
|
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
|
|||
|
|
Dialogs, cxStyles, cxCustomData, cxGraphics, cxFilter, cxData, cxDataStorage,
|
|||
|
|
cxEdit, DB, cxDBData, ToolWin, ComCtrls, U_BaseHelp, cxGridCustomTableView,
|
|||
|
|
cxGridTableView, cxGridDBTableView, cxGridLevel, cxClasses, cxControls,
|
|||
|
|
cxGridCustomView, cxGrid, DBClient, ADODB, ImgList, StdCtrls, ExtCtrls,
|
|||
|
|
cxTextEdit, cxGridCustomPopupMenu, cxGridPopupMenu, cxLookAndFeels,
|
|||
|
|
cxLookAndFeelPainters, cxNavigator, dxDateRanges, dxBarBuiltInMenu,
|
|||
|
|
System.ImageList, U_BaseInput, cxContainer, cxImageList,
|
|||
|
|
dxScrollbarAnnotations, dxSkinsDefaultPainters;
|
|||
|
|
|
|||
|
|
type
|
|||
|
|
TfrmCompanyContactSel = class(TfrmBaseHelp)
|
|||
|
|
TV1: TcxGridDBTableView;
|
|||
|
|
cxGrid1Level1: TcxGridLevel;
|
|||
|
|
cxGrid1: TcxGrid;
|
|||
|
|
ToolBar1: TToolBar;
|
|||
|
|
ADOQueryMain: TADOQuery;
|
|||
|
|
ADOQueryTemp: TADOQuery;
|
|||
|
|
ADOQueryCmd: TADOQuery;
|
|||
|
|
DS_1: TDataSource;
|
|||
|
|
CDS_1: TClientDataSet;
|
|||
|
|
TBSave: TToolButton;
|
|||
|
|
TBClose: TToolButton;
|
|||
|
|
ToolButton1: TToolButton;
|
|||
|
|
ADOConnection1: TADOConnection;
|
|||
|
|
GPM_1: TcxGridPopupMenu;
|
|||
|
|
ImageList1: TImageList;
|
|||
|
|
TV1Column1: TcxGridDBColumn;
|
|||
|
|
TV1Column2: TcxGridDBColumn;
|
|||
|
|
TV1Column3: TcxGridDBColumn;
|
|||
|
|
ThreeColorBase: TcxStyleRepository;
|
|||
|
|
SHuangSe: TcxStyle;
|
|||
|
|
SkyBlue: TcxStyle;
|
|||
|
|
Default: TcxStyle;
|
|||
|
|
QHuangSe: TcxStyle;
|
|||
|
|
Red: TcxStyle;
|
|||
|
|
FontBlue: TcxStyle;
|
|||
|
|
TextSHuangSe: TcxStyle;
|
|||
|
|
FonePurple: TcxStyle;
|
|||
|
|
FoneClMaroon: TcxStyle;
|
|||
|
|
FoneRed: TcxStyle;
|
|||
|
|
RowColor: TcxStyle;
|
|||
|
|
handBlack: TcxStyle;
|
|||
|
|
cxBlue: TcxStyle;
|
|||
|
|
SHuangSeCu: TcxStyle;
|
|||
|
|
cxImageList_bar: TcxImageList;
|
|||
|
|
TV1Column4: TcxGridDBColumn;
|
|||
|
|
TV1Column5: TcxGridDBColumn;
|
|||
|
|
TV1Column6: TcxGridDBColumn;
|
|||
|
|
procedure FormCreate(Sender: TObject);
|
|||
|
|
procedure FormClose(Sender: TObject; var Action: TCloseAction);
|
|||
|
|
procedure FormShow(Sender: TObject);
|
|||
|
|
procedure ToolButton1Click(Sender: TObject);
|
|||
|
|
procedure FormDestroy(Sender: TObject);
|
|||
|
|
procedure TBSaveClick(Sender: TObject);
|
|||
|
|
procedure TV1DblClick(Sender: TObject);
|
|||
|
|
procedure TBCloseClick(Sender: TObject);
|
|||
|
|
private
|
|||
|
|
procedure InitGrid();
|
|||
|
|
{ Private declarations }
|
|||
|
|
public
|
|||
|
|
FCoCode: string;
|
|||
|
|
{ Public declarations }
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
var
|
|||
|
|
frmCompanyContactSel: TfrmCompanyContactSel;
|
|||
|
|
|
|||
|
|
implementation
|
|||
|
|
|
|||
|
|
uses
|
|||
|
|
U_DataLink, U_RTFun, U_CompanySel;
|
|||
|
|
|
|||
|
|
{$R *.dfm}
|
|||
|
|
|
|||
|
|
procedure TfrmCompanyContactSel.FormCreate(Sender: TObject);
|
|||
|
|
begin
|
|||
|
|
inherited;
|
|||
|
|
try
|
|||
|
|
with ADOConnection1 do
|
|||
|
|
begin
|
|||
|
|
Connected := false;
|
|||
|
|
ConnectionString := DConString;
|
|||
|
|
Connected := true;
|
|||
|
|
end;
|
|||
|
|
ADOQueryBaseCmd.Connection := ADOConnection1;
|
|||
|
|
ADOQueryBaseTemp.Connection := ADOConnection1;
|
|||
|
|
except
|
|||
|
|
application.MessageBox('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʧ<EFBFBD>ܣ<EFBFBD>', '<27><>ʾ<EFBFBD><CABE>Ϣ');
|
|||
|
|
end;
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
procedure TfrmCompanyContactSel.FormClose(Sender: TObject; var Action: TCloseAction);
|
|||
|
|
begin
|
|||
|
|
|
|||
|
|
toolbar1.SetFocus;
|
|||
|
|
|
|||
|
|
Action := cahide;
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
procedure TfrmCompanyContactSel.InitGrid();
|
|||
|
|
begin
|
|||
|
|
try
|
|||
|
|
ADOQueryMain.DisableControls;
|
|||
|
|
with ADOQueryMain do
|
|||
|
|
begin
|
|||
|
|
Close;
|
|||
|
|
sql.Clear;
|
|||
|
|
sql.Add('select A.*,B.* from BS_Company A ');
|
|||
|
|
sql.Add('left join BS_Company_contact B ON A.COID=B.COID ');
|
|||
|
|
sql.Add('where 1=1 ');
|
|||
|
|
|
|||
|
|
sql.Add(' and A.CoCode=''' + Trim(FCoCode) + '''');
|
|||
|
|
|
|||
|
|
Open;
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
SCreateCDS(ADOQueryMain, CDS_1);
|
|||
|
|
SInitCDSData(ADOQueryMain, CDS_1);
|
|||
|
|
finally
|
|||
|
|
ADOQueryMain.EnableControls;
|
|||
|
|
end;
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
procedure TfrmCompanyContactSel.FormShow(Sender: TObject);
|
|||
|
|
begin
|
|||
|
|
inherited;
|
|||
|
|
|
|||
|
|
InitGrid();
|
|||
|
|
|
|||
|
|
ReadCxGrid(Self.Caption, TV1, '<27>Զ<EFBFBD><D4B6><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>');
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
procedure TfrmCompanyContactSel.TBCloseClick(Sender: TObject);
|
|||
|
|
begin
|
|||
|
|
inherited;
|
|||
|
|
Close;
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
procedure TfrmCompanyContactSel.TBSaveClick(Sender: TObject);
|
|||
|
|
begin
|
|||
|
|
WriteCxGrid(Self.Caption, TV1, '<27>Զ<EFBFBD><D4B6><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>');
|
|||
|
|
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
procedure TfrmCompanyContactSel.ToolButton1Click(Sender: TObject);
|
|||
|
|
begin
|
|||
|
|
toolbar1.SetFocus;
|
|||
|
|
ModalResult := 1;
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
procedure TfrmCompanyContactSel.TV1DblClick(Sender: TObject);
|
|||
|
|
begin
|
|||
|
|
ModalResult := 1;
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
procedure TfrmCompanyContactSel.FormDestroy(Sender: TObject);
|
|||
|
|
begin
|
|||
|
|
inherited;
|
|||
|
|
frmCompanyContactSel := nil;
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
end.
|
|||
|
|
|