691 lines
20 KiB
ObjectPascal
691 lines
20 KiB
ObjectPascal
![]() |
unit U_PRTOrderChkList;
|
|||
|
|
|||
|
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, RM_DsgGridReport, RM_Designer, cxPC;
|
|||
|
|
|||
|
type
|
|||
|
TfrmPRTOrderChkList = class(TForm)
|
|||
|
ToolBar1: TToolBar;
|
|||
|
TBRafresh: TToolButton;
|
|||
|
TBFind: TToolButton;
|
|||
|
TBPrint: TToolButton;
|
|||
|
TBClose: TToolButton;
|
|||
|
Panel1: TPanel;
|
|||
|
BegDate: TDateTimePicker;
|
|||
|
EndDate: TDateTimePicker;
|
|||
|
Label1: TLabel;
|
|||
|
cxGridPopupMenu1: TcxGridPopupMenu;
|
|||
|
ADOQueryCmd: TADOQuery;
|
|||
|
ADOQueryMain: TADOQuery;
|
|||
|
ADOQueryTemp: TADOQuery;
|
|||
|
DataSource1: TDataSource;
|
|||
|
Label3: TLabel;
|
|||
|
OrderNo: TEdit;
|
|||
|
TBExport: TToolButton;
|
|||
|
Order_Main: TClientDataSet;
|
|||
|
RM1: TRMGridReport;
|
|||
|
RMDBMain: TRMDBDataSet;
|
|||
|
Label4: TLabel;
|
|||
|
KHNO: TEdit;
|
|||
|
TBView: TToolButton;
|
|||
|
Label8: TLabel;
|
|||
|
MPRTCodeName: TEdit;
|
|||
|
Label10: TLabel;
|
|||
|
MPRTSpec: TEdit;
|
|||
|
Label12: TLabel;
|
|||
|
MPRTKZ: TEdit;
|
|||
|
Label13: TLabel;
|
|||
|
MPRTMF: TEdit;
|
|||
|
ADOQueryPrint: TADOQuery;
|
|||
|
CDS_Print: TClientDataSet;
|
|||
|
ComboBox1: TComboBox;
|
|||
|
Label9: TLabel;
|
|||
|
Label2: TLabel;
|
|||
|
ConNo: TEdit;
|
|||
|
LiDanPerson: TEdit;
|
|||
|
RMDBDataSet1: TRMDBDataSet;
|
|||
|
RM2: TRMGridReport;
|
|||
|
ToolButton3: TToolButton;
|
|||
|
RMXLSExport2: TRMXLSExport;
|
|||
|
cxTabControl1: TcxTabControl;
|
|||
|
ToolButton1: TToolButton;
|
|||
|
ToolButton4: TToolButton;
|
|||
|
cxGrid1: TcxGrid;
|
|||
|
Tv1: TcxGridDBTableView;
|
|||
|
v1OrderNo: TcxGridDBColumn;
|
|||
|
v1OrdDate: TcxGridDBColumn;
|
|||
|
v1DeliveryDate: TcxGridDBColumn;
|
|||
|
v1CustomerNoName: TcxGridDBColumn;
|
|||
|
v1Column5: TcxGridDBColumn;
|
|||
|
v1MPRTCodeName: TcxGridDBColumn;
|
|||
|
v1MPRTSpec: TcxGridDBColumn;
|
|||
|
v1Column1: TcxGridDBColumn;
|
|||
|
v1MPRTMF: TcxGridDBColumn;
|
|||
|
v1MPRTKZ: TcxGridDBColumn;
|
|||
|
v1Column2: TcxGridDBColumn;
|
|||
|
v1Column3: TcxGridDBColumn;
|
|||
|
v1Column4: TcxGridDBColumn;
|
|||
|
v1Column6: TcxGridDBColumn;
|
|||
|
v1Column7: TcxGridDBColumn;
|
|||
|
v1Column8: TcxGridDBColumn;
|
|||
|
v1Column9: TcxGridDBColumn;
|
|||
|
v1Column10: TcxGridDBColumn;
|
|||
|
v1Column11: TcxGridDBColumn;
|
|||
|
v1Column12: TcxGridDBColumn;
|
|||
|
cxGrid1Level1: TcxGridLevel;
|
|||
|
ToolButton2: TToolButton;
|
|||
|
ToolButton5: TToolButton;
|
|||
|
v1Column13: TcxGridDBColumn;
|
|||
|
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 TBPrintClick(Sender: TObject);
|
|||
|
procedure TBRafreshClick(Sender: TObject);
|
|||
|
procedure OrderNoChange(Sender: TObject);
|
|||
|
procedure FormShow(Sender: TObject);
|
|||
|
procedure Tv1CellDblClick(Sender: TcxCustomGridTableView;
|
|||
|
ACellViewInfo: TcxGridTableDataCellViewInfo; AButton: TMouseButton;
|
|||
|
AShift: TShiftState; var AHandled: Boolean);
|
|||
|
procedure CheckBox1Click(Sender: TObject);
|
|||
|
procedure CheckBox2Click(Sender: TObject);
|
|||
|
procedure Tv1StylesGetContentStyle(Sender: TcxCustomGridTableView;
|
|||
|
ARecord: TcxCustomGridRecord; AItem: TcxCustomGridTableItem;
|
|||
|
out AStyle: TcxStyle);
|
|||
|
procedure v1DeliveryDateCustomDrawCell(Sender: TcxCustomGridTableView;
|
|||
|
ACanvas: TcxCanvas; AViewInfo: TcxGridTableDataCellViewInfo;
|
|||
|
var ADone: Boolean);
|
|||
|
procedure TBViewClick(Sender: TObject);
|
|||
|
procedure OrderNoKeyPress(Sender: TObject; var Key: Char);
|
|||
|
procedure ConNoKeyPress(Sender: TObject; var Key: Char);
|
|||
|
procedure ToolButton3Click(Sender: TObject);
|
|||
|
procedure ToolButton1Click(Sender: TObject);
|
|||
|
procedure ToolButton4Click(Sender: TObject);
|
|||
|
procedure cxTabControl1Change(Sender: TObject);
|
|||
|
procedure ToolButton5Click(Sender: TObject);
|
|||
|
procedure ToolButton2Click(Sender: TObject);
|
|||
|
private
|
|||
|
CanShu1,CanShu2:string;
|
|||
|
DQdate:TDateTime;
|
|||
|
procedure InitGrid();
|
|||
|
procedure InitForm();
|
|||
|
function DelData():Boolean;
|
|||
|
procedure InitGridFH();
|
|||
|
{ Private declarations }
|
|||
|
public
|
|||
|
FFInt,FCloth:Integer;
|
|||
|
|
|||
|
{ Public declarations }
|
|||
|
end;
|
|||
|
|
|||
|
var
|
|||
|
frmPRTOrderChkList: TfrmPRTOrderChkList;
|
|||
|
|
|||
|
implementation
|
|||
|
uses
|
|||
|
U_DataLink,U_OrderInPut,U_RTFun, U_ZDYHelp, U_ZDYHelpSel, U_ModuleNote,U_OrderInPutPrice;
|
|||
|
|
|||
|
{$R *.dfm}
|
|||
|
|
|||
|
procedure TfrmPRTOrderChkList.FormDestroy(Sender: TObject);
|
|||
|
begin
|
|||
|
frmPRTOrderChkList:=nil;
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmPRTOrderChkList.FormClose(Sender: TObject;
|
|||
|
var Action: TCloseAction);
|
|||
|
begin
|
|||
|
Action:=caFree;
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmPRTOrderChkList.FormCreate(Sender: TObject);
|
|||
|
begin
|
|||
|
cxgrid1.Align:=alClient;
|
|||
|
CanShu1:=Trim(DParameters1);
|
|||
|
CanShu2:=Trim(DParameters2);
|
|||
|
//BegDate.DateTime:=SGetServerDateTime(ADOQueryTemp)-7;
|
|||
|
//EndDate.DateTime:=SGetServerDateTime(ADOQueryTemp);
|
|||
|
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmPRTOrderChkList.TBCloseClick(Sender: TObject);
|
|||
|
begin
|
|||
|
Close;
|
|||
|
WriteCxGrid('ָʾ<D6B8><CABE><EFBFBD>б<EFBFBD>',Tv1,'<27><><EFBFBD><EFBFBD>ָʾ<D6B8><CABE><EFBFBD><EFBFBD><EFBFBD><EFBFBD>');
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmPRTOrderChkList.InitGrid();
|
|||
|
var
|
|||
|
fsj:string;
|
|||
|
begin
|
|||
|
try
|
|||
|
ADOQueryMain.DisableControls;
|
|||
|
with ADOQueryMain do
|
|||
|
begin
|
|||
|
Filtered:=False;
|
|||
|
Close;
|
|||
|
sql.Clear;
|
|||
|
sql.add('exec P_View_Order :begdate,:enddate,:WSql') ;
|
|||
|
|
|||
|
if cxTabControl1.TabIndex=0 then
|
|||
|
begin
|
|||
|
fsj:=' and isnull(A.Chker,'''')='''' ';
|
|||
|
end else
|
|||
|
if cxTabControl1.TabIndex=1 then
|
|||
|
begin
|
|||
|
fsj:=' and isnull(Chker,'''')<>'''' and ZuoFeiFlag=0 ';
|
|||
|
end else
|
|||
|
if cxTabControl1.TabIndex=2 then
|
|||
|
begin
|
|||
|
fsj:=' and isnull(PChker,'''')='''' and ZuoFeiFlag=1 ';
|
|||
|
end else
|
|||
|
if cxTabControl1.TabIndex=3 then
|
|||
|
begin
|
|||
|
fsj:=' and isnull(PChker,'''')<>'''' ';
|
|||
|
end;
|
|||
|
Parameters.ParamByName('WSql').Value:=' and isnull(A.SChker,'''')<>'''' '+fsj;
|
|||
|
Parameters.ParamByName('begdate').Value:=FormatDateTime('yyyy-MM-dd',BegDate.DateTime);
|
|||
|
Parameters.ParamByName('enddate').Value:=FormatDateTime('yyyy-MM-dd',enddate.DateTime+1);
|
|||
|
ExecSQL;
|
|||
|
Open;
|
|||
|
end;
|
|||
|
SCreateCDS20(ADOQueryMain,Order_Main);
|
|||
|
SInitCDSData20(ADOQueryMain,Order_Main);
|
|||
|
finally
|
|||
|
ADOQueryMain.EnableControls;
|
|||
|
end;
|
|||
|
end;
|
|||
|
procedure TfrmPRTOrderChkList.InitGridFH();
|
|||
|
begin
|
|||
|
try
|
|||
|
ADOQueryMain.DisableControls;
|
|||
|
with ADOQueryMain do
|
|||
|
begin
|
|||
|
Filtered:=False;
|
|||
|
Close;
|
|||
|
sql.Clear;
|
|||
|
sql.Add('exec Order_QryList :MainId,:WSql');
|
|||
|
Parameters.ParamByName('WSql').Value:=' and FillTime>='''+Trim(FormatDateTime('yyyy-MM-dd',BegDate.DateTime))+''''
|
|||
|
+' and FillTime<'''+Trim(FormatDateTime('yyyy-MM-dd',EndDate.DateTime+1))+'''';
|
|||
|
Open;
|
|||
|
end;
|
|||
|
SCreateCDS20(ADOQueryMain,Order_Main);
|
|||
|
SInitCDSData20(ADOQueryMain,Order_Main);
|
|||
|
finally
|
|||
|
ADOQueryMain.EnableControls;
|
|||
|
end;
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmPRTOrderChkList.InitForm();
|
|||
|
begin
|
|||
|
ReadCxGrid('ָʾ<D6B8><CABE><EFBFBD>б<EFBFBD>',Tv1,'<27><><EFBFBD><EFBFBD>ָʾ<D6B8><CABE><EFBFBD><EFBFBD><EFBFBD><EFBFBD>');
|
|||
|
BegDate.DateTime:=SGetServerDate10(ADOQueryTemp)-92;
|
|||
|
EndDate.DateTime:=SGetServerDate10(ADOQueryTemp);
|
|||
|
with ADOQueryTemp do
|
|||
|
begin
|
|||
|
Close;
|
|||
|
sql.Clear;
|
|||
|
sql.Add('select Top 10* from JYOrder_Main Order by FillTime desc');
|
|||
|
Open;
|
|||
|
end;
|
|||
|
ComboBox1.Clear;
|
|||
|
with ADOQueryTemp do
|
|||
|
begin
|
|||
|
First;
|
|||
|
while not Eof do
|
|||
|
begin
|
|||
|
ComboBox1.Items.Add(Trim(ADOQueryTemp.fieldbyname('OrderNO').AsString));
|
|||
|
Next;
|
|||
|
end;
|
|||
|
end;
|
|||
|
//InitGrid();
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmPRTOrderChkList.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;
|
|||
|
|
|||
|
function TfrmPRTOrderChkList.DelData():Boolean;
|
|||
|
begin
|
|||
|
try
|
|||
|
Result:=false;
|
|||
|
ADOQueryCmd.Connection.BeginTrans;
|
|||
|
with ADOQueryCmd do
|
|||
|
begin
|
|||
|
Close;
|
|||
|
sql.Clear;
|
|||
|
sql.Add('delete JYOrder_Main where MainId='''+Trim(Order_Main.fieldbyname('MainId').AsString)+'''');
|
|||
|
sql.Add('delete JYOrder_Sub where MainId='''+Trim(Order_Main.fieldbyname('MainId').AsString)+'''');
|
|||
|
ExecSQL;
|
|||
|
end;
|
|||
|
{with ADOQueryTemp do
|
|||
|
begin
|
|||
|
Close;
|
|||
|
sql.Clear;
|
|||
|
sql.Add('select * from JYOrder_Sub where MainId='''+Trim(Order_Main.fieldbyname('MainId').AsString)+'''');
|
|||
|
Open;
|
|||
|
if IsEmpty then
|
|||
|
begin
|
|||
|
with ADOQueryCmd do
|
|||
|
begin
|
|||
|
Close;
|
|||
|
sql.Clear;
|
|||
|
sql.Add('delete JYOrder_Main where MainId='''+Trim(Order_Main.fieldbyname('MainId').AsString)+'''');
|
|||
|
ExecSQL;
|
|||
|
end;
|
|||
|
end;
|
|||
|
end;
|
|||
|
if Trim(Order_Main.fieldbyname('SubId').AsString)='' then
|
|||
|
begin
|
|||
|
with ADOQueryCmd do
|
|||
|
begin
|
|||
|
Close;
|
|||
|
sql.Clear;
|
|||
|
sql.Add('delete JYOrder_Main where MainId='''+Trim(Order_Main.fieldbyname('MainId').AsString)+'''');
|
|||
|
ExecSQL;
|
|||
|
end;
|
|||
|
end; }
|
|||
|
ADOQueryCmd.Connection.CommitTrans;
|
|||
|
Result:=True;
|
|||
|
except
|
|||
|
ADOQueryCmd.Connection.RollbackTrans;
|
|||
|
Result:=False;
|
|||
|
Application.MessageBox('<27><><EFBFBD><EFBFBD>ɾ<EFBFBD><C9BE><EFBFBD>쳣<EFBFBD><ECB3A3>','<27><>ʾ',0);
|
|||
|
end;
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmPRTOrderChkList.TBExportClick(Sender: TObject);
|
|||
|
begin
|
|||
|
if ADOQueryMain.IsEmpty then Exit;
|
|||
|
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmPRTOrderChkList.TBPrintClick(Sender: TObject);
|
|||
|
var
|
|||
|
fPrintFile:string;
|
|||
|
begin
|
|||
|
if Order_Main.IsEmpty then Exit;
|
|||
|
fPrintFile:= ExtractFilePath(Application.ExeName) + 'Report\<5C><><EFBFBD><EFBFBD>ָʾ<D6B8><CABE>.rmf' ;
|
|||
|
with ADOQueryPrint do
|
|||
|
begin
|
|||
|
Close;
|
|||
|
sql.Clear;
|
|||
|
sql.Add('select HZ.* ');
|
|||
|
sql.Add(',Case when HXCount>0 then Cast(HXCount As varchar(20))+''<27><>'' else Cast(null as varchar(20)) end as HX ');
|
|||
|
sql.Add(',Case when ColorCount>0 then Cast(ColorCount As varchar(20))+''ɫ'' else Cast(null as varchar(20)) end as YS ');
|
|||
|
sql.Add(' from(select A.* ');
|
|||
|
sql.Add(',KHType=(select KHType from ZH_KH_Info KH where KH.KHNameJC=A.CustomerNoName)');
|
|||
|
sql.Add(',HXCount=(select isnull(Count(*),0) from ');
|
|||
|
sql.Add(' (select PRTHX from JYOrder_Sub B where B.MainId=A.MainId and isnull(PRTHX,'''')<>'''' group by PRTHX)AA)');
|
|||
|
sql.Add(',ColorCount=(select isnull(Count(*),0) from ');
|
|||
|
sql.Add(' (select PRTColorEng from JYOrder_Sub B where B.MainId=A.MainId and isnull(PRTColorEng,'''')<>'''' group by PRTColorEng)AA)');
|
|||
|
sql.Add(' from JYOrder_Main A ');
|
|||
|
sql.Add(' where A.MainId='''+Trim(Order_Main.fieldbyname('MainId').AsString)+''')HZ');
|
|||
|
Open;
|
|||
|
end;
|
|||
|
SCreateCDS20(ADOQueryPrint,CDS_Print);
|
|||
|
SInitCDSData20(ADOQueryPrint,CDS_Print);
|
|||
|
if FileExists(fPrintFile) then
|
|||
|
begin
|
|||
|
RMVariables['ZQty']:=Order_Main.fieldbyname('ZQty').Value;
|
|||
|
RMVariables['OrderUnit']:=Order_Main.fieldbyname('OrderUnit').Value;
|
|||
|
RM1.LoadFromFile(fPrintFile);
|
|||
|
RM1.ShowReport;
|
|||
|
end else
|
|||
|
begin
|
|||
|
Application.MessageBox(PChar('û<><C3BB><EFBFBD><EFBFBD>'+ExtractFilePath(Application.ExeName)+'Report\<5C><><EFBFBD><EFBFBD>ָʾ<D6B8><CABE>.rmf'),'<27><>ʾ',0);
|
|||
|
end;
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmPRTOrderChkList.TBRafreshClick(Sender: TObject);
|
|||
|
begin
|
|||
|
InitGrid();
|
|||
|
with ADOQueryTemp do
|
|||
|
begin
|
|||
|
Close;
|
|||
|
sql.Clear;
|
|||
|
sql.Add('select Top 10* from JYOrder_Main Order by FillTime desc');
|
|||
|
Open;
|
|||
|
end;
|
|||
|
ComboBox1.Clear;
|
|||
|
with ADOQueryTemp do
|
|||
|
begin
|
|||
|
First;
|
|||
|
while not Eof do
|
|||
|
begin
|
|||
|
ComboBox1.Items.Add(Trim(ADOQueryTemp.fieldbyname('OrderNO').AsString));
|
|||
|
Next;
|
|||
|
end;
|
|||
|
end;
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmPRTOrderChkList.OrderNoChange(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 TfrmPRTOrderChkList.FormShow(Sender: TObject);
|
|||
|
begin
|
|||
|
InitForm();
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmPRTOrderChkList.Tv1CellDblClick(
|
|||
|
Sender: TcxCustomGridTableView;
|
|||
|
ACellViewInfo: TcxGridTableDataCellViewInfo; AButton: TMouseButton;
|
|||
|
AShift: TShiftState; var AHandled: Boolean);
|
|||
|
begin
|
|||
|
if TBView.Visible=False then Exit;
|
|||
|
TBView.Click;
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmPRTOrderChkList.CheckBox1Click(Sender: TObject);
|
|||
|
begin
|
|||
|
InitGrid();
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmPRTOrderChkList.CheckBox2Click(Sender: TObject);
|
|||
|
begin
|
|||
|
TBRafresh.Click;
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmPRTOrderChkList.Tv1StylesGetContentStyle(
|
|||
|
Sender: TcxCustomGridTableView; ARecord: TcxCustomGridRecord;
|
|||
|
AItem: TcxCustomGridTableItem; out AStyle: TcxStyle);
|
|||
|
var
|
|||
|
id,id10:Integer;
|
|||
|
begin
|
|||
|
{try
|
|||
|
if Tv1.GroupedItemCount=0 then
|
|||
|
begin
|
|||
|
Id:=Tv1.GetColumnByFieldName('DeliveryDate').Index-tv1.GroupedItemCount;
|
|||
|
Id10:=Tv1.GetColumnByFieldName('SubStatus').Index-tv1.GroupedItemCount;
|
|||
|
if Trim(VarToStr(ARecord.Values[id]))='' then Exit;
|
|||
|
if Id<0 then Exit;
|
|||
|
if ARecord.Values[id10]='<27><><EFBFBD><EFBFBD>' then exit;
|
|||
|
if (ARecord.Values[id]-DQdate)>=4 then Exit;
|
|||
|
if ((ARecord.Values[id]-DQdate)>=0) and ((ARecord.Values[id]-DQdate)<4) then
|
|||
|
AStyle:=DataLink_.QHuangSe
|
|||
|
else
|
|||
|
if ARecord.Values[id]-DQdate<0 then
|
|||
|
begin
|
|||
|
AStyle:=DataLink_OrderManage.FenHongS;
|
|||
|
end;
|
|||
|
end else
|
|||
|
begin
|
|||
|
|
|||
|
end;
|
|||
|
except
|
|||
|
end; }
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmPRTOrderChkList.v1DeliveryDateCustomDrawCell(
|
|||
|
Sender: TcxCustomGridTableView; ACanvas: TcxCanvas;
|
|||
|
AViewInfo: TcxGridTableDataCellViewInfo; var ADone: Boolean);
|
|||
|
begin
|
|||
|
{ Id:=TV1.GetColumnByFieldName('DeliveryDate').Index;//;-TV1.GroupedItemCount;
|
|||
|
Id10:=TV1.GetColumnByFieldName('SubStatus').Index;
|
|||
|
if Id<0 then Exit;
|
|||
|
if AViewInfo.GridRecord.Values[Id10]='<27><><EFBFBD><EFBFBD>' then Exit;
|
|||
|
if AViewInfo.GridRecord.Values[Id]-SGetServerDate(ADOQueryTemp)>=4 then Exit;
|
|||
|
if ((AViewInfo.GridRecord.Values[id]-SGetServerDate10(ADOQueryTemp))>=0) and ((AViewInfo.GridRecord.Values[id]-SGetServerDate(ADOQueryTemp))<4) then
|
|||
|
ACanvas.Brush.Color:=clYellow
|
|||
|
else
|
|||
|
if (AViewInfo.GridRecord.Values[id])-(SGetServerDate10(ADOQueryTemp)<0) then
|
|||
|
begin
|
|||
|
ACanvas.Brush.Color:=clRed;
|
|||
|
end;
|
|||
|
begin
|
|||
|
ACanvas.Brush.Color:=clRed;
|
|||
|
end else
|
|||
|
if AViewInfo.GridRecord.Values[Id]='Purple' then
|
|||
|
begin
|
|||
|
ACanvas.Brush.Color:=clPurple;
|
|||
|
end else
|
|||
|
if AViewInfo.GridRecord.Values[Id]='Olive' then
|
|||
|
begin
|
|||
|
ACanvas.Brush.Color:=clOlive;
|
|||
|
end else
|
|||
|
if AViewInfo.GridRecord.Values[Id]='Teal' then
|
|||
|
begin
|
|||
|
ACanvas.Brush.Color:=clTeal;
|
|||
|
end else
|
|||
|
if AViewInfo.GridRecord.Values[Id]='Background' then
|
|||
|
begin
|
|||
|
ACanvas.Brush.Color:=clBackground;
|
|||
|
end; }
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmPRTOrderChkList.TBViewClick(Sender: TObject);
|
|||
|
begin
|
|||
|
if Order_Main.IsEmpty then Exit;
|
|||
|
try
|
|||
|
frmOrderInPutPrice:=TfrmOrderInPutPrice.Create(Application);
|
|||
|
with frmOrderInPutPrice do
|
|||
|
begin
|
|||
|
PState:=1;
|
|||
|
FMainId:=Trim(Self.Order_Main.fieldbyname('MainId').AsString);
|
|||
|
ToolBar2.Visible:=False;
|
|||
|
//ToolBar3.Visible:=False;
|
|||
|
ToolBar4.Visible:=False;
|
|||
|
ToolBar5.Visible:=False;
|
|||
|
TBSave.Visible:=False;
|
|||
|
ToolButton4.Visible:=False;
|
|||
|
ToolButton5.Visible:=False;
|
|||
|
ToolButton8.Visible:=False;
|
|||
|
ToolButton10.Visible:=False;
|
|||
|
ToolButton11.Visible:=False;
|
|||
|
//ScrollBox1.Enabled:=False;
|
|||
|
Tv1.OptionsSelection.CellSelect:=False;
|
|||
|
ToolButton20.Visible:=False;
|
|||
|
ToolButton21.Visible:=False;
|
|||
|
if ShowModal=1 then
|
|||
|
begin
|
|||
|
|
|||
|
end;
|
|||
|
end;
|
|||
|
finally
|
|||
|
frmOrderInPutPrice.Free;
|
|||
|
end;
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmPRTOrderChkList.OrderNoKeyPress(Sender: TObject;
|
|||
|
var Key: Char);
|
|||
|
var
|
|||
|
fsj:string;
|
|||
|
begin
|
|||
|
if Key=#13 then
|
|||
|
begin
|
|||
|
if Length(OrderNo.Text)<3 then Exit;
|
|||
|
try
|
|||
|
ADOQueryMain.DisableControls;
|
|||
|
with ADOQueryMain do
|
|||
|
begin
|
|||
|
Filtered:=False;
|
|||
|
Close;
|
|||
|
sql.Clear;
|
|||
|
sql.add('exec P_View_Order :begdate,:enddate,:WSql') ;
|
|||
|
if cxTabControl1.TabIndex=0 then
|
|||
|
begin
|
|||
|
fsj:=' and isnull(Chker,'''')='''' ';
|
|||
|
end else
|
|||
|
if cxTabControl1.TabIndex=1 then
|
|||
|
begin
|
|||
|
fsj:=' and isnull(Chker,'''')<>'''' and ZuoFeiFlag=0 ';
|
|||
|
end else
|
|||
|
if cxTabControl1.TabIndex=2 then
|
|||
|
begin
|
|||
|
fsj:=' and isnull(PChker,'''')='''' and ZuoFeiFlag=1 ';
|
|||
|
end else
|
|||
|
if cxTabControl1.TabIndex=3 then
|
|||
|
begin
|
|||
|
fsj:=' and isnull(PChker,'''')<>'''' ';
|
|||
|
end;
|
|||
|
Parameters.ParamByName('WSql').Value:='and isnull(SChker,'''')<>'''' '+fsj+' and orderno like '''+'%'+Trim(OrderNo.Text)+'%'+'''';
|
|||
|
Parameters.ParamByName('begdate').Value:='1899-01-01';
|
|||
|
Parameters.ParamByName('enddate').Value:='2050-01-01';
|
|||
|
Open;
|
|||
|
end;
|
|||
|
SCreateCDS20(ADOQueryMain,Order_Main);
|
|||
|
SInitCDSData20(ADOQueryMain,Order_Main);
|
|||
|
finally
|
|||
|
ADOQueryMain.EnableControls;
|
|||
|
end;
|
|||
|
end;
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmPRTOrderChkList.ConNoKeyPress(Sender: TObject;
|
|||
|
var Key: Char);
|
|||
|
var
|
|||
|
fsj:String;
|
|||
|
begin
|
|||
|
if Key=#13 then
|
|||
|
begin
|
|||
|
if Length(conno.Text)<3 then Exit;
|
|||
|
try
|
|||
|
ADOQueryMain.DisableControls;
|
|||
|
with ADOQueryMain do
|
|||
|
begin
|
|||
|
Filtered:=False;
|
|||
|
Close;
|
|||
|
sql.Clear;
|
|||
|
sql.add('exec P_View_Order :begdate,:enddate,:WSql') ;
|
|||
|
if cxTabControl1.TabIndex=0 then
|
|||
|
begin
|
|||
|
fsj:=' and isnull(Chker,'''')='''' ';
|
|||
|
end else
|
|||
|
if cxTabControl1.TabIndex=1 then
|
|||
|
begin
|
|||
|
fsj:=' and isnull(Chker,'''')<>'''' and ZuoFeiFlag=0 ';
|
|||
|
end else
|
|||
|
if cxTabControl1.TabIndex=2 then
|
|||
|
begin
|
|||
|
fsj:=' and isnull(PChker,'''')='''' and ZuoFeiFlag=1 ';
|
|||
|
end else
|
|||
|
if cxTabControl1.TabIndex=3 then
|
|||
|
begin
|
|||
|
fsj:=' and isnull(PChker,'''')<>'''' ';
|
|||
|
end;
|
|||
|
Parameters.ParamByName('WSql').Value:=fsj+' and conno like '''+'%'+Trim(conno.Text)+'%'+'''';
|
|||
|
Parameters.ParamByName('begdate').Value:='1899-01-01';
|
|||
|
Parameters.ParamByName('enddate').Value:='2050-01-01';
|
|||
|
ExecSQL;
|
|||
|
Open;
|
|||
|
end;
|
|||
|
SCreateCDS20(ADOQueryMain,Order_Main);
|
|||
|
SInitCDSData20(ADOQueryMain,Order_Main);
|
|||
|
finally
|
|||
|
ADOQueryMain.EnableControls;
|
|||
|
end;
|
|||
|
end;
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmPRTOrderChkList.ToolButton3Click(Sender: TObject);
|
|||
|
begin
|
|||
|
try
|
|||
|
frmModuleNote:=TfrmModuleNote.Create(Application);
|
|||
|
with frmModuleNote do
|
|||
|
begin
|
|||
|
flag:='<27><><EFBFBD><EFBFBD>ָʾ<D6B8><CABE>';
|
|||
|
if ShowModal=1 then
|
|||
|
begin
|
|||
|
|
|||
|
end;
|
|||
|
end;
|
|||
|
finally
|
|||
|
frmModuleNote.Free;
|
|||
|
end;
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmPRTOrderChkList.ToolButton1Click(Sender: TObject);
|
|||
|
begin
|
|||
|
if cxTabControl1.TabIndex<>0 then Exit;
|
|||
|
if Order_Main.IsEmpty then Exit;
|
|||
|
if Application.MessageBox('ȷ<><C8B7>Ҫִ<D2AA>д˲<D0B4><CBB2><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>','<27><>ʾ',32+4)<>IDYES then exit;
|
|||
|
with ADOQueryCmd do
|
|||
|
begin
|
|||
|
Close;
|
|||
|
sql.Clear;
|
|||
|
sql.Add('Update JYOrder_Main Set Chker='''+Trim(DName)+'''');
|
|||
|
SQL.Add(',ChkTime=getdate(),ChkStatus=''<27><><EFBFBD><EFBFBD>ͨ<EFBFBD><CDA8>'' ');
|
|||
|
sql.Add(' where MainId='''+Trim(Order_Main.fieldbyname('MainId').AsString)+'''');
|
|||
|
ExecSQL;
|
|||
|
end;
|
|||
|
Order_Main.Delete;
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmPRTOrderChkList.ToolButton4Click(Sender: TObject);
|
|||
|
begin
|
|||
|
if cxTabControl1.TabIndex<>1 then Exit;
|
|||
|
if Order_Main.IsEmpty then Exit;
|
|||
|
if Application.MessageBox('ȷ<><C8B7>Ҫ<EFBFBD><D2AA><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>','<27><>ʾ',32+4)<>IDYES then exit;
|
|||
|
with ADOQueryCmd do
|
|||
|
begin
|
|||
|
Close;
|
|||
|
sql.Clear;
|
|||
|
sql.Add('Update JYOrder_Main Set Chker=NUll');
|
|||
|
SQL.Add(',ChkTime=NUll,ChkStatus=Null ');
|
|||
|
sql.Add(' where MainId='''+Trim(Order_Main.fieldbyname('MainId').AsString)+'''');
|
|||
|
ExecSQL;
|
|||
|
end;
|
|||
|
Order_Main.Delete;
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmPRTOrderChkList.cxTabControl1Change(Sender: TObject);
|
|||
|
begin
|
|||
|
InitGrid();
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmPRTOrderChkList.ToolButton5Click(Sender: TObject);
|
|||
|
begin
|
|||
|
if cxTabControl1.TabIndex<>3 then Exit;
|
|||
|
if Order_Main.IsEmpty then Exit;
|
|||
|
if Application.MessageBox('ȷ<><C8B7>Ҫ<EFBFBD><D2AA><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>','<27><>ʾ',32+4)<>IDYES then exit;
|
|||
|
with ADOQueryCmd do
|
|||
|
begin
|
|||
|
Close;
|
|||
|
sql.Clear;
|
|||
|
sql.Add('Update JYOrder_Main Set PChker=NUll');
|
|||
|
SQL.Add(',PChkTime=NUll,PChkStatus=Null ');
|
|||
|
sql.Add(' where MainId='''+Trim(Order_Main.fieldbyname('MainId').AsString)+'''');
|
|||
|
ExecSQL;
|
|||
|
end;
|
|||
|
Order_Main.Delete;
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmPRTOrderChkList.ToolButton2Click(Sender: TObject);
|
|||
|
begin
|
|||
|
if cxTabControl1.TabIndex<>2 then Exit;
|
|||
|
if Order_Main.IsEmpty then Exit;
|
|||
|
if Application.MessageBox('ȷ<><C8B7>Ҫִ<D2AA>д˲<D0B4><CBB2><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>','<27><>ʾ',32+4)<>IDYES then exit;
|
|||
|
with ADOQueryCmd do
|
|||
|
begin
|
|||
|
Close;
|
|||
|
sql.Clear;
|
|||
|
sql.Add('Update JYOrder_Main Set PChker='''+Trim(DName)+'''');
|
|||
|
SQL.Add(',PChkTime=getdate(),PChkStatus=''<27><><EFBFBD><EFBFBD>ͨ<EFBFBD><CDA8>'' ');
|
|||
|
sql.Add(' where MainId='''+Trim(Order_Main.fieldbyname('MainId').AsString)+'''');
|
|||
|
ExecSQL;
|
|||
|
end;
|
|||
|
Order_Main.Delete;
|
|||
|
end;
|
|||
|
|
|||
|
end.
|