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

208 lines
5.5 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_CKProductCPKCHZList_Yj;
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, MovePanel, cxContainer,
cxTextEdit, cxCurrencyEdit;
type
TfrmCKProductCPKCHZList_Yj = 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;
C_CodeName: TEdit;
C_Color: TEdit;
Label1: TLabel;
Label2: TLabel;
BegDate: TDateTimePicker;
EndDate: TDateTimePicker;
CDS_Main: TClientDataSet;
Tv1: TcxGridDBTableView;
cxGrid2Level1: TcxGridLevel;
cxGrid2: TcxGrid;
v2Column1: TcxGridDBColumn;
v2Column3: TcxGridDBColumn;
v2Column6: TcxGridDBColumn;
Label5: TLabel;
conNO: TEdit;
Label6: TLabel;
MJID: TEdit;
v1Column7: TcxGridDBColumn;
Label8: TLabel;
KZ: TEdit;
Label9: TLabel;
MF: TEdit;
Label7: TLabel;
CPType: TComboBox;
MovePanel2: TMovePanel;
v1KCRollNum: TcxGridDBColumn;
Label10: TLabel;
Edit1: TEdit;
v1Column1: TcxGridDBColumn;
C_CodeName_ZW: TEdit;
Label11: TLabel;
Label12: TLabel;
days2: TcxCurrencyEdit;
days: TcxCurrencyEdit;
Label13: TLabel;
v1Column2: TcxGridDBColumn;
v1Column3: TcxGridDBColumn;
CheckBox1: TCheckBox;
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 C_CodeNameChange(Sender: TObject);
procedure Tv1CustomDrawCell(Sender: TcxCustomGridTableView;
ACanvas: TcxCanvas; AViewInfo: TcxGridTableDataCellViewInfo;
var ADone: Boolean);
procedure CheckBox1Click(Sender: TObject);
private
procedure InitGrid();
{ Private declarations }
public
{ Public declarations }
end;
var
frmCKProductCPKCHZList_Yj: TfrmCKProductCPKCHZList_Yj;
implementation
uses
U_DataLink,U_Fun;
{$R *.dfm}
procedure TfrmCKProductCPKCHZList_Yj.FormDestroy(Sender: TObject);
begin
frmCKProductCPKCHZList_Yj:=nil;
end;
procedure TfrmCKProductCPKCHZList_Yj.FormClose(Sender: TObject;
var Action: TCloseAction);
begin
Action:=caFree;
end;
procedure TfrmCKProductCPKCHZList_Yj.FormCreate(Sender: TObject);
begin
//cxGrid1.Align:=alClient;
BegDate.DateTime:=SGetServerDateTime(ADOQueryTemp);
EndDate.DateTime:=SGetServerDateTime(ADOQueryTemp)
end;
procedure TfrmCKProductCPKCHZList_Yj.InitGrid();
begin
try
ADOQueryMain.DisableControls;
with ADOQueryMain do
begin
Filtered:=False;
Close;
sql.Clear;
sql.Add(' exec P_Get_KC_warning ');
sql.Add(' @days='''+inttostr(strtointdef(days.TEXT,1))+''' ');
sql.Add(',@days2='+inttostr(strtointdef(days2.TEXT,0)));
if CheckBox1.Checked then
sql.Add(',@flag=''1'' ')
else
sql.Add(',@flag=''0'' ');
Open;
end;
SCreateCDS20(ADOQueryMain,CDS_Main);
SInitCDSData20(ADOQueryMain,CDS_Main);
finally
ADOQueryMain.EnableControls;
TBFind.Click;
end;
end;
procedure TfrmCKProductCPKCHZList_Yj.TBRafreshClick(Sender: TObject);
begin
//BegDate.SetFocus;
MovePanel2.Visible:=True;
MovePanel2.Refresh;
InitGrid();
MovePanel2.Visible:=False;
end;
procedure TfrmCKProductCPKCHZList_Yj.ConNoMChange(Sender: TObject);
begin
if ADOQueryMain.Active then
begin
SDofilter(ADOQueryMain,SGetFilters(Panel1,1,2));
end;
end;
procedure TfrmCKProductCPKCHZList_Yj.TBCloseClick(Sender: TObject);
begin
WriteCxGrid(self.Caption,Tv1,'<27><>Ʒ<EFBFBD>ֿ<EFBFBD>');
Close;
end;
procedure TfrmCKProductCPKCHZList_Yj.FormShow(Sender: TObject);
begin
ReadCxGrid(self.Caption,Tv1,'<27><>Ʒ<EFBFBD>ֿ<EFBFBD>');
end;
procedure TfrmCKProductCPKCHZList_Yj.TBExportClick(Sender: TObject);
begin
if ADOQueryMain.IsEmpty then exit;
TcxGridToExcel('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>б<EFBFBD>',cxGrid2);
end;
procedure TfrmCKProductCPKCHZList_Yj.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 TfrmCKProductCPKCHZList_Yj.C_CodeNameChange(Sender: TObject);
begin
TBFind.Click;
end;
procedure TfrmCKProductCPKCHZList_Yj.Tv1CustomDrawCell(
Sender: TcxCustomGridTableView; ACanvas: TcxCanvas;
AViewInfo: TcxGridTableDataCellViewInfo; var ADone: Boolean);
begin
IF (not varisnull(AViewInfo.GridRecord.Values[tv1.GetColumnByFieldName('X_Qty').Index])) and (AViewInfo.GridRecord.Values[tv1.GetColumnByFieldName('KCQty').Index]-AViewInfo.GridRecord.Values[tv1.GetColumnByFieldName('X_Qty').Index])<0 then
begin
ACanvas.Brush.Color:=clred;
end;
end;
procedure TfrmCKProductCPKCHZList_Yj.CheckBox1Click(Sender: TObject);
begin
InitGrid();
end;
end.