743 lines
23 KiB
ObjectPascal
743 lines
23 KiB
ObjectPascal
![]() |
unit U_BGFeeList;
|
|||
|
|
|||
|
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
|
|||
|
TfrmBGFeeList = class(TForm)
|
|||
|
ToolBar1: TToolBar;
|
|||
|
TBRafresh: TToolButton;
|
|||
|
TBFind: TToolButton;
|
|||
|
TBAdd: TToolButton;
|
|||
|
TBEdit: TToolButton;
|
|||
|
TBDel: TToolButton;
|
|||
|
TBPrint: TToolButton;
|
|||
|
TBClose: TToolButton;
|
|||
|
Tv1: TcxGridDBTableView;
|
|||
|
cxGrid1Level1: TcxGridLevel;
|
|||
|
cxGrid1: TcxGrid;
|
|||
|
cxGridPopupMenu1: TcxGridPopupMenu;
|
|||
|
ADOQueryCmd: TADOQuery;
|
|||
|
ADOQueryMain: TADOQuery;
|
|||
|
ADOQueryTemp: TADOQuery;
|
|||
|
DataSource1: TDataSource;
|
|||
|
TBExport: TToolButton;
|
|||
|
v1OrdDate: 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;
|
|||
|
v1Column2: TcxGridDBColumn;
|
|||
|
cxTabControl1: TcxTabControl;
|
|||
|
ToolButton3: TToolButton;
|
|||
|
ToolButton4: TToolButton;
|
|||
|
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;
|
|||
|
procedure FormDestroy(Sender: TObject);
|
|||
|
procedure FormClose(Sender: TObject; var Action: TCloseAction);
|
|||
|
procedure FormCreate(Sender: TObject);
|
|||
|
procedure TBCloseClick(Sender: TObject);
|
|||
|
procedure TBFindClick(Sender: TObject);
|
|||
|
procedure TBEditClick(Sender: TObject);
|
|||
|
procedure TBDelClick(Sender: TObject);
|
|||
|
procedure TBExportClick(Sender: TObject);
|
|||
|
procedure TBPrintClick(Sender: TObject);
|
|||
|
procedure TBRafreshClick(Sender: TObject);
|
|||
|
procedure TBAddClick(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 ToolButton3Click(Sender: TObject);
|
|||
|
procedure ToolButton4Click(Sender: TObject);
|
|||
|
procedure Tv1FocusedRecordChanged(Sender: TcxCustomGridTableView;
|
|||
|
APrevFocusedRecord, AFocusedRecord: TcxCustomGridRecord;
|
|||
|
ANewItemRecordFocusingChanged: Boolean);
|
|||
|
procedure OrderNoHZKeyPress(Sender: TObject; var Key: Char);
|
|||
|
private
|
|||
|
DQdate:TDateTime;
|
|||
|
procedure InitGrid();
|
|||
|
procedure InitForm();
|
|||
|
function DelData():Boolean;
|
|||
|
{ Private declarations }
|
|||
|
public
|
|||
|
FFInt,FCloth:Integer;
|
|||
|
|
|||
|
{ Public declarations }
|
|||
|
end;
|
|||
|
|
|||
|
var
|
|||
|
frmBGFeeList: TfrmBGFeeList;
|
|||
|
|
|||
|
implementation
|
|||
|
uses
|
|||
|
U_DataLink,U_BGFeeInPut,U_RTFun;
|
|||
|
|
|||
|
{$R *.dfm}
|
|||
|
|
|||
|
procedure TfrmBGFeeList.FormDestroy(Sender: TObject);
|
|||
|
begin
|
|||
|
frmBGFeeList:=nil;
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmBGFeeList.FormClose(Sender: TObject;
|
|||
|
var Action: TCloseAction);
|
|||
|
begin
|
|||
|
Action:=caFree;
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmBGFeeList.FormCreate(Sender: TObject);
|
|||
|
begin
|
|||
|
cxgrid1.Align:=alClient;
|
|||
|
//BegDate.DateTime:=SGetServerDateTime(ADOQueryTemp)-7;
|
|||
|
//EndDate.DateTime:=SGetServerDateTime(ADOQueryTemp);
|
|||
|
DQdate:=SGetServerDate(ADOQueryTemp);
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmBGFeeList.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 TfrmBGFeeList.InitGrid();
|
|||
|
begin
|
|||
|
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');
|
|||
|
if Trim(ComboBox1.Text)='<27><><EFBFBD>Ǽ<EFBFBD><C7BC><EFBFBD><EFBFBD><EFBFBD>' then
|
|||
|
begin
|
|||
|
SQL.Add('where 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('where 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('where 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('where 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('where 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('where 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('where 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('where 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('where B.SFKDate>='''+FormatDateTime('yyyy-MM-dd',BegDate.DateTime)+'''');
|
|||
|
SQL.Add('and B.SFKDate<'''+FormatDateTime('yyyy-MM-dd',enddate.DateTime+1)+'''');
|
|||
|
end;
|
|||
|
{if Trim(ComboBox1.Text)='<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>' then
|
|||
|
begin
|
|||
|
SQL.Add('where A.FKDate>='''+FormatDateTime('yyyy-MM-dd',BegDate.DateTime)+'''');
|
|||
|
SQL.Add('and A.FKDate<'''+FormatDateTime('yyyy-MM-dd',enddate.DateTime+1)+'''');
|
|||
|
end; }
|
|||
|
|
|||
|
if Trim(DParameters1)<>'<27><>Ȩ<EFBFBD><C8A8>' then
|
|||
|
begin
|
|||
|
//sql.Add('and A.Filler='''+Trim(DName)+'''');
|
|||
|
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;
|
|||
|
if cxTabControl1.TabIndex=0 then
|
|||
|
begin
|
|||
|
SQL.Add(' and isnull(SChkTime,'''')='''' ');
|
|||
|
end else
|
|||
|
if cxTabControl1.TabIndex=1 then
|
|||
|
begin
|
|||
|
SQL.Add(' and isnull(SChkTime,'''')<>'''' ');
|
|||
|
sql.Add(' and (isnull(B.SFKDate,'''')='''' and isnull(TuiDanChkDate,'''')='''')');
|
|||
|
end else
|
|||
|
if cxTabControl1.TabIndex=2 then
|
|||
|
begin
|
|||
|
SQL.Add(' and isnull(SChkTime,'''')<>'''' ');
|
|||
|
sql.Add(' and (isnull(B.SFKDate,'''')<>'''')');
|
|||
|
end else
|
|||
|
if cxTabControl1.TabIndex=3 then
|
|||
|
begin
|
|||
|
SQL.Add(' and isnull(SChkTime,'''')<>'''' ');
|
|||
|
sql.Add(' and (isnull(TuiDanChkDate,'''')<>'''')');
|
|||
|
end;
|
|||
|
Open;
|
|||
|
end;
|
|||
|
SCreateCDS20(ADOQueryMain,Order_Main);
|
|||
|
SInitCDSData20(ADOQueryMain,Order_Main);
|
|||
|
finally
|
|||
|
ADOQueryMain.EnableControls;
|
|||
|
end;
|
|||
|
end;
|
|||
|
|
|||
|
|
|||
|
procedure TfrmBGFeeList.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);
|
|||
|
InitGrid();
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmBGFeeList.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 TfrmBGFeeList.TBEditClick(Sender: TObject);
|
|||
|
begin
|
|||
|
if Order_Main.IsEmpty then Exit;
|
|||
|
if cxTabControl1.TabIndex<>0 then Exit;
|
|||
|
if Trim(Order_Main.fieldbyname('Filler').AsString)<>Trim(DName) then
|
|||
|
begin
|
|||
|
Application.MessageBox('<27><><EFBFBD>ܲ<EFBFBD><DCB2><EFBFBD><EFBFBD><EFBFBD><EFBFBD>˵<EFBFBD><CBB5><EFBFBD><EFBFBD><EFBFBD>!','<27><>ʾ',0);
|
|||
|
Exit;
|
|||
|
end;
|
|||
|
try
|
|||
|
frmBGFeeInPut:=TfrmBGFeeInPut.Create(Application);
|
|||
|
with frmBGFeeInPut do
|
|||
|
begin
|
|||
|
PState:=1;
|
|||
|
FMainId:=Trim(Self.Order_Main.fieldbyname('BMId').AsString);
|
|||
|
if ShowModal=1 then
|
|||
|
begin
|
|||
|
|
|||
|
end;
|
|||
|
end;
|
|||
|
finally
|
|||
|
frmBGFeeInPut.Free;
|
|||
|
end;
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmBGFeeList.TBDelClick(Sender: TObject);
|
|||
|
begin
|
|||
|
if Order_Main.IsEmpty then Exit;
|
|||
|
if cxTabControl1.TabIndex<>0 then Exit;
|
|||
|
with ADOQueryTemp do
|
|||
|
begin
|
|||
|
Close;
|
|||
|
sql.Clear;
|
|||
|
sql.Add('select * from BGFee_Main where BMID='''+Trim(Order_Main.fieldbyname('BMID').AsString)+'''');
|
|||
|
Open;
|
|||
|
end;
|
|||
|
if Trim(ADOQueryTemp.fieldbyname('ChkStatus').AsString)<>'' then
|
|||
|
begin
|
|||
|
Application.MessageBox('<27><><EFBFBD><EFBFBD><EFBFBD>Ѳ<EFBFBD><D1B2><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ݣ<EFBFBD><DDA3><EFBFBD><EFBFBD><EFBFBD>ɾ<EFBFBD><C9BE>!','<27><>ʾ',0);
|
|||
|
Exit;
|
|||
|
end;
|
|||
|
if Trim(Order_Main.fieldbyname('Filler').AsString)<>Trim(DName) then
|
|||
|
begin
|
|||
|
Application.MessageBox('<27><><EFBFBD>ܲ<EFBFBD><DCB2><EFBFBD><EFBFBD><EFBFBD><EFBFBD>˵<EFBFBD><CBB5><EFBFBD><EFBFBD><EFBFBD>!','<27><>ʾ',0);
|
|||
|
Exit;
|
|||
|
end;
|
|||
|
if Application.MessageBox('ȷ<><C8B7>Ҫɾ<D2AA><C9BE><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>','<27><>ʾ',32+4)<>IDYES then Exit;
|
|||
|
if DelData() then
|
|||
|
begin
|
|||
|
Order_Main.Delete;
|
|||
|
end;
|
|||
|
end;
|
|||
|
|
|||
|
function TfrmBGFeeList.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 TfrmBGFeeList.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 TfrmBGFeeList.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 TfrmBGFeeList.TBRafreshClick(Sender: TObject);
|
|||
|
begin
|
|||
|
InitGrid();
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmBGFeeList.TBAddClick(Sender: TObject);
|
|||
|
var
|
|||
|
maxno:string;
|
|||
|
begin
|
|||
|
try
|
|||
|
frmBGFeeInPut:=TfrmBGFeeInPut.Create(Application);
|
|||
|
with frmBGFeeInPut do
|
|||
|
begin
|
|||
|
PState:=0;
|
|||
|
FMainId:='';
|
|||
|
if ShowModal=1 then
|
|||
|
begin
|
|||
|
|
|||
|
end;
|
|||
|
end;
|
|||
|
finally
|
|||
|
frmBGFeeInPut.Free;
|
|||
|
end;
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmBGFeeList.FormShow(Sender: TObject);
|
|||
|
begin
|
|||
|
InitForm();
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmBGFeeList.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 TfrmBGFeeList.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 TfrmBGFeeList.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 TfrmBGFeeList.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 TfrmBGFeeList.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)+'%'+'''');
|
|||
|
if cxTabControl1.TabIndex=0 then
|
|||
|
begin
|
|||
|
SQL.Add(' and isnull(SChkTime,'''')='''' ');
|
|||
|
end else
|
|||
|
if cxTabControl1.TabIndex=1 then
|
|||
|
begin
|
|||
|
SQL.Add(' and isnull(SChkTime,'''')<>'''' ');
|
|||
|
sql.Add(' and (isnull(SFKDate,'''')<>'''' or isnull(TuiDanChkDate,'''')<>'''')');
|
|||
|
end else
|
|||
|
if cxTabControl1.TabIndex=2 then
|
|||
|
begin
|
|||
|
SQL.Add(' and isnull(SChkTime,'''')<>'''' ');
|
|||
|
sql.Add(' and (isnull(SFKDate,'''')<>'''')');
|
|||
|
end else
|
|||
|
if cxTabControl1.TabIndex=3 then
|
|||
|
begin
|
|||
|
SQL.Add(' and isnull(SChkTime,'''')<>'''' ');
|
|||
|
sql.Add(' and (isnull(TuiDanChkDate,'''')<>'''')');
|
|||
|
end;
|
|||
|
Open;
|
|||
|
end;
|
|||
|
SCreateCDS20(ADOQueryMain,Order_Main);
|
|||
|
SInitCDSData20(ADOQueryMain,Order_Main);
|
|||
|
finally
|
|||
|
ADOQueryMain.EnableControls;
|
|||
|
end;
|
|||
|
end;
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmBGFeeList.cxTabControl1Change(Sender: TObject);
|
|||
|
begin
|
|||
|
InitGrid();
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmBGFeeList.ToolButton3Click(Sender: TObject);
|
|||
|
begin
|
|||
|
if Order_Main.IsEmpty then Exit;
|
|||
|
if cxTabControl1.TabIndex<>0 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 BGFee_Main Set SChkStatus=''<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>'',SChkTime=getdate(),SChker='''+Trim(DName)+'''');
|
|||
|
sql.Add(' where BMID='''+Trim(Order_Main.fieldbyname('BMID').AsString)+'''');
|
|||
|
ExecSQL;
|
|||
|
end;
|
|||
|
Order_Main.Delete;
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmBGFeeList.ToolButton4Click(Sender: TObject);
|
|||
|
begin
|
|||
|
if Order_Main.IsEmpty then Exit;
|
|||
|
if cxTabControl1.TabIndex<>1 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 BGFee_Main Set SChkStatus=Null,SChkTime=Null,SChker=Null');
|
|||
|
sql.Add(' where BMID='''+Trim(Order_Main.fieldbyname('BMID').AsString)+'''');
|
|||
|
ExecSQL;
|
|||
|
end;
|
|||
|
Order_Main.Delete;
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmBGFeeList.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 TfrmBGFeeList.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)+'%'+'''');
|
|||
|
if cxTabControl1.TabIndex=0 then
|
|||
|
begin
|
|||
|
SQL.Add(' and isnull(SChkTime,'''')='''' ');
|
|||
|
end else
|
|||
|
if cxTabControl1.TabIndex=1 then
|
|||
|
begin
|
|||
|
SQL.Add(' and isnull(SChkTime,'''')<>'''' ');
|
|||
|
sql.Add(' and (isnull(SFKDate,'''')<>'''' or isnull(TuiDanChkDate,'''')<>'''')');
|
|||
|
end else
|
|||
|
if cxTabControl1.TabIndex=2 then
|
|||
|
begin
|
|||
|
SQL.Add(' and isnull(SChkTime,'''')<>'''' ');
|
|||
|
sql.Add(' and (isnull(SFKDate,'''')<>'''')');
|
|||
|
end else
|
|||
|
if cxTabControl1.TabIndex=3 then
|
|||
|
begin
|
|||
|
SQL.Add(' and isnull(SChkTime,'''')<>'''' ');
|
|||
|
sql.Add(' and (isnull(TuiDanChkDate,'''')<>'''')');
|
|||
|
end;
|
|||
|
Open;
|
|||
|
end;
|
|||
|
SCreateCDS20(ADOQueryMain,Order_Main);
|
|||
|
SInitCDSData20(ADOQueryMain,Order_Main);
|
|||
|
finally
|
|||
|
ADOQueryMain.EnableControls;
|
|||
|
end;
|
|||
|
end;
|
|||
|
end;
|
|||
|
|
|||
|
end.
|