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

363 lines
10 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_JYOrderCDMore;
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, cxCheckBox, cxCalendar, cxSplitter,
RM_Dataset, RM_System, RM_Common, RM_Class, RM_GridReport, RM_e_Xls,
Menus, cxPC, MovePanel;
type
TfrmJYOrderCDMore = class(TForm)
ToolBar1: TToolBar;
TBRafresh: TToolButton;
TBFind: TToolButton;
TBClose: TToolButton;
Panel1: TPanel;
BegDate: TDateTimePicker;
EndDate: TDateTimePicker;
Label1: TLabel;
Tv1: TcxGridDBTableView;
cxGrid1Level1: TcxGridLevel;
cxGrid1: TcxGrid;
cxGridPopupMenu1: TcxGridPopupMenu;
ADOQueryCmd: TADOQuery;
ADOQueryMain: TADOQuery;
ADOQueryTemp: TADOQuery;
DataSource1: TDataSource;
TBExport: TToolButton;
Order_Main: TClientDataSet;
Panel4: TPanel;
Label11: TLabel;
Panel10: TPanel;
Image2: TImage;
RichEdit1: TRichEdit;
v1Column1: TcxGridDBColumn;
v1Column2: TcxGridDBColumn;
v1Column4: TcxGridDBColumn;
v1Column5: TcxGridDBColumn;
v1Column8: TcxGridDBColumn;
v1Column9: TcxGridDBColumn;
RadioGroup1: TRadioGroup;
cxTabControl1: TcxTabControl;
v1Column6: TcxGridDBColumn;
v1Column7: TcxGridDBColumn;
v1Column10: TcxGridDBColumn;
v1Column3: TcxGridDBColumn;
Label3: TLabel;
Label7: TLabel;
Label8: TLabel;
Label9: TLabel;
Label10: TLabel;
OrderNo: TEdit;
MPRTMF: TEdit;
PRTColor: TEdit;
MPRTKZ: TEdit;
gangno: TEdit;
MPRTCodeName: TEdit;
v1Column11: TcxGridDBColumn;
v1Column12: TcxGridDBColumn;
v1Column13: TcxGridDBColumn;
v1Column14: TcxGridDBColumn;
v1Column15: TcxGridDBColumn;
v1Column16: TcxGridDBColumn;
v1Column17: TcxGridDBColumn;
v1Column18: TcxGridDBColumn;
MovePanel2: TMovePanel;
procedure FormDestroy(Sender: TObject);
procedure FormClose(Sender: TObject; var Action: TCloseAction);
procedure FormCreate(Sender: TObject);
procedure TBCloseClick(Sender: TObject);
procedure TBFindClick(Sender: TObject);
procedure TBExportClick(Sender: TObject);
procedure TBRafreshClick(Sender: TObject);
procedure AOrdDefNote4Change(Sender: TObject);
procedure FormShow(Sender: TObject);
procedure Panel10MouseMove(Sender: TObject; Shift: TShiftState; X,
Y: Integer);
procedure Image2Click(Sender: TObject);
procedure Tv1MouseUp(Sender: TObject; Button: TMouseButton;
Shift: TShiftState; X, Y: Integer);
procedure Tv1CellDblClick(Sender: TcxCustomGridTableView;
ACellViewInfo: TcxGridTableDataCellViewInfo; AButton: TMouseButton;
AShift: TShiftState; var AHandled: Boolean);
procedure RadioGroup1Click(Sender: TObject);
procedure cxTabControl1Change(Sender: TObject);
procedure OrderNoKeyPress(Sender: TObject; var Key: Char);
private
DQdate:TDateTime;
FLeft,FTop:Integer;
procedure InitGrid();
procedure InitGrid10();
procedure InitForm();
{ Private declarations }
public
FFInt:Integer;
{ Public declarations }
end;
var
frmJYOrderCDMore: TfrmJYOrderCDMore;
implementation
uses
U_DataLink,U_OrderInPut,U_Fun;
{$R *.dfm}
procedure TfrmJYOrderCDMore.FormDestroy(Sender: TObject);
begin
frmJYOrderCDMore:=nil;
end;
procedure TfrmJYOrderCDMore.FormClose(Sender: TObject;
var Action: TCloseAction);
begin
Action:=caFree;
end;
procedure TfrmJYOrderCDMore.FormCreate(Sender: TObject);
begin
cxgrid1.Align:=alClient;
DQdate:=SGetServerDate(ADOQueryTemp);
end;
procedure TfrmJYOrderCDMore.TBCloseClick(Sender: TObject);
begin
Close;
//WriteCxGrid('<27><><EFBFBD><EFBFBD><E9B1A8>J',Tv1,'Ⱦ<><C8BE><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>');
end;
procedure TfrmJYOrderCDMore.InitGrid();
var
i:integer;
j,z:Integer;
begin
try
ADOQueryMain.DisableControls;
with ADOQueryMain do
begin
Filtered:=False;
Close;
sql.Clear;
sql.Add('exec P_JYOrder_HZFX :begdate,:enddate,:PState,:FFsql ');
Parameters.ParamByName('begdate').Value:=FormatDateTime('yyyy-MM-dd',BegDate.DateTime);
Parameters.ParamByName('enddate').Value:=FormatDateTime('yyyy-MM-dd',enddate.DateTime+1);
if cxTabControl1.TabIndex=0 then
Parameters.ParamByName('PState').Value:=RadioGroup1.ItemIndex+1
else
Parameters.ParamByName('PState').Value:=RadioGroup1.ItemIndex+4;
Parameters.ParamByName('FFsql').Value:='';
Open;
end;
SCreateCDSOnly(ADOQueryMain,Order_Main);
SInitCDSDataOnly(ADOQueryMain,Order_Main);
for i:=18 to Order_Main.FieldCount-1 do
begin
if Tv1.ColumnCount>i then
begin
end else
Tv1.CreateColumn;
Tv1.Columns[i].Width:=68;
Tv1.Columns[i].DataBinding.FieldName:=Order_Main.Fields[i].FieldName;
Tv1.Columns[i].Caption:=Trim(Order_Main.Fields[i].FieldName);
tv1.Columns[i].Summary.FooterKind:=skSum;
end;
finally
ADOQueryMain.EnableControls;
end;
end;
procedure TfrmJYOrderCDMore.InitGrid10();
begin
try
ADOQueryMain.DisableControls;
with ADOQueryMain do
begin
Filtered:=False;
Close;
sql.Clear;
sql.Add('exec P_JYOrder_HZFX :begdate,:enddate,:PState ');
Parameters.ParamByName('begdate').Value:='2012-01-01';
Parameters.ParamByName('enddate').Value:='2011-01-01';
Parameters.ParamByName('PState').Value:=RadioGroup1.ItemIndex+1;
Open;
end;
SCreateCDS20(ADOQueryMain,Order_Main);
SInitCDSData20(ADOQueryMain,Order_Main);
finally
ADOQueryMain.EnableControls;
end;
end;
procedure TfrmJYOrderCDMore.InitForm();
begin
if SGetServerDate(ADOQueryTemp)>StrToDate('2014-07-11') then
begin
ToolBar1.Visible:=False;
Application.MessageBox('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ҫ<EFBFBD><D2AA><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ϵ<EFBFBD><CFB5>Ӧ<EFBFBD>̣<EFBFBD>','<27><>ʾ',0);
Exit;
end;
InitGrid();
BegDate.DateTime:=SGetServerDate10(ADOQueryTemp)-7;
EndDate.DateTime:=SGetServerDate10(ADOQueryTemp);
end;
procedure TfrmJYOrderCDMore.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 TfrmJYOrderCDMore.TBExportClick(Sender: TObject);
begin
if ADOQueryMain.IsEmpty then Exit;
if RadioGroup1.ItemIndex=0 then
SelExportData(Tv1,ADOQueryMain,'<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>')
else
if RadioGroup1.ItemIndex=1 then
SelExportData(Tv1,ADOQueryMain,'<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>');
end;
procedure TfrmJYOrderCDMore.TBRafreshClick(Sender: TObject);
begin
MovePanel2.Visible:=True;
MovePanel2.Refresh;
InitGrid();
MovePanel2.Visible:=False;
end;
procedure TfrmJYOrderCDMore.AOrdDefNote4Change(Sender: TObject);
begin
if ADOQueryMain.Active=False then Exit;
SDofilter(ADOQueryMain,SGetFiltersHint(Panel1,1,2));
SCreateCDS20(ADOQueryMain,Order_Main);
SInitCDSData20(ADOQueryMain,Order_Main);
end;
procedure TfrmJYOrderCDMore.FormShow(Sender: TObject);
begin
InitForm();
end;
procedure TfrmJYOrderCDMore.Panel10MouseMove(Sender: TObject;
Shift: TShiftState; X, Y: Integer);
begin
ReleaseCapture;
TWinControl(Panel4).Perform(WM_SYSCOMMAND,$F012,0);
end;
procedure TfrmJYOrderCDMore.Image2Click(Sender: TObject);
begin
Panel4.Visible:=False;
end;
procedure TfrmJYOrderCDMore.Tv1MouseUp(Sender: TObject;
Button: TMouseButton; Shift: TShiftState; X, Y: Integer);
begin
FLeft:=X;
FTop:=Y;
end;
procedure TfrmJYOrderCDMore.Tv1CellDblClick(Sender: TcxCustomGridTableView;
ACellViewInfo: TcxGridTableDataCellViewInfo; AButton: TMouseButton;
AShift: TShiftState; var AHandled: Boolean);
begin
{Panel4.Left:=FLeft;
Panel4.Top:=FTop+110;
Panel4.Visible:=True;
Panel4.Refresh;
Panel10.Caption:=Trim(TV1.Controller.FocusedColumn.Caption);
RichEdit1.Text:=Order_Main.fieldbyname(TV1.Controller.FocusedColumn.DataBinding.FilterFieldName).AsString; }
end;
procedure TfrmJYOrderCDMore.RadioGroup1Click(Sender: TObject);
begin
if RadioGroup1.ItemIndex=0 then
begin
GangNo.Text:='';
GangNo.ReadOnly:=True;
v1Column2.Visible:=False;
end else
begin
GangNo.ReadOnly:=False;
v1Column2.Visible:=True;
end;
TBRafresh.Click;
end;
procedure TfrmJYOrderCDMore.cxTabControl1Change(Sender: TObject);
begin
TBRafresh.Click;
if cxTabControl1.TabIndex=0 then
v1Column9.Caption:='<27>õ<EFBFBD><C3B5><EFBFBD><EFBFBD><EFBFBD>'
else
v1Column9.Caption:='<27>õ<EFBFBD><C3B5><EFBFBD><EFBFBD><EFBFBD>';
end;
procedure TfrmJYOrderCDMore.OrderNoKeyPress(Sender: TObject;
var Key: Char);
var
i:Integer;
begin
if Key=#13 then
begin
if Length(Trim(OrderNo.Text))<4 then Exit;
MovePanel2.Visible:=True;
MovePanel2.Refresh;
try
ADOQueryMain.DisableControls;
with ADOQueryMain do
begin
Filtered:=False;
Close;
sql.Clear;
sql.Add('exec P_JYOrder_HZFX :begdate,:enddate,:PState,:FFsql ');
Parameters.ParamByName('begdate').Value:='2010-01-01';
Parameters.ParamByName('enddate').Value:='2050-01-01';
if cxTabControl1.TabIndex=0 then
begin
Parameters.ParamByName('PState').Value:=RadioGroup1.ItemIndex+1;
Parameters.ParamByName('FFSql').Value:=' where C.OrderNo like '''+'%'+Trim(OrderNo.Text)+'%'+'''';
end
else
begin
Parameters.ParamByName('PState').Value:=RadioGroup1.ItemIndex+4;
Parameters.ParamByName('FFSql').Value:=' where C.OrderNo like '''+'%'+Trim(OrderNo.Text)+'%'+'''';
end;
Open;
end;
SCreateCDSOnly(ADOQueryMain,Order_Main);
SInitCDSDataOnly(ADOQueryMain,Order_Main);
for i:=18 to Order_Main.FieldCount-1 do
begin
if Tv1.ColumnCount>i then
begin
end else
Tv1.CreateColumn;
Tv1.Columns[i].Width:=68;
Tv1.Columns[i].DataBinding.FieldName:=Order_Main.Fields[i].FieldName;
Tv1.Columns[i].Caption:=Trim(Order_Main.Fields[i].FieldName);
tv1.Columns[i].Summary.FooterKind:=skSum;
end;
finally
ADOQueryMain.EnableControls;
end;
MovePanel2.Visible:=False;
end;
end;
end.