215 lines
5.6 KiB
ObjectPascal
215 lines
5.6 KiB
ObjectPascal
unit U_ZdyAttachCP;
|
||
|
||
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, cxLookAndFeels, cxLookAndFeelPainters, cxNavigator;
|
||
|
||
type
|
||
TfrmZdyAttachCP = 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;
|
||
v2Column9: TcxGridDBColumn;
|
||
Label1: TLabel;
|
||
ZdyCode: TEdit;
|
||
ToolButton4: TToolButton;
|
||
Label2: TLabel;
|
||
DEFstr5: TComboBox;
|
||
v2Column7: TcxGridDBColumn;
|
||
v2Column11: TcxGridDBColumn;
|
||
v2Column12: TcxGridDBColumn;
|
||
v2Column8: TcxGridDBColumn;
|
||
defnote3: TEdit;
|
||
Label4: TLabel;
|
||
Tv2Column1: 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 ZdyNameChange(Sender: TObject);
|
||
procedure ToolButton1Click(Sender: TObject);
|
||
procedure ToolButton4Click(Sender: TObject);
|
||
procedure Tv2CellDblClick(Sender: TcxCustomGridTableView; ACellViewInfo: TcxGridTableDataCellViewInfo; AButton: TMouseButton; AShift: TShiftState; var AHandled: Boolean);
|
||
private
|
||
{ Private declarations }
|
||
procedure InitGrid();
|
||
public
|
||
fType: string;
|
||
end;
|
||
|
||
var
|
||
frmZdyAttachCP: TfrmZdyAttachCP;
|
||
|
||
implementation
|
||
|
||
uses
|
||
U_DataLink, U_Fun, U_ZDYHelp;
|
||
|
||
{$R *.dfm}
|
||
|
||
procedure TfrmZdyAttachCP.InitGrid();
|
||
begin
|
||
try
|
||
ADOQueryMain.DisableControls;
|
||
with ADOQueryMain do
|
||
begin
|
||
Filtered := False;
|
||
Close;
|
||
SQL.Clear;
|
||
sql.Add(' select * from KH_Zdy_Attachment where Type=''CP'' ');
|
||
if fType = '<27><>Ʒ' then
|
||
begin
|
||
sql.Add('and DEFstr5=''<27><>Ʒ''');
|
||
end
|
||
else
|
||
begin
|
||
sql.Add('and DEFstr5=''<27><><EFBFBD><EFBFBD>''');
|
||
end;
|
||
Open;
|
||
end;
|
||
SCreateCDS20(ADOQueryMain, CDS_HZ);
|
||
SInitCDSData20(ADOQueryMain, CDS_HZ);
|
||
finally
|
||
ADOQueryMain.EnableControls;
|
||
end;
|
||
end;
|
||
|
||
procedure TfrmZdyAttachCP.FormDestroy(Sender: TObject);
|
||
begin
|
||
frmZdyAttachCP := nil;
|
||
end;
|
||
|
||
procedure TfrmZdyAttachCP.FormClose(Sender: TObject; var Action: TCloseAction);
|
||
begin
|
||
Action := caFree;
|
||
end;
|
||
|
||
procedure TfrmZdyAttachCP.TBCloseClick(Sender: TObject);
|
||
begin
|
||
WriteCxGrid('<27><>Ʒ<EFBFBD><C6B7><EFBFBD><EFBFBD>', Tv2, '<27>ͻ<EFBFBD><CDBB>Զ<EFBFBD><D4B6><EFBFBD>');
|
||
Close;
|
||
end;
|
||
|
||
procedure TfrmZdyAttachCP.TBDelClick(Sender: TObject);
|
||
begin
|
||
{ if CDS_HZ.IsEmpty then Exit;
|
||
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('delete KH_Zdy_Attachment where ATID='''+Trim(CDS_HZ.fieldbyname('ATID').AsString)+'''');
|
||
sql.Add('delete KH_Zdy where ZdyNo='''+Trim(CDS_HZ.fieldbyname('ATID').AsString)+'''');
|
||
ExecSQL;
|
||
end;
|
||
end;
|
||
CDS_HZ.Delete; }
|
||
end;
|
||
|
||
procedure TfrmZdyAttachCP.FormShow(Sender: TObject);
|
||
begin
|
||
ReadCxGrid('<27><>Ʒ<EFBFBD><C6B7><EFBFBD><EFBFBD>', Tv2, '<27>ͻ<EFBFBD><CDBB>Զ<EFBFBD><D4B6><EFBFBD>');
|
||
if fType = '<27><>Ʒ' then
|
||
begin
|
||
Tv2Column1.Visible:=false;
|
||
end
|
||
else
|
||
begin
|
||
Tv2Column1.Visible:=true;
|
||
end;
|
||
InitGrid();
|
||
end;
|
||
|
||
procedure TfrmZdyAttachCP.TBRafreshClick(Sender: TObject);
|
||
begin
|
||
InitGrid();
|
||
end;
|
||
|
||
procedure TfrmZdyAttachCP.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 TfrmZdyAttachCP.ZdyNameChange(Sender: TObject);
|
||
begin
|
||
ToolButton2.Click;
|
||
end;
|
||
|
||
procedure TfrmZdyAttachCP.ToolButton1Click(Sender: TObject);
|
||
begin
|
||
if ADOQueryMain.IsEmpty then
|
||
Exit;
|
||
SelExportData(Tv2, ADOQueryMain, '<27>ͻ<EFBFBD><CDBB><EFBFBD><EFBFBD><EFBFBD><EFBFBD>б<EFBFBD>');
|
||
end;
|
||
|
||
procedure TfrmZdyAttachCP.ToolButton4Click(Sender: TObject);
|
||
begin
|
||
{ try
|
||
frmZdyAttInputCP:=TfrmZdyAttInputCP.Create(Application);
|
||
with frmZdyAttInputCP do
|
||
begin
|
||
FCYID:=Trim(Self.CDS_HZ.fieldbyname('ATID').AsString);
|
||
if ShowModal=1 then
|
||
begin
|
||
|
||
end;
|
||
end;
|
||
finally
|
||
frmZdyAttInputCP.Free;
|
||
end; }
|
||
end;
|
||
|
||
procedure TfrmZdyAttachCP.Tv2CellDblClick(Sender: TcxCustomGridTableView; ACellViewInfo: TcxGridTableDataCellViewInfo; AButton: TMouseButton; AShift: TShiftState; var AHandled: Boolean);
|
||
begin
|
||
if CDS_HZ.IsEmpty then
|
||
exit;
|
||
ModalResult := 1;
|
||
end;
|
||
|
||
end.
|
||
|