222 lines
5.9 KiB
ObjectPascal
222 lines
5.9 KiB
ObjectPascal
unit U_JYRLList;
|
||
|
||
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,
|
||
MovePanel, cxTextEdit, cxContainer, cxCurrencyEdit, BtnEdit, RM_e_main, RM_e_htm, RM_e_Graphic, RM_e_Jpeg, RM_e_txt, RM_e_csv, RM_E_llPDF, Math,
|
||
cxPC, Buttons, cxLookAndFeels, cxLookAndFeelPainters, dxBarBuiltInMenu,
|
||
cxNavigator;
|
||
|
||
type
|
||
TfrmJYRLList = class(TForm)
|
||
ToolBar1: TToolBar;
|
||
TBRafresh: TToolButton;
|
||
TBClose: TToolButton;
|
||
TBExport: TToolButton;
|
||
Panel1: TPanel;
|
||
Label1: TLabel;
|
||
Label12: TLabel;
|
||
Label7: TLabel;
|
||
BegDate: TDateTimePicker;
|
||
MPRTKZ: TEdit;
|
||
status: TComboBox;
|
||
cxTabControl1: TcxTabControl;
|
||
cxGrid1: TcxGrid;
|
||
Tv1: TcxGridDBTableView;
|
||
v1FillTime: TcxGridDBColumn;
|
||
v1Column4: TcxGridDBColumn;
|
||
v1MLOrderNo: TcxGridDBColumn;
|
||
v1MLConNo: TcxGridDBColumn;
|
||
v1MLCodeName: TcxGridDBColumn;
|
||
v1KHName: TcxGridDBColumn;
|
||
v1Column31: TcxGridDBColumn;
|
||
v1MLColorNo: TcxGridDBColumn;
|
||
cxGrid1Level1: TcxGridLevel;
|
||
v1Column1: TcxGridDBColumn;
|
||
MovePanel2: TMovePanel;
|
||
Order_Main: TClientDataSet;
|
||
DataSource1: TDataSource;
|
||
ADOQueryCmd: TADOQuery;
|
||
ADOQueryMain: TADOQuery;
|
||
ADOQueryTemp: TADOQuery;
|
||
cxGridPopupMenu1: TcxGridPopupMenu;
|
||
FBegDate: TDateTimePicker;
|
||
FEndDate: TDateTimePicker;
|
||
procedure FormDestroy(Sender: TObject);
|
||
procedure FormClose(Sender: TObject; var Action: TCloseAction);
|
||
procedure TBCloseClick(Sender: TObject);
|
||
procedure TBExportClick(Sender: TObject);
|
||
procedure TBRafreshClick(Sender: TObject);
|
||
procedure FormShow(Sender: TObject);
|
||
procedure cxTabControl1Change(Sender: TObject);
|
||
procedure Tv1DblClick(Sender: TObject);
|
||
private
|
||
DQdate: TDateTime;
|
||
FLeft, FTop: Integer;
|
||
CurrentPage, RecordsNumber: Integer;
|
||
canshu1: string;
|
||
procedure InitGrid();
|
||
procedure InitForm();
|
||
{ Private declarations }
|
||
public
|
||
FFInt: Integer;
|
||
{ Public declarations }
|
||
end;
|
||
|
||
var
|
||
frmJYRLList: TfrmJYRLList;
|
||
|
||
implementation
|
||
|
||
uses
|
||
U_DataLink, U_Fun, U_ZDYHelp,U_RTFun,U_JYOrdList;
|
||
|
||
{$R *.dfm}
|
||
|
||
|
||
procedure TfrmJYRLList.FormDestroy(Sender: TObject);
|
||
begin
|
||
frmJYRLList := nil;
|
||
end;
|
||
|
||
procedure TfrmJYRLList.FormClose(Sender: TObject; var Action: TCloseAction);
|
||
begin
|
||
Action := caFree;
|
||
end;
|
||
|
||
procedure TfrmJYRLList.TBCloseClick(Sender: TObject);
|
||
begin
|
||
Close;
|
||
WriteCxGrid('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ͳ<EFBFBD>Ʋ<EFBFBD>ѯ', Tv1, '<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>');
|
||
end;
|
||
|
||
procedure TfrmJYRLList.InitGrid();
|
||
var
|
||
FYue,FDate:string;
|
||
FInt:Integer;
|
||
FHuiLv:Double;
|
||
begin
|
||
|
||
//if RadioGroup1.ItemIndex=0 then
|
||
begin
|
||
if cxTabControl1.TabIndex<11 then
|
||
begin
|
||
FInt:=cxTabControl1.TabIndex+2;
|
||
end else
|
||
begin
|
||
FInt:=1;
|
||
end;
|
||
FYue:=Trim(IntToStr(FInt));
|
||
if FInt<10 then
|
||
begin
|
||
FYue:='0'+Trim(IntToStr(FInt));
|
||
end;
|
||
if FInt<>1 then
|
||
begin
|
||
FDate:=Trim(FormatDateTime('yyyy',begdate.Date))+'-'+FYue;
|
||
end else
|
||
begin
|
||
FDate:=Trim(FormatDateTime('yyyy',begdate.Date));
|
||
FDate:=IntToStr(strtoint(FDate)+1);
|
||
FDate:=FDate+'-'+FYue;
|
||
end;
|
||
|
||
FBegDate.Date:=StrToDate(FDate+'-01');
|
||
if FInt=12 then
|
||
FEndDate.Date:=StrToDate(Trim(FormatDateTime('yyyy',begdate.Date))+'-12-31')
|
||
else begin
|
||
if FInt=1 then
|
||
begin
|
||
FEndDate.Date:=StrToDate(FDate+'-31');
|
||
end else
|
||
begin
|
||
FEndDate.Date:=StrToDate(Trim(FormatDateTime('yyyy',begdate.Date))+'-'+Trim(IntToStr(FInt+1))+'-01')-1;
|
||
end;
|
||
end;
|
||
end;
|
||
try
|
||
ADOQueryMain.DisableControls;
|
||
with ADOQueryMain do
|
||
begin
|
||
Close;
|
||
SQL.Clear;
|
||
Filtered:=False;
|
||
sql.Add(' exec P_View_JYHZData :FBegdate,:FEndDate ') ;
|
||
Parameters.ParamByName('FBegdate').Value:=Trim(FormatDateTime('yyyy-MM-dd',FBegDate.Date));
|
||
Parameters.ParamByName('FEndDate').Value:=Trim(FormatDateTime('yyyy-MM-dd',FEndDate.Date+1));
|
||
Open;
|
||
end;
|
||
SCreateCDS20(ADOQueryMain,Order_Main);
|
||
SInitCDSData20(ADOQueryMain,Order_Main);
|
||
finally
|
||
ADOQueryMain.EnableControls;
|
||
end;
|
||
end;
|
||
procedure TfrmJYRLList.InitForm();
|
||
var
|
||
fstr:string;
|
||
begin
|
||
ReadCxGrid('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ͳ<EFBFBD>Ʋ<EFBFBD>ѯ', Tv1, '<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>');
|
||
BegDate.DateTime := SGetServerDate(ADOQueryTemp);
|
||
Fbegdate.DateTime:=SGetServerDate(ADOQueryTemp);
|
||
FEndDate.Date:=Fbegdate.DateTime;
|
||
fstr:=Trim(FormatDateTime('MM',Fbegdate.Date));
|
||
if StrToInt(fstr)=1 then
|
||
begin
|
||
begdate.DateTime:=SGetServerDateMBeg(ADOQueryTemp)-40;
|
||
cxTabControl1.TabIndex:=11;//StrToInt(fstr)-1;
|
||
end else
|
||
begin
|
||
begdate.DateTime:=SGetServerDateMBeg(ADOQueryTemp);
|
||
cxTabControl1.TabIndex:=StrToInt(fstr)-2;
|
||
end;
|
||
cxTabControl1.Tabs[11].Caption:=' 1<>£<EFBFBD>'+inttostr(strtoint(FormatDateTime('yyyy',begdate.Date))+1)+'<27><>)';
|
||
end;
|
||
|
||
procedure TfrmJYRLList.TBExportClick(Sender: TObject);
|
||
begin
|
||
if ADOQueryMain.IsEmpty then
|
||
Exit;
|
||
SelExportData(Tv1, ADOQueryMain, '<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ͳ<EFBFBD>Ʋ<EFBFBD>ѯ');
|
||
end;
|
||
|
||
procedure TfrmJYRLList.TBRafreshClick(Sender: TObject);
|
||
begin
|
||
toolbar1.SetFocus;
|
||
InitGrid();
|
||
end;
|
||
|
||
procedure TfrmJYRLList.FormShow(Sender: TObject);
|
||
begin
|
||
InitForm();
|
||
end;
|
||
|
||
procedure TfrmJYRLList.cxTabControl1Change(Sender: TObject);
|
||
begin
|
||
InitGrid();
|
||
end;
|
||
|
||
procedure TfrmJYRLList.Tv1DblClick(Sender: TObject);
|
||
begin
|
||
if Order_Main.IsEmpty then Exit;
|
||
try
|
||
frmJYOrdList:=TfrmJYOrdList.Create(Application);
|
||
with frmJYOrdList do
|
||
begin
|
||
frmJYOrdList.FBegDate.Date:=Self.Order_Main.fieldbyname('JYDate').AsDateTime;
|
||
frmJYOrdList.FEndDate.Date:=Self.Order_Main.fieldbyname('JYDate').AsDateTime;
|
||
if ShowModal=1 then
|
||
begin
|
||
|
||
end;
|
||
end;
|
||
finally
|
||
frmJYOrdList.Free;
|
||
end;
|
||
end;
|
||
|
||
end.
|
||
|
||
|