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

282 lines
7.2 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_ClothContractKCList;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls, ExtCtrls, ComCtrls, ToolWin, cxStyles, cxCustomData,
cxGraphics, cxFilter, cxData, cxDataStorage, cxEdit, DB, cxDBData, ADODB,
cxGridCustomPopupMenu, cxGridPopupMenu, cxGridLevel, cxClasses,
cxControls, cxGridCustomView, cxGridCustomTableView, cxGridTableView,
cxGridDBTableView, cxGrid, DBClient, cxCalendar, cxButtonEdit, cxSplitter,
RM_Common, RM_Class, RM_e_Xls, RM_Dataset, RM_System, RM_GridReport,
cxTextEdit;
type
TfrmClothContractKCList = class(TForm)
ToolBar1: TToolBar;
TBRafresh: TToolButton;
TBFind: TToolButton;
TBClose: TToolButton;
Panel1: TPanel;
BegDate: TDateTimePicker;
EndDate: TDateTimePicker;
Label1: TLabel;
Label2: TLabel;
cxGridPopupMenu1: TcxGridPopupMenu;
ADOQueryCmd: TADOQuery;
ADOQueryMain: TADOQuery;
ADOQueryTemp: TADOQuery;
DataSource1: TDataSource;
Label3: TLabel;
ConNo: TEdit;
Label5: TLabel;
C_CodeName: TEdit;
Order_Main: TClientDataSet;
Label4: TLabel;
C_Spec: TEdit;
ClientDataSet3: TClientDataSet;
DataSource2: TDataSource;
DataSource3: TDataSource;
ClientDataSet2: TClientDataSet;
RM1: TRMGridReport;
RMDBMain: TRMDBDataSet;
RMXLSExport1: TRMXLSExport;
cxGrid1: TcxGrid;
Tv1: TcxGridDBTableView;
v1OrderNo: TcxGridDBColumn;
v1Column2: TcxGridDBColumn;
v1FactoryNo1Name: TcxGridDBColumn;
v1PRTSpec: TcxGridDBColumn;
v1PRTMF: TcxGridDBColumn;
v1PRTKZ: TcxGridDBColumn;
cxGrid1Level1: TcxGridLevel;
v1Column1: TcxGridDBColumn;
v1Column3: TcxGridDBColumn;
v1Column5: TcxGridDBColumn;
cxGridPopupMenu2: TcxGridPopupMenu;
Label6: TLabel;
PBC: TEdit;
Label7: TLabel;
FirstName: TEdit;
v1Column6: TcxGridDBColumn;
v1Column7: TcxGridDBColumn;
v1Column8: TcxGridDBColumn;
v1Column9: TcxGridDBColumn;
v1Column10: TcxGridDBColumn;
v1Column11: TcxGridDBColumn;
v1Column12: TcxGridDBColumn;
v1Column13: TcxGridDBColumn;
Label8: TLabel;
v1Column4: TcxGridDBColumn;
v1Column14: TcxGridDBColumn;
v1Column16: TcxGridDBColumn;
v1Column15: TcxGridDBColumn;
procedure FormDestroy(Sender: TObject);
procedure FormClose(Sender: TObject; var Action: TCloseAction);
procedure TBCloseClick(Sender: TObject);
procedure TBFindClick(Sender: TObject);
procedure TBRafreshClick(Sender: TObject);
procedure ConNoChange(Sender: TObject);
procedure FormShow(Sender: TObject);
procedure ConNoKeyPress(Sender: TObject; var Key: Char);
procedure C_CodeNameKeyPress(Sender: TObject; var Key: Char);
procedure C_SpecKeyPress(Sender: TObject; var Key: Char);
procedure PBCKeyPress(Sender: TObject; var Key: Char);
procedure FirstNameKeyPress(Sender: TObject; var Key: Char);
private
FInt,PFInt:Integer;
procedure InitGrid();
procedure InitForm();
procedure InitGridWSQL(FWSQL:String);
{ Private declarations }
public
{ Public declarations }
end;
var
frmClothContractKCList: TfrmClothContractKCList;
implementation
uses
U_DataLink,U_ClothContractInPut,U_Fun,U_ProductOrderList,U_ZDYHelp;
{$R *.dfm}
procedure TfrmClothContractKCList.FormDestroy(Sender: TObject);
begin
frmClothContractKCList:=nil;
end;
procedure TfrmClothContractKCList.FormClose(Sender: TObject;
var Action: TCloseAction);
begin
Action:=caFree;
end;
procedure TfrmClothContractKCList.TBCloseClick(Sender: TObject);
begin
Close;
WriteCxGrid('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>HZ',Tv1,ʾ<D6B8><CABE><EFBFBD><EFBFBD><EFBFBD><EFBFBD>');
end;
procedure TfrmClothContractKCList.InitGrid();
begin
try
ADOQueryMain.DisableControls;
with ADOQueryMain do
begin
Filtered:=False;
Close;
sql.Clear;
sql.Add('exec P_SELECT_PbKC_MX :begdate,:enddate');
Parameters.ParamByName('begdate').Value:=FormatDateTime('yyyy-MM-dd',BegDate.Date);
Parameters.ParamByName('enddate').Value:=FormatDateTime('yyyy-MM-dd',EndDate.Date+1);
// Parameters.ParamByName('WSQL').Value:='';
Open;
end;
SCreateCDS20(ADOQueryMain,Order_Main);
SInitCDSData20(ADOQueryMain,Order_Main);
finally
ADOQueryMain.EnableControls;
end;
end;
procedure TfrmClothContractKCList.InitGridWSQL(FWSQL:String);
begin
try
ADOQueryMain.DisableControls;
with ADOQueryMain do
begin
Filtered:=False;
Close;
sql.Clear;
sql.Add('exec P_View_ClothHZ :begdate,:enddate,:WSQL');
Parameters.ParamByName('begdate').Value:='1900-01-01';
Parameters.ParamByName('enddate').Value:='2050-01-01';
Parameters.ParamByName('WSQL').Value:=FWSQL;
Open;
end;
SCreateCDS20(ADOQueryMain,Order_Main);
SInitCDSData20(ADOQueryMain,Order_Main);
finally
ADOQueryMain.EnableControls;
end;
end;
procedure TfrmClothContractKCList.InitForm();
begin
ReadCxGrid('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>H',Tv1,ʾ<D6B8><CABE><EFBFBD><EFBFBD><EFBFBD><EFBFBD>');
EndDate.DateTime:=SGetServerDateTime(ADOQueryTemp);
BegDate.DateTime:=EndDate.DateTime-30;
//InitGrid();
end;
procedure TfrmClothContractKCList.TBFindClick(Sender: TObject);
begin
if ADOQueryMain.Active=False then Exit;
SDofilter(ADOQueryMain,SGetFilters(Panel1,1,2));
SCreateCDS20(ADOQueryMain,Order_Main);
SInitCDSData20(ADOQueryMain,Order_Main);
end;
procedure TfrmClothContractKCList.TBRafreshClick(Sender: TObject);
begin
InitGrid();
end;
procedure TfrmClothContractKCList.ConNoChange(Sender: TObject);
begin
if ADOQueryMain.Active=False then Exit;
SDofilter(ADOQueryMain,SGetFilters(Panel1,1,2));
SCreateCDS20(ADOQueryMain,Order_Main);
SInitCDSData20(ADOQueryMain,Order_Main);
end;
procedure TfrmClothContractKCList.FormShow(Sender: TObject);
begin
InitForm();
end;
procedure TfrmClothContractKCList.ConNoKeyPress(Sender: TObject;
var Key: Char);
var
fsj:String;
begin
if Key=#13 then
begin
if Length(Trim(ConNo.Text))<4 then Exit;
fsj:=' and conNo like '''+'%'+Trim(ConNo.Text)+'%'+'''';
InitGridWSQL(fsj);
end;
end;
procedure TfrmClothContractKCList.C_CodeNameKeyPress(Sender: TObject;
var Key: Char);
var
fsj:String;
begin
if Key=#13 then
begin
if Length(Trim(C_CodeName.Text))<4 then Exit;
fsj:=' and C_CodeName like '''+'%'+Trim(C_CodeName.Text)+'%'+'''';
InitGridWSQL(fsj);
end;
end;
procedure TfrmClothContractKCList.C_SpecKeyPress(Sender: TObject;
var Key: Char);
var
fsj:String;
begin
if Key=#13 then
begin
if Length(Trim(C_Spec.Text))<4 then Exit;
fsj:=' and C_Spec like '''+'%'+Trim(C_Spec.Text)+'%'+'''';
InitGridWSQL(fsj);
end;
end;
procedure TfrmClothContractKCList.PBCKeyPress(Sender: TObject;
var Key: Char);
var
fsj:String;
begin
if Key=#13 then
begin
if Length(Trim(PBC.Text))<3 then
begin
fsj:=' and PBC='''+Trim(PBC.Text)+'''';
InitGridWSQL(fsj);
end else
begin
fsj:=' and PBC like '''+'%'+Trim(PBC.Text)+'%'+'''';
InitGridWSQL(fsj);
end;
end;
end;
procedure TfrmClothContractKCList.FirstNameKeyPress(Sender: TObject;
var Key: Char);
var
fsj:String;
begin
if Key=#13 then
begin
if Length(Trim(FirstName.Text))<3 then
begin
fsj:=' and FirstName='''+Trim(FirstName.Text)+'''';
InitGridWSQL(fsj);
end else
begin
fsj:=' and FirstName like '''+'%'+Trim(FirstName.Text)+'%'+'''';
InitGridWSQL(fsj);
end;
end;
end;
end.