194 lines
5.7 KiB
ObjectPascal
194 lines
5.7 KiB
ObjectPascal
|
|
unit U_ProductListHelp;
|
|||
|
|
|
|||
|
|
interface
|
|||
|
|
|
|||
|
|
uses
|
|||
|
|
Winapi.Windows, Winapi.Messages, System.SysUtils, System.Variants, System.Classes, Vcl.Graphics,
|
|||
|
|
Vcl.Controls, Vcl.Forms, Vcl.Dialogs, cxGraphics, cxControls, cxLookAndFeels,
|
|||
|
|
cxLookAndFeelPainters, cxStyles, cxCustomData,
|
|||
|
|
cxFilter, cxData, cxDataStorage, cxEdit, cxNavigator, dxDateRanges,
|
|||
|
|
dxScrollbarAnnotations, Data.DB, cxDBData, cxCalendar, cxGridLevel,
|
|||
|
|
cxGridCustomTableView, cxGridTableView, cxGridDBTableView, cxClasses,
|
|||
|
|
cxGridCustomView, cxGrid, Vcl.StdCtrls, Vcl.ComCtrls, Vcl.ExtCtrls,
|
|||
|
|
Vcl.ToolWin, Data.Win.ADODB, U_BaseHelp, U_BaseList, System.ImageList,
|
|||
|
|
Vcl.ImgList, Datasnap.DBClient, dxBarBuiltInMenu, cxGridCustomPopupMenu,
|
|||
|
|
cxGridPopupMenu, dxLayoutContainer, dxLayoutControl, cxContainer, dxCore,
|
|||
|
|
cxDateUtils, dxLayoutcxEditAdapters, cxMaskEdit, cxDropDownEdit, cxTextEdit;
|
|||
|
|
|
|||
|
|
type
|
|||
|
|
TfrmProductListHelp = class(TfrmBaseHelp)
|
|||
|
|
ToolBar1: TToolBar;
|
|||
|
|
TBRafresh: TToolButton;
|
|||
|
|
TBFind: TToolButton;
|
|||
|
|
TBClose: TToolButton;
|
|||
|
|
cxGrid2: TcxGrid;
|
|||
|
|
TV2: TcxGridDBTableView;
|
|||
|
|
V2filltime: TcxGridDBColumn;
|
|||
|
|
V2Subid: TcxGridDBColumn;
|
|||
|
|
V2Column10: TcxGridDBColumn;
|
|||
|
|
V2CustomerNoName: TcxGridDBColumn;
|
|||
|
|
V2KHOrderNo: TcxGridDBColumn;
|
|||
|
|
V2Column14: TcxGridDBColumn;
|
|||
|
|
V2C_Name: TcxGridDBColumn;
|
|||
|
|
V2C_Spec: TcxGridDBColumn;
|
|||
|
|
V2C_Color: TcxGridDBColumn;
|
|||
|
|
V2C_ColorNo: TcxGridDBColumn;
|
|||
|
|
V2C_Pattern: TcxGridDBColumn;
|
|||
|
|
V2OrdSNote: TcxGridDBColumn;
|
|||
|
|
V2packNote: TcxGridDBColumn;
|
|||
|
|
V2OrdQty: TcxGridDBColumn;
|
|||
|
|
V2OrderUnit: TcxGridDBColumn;
|
|||
|
|
cxGridLevel1: TcxGridLevel;
|
|||
|
|
DataSource1: TDataSource;
|
|||
|
|
ADOQueryMain: TADOQuery;
|
|||
|
|
Order_Main: TClientDataSet;
|
|||
|
|
TV2OrdPiece: TcxGridDBColumn;
|
|||
|
|
cxGridPopupMenu1: TcxGridPopupMenu;
|
|||
|
|
TselOk: TToolButton;
|
|||
|
|
ToolButton1: TToolButton;
|
|||
|
|
dxLayoutControl_query: TdxLayoutControl;
|
|||
|
|
custName: TcxTextEdit;
|
|||
|
|
conNo: TcxTextEdit;
|
|||
|
|
BuyConNo: TcxTextEdit;
|
|||
|
|
OrderNo: TcxTextEdit;
|
|||
|
|
C_Color: TcxTextEdit;
|
|||
|
|
C_Name: TcxTextEdit;
|
|||
|
|
enddate: TcxDateEdit;
|
|||
|
|
begdate: TcxDateEdit;
|
|||
|
|
dxLayoutControl_queryGroup_Root: TdxLayoutGroup;
|
|||
|
|
dxLayoutItem1: TdxLayoutItem;
|
|||
|
|
dxLayoutItem2: TdxLayoutItem;
|
|||
|
|
dxLayoutItem_color: TdxLayoutItem;
|
|||
|
|
dxLayoutItem_pm: TdxLayoutItem;
|
|||
|
|
dxLayoutItem_beg: TdxLayoutItem;
|
|||
|
|
dxLayoutItem_end: TdxLayoutItem;
|
|||
|
|
dxLayoutItem_hth: TdxLayoutItem;
|
|||
|
|
dxLayoutItem_khdh: TdxLayoutItem;
|
|||
|
|
dxLayoutItem_Pattern: TdxLayoutItem;
|
|||
|
|
C_Pattern: TcxTextEdit;
|
|||
|
|
TV2Column1: TcxGridDBColumn;
|
|||
|
|
procedure TBCloseClick(Sender: TObject);
|
|||
|
|
procedure FormCreate(Sender: TObject);
|
|||
|
|
procedure TBRafreshClick(Sender: TObject);
|
|||
|
|
procedure TselOkClick(Sender: TObject);
|
|||
|
|
procedure TV2DblClick(Sender: TObject);
|
|||
|
|
procedure FormShow(Sender: TObject);
|
|||
|
|
procedure ToolButton1Click(Sender: TObject);
|
|||
|
|
procedure TBFindClick(Sender: TObject);
|
|||
|
|
private
|
|||
|
|
procedure InitForm();
|
|||
|
|
procedure InitGrid();
|
|||
|
|
public
|
|||
|
|
fType:string;
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
var
|
|||
|
|
frmProductListHelp: TfrmProductListHelp;
|
|||
|
|
|
|||
|
|
implementation
|
|||
|
|
uses
|
|||
|
|
U_DataLink,U_globalVar,U_RTFun,U_FormLayOutDesign;
|
|||
|
|
{$R *.dfm}
|
|||
|
|
|
|||
|
|
procedure TfrmProductListHelp.FormCreate(Sender: TObject);
|
|||
|
|
begin
|
|||
|
|
inherited;
|
|||
|
|
cxGrid2.Align:=alClient;
|
|||
|
|
BegDate.Date:=SGetServerDateTime(ADOQueryBaseTemp)-3;
|
|||
|
|
endDate.Date:=SGetServerDateTime(ADOQueryBaseTemp)
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
procedure TfrmProductListHelp.FormShow(Sender: TObject);
|
|||
|
|
begin
|
|||
|
|
inherited;
|
|||
|
|
InitForm();
|
|||
|
|
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
procedure TfrmProductListHelp.InitForm();
|
|||
|
|
begin
|
|||
|
|
InitGrid();
|
|||
|
|
ReadCxGrid(self.Caption+tv2.Name,Tv2,gDllFileCaption);
|
|||
|
|
|
|||
|
|
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
procedure TfrmProductListHelp.TBFindClick(Sender: TObject);
|
|||
|
|
begin
|
|||
|
|
if ADOQueryMain.Active=False then Exit;
|
|||
|
|
SDofilter(ADOQueryMain, SLGetFilters(dxLayoutControl_query, 1, 2));
|
|||
|
|
SCreateCDS(ADOQueryMain, Order_Main);
|
|||
|
|
SInitCDSData(ADOQueryMain, Order_Main);
|
|||
|
|
end;
|
|||
|
|
procedure TfrmProductListHelp.TBRafreshClick(Sender: TObject);
|
|||
|
|
begin
|
|||
|
|
OrderNo.SetFocus;
|
|||
|
|
InitGrid();
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
procedure TfrmProductListHelp.ToolButton1Click(Sender: TObject);
|
|||
|
|
begin
|
|||
|
|
WriteCxGrid(trim(Self.Caption)+tv2.Name , Tv2, gDllFileCaption);
|
|||
|
|
if gIsCanDesign then
|
|||
|
|
begin
|
|||
|
|
saveLayOut(application,dxLayoutControl_query, ADOQueryBaseCmd,
|
|||
|
|
PWideChar( fDllFileName + '|' + Self.Name + '|' + dxLayoutControl_query.Name
|
|||
|
|
+ '.ini'));
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
procedure TfrmProductListHelp.TselOkClick(Sender: TObject);
|
|||
|
|
begin
|
|||
|
|
inherited;
|
|||
|
|
if Order_Main.IsEmpty then exit;
|
|||
|
|
|
|||
|
|
ModalResult:=1;
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
procedure TfrmProductListHelp.TV2DblClick(Sender: TObject);
|
|||
|
|
begin
|
|||
|
|
inherited;
|
|||
|
|
TselOk.Click;
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
procedure TfrmProductListHelp.TBCloseClick(Sender: TObject);
|
|||
|
|
begin
|
|||
|
|
close;
|
|||
|
|
end;
|
|||
|
|
procedure TfrmProductListHelp.InitGrid();
|
|||
|
|
var
|
|||
|
|
mBegDate:string;
|
|||
|
|
mendDate:string;
|
|||
|
|
begin
|
|||
|
|
if BegDate.Text<>'' then
|
|||
|
|
mBegDate := FormatDateTime('yyyy-MM-dd', BegDate.Date);
|
|||
|
|
if enddate.Text<>'' then
|
|||
|
|
mendDate := FormatDateTime('yyyy-MM-dd', enddate.Date + 1);
|
|||
|
|
try
|
|||
|
|
Order_Main.DisableControls;
|
|||
|
|
with ADOQueryMain do
|
|||
|
|
begin
|
|||
|
|
Close;
|
|||
|
|
sql.Clear;
|
|||
|
|
sql.Add('select A.* ');
|
|||
|
|
// sql.Add(',SumPiece=(select Sum(X.Piece) from BS_Cloth_IO X where X.IOFlag=''<27><><EFBFBD><EFBFBD>'' and X.fromSubID=A.SubID and isnull(X.STKNAME,'''')=' + Quotedstr(Trim(FSTKNAME)) + ')');
|
|||
|
|
//sql.Add(',SumQty=(select Sum(X.Qty) from BS_Cloth_IO X where X.IOFlag=''<27><><EFBFBD><EFBFBD>'' and X.fromSubID=A.SubID and isnull(X.STKNAME,'''')=' + Quotedstr(Trim(FSTKNAME)) + ')');
|
|||
|
|
sql.Add('from V_Trade_Plan_Fty A ');
|
|||
|
|
sql.add('where Status=''9'' ');
|
|||
|
|
if mBegDate<>'' then
|
|||
|
|
sql.Add('and filltime>='+QuotedStr(mBegDate));
|
|||
|
|
if mendDate<>'' then
|
|||
|
|
sql.Add('and filltime<'+QuotedStr(mendDate));
|
|||
|
|
Open;
|
|||
|
|
end;
|
|||
|
|
SDofilter(ADOQueryMain, SLGetFilters(dxLayoutControl_query, 1, 2));
|
|||
|
|
SCreateCDS(ADOQueryMain, Order_Main);
|
|||
|
|
SInitCDSData(ADOQueryMain, Order_Main);
|
|||
|
|
finally
|
|||
|
|
Order_Main.EnableControls;
|
|||
|
|
end;
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
end.
|