820 lines
25 KiB
ObjectPascal
820 lines
25 KiB
ObjectPascal
unit U_BGFeeChkList;
|
||
|
||
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, cxButtonEdit, cxTextEdit, cxDropDownEdit;
|
||
|
||
type
|
||
TfrmBGFeeChkList = class(TForm)
|
||
ToolBar1: TToolBar;
|
||
TBRafresh: TToolButton;
|
||
TBFind: TToolButton;
|
||
TBEdit: TToolButton;
|
||
TBPrint: TToolButton;
|
||
TBClose: TToolButton;
|
||
Tv1: TcxGridDBTableView;
|
||
cxGrid1Level1: TcxGridLevel;
|
||
cxGrid1: TcxGrid;
|
||
cxGridPopupMenu1: TcxGridPopupMenu;
|
||
ADOQueryCmd: TADOQuery;
|
||
ADOQueryMain: TADOQuery;
|
||
ADOQueryTemp: TADOQuery;
|
||
DataSource1: TDataSource;
|
||
TBExport: TToolButton;
|
||
V1SFKDate: TcxGridDBColumn;
|
||
v1ConNo: TcxGridDBColumn;
|
||
v1PRTColor: TcxGridDBColumn;
|
||
v1MPRTSpec: TcxGridDBColumn;
|
||
Order_Main: TClientDataSet;
|
||
RM1: TRMGridReport;
|
||
RMDBDataSet1: TRMDBDataSet;
|
||
RMXLSExport1: TRMXLSExport;
|
||
v1CustomerNoName: TcxGridDBColumn;
|
||
v1MPRTCodeName: TcxGridDBColumn;
|
||
v1MPRTMF: TcxGridDBColumn;
|
||
PopupMenu1: TPopupMenu;
|
||
N2: TMenuItem;
|
||
v1PRTPrice: TcxGridDBColumn;
|
||
ToolButton1: TToolButton;
|
||
v1Column1: TcxGridDBColumn;
|
||
ADOQueryPrint: TADOQuery;
|
||
CDS_Print: TClientDataSet;
|
||
v1Column4: TcxGridDBColumn;
|
||
Panel1: TPanel;
|
||
Label4: TLabel;
|
||
Label9: TLabel;
|
||
Label10: TLabel;
|
||
BegDate: TDateTimePicker;
|
||
EndDate: TDateTimePicker;
|
||
OrderNoHZ: TEdit;
|
||
BMNo: TEdit;
|
||
ChuanGS: TEdit;
|
||
V1TuiDanChkDate: TcxGridDBColumn;
|
||
cxTabControl1: TcxTabControl;
|
||
v1Column3: TcxGridDBColumn;
|
||
v1Column5: TcxGridDBColumn;
|
||
v1Column6: TcxGridDBColumn;
|
||
v1Column7: TcxGridDBColumn;
|
||
v1Column8: TcxGridDBColumn;
|
||
v1Column9: TcxGridDBColumn;
|
||
v1Column10: TcxGridDBColumn;
|
||
v1Column11: TcxGridDBColumn;
|
||
cxSplitter1: TcxSplitter;
|
||
Label2: TLabel;
|
||
ChuanNo: TEdit;
|
||
Label3: TLabel;
|
||
HDName: TEdit;
|
||
Label5: TLabel;
|
||
FeeName: TEdit;
|
||
ComboBox1: TComboBox;
|
||
DataSource2: TDataSource;
|
||
ClientDataSet2: TClientDataSet;
|
||
v1Column12: TcxGridDBColumn;
|
||
v1Column13: TcxGridDBColumn;
|
||
v1Column14: TcxGridDBColumn;
|
||
Panel2: TPanel;
|
||
cxGrid2: TcxGrid;
|
||
Tv2: TcxGridDBTableView;
|
||
cxGridDBColumn1: TcxGridDBColumn;
|
||
cxGridDBColumn2: TcxGridDBColumn;
|
||
cxGridDBColumn3: TcxGridDBColumn;
|
||
cxGridDBColumn4: TcxGridDBColumn;
|
||
cxGridDBColumn5: TcxGridDBColumn;
|
||
cxGridDBColumn6: TcxGridDBColumn;
|
||
cxGridDBColumn7: TcxGridDBColumn;
|
||
cxGridDBColumn8: TcxGridDBColumn;
|
||
cxGridDBColumn9: TcxGridDBColumn;
|
||
cxGridDBColumn10: TcxGridDBColumn;
|
||
cxGridDBColumn11: TcxGridDBColumn;
|
||
cxGridDBColumn12: TcxGridDBColumn;
|
||
cxGridLevel1: TcxGridLevel;
|
||
cxSplitter2: TcxSplitter;
|
||
cxGrid3: TcxGrid;
|
||
Tv3: TcxGridDBTableView;
|
||
v2Column1: TcxGridDBColumn;
|
||
cxGridDBColumn13: TcxGridDBColumn;
|
||
cxGridDBColumn14: TcxGridDBColumn;
|
||
cxGridDBColumn15: TcxGridDBColumn;
|
||
cxGridDBColumn16: TcxGridDBColumn;
|
||
cxGridDBColumn17: TcxGridDBColumn;
|
||
cxGridDBColumn18: TcxGridDBColumn;
|
||
cxGridDBColumn19: TcxGridDBColumn;
|
||
cxGridDBColumn20: TcxGridDBColumn;
|
||
cxGridLevel2: TcxGridLevel;
|
||
DataSource3: TDataSource;
|
||
ClientDataSet3: TClientDataSet;
|
||
cxGridPopupMenu2: TcxGridPopupMenu;
|
||
cxGridPopupMenu3: TcxGridPopupMenu;
|
||
v1Column15: TcxGridDBColumn;
|
||
v1Column16: TcxGridDBColumn;
|
||
v1Column17: TcxGridDBColumn;
|
||
ToolButton2: TToolButton;
|
||
Panel3: TPanel;
|
||
Panel4: TPanel;
|
||
SFKDate: TDateTimePicker;
|
||
TuiDanChkDate: TDateTimePicker;
|
||
Button1: TButton;
|
||
Button2: TButton;
|
||
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 FormShow(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 ToolButton1Click(Sender: TObject);
|
||
procedure OrderNoHZChange(Sender: TObject);
|
||
procedure BMNoKeyPress(Sender: TObject; var Key: Char);
|
||
procedure cxTabControl1Change(Sender: TObject);
|
||
procedure Tv1FocusedRecordChanged(Sender: TcxCustomGridTableView;
|
||
APrevFocusedRecord, AFocusedRecord: TcxCustomGridRecord;
|
||
ANewItemRecordFocusingChanged: Boolean);
|
||
procedure OrderNoHZKeyPress(Sender: TObject; var Key: Char);
|
||
procedure TBEditClick(Sender: TObject);
|
||
procedure Button1Click(Sender: TObject);
|
||
procedure ToolButton2Click(Sender: TObject);
|
||
procedure Button2Click(Sender: TObject);
|
||
private
|
||
DQdate:TDateTime;
|
||
procedure InitGrid();
|
||
procedure InitForm();
|
||
function DelData():Boolean;
|
||
{ Private declarations }
|
||
public
|
||
FFInt,FCloth:Integer;
|
||
|
||
{ Public declarations }
|
||
end;
|
||
|
||
var
|
||
frmBGFeeChkList: TfrmBGFeeChkList;
|
||
|
||
implementation
|
||
uses
|
||
U_DataLink,U_BGFeeInPut,U_RTFun;
|
||
|
||
{$R *.dfm}
|
||
|
||
procedure TfrmBGFeeChkList.FormDestroy(Sender: TObject);
|
||
begin
|
||
frmBGFeeChkList:=nil;
|
||
end;
|
||
|
||
procedure TfrmBGFeeChkList.FormClose(Sender: TObject;
|
||
var Action: TCloseAction);
|
||
begin
|
||
Action:=caFree;
|
||
end;
|
||
|
||
procedure TfrmBGFeeChkList.FormCreate(Sender: TObject);
|
||
begin
|
||
cxgrid1.Align:=alClient;
|
||
//BegDate.DateTime:=SGetServerDateTime(ADOQueryTemp)-7;
|
||
//EndDate.DateTime:=SGetServerDateTime(ADOQueryTemp);
|
||
DQdate:=SGetServerDate(ADOQueryTemp);
|
||
end;
|
||
|
||
procedure TfrmBGFeeChkList.TBCloseClick(Sender: TObject);
|
||
begin
|
||
Close;
|
||
WriteCxGrid('<27><><EFBFBD>ط<EFBFBD><D8B7><EFBFBD><EFBFBD>б<EFBFBD>1',Tv1,'<27><><EFBFBD>ط<EFBFBD><D8B7><EFBFBD>');
|
||
WriteCxGrid('<27><><EFBFBD>ط<EFBFBD><D8B7><EFBFBD><EFBFBD>б<EFBFBD>2',Tv2,'<27><><EFBFBD>ط<EFBFBD><D8B7><EFBFBD>');
|
||
WriteCxGrid('<27><><EFBFBD>ط<EFBFBD><D8B7><EFBFBD><EFBFBD>б<EFBFBD>3',Tv3,'<27><><EFBFBD>ط<EFBFBD><D8B7><EFBFBD>');
|
||
end;
|
||
|
||
procedure TfrmBGFeeChkList.InitGrid();
|
||
begin
|
||
try
|
||
ADOQueryMain.DisableControls;
|
||
with ADOQueryMain do
|
||
begin
|
||
Filtered:=False;
|
||
Close;
|
||
sql.Clear;
|
||
if cxTabControl1.TabIndex=0 then
|
||
begin
|
||
sql.Add('select A.*,B.* ');
|
||
sql.Add(',OrderNoHZ=dbo.F_Get_Order_SubStr(A.BMID,''BGOrderNo'')');
|
||
sql.Add(' from BGFee_Main A ');
|
||
sql.Add(' inner join BGFee_HuoDai B on A.BMID=B.BMID');
|
||
sql.Add(' where 1=1');
|
||
sql.Add(' and isnull(B.SFKDate,'''')='''' ');
|
||
end else
|
||
if cxTabControl1.TabIndex=1 then
|
||
begin
|
||
sql.Add('select A.*,B.* ');
|
||
sql.Add(',OrderNoHZ=dbo.F_Get_Order_SubStr(A.BMID,''BGOrderNo'')');
|
||
sql.Add(' from BGFee_Main A ');
|
||
sql.Add(' inner join BGFee_HuoDai B on A.BMID=B.BMID');
|
||
sql.Add(' where 1=1');
|
||
sql.Add(' and isnull(B.SFKDate,'''')<>'''' ');
|
||
end else
|
||
if cxTabControl1.TabIndex=2 then
|
||
begin
|
||
sql.Add('select A.*,B.* ');
|
||
sql.Add(',OrderNoHZ=dbo.F_Get_Order_SubStr(A.BMID,''BGOrderNo'')');
|
||
sql.Add(' from BGFee_Main A ');
|
||
sql.Add(' left join BGFee_HuoDai B on A.BMID=B.BMID');
|
||
sql.Add(' where 1=1');
|
||
sql.Add(' and isnull(TuiDanChkDate,'''')='''' ');
|
||
end else
|
||
if cxTabControl1.TabIndex=3 then
|
||
begin
|
||
sql.Add('select A.*,B.* ');
|
||
sql.Add(',OrderNoHZ=dbo.F_Get_Order_SubStr(A.BMID,''BGOrderNo'')');
|
||
sql.Add(' from BGFee_Main A ');
|
||
sql.Add(' left join BGFee_HuoDai B on A.BMID=B.BMID');
|
||
sql.Add(' where 1=1');
|
||
sql.Add(' and isnull(TuiDanChkDate,'''')<>''''');
|
||
end else
|
||
begin
|
||
sql.Add('select A.*,B.* ');
|
||
sql.Add(',OrderNoHZ=dbo.F_Get_Order_SubStr(A.BMID,''BGOrderNo'')');
|
||
sql.Add(' from BGFee_Main A ');
|
||
sql.Add(' left join BGFee_HuoDai B on A.BMID=B.BMID');
|
||
sql.Add(' where 1=1');
|
||
end;
|
||
|
||
if (cxTabControl1.TabIndex=1) or (cxTabControl1.TabIndex=3) or (cxTabControl1.TabIndex=4) then
|
||
begin
|
||
if Trim(ComboBox1.Text)='<27><><EFBFBD>Ǽ<EFBFBD><C7BC><EFBFBD><EFBFBD><EFBFBD>' then
|
||
begin
|
||
SQL.Add('and A.FillTIme>='''+FormatDateTime('yyyy-MM-dd',BegDate.DateTime)+'''');
|
||
SQL.Add('and A.FillTIme<'''+FormatDateTime('yyyy-MM-dd',enddate.DateTime+1)+'''');
|
||
end else
|
||
if Trim(ComboBox1.Text)='<27><>װ<EFBFBD><D7B0><EFBFBD><EFBFBD><EFBFBD><EFBFBD>' then
|
||
begin
|
||
SQL.Add('and A.ZhuangXiangDate>='''+FormatDateTime('yyyy-MM-dd',BegDate.DateTime)+'''');
|
||
SQL.Add('and A.ZhuangXiangDate<'''+FormatDateTime('yyyy-MM-dd',enddate.DateTime+1)+'''');
|
||
end else
|
||
if Trim(ComboBox1.Text)='<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>' then
|
||
begin
|
||
SQL.Add('and A.ChuanDate>='''+FormatDateTime('yyyy-MM-dd',BegDate.DateTime)+'''');
|
||
SQL.Add('and A.ChuanDate<'''+FormatDateTime('yyyy-MM-dd',enddate.DateTime+1)+'''');
|
||
end else
|
||
if Trim(ComboBox1.Text)='<27><>Ԥ¼<D4A4><C2BC><EFBFBD><EFBFBD><EFBFBD><EFBFBD>' then
|
||
begin
|
||
SQL.Add('and A.YuLuDanDate>='''+FormatDateTime('yyyy-MM-dd',BegDate.DateTime)+'''');
|
||
SQL.Add('and A.YuLuDanDate<'''+FormatDateTime('yyyy-MM-dd',enddate.DateTime+1)+'''');
|
||
end else
|
||
if Trim(ComboBox1.Text)='<27><><EFBFBD>ᵥ<EFBFBD><E1B5A5><EFBFBD><EFBFBD>' then
|
||
begin
|
||
SQL.Add('and A.TiDanDate>='''+FormatDateTime('yyyy-MM-dd',BegDate.DateTime)+'''');
|
||
SQL.Add('and A.TiDanDate<'''+FormatDateTime('yyyy-MM-dd',enddate.DateTime+1)+'''');
|
||
end else
|
||
if Trim(ComboBox1.Text)='<27><>Ԥ<EFBFBD>˵<EFBFBD><CBB5><EFBFBD><EFBFBD><EFBFBD>' then
|
||
begin
|
||
SQL.Add('and A.YuTuiDanDate>='''+FormatDateTime('yyyy-MM-dd',BegDate.DateTime)+'''');
|
||
SQL.Add('and A.YuTuiDanDate<'''+FormatDateTime('yyyy-MM-dd',enddate.DateTime+1)+'''');
|
||
end else
|
||
if Trim(ComboBox1.Text)='<27><><EFBFBD><EFBFBD><EFBFBD>˵<EFBFBD><CBB5><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>' then
|
||
begin
|
||
SQL.Add('and A.JiaoTuiDanDate>='''+FormatDateTime('yyyy-MM-dd',BegDate.DateTime)+'''');
|
||
SQL.Add('and A.JiaoTuiDanDate<'''+FormatDateTime('yyyy-MM-dd',enddate.DateTime+1)+'''');
|
||
end else
|
||
if Trim(ComboBox1.Text)='<27><><EFBFBD>˵<EFBFBD>(<28><>)<29><><EFBFBD><EFBFBD>' then
|
||
begin
|
||
SQL.Add('and A.TuiDanChkDate>='''+FormatDateTime('yyyy-MM-dd',BegDate.DateTime)+'''');
|
||
SQL.Add('and A.TuiDanChkDate<'''+FormatDateTime('yyyy-MM-dd',enddate.DateTime+1)+'''');
|
||
end else
|
||
if Trim(ComboBox1.Text)='<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>' then
|
||
begin
|
||
SQL.Add('and B.SFKDate>='''+FormatDateTime('yyyy-MM-dd',BegDate.DateTime)+'''');
|
||
SQL.Add('and B.SFKDate<'''+FormatDateTime('yyyy-MM-dd',enddate.DateTime+1)+'''');
|
||
end;
|
||
end;
|
||
SQL.Add(' and isnull(A.SChkTime,'''')<>'''' ');
|
||
Open;
|
||
end;
|
||
SCreateCDS20(ADOQueryMain,Order_Main);
|
||
SInitCDSData20(ADOQueryMain,Order_Main);
|
||
finally
|
||
ADOQueryMain.EnableControls;
|
||
end;
|
||
end;
|
||
|
||
|
||
procedure TfrmBGFeeChkList.InitForm();
|
||
begin
|
||
ReadCxGrid('<27><><EFBFBD>ط<EFBFBD><D8B7><EFBFBD><EFBFBD>б<EFBFBD>1',Tv1,'<27><><EFBFBD>ط<EFBFBD><D8B7><EFBFBD>');
|
||
ReadCxGrid('<27><><EFBFBD>ط<EFBFBD><D8B7><EFBFBD><EFBFBD>б<EFBFBD>2',Tv2,'<27><><EFBFBD>ط<EFBFBD><D8B7><EFBFBD>');
|
||
ReadCxGrid('<27><><EFBFBD>ط<EFBFBD><D8B7><EFBFBD><EFBFBD>б<EFBFBD>3',Tv3,'<27><><EFBFBD>ط<EFBFBD><D8B7><EFBFBD>');
|
||
BegDate.DateTime:=SGetServerDate10(ADOQueryTemp)-7;
|
||
EndDate.DateTime:=SGetServerDate10(ADOQueryTemp);
|
||
SFKDate.DateTime:=EndDate.DateTime;
|
||
TuiDanChkDate.DateTime:=EndDate.DateTime;
|
||
InitGrid();
|
||
end;
|
||
|
||
procedure TfrmBGFeeChkList.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 TfrmBGFeeChkList.DelData():Boolean;
|
||
begin
|
||
try
|
||
Result:=false;
|
||
ADOQueryCmd.Connection.BeginTrans;
|
||
with ADOQueryCmd do
|
||
begin
|
||
Close;
|
||
sql.Clear;
|
||
sql.Add('delete BGFee_Main where BMId='''+Trim(Order_Main.fieldbyname('BMId').AsString)+'''');
|
||
ExecSQL;
|
||
end;
|
||
with ADOQueryCmd do
|
||
begin
|
||
Close;
|
||
sql.Clear;
|
||
sql.Add('delete BGFee_Sub where BMId='''+Trim(Order_Main.fieldbyname('BMId').AsString)+'''');
|
||
ExecSQL;
|
||
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 TfrmBGFeeChkList.TBExportClick(Sender: TObject);
|
||
begin
|
||
//if ADOQueryMain.IsEmpty then Exit;
|
||
//SelExportData(Tv1,ADOQueryMain,'<27><><EFBFBD><EFBFBD>ָʾ<D6B8><CABE><EFBFBD>б<EFBFBD>');
|
||
if Order_Main.IsEmpty then Exit;
|
||
TcxGridToExcel('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ͬ',cxGrid1);
|
||
end;
|
||
|
||
procedure TfrmBGFeeChkList.TBPrintClick(Sender: TObject);
|
||
var
|
||
fPrintFile:string;
|
||
EngMoney:string;
|
||
begin
|
||
if Order_Main.IsEmpty then Exit;
|
||
fPrintFile:= ExtractFilePath(Application.ExeName) + 'Report\Ӣ<>ĺ<EFBFBD>ͬ.rmf' ;
|
||
with ADOQueryPrint do
|
||
begin
|
||
Close;
|
||
sql.Clear;
|
||
sql.Add('select A.*,B.*,ConMoney=B.PRTOrderQty*B.PRTPrice,COL=''COL:'' ');
|
||
sql.Add(' from JYOrderCon_Main A inner join JYOrderCon_Sub B on A.MainId=B.MainId ');
|
||
sql.Add(' where A.MainId='''+Trim(Order_Main.fieldbyname('MainId').AsString)+'''');
|
||
Open;
|
||
end;
|
||
SCreateCDS20(ADOQueryPrint,CDS_Print);
|
||
SInitCDSData20(ADOQueryPrint,CDS_Print);
|
||
//
|
||
with ADOQueryTemp do
|
||
begin
|
||
close;
|
||
sql.Clear;
|
||
sql.Add('select TolConMoney=Sum(PRTOrderQty*PRTPrice)');
|
||
sql.Add(' from JYOrderCon_Main A inner join JYOrderCon_Sub B on A.MainId=B.MainId ');
|
||
sql.Add(' where A.MainId='''+Trim(Order_Main.fieldbyname('MainId').AsString)+'''');
|
||
Open;
|
||
end;
|
||
EngMoney:=num2cengnum(ADOQueryTemp.fieldbyname('TolConMoney').AsString);
|
||
EngMoney:=UpperCase(EngMoney);
|
||
if FileExists(fPrintFile) then
|
||
begin
|
||
RMVariables['EngMoney']:=EngMoney;
|
||
//RMVariables['enddate']:=enddate.DateTime;
|
||
//RMVariables['printtime']:=Now;
|
||
//RMVariables['printer']:=Trim(gUserName);
|
||
RM1.LoadFromFile(fPrintFile);
|
||
RM1.ShowReport;
|
||
end else
|
||
begin
|
||
Application.MessageBox(PChar('û<><C3BB><EFBFBD><EFBFBD>'+ExtractFilePath(Application.ExeName)+'Report\Ӣ<>ĺ<EFBFBD>ͬ.rmf'),'<27><>ʾ',0);
|
||
end;
|
||
end;
|
||
|
||
procedure TfrmBGFeeChkList.TBRafreshClick(Sender: TObject);
|
||
begin
|
||
InitGrid();
|
||
end;
|
||
|
||
procedure TfrmBGFeeChkList.FormShow(Sender: TObject);
|
||
begin
|
||
InitForm();
|
||
end;
|
||
|
||
procedure TfrmBGFeeChkList.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 TfrmBGFeeChkList.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 TfrmBGFeeChkList.ToolButton1Click(Sender: TObject);
|
||
begin
|
||
if Order_Main.IsEmpty then Exit;
|
||
try
|
||
frmBGFeeInPut:=TfrmBGFeeInPut.Create(Application);
|
||
with frmBGFeeInPut do
|
||
begin
|
||
PState:=1;
|
||
FMainId:=Trim(Self.Order_Main.fieldbyname('BMId').AsString);
|
||
ToolBar2.Visible:=False;
|
||
TBSave.Visible:=False;
|
||
ScrollBox1.Enabled:=False;
|
||
Tv1.OptionsSelection.CellSelect:=False;
|
||
if ShowModal=1 then
|
||
begin
|
||
|
||
end;
|
||
end;
|
||
finally
|
||
frmBGFeeInPut.Free;
|
||
end;
|
||
end;
|
||
|
||
procedure TfrmBGFeeChkList.OrderNoHZChange(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 TfrmBGFeeChkList.BMNoKeyPress(Sender: TObject; var Key: Char);
|
||
begin
|
||
if Key=#13 then
|
||
begin
|
||
if Length(BMNo.Text)<3 then Exit;
|
||
try
|
||
ADOQueryMain.DisableControls;
|
||
with ADOQueryMain do
|
||
begin
|
||
Filtered:=False;
|
||
Close;
|
||
SQL.Clear;
|
||
sql.Add('select A.*,B.* ');
|
||
sql.Add(',OrderNoHZ=dbo.F_Get_Order_SubStr(A.BMID,''BGOrderNo'')');
|
||
sql.Add(' from BGFee_Main A ');
|
||
sql.Add(' left join BGFee_HuoDai B on A.BMID=B.BMID');
|
||
SQL.Add('where 1=1');
|
||
{if Trim(DParameters1)<>'<27><>Ȩ<EFBFBD><C8A8>' then
|
||
begin
|
||
sql.Add(' and A.Filler in(select UserName from SY_User where DPID in');
|
||
sql.Add(' (select DPID from SY_User where UserName='''+Trim(DName)+'''))');
|
||
end; }
|
||
sql.Add(' and BMNO like '''+'%'+Trim(BMNO.Text)+'%'+'''');
|
||
SQL.Add(' and isnull(A.SChkTime,'''')<>'''' ');
|
||
if cxTabControl1.TabIndex=0 then
|
||
begin
|
||
sql.Add(' and isnull(B.SFKDate,'''')='''' ');
|
||
end else
|
||
if cxTabControl1.TabIndex=1 then
|
||
begin
|
||
sql.Add(' and isnull(B.SFKDate,'''')<>'''' ');
|
||
end else
|
||
if cxTabControl1.TabIndex=2 then
|
||
begin
|
||
sql.Add(' and isnull(TuiDanChkDate,'''')='''' ');
|
||
end else
|
||
if cxTabControl1.TabIndex=3 then
|
||
begin
|
||
sql.Add(' and isnull(TuiDanChkDate,'''')<>''''');
|
||
end;
|
||
Open;
|
||
end;
|
||
SCreateCDS20(ADOQueryMain,Order_Main);
|
||
SInitCDSData20(ADOQueryMain,Order_Main);
|
||
finally
|
||
ADOQueryMain.EnableControls;
|
||
end;
|
||
end;
|
||
end;
|
||
|
||
procedure TfrmBGFeeChkList.cxTabControl1Change(Sender: TObject);
|
||
begin
|
||
InitGrid();
|
||
end;
|
||
|
||
procedure TfrmBGFeeChkList.Tv1FocusedRecordChanged(
|
||
Sender: TcxCustomGridTableView; APrevFocusedRecord,
|
||
AFocusedRecord: TcxCustomGridRecord;
|
||
ANewItemRecordFocusingChanged: Boolean);
|
||
begin
|
||
with ADOQueryTemp do
|
||
begin
|
||
Close;
|
||
sql.Clear;
|
||
sql.Add('select * from BGFee_Sub where BMID='''+Trim(Order_Main.fieldbyname('BMID').AsString)+'''');
|
||
Open;
|
||
end;
|
||
SCreateCDS20(ADOQueryTemp,ClientDataSet2);
|
||
SInitCDSData20(ADOQueryTemp,ClientDataSet2);
|
||
with ADOQueryTemp do
|
||
begin
|
||
Close;
|
||
sql.Clear;
|
||
sql.Add('select * from BGFee_HuoDai where BMID='''+Trim(Order_Main.fieldbyname('BMID').AsString)+'''');
|
||
Open;
|
||
end;
|
||
SCreateCDS20(ADOQueryTemp,ClientDataSet3);
|
||
SInitCDSData20(ADOQueryTemp,ClientDataSet3);
|
||
end;
|
||
|
||
procedure TfrmBGFeeChkList.OrderNoHZKeyPress(Sender: TObject; var Key: Char);
|
||
begin
|
||
if Key=#13 then
|
||
begin
|
||
if Length(OrderNoHZ.Text)<3 then Exit;
|
||
try
|
||
ADOQueryMain.DisableControls;
|
||
with ADOQueryMain do
|
||
begin
|
||
Filtered:=False;
|
||
Close;
|
||
SQL.Clear;
|
||
sql.Add('select A.*,B.* ');
|
||
sql.Add(',OrderNoHZ=dbo.F_Get_Order_SubStr(A.BMID,''BGOrderNo'')');
|
||
sql.Add(' from BGFee_Main A ');
|
||
sql.Add(' left join BGFee_HuoDai B on A.BMID=B.BMID');
|
||
SQL.Add('where 1=1');
|
||
{if Trim(DParameters1)<>'<27><>Ȩ<EFBFBD><C8A8>' then
|
||
begin
|
||
sql.Add(' and A.Filler in(select UserName from SY_User where DPID in');
|
||
sql.Add(' (select DPID from SY_User where UserName='''+Trim(DName)+'''))');
|
||
end; }
|
||
sql.Add(' and dbo.F_Get_Order_SubStr(A.BMID,''BGOrderNo'') like '''+'%'+Trim(OrderNoHZ.Text)+'%'+'''');
|
||
SQL.Add(' and isnull(A.SChkTime,'''')<>'''' ');
|
||
if cxTabControl1.TabIndex=0 then
|
||
begin
|
||
sql.Add(' and isnull(B.SFKDate,'''')='''' ');
|
||
end else
|
||
if cxTabControl1.TabIndex=1 then
|
||
begin
|
||
sql.Add(' and isnull(B.SFKDate,'''')<>'''' ');
|
||
end else
|
||
if cxTabControl1.TabIndex=2 then
|
||
begin
|
||
sql.Add(' and isnull(TuiDanChkDate,'''')='''' ');
|
||
end else
|
||
if cxTabControl1.TabIndex=3 then
|
||
begin
|
||
sql.Add(' and isnull(TuiDanChkDate,'''')<>''''');
|
||
end;
|
||
Open;
|
||
end;
|
||
SCreateCDS20(ADOQueryMain,Order_Main);
|
||
SInitCDSData20(ADOQueryMain,Order_Main);
|
||
finally
|
||
ADOQueryMain.EnableControls;
|
||
end;
|
||
end;
|
||
end;
|
||
|
||
procedure TfrmBGFeeChkList.TBEditClick(Sender: TObject);
|
||
begin
|
||
if Order_Main.IsEmpty then exit;
|
||
if cxTabControl1.TabIndex<>0 then Exit;
|
||
if Order_Main.Locate('SSel',True,[])=False then
|
||
begin
|
||
Application.MessageBox('û<><C3BB>ѡ<EFBFBD><D1A1><EFBFBD><EFBFBD><EFBFBD><EFBFBD>!','<27><>ʾ',0);
|
||
Exit;
|
||
end;
|
||
if Application.MessageBox('ȷ<><C8B7>Ҫִ<D2AA>д˲<D0B4><CBB2><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>','<27><>ʾ',32+4)<>IDYES then Exit;
|
||
try
|
||
ADOQueryCmd.Connection.BeginTrans;
|
||
Order_Main.DisableControls;
|
||
with Order_Main do
|
||
begin
|
||
First;
|
||
while Locate('SSel',True,[]) do
|
||
begin
|
||
with ADOQueryCmd do
|
||
begin
|
||
Close;
|
||
sql.Clear;
|
||
sql.Add('select * from BGFee_HuoDai where BHID='''+Trim(Order_Main.fieldbyname('BHID').AsString)+'''');
|
||
Open;
|
||
end;
|
||
with ADOQueryCmd do
|
||
begin
|
||
Edit;
|
||
FieldByName('SFKDate').Value:=Trim(FormatDateTime('yyyy-MM-dd',SFKDate.Date));
|
||
Post;
|
||
end;
|
||
Order_Main.Delete;
|
||
end;
|
||
end;
|
||
Order_Main.EnableControls;
|
||
ADOQueryCmd.Connection.CommitTrans;
|
||
except
|
||
ADOQueryCmd.Connection.RollbackTrans;
|
||
Application.MessageBox('<27><><EFBFBD>¸<EFBFBD><C2B8><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>쳣!','<27><>ʾ',0);
|
||
end;
|
||
end;
|
||
|
||
procedure TfrmBGFeeChkList.Button1Click(Sender: TObject);
|
||
begin
|
||
if Order_Main.IsEmpty then exit;
|
||
if cxTabControl1.TabIndex<>1 then Exit;
|
||
if Order_Main.Locate('SSel',True,[])=False then
|
||
begin
|
||
Application.MessageBox('û<><C3BB>ѡ<EFBFBD><D1A1><EFBFBD><EFBFBD><EFBFBD><EFBFBD>!','<27><>ʾ',0);
|
||
Exit;
|
||
end;
|
||
if Application.MessageBox('ȷ<><C8B7>Ҫִ<D2AA>д˲<D0B4><CBB2><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>','<27><>ʾ',32+4)<>IDYES then Exit;
|
||
try
|
||
ADOQueryCmd.Connection.BeginTrans;
|
||
Order_Main.DisableControls;
|
||
with Order_Main do
|
||
begin
|
||
First;
|
||
while Locate('SSel',True,[]) do
|
||
begin
|
||
with ADOQueryCmd do
|
||
begin
|
||
Close;
|
||
sql.Clear;
|
||
sql.Add('select * from BGFee_HuoDai where BHID='''+Trim(Order_Main.fieldbyname('BHID').AsString)+'''');
|
||
Open;
|
||
end;
|
||
with ADOQueryCmd do
|
||
begin
|
||
Edit;
|
||
FieldByName('SFKDate').Value:=NUll;
|
||
Post;
|
||
end;
|
||
Order_Main.Delete;
|
||
end;
|
||
end;
|
||
Order_Main.EnableControls;
|
||
ADOQueryCmd.Connection.CommitTrans;
|
||
except
|
||
ADOQueryCmd.Connection.RollbackTrans;
|
||
Application.MessageBox('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>쳣!','<27><>ʾ',0);
|
||
end;
|
||
end;
|
||
|
||
procedure TfrmBGFeeChkList.ToolButton2Click(Sender: TObject);
|
||
begin
|
||
if Order_Main.IsEmpty then exit;
|
||
if cxTabControl1.TabIndex<>2 then Exit;
|
||
if Order_Main.Locate('SSel',True,[])=False then
|
||
begin
|
||
Application.MessageBox('û<><C3BB>ѡ<EFBFBD><D1A1><EFBFBD><EFBFBD><EFBFBD><EFBFBD>!','<27><>ʾ',0);
|
||
Exit;
|
||
end;
|
||
if Application.MessageBox('ȷ<><C8B7>Ҫִ<D2AA>д˲<D0B4><CBB2><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>','<27><>ʾ',32+4)<>IDYES then Exit;
|
||
try
|
||
ADOQueryCmd.Connection.BeginTrans;
|
||
Order_Main.DisableControls;
|
||
with Order_Main do
|
||
begin
|
||
First;
|
||
while Locate('SSel',True,[]) do
|
||
begin
|
||
with ADOQueryCmd do
|
||
begin
|
||
Close;
|
||
sql.Clear;
|
||
sql.Add('select * from BGFee_Main where BMID='''+Trim(Order_Main.fieldbyname('BMID').AsString)+'''');
|
||
Open;
|
||
end;
|
||
with ADOQueryCmd do
|
||
begin
|
||
Edit;
|
||
FieldByName('TuiDanChkDate').Value:=Trim(FormatDateTime('yyyy-MM-dd',TuiDanChkDate.Date));
|
||
Post;
|
||
end;
|
||
Order_Main.Delete;
|
||
end;
|
||
end;
|
||
Order_Main.EnableControls;
|
||
ADOQueryCmd.Connection.CommitTrans;
|
||
except
|
||
ADOQueryCmd.Connection.RollbackTrans;
|
||
Application.MessageBox('<27><><EFBFBD>¸<EFBFBD><C2B8><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>쳣!','<27><>ʾ',0);
|
||
end;
|
||
end;
|
||
|
||
procedure TfrmBGFeeChkList.Button2Click(Sender: TObject);
|
||
begin
|
||
if Order_Main.IsEmpty then exit;
|
||
if cxTabControl1.TabIndex<>3 then Exit;
|
||
if Order_Main.Locate('SSel',True,[])=False then
|
||
begin
|
||
Application.MessageBox('û<><C3BB>ѡ<EFBFBD><D1A1><EFBFBD><EFBFBD><EFBFBD><EFBFBD>!','<27><>ʾ',0);
|
||
Exit;
|
||
end;
|
||
if Application.MessageBox('ȷ<><C8B7>Ҫִ<D2AA>д˲<D0B4><CBB2><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>','<27><>ʾ',32+4)<>IDYES then Exit;
|
||
try
|
||
ADOQueryCmd.Connection.BeginTrans;
|
||
Order_Main.DisableControls;
|
||
with Order_Main do
|
||
begin
|
||
First;
|
||
while Locate('SSel',True,[]) do
|
||
begin
|
||
with ADOQueryCmd do
|
||
begin
|
||
Close;
|
||
sql.Clear;
|
||
sql.Add('select * from BGFee_Main where BMID='''+Trim(Order_Main.fieldbyname('BMID').AsString)+'''');
|
||
Open;
|
||
end;
|
||
with ADOQueryCmd do
|
||
begin
|
||
Edit;
|
||
FieldByName('TuiDanChkDate').Value:=NUll;
|
||
Post;
|
||
end;
|
||
Order_Main.Delete;
|
||
end;
|
||
end;
|
||
Order_Main.EnableControls;
|
||
ADOQueryCmd.Connection.CommitTrans;
|
||
except
|
||
ADOQueryCmd.Connection.RollbackTrans;
|
||
Application.MessageBox('<27><><EFBFBD>¸<EFBFBD><C2B8><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>쳣!','<27><>ʾ',0);
|
||
end;
|
||
end;
|
||
|
||
end.
|