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

184 lines
4.7 KiB
ObjectPascal
Raw Blame History

unit U_CP_XL;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls, ComCtrls, ExtCtrls, ToolWin, DBClient, DB, ADODB,
cxStyles, cxCustomData, cxGraphics, cxFilter, cxData, cxDataStorage,
cxEdit, cxDBData, cxGridCustomTableView, cxGridTableView,
cxGridBandedTableView, cxGridDBBandedTableView, cxControls,
cxGridCustomView, cxClasses, cxGridLevel, cxGrid, cxLookAndFeels,
cxLookAndFeelPainters, cxNavigator;
type
TfrmCP_XL = class(TForm)
ToolBar1: TToolBar;
TBRafresh: TToolButton;
TBFind: TToolButton;
TBClose: TToolButton;
Panel1: TPanel;
Label1: TLabel;
Label4: TLabel;
Label9: TLabel;
BegDate: TDateTimePicker;
EndDate: TDateTimePicker;
P_CodeName: TEdit;
ConNoM: TEdit;
Label2: TLabel;
ADOQueryMain: TADOQuery;
DS_Main: TDataSource;
CDS_main: TClientDataSet;
cxGrid1Level1: TcxGridLevel;
cxGrid1: TcxGrid;
Tv1: TcxGridDBBandedTableView;
v1Column1: TcxGridDBBandedColumn;
v1Column2: TcxGridDBBandedColumn;
v1Column3: TcxGridDBBandedColumn;
v1Column4: TcxGridDBBandedColumn;
v1Column5: TcxGridDBBandedColumn;
v1Column6: TcxGridDBBandedColumn;
v1Column7: TcxGridDBBandedColumn;
v1Column8: TcxGridDBBandedColumn;
v1Column9: TcxGridDBBandedColumn;
v1Column10: TcxGridDBBandedColumn;
v1Column11: TcxGridDBBandedColumn;
v1Column12: TcxGridDBBandedColumn;
v1Column13: TcxGridDBBandedColumn;
v1Column14: TcxGridDBBandedColumn;
v1Column15: TcxGridDBBandedColumn;
v1Column16: TcxGridDBBandedColumn;
v1Column17: TcxGridDBBandedColumn;
ToolButton1: TToolButton;
TBexcept: TToolButton;
procedure FormDestroy(Sender: TObject);
procedure FormClose(Sender: TObject; var Action: TCloseAction);
procedure FormCreate(Sender: TObject);
procedure TBCloseClick(Sender: TObject);
procedure TBFindClick(Sender: TObject);
procedure P_CodeNameChange(Sender: TObject);
procedure TBRafreshClick(Sender: TObject);
procedure FormShow(Sender: TObject);
procedure ToolButton1Click(Sender: TObject);
procedure TBexceptClick(Sender: TObject);
private
procedure InitGrid();
{ Private declarations }
public
canshu1:string;
{ Public declarations }
end;
var
frmCP_XL: TfrmCP_XL;
implementation
uses
U_DataLink,U_Fun10,U_CP_COL_XL;
{$R *.dfm}
procedure TfrmCP_XL.InitGrid();
begin
try
ADOQueryMain.DisableControls;
with ADOQueryMain do
begin
Close;
Filtered:=False;
sql.Clear;
sql.Add(' exec P_Get_CP_Xl ');
SQL.Add(' @begdate='''+FormatDateTime('yyyy-MM-dd',BegDate.DateTime)+'''');
SQL.Add(',@enddate='''+FormatDateTime('yyyy-MM-dd',enddate.DateTime+1)+'''');
Open;
end;
SCreateCDS20(ADOQueryMain,CDS_Main);
SInitCDSData20(ADOQueryMain,CDS_Main);
finally
ADOQueryMain.EnableControls;
end;
TBfind.Click;
end;
procedure TfrmCP_XL.FormDestroy(Sender: TObject);
begin
frmCP_XL:=nil;
end;
procedure TfrmCP_XL.FormClose(Sender: TObject; var Action: TCloseAction);
begin
Action:=cafree;
end;
procedure TfrmCP_XL.FormCreate(Sender: TObject);
begin
enddate.DateTime:=now();
begdate.DateTime:=enddate.DateTime-30;
cxGrid1.Align:=alclient;
canshu1:=trim(DParameters1);
end;
procedure TfrmCP_XL.TBCloseClick(Sender: TObject);
begin
close;
end;
procedure TfrmCP_XL.TBFindClick(Sender: TObject);
begin
if ADOQueryMain.Active=False then Exit;
SDofilter(ADOQueryMain,SGetFilters(Panel1,1,2));
SCreateCDS20(ADOQueryMain,CDS_Main);
SInitCDSData20(ADOQueryMain,CDS_Main);
end;
procedure TfrmCP_XL.P_CodeNameChange(Sender: TObject);
begin
TBfind.Click;
end;
procedure TfrmCP_XL.TBRafreshClick(Sender: TObject);
begin
initGrid();
end;
procedure TfrmCP_XL.FormShow(Sender: TObject);
begin
IF trim(canshu1)='<27>𻪷<EFBFBD>֯'then
begin
tv1.Bands[2].Visible:=false;
tv1.Bands[3].Visible:=false;
tv1.Bands[4].Visible:=false;
end;
IF trim(canshu1)='<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>'then
begin
tv1.Bands[1].Visible:=false;
tv1.Bands[3].Visible:=false;
tv1.Bands[4].Visible:=false;
end;
IF trim(canshu1)='<27>𶦷<EFBFBD><F0B6A6B7><EFBFBD><EFBFBD>в<EFBFBD>'then
begin
tv1.Bands[1].Visible:=false;
tv1.Bands[2].Visible:=false;
tv1.Bands[4].Visible:=false;
end;
end;
procedure TfrmCP_XL.ToolButton1Click(Sender: TObject);
begin
IF cds_main.IsEmpty then exit;
frmCP_COL_XL:=TfrmCP_COL_XL.create(self);
with frmCP_COL_XL do
begin
begdate.Date:=self.BegDate.Date;
enddate.Date:=self.EndDate.date;
P_Codename.Text:=self.cds_main.fieldbyname('P_CodeName').asstring;
show;
end;
end;
procedure TfrmCP_XL.TBexceptClick(Sender: TObject);
begin
if ADOQueryMain.IsEmpty then exit;
TcxGridToExcel(self.Caption,cxGrid1);
end;
end.