864 lines
24 KiB
ObjectPascal
864 lines
24 KiB
ObjectPascal
unit U_ZdyAttInputGYS;
|
||
|
||
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, cxDropDownEdit, cxPC;
|
||
|
||
type
|
||
TfrmZdyAttInputGYS = class(TForm)
|
||
ADOQueryTemp: TADOQuery;
|
||
ADOQueryCmd: TADOQuery;
|
||
ADOQueryMain: TADOQuery;
|
||
RM1: TRMGridReport;
|
||
RMDB_Main: TRMDBDataSet;
|
||
cxGridPopupMenu2: TcxGridPopupMenu;
|
||
DS_HZ: TDataSource;
|
||
CDS_HZ: TClientDataSet;
|
||
Panel2: TPanel;
|
||
cxGridPopupMenu1: TcxGridPopupMenu;
|
||
DS_HZ2: TDataSource;
|
||
CDS_HZ2: TClientDataSet;
|
||
ADOQueryMain2: TADOQuery;
|
||
cxGridPopupMenu3: TcxGridPopupMenu;
|
||
DS_HZ3: TDataSource;
|
||
ADOQueryMain3: TADOQuery;
|
||
CDS_HZ3: TClientDataSet;
|
||
ToolBar2: TToolBar;
|
||
ToolButton2: TToolButton;
|
||
ToolButton4: TToolButton;
|
||
Panel4: TPanel;
|
||
Label1: TLabel;
|
||
Label9: TLabel;
|
||
TFJ: TToolButton;
|
||
Panel5: TPanel;
|
||
Label11: TLabel;
|
||
Panel3: TPanel;
|
||
ToolBar3: TToolBar;
|
||
ToolButton5: TToolButton;
|
||
ToolButton6: TToolButton;
|
||
Panel6: TPanel;
|
||
Label12: TLabel;
|
||
cxGrid3: TcxGrid;
|
||
TV3: TcxGridDBTableView;
|
||
cxGridDBBankNo: TcxGridDBColumn;
|
||
cxGridDBBankName: TcxGridDBColumn;
|
||
cxGridLevel3: TcxGridLevel;
|
||
Panel7: TPanel;
|
||
Label15: TLabel;
|
||
Label16: TLabel;
|
||
KHMXAdd: TMemo;
|
||
KHMXSJAdd: TMemo;
|
||
Label13: TLabel;
|
||
Label14: TLabel;
|
||
KHMXLXR: TEdit;
|
||
KHMXTel: TEdit;
|
||
Label17: TLabel;
|
||
KHMXNote: TMemo;
|
||
Label18: TLabel;
|
||
Label19: TLabel;
|
||
KHMXName: TEdit;
|
||
Label20: TLabel;
|
||
KHMXJC: TEdit;
|
||
Label22: TLabel;
|
||
KHMXSH: TEdit;
|
||
KHSubid: TEdit;
|
||
Panel8: TPanel;
|
||
Label3: TLabel;
|
||
Label4: TLabel;
|
||
Label5: TLabel;
|
||
Label6: TLabel;
|
||
Label7: TLabel;
|
||
Label8: TLabel;
|
||
Label10: TLabel;
|
||
GYSName: TEdit;
|
||
GYSFZRen: TEdit;
|
||
GYSNameZC: TEdit;
|
||
GYSTel: TEdit;
|
||
GYSCodeFW: TMemo;
|
||
Note: TMemo;
|
||
GYSAdd: TMemo;
|
||
ToolBar1: TToolBar;
|
||
ToolButton3: TToolButton;
|
||
Panel1: TPanel;
|
||
Label2: TLabel;
|
||
GYSNo: TEdit;
|
||
Panel9: TPanel;
|
||
ToolBar4: TToolBar;
|
||
ToolButton1: TToolButton;
|
||
Panel10: TPanel;
|
||
Label21: TLabel;
|
||
cxGrid2: TcxGrid;
|
||
TV2: TcxGridDBTableView;
|
||
V2KHMXNo: TcxGridDBColumn;
|
||
cxGridDBKHMXName: TcxGridDBColumn;
|
||
V2ZKHMXJC: TcxGridDBColumn;
|
||
cxGridDBCKHMXSH: TcxGridDBColumn;
|
||
cxGridDBKHMXTel: TcxGridDBColumn;
|
||
cxGridDBKHMXLXR: TcxGridDBColumn;
|
||
cxGridDBKHMXNote: TcxGridDBColumn;
|
||
cxGridLevel1: TcxGridLevel;
|
||
V2KHMXAdd: TcxGridDBColumn;
|
||
V2KHMXSJAdd: TcxGridDBColumn;
|
||
ToolButton7: TToolButton;
|
||
ToolButton8: TToolButton;
|
||
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 ToolButton4Click(Sender: TObject);
|
||
procedure ToolButton5Click(Sender: TObject);
|
||
procedure ToolButton6Click(Sender: TObject);
|
||
procedure TFJClick(Sender: TObject);
|
||
procedure TV2MouseDown(Sender: TObject; Button: TMouseButton;
|
||
Shift: TShiftState; X, Y: Integer);
|
||
procedure ToolButton1Click(Sender: TObject);
|
||
procedure ToolButton8Click(Sender: TObject);
|
||
procedure ToolButton7Click(Sender: TObject);
|
||
private
|
||
{ Private declarations }
|
||
procedure InitGrid();
|
||
function SaveData():Boolean;
|
||
function SaveData2():Boolean;
|
||
procedure SSetsaveSqlNewTClient(ADOQueryCmd:TClientDataSet;
|
||
Myparent:TWinControl;MyTag:integer);
|
||
procedure SCSHDataNewTclient(ADOQueryTmp:TClientDataSet;mParent:TWinControl;FTag:Integer);
|
||
public
|
||
{ Public declarations }
|
||
RKFlag,FKHMainid,formid:String;
|
||
fDEFstr5:string;
|
||
end;
|
||
var
|
||
frmZdyAttInputGYS: TfrmZdyAttInputGYS;
|
||
|
||
implementation
|
||
uses
|
||
U_DataLink,U_Fun,U_ZDYHelp,U_FjList_RZ;
|
||
|
||
{$R *.dfm}
|
||
|
||
procedure TfrmZdyAttInputGYS.InitGrid();
|
||
begin
|
||
with ADOQueryMain do
|
||
begin
|
||
Filtered:=False;
|
||
Close;
|
||
SQL.Clear;
|
||
sql.Add('select * from KH_Main where KHMainID='''+Trim(FKHMainid)+'''');
|
||
Open;
|
||
end;
|
||
//<2F><><EFBFBD><EFBFBD>
|
||
if ADOQueryMain.IsEmpty=false then
|
||
SCSHDataNew(ADOQueryMain,panel8,2)
|
||
else
|
||
begin
|
||
//GYSFZRen.Text:=Trim(DName);
|
||
end;
|
||
//<2F><>2
|
||
with ADOQueryMain2 do
|
||
begin
|
||
Filtered:=False;
|
||
Close;
|
||
SQL.Clear;
|
||
sql.Add(' select * from KH_Sub where KHMainid='''+Trim(FKHMainid)+'''');
|
||
sql.Add(' order by XHNO');
|
||
Open;
|
||
end;
|
||
SCreateCDS20(ADOQueryMain2,CDS_HZ2);
|
||
SInitCDSData20(ADOQueryMain2,CDS_HZ2);
|
||
//<2F><>3
|
||
with ADOQueryMain3 do
|
||
begin
|
||
Filtered:=False;
|
||
Close;
|
||
SQL.Clear;
|
||
sql.Add(' select * from KH_Sub_Bank where KHSubid='''+Trim(KHSubid.Text)+'''');
|
||
Open;
|
||
end;
|
||
SCreateCDS20(ADOQueryMain3,CDS_HZ3);
|
||
SInitCDSData20(ADOQueryMain3,CDS_HZ3);
|
||
if CDS_HZ3.IsEmpty then
|
||
begin
|
||
with CDS_HZ3 do
|
||
begin
|
||
append;
|
||
post;
|
||
end;
|
||
end;
|
||
end;
|
||
|
||
procedure TfrmZdyAttInputGYS.FormDestroy(Sender: TObject);
|
||
begin
|
||
frmZdyAttInputGYS:=nil;
|
||
end;
|
||
|
||
procedure TfrmZdyAttInputGYS.FormClose(Sender: TObject; var Action: TCloseAction);
|
||
begin
|
||
Action:=caFree;
|
||
end;
|
||
|
||
procedure TfrmZdyAttInputGYS.TBCloseClick(Sender: TObject);
|
||
begin
|
||
WriteCxGrid('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ӧ<EFBFBD><D3A6><EFBFBD><EFBFBD><EFBFBD><EFBFBD>¼<EFBFBD><C2BC>1',Tv2,'<27>ͻ<EFBFBD><CDBB>Զ<EFBFBD><D4B6><EFBFBD>');
|
||
WriteCxGrid('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ӧ<EFBFBD><D3A6><EFBFBD><EFBFBD><EFBFBD><EFBFBD>¼<EFBFBD><C2BC>2',Tv3,'<27>ͻ<EFBFBD><CDBB>Զ<EFBFBD><D4B6><EFBFBD>');
|
||
Close;
|
||
end;
|
||
procedure TfrmZdyAttInputGYS.FormShow(Sender: TObject);
|
||
begin
|
||
ReadCxGrid('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ӧ<EFBFBD><D3A6><EFBFBD><EFBFBD><EFBFBD><EFBFBD>¼<EFBFBD><C2BC>1',Tv2,'<27>ͻ<EFBFBD><CDBB>Զ<EFBFBD><D4B6><EFBFBD>');
|
||
ReadCxGrid('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ӧ<EFBFBD><D3A6><EFBFBD><EFBFBD><EFBFBD><EFBFBD>¼<EFBFBD><C2BC>2',Tv3,'<27>ͻ<EFBFBD><CDBB>Զ<EFBFBD><D4B6><EFBFBD>');
|
||
InitGrid();
|
||
end;
|
||
|
||
procedure TfrmZdyAttInputGYS.TBRafreshClick(Sender: TObject);
|
||
begin
|
||
InitGrid();
|
||
end;
|
||
|
||
procedure TfrmZdyAttInputGYS.SSetsaveSqlNewTClient(ADOQueryCmd:TClientDataSet;
|
||
Myparent:TWinControl;MyTag:integer);
|
||
var
|
||
i:Integer;
|
||
MCode:String;
|
||
begin
|
||
with Myparent do
|
||
begin
|
||
for i:=0 to ControlCount-1 do
|
||
begin
|
||
if Controls[i].Tag=MyTag then
|
||
begin
|
||
if Controls[i] is TEdit then
|
||
begin
|
||
if Trim(TEdit(Controls[i]).Text)<>'' then
|
||
ADOQueryCmd.FieldByName(Controls[i].Name).Value:=Trim(TEdit(Controls[i]).Text)
|
||
else
|
||
ADOQueryCmd.FieldByName(Controls[i].Name).Value:=Null;
|
||
end else
|
||
if Controls[i] is TRichEdit then
|
||
begin
|
||
ADOQueryCmd.FieldByName(Controls[i].Name).Value:=TRichEdit(Controls[i]).Text;
|
||
end else
|
||
if Controls[i] is TCheckBox then
|
||
begin
|
||
if TCheckBox(Controls[i]).Checked=True then
|
||
ADOQueryCmd.FieldByName(Controls[i].Name).Value:=1
|
||
else
|
||
ADOQueryCmd.FieldByName(Controls[i].Name).Value:=0;
|
||
end else
|
||
if Controls[i] is TMemo then
|
||
begin
|
||
ADOQueryCmd.FieldByName(Controls[i].Name).Value:=TMemo(Controls[i]).Text;
|
||
end else
|
||
|
||
if Controls[i] is TComboBox then
|
||
begin
|
||
ADOQueryCmd.FieldByName(Controls[i].Name).Value:=Trim(TComboBox(Controls[i]).Text);
|
||
end else
|
||
if Controls[i] is TDateTimePicker then
|
||
begin
|
||
if TDateTimePicker(Controls[i]).ShowCheckbox then
|
||
begin
|
||
if TDateTimePicker(Controls[i]).Checked then
|
||
ADOQueryCmd.FieldByName(Controls[i].Name).Value:=TDateTimePicker(Controls[i]).DateTime
|
||
else
|
||
ADOQueryCmd.FieldByName(Controls[i].Name).Value:=null;
|
||
end else
|
||
ADOQueryCmd.FieldByName(Controls[i].Name).Value:=TDateTimePicker(Controls[i]).DateTime;
|
||
end else
|
||
if Controls[i] is TcxButtonEdit then
|
||
begin
|
||
if (TcxButtonEdit(Controls[i]).BeepOnEnter=True) or (TcxButtonEdit(Controls[i]).ParentShowHint=True) then
|
||
ADOQueryCmd.FieldByName(Controls[i].Name).Value:=Trim(TcxButtonEdit(Controls[i]).Text);
|
||
if TcxButtonEdit(Controls[i]).ParentShowHint=False then
|
||
begin
|
||
MCode:=Copy(Trim(Controls[i].Name),1,Length(Trim(Controls[i].Name))-4);
|
||
ADOQueryCmd.FieldByName(MCode).Value:=Trim(TcxButtonEdit(Controls[i]).Hint);
|
||
end;
|
||
end;
|
||
end;
|
||
end;
|
||
end;
|
||
end;
|
||
|
||
function TfrmZdyAttInputGYS.SaveData():Boolean;
|
||
var
|
||
maxId,CRID,fzdyCode,FYSSubId,maxno,maxnum,FMXNO:String;
|
||
begin
|
||
///ȡmaxId
|
||
result:=false;
|
||
ADOQueryCmd.Connection.BeginTrans;
|
||
if Trim(FKHMainid)='' then
|
||
begin
|
||
if GetLSNo(ADOQueryCmd,maxId,'KH','KH_Main',4,1)=False then
|
||
begin
|
||
Result:=False;
|
||
ADOQueryCmd.Connection.RollbackTrans;
|
||
Application.MessageBox('ȡ<><C8A1><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʧ<EFBFBD>ܣ<EFBFBD>','<27><>ʾ',0);
|
||
Exit;
|
||
end;
|
||
if GetLSNo(ADOQueryCmd,fzdyCode,'PB','KH_Main',4,0)=False then
|
||
begin
|
||
Result:=False;
|
||
ADOQueryCmd.Connection.RollbackTrans;
|
||
Application.MessageBox('ȡ<><C8A1><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʧ<EFBFBD>ܣ<EFBFBD>','<27><>ʾ',0);
|
||
Exit;
|
||
end;
|
||
GYSNo.Text:=Trim(fzdyCode);
|
||
end else
|
||
begin
|
||
maxId:=Trim(FKHMainid);
|
||
end;
|
||
with ADOQueryCmd do
|
||
begin
|
||
Close;
|
||
SQL.Clear;
|
||
sql.Add('select * from KH_Main where KHMainID='''+Trim(FKHMainid)+'''');
|
||
Open;
|
||
If IsEmpty then
|
||
begin
|
||
append;
|
||
FieldByName('Filler').Value:=Trim(DName);
|
||
FieldByName('fillcode').Value:=Trim(DCode);
|
||
end
|
||
else
|
||
begin
|
||
Edit;
|
||
FieldByName('Editer').Value:=Trim(DName);
|
||
FieldByName('Edittime').Value:=SGetServerDateTime(ADOQueryTemp);
|
||
end;
|
||
FieldByName('KHMainID').Value:=Trim(maxId);
|
||
FieldByName('GYSType').Value:='<27><><EFBFBD><EFBFBD>';
|
||
SSetsaveSqlNew(ADOQueryCmd,'KH_Main',panel8,2);
|
||
post;
|
||
end;
|
||
if FKHMainid='' then
|
||
begin
|
||
if GetLSNo(ADOQueryCmd,maxno,'HB','KH_Sub',4,1)=False then
|
||
begin
|
||
ADOQueryCmd.Connection.RollbackTrans;
|
||
Application.MessageBox('ȡϵ<C8A1><CFB5><EFBFBD><EFBFBD><EFBFBD><EFBFBD>IDʧ<44><CAA7>!','<27><>ʾ',0);
|
||
Exit;
|
||
end;
|
||
with ADOQueryCmd do
|
||
begin
|
||
Close;
|
||
SQL.Clear;
|
||
sql.Add('select * from KH_Sub where KHSubid='''+Trim(maxno)+'''');
|
||
Open;
|
||
If IsEmpty then
|
||
begin
|
||
append;
|
||
FieldByName('XHNo').Value:=1;
|
||
end
|
||
else
|
||
begin
|
||
Edit;
|
||
end;
|
||
FieldByName('KHSubid').Value:=Trim(maxno);
|
||
FieldByName('KHMainID').Value:=Trim(maxId);
|
||
FieldByName('KHMXName').Value:=Trim(GYSName.Text);
|
||
FieldByName('KHMXJC').Value:=Trim(GYSNameZC.Text);
|
||
FieldByName('KHMXLXR').Value:=Trim(GYSFZRen.Text);
|
||
FieldByName('KHMXTel').Value:=Trim(GYSTel.Text);
|
||
FieldByName('KHMXAdd').Value:=Trim(GYSAdd.Text);
|
||
FieldByName('KHMXSJAdd').Value:=Trim(GYSAdd.Text);
|
||
FieldByName('KHMXNo').Value:=Trim(fzdyCode);
|
||
//FieldByName('KHMXNote').Value:=Trim(Note.Text);
|
||
post;
|
||
end;
|
||
end;
|
||
FKHMainid:=maxId;
|
||
with ADOQueryCmd do
|
||
begin
|
||
Close;
|
||
sql.Clear;
|
||
sql.Add('select * from KH_Main where GYSName='''+Trim(GYSName.Text)+'''');
|
||
sql.Add(' and GYSType=''<27><><EFBFBD><EFBFBD>'' ');
|
||
Open;
|
||
end;
|
||
if ADOQueryCmd.RecordCount>1 then
|
||
begin
|
||
ADOQueryCmd.Connection.RollbackTrans;
|
||
Application.MessageBox('<27><>Ӧ<EFBFBD><D3A6><EFBFBD>ظ<EFBFBD>!','<27><>ʾ',0);
|
||
Exit;
|
||
end;
|
||
with ADOQueryCmd do
|
||
begin
|
||
Close;
|
||
sql.Clear;
|
||
sql.Add('select * from KH_Main where GYSNameZC='''+Trim(GYSNameZC.Text)+'''');
|
||
sql.Add(' and GYSType=''<27><><EFBFBD><EFBFBD>'' ');
|
||
Open;
|
||
end;
|
||
if ADOQueryCmd.RecordCount>1 then
|
||
begin
|
||
ADOQueryCmd.Connection.RollbackTrans;
|
||
Application.MessageBox('<27><>Ӧ<EFBFBD>̼<EFBFBD><CCBC><EFBFBD><EFBFBD>ظ<EFBFBD>!','<27><>ʾ',0);
|
||
Exit;
|
||
end;
|
||
///<2F><>2
|
||
with CDS_HZ2 do
|
||
begin
|
||
First;
|
||
while not eof do
|
||
begin
|
||
if CDS_HZ2.FieldByName('KHSubid').AsString='' then
|
||
begin
|
||
if GetLSNo(ADOQueryCmd,maxno,'ZH','KH_Sub',4,1)=False then
|
||
begin
|
||
ADOQueryCmd.Connection.RollbackTrans;
|
||
Application.MessageBox('ȡϵ<C8A1><CFB5><EFBFBD><EFBFBD><EFBFBD><EFBFBD>IDʧ<44><CAA7>!','<27><>ʾ',0);
|
||
Exit;
|
||
end;
|
||
if GetLSNo(ADOQueryCmd,FMXNO,'MX','KH_Sub',4,0)=False then
|
||
begin
|
||
ADOQueryCmd.Connection.RollbackTrans;
|
||
Application.MessageBox('ȡϵ<C8A1><CFB5><EFBFBD><EFBFBD><EFBFBD><EFBFBD>IDʧ<44><CAA7>!','<27><>ʾ',0);
|
||
Exit;
|
||
end;
|
||
end else
|
||
begin
|
||
maxno:=Trim(CDS_HZ2.FieldByName('KHSubid').AsString);
|
||
end;
|
||
with ADOQueryCmd do
|
||
begin
|
||
Close;
|
||
SQL.Clear;
|
||
sql.Add('select * from KH_Sub where KHSubid='''+Trim(maxno)+'''');
|
||
Open;
|
||
If IsEmpty then
|
||
begin
|
||
append;
|
||
FieldByName('XHNo').Value:=99;
|
||
FieldByName('KHMXNo').Value:=Trim(FMXNO);
|
||
end
|
||
else
|
||
begin
|
||
Edit;
|
||
end;
|
||
RTSetSaveDataCDS(ADOQueryCmd,Tv2,CDS_HZ2,'KH_Sub',0);
|
||
FieldByName('KHSubid').Value:=Trim(maxno);
|
||
FieldByName('KHMainID').Value:=Trim(maxId);
|
||
post;
|
||
end;
|
||
with ADOQueryCmd do
|
||
begin
|
||
Close;
|
||
sql.Clear;
|
||
sql.Add('select * from KH_Sub where KHMXName='''+Trim(CDS_HZ2.FieldByName('KHMXName').AsString)+'''');
|
||
//sql.Add(' and GYSType=''<27><><EFBFBD><EFBFBD>'' ');
|
||
Open;
|
||
end;
|
||
if ADOQueryCmd.RecordCount>1 then
|
||
begin
|
||
ADOQueryCmd.Connection.RollbackTrans;
|
||
Application.MessageBox('<27><>Ӧ<EFBFBD><D3A6><EFBFBD>ظ<EFBFBD>!','<27><>ʾ',0);
|
||
Exit;
|
||
end;
|
||
with ADOQueryCmd do
|
||
begin
|
||
Close;
|
||
sql.Clear;
|
||
sql.Add('select * from KH_Sub where KHMXJC='''+Trim(CDS_HZ2.FieldByName('KHMXJC').AsString)+'''');
|
||
//sql.Add(' and GYSType=''<27><><EFBFBD><EFBFBD>'' ');
|
||
Open;
|
||
end;
|
||
if ADOQueryCmd.RecordCount>1 then
|
||
begin
|
||
ADOQueryCmd.Connection.RollbackTrans;
|
||
Application.MessageBox('<27><>Ӧ<EFBFBD>̼<EFBFBD><CCBC><EFBFBD><EFBFBD>ظ<EFBFBD>!','<27><>ʾ',0);
|
||
Exit;
|
||
end;
|
||
Next;
|
||
end;
|
||
end;
|
||
//<2F><>3
|
||
with CDS_HZ3 do
|
||
begin
|
||
CDS_HZ3.First;
|
||
while not Eof do
|
||
begin
|
||
if Trim(CDS_HZ3.fieldbyname('BKID').AsString)='' then
|
||
begin
|
||
if GetLSNo(ADOQueryCmd,maxnum,'BK','KH_Sub_Bank',4,1)=False then
|
||
begin
|
||
ADOQueryCmd.Connection.RollbackTrans;
|
||
Application.MessageBox('ȡϵ<C8A1><CFB5><EFBFBD><EFBFBD><EFBFBD><EFBFBD>IDʧ<44><CAA7>!','<27><>ʾ',0);
|
||
Exit;
|
||
end;
|
||
end else
|
||
begin
|
||
maxnum:=Trim(CDS_HZ3.fieldbyname('BKID').AsString);
|
||
end;
|
||
with ADOQueryCmd do
|
||
begin
|
||
Close;
|
||
SQL.Clear;
|
||
sql.Add('select * from KH_Sub_Bank where BKID='''+Trim(maxnum)+'''');
|
||
Open;
|
||
If IsEmpty then
|
||
begin
|
||
append;
|
||
end
|
||
else
|
||
begin
|
||
Edit;
|
||
end;
|
||
RTSetSaveDataCDS(ADOQueryCmd,Tv3,CDS_HZ3,'KH_Sub_Bank',0);
|
||
FieldByName('BKID').Value:=Trim(maxnum);
|
||
FieldByName('KHMainID').Value:=Trim(maxId);
|
||
FieldByName('KHSubid').Value:=Trim(KHSubid.Text);
|
||
post;
|
||
end;
|
||
CDS_HZ3.Next;
|
||
end;
|
||
end;
|
||
ADOQueryCmd.Connection.CommitTrans;
|
||
result:=true;
|
||
end;
|
||
|
||
procedure TfrmZdyAttInputGYS.ToolButton2Click(Sender: TObject);
|
||
var
|
||
maxId:String;
|
||
i:Integer;
|
||
begin
|
||
Panel7.SetFocus;
|
||
if KHMXName.Text='' then
|
||
begin
|
||
application.MessageBox('Ӧ<><D3A6><EFBFBD>λ(<28><><EFBFBD><EFBFBD>)<29><><EFBFBD><EFBFBD>Ϊ<EFBFBD><CEAA>','<27><>ʾ');
|
||
exit;
|
||
end;
|
||
if KHMXJC.Text='' then
|
||
begin
|
||
application.MessageBox('<27><><EFBFBD>Ʋ<EFBFBD><C6B2><EFBFBD>Ϊ<EFBFBD><CEAA>','<27><>ʾ');
|
||
exit;
|
||
end;
|
||
if ToolButton2.Caption='<27><><EFBFBD><EFBFBD>ȷ<EFBFBD><C8B7>' then
|
||
begin
|
||
if CDS_HZ2.Locate('KHMXName',KHMXName.Text,[])=True then
|
||
begin
|
||
Application.MessageBox('Ӧ<><D3A6><EFBFBD>λ(<28><><EFBFBD><EFBFBD>)<29>Ѵ<EFBFBD><D1B4><EFBFBD>','<27><>ʾ');
|
||
exit;
|
||
end;
|
||
end;
|
||
with CDS_HZ2 do
|
||
begin
|
||
if ToolButton2.Caption='<27><><EFBFBD><EFBFBD>ȷ<EFBFBD><C8B7>' then
|
||
append
|
||
else
|
||
edit;
|
||
SSetsaveSqlNewTClient(CDS_HZ2,panel7,2);
|
||
post;
|
||
end;
|
||
with Panel7 do
|
||
begin
|
||
for i:=0 to Panel7.ControlCount-1 do
|
||
begin
|
||
if Controls[i] is TEdit then
|
||
begin
|
||
TEdit(Controls[i]).Text:='';
|
||
end;
|
||
if Controls[i] is TMemo then
|
||
begin
|
||
TMemo(Controls[i]).Text:='';
|
||
end;
|
||
end;
|
||
end;
|
||
toolbutton2.Caption:='<27><><EFBFBD><EFBFBD>ȷ<EFBFBD><C8B7>';
|
||
end;
|
||
|
||
procedure TfrmZdyAttInputGYS.ToolButton4Click(Sender: TObject);
|
||
begin
|
||
IF KHSubid.Text='' then exit;
|
||
if Application.MessageBox('ȷ<><C8B7>Ҫɾ<D2AA><C9BE><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>','<27><>ʾ',32+4)<>IDYES then Exit;
|
||
with ADOQueryMain2 do
|
||
begin
|
||
Close;
|
||
SQL.Clear;
|
||
sql.Add('delete from KH_Sub where KHSubid ='''+Trim(KHSubid.Text)+'''');
|
||
ExecSQL;
|
||
end;
|
||
end;
|
||
|
||
procedure TfrmZdyAttInputGYS.ToolButton5Click(Sender: TObject);
|
||
begin
|
||
ToolBar3.SetFocus;
|
||
with CDS_HZ3 do
|
||
begin
|
||
Append;
|
||
|
||
post;
|
||
end;
|
||
end;
|
||
|
||
procedure TfrmZdyAttInputGYS.ToolButton6Click(Sender: TObject);
|
||
begin
|
||
IF CDS_HZ3.IsEmpty then exit;
|
||
CDS_HZ3.DisableControls;
|
||
with CDS_HZ3 do
|
||
begin
|
||
if Trim(CDS_HZ3.fieldbyname('BKID').AsString)<>'' then
|
||
begin
|
||
if Application.MessageBox('ȷ<><C8B7>Ҫɾ<D2AA><C9BE><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>','<27><>ʾ',32+4)<>IDYES then Exit;
|
||
with ADOQueryMain3 do
|
||
begin
|
||
Close;
|
||
SQL.Clear;
|
||
sql.Add('delete from KH_Sub_Bank where BKID ='''+Trim(CDS_HZ3.fieldbyname('BKID').AsString)+'''');
|
||
ExecSQL;
|
||
end;
|
||
end;
|
||
Delete;
|
||
end;
|
||
CDS_HZ3.EnableControls;
|
||
end;
|
||
|
||
function TfrmZdyAttInputGYS.SaveData2():Boolean;
|
||
var
|
||
maxId,CRID,fzdyCode,FYSSubId,maxno:String;
|
||
begin
|
||
///<2F>жϡ<D0B6><CFA1><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||
with CDS_HZ3 do
|
||
begin
|
||
CDS_HZ3.First;
|
||
while not Eof do
|
||
begin
|
||
FYSSubId:=Trim(CDS_HZ3.fieldbyname('LXFS_ZJ').AsString);
|
||
if Trim(FYSSubId)='' then
|
||
begin
|
||
if GetLSNo(ADOQueryMain3,maxno,'LX','LXFS_ZJ',4,1)=False then
|
||
begin
|
||
// ADOQueryCmd.Connection.RollbackTrans; //<2F>ع<EFBFBD><D8B9><EFBFBD><EFBFBD><EFBFBD>
|
||
Application.MessageBox('ȡϵ<C8A1><CFB5><EFBFBD><EFBFBD><EFBFBD><EFBFBD>IDʧ<44><CAA7>!','<27><>ʾ',0);
|
||
Exit;
|
||
end;
|
||
end else
|
||
begin
|
||
maxno:=Trim(FYSSubId);
|
||
end;
|
||
ADOQueryCmd.Connection.BeginTrans; //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʼ<EFBFBD><CABC><EFBFBD><EFBFBD>
|
||
with ADOQueryCmd do
|
||
begin
|
||
Close;
|
||
SQL.Clear;
|
||
sql.Add('select * from GYS_LXFS where LXFS_ZJ='''+Trim(maxno)+'''');
|
||
Open;
|
||
If Trim(FYSSubId)='' then
|
||
begin
|
||
append;
|
||
end
|
||
else
|
||
begin
|
||
Edit;
|
||
end;
|
||
FieldByName('LXFS_BH').Value:=Trim(CDS_HZ3.fieldbyname('LXFS_BH').AsString);
|
||
FieldByName('LXFS_LXR').Value:=Trim(CDS_HZ3.fieldbyname('LXFS_LXR').AsString);
|
||
FieldByName('LXFS_SJ').Value:=Trim(CDS_HZ3.fieldbyname('LXFS_SJ').AsString);
|
||
FieldByName('LXFS_DZ').Value:=Trim(CDS_HZ3.fieldbyname('LXFS_DZ').AsString);
|
||
FieldByName('LXFS_DH').Value:=Trim(CDS_HZ3.fieldbyname('LXFS_DH').AsString);
|
||
FieldByName('LXFS_CZ').Value:=Trim(CDS_HZ3.fieldbyname('LXFS_CZ').AsString);
|
||
FieldByName('LXFS_BZ').Value:=Trim(CDS_HZ3.fieldbyname('LXFS_BZ').AsString);
|
||
FieldByName('LXFS_ZJ').Value:=Trim(maxno);
|
||
FieldByName('KHMainID').Value:=Trim(CDS_HZ2.fieldbyname('KHMainID').AsString);
|
||
FieldByName('KHSubid').Value:=Trim(CDS_HZ2.fieldbyname('KHSubid').AsString);
|
||
post;
|
||
end;
|
||
CDS_HZ3.Next;
|
||
end;
|
||
end;
|
||
ADOQueryCmd.Connection.CommitTrans; //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||
result:=true;
|
||
end;
|
||
|
||
procedure TfrmZdyAttInputGYS.TFJClick(Sender: TObject);
|
||
begin
|
||
if KHSubid.Text='' then
|
||
begin
|
||
Application.MessageBox('<27>뱣<EFBFBD><EBB1A3><EFBFBD><EFBFBD><EFBFBD><EFBFBD>','<27><>ʾ');
|
||
exit;
|
||
end;
|
||
try
|
||
frmFjList_RZ:=TfrmFjList_RZ.Create(Application);
|
||
with frmFjList_RZ do
|
||
begin
|
||
fkeyNO:=Trim(KHSubid.Text);
|
||
fType:='<27><>Ӧ<EFBFBD>̲<EFBFBD><CCB2><EFBFBD>';
|
||
if ShowModal=1 then
|
||
begin
|
||
|
||
end;
|
||
end;
|
||
finally
|
||
frmFjList_RZ.Free;
|
||
end;
|
||
end;
|
||
|
||
procedure TfrmZdyAttInputGYS.SCSHDataNewTclient(ADOQueryTmp:TClientDataSet;mParent:TWinControl;FTag:Integer);
|
||
var
|
||
i,idx:integer;
|
||
mfield,mfieldCode:string;
|
||
ma:TA;
|
||
begin
|
||
with ADOQueryTmp do
|
||
begin
|
||
if isEmpty then exit;
|
||
with mParent do
|
||
begin
|
||
for i:=0 to ControlCount-1 do
|
||
begin
|
||
if Controls[i] is TLabel then continue;
|
||
if Controls[i].Tag<>FTag then continue;
|
||
mfield:=Controls[i].Name;
|
||
|
||
if Controls[i] is TEdit then
|
||
begin
|
||
if Trim(fieldByName(mfield).AsString)<>'' then
|
||
TEdit(Controls[i]).Text:=trim(fieldByName(mfield).AsString)
|
||
else
|
||
TEdit(Controls[i]).Text:='';
|
||
end
|
||
else if Controls[i] is TRichEdit then
|
||
begin
|
||
if Trim(fieldByName(mfield).AsString)<>'' then
|
||
TRichEdit(Controls[i]).Text:=trim(fieldByName(mfield).AsString);
|
||
end
|
||
|
||
else if Controls[i] is TComboBox then
|
||
begin
|
||
if TComboBox(Controls[i]).Items.Count>0 then
|
||
begin
|
||
idx:=TComboBox(Controls[i]).Items.IndexOf(trim(fieldByName(mfield).AsString));
|
||
end
|
||
else
|
||
idx:=-1;
|
||
TComboBox(Controls[i]).ItemIndex:=idx;
|
||
end
|
||
else if Controls[i] is TDateTimePicker then
|
||
begin
|
||
if Trim(fieldByName(mfield).AsString)='' then
|
||
begin
|
||
TDateTimePicker(Controls[i]).Checked:=False;
|
||
end
|
||
else
|
||
TDateTimePicker(Controls[i]).DateTime:=fieldByName(mfield).AsDateTime;
|
||
end
|
||
else if Controls[i] is Tmemo then
|
||
begin
|
||
Tmemo(Controls[i]).Text :=trim(fieldByName(mfield).AsString);
|
||
end
|
||
else if Controls[i] is TcxDateEdit then
|
||
begin
|
||
if not IsEmpty and not fieldByName(mfield).IsNull then
|
||
TcxDateEdit(Controls[i]).text :=fieldByName(mfield).AsString;
|
||
end
|
||
|
||
else if Controls[i] is TcheckBox then
|
||
begin
|
||
if FieldByName(mfield).Value=null then
|
||
TcheckBox(Controls[i]).Checked:=False
|
||
else
|
||
TcheckBox(Controls[i]).Checked:=fieldByName(mfield).asBoolean;
|
||
end else if Controls[i] is TcxButtonEdit then
|
||
begin
|
||
TcxButtonEdit(Controls[i]).Text:=Trim(fieldbyname(mfield).AsString);
|
||
if TcxButtonEdit(Controls[i]).ParentShowHint=False then
|
||
begin
|
||
mfieldCode:=Trim(Copy(mfield,1,Length(mfield)-4));
|
||
TcxButtonEdit(Controls[i]).Hint:=Trim(fieldbyname(mfieldCode).AsString);
|
||
end;
|
||
|
||
end;
|
||
end; // end for
|
||
end; // end with
|
||
end; //end for with
|
||
end;
|
||
|
||
procedure TfrmZdyAttInputGYS.TV2MouseDown(Sender: TObject;
|
||
Button: TMouseButton; Shift: TShiftState; X, Y: Integer);
|
||
begin
|
||
if CDS_HZ3.IsEmpty=False then
|
||
begin
|
||
if (CDS_HZ3.Locate('BKID',NULL,[])=true) and (CDS_HZ3.Locate('BankNo',NULL,[])=true)
|
||
and (CDS_HZ3.Locate('BKID','',[])=true) and (CDS_HZ3.Locate('BankNo','',[])=true) then
|
||
begin
|
||
if application.MessageBox('<27><>ϸȷ<CFB8><C8B7><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>','<27><>ʾ',1)=2 then exit;
|
||
end;
|
||
end;
|
||
if CDS_HZ2.IsEmpty then exit;
|
||
SCSHDataNewTclient(CDS_HZ2,panel7,2);
|
||
ToolButton2.Caption:='<27><EFBFBD>ȷ<EFBFBD><C8B7>';
|
||
with ADOQueryMain3 do
|
||
begin
|
||
Close;
|
||
sql.Clear;
|
||
sql.Add('select * from KH_Sub_Bank where KHSubid='''+Trim(CDS_HZ2.fieldbyname('KHSubid').asstring)+'''');
|
||
Open;
|
||
end;
|
||
SCreateCDS20(ADOQueryMain3,CDS_HZ3);
|
||
SInitCDSData20(ADOQueryMain3,CDS_HZ3);
|
||
end;
|
||
|
||
procedure TfrmZdyAttInputGYS.ToolButton1Click(Sender: TObject);
|
||
var
|
||
maxId:String;
|
||
i:Integer;
|
||
begin
|
||
Panel7.SetFocus;
|
||
with Panel7 do
|
||
begin
|
||
for i:=0 to Panel7.ControlCount-1 do
|
||
begin
|
||
if Controls[i] is TEdit then
|
||
begin
|
||
TEdit(Controls[i]).Text:='';
|
||
end;
|
||
if Controls[i] is TMemo then
|
||
begin
|
||
TMemo(Controls[i]).Text:='';
|
||
end;
|
||
end;
|
||
end;
|
||
ToolButton2.Caption:='<27><><EFBFBD><EFBFBD>ȷ<EFBFBD><C8B7>';
|
||
end;
|
||
|
||
procedure TfrmZdyAttInputGYS.ToolButton8Click(Sender: TObject);
|
||
begin
|
||
WriteCxGrid('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ӧ<EFBFBD><D3A6><EFBFBD><EFBFBD><EFBFBD><EFBFBD>¼<EFBFBD><C2BC>1',Tv2,'<27>ͻ<EFBFBD><CDBB>Զ<EFBFBD><D4B6><EFBFBD>');
|
||
WriteCxGrid('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ӧ<EFBFBD><D3A6><EFBFBD><EFBFBD><EFBFBD><EFBFBD>¼<EFBFBD><C2BC>2',Tv3,'<27>ͻ<EFBFBD><CDBB>Զ<EFBFBD><D4B6><EFBFBD>');
|
||
Close;
|
||
end;
|
||
|
||
procedure TfrmZdyAttInputGYS.ToolButton7Click(Sender: TObject);
|
||
begin
|
||
Panel4.SetFocus;
|
||
IF trim(GYSName.Text)='' then
|
||
begin
|
||
application.MessageBox('<27><>Ӧ<EFBFBD>̲<EFBFBD><CCB2><EFBFBD>Ϊ<EFBFBD>գ<EFBFBD>','<27><>ʾ<EFBFBD><CABE>Ϣ',MB_ICONERROR);
|
||
exit;
|
||
end;
|
||
if Trim(GYSNameZC.Text)='' then
|
||
begin
|
||
application.MessageBox('<27><><EFBFBD>Ʋ<EFBFBD><C6B2><EFBFBD>Ϊ<EFBFBD>գ<EFBFBD>','<27><>ʾ<EFBFBD><CABE>Ϣ',MB_ICONERROR);
|
||
exit;
|
||
end;
|
||
if Application.MessageBox('ȷ<><C8B7>Ҫ<EFBFBD><D2AA><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>','<27><>ʾ',32+4)<>IDYES then Exit;
|
||
if SaveData() then
|
||
begin
|
||
Application.MessageBox('<27><><EFBFBD><EFBFBD><EFBFBD>ɹ<EFBFBD>!','<27><>ʾ',0);
|
||
ModalResult:=1;
|
||
end;
|
||
end;
|
||
|
||
end.
|