D7wmguihua/桂华管理系统/U_CPKWList.pas
DESKTOP-E401PHE\Administrator b4b5840f18 1
2025-01-18 16:22:10 +08:00

191 lines
4.8 KiB
ObjectPascal
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

unit U_CPKWList;
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;
type
TfrmCPKWList = 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;
defstr1: TEdit;
cxGrid2: TcxGrid;
Tv2: TcxGridDBTableView;
cxGridLevel1: TcxGridLevel;
cxGridPopupMenu2: TcxGridPopupMenu;
DS_HZ: TDataSource;
CDS_HZ: TClientDataSet;
ToolButton3: TToolButton;
v2Column6: TcxGridDBColumn;
v2Column1: TcxGridDBColumn;
v2Column3: TcxGridDBColumn;
Label1: TLabel;
ZdyCode: TEdit;
ToolButton4: TToolButton;
v2Column8: TcxGridDBColumn;
Label2: TLabel;
DEFstr3: TComboBox;
v2Column10: TcxGridDBColumn;
v2Column11: TcxGridDBColumn;
v2Column12: TcxGridDBColumn;
v2Column13: TcxGridDBColumn;
defstr2: TEdit;
Label4: TLabel;
v2Column2: TcxGridDBColumn;
TBOK: TToolButton;
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 defstr1Change(Sender: TObject);
procedure ToolButton1Click(Sender: TObject);
procedure Tv2DblClick(Sender: TObject);
procedure TBOKClick(Sender: TObject);
private
{ Private declarations }
procedure InitGrid();
public
end;
var
frmCPKWList: TfrmCPKWList;
implementation
uses
U_DataLink,U_Fun,U_ZDYHelp;
{$R *.dfm}
procedure TfrmCPKWList.InitGrid();
begin
try
ADOQueryMain.DisableControls;
with ADOQueryMain do
begin
Filtered:=False;
Close;
SQL.Clear;
sql.Add(' select A.*, ');
sql.Add(' cpNum=(select count(MJID) from CK_BanCP_KC X where X.KCKW=A.zdyCode and X.kcQty>0)');
sql.Add(' from KH_Zdy_Attachment A ');
sql.Add(' where Type=''CPKW'' ');
sql.Add(' and isnull(defstr1,'''') like '+quotedstr('%'+trim(defstr1.Text)+'%'));
Open;
end;
SCreateCDS20(ADOQueryMain,CDS_HZ);
SInitCDSData20(ADOQueryMain,CDS_HZ);
finally
ADOQueryMain.EnableControls;
end;
ToolButton2.Click;
end;
procedure TfrmCPKWList.FormDestroy(Sender: TObject);
begin
frmCPKWList:=nil;
end;
procedure TfrmCPKWList.FormClose(Sender: TObject; var Action: TCloseAction);
begin
Action:=caFree;
end;
procedure TfrmCPKWList.TBCloseClick(Sender: TObject);
begin
WriteCxGrid(self.Caption,Tv2,'<27>ͻ<EFBFBD><CDBB>Զ<EFBFBD><D4B6><EFBFBD>');
Close;
end;
procedure TfrmCPKWList.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 TfrmCPKWList.FormShow(Sender: TObject);
begin
cxGrid2.Align:=alclient;
ReadCxGrid(self.Caption,Tv2,'<27>ͻ<EFBFBD><CDBB>Զ<EFBFBD><D4B6><EFBFBD>');
InitGrid();
end;
procedure TfrmCPKWList.TBRafreshClick(Sender: TObject);
begin
InitGrid();
end;
procedure TfrmCPKWList.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 TfrmCPKWList.defstr1Change(Sender: TObject);
begin
ToolButton2.Click;
end;
procedure TfrmCPKWList.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 TfrmCPKWList.Tv2DblClick(Sender: TObject);
begin
TBOK.Click;
end;
procedure TfrmCPKWList.TBOKClick(Sender: TObject);
begin
ModalResult:=1;
end;
end.