238 lines
6.4 KiB
ObjectPascal
238 lines
6.4 KiB
ObjectPascal
unit U_GYSListSel;
|
||
|
||
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, cxPC, cxDropDownEdit, Menus, BtnEdit, Buttons,
|
||
cxLookAndFeels, cxLookAndFeelPainters, cxNavigator;
|
||
|
||
type
|
||
TfrmGYSListSel = class(TForm)
|
||
ToolBar1: TToolBar;
|
||
TBRafresh: TToolButton;
|
||
TBClose: TToolButton;
|
||
ADOQueryTemp: TADOQuery;
|
||
ADOQueryCmd: TADOQuery;
|
||
Panel1: TPanel;
|
||
ToolButton2: TToolButton;
|
||
ADOQueryMain: TADOQuery;
|
||
zjm: TEdit;
|
||
cxGridPopupMenu2: TcxGridPopupMenu;
|
||
DS_HZ: TDataSource;
|
||
CDS_HZ: TClientDataSet;
|
||
Label2: TLabel;
|
||
cxGrid1: TcxGrid;
|
||
TV1: TcxGridDBTableView;
|
||
V1Column1: TcxGridDBColumn;
|
||
cxGYSName: TcxGridDBColumn;
|
||
cxGridDBGYSNameZC: TcxGridDBColumn;
|
||
V1SHStatus: TcxGridDBColumn;
|
||
V1FZR: TcxGridDBColumn;
|
||
cxGridLevel2: TcxGridLevel;
|
||
V1Column2: TcxGridDBColumn;
|
||
V1Column3: TcxGridDBColumn;
|
||
cxStyleRepository1: TcxStyleRepository;
|
||
cxStyle1: TcxStyle;
|
||
LabKHType: TLabel;
|
||
KHType: TBtnEditC;
|
||
cxGrid3: TcxGrid;
|
||
TV3: TcxGridDBTableView;
|
||
V3Column2: TcxGridDBColumn;
|
||
V3BankName: TcxGridDBColumn;
|
||
V3BankNo: TcxGridDBColumn;
|
||
V3Column3: TcxGridDBColumn;
|
||
V3Column1: TcxGridDBColumn;
|
||
cxGridLevel3: TcxGridLevel;
|
||
DS_HZ3: TDataSource;
|
||
CDS_HZ3: TClientDataSet;
|
||
cxGridPopupMenu4: TcxGridPopupMenu;
|
||
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 zjmChange(Sender: TObject);
|
||
procedure KHTypeClick(Sender: TObject);
|
||
procedure V1SHStatusCustomDrawCell(Sender: TcxCustomGridTableView;
|
||
ACanvas: TcxCanvas; AViewInfo: TcxGridTableDataCellViewInfo;
|
||
var ADone: Boolean);
|
||
procedure KHTypeBtnUpClick(Sender: TObject);
|
||
procedure KHTypeBtnDnClick(Sender: TObject);
|
||
procedure TV3DblClick(Sender: TObject);
|
||
procedure TV1MouseDown(Sender: TObject; Button: TMouseButton;
|
||
Shift: TShiftState; X, Y: Integer);
|
||
private
|
||
{ Private declarations }
|
||
ColorInt:Integer;
|
||
procedure InitGrid();
|
||
procedure InitGridBankMain();
|
||
public
|
||
canshu1,canshu2,FGYSType:string;
|
||
end;
|
||
|
||
var
|
||
frmGYSListSel: TfrmGYSListSel;
|
||
|
||
implementation
|
||
uses
|
||
U_DataLink,U_RTFun,U_ZDYHelp, U_SCPerson;
|
||
|
||
{$R *.dfm}
|
||
|
||
|
||
procedure TfrmGYSListSel.InitGrid();
|
||
begin
|
||
with ADOQueryMain do
|
||
begin
|
||
Filtered:=False;
|
||
Close;
|
||
SQL.Clear;
|
||
sql.Add(' select *,zjm=dbo.getpinyin(KHName)+KHName+dbo.getpinyin(KHNameJC)+KHNameJC+KHNO');
|
||
sql.add(',SHStatus=(case when isnull(status,''0'')=''0'' then ''δ<><CEB4><EFBFBD><EFBFBD>'' else ''<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>'' end)');
|
||
sql.Add(' from KH_Main A ');
|
||
sql.add(' where isnull(KHFlag,'''') in (''GYS'',''KH'') and isnull(Valid,'''')=''Y'' ');
|
||
Open;
|
||
end;
|
||
SCreateCDS20(ADOQueryMain,CDS_HZ);
|
||
SInitCDSData20(ADOQueryMain,CDS_HZ);
|
||
end;
|
||
|
||
procedure TfrmGYSListSel.FormDestroy(Sender: TObject);
|
||
begin
|
||
frmGYSListSel:=nil;
|
||
end;
|
||
|
||
procedure TfrmGYSListSel.FormClose(Sender: TObject; var Action: TCloseAction);
|
||
begin
|
||
Action:=caFree;
|
||
end;
|
||
|
||
procedure TfrmGYSListSel.TBCloseClick(Sender: TObject);
|
||
begin
|
||
WriteCxGrid('PBGYS11YXCX',Tv1,'<27><>Ӧ<EFBFBD>̹<EFBFBD><CCB9><EFBFBD>');
|
||
Close;
|
||
end;
|
||
procedure TfrmGYSListSel.FormShow(Sender: TObject);
|
||
var
|
||
fsj:String;
|
||
begin
|
||
{ fsj:='select Name=YWY from KH_Main where isnull(YWY,'''')<>'''' and Valid=''Y'' and isnull(KHFlag,'''')=''KH'' Group by YWY';
|
||
SInitComBoxBySql(ADOQueryTemp,YWY,False,fsj);
|
||
fsj:='select Name=LiDan from KH_Main where isnull(LiDan,'''')<>'''' and Valid=''Y'' and isnull(KHFlag,'''')=''KH'' Group by LiDan';
|
||
SInitComBoxBySql(ADOQueryTemp,LiDan,False,fsj); }
|
||
ReadCxGrid('PBGYS11YXCX',Tv1,'<27><>Ӧ<EFBFBD>̹<EFBFBD><CCB9><EFBFBD>');
|
||
InitGrid();
|
||
end;
|
||
|
||
procedure TfrmGYSListSel.TBRafreshClick(Sender: TObject);
|
||
begin
|
||
ToolBar1.SetFocus;
|
||
InitGrid();
|
||
end;
|
||
|
||
procedure TfrmGYSListSel.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 TfrmGYSListSel.zjmChange(Sender: TObject);
|
||
begin
|
||
ToolButton2.Click;
|
||
end;
|
||
|
||
|
||
procedure TfrmGYSListSel.KHTypeClick(Sender: TObject);
|
||
begin
|
||
ToolButton2.Click;
|
||
end;
|
||
|
||
procedure TfrmGYSListSel.V1SHStatusCustomDrawCell(
|
||
Sender: TcxCustomGridTableView; ACanvas: TcxCanvas;
|
||
AViewInfo: TcxGridTableDataCellViewInfo; var ADone: Boolean);
|
||
var
|
||
id:Integer;
|
||
begin
|
||
Id:=TV1.GetColumnByFieldName('SHStatus').Index;
|
||
if AViewInfo.GridRecord.Values[Id]='δ<><CEB4><EFBFBD><EFBFBD>' then
|
||
begin
|
||
ACanvas.Font.Color:=clRed;
|
||
end;
|
||
end;
|
||
|
||
procedure TfrmGYSListSel.KHTypeBtnUpClick(Sender: TObject);
|
||
begin
|
||
try
|
||
frmSCPerson:=TfrmSCPerson.Create(Application);
|
||
with frmSCPerson do
|
||
begin
|
||
FlagStr:='GYSType';
|
||
if ShowModal=1 then
|
||
begin
|
||
Self.KHType.Text:=Trim(FSDPerson);
|
||
Self.KHType.TxtCode:=Trim(FSDPerson);
|
||
end;
|
||
end;
|
||
finally
|
||
frmSCPerson.Free;
|
||
end;
|
||
ToolButton2.Click;
|
||
end;
|
||
|
||
procedure TfrmGYSListSel.KHTypeBtnDnClick(Sender: TObject);
|
||
begin
|
||
KHType.Text:='';
|
||
KHType.TxtCode:='';
|
||
ToolButton2.Click;
|
||
end;
|
||
|
||
procedure TfrmGYSListSel.TV3DblClick(Sender: TObject);
|
||
begin
|
||
if CDS_HZ.IsEmpty then exit;
|
||
ModalResult:=1;
|
||
end;
|
||
procedure TfrmGYSListSel.InitGridBankMain();
|
||
begin
|
||
with ADOQueryTemp do
|
||
begin
|
||
Close;
|
||
sql.Clear;
|
||
sql.Add('select * from KH_Sub_Bank where KHMainid='''+Trim(CDS_HZ.fieldbyname('KHMainid').asstring)+'''');
|
||
if CDS_HZ.IsEmpty then
|
||
begin
|
||
sql.Add(' and 1=2');
|
||
end else
|
||
begin
|
||
sql.Add(' and valid=''Y'' ');
|
||
end;
|
||
sql.Add(' order by XH');
|
||
Open;
|
||
end;
|
||
SCreateCDS20(ADOQueryTemp,CDS_HZ3);
|
||
SInitCDSData20(ADOQueryTemp,CDS_HZ3);
|
||
end;
|
||
|
||
procedure TfrmGYSListSel.TV1MouseDown(Sender: TObject;
|
||
Button: TMouseButton; Shift: TShiftState; X, Y: Integer);
|
||
begin
|
||
InitGridBankMain();
|
||
end;
|
||
|
||
end.
|
||
|
||
|