You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

477 lines
18 KiB
Plaintext

This file contains ambiguous Unicode characters!

This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.

unit u_rp_kou_histry;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, bsSkinCtrls, ExtCtrls, ComCtrls, bsSkinTabs, DB, ADODB,DateUtils,
dxExEdtr, dxDBTLCl, dxGrClms, dxDBGrid, dxTL, dxDBCtrl, dxCntner,
kbmMemTable, kbmMemBinaryStreamFormat, Menus, StdCtrls,
wwdbdatetimepicker, Grids, DBGridEh, Mask, wwdbedit, Wwdotdot, Wwdbcomb,teeprevi,
RxLookup, TeEngine, Series, TeeProcs, Chart, DbChart, DBGrids;
type
Tfrm_rp_kou_histry = class(TForm)
Panel1: TPanel;
bsSkinPanel2: TbsSkinPanel;
bsSkinButton10: TbsSkinButton;
bsSkinButton9: TbsSkinButton;
bsSkinButton1: TbsSkinButton;
bsSkinButton5: TbsSkinButton;
SaveDialog: TSaveDialog;
kbmBinaryStreamFormat1: TkbmBinaryStreamFormat;
kbmThreadDataSet1: TkbmThreadDataSet;
PopupMenu1: TPopupMenu;
N1101: TMenuItem;
memtblDetail: TkbmMemTable;
p_total1: TDataSource;
bsSkinPanel1: TbsSkinPanel;
Label13: TLabel;
RxDBLookupCombo5: TRxDBLookupCombo;
Label14: TLabel;
wwDBComboBox14: TwwDBComboBox;
RxDBLookupCombo3: TRxDBLookupCombo;
bsSkinPageControl1: TbsSkinPageControl;
bsSkinTabSheet1: TbsSkinTabSheet;
bsSkinTabSheet2: TbsSkinTabSheet;
DBChart3: TDBChart;
Series1: TLineSeries;
memtotal1: TDataSource;
memtotal: TkbmMemTable;
memtotalField: TStringField;
memtotalField2: TFloatField;
kbmMemTable2: TkbmMemTable;
kbmMemTable2Field10: TStringField;
kbmMemTable2Field: TStringField;
kbmMemTable2Field2: TStringField;
kbmMemTable2Field3: TStringField;
kbmMemTable2Field4: TDateField;
kbmMemTable2Field5: TStringField;
kbmMemTable2USD: TFloatField;
kbmMemTable2RMB: TFloatField;
kbmMemTable2Field6: TFloatField;
kbmMemTable2USD2: TFloatField;
kbmMemTable2RMB2: TFloatField;
kbmMemTable2Field7: TFloatField;
kbmMemTable2USD3: TFloatField;
kbmMemTable2RMB3: TFloatField;
kbmMemTable2Field8: TFloatField;
kbmMemTable2Field9: TFloatField;
DataSource3: TDataSource;
dxDBGrid1: TdxDBGrid;
dxDBGridMaskColumn39: TdxDBGridMaskColumn;
dxDBGridMaskColumn42: TdxDBGridMaskColumn;
dxDBGridMaskColumn47: TdxDBGridMaskColumn;
dxDBGridDateColumn7: TdxDBGridDateColumn;
dxDBGridMaskColumn75: TdxDBGridMaskColumn;
dxDBGrid1Column57: TdxDBGridColumn;
dxDBGrid1Column7: TdxDBGridColumn;
dxDBGrid1Column8: TdxDBGridColumn;
dxDBGrid1Column9: TdxDBGridColumn;
dxDBGrid1Column10: TdxDBGridColumn;
dxDBGrid1Column11: TdxDBGridColumn;
dxDBGrid1Column12: TdxDBGridColumn;
dxDBGrid1Column13: TdxDBGridColumn;
dxDBGrid1Column14: TdxDBGridColumn;
dxDBGrid1Column15: TdxDBGridColumn;
kbmMemTable2Field11: TStringField;
dxDBGrid1Column16: TdxDBGridColumn;
Label3: TLabel;
Label4: TLabel;
wwDBDateTimePicker1: TwwDBDateTimePicker;
wwDBDateTimePicker2: TwwDBDateTimePicker;
kbmMemTable2USD4: TFloatField;
kbmMemTable2RMB4: TFloatField;
kbmMemTable2Field12: TFloatField;
dxDBGrid1Column17: TdxDBGridColumn;
dxDBGrid1Column18: TdxDBGridColumn;
dxDBGrid1Column19: TdxDBGridColumn;
t_salepriftset: TADOQuery;
procedure bsSkinButton5Click(Sender: TObject);
procedure FormClose(Sender: TObject; var Action: TCloseAction);
procedure Panel1Resize(Sender: TObject);
procedure bsSkinButton10Click(Sender: TObject);
procedure bsSkinButton1Click(Sender: TObject);
procedure bsSkinButton9Click(Sender: TObject);
private
procedure do_1(str_bill:widestring);
procedure GetNoFee;
procedure Creatememtbl;
function GetZhangQi(SaleID,Cust:String):String;
function isChaoQi(SaleID,Cust:String):Boolean;
function GetZhangQiNum(SaleID,Cust:String;aetd:TDateTime):Double;
function GetZhangQiStr(SaleID,Cust:String):String;
{ Private declarations }
public
{ Public declarations }
end;
var
frm_rp_kou_histry: Tfrm_rp_kou_histry;
FmDate,ToDate:String;
sqlstr:WideString;
implementation
uses u_main, u_rp_no_seae_query,my_sys_function, u_rp_total_query,
u_sys_progress;
{$R *.dfm}
function Tfrm_rp_kou_histry.GetZhangQi(SaleID,Cust:String):String;
var
aQuery:TADOQuery;
S:String;
begin
if (FmDate='') then begin
FmDate:='2006-01-01';
end;
aQuery:=CreateAdoQuery;
try
with aQuery do begin
Close;SQL.Clear;
// SQL.Add('Select * from t_crm_client_sales where ״̬=''<27><><EFBFBD><EFBFBD>'' and <20><>ʼ<EFBFBD><CABC><EFBFBD><EFBFBD><='''+FmDate+''' and <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>>='''+ToDate+''' and <20>ͻ<EFBFBD><CDBB><EFBFBD><EFBFBD><EFBFBD>='''+Cust+''' and <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>='''+SaleID+'''');
SQL.Add('Select * from t_crm_client_sales where ״̬=''<27><><EFBFBD><EFBFBD>'' and <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>>'''+FmDate+''' and <20>ͻ<EFBFBD><CDBB><EFBFBD><EFBFBD><EFBFBD>='''+Cust+''' and <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>='''+SaleID+'''');
Open;
if not IsEmpty then begin
first;
S:='';
while not eof do begin
S:=S+'<27><>ʼ<EFBFBD><CABC><EFBFBD><EFBFBD>:'+FormatDateTime('YYYY-MM-DD',FieldByName('<27><>ʼ<EFBFBD><CABC><EFBFBD><EFBFBD>').AsDateTime)+',<2C><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>'+FormatDateTime('YYYY-MM-DD',FieldByName('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').AsDateTime);
if FieldByName('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').AsString='<27>ֽ<EFBFBD><D6BD><EFBFBD><EFBFBD><EFBFBD>' then begin
S:=S+'<27><><EFBFBD>½<EFBFBD><C2BD><EFBFBD>;';
end else if FieldByName('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').AsString='Լ<><D4BC><EFBFBD><EFBFBD><EFBFBD><EFBFBD>' then begin
S:=S+'Լ<><D4BC><EFBFBD><EFBFBD><EFBFBD><EFBFBD>,'+fieldByName('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').AsString+'<27><>;';
end else if FieldByName('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').AsString='Լ<><D4BC>ʱ<EFBFBD><CAB1>' then begin
S:=S+'Լ<><D4BC>ʱ<EFBFBD><CAB1>,'+FieldByName('<27><><EFBFBD><EFBFBD>ģʽ').AsString+'<27><>;'+FieldByName('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').AsString+'<27>ս<EFBFBD><D5BD><EFBFBD>';
end else if FieldByName('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').AsString='<27>ֽ׶θ<D7B6><CEB8><EFBFBD>' then begin
S:=S+'<27>ֽ׶θ<D7B6><CEB8><EFBFBD>;';
end;
Next;
end;
result:=S;
end else begin
Result:='<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>';
end;
end;
finally
FreeAndNil(aQuery);
end;
end;
procedure Tfrm_rp_kou_histry.do_1(str_bill:widestring);
begin
end;
procedure Tfrm_rp_kou_histry.bsSkinButton5Click(Sender: TObject);
begin
close;
end;
procedure Tfrm_rp_kou_histry.FormClose(Sender: TObject;
var Action: TCloseAction);
begin
frm_rp_kou_histry.Hide;
frm_rp_kou_histry.ManualFloat(frm_rp_kou_histry.BoundsRect );
frm_main.freeTabs('frm_rp_kou_histry');
action:=cafree;
frm_rp_kou_histry:=nil;
end;
procedure Tfrm_rp_kou_histry.Panel1Resize(Sender: TObject);
var
i:integer;
begin
i:=round(bsSkinPanel2.Width/7);
bsSkinButton10.Width:=i;
bsSkinButton9.Width:=i;
bsSkinButton1.Width:=i;
end;
procedure Tfrm_rp_kou_histry.bsSkinButton10Click(Sender: TObject);
begin
if wwDBDateTimePicker1.Text='' then begin
MessageDlg('<27><>ʼ<EFBFBD><CABC><EFBFBD>ڲ<EFBFBD><DAB2><EFBFBD>Ϊ<EFBFBD><CEAA>!',mtWarning,[mbOk],0);
exit;
end;
if wwDBDateTimePicker2.Text='' then begin
MessageDlg('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ڲ<EFBFBD><DAB2><EFBFBD>Ϊ<EFBFBD><CEAA>!',mtWarning,[mbOk],0);
exit;
end;
if wwDBDateTimePicker1.Date>wwDBDateTimePicker2.date then begin
MessageDlg('<27><>ʼ<EFBFBD><CABC><EFBFBD>ڲ<EFBFBD><DAB2>ܴ<EFBFBD><DCB4>ڽ<EFBFBD><DABD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>!',mtWarning,[mbOk],0);
exit;
end;
kbmMemTable2.EmptyTable;
if not kbmMemTable2.Active then
kbmMemTable2.open;
GetNoFee;
end;
procedure Tfrm_rp_kou_histry.bsSkinButton1Click(Sender: TObject);
begin
with SaveDialog do
begin
DefaultExt :='xls';
Filter := '(*.xls)|*.xls';
if Execute then
begin
dxDBGrid1.SaveToXLS(FileName,true)
end;
end;
end;
procedure Tfrm_rp_kou_histry.bsSkinButton9Click(Sender: TObject);
begin
sys_print('ҵ<><D2B5><EFBFBD>ۺ<EFBFBD>Ƿ<EFBFBD><C7B7>',2,nil,nil,nil,nil,p_total1,nil,nil,nil,nil,nil,nil);
end;
procedure Tfrm_rp_kou_histry.GetNoFee;
var
aQuery:TAdoQuery;
aDate,aToDate,yDate:TDate;
strdate,stredate,sDate,str:String;
nostr,nostr2:WideString;
i:integer;
function GetHistryno(nodate:Tdate;bsno:String):double;
var
aQuery2:TADOQuery;
begin
aQuery2:=CreateAdoQuery;
try
with aQuery2 do begin
Close;SQL.Clear;
SQL.Add('select sum(CASE <20><><EFBFBD><EFBFBD> when ''<27><>'' then ԭʼ<D4AD><CABC><EFBFBD><EFBFBD>*<2A><><EFBFBD><EFBFBD> else 0 end) as δ<>պϼ<D5BA> ');
SQL.Add(' from v_fee_do_detail where <20><><EFBFBD><EFBFBD>='''+bsno+''' and <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><'''+DateToStr(nodate)+'''');
SQL.Add(' Group by <20><><EFBFBD><EFBFBD>');
OPEN;
if IsEmpty then
result:=0.00
else
Result:=fieldbyName('δ<>պϼ<D5BA>').AsFloat;
end;
finally
FreeAndNil(aQuery2);
end;
end;
function GetHistryUSDno(nodate:Tdate;bsno:String):double;
var
aQuery2:TADOQuery;
begin
aQuery2:=CreateAdoQuery;
try
with aQuery2 do begin
Close;SQL.Clear;
SQL.Add('select sum(CASE <20><><EFBFBD><EFBFBD> when ''<27><>'' then ԭʼ<D4AD><CABC><EFBFBD><EFBFBD> else 0 end) as δ<>պϼ<D5BA> ');
SQL.Add(' from v_fee_do_detail where ԭʼ<D4AD>ұ<EFBFBD>=''USD'' and <20><><EFBFBD><EFBFBD>='''+bsno+''' and <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><'''+DateToStr(nodate)+'''');
SQL.Add(' Group by <20><><EFBFBD><EFBFBD>');
OPEN;
if IsEmpty then
result:=0.00
else
Result:=fieldbyName('δ<>պϼ<D5BA>').AsFloat;
end;
finally
FreeAndNil(aQuery2);
end;
end;
function GetHistryRMBno(nodate:Tdate;bsno:String):double;
var
aQuery2:TADOQuery;
begin
aQuery2:=CreateAdoQuery;
try
with aQuery2 do begin
Close;SQL.Clear;
SQL.Add('select sum(CASE <20><><EFBFBD><EFBFBD> when ''<27><>'' then ԭʼ<D4AD><CABC><EFBFBD><EFBFBD>*<2A><><EFBFBD><EFBFBD> else 0 end) as δ<>պϼ<D5BA> ');
SQL.Add(' from v_fee_do_detail where ԭʼ<D4AD>ұ<EFBFBD><>''USD'' and <20><><EFBFBD><EFBFBD>='''+bsno+''' and <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><'''+DateToStr(nodate)+'''');
SQL.Add(' Group by <20><><EFBFBD><EFBFBD>');
OPEN;
if IsEmpty then
result:=0.00
else
Result:=fieldbyName('δ<>պϼ<D5BA>').AsFloat;
end;
finally
FreeAndNil(aQuery2);
end;
end;
// S:TChartSeries;
begin
t_salepriftset.Close;
t_salepriftset.SQL.Clear;
t_salepriftset.SQL.Add('select t_sys_employee.<2E><><EFBFBD><EFBFBD>,t_sys_employee.<2E><><EFBFBD>ɷ<EFBFBD><C9B7><EFBFBD>,t_crm_salesproftt.* from t_sys_employee ');
t_salepriftset.SQL.Add('left join t_crm_salesproftt on t_crm_salesproftt.<2E><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>=t_sys_employee.<2E><><EFBFBD>ɷ<EFBFBD><C9B7><EFBFBD> ');
t_salepriftset.SQL.Add('where t_sys_employee.<2E><><EFBFBD>ɷ<EFBFBD><C9B7><EFBFBD><>'''' and t_crm_salesproftt.<2E><><EFBFBD>ʼ<EFBFBD><CABC><EFBFBD><EFBFBD>·<EFBFBD><>0 ');
t_salepriftset.Open;
if t_salepriftset.IsEmpty then exit;
aQuery:=CreateAdoQuery;
try
with aQuery do begin
aDate:=wwDBDateTimePicker1.Date;
aToDate:=wwDBDateTimePicker2.Date;
if not ASSIGNED(frm_sys_progress) then
frm_sys_progress:=tfrm_sys_progress.Create(application);
frm_sys_progress.Show;
frm_sys_progress.bsSkinGauge1.MaxValue:=12;
frm_sys_progress.bsSkinGauge1.MinValue:=0;
frm_sys_progress.bsSkinGauge1.Value:=0;
frm_sys_progress.Update;
while not (aDate>aToDate) do begin
strdate:=FormatDateTime('YYYY-MM-DD',EncodeDate(strtoint(FormatDateTime('YYYY',incmonth(aDate,-11))),strtoint(FormatDateTime('MM',incmonth(aDate,-11))),MonthDays[isLeapYear(strtoint(FormatDateTime('YYYY',incmonth(aDate,-11)))),strtoint(FormatDateTime('MM',incmonth(aDate,-11)))]));
stredate:=FormatDateTime('YYYY-MM-DD',incmonth(aDate,-9));
sDate:=FormatDateTime('YYYYMM',aDate);
ydate:=EncodeDate(strtoint(FormatDateTime('YYYY',aDate)),strtoint(FormatDateTime('MM',aDate)),MonthDays[isLeapYear(strtoint(FormatDateTime('YYYY',aDate))),strtoint(FormatDateTime('MM',aDate))]);
nostr:='';
t_salepriftset.First;
while not t_salepriftset.eof do begin
str:='(<28><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>='+''''+t_salepriftset.fieldbyname('<27><><EFBFBD><EFBFBD>').AsString+''''+' and '+'<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><'+''''+FormatDateTime('YYYY-MM-DD',incmonth(aDate,-(t_salepriftset.fieldbyname('<27><><EFBFBD>ʼ<EFBFBD><CABC><EFBFBD><EFBFBD>·<EFBFBD>').Asinteger-2)))+''''
+' and <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>>'+''''+FormatDateTime('YYYY-MM-DD',EncodeDate(strtoint(FormatDateTime('YYYY',incmonth(aDate,-t_salepriftset.fieldbyname('<27><><EFBFBD>ʼ<EFBFBD><CABC><EFBFBD><EFBFBD>·<EFBFBD>').Asinteger))),strtoint(FormatDateTime('MM',incmonth(aDate,-t_salepriftset.fieldbyname('<27><><EFBFBD>ʼ<EFBFBD><CABC><EFBFBD><EFBFBD>·<EFBFBD>').Asinteger))),MonthDays[isLeapYear(strtoint(FormatDateTime('YYYY',incmonth(aDate,-t_salepriftset.fieldbyname('<27><><EFBFBD>ʼ<EFBFBD><CABC><EFBFBD><EFBFBD>·<EFBFBD>').Asinteger)))),strtoint(FormatDateTime('MM',incmonth(aDate,-t_salepriftset.fieldbyname('<27><><EFBFBD>ʼ<EFBFBD><CABC><EFBFBD><EFBFBD>·<EFBFBD>').Asinteger)))]))+''''+')';
if nostr='' then
nostr:='('+str
else
nostr:=nostr+' or '+str;
t_salepriftset.Next;
end;
nostr:=nostr+')';
CLOSE;
SQL.Clear;
SQL.Add('select *,<2C>ϼ<EFBFBD>Ӧ<EFBFBD><D3A6>-<2D>ϼ<EFBFBD><CFBC><EFBFBD><EFBFBD><EFBFBD> as <20>۳<EFBFBD><DBB3><EFBFBD><EFBFBD><EFBFBD> from v_op_bscard where <20>ϼ<EFBFBD><CFBC><EFBFBD><EFBFBD><EFBFBD><><3E>ϼ<EFBFBD>Ӧ<EFBFBD><D3A6> and ί<>е<EFBFBD>λ not in (select <20>ͻ<EFBFBD><CDBB><EFBFBD><EFBFBD><EFBFBD> from t_crm_client_sales where <20>Ƿ<EFBFBD><C7B7><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ͻ<EFBFBD>=1) and ');
// SQL.Add('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><'''+stredate+''' and <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>>'''+strdate+'''');
SQL.Add(nostr);
if RxDBLookupCombo5.DisplayValues[1]<>'' then
SQL.Add(' and ί<>е<EFBFBD>λ='''+RxDBLookupCombo5.DisplayValues[1]+'''');
if RxDBLookupCombo3.DisplayValues[0]<>'' then begin
if wwDBComboBox14.Text='<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>' then
SQL.Add(' and <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><>'''+RxDBLookupCombo3.DisplayValues[0]+'''')
else
SQL.Add(' and <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>='''+RxDBLookupCombo3.DisplayValues[0]+'''');
end;
SQL.Add('order by <20><><EFBFBD><EFBFBD> ');
Open;
if not IsEmpty then begin
first;
while not eof do begin
kbmMemTable2.Append;
kbmMemTable2.FieldByName('<27><><EFBFBD><EFBFBD>').asstring:=FieldByName('<27><><EFBFBD><EFBFBD>').asstring;
kbmMemTable2.FieldByName('ҵ<><D2B5><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').asstring:=FieldByName('ҵ<><D2B5><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').asstring;
kbmMemTable2.FieldByName('<27><><EFBFBD><EFBFBD><E1B5A5>').asstring:=FieldByName('<27><><EFBFBD><EFBFBD><E1B5A5>').asstring;
kbmMemTable2.FieldByName('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').asstring:=FieldByName('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').asstring;
kbmMemTable2.FieldByName('ί<>е<EFBFBD>λ').asstring:=FieldByName('ί<>е<EFBFBD>λ').asstring;
kbmMemTable2.FieldByName('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').value:=FieldByName('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').value;
kbmMemTable2.FieldByName('Ӧ<><D3A6>USD').AsFloat:=FieldByName('Ӧ<><D3A6>USD').AsFloat;
kbmMemTable2.FieldByName('Ӧ<><D3A6>RMB').AsFloat:=FieldByName('Ӧ<><D3A6>RMB').AsFloat;
kbmMemTable2.FieldByName('<27>ϼ<EFBFBD>Ӧ<EFBFBD><D3A6>').AsFloat:=FieldByName('<27>ϼ<EFBFBD>Ӧ<EFBFBD><D3A6>').AsFloat;
kbmMemTable2.FieldByName('<27><><EFBFBD><EFBFBD>USD').AsFloat:=GetHistryusdno(ydate+1,FieldByName('<27><><EFBFBD><EFBFBD>').asstring);
kbmMemTable2.FieldByName('<27><><EFBFBD><EFBFBD>RMB').AsFloat:=GetHistryRMBno(ydate+1,FieldByName('<27><><EFBFBD><EFBFBD>').asstring);
kbmMemTable2.FieldByName('<27>ϼ<EFBFBD><CFBC><EFBFBD><EFBFBD><EFBFBD>').AsFloat:=GetHistryno(ydate+1,FieldByName('<27><><EFBFBD><EFBFBD>').asstring);
kbmMemTable2.FieldByName('δ<><CEB4>USD').AsFloat:=kbmMemTable2.FieldByName('Ӧ<><D3A6>USD').AsFloat-kbmMemTable2.FieldByName('<27><><EFBFBD><EFBFBD>USD').AsFloat;
kbmMemTable2.FieldByName('δ<><CEB4>RMB').AsFloat:=kbmMemTable2.FieldByName('Ӧ<><D3A6>RMB').AsFloat-kbmMemTable2.FieldByName('<27><><EFBFBD><EFBFBD>RMB').AsFloat;
kbmMemTable2.FieldByName('<27>ϼ<EFBFBD>δ<EFBFBD><CEB4>').AsFloat:=kbmMemTable2.FieldByName('<27>ϼ<EFBFBD>Ӧ<EFBFBD><D3A6>').AsFloat-kbmMemTable2.FieldByName('<27>ϼ<EFBFBD><CFBC><EFBFBD><EFBFBD><EFBFBD>').AsFloat;
kbmMemTable2.FieldByName('<27><><EFBFBD><EFBFBD>USD').AsFloat:=FieldByName('<27><><EFBFBD><EFBFBD>USD').AsFloat;
kbmMemTable2.FieldByName('<27><><EFBFBD><EFBFBD>RMB').AsFloat:=FieldByName('<27><><EFBFBD><EFBFBD>RMB').AsFloat;
kbmMemTable2.FieldByName('ë<><C3AB><EFBFBD><EFBFBD>').AsFloat:=FieldByName('ë<><C3AB><EFBFBD><EFBFBD>').AsFloat;
kbmMemTable2.FieldByName('<27>۳<EFBFBD><DBB3><EFBFBD><EFBFBD><EFBFBD>').AsFloat:=kbmMemTable2.FieldByName('<27>ϼ<EFBFBD>δ<EFBFBD><CEB4>').AsFloat;
kbmMemTable2.post;
Next;
end;
end;
CLOSE;
SQL.Clear;
SQL.Add('select * from v_op_bscard_MAX where <20>ϼ<EFBFBD>Ӧ<EFBFBD><D3A6>=<3D>ϼ<EFBFBD><CFBC><EFBFBD><EFBFBD><EFBFBD> and ί<>е<EFBFBD>λ not in (select <20>ͻ<EFBFBD><CDBB><EFBFBD><EFBFBD><EFBFBD> from t_crm_client_sales where <20>Ƿ<EFBFBD><C7B7><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ͻ<EFBFBD>=1) and ');
// SQL.Add('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><'''+stredate+''' and <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>>'''+strdate+''' and <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>>'''+datetostr(ydate)+'''');
SQL.Add(nostr);
SQL.Add(' and <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>>'''+datetostr(ydate)+'''');
if RxDBLookupCombo5.DisplayValues[1]<>'' then
SQL.Add(' and ί<>е<EFBFBD>λ='''+RxDBLookupCombo5.DisplayValues[1]+'''');
if RxDBLookupCombo3.DisplayValues[0]<>'' then begin
if wwDBComboBox14.Text='<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>' then
SQL.Add(' and <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><>'''+RxDBLookupCombo3.DisplayValues[0]+'''')
else
SQL.Add(' and <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>='''+RxDBLookupCombo3.DisplayValues[0]+'''');
end;
SQL.Add(' order by <20><><EFBFBD><EFBFBD> ');
Open;
if not IsEmpty then begin
first;
while not eof do begin
kbmMemTable2.Append;
kbmMemTable2.FieldByName('<27><><EFBFBD><EFBFBD>').asstring:=FieldByName('<27><><EFBFBD><EFBFBD>').asstring;
kbmMemTable2.FieldByName('ҵ<><D2B5><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').asstring:=FieldByName('ҵ<><D2B5><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').asstring;
kbmMemTable2.FieldByName('<27><><EFBFBD><EFBFBD><E1B5A5>').asstring:=FieldByName('<27><><EFBFBD><EFBFBD><E1B5A5>').asstring;
kbmMemTable2.FieldByName('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').asstring:=FieldByName('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').asstring;
kbmMemTable2.FieldByName('ί<>е<EFBFBD>λ').asstring:=FieldByName('ί<>е<EFBFBD>λ').asstring;
kbmMemTable2.FieldByName('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').value:=FieldByName('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').value;
kbmMemTable2.FieldByName('Ӧ<><D3A6>USD').AsFloat:=FieldByName('Ӧ<><D3A6>USD').AsFloat;
kbmMemTable2.FieldByName('Ӧ<><D3A6>RMB').AsFloat:=FieldByName('Ӧ<><D3A6>RMB').AsFloat;
kbmMemTable2.FieldByName('<27>ϼ<EFBFBD>Ӧ<EFBFBD><D3A6>').AsFloat:=FieldByName('<27>ϼ<EFBFBD>Ӧ<EFBFBD><D3A6>').AsFloat;
kbmMemTable2.FieldByName('<27><><EFBFBD><EFBFBD>USD').AsFloat:=GetHistryusdno(ydate+1,FieldByName('<27><><EFBFBD><EFBFBD>').asstring);
kbmMemTable2.FieldByName('<27><><EFBFBD><EFBFBD>RMB').AsFloat:=GetHistryRMBno(ydate+1,FieldByName('<27><><EFBFBD><EFBFBD>').asstring);
kbmMemTable2.FieldByName('<27>ϼ<EFBFBD><CFBC><EFBFBD><EFBFBD><EFBFBD>').AsFloat:=GetHistryno(ydate+1,FieldByName('<27><><EFBFBD><EFBFBD>').asstring);
kbmMemTable2.FieldByName('δ<><CEB4>USD').AsFloat:=kbmMemTable2.FieldByName('Ӧ<><D3A6>USD').AsFloat-kbmMemTable2.FieldByName('<27><><EFBFBD><EFBFBD>USD').AsFloat;
kbmMemTable2.FieldByName('δ<><CEB4>RMB').AsFloat:=kbmMemTable2.FieldByName('Ӧ<><D3A6>RMB').AsFloat-kbmMemTable2.FieldByName('<27><><EFBFBD><EFBFBD>RMB').AsFloat;
kbmMemTable2.FieldByName('<27>ϼ<EFBFBD>δ<EFBFBD><CEB4>').AsFloat:=kbmMemTable2.FieldByName('<27>ϼ<EFBFBD>Ӧ<EFBFBD><D3A6>').AsFloat-kbmMemTable2.FieldByName('<27>ϼ<EFBFBD><CFBC><EFBFBD><EFBFBD><EFBFBD>').AsFloat;
kbmMemTable2.FieldByName('<27><><EFBFBD><EFBFBD>USD').AsFloat:=FieldByName('<27><><EFBFBD><EFBFBD>USD').AsFloat;
kbmMemTable2.FieldByName('<27><><EFBFBD><EFBFBD>RMB').AsFloat:=FieldByName('<27><><EFBFBD><EFBFBD>RMB').AsFloat;
kbmMemTable2.FieldByName('ë<><C3AB><EFBFBD><EFBFBD>').AsFloat:=FieldByName('ë<><C3AB><EFBFBD><EFBFBD>').AsFloat;
kbmMemTable2.FieldByName('<27>۳<EFBFBD><DBB3><EFBFBD><EFBFBD><EFBFBD>').AsFloat:=kbmMemTable2.FieldByName('<27>ϼ<EFBFBD>δ<EFBFBD><CEB4>').AsFloat;
kbmMemTable2.post;
Next;
end;
end;
frm_sys_progress.bsSkinGauge1.Value:=frm_sys_progress.bsSkinGauge1.Value+1;
aDate:=IncMonth(aDate,1);
end;
end;
finally
FreeAndNil(aQuery);
freeAndNil(frm_sys_progress);
end;
end;
procedure Tfrm_rp_kou_histry.Creatememtbl;
begin
end;
function Tfrm_rp_kou_histry.GetZhangQiNum(SaleID, Cust: String;
aetd: TDateTime): Double;
begin
end;
function Tfrm_rp_kou_histry.isChaoQi(SaleID, Cust: String): Boolean;
begin
end;
function Tfrm_rp_kou_histry.GetZhangQiStr(SaleID, Cust: String): String;
begin
end;
end.