576 lines
15 KiB
ObjectPascal
576 lines
15 KiB
ObjectPascal
![]() |
unit U_ZdyAttachGYS;
|
|||
|
|
|||
|
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, cxLookAndFeels, cxLookAndFeelPainters,
|
|||
|
cxNavigator, dxBarBuiltInMenu;
|
|||
|
|
|||
|
type
|
|||
|
TfrmZdyAttachGYS = class(TForm)
|
|||
|
ToolBar1: TToolBar;
|
|||
|
TBRafresh: TToolButton;
|
|||
|
TBDel: TToolButton;
|
|||
|
TBClose: TToolButton;
|
|||
|
ADOQueryTemp: TADOQuery;
|
|||
|
ADOQueryCmd: TADOQuery;
|
|||
|
Panel1: TPanel;
|
|||
|
ToolButton2: TToolButton;
|
|||
|
ADOQueryMain: TADOQuery;
|
|||
|
ToolButton1: TToolButton;
|
|||
|
RM1: TRMGridReport;
|
|||
|
RMDB_Main: TRMDBDataSet;
|
|||
|
Label3: TLabel;
|
|||
|
ZdyName: TEdit;
|
|||
|
cxGrid2: TcxGrid;
|
|||
|
Tv2: TcxGridDBTableView;
|
|||
|
cxGridLevel1: TcxGridLevel;
|
|||
|
cxGridPopupMenu2: TcxGridPopupMenu;
|
|||
|
DS_HZ: TDataSource;
|
|||
|
CDS_HZ: TClientDataSet;
|
|||
|
ToolButton3: TToolButton;
|
|||
|
v2Column6: TcxGridDBColumn;
|
|||
|
v2Column1: TcxGridDBColumn;
|
|||
|
v2Column2: TcxGridDBColumn;
|
|||
|
v2Column3: TcxGridDBColumn;
|
|||
|
v2Column4: TcxGridDBColumn;
|
|||
|
v2Column5: TcxGridDBColumn;
|
|||
|
v2Column7: TcxGridDBColumn;
|
|||
|
v2Column9: TcxGridDBColumn;
|
|||
|
Label1: TLabel;
|
|||
|
ZdyCode: TEdit;
|
|||
|
TBedit: TToolButton;
|
|||
|
v2Column8: TcxGridDBColumn;
|
|||
|
Label2: TLabel;
|
|||
|
ZdyType: TComboBox;
|
|||
|
v2Column11: TcxGridDBColumn;
|
|||
|
v2Column12: TcxGridDBColumn;
|
|||
|
v2Column13: TcxGridDBColumn;
|
|||
|
Region: TEdit;
|
|||
|
Label4: TLabel;
|
|||
|
v2Column15: TcxGridDBColumn;
|
|||
|
Tchk: TToolButton;
|
|||
|
TNochk: TToolButton;
|
|||
|
cxTabControl1: TcxTabControl;
|
|||
|
v2Column16: TcxGridDBColumn;
|
|||
|
ToolButton4: TToolButton;
|
|||
|
Panel2: TPanel;
|
|||
|
Tlb1: TToolBar;
|
|||
|
TB3: TToolButton;
|
|||
|
TB4: TToolButton;
|
|||
|
TB5: TToolButton;
|
|||
|
cxGrid1: TcxGrid;
|
|||
|
Tv1: TcxGridDBTableView;
|
|||
|
cxGridDBColumn2: TcxGridDBColumn;
|
|||
|
cxGridDBColumn3: TcxGridDBColumn;
|
|||
|
cxGridDBColumn4: TcxGridDBColumn;
|
|||
|
cxGridDBColumn7: TcxGridDBColumn;
|
|||
|
cxGridDBColumn8: TcxGridDBColumn;
|
|||
|
cxGridDBColumn9: TcxGridDBColumn;
|
|||
|
cxGridDBColumn10: TcxGridDBColumn;
|
|||
|
cxGridDBColumn11: TcxGridDBColumn;
|
|||
|
cxGridDBColumn12: TcxGridDBColumn;
|
|||
|
cxGridDBColumn13: TcxGridDBColumn;
|
|||
|
cxGridDBColumn14: TcxGridDBColumn;
|
|||
|
cxGridLevel2: TcxGridLevel;
|
|||
|
cxGridPopupMenu1: TcxGridPopupMenu;
|
|||
|
DS1: TDataSource;
|
|||
|
ADOQuery1: TADOQuery;
|
|||
|
CDS1: TClientDataSet;
|
|||
|
Panel3: TPanel;
|
|||
|
ToolButton5: TToolButton;
|
|||
|
ADOTemp: TADOQuery;
|
|||
|
v2Column10: TcxGridDBColumn;
|
|||
|
ZYCP: TEdit;
|
|||
|
Label5: TLabel;
|
|||
|
v2Column14: TcxGridDBColumn;
|
|||
|
Label6: TLabel;
|
|||
|
Shortened: TEdit;
|
|||
|
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 ZdyNameChange(Sender: TObject);
|
|||
|
procedure ToolButton1Click(Sender: TObject);
|
|||
|
procedure TBeditClick(Sender: TObject);
|
|||
|
procedure ToolButton3Click(Sender: TObject);
|
|||
|
procedure FormCreate(Sender: TObject);
|
|||
|
procedure TchkClick(Sender: TObject);
|
|||
|
procedure TNochkClick(Sender: TObject);
|
|||
|
procedure cxTabControl1Change(Sender: TObject);
|
|||
|
procedure ToolButton4Click(Sender: TObject);
|
|||
|
procedure Tv2FocusedRecordChanged(Sender: TcxCustomGridTableView;
|
|||
|
APrevFocusedRecord, AFocusedRecord: TcxCustomGridRecord;
|
|||
|
ANewItemRecordFocusingChanged: Boolean);
|
|||
|
procedure TB3Click(Sender: TObject);
|
|||
|
procedure TB4Click(Sender: TObject);
|
|||
|
procedure TB5Click(Sender: TObject);
|
|||
|
procedure Tv1FocusedRecordChanged(Sender: TcxCustomGridTableView;
|
|||
|
APrevFocusedRecord, AFocusedRecord: TcxCustomGridRecord;
|
|||
|
ANewItemRecordFocusingChanged: Boolean);
|
|||
|
procedure ToolButton5Click(Sender: TObject);
|
|||
|
private
|
|||
|
{ Private declarations }
|
|||
|
procedure InitGrid();
|
|||
|
procedure setstatus();
|
|||
|
public
|
|||
|
{ Public declarations }
|
|||
|
canshu1:string;
|
|||
|
end;
|
|||
|
|
|||
|
var
|
|||
|
frmZdyAttachGYS: TfrmZdyAttachGYS;
|
|||
|
|
|||
|
implementation
|
|||
|
uses
|
|||
|
U_DataLink,U_Fun,U_ZDYHelp,U_ZdyAttInputGYS,U_AddYFGYS,U_FjList_RZ;
|
|||
|
|
|||
|
{$R *.dfm}
|
|||
|
procedure TfrmZdyAttachGYS.setstatus();
|
|||
|
begin
|
|||
|
TBedit.Visible:=false;
|
|||
|
TBdel.Visible:=false;
|
|||
|
tchk.Visible:=false;
|
|||
|
tnochk.Visible:=false;
|
|||
|
toolbutton1.Visible:=false;
|
|||
|
IF trim(canshu1)=''then
|
|||
|
begin
|
|||
|
case cxTabControl1.TabIndex of
|
|||
|
0:begin
|
|||
|
TBedit.Visible:=true;
|
|||
|
TBdel.Visible:=true;
|
|||
|
end;
|
|||
|
end;
|
|||
|
end
|
|||
|
else IF trim(canshu1)='<27><>Ȩ<EFBFBD><C8A8>'then
|
|||
|
begin
|
|||
|
toolbutton1.Visible:=true;
|
|||
|
case cxTabControl1.TabIndex of
|
|||
|
0:begin
|
|||
|
TBedit.Visible:=true;
|
|||
|
tbdel.Visible:=True;
|
|||
|
tchk.Visible:=True;
|
|||
|
end;
|
|||
|
1:begin
|
|||
|
tNochk.Visible:=True;
|
|||
|
end;
|
|||
|
end;
|
|||
|
end;
|
|||
|
// InitGrid();
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmZdyAttachGYS.InitGrid();
|
|||
|
begin
|
|||
|
try
|
|||
|
ADOQueryMain.DisableControls;
|
|||
|
with ADOQueryMain do
|
|||
|
begin
|
|||
|
Filtered:=False;
|
|||
|
Close;
|
|||
|
SQL.Clear;
|
|||
|
sql.Add(' select * from KH_Zdy_Attachment where Type=''GYS'' and Valid=''Y'' and ATID=FromATID ');
|
|||
|
if cxTabControl1.TabIndex<2 then
|
|||
|
sql.Add(' and Status='''+inttostr(cxTabControl1.TabIndex)+''' ');
|
|||
|
Open;
|
|||
|
end;
|
|||
|
SCreateCDS20(ADOQueryMain,CDS_HZ);
|
|||
|
SInitCDSData20(ADOQueryMain,CDS_HZ);
|
|||
|
finally
|
|||
|
ADOQueryMain.EnableControls;
|
|||
|
end;
|
|||
|
ZdyType.Items.Clear;
|
|||
|
|
|||
|
with ADOQueryCmd do
|
|||
|
begin
|
|||
|
Close;
|
|||
|
SQL.Clear;
|
|||
|
SQL.Add('select ZDYName from KH_ZDY where type=''GYSSZ''');
|
|||
|
Open;
|
|||
|
end;
|
|||
|
ADOQueryCmd.First;
|
|||
|
while not ADOQueryCmd.Eof do
|
|||
|
begin
|
|||
|
ZdyType.Items.Add(ADOQueryCmd.fieldByName('ZDYName').AsString);
|
|||
|
ADOQueryCmd.Next;
|
|||
|
end;
|
|||
|
ToolButton2.Click;
|
|||
|
end;
|
|||
|
|
|||
|
|
|||
|
procedure TfrmZdyAttachGYS.FormDestroy(Sender: TObject);
|
|||
|
begin
|
|||
|
frmZdyAttachGYS:=nil;
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmZdyAttachGYS.FormClose(Sender: TObject; var Action: TCloseAction);
|
|||
|
begin
|
|||
|
Action:=caFree;
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmZdyAttachGYS.TBCloseClick(Sender: TObject);
|
|||
|
begin
|
|||
|
WriteCxGrid('<27><>Ӧ<EFBFBD><D3A6><EFBFBD><EFBFBD><EFBFBD><EFBFBD>',Tv2,'<27>ͻ<EFBFBD><CDBB>Զ<EFBFBD><D4B6><EFBFBD>');
|
|||
|
Close;
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmZdyAttachGYS.TBDelClick(Sender: TObject);
|
|||
|
begin
|
|||
|
if CDS_HZ.IsEmpty then Exit;
|
|||
|
with ADOQueryTemp do
|
|||
|
begin
|
|||
|
Close;
|
|||
|
SQL.Clear;
|
|||
|
SQL.Add(' select * from KH_Zdy_Attachment where FromATID='+QuotedStr(Trim(CDS_HZ.FieldByName('ATID').AsString)));
|
|||
|
SQL.Add(' and Type=''GYS'' and Valid=''Y'' and FromATID<>ATID ');
|
|||
|
Open;
|
|||
|
if not IsEmpty then
|
|||
|
begin
|
|||
|
Application.MessageBox('<27>Ѵ<EFBFBD><D1B4><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ظ<EFBFBD><D8B8>λ<EEB5A5><CEBB><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ɾ<EFBFBD><C9BE><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;
|
|||
|
|
|||
|
if ( Trim(CDS_HZ.fieldbyname('ATID').AsString)<>'' ) then
|
|||
|
begin
|
|||
|
with ADOQueryCmd do
|
|||
|
begin
|
|||
|
Close;
|
|||
|
SQL.Clear;
|
|||
|
SQL.Add(' update KH_Zdy_Attachment set Valid=''N'',ZFTime=GETDATE(),ZFPerson='+QuotedStr(Trim(DName)));
|
|||
|
SQL.Add(' where ATID='+QuotedStr(Trim(CDS_HZ.FieldByName('ATID').AsString)));
|
|||
|
ExecSQL;
|
|||
|
end;
|
|||
|
end;
|
|||
|
CDS_HZ.Delete;
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmZdyAttachGYS.FormShow(Sender: TObject);
|
|||
|
begin
|
|||
|
ReadCxGrid('<27><>Ӧ<EFBFBD><D3A6><EFBFBD><EFBFBD><EFBFBD><EFBFBD>',Tv2,'<27>ͻ<EFBFBD><CDBB>Զ<EFBFBD><D4B6><EFBFBD>');
|
|||
|
setstatus();
|
|||
|
InitGrid();
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmZdyAttachGYS.TBRafreshClick(Sender: TObject);
|
|||
|
begin
|
|||
|
InitGrid();
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmZdyAttachGYS.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 TfrmZdyAttachGYS.ZdyNameChange(Sender: TObject);
|
|||
|
begin
|
|||
|
ToolButton2.Click;
|
|||
|
end;
|
|||
|
|
|||
|
|
|||
|
procedure TfrmZdyAttachGYS.ToolButton1Click(Sender: TObject);
|
|||
|
begin
|
|||
|
if ADOQueryMain.IsEmpty then Exit;
|
|||
|
TcxGridToExcel(self.Caption,cxgrid2);
|
|||
|
// SelExportData(Tv2,ADOQueryMain,'<27><>Ӧ<EFBFBD><D3A6><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>б<EFBFBD>');
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmZdyAttachGYS.TBeditClick(Sender: TObject);
|
|||
|
begin
|
|||
|
try
|
|||
|
frmZdyAttInputGYS:=TfrmZdyAttInputGYS.Create(Application);
|
|||
|
with frmZdyAttInputGYS do
|
|||
|
begin
|
|||
|
FATID:=Trim(Self.CDS_HZ.fieldbyname('ATID').AsString);
|
|||
|
FFromATID:=Trim(Self.CDS_HZ.fieldbyname('FromATID').AsString);
|
|||
|
if ShowModal=1 then
|
|||
|
begin
|
|||
|
TBRafresh.Click;
|
|||
|
Self.CDS_HZ.Locate('ATID',FATID,[]);
|
|||
|
end;
|
|||
|
end;
|
|||
|
finally
|
|||
|
frmZdyAttInputGYS.Free;
|
|||
|
end;
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmZdyAttachGYS.ToolButton3Click(Sender: TObject);
|
|||
|
begin
|
|||
|
try
|
|||
|
frmZdyAttInputGYS:=TfrmZdyAttInputGYS.Create(Application);
|
|||
|
with frmZdyAttInputGYS do
|
|||
|
begin
|
|||
|
FATID:='';
|
|||
|
FFromATID:='';
|
|||
|
if ShowModal=1 then
|
|||
|
begin
|
|||
|
TBRafresh.Click;
|
|||
|
end;
|
|||
|
end;
|
|||
|
finally
|
|||
|
frmZdyAttInputGYS.Free;
|
|||
|
end;
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmZdyAttachGYS.FormCreate(Sender: TObject);
|
|||
|
begin
|
|||
|
canshu1:=trim(DParameters1);
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmZdyAttachGYS.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
|
|||
|
with CDS_HZ do
|
|||
|
begin
|
|||
|
DisableControls;
|
|||
|
First;
|
|||
|
while not eof do
|
|||
|
begin
|
|||
|
iF fieldbyname('ssel').AsBoolean then
|
|||
|
begin
|
|||
|
with ADOQueryCmd do
|
|||
|
begin
|
|||
|
close;
|
|||
|
sql.Clear;
|
|||
|
sql.Add(' update KH_Zdy_Attachment SET status=''1'',ChkTime=GETDATE(),Chker='''+Trim(DName)+''' ');
|
|||
|
sql.Add(' where ATID='+quotedstr(trim(CDS_HZ.fieldbyname('ATID').AsString)));
|
|||
|
execsql;
|
|||
|
end;
|
|||
|
end;
|
|||
|
next;
|
|||
|
end;
|
|||
|
First;
|
|||
|
EnableControls;
|
|||
|
end;
|
|||
|
application.MessageBox('<27><><EFBFBD>˳ɹ<CBB3><C9B9><EFBFBD>','<27><>ʾ<EFBFBD><CABE>Ϣ');
|
|||
|
TBRafresh.Click;
|
|||
|
except
|
|||
|
CDS_HZ.EnableControls;
|
|||
|
application.MessageBox('<27><><EFBFBD><EFBFBD>ʧ<EFBFBD>ܣ<EFBFBD>','<27><>ʾ<EFBFBD><CABE>Ϣ',0);
|
|||
|
end;
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmZdyAttachGYS.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
|
|||
|
with CDS_HZ do
|
|||
|
begin
|
|||
|
DisableControls;
|
|||
|
First;
|
|||
|
while not eof do
|
|||
|
begin
|
|||
|
iF fieldbyname('ssel').AsBoolean then
|
|||
|
begin
|
|||
|
with ADOQueryCmd do
|
|||
|
begin
|
|||
|
close;
|
|||
|
sql.Clear;
|
|||
|
sql.Add(' update KH_Zdy_Attachment SET status=''0'',ChkTime=NULL,Chker=NULL ');
|
|||
|
sql.Add(' where ATID='+quotedstr(trim(CDS_HZ.fieldbyname('ATID').AsString)));
|
|||
|
execsql;
|
|||
|
end;
|
|||
|
end;
|
|||
|
next;
|
|||
|
end;
|
|||
|
First;
|
|||
|
EnableControls;
|
|||
|
end;
|
|||
|
application.MessageBox('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>˳ɹ<CBB3><C9B9><EFBFBD>','<27><>ʾ<EFBFBD><CABE>Ϣ');
|
|||
|
TBRafresh.Click;
|
|||
|
except
|
|||
|
CDS_HZ.EnableControls;
|
|||
|
application.MessageBox('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʧ<EFBFBD>ܣ<EFBFBD>','<27><>ʾ<EFBFBD><CABE>Ϣ',0);
|
|||
|
end;
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmZdyAttachGYS.cxTabControl1Change(Sender: TObject);
|
|||
|
begin
|
|||
|
setstatus();
|
|||
|
InitGrid();
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmZdyAttachGYS.ToolButton4Click(Sender: TObject);
|
|||
|
begin
|
|||
|
if CDS_HZ.IsEmpty then Exit;
|
|||
|
try
|
|||
|
frmFjList_RZ:=TfrmFjList_RZ.Create(Application);
|
|||
|
with frmFjList_RZ do
|
|||
|
begin
|
|||
|
fkeyNO:=Trim(Self.CDS_HZ.fieldbyname('ATID').AsString);
|
|||
|
fType:='<27><>Ӧ<EFBFBD><D3A6><EFBFBD><EFBFBD><EFBFBD><EFBFBD>';
|
|||
|
if ShowModal=1 then
|
|||
|
begin
|
|||
|
|
|||
|
end;
|
|||
|
end;
|
|||
|
finally
|
|||
|
frmFjList_RZ.Free;
|
|||
|
end;
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmZdyAttachGYS.Tv2FocusedRecordChanged(
|
|||
|
Sender: TcxCustomGridTableView; APrevFocusedRecord,
|
|||
|
AFocusedRecord: TcxCustomGridRecord;
|
|||
|
ANewItemRecordFocusingChanged: Boolean);
|
|||
|
begin
|
|||
|
if CDS_HZ.IsEmpty then Exit;
|
|||
|
with ADOQuery1 do
|
|||
|
begin
|
|||
|
Close;
|
|||
|
SQL.Clear;
|
|||
|
SQL.Add(' select * from KH_Zdy_Attachment where Type=''GYS'' and Valid=''Y'' ');
|
|||
|
SQL.Add(' and FromATID='''+Trim(CDS_HZ.FieldByName('ATID').AsString)+''' ');
|
|||
|
Open;
|
|||
|
end;
|
|||
|
SCreateCDS20(ADOQuery1,CDS1);
|
|||
|
SInitCDSData20(ADOQuery1,CDS1);
|
|||
|
Panel3.Caption := Trim(CDS_HZ.FieldByName('ZdyName').AsString);
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmZdyAttachGYS.TB3Click(Sender: TObject);
|
|||
|
begin
|
|||
|
try
|
|||
|
frmAddYFGYS:=TfrmAddYFGYS.Create(Application);
|
|||
|
with frmAddYFGYS do
|
|||
|
begin
|
|||
|
FATID:='';
|
|||
|
FFromATID:=Trim(Self.CDS_HZ.fieldbyname('ATID').AsString);
|
|||
|
if ShowModal=1 then
|
|||
|
begin
|
|||
|
TBRafresh.Click;
|
|||
|
Self.CDS_HZ.Locate('ATID',FFromATID,[]);
|
|||
|
end;
|
|||
|
end;
|
|||
|
finally
|
|||
|
frmAddYFGYS.Free;
|
|||
|
end;
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmZdyAttachGYS.TB4Click(Sender: TObject);
|
|||
|
begin
|
|||
|
try
|
|||
|
frmAddYFGYS:=TfrmAddYFGYS.Create(Application);
|
|||
|
with frmAddYFGYS do
|
|||
|
begin
|
|||
|
FATID:=Trim(Self.CDS1.fieldbyname('ATID').AsString);
|
|||
|
FFromATID:=Trim(Self.CDS1.fieldbyname('FromATID').AsString);
|
|||
|
if ShowModal=1 then
|
|||
|
begin
|
|||
|
TBRafresh.Click;
|
|||
|
Self.CDS_HZ.Locate('ATID',FFromATID,[]);
|
|||
|
end;
|
|||
|
end;
|
|||
|
finally
|
|||
|
frmAddYFGYS.Free;
|
|||
|
end;
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmZdyAttachGYS.TB5Click(Sender: TObject);
|
|||
|
begin
|
|||
|
with ADOQueryCmd do
|
|||
|
begin
|
|||
|
Close;
|
|||
|
SQL.Clear;
|
|||
|
SQL.Add(' update KH_Zdy_Attachment set Valid=''N'',ZFTime=GETDATE(),ZFPerson='+QuotedStr(Trim(DName)));
|
|||
|
SQL.Add(' where ATID='+QuotedStr(Trim(CDS1.FieldByName('ATID').AsString)));
|
|||
|
ExecSQL;
|
|||
|
end;
|
|||
|
CDS1.Delete;
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmZdyAttachGYS.Tv1FocusedRecordChanged(
|
|||
|
Sender: TcxCustomGridTableView; APrevFocusedRecord,
|
|||
|
AFocusedRecord: TcxCustomGridRecord;
|
|||
|
ANewItemRecordFocusingChanged: Boolean);
|
|||
|
begin
|
|||
|
if ( Trim(CDS1.FieldByName('ATID').AsString)=Trim(CDS1.FieldByName('FromATID').AsString) ) then
|
|||
|
begin
|
|||
|
TB4.Enabled:=False;
|
|||
|
TB5.Enabled:=False;
|
|||
|
end else
|
|||
|
begin
|
|||
|
TB4.Enabled:=True;
|
|||
|
TB5.Enabled:=True;
|
|||
|
end;
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmZdyAttachGYS.ToolButton5Click(Sender: TObject);
|
|||
|
var
|
|||
|
fsj:string;
|
|||
|
FWZ:Integer;
|
|||
|
begin
|
|||
|
fsj:=Trim(TEdit(Sender).Hint);
|
|||
|
FWZ:=Pos('/',fsj);
|
|||
|
try
|
|||
|
frmZDYHelp:=TfrmZDYHelp.Create(Application);
|
|||
|
with frmZDYHelp do
|
|||
|
begin
|
|||
|
flag:=Copy(fsj,1,FWZ-1);
|
|||
|
flagname:=Copy(fsj,FWZ+1,Length(fsj)-fwz);
|
|||
|
if Trim(flag)='GYSSZ' then
|
|||
|
begin
|
|||
|
ToolButton1.Visible:=False;
|
|||
|
V1Name.Caption:='<27><>Ӧ<EFBFBD><D3A6><EFBFBD><EFBFBD><EFBFBD><EFBFBD>';
|
|||
|
V1Note.Caption:='<27><><EFBFBD>Ź<EFBFBD><C5B9><EFBFBD>';
|
|||
|
fnote:=True;
|
|||
|
end;
|
|||
|
if ShowModal=1 then
|
|||
|
begin
|
|||
|
TEdit(Sender).Text:=Trim(ClientDataSet1.fieldbyname('ZDYName').AsString);
|
|||
|
if Trim(flag)='MPRTCode' then
|
|||
|
begin
|
|||
|
with ADOTemp do
|
|||
|
begin
|
|||
|
Close;
|
|||
|
sql.Clear;
|
|||
|
sql.Add('select Top 1 * from JYOrder_Main where MPRTCode='''+Trim(ClientDataSet1.fieldbyname('ZDYName').AsString)+'''');
|
|||
|
sql.Add(' order by FillTime desc');
|
|||
|
Open;
|
|||
|
end;
|
|||
|
// MPRTCodeName.Text:=ADOTemp.fieldbyname('MPRTCodeName').AsString;
|
|||
|
// MPRTMF.Text:=ADOTemp.fieldbyname('MPRTMF').AsString;
|
|||
|
// MPRTKZ.Text:=ADOTemp.fieldbyname('MPRTKZ').AsString;
|
|||
|
// MPRTSpec.Text:=ADOTemp.fieldbyname('MPRTSpec').AsString;
|
|||
|
end;
|
|||
|
end;
|
|||
|
end;
|
|||
|
finally
|
|||
|
frmZDYHelp.Free;
|
|||
|
end;
|
|||
|
end;
|
|||
|
|
|||
|
end.
|
|||
|
|
|||
|
|