884 lines
23 KiB
ObjectPascal
884 lines
23 KiB
ObjectPascal
unit U_GYSListPB;
|
||
|
||
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
|
||
TfrmGYSListPB = class(TForm)
|
||
ToolBar1: TToolBar;
|
||
TBRafresh: TToolButton;
|
||
TBDel: TToolButton;
|
||
TBClose: TToolButton;
|
||
ADOQueryTemp: TADOQuery;
|
||
ADOQueryCmd: TADOQuery;
|
||
Panel1: TPanel;
|
||
ToolButton2: TToolButton;
|
||
ADOQueryMain: TADOQuery;
|
||
TBExport: TToolButton;
|
||
zjm: TEdit;
|
||
cxGridPopupMenu2: TcxGridPopupMenu;
|
||
DS_HZ: TDataSource;
|
||
CDS_HZ: TClientDataSet;
|
||
Tadd: TToolButton;
|
||
Label5: TLabel;
|
||
KHNameJC: TEdit;
|
||
DS_HZ3: TDataSource;
|
||
CDS_HZ3: TClientDataSet;
|
||
cxGridPopupMenu4: TcxGridPopupMenu;
|
||
Label2: TLabel;
|
||
Tchk: TToolButton;
|
||
TNochk: TToolButton;
|
||
Label4: TLabel;
|
||
SHStatus: TComboBox;
|
||
Label1: TLabel;
|
||
KHJYFanWei: TEdit;
|
||
Label3: TLabel;
|
||
cxGrid1: TcxGrid;
|
||
TV1: TcxGridDBTableView;
|
||
V1Column4: TcxGridDBColumn;
|
||
V1Column1: TcxGridDBColumn;
|
||
cxGYSName: TcxGridDBColumn;
|
||
cxGridDBGYSNameZC: TcxGridDBColumn;
|
||
B1GYSFZRen: TcxGridDBColumn;
|
||
cxGridDBGYSTel: TcxGridDBColumn;
|
||
V1SHStatus: TcxGridDBColumn;
|
||
V1FZR: TcxGridDBColumn;
|
||
V1GYSCodeFW: TcxGridDBColumn;
|
||
cxGridLevel2: TcxGridLevel;
|
||
PopupMenu1: TPopupMenu;
|
||
MainEdit: TMenuItem;
|
||
MainView: TMenuItem;
|
||
TBFJUp1: TPopupMenu;
|
||
BankEdit: TMenuItem;
|
||
BankDel: TMenuItem;
|
||
BankView: TMenuItem;
|
||
cxGrid3: TcxGrid;
|
||
TV3: TcxGridDBTableView;
|
||
V3Column2: TcxGridDBColumn;
|
||
V3BankName: TcxGridDBColumn;
|
||
V3BankNo: TcxGridDBColumn;
|
||
V3Column3: TcxGridDBColumn;
|
||
cxGridLevel3: TcxGridLevel;
|
||
TBOwner: TToolButton;
|
||
V1KHType: TcxGridDBColumn;
|
||
LabKHType: TLabel;
|
||
KHType: TBtnEditC;
|
||
TBAddBank: TMenuItem;
|
||
FZR: TComboBox;
|
||
TBGYSTYpe: TToolButton;
|
||
V3Column1: TcxGridDBColumn;
|
||
V1Column2: TcxGridDBColumn;
|
||
Label6: TLabel;
|
||
KHQuYu: TEdit;
|
||
cxStyleRepository1: TcxStyleRepository;
|
||
cxStyle1: TcxStyle;
|
||
TBFJUp: TMenuItem;
|
||
TBFJView: TMenuItem;
|
||
V1Column3: TcxGridDBColumn;
|
||
procedure FormDestroy(Sender: TObject);
|
||
procedure FormClose(Sender: TObject; var Action: TCloseAction);
|
||
procedure TBCloseClick(Sender: TObject);
|
||
procedure TBDelClick(Sender: TObject);
|
||
procedure FormShow(Sender: TObject);
|
||
procedure TBRafreshClick(Sender: TObject);
|
||
procedure ToolButton2Click(Sender: TObject);
|
||
procedure zjmChange(Sender: TObject);
|
||
procedure TBExportClick(Sender: TObject);
|
||
procedure TaddClick(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 TchkClick(Sender: TObject);
|
||
procedure TNochkClick(Sender: TObject);
|
||
procedure MainEditClick(Sender: TObject);
|
||
procedure MainViewClick(Sender: TObject);
|
||
procedure BankEditClick(Sender: TObject);
|
||
procedure BankDelClick(Sender: TObject);
|
||
procedure BankViewClick(Sender: TObject);
|
||
procedure TV3DblClick(Sender: TObject);
|
||
procedure TBOwnerClick(Sender: TObject);
|
||
procedure KHTypeBtnUpClick(Sender: TObject);
|
||
procedure KHTypeBtnDnClick(Sender: TObject);
|
||
procedure TBAddBankClick(Sender: TObject);
|
||
procedure TBGYSTYpeClick(Sender: TObject);
|
||
procedure V1SHStatusCustomDrawCell(Sender: TcxCustomGridTableView;
|
||
ACanvas: TcxCanvas; AViewInfo: TcxGridTableDataCellViewInfo;
|
||
var ADone: Boolean);
|
||
procedure TBFJUpClick(Sender: TObject);
|
||
procedure TBFJViewClick(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
|
||
//frmGYSListPB: TfrmGYSListPB;
|
||
|
||
implementation
|
||
uses
|
||
U_DataLink,U_RTFun,U_ZDYHelp, U_FjList_RZ,U_PBGYSInPutMain,U_PBGYSInPut,U_PBGYSInPutSub,U_PBGYSInPutGR
|
||
,U_PBGYSInPutMainBank,U_PBGYSInPutSubBank,U_UserMoreSel, U_SCPerson,
|
||
U_FjList;
|
||
|
||
{$R *.dfm}
|
||
procedure TfrmGYSListPB.setstatus();
|
||
begin
|
||
tchk.Visible:=false;
|
||
tnochk.Visible:=false;
|
||
Tadd.Visible:=false;
|
||
TBDel.Visible:=false;
|
||
canshu2:='GYS';
|
||
IF trim(Self.Caption)='<27><>Ӧ<EFBFBD><D3A6><EFBFBD><EFBFBD>Ϣ¼<CFA2><C2BC>(<28><>)*'then
|
||
begin
|
||
Tadd.Visible:=True;
|
||
LabKHType.Visible:=True;
|
||
KHType.Visible:=True;
|
||
TBAddBank.Visible:=True;
|
||
TBDel.Visible:=True;
|
||
tchk.Visible:=False;
|
||
tNochk.Visible:=False;
|
||
MainEdit.Visible:=True;
|
||
MainView.Visible:=True;
|
||
TBExport.Visible:=True;
|
||
BankEdit.Visible:=True;
|
||
BankDel.Visible:=True;
|
||
BankView.Visible:=True;
|
||
TBOwner.Visible:=True;
|
||
canshu1:='<27><>Ȩ<EFBFBD><C8A8>';
|
||
TBGYSTYpe.Visible:=True;
|
||
V1Column4.Visible:=False;
|
||
V1Column4.Hidden:=True;
|
||
TBFJUp.Visible:=True;
|
||
TBFJView.Visible:=True;
|
||
end else
|
||
IF trim(Self.Caption)='<27><>Ӧ<EFBFBD><D3A6><EFBFBD><EFBFBD>Ϣ<EFBFBD><CFA2><EFBFBD><EFBFBD>*'then
|
||
begin
|
||
LabKHType.Visible:=True;
|
||
KHType.Visible:=True;
|
||
Tadd.Visible:=false;
|
||
TBAddBank.Visible:=false;
|
||
TBDel.Visible:=false;
|
||
tchk.Visible:=True;
|
||
tNochk.Visible:=True;
|
||
MainEdit.Visible:=False;
|
||
MainView.Visible:=True;
|
||
TBExport.Visible:=True;
|
||
BankEdit.Visible:=false;
|
||
BankDel.Visible:=false;
|
||
BankView.Visible:=True;
|
||
TBOwner.Visible:=False;
|
||
V1Column4.Visible:=True;
|
||
V1Column4.Hidden:=False;
|
||
TBFJUp.Visible:=True;
|
||
TBFJView.Visible:=True;
|
||
end else
|
||
IF trim(Self.Caption)='<27><>Ӧ<EFBFBD><D3A6><EFBFBD><EFBFBD>Ϣ¼<CFA2><C2BC>*'then
|
||
begin
|
||
LabKHType.Visible:=True;
|
||
KHType.Visible:=True;
|
||
Tadd.Visible:=True;
|
||
Tadd.Caption:='<27><><EFBFBD>ӹ<EFBFBD>Ӧ<EFBFBD><D3A6>';
|
||
TBAddBank.Visible:=True;
|
||
TBDel.Visible:=False;
|
||
tchk.Visible:=False;
|
||
tNochk.Visible:=False;
|
||
MainEdit.Visible:=True;
|
||
MainView.Visible:=True;
|
||
TBExport.Visible:=True;
|
||
BankEdit.Visible:=True;
|
||
BankDel.Visible:=True;
|
||
BankView.Visible:=True;
|
||
TBOwner.Visible:=False;
|
||
canshu1:='¼<><C2BC>';
|
||
V1Column4.Visible:=False;
|
||
V1Column4.Hidden:=True;
|
||
TBFJUp.Visible:=True;
|
||
TBFJView.Visible:=True;
|
||
end else
|
||
IF trim(Self.Caption)='<27><>Ӧ<EFBFBD><D3A6><EFBFBD><EFBFBD>Ϣ<EFBFBD><CFA2>ѯ*'then
|
||
begin
|
||
LabKHType.Visible:=True;
|
||
KHType.Visible:=True;
|
||
Tadd.Visible:=False;
|
||
TBAddBank.Visible:=False;
|
||
TBDel.Visible:=False;
|
||
tchk.Visible:=False;
|
||
tNochk.Visible:=False;
|
||
MainEdit.Visible:=False;
|
||
MainView.Visible:=True;
|
||
TBExport.Visible:=False;
|
||
BankEdit.Visible:=False;
|
||
BankDel.Visible:=False;
|
||
BankView.Visible:=True;
|
||
TBOwner.Visible:=False;
|
||
V1Column4.Visible:=False;
|
||
V1Column4.Hidden:=True;
|
||
TBFJView.Visible:=True;
|
||
end;
|
||
end;
|
||
|
||
procedure TfrmGYSListPB.InitGrid();
|
||
begin
|
||
with ADOQueryMain do
|
||
begin
|
||
Filtered:=False;
|
||
Close;
|
||
SQL.Clear;
|
||
sql.Add(' select *,zjm=dbo.getpinyin(KHName) ');
|
||
sql.add(',SHStatus=(case when isnull(status,''0'')=''0'' then ''δ<><CEB4><EFBFBD><EFBFBD>'' else ''<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>'' end)');
|
||
sql.Add(',SDQty=(select Count(*) from TP_File TF where TF.WBID=A.KHMainId and TF.TFType=''<27><>Ӧ<EFBFBD><D3A6><EFBFBD><EFBFBD><EFBFBD><EFBFBD>'' )');
|
||
sql.Add(' from KH_Main A ');
|
||
sql.add(' where isnull(KHFlag,'''')='''+Trim(canshu2)+''' and isnull(Valid,'''')=''Y'' ');
|
||
if Trim(canshu1)='¼<><C2BC>' then
|
||
begin
|
||
sql.Add(' and exists(select * from KH_Owner B where B.KHMainId=A.KHMainId and B.UserName='''+Trim(DName)+''')');
|
||
end;
|
||
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 TfrmGYSListPB.FormDestroy(Sender: TObject);
|
||
begin
|
||
//frmGYSListPB:=nil;
|
||
end;
|
||
|
||
procedure TfrmGYSListPB.FormClose(Sender: TObject; var Action: TCloseAction);
|
||
begin
|
||
Action:=caFree;
|
||
end;
|
||
|
||
procedure TfrmGYSListPB.TBCloseClick(Sender: TObject);
|
||
begin
|
||
WriteCxGrid('PBGYS11YX',Tv1,'<27><>Ӧ<EFBFBD>̹<EFBFBD><CCB9><EFBFBD>');
|
||
WriteCxGrid('PBGYS31YX',Tv3,'<27><>Ӧ<EFBFBD>̹<EFBFBD><CCB9><EFBFBD>');
|
||
Close;
|
||
end;
|
||
procedure TfrmGYSListPB.TBDelClick(Sender: TObject);
|
||
begin
|
||
if CDS_HZ.IsEmpty then exit;
|
||
{if CDS_HZ.Locate('ssel',true,[])=false then
|
||
begin
|
||
Application.MessageBox('û<><C3BB>ѡ<EFBFBD><D1A1><EFBFBD><EFBFBD><EFBFBD><EFBFBD>!','<27><>ʾ',0);
|
||
Exit;
|
||
end;}
|
||
if Trim(canshu1)<>'<27><>Ȩ<EFBFBD><C8A8>' then
|
||
begin
|
||
if Trim(CDS_HZ.fieldbyname('FillerCode').AsString)<>Trim(DCode) then
|
||
begin
|
||
Application.MessageBox('<27><><EFBFBD>ܲ<EFBFBD><DCB2><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>¼<EFBFBD><C2BC><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>!','<27><>ʾ',0);
|
||
Exit;
|
||
end;
|
||
with ADOQueryTemp do
|
||
begin
|
||
Close;
|
||
sql.Clear;
|
||
sql.Add('select * from KH_Main where KHMainId='''+Trim(CDS_HZ.fieldbyname('KHMainId').AsString)+'''');
|
||
Open;
|
||
end;
|
||
if Trim(ADOQueryTemp.fieldbyname('SHStatus').AsString)='<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>' then
|
||
begin
|
||
Application.MessageBox('<27><><EFBFBD><EFBFBD><EFBFBD>˲<EFBFBD><CBB2>ܲ<EFBFBD><DCB2><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>!','<27><>ʾ',0);
|
||
Exit;
|
||
end;
|
||
end;
|
||
if Application.MessageBox('ȷ<><C8B7>Ҫɾ<D2AA><C9BE><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>','<27><>ʾ',32+4)<>IDYES then Exit;
|
||
try
|
||
ADOQueryCmd.Connection.BeginTrans;
|
||
CDS_HZ.DisableControls;
|
||
with CDS_HZ do
|
||
begin
|
||
// while Locate('SSel',True,[]) do
|
||
begin
|
||
with ADOQueryCmd do
|
||
begin
|
||
Close;
|
||
SQL.Clear;
|
||
sql.Add('UPdate KH_Main Set Valid=''N'',DelTime=getdate(),Deler='''+Trim(DName)+''',DelerCode='''+Trim(DCode)+'''');
|
||
sql.Add(' where KHMainID='''+Trim(CDS_HZ.fieldbyname('KHMainID').AsString)+'''');
|
||
|
||
sql.Add('UPdate KH_Sub_Bank Set Valid=''N'',DelTime=getdate(),Deler='''+Trim(DName)+''',DelerCode='''+Trim(DCode)+'''');
|
||
sql.Add(' where KHMainID='''+Trim(CDS_HZ.fieldbyname('KHMainID').AsString)+'''');
|
||
ExecSQL;
|
||
end;
|
||
CDS_HZ.Delete;
|
||
end;
|
||
end;
|
||
CDS_HZ.EnableControls;
|
||
ADOQueryCmd.Connection.CommitTrans;
|
||
except
|
||
ADOQueryCmd.Connection.RollbackTrans;
|
||
Application.MessageBox('<27><><EFBFBD><EFBFBD>ʧ<EFBFBD><CAA7>!','<27><>ʾ',0);
|
||
CDS_HZ.EnableControls;
|
||
end;
|
||
end;
|
||
|
||
procedure TfrmGYSListPB.FormShow(Sender: TObject);
|
||
var
|
||
fsj:String;
|
||
begin
|
||
fsj:='select Name=UserName from KH_Owner A inner join KH_Main B on A.KHMainId=B.KHMainId and B.KHFlag=''GYS'''+
|
||
' and A.Valid=''Y'' and B.Valid=''Y'' and A.USERID<>''ADMIN'' Group by A.UserName ';
|
||
SInitComBoxBySql(ADOQueryTemp,FZR,False,fsj);
|
||
ReadCxGrid('PBGYS11YX',Tv1,'<27><>Ӧ<EFBFBD>̹<EFBFBD><CCB9><EFBFBD>');
|
||
ReadCxGrid('PBGYS31YX',Tv3,'<27><>Ӧ<EFBFBD>̹<EFBFBD><CCB9><EFBFBD>');
|
||
setstatus();
|
||
InitGrid();
|
||
end;
|
||
|
||
procedure TfrmGYSListPB.TBRafreshClick(Sender: TObject);
|
||
begin
|
||
ToolBar1.SetFocus;
|
||
InitGrid();
|
||
end;
|
||
|
||
procedure TfrmGYSListPB.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 TfrmGYSListPB.zjmChange(Sender: TObject);
|
||
begin
|
||
ToolButton2.Click;
|
||
end;
|
||
|
||
|
||
procedure TfrmGYSListPB.TBExportClick(Sender: TObject);
|
||
begin
|
||
if ADOQueryMain.IsEmpty then Exit;
|
||
TcxGridToExcel(self.Caption,cxgrid1);
|
||
end;
|
||
|
||
procedure TfrmGYSListPB.TaddClick(Sender: TObject);
|
||
begin
|
||
try
|
||
frmSCPerson:=TfrmSCPerson.Create(Application);
|
||
with frmSCPerson do
|
||
begin
|
||
FlagStr:='GYSType';
|
||
if ShowModal=1 then
|
||
begin
|
||
XZKHTYpe:=Trim(FSDPerson);
|
||
end;
|
||
end;
|
||
finally
|
||
frmSCPerson.Free;
|
||
end;
|
||
if Trim(XZKHTYpe)='' then Exit;
|
||
try
|
||
frmPBGYSInPutMain:=TfrmPBGYSInPutMain.Create(Application);
|
||
with frmPBGYSInPutMain do
|
||
begin
|
||
FKHMainid:='';
|
||
FKHFlag:=Trim(Self.canshu2);
|
||
frmPBGYSInPutMain.KHType.Text:=Trim(XZKHTYpe);
|
||
frmPBGYSInPutMain.KHType.Enabled:=False;
|
||
frmPBGYSInPutMain.KHType.Color:=clMenu;
|
||
if ShowModal=1 then
|
||
begin
|
||
TBRafresh.Click;
|
||
CDS_HZ.Locate('KHMainId',FKHMainid,[]);
|
||
InitGridBankMainID(FKHMainid);
|
||
end;
|
||
end;
|
||
finally
|
||
frmPBGYSInPutMain.Free;
|
||
end;
|
||
end;
|
||
|
||
procedure TfrmGYSListPB.cxTabControl1Change(Sender: TObject);
|
||
begin
|
||
setstatus();
|
||
InitGrid();
|
||
end;
|
||
|
||
procedure TfrmGYSListPB.TV1MouseDown(Sender: TObject;
|
||
Button: TMouseButton; Shift: TShiftState; X, Y: Integer);
|
||
begin
|
||
InitGridBankMain();
|
||
end;
|
||
|
||
procedure TfrmGYSListPB.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 TfrmGYSListPB.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 TfrmGYSListPB.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><D3A6><EFBFBD><EFBFBD><EFBFBD><EFBFBD>';
|
||
if Self.Caption='<27><>Ӧ<EFBFBD><D3A6><EFBFBD><EFBFBD>Ϣ<EFBFBD><CFA2>ѯ*' then
|
||
begin
|
||
fstatus:=1;
|
||
end else
|
||
begin
|
||
fstatus:=0;
|
||
end;
|
||
|
||
if ShowModal=1 then
|
||
begin
|
||
|
||
end;
|
||
end;
|
||
finally
|
||
frmFjList.Free;
|
||
end;
|
||
end;
|
||
{if CDS_HZ.IsEmpty then Exit;
|
||
try
|
||
frmPBGYSInPutMain:=TfrmPBGYSInPutMain.Create(Application);
|
||
with frmPBGYSInPutMain do
|
||
begin
|
||
FKHMainid:=Trim(Self.CDS_HZ.fieldbyname('KHMainId').AsString);
|
||
frmPBGYSInPutMain.TBSave.Visible:=False;
|
||
if ShowModal=1 then
|
||
begin
|
||
TBRafresh.Click;
|
||
end;
|
||
end;
|
||
finally
|
||
frmPBGYSInPutMain.Free;
|
||
end; }
|
||
end;
|
||
|
||
procedure TfrmGYSListPB.TchkClick(Sender: TObject);
|
||
begin
|
||
if CDS_HZ.IsEmpty then exit;
|
||
if CDS_HZ.Locate('ssel',true,[])=false then
|
||
begin
|
||
Application.MessageBox('û<><C3BB>ѡ<EFBFBD><D1A1><EFBFBD><EFBFBD><EFBFBD><EFBFBD>!','<27><>ʾ',0);
|
||
Exit;
|
||
end;
|
||
try
|
||
ADOQueryCmd.Connection.BeginTrans;
|
||
with CDS_HZ do
|
||
begin
|
||
DisableControls;
|
||
First;
|
||
while Locate('SSel',True,[]) do
|
||
begin
|
||
with ADOQueryCmd do
|
||
begin
|
||
close;
|
||
sql.Clear;
|
||
sql.Add('update KH_Main SET status=1,chker='''+trim(DName)+''',chkTime=getdate() ');
|
||
sql.Add('where KHMainid='+quotedstr(trim(CDS_HZ.fieldbyname('KHMainid').AsString)));
|
||
execsql;
|
||
end;
|
||
Edit;
|
||
FieldByName('SSel').Value:=false;
|
||
FieldByName('SHStatus').Value:='<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>';
|
||
end;
|
||
EnableControls;
|
||
end;
|
||
ADOQueryCmd.Connection.CommitTrans;
|
||
except
|
||
ADOQueryCmd.Connection.RollbackTrans;
|
||
CDS_HZ.EnableControls;
|
||
application.MessageBox('<27><><EFBFBD><EFBFBD>ʧ<EFBFBD>ܣ<EFBFBD>','<27><>ʾ<EFBFBD><CABE>Ϣ',0);
|
||
end;
|
||
end;
|
||
|
||
procedure TfrmGYSListPB.TNochkClick(Sender: TObject);
|
||
begin
|
||
if CDS_HZ.IsEmpty then exit;
|
||
if CDS_HZ.Locate('ssel',true,[])=false then
|
||
begin
|
||
Application.MessageBox('û<><C3BB>ѡ<EFBFBD><D1A1><EFBFBD><EFBFBD><EFBFBD><EFBFBD>!','<27><>ʾ',0);
|
||
Exit;
|
||
end;
|
||
try
|
||
ADOQueryCmd.Connection.BeginTrans;
|
||
with CDS_HZ do
|
||
begin
|
||
DisableControls;
|
||
First;
|
||
while Locate('SSel',True,[]) do
|
||
begin
|
||
with ADOQueryCmd do
|
||
begin
|
||
close;
|
||
sql.Clear;
|
||
sql.Add('update KH_Main SET status=0,chker='''',chkTime=null');
|
||
sql.Add('where KHMainid='+quotedstr(trim(CDS_HZ.fieldbyname('KHMainid').AsString)));
|
||
execsql;
|
||
end;
|
||
Edit;
|
||
FieldByName('SSel').Value:=false;
|
||
FieldByName('SHStatus').Value:='δ<><CEB4><EFBFBD><EFBFBD>';
|
||
end;
|
||
EnableControls;
|
||
end;
|
||
ADOQueryCmd.Connection.CommitTrans;
|
||
except
|
||
ADOQueryCmd.Connection.RollbackTrans;
|
||
CDS_HZ.EnableControls;
|
||
application.MessageBox('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʧ<EFBFBD>ܣ<EFBFBD>','<27><>ʾ<EFBFBD><CABE>Ϣ',0);
|
||
end;
|
||
end;
|
||
|
||
procedure TfrmGYSListPB.MainEditClick(Sender: TObject);
|
||
begin
|
||
if CDS_HZ.IsEmpty then Exit;
|
||
if Trim(canshu1)<>'<27><>Ȩ<EFBFBD><C8A8>' then
|
||
begin
|
||
if Trim(CDS_HZ.fieldbyname('FillerCode').AsString)<>Trim(DCode) then
|
||
begin
|
||
Application.MessageBox('<27><><EFBFBD>ܲ<EFBFBD><DCB2><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>¼<EFBFBD><C2BC><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>!','<27><>ʾ',0);
|
||
Exit;
|
||
end;
|
||
with ADOQueryTemp do
|
||
begin
|
||
Close;
|
||
sql.Clear;
|
||
sql.Add('select * from KH_Main where KHMainId='''+Trim(CDS_HZ.fieldbyname('KHMainId').AsString)+'''');
|
||
Open;
|
||
end;
|
||
if Trim(ADOQueryTemp.fieldbyname('Status').AsString)='1' then
|
||
begin
|
||
Application.MessageBox('<27><><EFBFBD><EFBFBD><EFBFBD>˲<EFBFBD><CBB2>ܲ<EFBFBD><DCB2><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>!','<27><>ʾ',0);
|
||
Exit;
|
||
end;
|
||
end;
|
||
try
|
||
frmPBGYSInPutMain:=TfrmPBGYSInPutMain.Create(Application);
|
||
with frmPBGYSInPutMain do
|
||
begin
|
||
FKHMainid:=Trim(Self.CDS_HZ.fieldbyname('KHMainId').AsString);
|
||
FKHFlag:=Trim(Self.canshu2);
|
||
if ShowModal=1 then
|
||
begin
|
||
TBRafresh.Click;
|
||
CDS_HZ.Locate('KHMainId',FKHMainid,[]);
|
||
InitGridBankMainID(FKHMainid);
|
||
end;
|
||
end;
|
||
finally
|
||
frmPBGYSInPutMain.Free;
|
||
end;
|
||
end;
|
||
|
||
procedure TfrmGYSListPB.MainViewClick(Sender: TObject);
|
||
begin
|
||
if CDS_HZ.IsEmpty then Exit;
|
||
try
|
||
frmPBGYSInPutMain:=TfrmPBGYSInPutMain.Create(Application);
|
||
with frmPBGYSInPutMain do
|
||
begin
|
||
FKHMainid:=Trim(Self.CDS_HZ.fieldbyname('KHMainId').AsString);
|
||
frmPBGYSInPutMain.TBSave.Visible:=False;
|
||
if ShowModal=1 then
|
||
begin
|
||
TBRafresh.Click;
|
||
end;
|
||
end;
|
||
finally
|
||
frmPBGYSInPutMain.Free;
|
||
end;
|
||
end;
|
||
|
||
procedure TfrmGYSListPB.BankEditClick(Sender: TObject);
|
||
begin
|
||
if CDS_HZ3.IsEmpty then exit;
|
||
if Trim(canshu1)<>'<27><>Ȩ<EFBFBD><C8A8>' then
|
||
begin
|
||
if Trim(CDS_HZ3.fieldbyname('FillerCode').AsString)<>Trim(DCode) then
|
||
begin
|
||
Application.MessageBox('<27><><EFBFBD>ܲ<EFBFBD><DCB2><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>¼<EFBFBD><C2BC><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>!','<27><>ʾ',0);
|
||
Exit;
|
||
end;
|
||
end;
|
||
try
|
||
frmPBGYSInPutMainBank:=TfrmPBGYSInPutMainBank.Create(Application);
|
||
with frmPBGYSInPutMainBank do
|
||
begin
|
||
FKHMainid:=Trim(Self.CDS_HZ.fieldbyname('KHMainId').AsString);
|
||
FBKID:=Trim(Self.CDS_HZ3.fieldbyname('BKID').AsString);
|
||
PState:=1;
|
||
if ShowModal=1 then
|
||
begin
|
||
Self.InitGridBankMain();
|
||
end;
|
||
end;
|
||
finally
|
||
frmPBGYSInPutMainBank.Free;
|
||
end;
|
||
|
||
end;
|
||
|
||
procedure TfrmGYSListPB.BankDelClick(Sender: TObject);
|
||
begin
|
||
IF CDS_HZ3.IsEmpty then exit;
|
||
if Trim(canshu1)<>'<27><>Ȩ<EFBFBD><C8A8>' then
|
||
begin
|
||
if Trim(CDS_HZ3.fieldbyname('FillerCode').AsString)<>Trim(DCode) then
|
||
begin
|
||
Application.MessageBox('<27><><EFBFBD>ܲ<EFBFBD><DCB2><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>¼<EFBFBD><C2BC><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>!','<27><>ʾ',0);
|
||
Exit;
|
||
end;
|
||
end;
|
||
if Application.MessageBox('ȷ<><C8B7>Ҫɾ<D2AA><C9BE><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>','<27><>ʾ',32+4)<>IDYES then Exit;
|
||
with ADOQueryCmd do
|
||
begin
|
||
Close;
|
||
SQL.Clear;
|
||
sql.Add('Update KH_Sub_Bank Set Valid=''N'',DelTime=getdate(),Deler='''+Trim(DName)+''',DelerCode='''+Trim(DCode)+'''');
|
||
sql.add('where BKID='''+Trim(CDS_HZ3.fieldbyname('BKID').AsString)+'''');
|
||
ExecSQL;
|
||
end;
|
||
CDS_HZ3.Delete;
|
||
end;
|
||
|
||
procedure TfrmGYSListPB.BankViewClick(Sender: TObject);
|
||
begin
|
||
try
|
||
frmPBGYSInPutMainBank:=TfrmPBGYSInPutMainBank.Create(Application);
|
||
with frmPBGYSInPutMainBank 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
|
||
frmPBGYSInPutMainBank.Free;
|
||
end;
|
||
end;
|
||
|
||
procedure TfrmGYSListPB.TV3DblClick(Sender: TObject);
|
||
begin
|
||
BankView.Click;
|
||
end;
|
||
|
||
procedure TfrmGYSListPB.TBOwnerClick(Sender: TObject);
|
||
begin
|
||
if CDS_HZ.IsEmpty then Exit;
|
||
try
|
||
frmUserMoreSel:=TfrmUserMoreSel.Create(Application);
|
||
with frmUserMoreSel do
|
||
begin
|
||
KHMainId:=Trim(Self.CDS_HZ.fieldbyname('KHMainId').AsString);
|
||
FYWY:=Trim(Self.CDS_HZ.fieldbyname('FZR').AsString);
|
||
FKOType:='<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>';
|
||
if ShowModal=1 then
|
||
begin
|
||
with Self.CDS_HZ do
|
||
begin
|
||
Edit;
|
||
FieldByName('FZR').Value:=frmUserMoreSel.FYWY;
|
||
end;
|
||
end;
|
||
end;
|
||
finally
|
||
frmUserMoreSel.Free;
|
||
end;
|
||
end;
|
||
|
||
procedure TfrmGYSListPB.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 TfrmGYSListPB.KHTypeBtnDnClick(Sender: TObject);
|
||
begin
|
||
KHType.Text:='';
|
||
KHType.TxtCode:='';
|
||
ToolButton2.Click;
|
||
end;
|
||
|
||
procedure TfrmGYSListPB.TBAddBankClick(Sender: TObject);
|
||
begin
|
||
if CDS_HZ.IsEmpty then exit;
|
||
try
|
||
frmPBGYSInPutMainBank:=TfrmPBGYSInPutMainBank.Create(Application);
|
||
with frmPBGYSInPutMainBank do
|
||
begin
|
||
FKHMainid:=Trim(CDS_HZ.fieldbyname('KHMainId').AsString);
|
||
PState:=0;
|
||
if ShowModal=1 then
|
||
begin
|
||
Self.InitGridBankMain();
|
||
end;
|
||
end;
|
||
finally
|
||
frmPBGYSInPutMainBank.Free;
|
||
end;
|
||
end;
|
||
|
||
procedure TfrmGYSListPB.TBGYSTYpeClick(Sender: TObject);
|
||
begin
|
||
try
|
||
frmZDYHelp:=TfrmZDYHelp.Create(Application);
|
||
with frmZDYHelp do
|
||
begin
|
||
flag:='GYSType';
|
||
flagname:='<27><>Ӧ<EFBFBD><D3A6><EFBFBD><EFBFBD><EFBFBD><EFBFBD>';
|
||
if ShowModal=1 then
|
||
begin
|
||
|
||
end;
|
||
end;
|
||
finally
|
||
frmZDYHelp.Free;
|
||
end;
|
||
end;
|
||
|
||
procedure TfrmGYSListPB.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 TfrmGYSListPB.TBFJUpClick(Sender: TObject);
|
||
begin
|
||
if CDS_HZ3.IsEmpty then Exit;
|
||
try
|
||
frmFjList:=TfrmFjList.Create(Application);
|
||
with frmFjList do
|
||
begin
|
||
fkeyNO:=Trim(CDS_HZ3.fieldbyname('BKID').AsString);
|
||
fType:='<27><>Ʊ<EFBFBD><C6B1><EFBFBD><EFBFBD>';
|
||
fstatus:=0;
|
||
if ShowModal=1 then
|
||
begin
|
||
|
||
end;
|
||
end;
|
||
finally
|
||
frmFjList.Free;
|
||
end;
|
||
end;
|
||
|
||
procedure TfrmGYSListPB.TBFJViewClick(Sender: TObject);
|
||
begin
|
||
if CDS_HZ3.IsEmpty then Exit;
|
||
try
|
||
frmFjList:=TfrmFjList.Create(Application);
|
||
with frmFjList do
|
||
begin
|
||
fkeyNO:=Trim(CDS_HZ3.fieldbyname('BKID').AsString);
|
||
fType:='<27><>Ʊ<EFBFBD><C6B1><EFBFBD><EFBFBD>';
|
||
fstatus:=1;
|
||
if ShowModal=1 then
|
||
begin
|
||
|
||
end;
|
||
end;
|
||
finally
|
||
frmFjList.Free;
|
||
end;
|
||
end;
|
||
|
||
end.
|
||
|
||
|