284 lines
7.5 KiB
ObjectPascal
284 lines
7.5 KiB
ObjectPascal
|
|
unit U_GSListBankSel;
|
|||
|
|
|
|||
|
|
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;
|
|||
|
|
|
|||
|
|
type
|
|||
|
|
TfrmGSListBankSel = class(TForm)
|
|||
|
|
ToolBar1: TToolBar;
|
|||
|
|
TBRafresh: TToolButton;
|
|||
|
|
TBClose: TToolButton;
|
|||
|
|
ADOQueryTemp: TADOQuery;
|
|||
|
|
ADOQueryCmd: TADOQuery;
|
|||
|
|
ADOQueryMain: TADOQuery;
|
|||
|
|
cxGridPopupMenu2: TcxGridPopupMenu;
|
|||
|
|
DS_HZ: TDataSource;
|
|||
|
|
CDS_HZ: TClientDataSet;
|
|||
|
|
DS_HZ3: TDataSource;
|
|||
|
|
CDS_HZ3: TClientDataSet;
|
|||
|
|
cxGridPopupMenu4: TcxGridPopupMenu;
|
|||
|
|
cxGrid1: TcxGrid;
|
|||
|
|
TV1: TcxGridDBTableView;
|
|||
|
|
V1Column1: TcxGridDBColumn;
|
|||
|
|
cxGYSName: TcxGridDBColumn;
|
|||
|
|
cxGridDBGYSNameZC: TcxGridDBColumn;
|
|||
|
|
B1GYSFZRen: TcxGridDBColumn;
|
|||
|
|
cxGridDBGYSTel: TcxGridDBColumn;
|
|||
|
|
V1SHStatus: TcxGridDBColumn;
|
|||
|
|
V1GYSCodeFW: TcxGridDBColumn;
|
|||
|
|
cxGridLevel2: TcxGridLevel;
|
|||
|
|
PopupMenu1: TPopupMenu;
|
|||
|
|
MainView: TMenuItem;
|
|||
|
|
TBFJUp1: TPopupMenu;
|
|||
|
|
BankView: TMenuItem;
|
|||
|
|
cxGrid3: TcxGrid;
|
|||
|
|
TV3: TcxGridDBTableView;
|
|||
|
|
V3Column2: TcxGridDBColumn;
|
|||
|
|
V3BankName: TcxGridDBColumn;
|
|||
|
|
V3BankNo: TcxGridDBColumn;
|
|||
|
|
V3Column3: TcxGridDBColumn;
|
|||
|
|
cxGridLevel3: TcxGridLevel;
|
|||
|
|
V3Column1: TcxGridDBColumn;
|
|||
|
|
V1Column2: TcxGridDBColumn;
|
|||
|
|
cxStyleRepository1: TcxStyleRepository;
|
|||
|
|
cxStyle1: TcxStyle;
|
|||
|
|
Panel1: TPanel;
|
|||
|
|
V1Column3: TcxGridDBColumn;
|
|||
|
|
V3Column4: TcxGridDBColumn;
|
|||
|
|
V3Column5: 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 cxTabControl1Change(Sender: TObject);
|
|||
|
|
procedure TV1MouseDown(Sender: TObject; Button: TMouseButton;
|
|||
|
|
Shift: TShiftState; X, Y: Integer);
|
|||
|
|
procedure TV1CellDblClick(Sender: TcxCustomGridTableView;
|
|||
|
|
ACellViewInfo: TcxGridTableDataCellViewInfo; AButton: TMouseButton;
|
|||
|
|
AShift: TShiftState; var AHandled: Boolean);
|
|||
|
|
procedure MainViewClick(Sender: TObject);
|
|||
|
|
procedure BankViewClick(Sender: TObject);
|
|||
|
|
procedure TV3DblClick(Sender: TObject);
|
|||
|
|
private
|
|||
|
|
{ Private declarations }
|
|||
|
|
ColorInt:Integer;
|
|||
|
|
procedure InitGrid();
|
|||
|
|
procedure setstatus();
|
|||
|
|
procedure InitGridBankMain();
|
|||
|
|
procedure InitGridBankMainID(FID:String);
|
|||
|
|
public
|
|||
|
|
canshu1,canshu2,FGYSType,XZKHTYpe:string;
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
var
|
|||
|
|
frmGSListBankSel: TfrmGSListBankSel;
|
|||
|
|
|
|||
|
|
implementation
|
|||
|
|
uses
|
|||
|
|
U_DataLink,U_RTFun,U_ZDYHelp,U_GSInPutMain,U_GSInPutMainBank,U_FjList;
|
|||
|
|
|
|||
|
|
{$R *.dfm}
|
|||
|
|
procedure TfrmGSListBankSel.setstatus();
|
|||
|
|
begin
|
|||
|
|
canshu2:='GS';
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
procedure TfrmGSListBankSel.InitGrid();
|
|||
|
|
begin
|
|||
|
|
with ADOQueryMain do
|
|||
|
|
begin
|
|||
|
|
Filtered:=False;
|
|||
|
|
Close;
|
|||
|
|
SQL.Clear;
|
|||
|
|
sql.Add(' select A.* ');
|
|||
|
|
sql.Add(',SDQty=(select Count(*) from TP_File TF where TF.WBID=A.KHMainId and TF.TFType=''<27><>˾<EFBFBD><CBBE><EFBFBD><EFBFBD>'' )');
|
|||
|
|
sql.Add(' from KH_Main A ');
|
|||
|
|
sql.add(' where isnull(KHFlag,'''')='''+Trim(canshu2)+''' and isnull(Valid,'''')=''Y'' ');
|
|||
|
|
Open;
|
|||
|
|
end;
|
|||
|
|
SCreateCDS20(ADOQueryMain,CDS_HZ);
|
|||
|
|
SInitCDSData20(ADOQueryMain,CDS_HZ);
|
|||
|
|
with ADOQueryTemp do
|
|||
|
|
begin
|
|||
|
|
Close;
|
|||
|
|
sql.Clear;
|
|||
|
|
sql.Add('select * from KH_Sub_Bank where KHMainid='''+Trim(CDS_HZ.fieldbyname('KHMainid').asstring)+''' and isnull(Valid,'''')=''Y''');
|
|||
|
|
Open;
|
|||
|
|
end;
|
|||
|
|
SCreateCDS20(ADOQueryTemp,CDS_HZ3);
|
|||
|
|
SInitCDSData20(ADOQueryTemp,CDS_HZ3);
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
procedure TfrmGSListBankSel.FormDestroy(Sender: TObject);
|
|||
|
|
begin
|
|||
|
|
frmGSListBankSel:=nil;
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
procedure TfrmGSListBankSel.FormClose(Sender: TObject; var Action: TCloseAction);
|
|||
|
|
begin
|
|||
|
|
Action:=caFree;
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
procedure TfrmGSListBankSel.TBCloseClick(Sender: TObject);
|
|||
|
|
begin
|
|||
|
|
WriteCxGrid('GS1',Tv1,'<27><>˾<EFBFBD>˻<EFBFBD><CBBB><EFBFBD><EFBFBD><EFBFBD>');
|
|||
|
|
WriteCxGrid('GS3',Tv3,'<27><>˾<EFBFBD>˻<EFBFBD><CBBB><EFBFBD><EFBFBD><EFBFBD>');
|
|||
|
|
Close;
|
|||
|
|
end;
|
|||
|
|
procedure TfrmGSListBankSel.FormShow(Sender: TObject);
|
|||
|
|
begin
|
|||
|
|
ReadCxGrid('GS1',Tv1,'<27><>˾<EFBFBD>˻<EFBFBD><CBBB><EFBFBD><EFBFBD><EFBFBD>');
|
|||
|
|
ReadCxGrid('GS3',Tv3,'<27><>˾<EFBFBD>˻<EFBFBD><CBBB><EFBFBD><EFBFBD><EFBFBD>');
|
|||
|
|
setstatus();
|
|||
|
|
InitGrid();
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
procedure TfrmGSListBankSel.TBRafreshClick(Sender: TObject);
|
|||
|
|
begin
|
|||
|
|
ToolBar1.SetFocus;
|
|||
|
|
InitGrid();
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
procedure TfrmGSListBankSel.cxTabControl1Change(Sender: TObject);
|
|||
|
|
begin
|
|||
|
|
InitGrid();
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
procedure TfrmGSListBankSel.TV1MouseDown(Sender: TObject;
|
|||
|
|
Button: TMouseButton; Shift: TShiftState; X, Y: Integer);
|
|||
|
|
begin
|
|||
|
|
InitGridBankMain();
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
procedure TfrmGSListBankSel.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 TfrmGSListBankSel.InitGridBankMainID(FID:String);
|
|||
|
|
begin
|
|||
|
|
with ADOQueryTemp do
|
|||
|
|
begin
|
|||
|
|
Close;
|
|||
|
|
sql.Clear;
|
|||
|
|
sql.Add('select * from KH_Sub_Bank where KHMainid='''+Trim(FID)+'''');
|
|||
|
|
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 TfrmGSListBankSel.TV1CellDblClick(Sender: TcxCustomGridTableView;
|
|||
|
|
ACellViewInfo: TcxGridTableDataCellViewInfo; AButton: TMouseButton;
|
|||
|
|
AShift: TShiftState; var AHandled: Boolean);
|
|||
|
|
var
|
|||
|
|
FName:string;
|
|||
|
|
begin
|
|||
|
|
if CDS_HZ.IsEmpty then Exit;
|
|||
|
|
FName:=Tv1.Controller.FocusedColumn.DataBinding.FilterFieldName;
|
|||
|
|
if Trim(FName)='SDQty' then
|
|||
|
|
begin
|
|||
|
|
if CDS_HZ.IsEmpty then Exit;
|
|||
|
|
try
|
|||
|
|
frmFjList:=TfrmFjList.Create(Application);
|
|||
|
|
with frmFjList do
|
|||
|
|
begin
|
|||
|
|
fkeyNO:=Trim(CDS_HZ.fieldbyname('KHMainid').AsString);
|
|||
|
|
fType:='<27><>˾<EFBFBD><CBBE><EFBFBD><EFBFBD>';
|
|||
|
|
fstatus:=1;
|
|||
|
|
if ShowModal=1 then
|
|||
|
|
begin
|
|||
|
|
|
|||
|
|
end;
|
|||
|
|
end;
|
|||
|
|
finally
|
|||
|
|
frmFjList.Free;
|
|||
|
|
end;
|
|||
|
|
end;
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
procedure TfrmGSListBankSel.MainViewClick(Sender: TObject);
|
|||
|
|
begin
|
|||
|
|
if CDS_HZ.IsEmpty then Exit;
|
|||
|
|
try
|
|||
|
|
frmGSInPutMain:=TfrmGSInPutMain.Create(Application);
|
|||
|
|
with frmGSInPutMain do
|
|||
|
|
begin
|
|||
|
|
FKHMainid:=Trim(Self.CDS_HZ.fieldbyname('KHMainId').AsString);
|
|||
|
|
frmGSInPutMain.TBSave.Visible:=False;
|
|||
|
|
if ShowModal=1 then
|
|||
|
|
begin
|
|||
|
|
TBRafresh.Click;
|
|||
|
|
end;
|
|||
|
|
end;
|
|||
|
|
finally
|
|||
|
|
frmGSInPutMain.Free;
|
|||
|
|
end;
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
procedure TfrmGSListBankSel.BankViewClick(Sender: TObject);
|
|||
|
|
begin
|
|||
|
|
if CDS_HZ3.IsEmpty then Exit;
|
|||
|
|
try
|
|||
|
|
frmGSInPutMainBank:=TfrmGSInPutMainBank.Create(Application);
|
|||
|
|
with frmGSInPutMainBank do
|
|||
|
|
begin
|
|||
|
|
FKHMainid:=Trim(Self.CDS_HZ.fieldbyname('KHMainId').AsString);
|
|||
|
|
FBKID:=Trim(Self.CDS_HZ3.fieldbyname('BKID').AsString);
|
|||
|
|
PState:=2;
|
|||
|
|
if ShowModal=1 then
|
|||
|
|
begin
|
|||
|
|
Self.InitGridBankMain();
|
|||
|
|
end;
|
|||
|
|
end;
|
|||
|
|
finally
|
|||
|
|
frmGSInPutMainBank.Free;
|
|||
|
|
end;
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
procedure TfrmGSListBankSel.TV3DblClick(Sender: TObject);
|
|||
|
|
begin
|
|||
|
|
if CDS_HZ3.IsEmpty then Exit;
|
|||
|
|
ModalResult:=1;
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
end.
|
|||
|
|
|
|||
|
|
|