|
|
|
|
unit u_rp_sales_profitLcx;
|
|
|
|
|
|
|
|
|
|
interface
|
|
|
|
|
|
|
|
|
|
uses
|
|
|
|
|
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
|
|
|
|
|
Dialogs, RxLookup, bsSkinCtrls, StdCtrls, wwdbdatetimepicker, XPMenu,
|
|
|
|
|
dxExEdtr, dxDBTLCl, dxGrClms, dxDBCtrl, dxDBGrid, dxTL, dxCntner, DB,
|
|
|
|
|
ADODB, Menus, kbmMemTable,DateUtils;
|
|
|
|
|
|
|
|
|
|
type
|
|
|
|
|
Tfrm_rp_sales_profitLcx = class(TForm)
|
|
|
|
|
bsSkinPanel1: TbsSkinPanel;
|
|
|
|
|
Label10: TLabel;
|
|
|
|
|
Label5: TLabel;
|
|
|
|
|
Label8: TLabel;
|
|
|
|
|
Label11: TLabel;
|
|
|
|
|
Label16: TLabel;
|
|
|
|
|
Label1: TLabel;
|
|
|
|
|
Label2: TLabel;
|
|
|
|
|
wwDBDateTimePicker3: TwwDBDateTimePicker;
|
|
|
|
|
bsSkinButton10: TbsSkinButton;
|
|
|
|
|
bsSkinButton9: TbsSkinButton;
|
|
|
|
|
bsSkinButton5: TbsSkinButton;
|
|
|
|
|
wwDBDateTimePicker1: TwwDBDateTimePicker;
|
|
|
|
|
wwDBDateTimePicker2: TwwDBDateTimePicker;
|
|
|
|
|
wwDBDateTimePicker4: TwwDBDateTimePicker;
|
|
|
|
|
RxDBLookupCombo6: TRxDBLookupCombo;
|
|
|
|
|
RxDBLookupCombo1: TRxDBLookupCombo;
|
|
|
|
|
RxDBLookupCombo2: TRxDBLookupCombo;
|
|
|
|
|
bsSkinButton6: TbsSkinButton;
|
|
|
|
|
XPMenu1: TXPMenu;
|
|
|
|
|
dxDBGrid1: TdxDBGrid;
|
|
|
|
|
Label3: TLabel;
|
|
|
|
|
cmbbYwlb: TComboBox;
|
|
|
|
|
tv_bscard_all: TADOQuery;
|
|
|
|
|
tv_bscard_all1: TDataSource;
|
|
|
|
|
dxDBGrid1Column1: TdxDBGridMaskColumn;
|
|
|
|
|
dxDBGrid1Column3: TdxDBGridMaskColumn;
|
|
|
|
|
dxDBGrid1Column4: TdxDBGridMaskColumn;
|
|
|
|
|
dxDBGrid1Column5: TdxDBGridMaskColumn;
|
|
|
|
|
dxDBGrid1Column6: TdxDBGridDateColumn;
|
|
|
|
|
dxDBGrid1Column7: TdxDBGridMaskColumn;
|
|
|
|
|
dxDBGrid1Column8: TdxDBGridMaskColumn;
|
|
|
|
|
dxDBGrid1Column9: TdxDBGridMaskColumn;
|
|
|
|
|
dxDBGrid1Column10: TdxDBGridMaskColumn;
|
|
|
|
|
dxDBGrid1Column11: TdxDBGridMaskColumn;
|
|
|
|
|
dxDBGrid1Column12: TdxDBGridMaskColumn;
|
|
|
|
|
dxDBGrid1Column13: TdxDBGridMaskColumn;
|
|
|
|
|
dxDBGrid1Column14: TdxDBGridDateColumn;
|
|
|
|
|
dxDBGrid1Column15: TdxDBGridMaskColumn;
|
|
|
|
|
dxDBGrid1Column16: TdxDBGridMaskColumn;
|
|
|
|
|
dxDBGrid1Column17: TdxDBGridMaskColumn;
|
|
|
|
|
dxDBGrid1Column18: TdxDBGridMaskColumn;
|
|
|
|
|
dxDBGrid1Column20: TdxDBGridMaskColumn;
|
|
|
|
|
dxDBGrid1Column21: TdxDBGridDateColumn;
|
|
|
|
|
dxDBGrid1Column22: TdxDBGridMaskColumn;
|
|
|
|
|
dxDBGrid1Column23: TdxDBGridMaskColumn;
|
|
|
|
|
dxDBGrid1Column24: TdxDBGridMaskColumn;
|
|
|
|
|
dxDBGrid1Column25: TdxDBGridMaskColumn;
|
|
|
|
|
dxDBGrid1Column31: TdxDBGridMaskColumn;
|
|
|
|
|
dxDBGrid1Column32: TdxDBGridMaskColumn;
|
|
|
|
|
dxDBGrid1Column40: TdxDBGridMaskColumn;
|
|
|
|
|
dxDBGrid1Column41: TdxDBGridMaskColumn;
|
|
|
|
|
dxDBGrid1Column68: TdxDBGridMaskColumn;
|
|
|
|
|
dxDBGrid1Column83: TdxDBGridMaskColumn;
|
|
|
|
|
PopupMenu2: TPopupMenu;
|
|
|
|
|
N10: TMenuItem;
|
|
|
|
|
MenuItem1: TMenuItem;
|
|
|
|
|
N14: TMenuItem;
|
|
|
|
|
N13: TMenuItem;
|
|
|
|
|
N12: TMenuItem;
|
|
|
|
|
N15: TMenuItem;
|
|
|
|
|
N16: TMenuItem;
|
|
|
|
|
dxDBGrid1Column94: TdxDBGridColumn;
|
|
|
|
|
dxDBGrid1Column19: TdxDBGridColumn;
|
|
|
|
|
dxDBGrid1USD: TdxDBGridColumn;
|
|
|
|
|
dxDBGrid1Column71: TdxDBGridColumn;
|
|
|
|
|
dxDBGrid1Column72: TdxDBGridColumn;
|
|
|
|
|
dxDBGrid1Column73: TdxDBGridColumn;
|
|
|
|
|
dxDBGrid1Column74: TdxDBGridColumn;
|
|
|
|
|
dxDBGrid1RMB: TdxDBGridColumn;
|
|
|
|
|
dxDBGrid1Column76: TdxDBGridColumn;
|
|
|
|
|
dxDBGrid1Column77: TdxDBGridColumn;
|
|
|
|
|
dxDBGrid1Column78: TdxDBGridColumn;
|
|
|
|
|
dxDBGrid1Column79: TdxDBGridColumn;
|
|
|
|
|
dxDBGrid1Column80: TdxDBGridColumn;
|
|
|
|
|
dxDBGrid1Column81: TdxDBGridColumn;
|
|
|
|
|
dxDBGrid1Column82: TdxDBGridColumn;
|
|
|
|
|
dxDBGrid1Column84: TdxDBGridColumn;
|
|
|
|
|
dxDBGrid1Column85: TdxDBGridColumn;
|
|
|
|
|
memTblCustDetail: TkbmMemTable;
|
|
|
|
|
dsrTblCustDetal: TDataSource;
|
|
|
|
|
memTblCustDetailField2: TStringField;
|
|
|
|
|
memTblCustDetailField3: TStringField;
|
|
|
|
|
memTblCustDetailField4: TStringField;
|
|
|
|
|
memTblCustDetailField5: TStringField;
|
|
|
|
|
memTblCustDetailField6: TStringField;
|
|
|
|
|
memTblCustDetailField9: TStringField;
|
|
|
|
|
memTblCustDetailField8: TIntegerField;
|
|
|
|
|
memTblCustDetailField10: TStringField;
|
|
|
|
|
memTblCustDetailField11: TStringField;
|
|
|
|
|
memTblCustDetailField12: TStringField;
|
|
|
|
|
memTblCustDetailField13: TStringField;
|
|
|
|
|
memTblCustDetailField14: TStringField;
|
|
|
|
|
memTblCustDetailField16: TStringField;
|
|
|
|
|
memTblCustDetailField17: TStringField;
|
|
|
|
|
memTblCustDetailField18: TIntegerField;
|
|
|
|
|
memTblCustDetailField19: TStringField;
|
|
|
|
|
memTblCustDetailField20: TFloatField;
|
|
|
|
|
memTblCustDetailField21: TStringField;
|
|
|
|
|
memTblCustDetailField23: TStringField;
|
|
|
|
|
memTblCustDetailField24: TStringField;
|
|
|
|
|
memTblCustDetailField25: TStringField;
|
|
|
|
|
memTblCustDetailField26: TStringField;
|
|
|
|
|
memTblCustDetailField27: TStringField;
|
|
|
|
|
memTblCustDetailField28: TStringField;
|
|
|
|
|
memTblCustDetailField29: TStringField;
|
|
|
|
|
memTblCustDetailField30: TStringField;
|
|
|
|
|
memTblCustDetailField31: TStringField;
|
|
|
|
|
memTblCustDetailUSD: TFloatField;
|
|
|
|
|
memTblCustDetailUSD2: TFloatField;
|
|
|
|
|
memTblCustDetailUSD3: TFloatField;
|
|
|
|
|
memTblCustDetailUSD4: TFloatField;
|
|
|
|
|
memTblCustDetailUSD5: TFloatField;
|
|
|
|
|
memTblCustDetailRMB: TFloatField;
|
|
|
|
|
memTblCustDetailRMB2: TFloatField;
|
|
|
|
|
memTblCustDetailRMB3: TFloatField;
|
|
|
|
|
memTblCustDetailRMB4: TFloatField;
|
|
|
|
|
memTblCustDetailRMB5: TFloatField;
|
|
|
|
|
memTblCustDetailField32: TFloatField;
|
|
|
|
|
memTblCustDetailField33: TFloatField;
|
|
|
|
|
memTblCustDetailField34: TFloatField;
|
|
|
|
|
memTblCustDetailField35: TFloatField;
|
|
|
|
|
memTblCustDetailField36: TFloatField;
|
|
|
|
|
memTblCustDetailField37: TStringField;
|
|
|
|
|
memTblCustDetailField38: TFloatField;
|
|
|
|
|
memTblCustDetailField: TDateTimeField;
|
|
|
|
|
memTblCustDetailField7: TDateTimeField;
|
|
|
|
|
memTblCustDetailField15: TDateTimeField;
|
|
|
|
|
dxDBGrid1Column47: TdxDBGridColumn;
|
|
|
|
|
bsSkinCheckRadioBox1: TbsSkinCheckRadioBox;
|
|
|
|
|
bsSkinCheckRadioBox2: TbsSkinCheckRadioBox;
|
|
|
|
|
memTblCustDetailField22: TStringField;
|
|
|
|
|
dxDBGrid1Column48: TdxDBGridColumn;
|
|
|
|
|
bsSkinCheckRadioBox3: TbsSkinCheckRadioBox;
|
|
|
|
|
memTblCustDetailField39: TDateTimeField;
|
|
|
|
|
Label4: TLabel;
|
|
|
|
|
wwDBDateTimePicker5: TwwDBDateTimePicker;
|
|
|
|
|
Label6: TLabel;
|
|
|
|
|
wwDBDateTimePicker6: TwwDBDateTimePicker;
|
|
|
|
|
dxDBGrid1Column49: TdxDBGridColumn;
|
|
|
|
|
RxDBLookupCombo15: TRxDBLookupCombo;
|
|
|
|
|
RxDBLookupCombo12: TRxDBLookupCombo;
|
|
|
|
|
Label23: TLabel;
|
|
|
|
|
Label40: TLabel;
|
|
|
|
|
Label21: TLabel;
|
|
|
|
|
RxDBLookupCombo20: TRxDBLookupCombo;
|
|
|
|
|
bsSkinButton1: TbsSkinButton;
|
|
|
|
|
bsSkinButton2: TbsSkinButton;
|
|
|
|
|
bsSkinButton3: TbsSkinButton;
|
|
|
|
|
dxDBGrid1Column50: TdxDBGridCheckColumn;
|
|
|
|
|
memTblCustDetailFEE2: TIntegerField;
|
|
|
|
|
memTblCustDetailField40: TStringField;
|
|
|
|
|
dxDBGrid1Column51: TdxDBGridColumn;
|
|
|
|
|
procedure bsSkinButton5Click(Sender: TObject);
|
|
|
|
|
procedure bsSkinButton10Click(Sender: TObject);
|
|
|
|
|
procedure bsSkinButton6Click(Sender: TObject);
|
|
|
|
|
procedure FormClose(Sender: TObject; var Action: TCloseAction);
|
|
|
|
|
procedure N10Click(Sender: TObject);
|
|
|
|
|
procedure N14Click(Sender: TObject);
|
|
|
|
|
procedure N12Click(Sender: TObject);
|
|
|
|
|
procedure N16Click(Sender: TObject);
|
|
|
|
|
procedure bsSkinButton9Click(Sender: TObject);
|
|
|
|
|
procedure FormShow(Sender: TObject);
|
|
|
|
|
procedure bsSkinButton1Click(Sender: TObject);
|
|
|
|
|
procedure dxDBGrid1DblClick(Sender: TObject);
|
|
|
|
|
procedure bsSkinButton2Click(Sender: TObject);
|
|
|
|
|
procedure bsSkinButton3Click(Sender: TObject);
|
|
|
|
|
procedure dxDBGrid1CustomDraw(Sender: TObject; ACanvas: TCanvas;
|
|
|
|
|
ARect: TRect; ANode: TdxTreeListNode; AColumn: TdxDBTreeListColumn;
|
|
|
|
|
const AText: String; AFont: TFont; var AColor: TColor; ASelected,
|
|
|
|
|
AFocused: Boolean; var ADone: Boolean);
|
|
|
|
|
private
|
|
|
|
|
function getlx(etd:TDate;bsno,saleid:string):double;
|
|
|
|
|
{ Private declarations }
|
|
|
|
|
public
|
|
|
|
|
{ Public declarations }
|
|
|
|
|
procedure UpdateBsProfit(bstype,bsno:String;fee:integer);
|
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
var
|
|
|
|
|
frm_rp_sales_profitLcx: Tfrm_rp_sales_profitLcx;
|
|
|
|
|
|
|
|
|
|
implementation
|
|
|
|
|
|
|
|
|
|
{$R *.dfm}
|
|
|
|
|
uses u_main, my_sys_function, u_rp_totaljs_query;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
procedure Tfrm_rp_sales_profitLcx.UpdateBsProfit(bstype,bsno:String;fee:integer);
|
|
|
|
|
var
|
|
|
|
|
aQuery:TADOQuery;
|
|
|
|
|
tblname:string;
|
|
|
|
|
begin
|
|
|
|
|
tblname:='';
|
|
|
|
|
if bstype='<27><><EFBFBD>˳<EFBFBD><CBB3><EFBFBD>' then tblname:='t_op_seae'
|
|
|
|
|
else if bstype='<27><><EFBFBD>˽<EFBFBD><CBBD><EFBFBD>' then tblname:='t_op_seai'
|
|
|
|
|
else if bstype='<27><><EFBFBD>˳<EFBFBD><CBB3><EFBFBD>' then tblname:='t_op_Aire'
|
|
|
|
|
else if bstype='<27><><EFBFBD>˽<EFBFBD><CBBD><EFBFBD>' then tblname:='t_op_Airi';
|
|
|
|
|
if tblname='' then exit;
|
|
|
|
|
aQuery:=CreateAdoQuery;
|
|
|
|
|
with aQuery do
|
|
|
|
|
try
|
|
|
|
|
Close;SQL.Clear;
|
|
|
|
|
SQL.Add('update '+tblname +' set Fee2=:fee');
|
|
|
|
|
SQL.Add('where <20><><EFBFBD><EFBFBD>=:bsno');
|
|
|
|
|
Parameters.ParamByName('bsno').Value:=bsno;
|
|
|
|
|
Parameters.ParamByName('fee').Value:=fee;
|
|
|
|
|
Execsql;
|
|
|
|
|
finally
|
|
|
|
|
FreeAndNil(aQuery);
|
|
|
|
|
end;
|
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
function Tfrm_rp_sales_profitLcx.getlx(etd:TDate;bsno,saleid:string):double;
|
|
|
|
|
var
|
|
|
|
|
aQuery,aQuery2:TAdoQuery;
|
|
|
|
|
d:integer;
|
|
|
|
|
lx:real;
|
|
|
|
|
begin
|
|
|
|
|
aQuery:=CreateAdoQuery;
|
|
|
|
|
aQuery2:=CreateAdoQuery;
|
|
|
|
|
result:=0;
|
|
|
|
|
try
|
|
|
|
|
with aQuery do begin
|
|
|
|
|
close;sql.clear;
|
|
|
|
|
sql.Add('select * from t_crm_saleslxSet where <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>=(select <20><><EFBFBD>ɷ<EFBFBD><C9B7><EFBFBD> from t_sys_employee where <20><><EFBFBD><EFBFBD>='''+saleid+''') order by <20><>ʼ<EFBFBD><CABC><EFBFBD><EFBFBD>');
|
|
|
|
|
open;
|
|
|
|
|
if IsEmpty then begin
|
|
|
|
|
result:=0;
|
|
|
|
|
exit;
|
|
|
|
|
end else begin
|
|
|
|
|
aQuery2.close;aQuery2.sql.clear;
|
|
|
|
|
aQuery2.sql.Add('select sum(ԭʼ<D4AD><CABC><EFBFBD><EFBFBD>*<2A><><EFBFBD><EFBFBD>) as <20><><EFBFBD><EFBFBD>,<2C><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> from v_fee_do_detail where <20><><EFBFBD><EFBFBD>=''<27><>'' and <20><><EFBFBD><EFBFBD>='''+bsno+'''');
|
|
|
|
|
aQuery2.sql.Add('group by <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>');
|
|
|
|
|
aQuery2.Open;
|
|
|
|
|
aQuery2.First;
|
|
|
|
|
while not aQuery2.Eof do begin
|
|
|
|
|
if aQuery2.FieldByName('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').AsDateTime>etd then begin
|
|
|
|
|
d:=abs(daysbetween(etd,aQuery2.FieldByName('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').AsDateTime));
|
|
|
|
|
first;
|
|
|
|
|
lx:=0.00;
|
|
|
|
|
while not eof do begin
|
|
|
|
|
if (d>=fieldbyname('<27><>ʼ<EFBFBD><CABC><EFBFBD><EFBFBD>').asinteger) and (d<=fieldbyname('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').asinteger) then begin
|
|
|
|
|
lx:=fieldbyname('<27><>Ϣ<EFBFBD>ٷֱ<D9B7>').asfloat;
|
|
|
|
|
result:=result+(aQuery2.fieldbyname('<27><><EFBFBD><EFBFBD>').asfloat*lx/100*(d-fieldbyname('<27><>ʼ<EFBFBD><CABC><EFBFBD><EFBFBD>').asinteger));
|
|
|
|
|
end else begin
|
|
|
|
|
if d>fieldbyname('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').asinteger then begin
|
|
|
|
|
lx:=fieldbyname('<27><>Ϣ<EFBFBD>ٷֱ<D9B7>').asfloat;
|
|
|
|
|
result:=result+(aQuery2.fieldbyname('<27><><EFBFBD><EFBFBD>').asfloat*lx/100*(fieldbyname('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').asinteger-fieldbyname('<27><>ʼ<EFBFBD><CABC><EFBFBD><EFBFBD>').asinteger));
|
|
|
|
|
end;
|
|
|
|
|
end;
|
|
|
|
|
next;
|
|
|
|
|
end;
|
|
|
|
|
end;
|
|
|
|
|
aQuery2.Next;
|
|
|
|
|
end;
|
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
end;
|
|
|
|
|
finally
|
|
|
|
|
FreeAndNil(aQuery);
|
|
|
|
|
FreeAndNil(aQuery2);
|
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
procedure Tfrm_rp_sales_profitLcx.bsSkinButton5Click(Sender: TObject);
|
|
|
|
|
begin
|
|
|
|
|
close ;
|
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
procedure Tfrm_rp_sales_profitLcx.bsSkinButton10Click(Sender: TObject);
|
|
|
|
|
begin
|
|
|
|
|
if bsSkinCheckRadioBox2.Checked then begin
|
|
|
|
|
if (wwDBDateTimePicker5.text='')or (wwDBDateTimePicker5.text='') then begin
|
|
|
|
|
MessageDlg('<27><><EFBFBD><EFBFBD>ͳ<EFBFBD>ƵĿ<C6B5><C4BF><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϊ<EFBFBD><CEAA><EFBFBD>',mtWarning,[mbok],0);
|
|
|
|
|
end;
|
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
with tv_bscard_all,sql do
|
|
|
|
|
begin
|
|
|
|
|
close ; clear ;
|
|
|
|
|
add('SELECT V_op_bscard.*, v_fee_do_max.<2E><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> FROM V_op_bscard ');
|
|
|
|
|
add('left join v_fee_do_max on v_fee_do_max.<2E><><EFBFBD><EFBFBD>=V_op_bscard.<2E><><EFBFBD><EFBFBD> ');
|
|
|
|
|
add('where 1=1');
|
|
|
|
|
if bsSkinCheckRadioBox1.Checked then begin
|
|
|
|
|
add(' and (v_op_bscard.<2E>ϼ<EFBFBD>Ӧ<EFBFBD><D3A6>=v_op_bscard.<2E>ϼ<EFBFBD><CFBC><EFBFBD><EFBFBD><EFBFBD>) and (v_op_bscard.<2E>ϼ<EFBFBD>Ӧ<EFBFBD><D3A6><>0)');
|
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
case cmbbYwlb.ItemIndex of
|
|
|
|
|
1:add('and (V_op_bscard.ҵ<><D2B5><EFBFBD><EFBFBD><EFBFBD><EFBFBD> ='+'''<27><><EFBFBD>˳<EFBFBD><CBB3><EFBFBD>'''+')');
|
|
|
|
|
2:add('and (V_op_bscard.ҵ<><D2B5><EFBFBD><EFBFBD><EFBFBD><EFBFBD> ='+'''<27><><EFBFBD>˽<EFBFBD><CBBD><EFBFBD>'''+')');
|
|
|
|
|
3:add('and (V_op_bscard.ҵ<><D2B5><EFBFBD><EFBFBD><EFBFBD><EFBFBD> ='+'''<27><><EFBFBD>˳<EFBFBD><CBB3><EFBFBD>'''+')');
|
|
|
|
|
4:add('and (V_op_bscard.ҵ<><D2B5><EFBFBD><EFBFBD><EFBFBD><EFBFBD> ='+'''<27><><EFBFBD>˽<EFBFBD><CBBD><EFBFBD>'''+')');
|
|
|
|
|
end ;
|
|
|
|
|
if wwDBDateTimePicker1.text<>''then
|
|
|
|
|
begin
|
|
|
|
|
|
|
|
|
|
add(' and v_fee_do_max.<2E><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> >='+''''+wwDBDateTimePicker1.text+'''');
|
|
|
|
|
end ;
|
|
|
|
|
if wwDBDateTimePicker2.text<>''then
|
|
|
|
|
begin
|
|
|
|
|
|
|
|
|
|
add(' and v_fee_do_max.<2E><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <='+''''+wwDBDateTimePicker2.text+' 23:59:59 ''');
|
|
|
|
|
end ;
|
|
|
|
|
if wwDBDateTimePicker3.text<>''then
|
|
|
|
|
add(' and V_op_bscard.<2E><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>>='+''''+wwDBDateTimePicker3.text+'''');
|
|
|
|
|
if wwDBDateTimePicker4.text<>''then
|
|
|
|
|
add(' and V_op_bscard.<2E><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><='+''''+wwDBDateTimePicker4.text+'''');
|
|
|
|
|
if RxDBLookupCombo6.DisplayValue<>''then
|
|
|
|
|
add(' and V_op_bscard.<2E><><EFBFBD><EFBFBD>Ա='+''''+RxDBLookupCombo6.DisplayValue+'''');
|
|
|
|
|
if RxDBLookupCombo1.DisplayValue<>''then
|
|
|
|
|
add(' and V_op_bscard.<2E><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>='+''''+RxDBLookupCombo1.DisplayValue+'''');
|
|
|
|
|
if RxDBLookupCombo2.DisplayValue<>''then
|
|
|
|
|
add(' and V_op_bscard.¼<><C2BC><EFBFBD><EFBFBD>='+''''+RxDBLookupCombo2.DisplayValue+'''');
|
|
|
|
|
|
|
|
|
|
if RxDBLookupCombo12.DisplayValue<>''then
|
|
|
|
|
add(' and V_op_bscard.<2E><><EFBFBD>۲<EFBFBD><DBB2><EFBFBD>='+''''+RxDBLookupCombo12.DisplayValue+'''');
|
|
|
|
|
if RxDBLookupCombo15.DisplayValue<>''then
|
|
|
|
|
add(' and V_op_bscard.<2E>ֲ<EFBFBD><D6B2><EFBFBD><EFBFBD><EFBFBD>='+''''+RxDBLookupCombo15.DisplayValue+'''');
|
|
|
|
|
|
|
|
|
|
if RxDBLookupCombo20.DisplayValue<>''then
|
|
|
|
|
add(' and V_op_bscard.<2E><><EFBFBD><EFBFBD>='+''''+RxDBLookupCombo20.DisplayValues[1]+'''');
|
|
|
|
|
|
|
|
|
|
add(' and '+open_data('0021','v_op_bscard.<2E><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>','no','no','no','no'));
|
|
|
|
|
|
|
|
|
|
if bsSkinCheckRadioBox2.Checked then begin
|
|
|
|
|
add('union SELECT V_op_bscard.*, v_fee_do_max.<2E><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> FROM V_op_bscard ');
|
|
|
|
|
add('left join v_fee_do_max on v_fee_do_max.<2E><><EFBFBD><EFBFBD>=V_op_bscard.<2E><><EFBFBD><EFBFBD> ');
|
|
|
|
|
add('where 1=1');
|
|
|
|
|
add(' and v_op_bscard.<2E>ϼ<EFBFBD>Ӧ<EFBFBD><D3A6>=0 ');
|
|
|
|
|
if wwDBDateTimePicker5.text<>''then
|
|
|
|
|
begin
|
|
|
|
|
add(' and v_op_bscard.<2E><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> >='+''''+wwDBDateTimePicker5.text+'''');
|
|
|
|
|
end;
|
|
|
|
|
if wwDBDateTimePicker6.text<>''then
|
|
|
|
|
begin
|
|
|
|
|
add(' and v_op_bscard.<2E><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <='+''''+wwDBDateTimePicker6.text+'''');
|
|
|
|
|
end;
|
|
|
|
|
// add(')');
|
|
|
|
|
|
|
|
|
|
if RxDBLookupCombo6.DisplayValue<>''then
|
|
|
|
|
add(' and V_op_bscard.<2E><><EFBFBD><EFBFBD>Ա='+''''+RxDBLookupCombo6.DisplayValue+'''');
|
|
|
|
|
if RxDBLookupCombo1.DisplayValue<>''then
|
|
|
|
|
add(' and V_op_bscard.<2E><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>='+''''+RxDBLookupCombo1.DisplayValue+'''');
|
|
|
|
|
if RxDBLookupCombo2.DisplayValue<>''then
|
|
|
|
|
add(' and V_op_bscard.¼<><C2BC><EFBFBD><EFBFBD>='+''''+RxDBLookupCombo2.DisplayValue+'''');
|
|
|
|
|
if RxDBLookupCombo20.DisplayValue<>''then
|
|
|
|
|
add(' and V_op_bscard.<2E><><EFBFBD><EFBFBD>='+''''+RxDBLookupCombo20.DisplayValues[1]+'''');
|
|
|
|
|
|
|
|
|
|
case cmbbYwlb.ItemIndex of
|
|
|
|
|
1:add('and (V_op_bscard.ҵ<><D2B5><EFBFBD><EFBFBD><EFBFBD><EFBFBD> ='+'''<27><><EFBFBD>˳<EFBFBD><CBB3><EFBFBD>'''+')');
|
|
|
|
|
2:add('and (V_op_bscard.ҵ<><D2B5><EFBFBD><EFBFBD><EFBFBD><EFBFBD> ='+'''<27><><EFBFBD>˽<EFBFBD><CBBD><EFBFBD>'''+')');
|
|
|
|
|
3:add('and (V_op_bscard.ҵ<><D2B5><EFBFBD><EFBFBD><EFBFBD><EFBFBD> ='+'''<27><><EFBFBD>˳<EFBFBD><CBB3><EFBFBD>'''+')');
|
|
|
|
|
4:add('and (V_op_bscard.ҵ<><D2B5><EFBFBD><EFBFBD><EFBFBD><EFBFBD> ='+'''<27><><EFBFBD>˽<EFBFBD><CBBD><EFBFBD>'''+')');
|
|
|
|
|
end ;
|
|
|
|
|
|
|
|
|
|
if RxDBLookupCombo12.DisplayValue<>''then
|
|
|
|
|
add(' and V_op_bscard.<2E><><EFBFBD>۲<EFBFBD><DBB2><EFBFBD>='+''''+RxDBLookupCombo12.DisplayValue+'''');
|
|
|
|
|
if RxDBLookupCombo15.DisplayValue<>''then
|
|
|
|
|
add(' and V_op_bscard.<2E>ֲ<EFBFBD><D6B2><EFBFBD><EFBFBD><EFBFBD>='+''''+RxDBLookupCombo15.DisplayValue+'''');
|
|
|
|
|
|
|
|
|
|
add(' and '+open_data('0021','v_op_bscard.<2E><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>','no','no','no','no'));
|
|
|
|
|
|
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
open ;
|
|
|
|
|
memTblCustDetail.LoadFromDataSet(tv_bscard_all,[]);
|
|
|
|
|
if bsSkinCheckRadioBox3.Checked then begin
|
|
|
|
|
with memTblCustDetail do begin
|
|
|
|
|
First;
|
|
|
|
|
while not eof do begin
|
|
|
|
|
if Fieldbyname('<27>ϼ<EFBFBD>Ӧ<EFBFBD><D3A6>').Asfloat<>0 then begin
|
|
|
|
|
edit;
|
|
|
|
|
fieldbyname('<27><><EFBFBD><EFBFBD>Ϣ').AsFloat:=getlx(fieldbyname('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').AsDateTime,fieldbyname('<27><><EFBFBD><EFBFBD>').asstring,fieldbyname('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').asstring);
|
|
|
|
|
post;
|
|
|
|
|
end;
|
|
|
|
|
Next;
|
|
|
|
|
end;
|
|
|
|
|
end;
|
|
|
|
|
end;
|
|
|
|
|
end ;
|
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
procedure Tfrm_rp_sales_profitLcx.bsSkinButton6Click(Sender: TObject);
|
|
|
|
|
begin
|
|
|
|
|
wwDBDateTimePicker1.Clear;
|
|
|
|
|
wwDBDateTimePicker2.Clear;
|
|
|
|
|
wwDBDateTimePicker3.Clear;
|
|
|
|
|
wwDBDateTimePicker4.Clear;
|
|
|
|
|
RxDBLookupCombo6.ClearValue;
|
|
|
|
|
RxDBLookupCombo1.ClearValue;
|
|
|
|
|
RxDBLookupCombo2.ClearValue;
|
|
|
|
|
cmbbYwlb.ItemIndex:=-1 ;
|
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
procedure Tfrm_rp_sales_profitLcx.FormClose(Sender: TObject;
|
|
|
|
|
var Action: TCloseAction);
|
|
|
|
|
begin
|
|
|
|
|
savereggrid(dxdbgrid1,caption);
|
|
|
|
|
frm_rp_sales_profitLcx.Hide;
|
|
|
|
|
frm_rp_sales_profitLcx.ManualFloat(frm_rp_sales_profitLcx.BoundsRect );
|
|
|
|
|
frm_main.freeTabs('frm_rp_sales_profitLcx');
|
|
|
|
|
action:=cafree;
|
|
|
|
|
frm_rp_sales_profitLcx:=nil;
|
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
procedure Tfrm_rp_sales_profitLcx.N10Click(Sender: TObject);
|
|
|
|
|
begin
|
|
|
|
|
update_grid_view_no(dxdbgrid1);
|
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
procedure Tfrm_rp_sales_profitLcx.N14Click(Sender: TObject);
|
|
|
|
|
begin
|
|
|
|
|
update_grid_view_all(dxdbgrid1);
|
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
procedure Tfrm_rp_sales_profitLcx.N12Click(Sender: TObject);
|
|
|
|
|
begin
|
|
|
|
|
update_grid(dxdbgrid1,111);
|
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
procedure Tfrm_rp_sales_profitLcx.N16Click(Sender: TObject);
|
|
|
|
|
begin
|
|
|
|
|
grid_save_xls(dxdbgrid1);
|
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
procedure Tfrm_rp_sales_profitLcx.bsSkinButton9Click(Sender: TObject);
|
|
|
|
|
begin
|
|
|
|
|
sys_print('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ͳ<EFBFBD><CDB3>',2,nil,nil,nil,nil,dsrTblCustDetal,nil,nil,nil,nil,nil,nil);
|
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
procedure Tfrm_rp_sales_profitLcx.FormShow(Sender: TObject);
|
|
|
|
|
begin
|
|
|
|
|
loadreggrid(dxdbgrid1,true,caption);
|
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
procedure Tfrm_rp_sales_profitLcx.bsSkinButton1Click(Sender: TObject);
|
|
|
|
|
begin
|
|
|
|
|
try
|
|
|
|
|
frm_rp_totaljs_query:=tfrm_rp_totaljs_query.Create (self);
|
|
|
|
|
rp_totaljs_query_limited:='0021';
|
|
|
|
|
rp_totaljs_query_str:='ҵ<><D2B5>Ա<EFBFBD><D4B1><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>';
|
|
|
|
|
frm_rp_totaljs_query.ShowModal;
|
|
|
|
|
finally
|
|
|
|
|
FreeAndNil(frm_rp_totaljs_query);
|
|
|
|
|
end;
|
|
|
|
|
if tv_bscard_all.Recordset.RecordCount<>0 then begin
|
|
|
|
|
memTblCustDetail.LoadFromDataSet(tv_bscard_all,[]);
|
|
|
|
|
if bsSkinCheckRadioBox3.Checked then begin
|
|
|
|
|
with memTblCustDetail do begin
|
|
|
|
|
First;
|
|
|
|
|
while not eof do begin
|
|
|
|
|
if Fieldbyname('<27>ϼ<EFBFBD>Ӧ<EFBFBD><D3A6>').Asfloat<>0 then begin
|
|
|
|
|
edit;
|
|
|
|
|
fieldbyname('<27><><EFBFBD><EFBFBD>Ϣ').AsFloat:=getlx(fieldbyname('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').AsDateTime,fieldbyname('<27><><EFBFBD><EFBFBD>').asstring,fieldbyname('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').asstring);
|
|
|
|
|
post;
|
|
|
|
|
end;
|
|
|
|
|
Next;
|
|
|
|
|
end;
|
|
|
|
|
end;
|
|
|
|
|
end;
|
|
|
|
|
end;
|
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
procedure Tfrm_rp_sales_profitLcx.dxDBGrid1DblClick(Sender: TObject);
|
|
|
|
|
begin
|
|
|
|
|
fee_view(memTblCustDetail.fieldbyname('<27><><EFBFBD><EFBFBD>').asstring);
|
|
|
|
|
|
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
procedure Tfrm_rp_sales_profitLcx.bsSkinButton2Click(Sender: TObject);
|
|
|
|
|
var i:integer;
|
|
|
|
|
begin
|
|
|
|
|
if not if_open('405') then
|
|
|
|
|
begin
|
|
|
|
|
showmessage('<27><>û<EFBFBD>д<EFBFBD>ģ<EFBFBD><C4A3><EFBFBD>IJ<EFBFBD><C4B2><EFBFBD>Ȩ<EFBFBD>ޣ<EFBFBD>,<2C><><EFBFBD><EFBFBD>ϵϵͳ<CFB5><CDB3><EFBFBD><EFBFBD>Ա,Ȩ<><C8A8><EFBFBD><EFBFBD><EFBFBD><EFBFBD>·<EFBFBD><C2B7>:<3A><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>---><3E><><EFBFBD>۹<EFBFBD><DBB9><EFBFBD>---><3E><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>');
|
|
|
|
|
exit;
|
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if dxDBGrid1.SelectedCount>=1 then
|
|
|
|
|
begin
|
|
|
|
|
for i:=0 to dxDBGrid1.SelectedCount-1 do
|
|
|
|
|
begin
|
|
|
|
|
memTblCustDetail.GotoBookmark(pointer(dxDBGrid1.selectedrows[i]));
|
|
|
|
|
UpdateBsProfit(memTblCustDetail.fieldbyname('ҵ<><D2B5><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').asstring,memTblCustDetail.fieldbyname('<27><><EFBFBD><EFBFBD>').asstring,1);
|
|
|
|
|
memTblCustDetail.Edit;
|
|
|
|
|
memTblCustDetail.fieldbyname('FEE2').AsString:='1';
|
|
|
|
|
memTblCustDetail.Post;
|
|
|
|
|
end;
|
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
procedure Tfrm_rp_sales_profitLcx.bsSkinButton3Click(Sender: TObject);
|
|
|
|
|
var i:integer;
|
|
|
|
|
begin
|
|
|
|
|
if not if_open('406') then
|
|
|
|
|
begin
|
|
|
|
|
showmessage('<27><>û<EFBFBD>д<EFBFBD>ģ<EFBFBD><C4A3><EFBFBD>IJ<EFBFBD><C4B2><EFBFBD>Ȩ<EFBFBD>ޣ<EFBFBD>,<2C><><EFBFBD><EFBFBD>ϵϵͳ<CFB5><CDB3><EFBFBD><EFBFBD>Ա,Ȩ<><C8A8><EFBFBD><EFBFBD><EFBFBD><EFBFBD>·<EFBFBD><C2B7><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>---><3E><><EFBFBD>۹<EFBFBD><DBB9><EFBFBD>--->ȡ<><C8A1><EFBFBD><EFBFBD><EFBFBD><EFBFBD>');
|
|
|
|
|
exit;
|
|
|
|
|
end;
|
|
|
|
|
if dxDBGrid1.SelectedCount>=1 then
|
|
|
|
|
begin
|
|
|
|
|
for i:=0 to dxDBGrid1.SelectedCount-1 do
|
|
|
|
|
begin
|
|
|
|
|
memTblCustDetail.GotoBookmark(pointer(dxDBGrid1.selectedrows[i]));
|
|
|
|
|
UpdateBsProfit(memTblCustDetail.fieldbyname('ҵ<><D2B5><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').asstring,memTblCustDetail.fieldbyname('<27><><EFBFBD><EFBFBD>').asstring,0);
|
|
|
|
|
memTblCustDetail.Edit;
|
|
|
|
|
memTblCustDetail.fieldbyname('FEE2').AsString:='0';
|
|
|
|
|
memTblCustDetail.Post;
|
|
|
|
|
|
|
|
|
|
end;
|
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
procedure Tfrm_rp_sales_profitLcx.dxDBGrid1CustomDraw(Sender: TObject;
|
|
|
|
|
ACanvas: TCanvas; ARect: TRect; ANode: TdxTreeListNode;
|
|
|
|
|
AColumn: TdxDBTreeListColumn; const AText: String; AFont: TFont;
|
|
|
|
|
var AColor: TColor; ASelected, AFocused: Boolean; var ADone: Boolean);
|
|
|
|
|
begin
|
|
|
|
|
if uppercase(ANode.Strings[dxDBGrid1Column50.Index])='1' then begin
|
|
|
|
|
AColor:=clRed;
|
|
|
|
|
exit;
|
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
end.
|