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

208 lines
5.6 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_CKProductBCPKC;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, cxStyles, cxCustomData, cxGraphics, cxFilter, cxData,
cxDataStorage, cxEdit, DB, cxDBData, cxGridCustomTableView,
cxGridTableView, cxGridBandedTableView, cxGridDBBandedTableView,
cxGridLevel, cxClasses, cxControls, cxGridCustomView, cxGridDBTableView,
cxGrid, StdCtrls, ComCtrls, ExtCtrls, ToolWin, cxGridCustomPopupMenu,
cxGridPopupMenu, ADODB, DBClient, cxDropDownEdit;
type
TfrmCKProductBCPKC = class(TForm)
ToolBar1: TToolBar;
TBRafresh: TToolButton;
TBFind: TToolButton;
TBExport: TToolButton;
TBPrint: TToolButton;
TBClose: TToolButton;
Panel1: TPanel;
ADOQueryCmd: TADOQuery;
ADOQueryMain: TADOQuery;
ADOQueryTemp: TADOQuery;
DataSource1: TDataSource;
cxGridPopupMenu1: TcxGridPopupMenu;
Label3: TLabel;
Label4: TLabel;
Label7: TLabel;
YCLName: TEdit;
SWFBColor: TEdit;
SWFBHW: TEdit;
Label1: TLabel;
Label2: TLabel;
BegDate: TDateTimePicker;
EndDate: TDateTimePicker;
CDS_Main: TClientDataSet;
Tv1: TcxGridDBTableView;
cxGrid2Level1: TcxGridLevel;
cxGrid2: TcxGrid;
v2Column1: TcxGridDBColumn;
v2Column2: TcxGridDBColumn;
v2Column3: TcxGridDBColumn;
v2Column4: TcxGridDBColumn;
v2Column5: TcxGridDBColumn;
v2Column6: TcxGridDBColumn;
v2Column7: TcxGridDBColumn;
v2Column8: TcxGridDBColumn;
v1Column1: TcxGridDBColumn;
v1Column3: TcxGridDBColumn;
v1Column4: TcxGridDBColumn;
procedure FormDestroy(Sender: TObject);
procedure FormClose(Sender: TObject; var Action: TCloseAction);
procedure FormCreate(Sender: TObject);
procedure TBRafreshClick(Sender: TObject);
procedure ConNoMChange(Sender: TObject);
procedure TBCloseClick(Sender: TObject);
procedure FormShow(Sender: TObject);
procedure TBExportClick(Sender: TObject);
procedure TBFindClick(Sender: TObject);
procedure YCLNameChange(Sender: TObject);
procedure Tv1CellDblClick(Sender: TcxCustomGridTableView;
ACellViewInfo: TcxGridTableDataCellViewInfo; AButton: TMouseButton;
AShift: TShiftState; var AHandled: Boolean);
private
procedure InitGrid();
{ Private declarations }
public
{ Public declarations }
end;
var
frmCKProductBCPKC: TfrmCKProductBCPKC;
implementation
uses
U_DataLink,U_Fun,U_CRMX;
{$R *.dfm}
procedure TfrmCKProductBCPKC.FormDestroy(Sender: TObject);
begin
frmCKProductBCPKC:=nil;
end;
procedure TfrmCKProductBCPKC.FormClose(Sender: TObject;
var Action: TCloseAction);
begin
Action:=caFree;
end;
procedure TfrmCKProductBCPKC.FormCreate(Sender: TObject);
begin
//cxGrid1.Align:=alClient;
BegDate.DateTime:=SGetServerDateTime(ADOQueryTemp)-30;
EndDate.DateTime:=SGetServerDateTime(ADOQueryTemp)
end;
procedure TfrmCKProductBCPKC.InitGrid();
begin
try
ADOQueryMain.DisableControls;
with ADOQueryMain do
begin
Filtered:=False;
Close;
sql.Clear;
SQL.Add('exec CK_YCL_CRCHZ :begdate,:enddate,:CKName');
Parameters.ParamByName('begdate').Value:=Trim(FormatDateTime('yyyy-MM-dd',BegDate.DateTime));
Parameters.ParamByName('enddate').Value:=Trim(FormatDateTime('yyyy-MM-dd',enddate.DateTime+1));
Parameters.ParamByName('CKName').Value:=Trim(DParameters1);
Open;
//ShowMessage(SQL.Text);
end;
SCreateCDS20(ADOQueryMain,CDS_Main);
SInitCDSData20(ADOQueryMain,CDS_Main);
finally
ADOQueryMain.EnableControls;
end;
end;
procedure TfrmCKProductBCPKC.TBRafreshClick(Sender: TObject);
begin
BegDate.SetFocus;
InitGrid();
end;
procedure TfrmCKProductBCPKC.ConNoMChange(Sender: TObject);
begin
if ADOQueryMain.Active then
begin
SDofilter(ADOQueryMain,SGetFilters(Panel1,1,2));
end;
end;
procedure TfrmCKProductBCPKC.TBCloseClick(Sender: TObject);
begin
WriteCxGrid(<><D4AD><EFBFBD>Ͽ<EFBFBD><CFBF><EFBFBD>2',Tv1,<><D4AD><EFBFBD>ϲֿ<CFB2>');
Close;
end;
procedure TfrmCKProductBCPKC.FormShow(Sender: TObject);
begin
ReadCxGrid(<><D4AD><EFBFBD>Ͽ<EFBFBD><CFBF><EFBFBD>2',Tv1,<><D4AD><EFBFBD>ϲֿ<CFB2>');
if Trim(DParameters2)=<><D4AD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>' then
begin
ToolButton1.Visible:=True;
v2Column9.Options.Focusing:=True;
v2Column9.Visible:=True;
end else
begin
ToolButton1.Visible:=False;
v2Column9.Options.Focusing:=False;
v2Column9.Visible:=False;
end;
InitGrid();
end;
procedure TfrmCKProductBCPKC.TBExportClick(Sender: TObject);
begin
if ADOQueryMain.IsEmpty then exit;
TcxGridToExcel(Trim(DParameters1)+'<27><><EFBFBD><EFBFBD>',cxGrid2);
end;
procedure TfrmCKProductBCPKC.TBFindClick(Sender: TObject);
begin
if ADOQueryMain.Active then
begin
SDofilter(ADOQueryMain,SGetFilters(Panel1,1,2));
SCreateCDS20(ADOQueryMain,CDS_Main);
SInitCDSData20(ADOQueryMain,CDS_Main);
end;
end;
procedure TfrmCKProductBCPKC.YCLNameChange(Sender: TObject);
begin
TBFind.Click;
end;
procedure TfrmCKProductBCPKC.Tv1CellDblClick(Sender: TcxCustomGridTableView;
ACellViewInfo: TcxGridTableDataCellViewInfo; AButton: TMouseButton;
AShift: TShiftState; var AHandled: Boolean);
begin
try
frmCRMX:=TfrmCRMX.Create(Application);
with frmCRMX do
begin
Fbegdate:=FormatDateTime('yyyy-MM-dd',Self.BegDate.DateTime);
Fenddate:=FormatDateTime('yyyy-MM-dd',Self.enddate.DateTime+1);
{FGYS:=Trim(Self.CDS_Main.fieldbyname('GYS').AsString);
FYCLCode:=Trim(Self.CDS_Main.fieldbyname('YCLCode').AsString);
FYCLSpec:=Trim(Self.CDS_Main.fieldbyname('YCLSpec').AsString);
FCRUnit:=Trim(Self.CDS_Main.fieldbyname('KCUint').AsString); }
CRID:=Trim(Self.CDS_Main.fieldbyname('CRID').AsString);
if ShowModal=1 then
begin
end;
end;
finally
frmCRMX.Free;
end;
end;
end.