|
|
unit u_rp_zou_linehistry;
|
|
|
|
|
|
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, TeeFunci,
|
|
|
wwdblook;
|
|
|
|
|
|
type
|
|
|
Tfrm_rp_zou_linehistry = 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;
|
|
|
Label3: TLabel;
|
|
|
cbYear: TwwDBComboBox;
|
|
|
Label13: TLabel;
|
|
|
RxDBLookupCombo5: TRxDBLookupCombo;
|
|
|
Label14: TLabel;
|
|
|
wwDBComboBox14: TwwDBComboBox;
|
|
|
RxDBLookupCombo3: TRxDBLookupCombo;
|
|
|
bsSkinPageControl1: TbsSkinPageControl;
|
|
|
bsSkinTabSheet1: TbsSkinTabSheet;
|
|
|
bsSkinTabSheet2: TbsSkinTabSheet;
|
|
|
dxDBGrid1: TdxDBGrid;
|
|
|
dxDBGrid1Column5: TdxDBGridColumn;
|
|
|
dxDBGridMaskColumn95: TdxDBGridMaskColumn;
|
|
|
memtotal1: TDataSource;
|
|
|
memtotal: TkbmMemTable;
|
|
|
memtotalField: TStringField;
|
|
|
memtotalField2: TFloatField;
|
|
|
memtblDetailField: TStringField;
|
|
|
memtblDetailField01: TFloatField;
|
|
|
memtblDetailField02: TFloatField;
|
|
|
memtblDetailField03: TFloatField;
|
|
|
memtblDetailField04: TFloatField;
|
|
|
memtblDetailField05: TFloatField;
|
|
|
memtblDetailField06: TFloatField;
|
|
|
memtblDetailField07: TFloatField;
|
|
|
memtblDetailField08: TFloatField;
|
|
|
memtblDetailField09: TFloatField;
|
|
|
memtblDetailField10: TFloatField;
|
|
|
memtblDetailField11: TFloatField;
|
|
|
memtblDetailField12: TFloatField;
|
|
|
memtblDetailField2: TFloatField;
|
|
|
Chart1: TChart;
|
|
|
bsSkinRadioGroup1: TbsSkinRadioGroup;
|
|
|
RxDBLookupCombo10: TRxDBLookupCombo;
|
|
|
Label22: TLabel;
|
|
|
t_code_trade_two: TADOQuery;
|
|
|
t_code_trade_two1: TDataSource;
|
|
|
t_code_trade_one: TADOQuery;
|
|
|
t_code_trade_oneDSDesigner: TStringField;
|
|
|
t_code_trade_one1: TDataSource;
|
|
|
t_code_trade1: TDataSource;
|
|
|
t_code_trade: TADOQuery;
|
|
|
Label1: TLabel;
|
|
|
Edit1: TEdit;
|
|
|
Edit2: TEdit;
|
|
|
Label4: TLabel;
|
|
|
bsSkinCheckGroup1: TbsSkinCheckGroup;
|
|
|
RxDBLookupCombo20: TRxDBLookupCombo;
|
|
|
Label21: TLabel;
|
|
|
Label2: TLabel;
|
|
|
RxDBLookupCombo1: TRxDBLookupCombo;
|
|
|
bsSkinRadioGroup2: TbsSkinRadioGroup;
|
|
|
bsSkinRadioGroup3: TbsSkinRadioGroup;
|
|
|
wwDBLookupCombo52: TwwDBLookupCombo;
|
|
|
Label124: TLabel;
|
|
|
Label5: TLabel;
|
|
|
cbeYear: TwwDBComboBox;
|
|
|
Label12: TLabel;
|
|
|
RxDBLookupCombo2: TRxDBLookupCombo;
|
|
|
bsSkinTabSheet3: TbsSkinTabSheet;
|
|
|
ado_bs_items: TADOQuery;
|
|
|
ado_bs_items1: TDataSource;
|
|
|
dxDBGrid2: TdxDBGrid;
|
|
|
dxDBGrid2Column1: TdxDBGridColumn;
|
|
|
dxDBGrid2Column2: TdxDBGridColumn;
|
|
|
dxDBGrid2Column3: TdxDBGridColumn;
|
|
|
dxDBGrid2Column4: TdxDBGridColumn;
|
|
|
dxDBGrid2Column5: TdxDBGridColumn;
|
|
|
dxDBGrid2Column6: TdxDBGridColumn;
|
|
|
Label53: TLabel;
|
|
|
wwDBComboBox58: TwwDBComboBox;
|
|
|
bsSkinCheckRadioBox1: TbsSkinCheckRadioBox;
|
|
|
bsSkinCheckRadioBox2: TbsSkinCheckRadioBox;
|
|
|
bsSkinGroupBox1: TbsSkinGroupBox;
|
|
|
Memo1: TMemo;
|
|
|
Series1: TBarSeries;
|
|
|
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);
|
|
|
procedure bsSkinCheckRadioBox3Click(Sender: TObject);
|
|
|
procedure bsSkinCheckRadioBox2Click(Sender: TObject);
|
|
|
procedure FormShow(Sender: TObject);
|
|
|
procedure N1101Click(Sender: TObject);
|
|
|
procedure bsSkinRadioGroup1Click(Sender: TObject);
|
|
|
procedure RxDBLookupCombo1Change(Sender: TObject);
|
|
|
procedure bsSkinRadioGroup2Click(Sender: TObject);
|
|
|
procedure Button1Click(Sender: TObject);
|
|
|
procedure Chart1DblClick(Sender: TObject);
|
|
|
procedure dxDBGrid1DblClick(Sender: TObject);
|
|
|
procedure dxDBGrid2DblClick(Sender: TObject);
|
|
|
private
|
|
|
FmDate,ToDate:String;
|
|
|
sqlstr,cntrstr,linestr:WideString;
|
|
|
|
|
|
procedure do_1(str_bill:widestring);
|
|
|
procedure GetNoFee;
|
|
|
procedure Getcntr;
|
|
|
procedure Getlirun;
|
|
|
procedure Getctnitems(years,weeks:Integer);
|
|
|
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;
|
|
|
function getleftstr(substr:String;leng:integer;left:boolean=true):String;
|
|
|
function GetEtdStr(aYear,aWeek:Integer):String;
|
|
|
{ Private declarations }
|
|
|
public
|
|
|
linesqlstr:WideString;
|
|
|
{ Public declarations }
|
|
|
end;
|
|
|
|
|
|
var
|
|
|
frm_rp_zou_linehistry: Tfrm_rp_zou_linehistry;
|
|
|
frmshow:boolean;
|
|
|
implementation
|
|
|
|
|
|
uses u_main, u_rp_no_seae_query,my_sys_function, u_rp_total_query,
|
|
|
u_rp_no_total, u_sys_progress, u_rp_no_selfno, u_data_share;
|
|
|
|
|
|
{$R *.dfm}
|
|
|
function Tfrm_rp_zou_linehistry.GetEtdStr(aYear,aWeek:Integer):String;
|
|
|
var
|
|
|
FirstweekDay,endWeekday,aPerWeek: TDate;
|
|
|
i:integer;
|
|
|
S,datetype:String;
|
|
|
begin
|
|
|
Result:='';
|
|
|
|
|
|
|
|
|
datetype:='<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>';
|
|
|
if (bsSkinCheckRadioBox1.Checked) then datetype:='Ԥ<><D4A4><EFBFBD><EFBFBD><EFBFBD><EFBFBD>';
|
|
|
|
|
|
S:='';
|
|
|
aperweek:=EncodeDate(aYear, 1, 1);
|
|
|
i:=DayOfWeek(aperweek);
|
|
|
if i=1 then
|
|
|
FirstweekDay:=aPerWeek-6
|
|
|
else
|
|
|
FirstweekDay:=aPerWeek-(i-2);
|
|
|
firstweekday:=firstweekday+7*(aWeek-1);
|
|
|
endWeekday:=FirstweekDay+6;
|
|
|
if S='' then begin
|
|
|
if (bsSkinCheckRadioBox1.Checked) then
|
|
|
S:=' t_op_seae.'+datetype+'>='''+FormatDateTime('YYYY-MM-DD',FirstweekDay)+''' and t_op_seae.'+datetype+'<'''+FormatDateTime('YYYY-MM-DD',FirstweekDay+7)+''''
|
|
|
else begin
|
|
|
S:=' t_op_seae.'+datetype+'>='''+FormatDateTime('YYYY-MM-DD',FirstweekDay)+''' and t_op_seae.'+datetype+'<='''+FormatDateTime('YYYY-MM-DD',FirstweekDay+6)+'''';
|
|
|
end;
|
|
|
end;
|
|
|
Result:=S;
|
|
|
end;
|
|
|
|
|
|
function Tfrm_rp_zou_linehistry.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_zou_linehistry.do_1(str_bill:widestring);
|
|
|
begin
|
|
|
|
|
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
procedure Tfrm_rp_zou_linehistry.bsSkinButton5Click(Sender: TObject);
|
|
|
begin
|
|
|
close;
|
|
|
end;
|
|
|
|
|
|
procedure Tfrm_rp_zou_linehistry.FormClose(Sender: TObject;
|
|
|
var Action: TCloseAction);
|
|
|
begin
|
|
|
frm_rp_zou_linehistry.Hide;
|
|
|
frm_rp_zou_linehistry.ManualFloat(frm_rp_zou_linehistry.BoundsRect );
|
|
|
frm_main.freeTabs('frm_rp_zou_linehistry');
|
|
|
action:=cafree;
|
|
|
frm_rp_zou_linehistry:=nil;
|
|
|
end;
|
|
|
|
|
|
procedure Tfrm_rp_zou_linehistry.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_zou_linehistry.bsSkinButton10Click(Sender: TObject);
|
|
|
var
|
|
|
FirstweekDay,endWeekday,aPerWeek: TDate;
|
|
|
barse:TBarSeries;
|
|
|
f,t,i,weekday:integer;
|
|
|
sdate:string;
|
|
|
aQuery:TAdoQuery;
|
|
|
begin
|
|
|
if cbyear.Text='' then begin
|
|
|
MessageDlg('ͳ<><CDB3><EFBFBD>겻<EFBFBD><EAB2BB>Ϊ<EFBFBD><CEAA>!',mtWarning,[mbOk],0);
|
|
|
exit;
|
|
|
end;
|
|
|
|
|
|
linesqlstr:='';
|
|
|
query_seae(26,'0001');
|
|
|
linesqlstr:=StringReplace(linesqlstr,'where','and',[]);
|
|
|
f:=strtoint(edit1.Text);
|
|
|
t:=strtoint(edit2.text);
|
|
|
cntrstr:='';
|
|
|
for i:=0 to bsSkinCheckGroup1.Items.Count-1 do begin
|
|
|
if bsSkinCheckGroup1.Checked[i] then begin
|
|
|
if cntrstr='' then
|
|
|
cntrstr:=''''+StringReplace(bsSkinCheckGroup1.Items[i],'''','''''',[])+''''
|
|
|
else
|
|
|
cntrstr:=cntrstr+','+''''+StringReplace(bsSkinCheckGroup1.Items[i],'''','''''',[])+'''';
|
|
|
end;
|
|
|
end;
|
|
|
|
|
|
if cntrstr<>'' then
|
|
|
cntrstr:='('+cntrstr+')';
|
|
|
|
|
|
|
|
|
linestr:='';
|
|
|
if bsSkinRadioGroup2.ItemIndex<>0 then begin
|
|
|
linestr:=bsSkinRadioGroup2.Items.Strings[bsSkinRadioGroup2.ItemIndex];
|
|
|
linestr:='('+''''+linestr+''''+')';
|
|
|
end else
|
|
|
if (RxDBLookupCombo20.DisplayValue<>'') or (RxDBLookupCombo1.DisplayValue<>'') then
|
|
|
begin
|
|
|
aQuery:=CreateAdoQuery;
|
|
|
try
|
|
|
with aQuery do begin
|
|
|
Close;SQL.Clear;
|
|
|
sql.Add('select <20><><EFBFBD><EFBFBD> from t_code_trade where 1=1 ');
|
|
|
if RxDBLookupCombo20.DisplayValue<>'' then
|
|
|
sql.Add(' and һ<><D2BB><EFBFBD><EFBFBD><EFBFBD><EFBFBD>='''+RxDBLookupCombo20.DisplayValue+'''');
|
|
|
if RxDBLookupCombo1.DisplayValue<>'' then
|
|
|
sql.Add(' and <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>='''+RxDBLookupCombo1.DisplayValue+'''');
|
|
|
Open;
|
|
|
first;
|
|
|
while not eof do begin
|
|
|
if linestr='' then
|
|
|
linestr:=''''+FieldByName('<27><><EFBFBD><EFBFBD>').AsString+''''
|
|
|
else
|
|
|
linestr:=linestr+','+''''+FieldByName('<27><><EFBFBD><EFBFBD>').AsString+'''';
|
|
|
Next;
|
|
|
end;
|
|
|
if linestr<>'' then
|
|
|
linestr:='('+linestr+')';
|
|
|
end;
|
|
|
finally
|
|
|
FreeAndNil(aQuery);
|
|
|
end;
|
|
|
end;
|
|
|
|
|
|
Creatememtbl;
|
|
|
memtblDetail.DisableControls;
|
|
|
if bsSkinRadioGroup1.ItemIndex=0 then begin
|
|
|
Getcntr;
|
|
|
end;
|
|
|
if bsSkinRadioGroup1.ItemIndex=1 then begin
|
|
|
Getlirun;
|
|
|
end;
|
|
|
Memo1.Lines.Clear;
|
|
|
Chart1.SeriesList.Clear;
|
|
|
memtblDetail.First;
|
|
|
while not memtblDetail.Eof do begin
|
|
|
barse:=TBarSeries.Create(self);
|
|
|
barse.Title:=memtblDetail.fieldbyname('<27><><EFBFBD><EFBFBD>').asstring+'<27><><EFBFBD><EFBFBD>';
|
|
|
for i:=f to t do begin
|
|
|
sDate:=getleftstr(inttostr(i),2);
|
|
|
aperweek:=EncodeDate(StrToInt64(memtblDetail.fieldbyname('<27><><EFBFBD><EFBFBD>').asstring), 1, 1);
|
|
|
weekday:=DayOfWeek(aperweek);
|
|
|
if weekday=1 then
|
|
|
FirstweekDay:=aPerWeek-6
|
|
|
else
|
|
|
FirstweekDay:=aPerWeek-(weekday-2);
|
|
|
firstweekday:=firstweekday+7*(i-1);
|
|
|
endWeekday:=FirstweekDay+6;
|
|
|
barse.Add(memtblDetail.fieldbyname(sDate+'<27><><EFBFBD><EFBFBD>').AsFloat,sDate);
|
|
|
barse.Marks.Style:= smsValue;
|
|
|
Memo1.Lines.Add('<27><><EFBFBD><EFBFBD>:'+memtblDetail.fieldbyname('<27><><EFBFBD><EFBFBD>').asstring+'<27><>'+sDate+'<27><>('+FormatDateTime('YYYY-MM-DD',FirstweekDay)+'<27><>'+FormatDateTime('YYYY-MM-DD',endWeekday)+')')
|
|
|
end;
|
|
|
|
|
|
Chart1.AddSeries(barse);
|
|
|
memtblDetail.Next;
|
|
|
end;
|
|
|
Chart1.Repaint;
|
|
|
memtblDetail.EnableControls;
|
|
|
|
|
|
|
|
|
end;
|
|
|
|
|
|
procedure Tfrm_rp_zou_linehistry.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_zou_linehistry.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_zou_linehistry.GetNoFee;
|
|
|
begin
|
|
|
|
|
|
end;
|
|
|
|
|
|
procedure Tfrm_rp_zou_linehistry.Creatememtbl;
|
|
|
var
|
|
|
aDate,aToDate:TDate;
|
|
|
sDate,aYear,aMonth,acaption:String;
|
|
|
aColumn:TdxDBTreeListColumn;
|
|
|
aBand:TdxTreeListBand;
|
|
|
i,f,t:integer;
|
|
|
begin
|
|
|
f:=strtoint(edit1.Text);
|
|
|
t:=strtoint(edit2.text);
|
|
|
|
|
|
dxDBGrid1.Bands.Clear;
|
|
|
// dxDBGrid1.DestroyColumns;
|
|
|
while dxDBGrid1.columncount>0 do
|
|
|
begin
|
|
|
dxDBGrid1.Columns[0].Destroy;
|
|
|
end;
|
|
|
|
|
|
memtblDetail.Close;
|
|
|
memtblDetail.EmptyTable;
|
|
|
|
|
|
|
|
|
if bsSkinRadioGroup1.ItemIndex=0 then begin
|
|
|
acaption:='<27><><EFBFBD><EFBFBD>';
|
|
|
end else if bsSkinRadioGroup1.ItemIndex=1 then begin
|
|
|
acaption:='<27><><EFBFBD><EFBFBD>';
|
|
|
end;
|
|
|
|
|
|
memtblDetail.Fields.Clear;
|
|
|
memtblDetail.FieldDefs.Clear;
|
|
|
memtblDetail.FieldDefs.Add('<27><><EFBFBD><EFBFBD>', ftString, 20, false);
|
|
|
|
|
|
aBand:=dxDBGrid1.Bands.Add;
|
|
|
aBand.Caption:='<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϣ';
|
|
|
aColumn:=dxDBGrid1.CreateColumn(TdxDBGridColumn);
|
|
|
aColumn.Caption:='<27><><EFBFBD><EFBFBD>';
|
|
|
aColumn.BandIndex:=0;
|
|
|
aColumn.FieldName:='<27><><EFBFBD><EFBFBD>';
|
|
|
|
|
|
aBand:=dxDBGrid1.Bands.Add;
|
|
|
aBand.Caption:=acaption;
|
|
|
for i:=f to t do begin
|
|
|
aMonth:=getleftstr(inttostr(i),2);
|
|
|
aColumn:=dxDBGrid1.CreateColumn(TdxDBGridColumn);
|
|
|
aColumn.Caption:=aMonth+'<27><>'+acaption;
|
|
|
aColumn.FieldName:=aMonth+'<27><><EFBFBD><EFBFBD>';
|
|
|
aColumn.SummaryFooterType:=cstAvg;
|
|
|
aColumn.BandIndex:=1;
|
|
|
memtblDetail.FieldDefs.Add(aMonth+'<27><><EFBFBD><EFBFBD>',ftFloat, 0, false);
|
|
|
end;
|
|
|
|
|
|
aColumn:=dxDBGrid1.CreateColumn(TdxDBGridColumn);
|
|
|
aColumn.Caption:='ƽ<><C6BD>'+acaption;
|
|
|
aColumn.FieldName:='ƽ<><C6BD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>';
|
|
|
aColumn.SummaryFooterType:=cstAvg;
|
|
|
aColumn.BandIndex:=1;
|
|
|
|
|
|
memtblDetail.FieldDefs.Add('ƽ<><C6BD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>',ftFloat, 0, false);
|
|
|
memtblDetail.CreateTable;
|
|
|
memtblDetail.Open;
|
|
|
memtblDetail.IndexName:='<27><><EFBFBD><EFBFBD>';
|
|
|
|
|
|
end;
|
|
|
|
|
|
function Tfrm_rp_zou_linehistry.GetZhangQiNum(SaleID, Cust: String;
|
|
|
aetd: TDateTime): Double;
|
|
|
var
|
|
|
aQuery:TAdoQuery;
|
|
|
begin
|
|
|
aQuery:=CreateAdoQuery;
|
|
|
try
|
|
|
with aQuery do begin
|
|
|
Close;SQL.Clear;
|
|
|
SQL.Add('Select <20><><EFBFBD>ѽ<EFBFBD><D1BD><EFBFBD> from t_crm_client_sales where ״̬=''<27><><EFBFBD><EFBFBD>'' and <20><>ʼ<EFBFBD><CABC><EFBFBD><EFBFBD><='''+FormatDateTime('YYYY-MM-DD',aetd)+''' and <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>>='''+FormatDateTime('YYYY-MM-DD',aetd)+''' and <20>ͻ<EFBFBD><CDBB><EFBFBD><EFBFBD><EFBFBD>='''+Cust+''' and <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>='''+SaleID+'''');
|
|
|
Open;
|
|
|
if not IsEmpty then begin
|
|
|
if FieldByName('<27><><EFBFBD>ѽ<EFBFBD><D1BD><EFBFBD>').IsNull or (FieldByName('<27><><EFBFBD>ѽ<EFBFBD><D1BD><EFBFBD>').AsFloat<=0) then begin
|
|
|
Result:=0;
|
|
|
end else begin
|
|
|
Result:=FieldByName('<27><><EFBFBD>ѽ<EFBFBD><D1BD><EFBFBD>').AsFloat;
|
|
|
end;
|
|
|
end else begin
|
|
|
Result:=-1;
|
|
|
end;
|
|
|
end;
|
|
|
finally
|
|
|
FreeAndNil(aQuery);
|
|
|
end;
|
|
|
|
|
|
end;
|
|
|
|
|
|
function Tfrm_rp_zou_linehistry.isChaoQi(SaleID, Cust: String): Boolean;
|
|
|
begin
|
|
|
|
|
|
end;
|
|
|
|
|
|
procedure Tfrm_rp_zou_linehistry.bsSkinCheckRadioBox3Click(Sender: TObject);
|
|
|
begin
|
|
|
GetNoFee;
|
|
|
end;
|
|
|
|
|
|
procedure Tfrm_rp_zou_linehistry.bsSkinCheckRadioBox2Click(Sender: TObject);
|
|
|
begin
|
|
|
GetNoFee;
|
|
|
end;
|
|
|
|
|
|
function Tfrm_rp_zou_linehistry.GetZhangQiStr(SaleID, Cust: String): String;
|
|
|
var
|
|
|
aQuery:TADOQuery;
|
|
|
begin
|
|
|
aQuery:=CreateAdoQuery;
|
|
|
Result:='';
|
|
|
try
|
|
|
with aQuery do begin
|
|
|
Close;SQL.Clear;
|
|
|
sql.Add(' select distinct SUBSTRING(CONVERT(char(15), dbo.v_op_bscard.<2E><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>, 111), 1, 7) from v_op_bscard left join t_ch_fee on t_ch_fee.<2E><><EFBFBD><EFBFBD>=v_op_bscard.<2E><><EFBFBD><EFBFBD> ');
|
|
|
sql.Add(sqlstr);
|
|
|
sql.Add(' and t_ch_fee.<2E>ͻ<EFBFBD><CDBB><EFBFBD><EFBFBD><EFBFBD>='''+Cust+''' and v_op_bscard.<2E><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>='''+SaleID+'''');
|
|
|
Open;
|
|
|
if not IsEmpty then begin
|
|
|
first;
|
|
|
while not eof do begin
|
|
|
if Result='' then
|
|
|
result:=Fields[0].value
|
|
|
else
|
|
|
Result:=Result+','+Fields[0].value;
|
|
|
Next;
|
|
|
end;
|
|
|
Result:=Result+'<27><>Ƿ<EFBFBD><C7B7>'
|
|
|
end else
|
|
|
result:='';
|
|
|
end;
|
|
|
finally
|
|
|
FreeAndNil(aQuery);
|
|
|
end;
|
|
|
|
|
|
end;
|
|
|
|
|
|
procedure Tfrm_rp_zou_linehistry.FormShow(Sender: TObject);
|
|
|
begin
|
|
|
frmshow:=true;
|
|
|
cbyear.Items.IndexOf(FormatDateTime('YYYY',Now));
|
|
|
cbyear.text:=FormatDateTime('YYYY',Now);
|
|
|
cbeYear.Items.IndexOf(FormatDateTime('YYYY',Now));
|
|
|
cbeYear.text:=FormatDateTime('YYYY',Now);
|
|
|
edit1.Text:='1';
|
|
|
edit2.Text:=inttostr(WeekofYear(now));
|
|
|
t_code_trade_one.Open;
|
|
|
t_code_trade_two.Open;
|
|
|
t_code_trade.Open;
|
|
|
bsSkinCheckGroup1.Items.Clear;
|
|
|
frm_data_share.t_code_ctn.First;
|
|
|
while not frm_data_share.t_code_ctn.eof do begin
|
|
|
bsSkinCheckGroup1.Items.add(frm_data_share.t_code_ctn.fieldbyname('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʽ').AsString);
|
|
|
frm_data_share.t_code_ctn.Next;
|
|
|
end;
|
|
|
RxDBLookupCombo1.OnChange(nil);
|
|
|
frmshow:=false;
|
|
|
end;
|
|
|
|
|
|
procedure Tfrm_rp_zou_linehistry.N1101Click(Sender: TObject);
|
|
|
begin
|
|
|
chartpreview(frm_rp_zou_linehistry,chart1);
|
|
|
end;
|
|
|
|
|
|
function Tfrm_rp_zou_linehistry.getleftstr(substr: String; leng: integer;
|
|
|
left: boolean=true): String;
|
|
|
var
|
|
|
str:String;
|
|
|
begin
|
|
|
str:=substr;
|
|
|
if length(str)>=leng then begin
|
|
|
result:=str;
|
|
|
exit;
|
|
|
end;
|
|
|
while length(str)<leng do begin
|
|
|
if left then
|
|
|
str:='0'+str
|
|
|
else
|
|
|
str:=str+'0';
|
|
|
end;
|
|
|
result:=str;
|
|
|
end;
|
|
|
|
|
|
procedure Tfrm_rp_zou_linehistry.Getcntr;
|
|
|
var
|
|
|
aQuery:TAdoQuery;
|
|
|
aDate,aToDate:TDate;
|
|
|
strdate,strbdate,sDate,yDate:String;
|
|
|
n,i,f,t,fyear,eyear,y:integer;
|
|
|
// S:TChartSeries;
|
|
|
begin
|
|
|
// DBChart3.AddSeries();
|
|
|
fyear:=strtoint(cbYear.text);
|
|
|
eyear:=strtoint(cbeYear.text);
|
|
|
aQuery:=CreateAdoQuery;
|
|
|
try
|
|
|
with aQuery do begin
|
|
|
if not ASSIGNED(frm_sys_progress) then
|
|
|
frm_sys_progress:=tfrm_sys_progress.Create(application);
|
|
|
frm_sys_progress.Show;
|
|
|
n:=eyear-fyear;
|
|
|
if n=0 then n:=1;
|
|
|
frm_sys_progress.bsSkinGauge1.MaxValue:=n;
|
|
|
frm_sys_progress.bsSkinGauge1.MinValue:=0;
|
|
|
frm_sys_progress.bsSkinGauge1.Value:=0;
|
|
|
frm_sys_progress.Update;
|
|
|
for y:=fyear to eyear do begin
|
|
|
f:=strtoint(edit1.Text);
|
|
|
t:=strtoint(edit2.text);
|
|
|
while not (f>t) do begin
|
|
|
ydate:=inttostr(y);
|
|
|
sDate:=getleftstr(inttostr(f),2);
|
|
|
frm_sys_progress.bsSkinGauge1.ProgressText:='<27><>:'+IntToStr(y)+' <20><> '+IntToStr(f);
|
|
|
CLOSE;
|
|
|
SQL.Clear;
|
|
|
{
|
|
|
SQL.Add('Select ');
|
|
|
SQL.Add('sum(isnull(t_op_ctn.TEU,0)) as <20><><EFBFBD><EFBFBD> ');
|
|
|
SQL.Add('from t_op_seae ');
|
|
|
SQL.Add('left join t_op_ctn on t_op_seae.<2E><><EFBFBD><EFBFBD>=t_op_ctn.<2E><><EFBFBD><EFBFBD> where '+GetEtdStr(y,f));
|
|
|
}
|
|
|
SQL.Add('Select ');
|
|
|
SQL.Add('sum(isnull(t_op_ctn.TEU,0)) as <20><><EFBFBD><EFBFBD> ');
|
|
|
SQL.Add('from t_op_ctn,t_op_seae ');
|
|
|
SQL.Add('where t_op_seae.<2E><><EFBFBD><EFBFBD>=t_op_ctn.<2E><><EFBFBD><EFBFBD> and '+GetEtdStr(y,f));
|
|
|
SQL.Add(linesqlstr);
|
|
|
if RxDBLookupCombo5.DisplayValues[1]<>'' then
|
|
|
SQL.Add(' and t_op_seae.ί<>е<EFBFBD>λ='''+RxDBLookupCombo5.DisplayValues[1]+'''');
|
|
|
if RxDBLookupCombo3.DisplayValue<>'' then begin
|
|
|
if wwDBComboBox14.Text='<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>' then
|
|
|
SQL.Add(' and t_op_seae.<2E><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><>'''+RxDBLookupCombo3.DisplayValues[0]+'''')
|
|
|
else
|
|
|
SQL.Add(' and t_op_seae.<2E><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>='''+RxDBLookupCombo3.DisplayValues[0]+'''');
|
|
|
end;
|
|
|
|
|
|
if RxDBLookupCombo10.DisplayValue<>'' then begin
|
|
|
SQL.Add(' and t_op_seae.<2E><><EFBFBD>۲<EFBFBD><DBB2><EFBFBD>='''+RxDBLookupCombo10.DisplayValues[0]+'''');
|
|
|
end;
|
|
|
|
|
|
if RxDBLookupCombo2.DisplayValue<>'' then begin
|
|
|
SQL.Add(' and t_op_seae.<2E><><EFBFBD><EFBFBD>˾='''+RxDBLookupCombo2.DisplayValues[1]+'''');
|
|
|
end;
|
|
|
|
|
|
if cntrstr<>'' then begin
|
|
|
SQL.Add(' and t_op_ctn.<2E><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʽ in '+cntrstr);
|
|
|
end;
|
|
|
if (wwDBComboBox58.Value<>'') then begin
|
|
|
SQL.Add(' and t_op_seae.<2E>Ƿ<EFBFBD>ռ<EFBFBD><D5BC>='''+wwDBComboBox58.Value+'''');
|
|
|
end;
|
|
|
|
|
|
if linestr<>'' then begin
|
|
|
if bsSkinRadioGroup3.ItemIndex=1 then
|
|
|
SQL.Add(' and EXISTS (select * from t_code_disport where t_code_disport.EDI<44><49><EFBFBD><EFBFBD>=t_op_seae.ж<><D0B6><EFBFBD><EFBFBD><EFBFBD><EFBFBD> and t_code_disport.<2E><><EFBFBD><EFBFBD> in '+linestr+')')
|
|
|
else
|
|
|
SQL.Add(' and t_op_seae.<2E><><EFBFBD><EFBFBD> in '+linestr)
|
|
|
end;
|
|
|
if wwDBLookupCombo52.Text<>'' then begin
|
|
|
SQL.Add(' and t_op_seae.ж<><D0B6><EFBFBD><EFBFBD> like ''%'+wwDBLookupCombo52.Text+'%''')
|
|
|
end;
|
|
|
|
|
|
SQL.Add(' and '+open_data('9009','t_op_seae.<2E><><EFBFBD><EFBFBD>Ա','t_op_seae.<2E><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>','no','no','no','no'));
|
|
|
|
|
|
Open;
|
|
|
// showmessage(sql.Text);
|
|
|
if not IsEmpty then
|
|
|
begin
|
|
|
first;
|
|
|
while not eof do
|
|
|
begin
|
|
|
if memtblDetail.Locate('<27><><EFBFBD><EFBFBD>',Ydate,[]) then
|
|
|
begin
|
|
|
memtblDetail.Edit;
|
|
|
memtblDetail.FieldByName(sDate+'<27><><EFBFBD><EFBFBD>').AsFloat:=memtblDetail.FieldByName(sDate+'<27><><EFBFBD><EFBFBD>').AsFloat+FieldbyName('<27><><EFBFBD><EFBFBD>').AsFloat;
|
|
|
memtblDetail.Post;
|
|
|
end
|
|
|
else
|
|
|
begin
|
|
|
memtblDetail.Insert;
|
|
|
for i:=0 to memtbldetail.FieldCount-1 do begin
|
|
|
if memtbldetail.Fields[i].FieldName='<27><><EFBFBD><EFBFBD>' then
|
|
|
memtbldetail.Fields[i].AsString:=Ydate
|
|
|
else
|
|
|
memtbldetail.Fields[i].AsFloat:=0;
|
|
|
end;
|
|
|
memtblDetail.FieldByName(sDate+'<27><><EFBFBD><EFBFBD>').AsFloat:=memtblDetail.FieldByName(sDate+'<27><><EFBFBD><EFBFBD>').AsFloat+FieldbyName('<27><><EFBFBD><EFBFBD>').AsFloat;
|
|
|
memtblDetail.Post;
|
|
|
end;
|
|
|
frm_sys_progress.bsSkinGauge1.ProgressText:='<27><>:'+IntToStr(y)+' <20><>: '+IntToStr(f);
|
|
|
Next;
|
|
|
end;
|
|
|
end;
|
|
|
frm_sys_progress.bsSkinGauge1.Value:=frm_sys_progress.bsSkinGauge1.Value+1;
|
|
|
f:=f+1;
|
|
|
end;
|
|
|
end;
|
|
|
end;
|
|
|
finally
|
|
|
FreeAndNil(aQuery);
|
|
|
freeAndNil(frm_sys_progress);
|
|
|
end;
|
|
|
|
|
|
end;
|
|
|
|
|
|
procedure Tfrm_rp_zou_linehistry.Getlirun;
|
|
|
var
|
|
|
aQuery:TAdoQuery;
|
|
|
aDate,aToDate:TDate;
|
|
|
strdate,strbdate,sDate,yDate:String;
|
|
|
i,f,t,n,fyear,eyear,y:integer;
|
|
|
// S:TChartSeries;
|
|
|
begin
|
|
|
// DBChart3.AddSeries();
|
|
|
fyear:=strtoint(cbYear.text);
|
|
|
eyear:=strtoint(cbeYear.text);
|
|
|
aQuery:=CreateAdoQuery;
|
|
|
try
|
|
|
with aQuery do begin
|
|
|
if not ASSIGNED(frm_sys_progress) then
|
|
|
frm_sys_progress:=tfrm_sys_progress.Create(application);
|
|
|
frm_sys_progress.Show;
|
|
|
n:=eyear-fyear;
|
|
|
if n=0 then n:=1;
|
|
|
frm_sys_progress.bsSkinGauge1.MaxValue:=n;
|
|
|
frm_sys_progress.bsSkinGauge1.MinValue:=0;
|
|
|
frm_sys_progress.bsSkinGauge1.Value:=0;
|
|
|
frm_sys_progress.Update;
|
|
|
for y:=fyear to eyear do begin
|
|
|
f:=strtoint(edit1.Text);
|
|
|
t:=strtoint(edit2.text);
|
|
|
while not (f>t) do begin
|
|
|
ydate:=inttostr(y);
|
|
|
sDate:=getleftstr(inttostr(f),2);
|
|
|
CLOSE;
|
|
|
SQL.Clear;
|
|
|
SQL.Add('Select ');
|
|
|
SQL.Add('sum(t_op_gain_main.ë<><C3AB><EFBFBD><EFBFBD>) as <20><><EFBFBD><EFBFBD> ');
|
|
|
SQL.Add('from t_op_seae inner JOIN t_op_gain_main ON t_op_seae.<2E><><EFBFBD><EFBFBD> =t_op_gain_main.<2E><><EFBFBD><EFBFBD> ');
|
|
|
SQL.Add(' where '+GetEtdStr(y,f));
|
|
|
SQL.Add(linesqlstr);
|
|
|
if RxDBLookupCombo5.DisplayValues[1]<>'' then
|
|
|
SQL.Add(' and t_op_seae.ί<>е<EFBFBD>λ='''+RxDBLookupCombo5.DisplayValues[1]+'''');
|
|
|
if RxDBLookupCombo3.DisplayValue<>'' then begin
|
|
|
if wwDBComboBox14.Text='<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>' then
|
|
|
SQL.Add(' and t_op_seae.<2E><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><>'''+RxDBLookupCombo3.DisplayValues[0]+'''')
|
|
|
else
|
|
|
SQL.Add(' and t_op_seae.<2E><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>='''+RxDBLookupCombo3.DisplayValues[0]+'''');
|
|
|
end;
|
|
|
if RxDBLookupCombo10.DisplayValue<>'' then begin
|
|
|
SQL.Add(' and t_op_seae.<2E><><EFBFBD>۲<EFBFBD><DBB2><EFBFBD>='''+RxDBLookupCombo10.DisplayValues[0]+'''');
|
|
|
end;
|
|
|
if RxDBLookupCombo2.DisplayValue<>'' then begin
|
|
|
SQL.Add(' and t_op_seae.<2E><><EFBFBD><EFBFBD>˾='''+RxDBLookupCombo2.DisplayValues[1]+'''');
|
|
|
end;
|
|
|
if (wwDBComboBox58.Value<>'') then begin
|
|
|
SQL.Add(' and t_op_seae.<2E>Ƿ<EFBFBD>ռ<EFBFBD><D5BC>='''+wwDBComboBox58.Value+'''');
|
|
|
end;
|
|
|
|
|
|
|
|
|
if cntrstr<>'' then begin
|
|
|
SQL.Add(' and EXISTS (select * from t_op_ctn where t_op_ctn.<2E><><EFBFBD><EFBFBD>=t_op_seae.<2E><><EFBFBD><EFBFBD> and t_op_ctn.<2E><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʽ in '+cntrstr+')');
|
|
|
end;
|
|
|
|
|
|
if linestr<>'' then begin
|
|
|
if bsSkinRadioGroup3.ItemIndex=1 then
|
|
|
SQL.Add(' and EXISTS (select * from t_code_disport where t_code_disport.EDI<44><49><EFBFBD><EFBFBD>=t_op_seae.ж<><D0B6><EFBFBD><EFBFBD><EFBFBD><EFBFBD> and t_code_disport.<2E><><EFBFBD><EFBFBD> in '+linestr+')')
|
|
|
else
|
|
|
SQL.Add(' and t_op_seae.<2E><><EFBFBD><EFBFBD> in '+linestr)
|
|
|
end;
|
|
|
if wwDBLookupCombo52.Text<>'' then begin
|
|
|
SQL.Add(' and t_op_seae.ж<><D0B6><EFBFBD><EFBFBD> like ''%'+wwDBLookupCombo52.Text+'%''')
|
|
|
end;
|
|
|
|
|
|
SQL.Add(' and '+open_data('9009','t_op_seae.<2E><><EFBFBD><EFBFBD>Ա','t_op_seae.<2E><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>','no','no','no','no'));
|
|
|
|
|
|
Open;
|
|
|
if not IsEmpty then begin
|
|
|
first;
|
|
|
while not eof do begin
|
|
|
if memtblDetail.Locate('<27><><EFBFBD><EFBFBD>',Ydate,[]) then begin
|
|
|
memtblDetail.Edit;
|
|
|
memtblDetail.FieldByName(sDate+'<27><><EFBFBD><EFBFBD>').AsFloat:=memtblDetail.FieldByName(sDate+'<27><><EFBFBD><EFBFBD>').AsFloat+FieldbyName('<27><><EFBFBD><EFBFBD>').AsFloat;
|
|
|
memtblDetail.Post;
|
|
|
end else begin
|
|
|
memtblDetail.Insert;
|
|
|
for i:=0 to memtbldetail.FieldCount-1 do begin
|
|
|
if memtbldetail.Fields[i].FieldName='<27><><EFBFBD><EFBFBD>' then
|
|
|
memtbldetail.Fields[i].AsString:=Ydate
|
|
|
else
|
|
|
memtbldetail.Fields[i].AsFloat:=0;
|
|
|
end;
|
|
|
memtblDetail.FieldByName(sDate+'<27><><EFBFBD><EFBFBD>').AsFloat:=memtblDetail.FieldByName(sDate+'<27><><EFBFBD><EFBFBD>').AsFloat+FieldbyName('<27><><EFBFBD><EFBFBD>').AsFloat;
|
|
|
memtblDetail.Post;
|
|
|
end;
|
|
|
Next;
|
|
|
end;
|
|
|
end;
|
|
|
frm_sys_progress.bsSkinGauge1.Value:=frm_sys_progress.bsSkinGauge1.Value+1;
|
|
|
|
|
|
f:=f+1;
|
|
|
end;
|
|
|
end;
|
|
|
end;
|
|
|
finally
|
|
|
FreeAndNil(aQuery);
|
|
|
freeAndNil(frm_sys_progress);
|
|
|
end;
|
|
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
procedure Tfrm_rp_zou_linehistry.Getctnitems(years,weeks:Integer);
|
|
|
begin
|
|
|
with ado_bs_items do
|
|
|
begin
|
|
|
CLOSE;
|
|
|
SQL.Clear;
|
|
|
SQL.Add('Select t_op_seae.<2E><><EFBFBD><EFBFBD>,t_op_seae.<2E><><EFBFBD><EFBFBD>˾,t_op_seae.ί<>е<EFBFBD>λ,t_op_seae.<2E><>װ<EFBFBD><D7B0>,t_op_seae.ж<><D0B6><EFBFBD><EFBFBD>,t_op_seae.<2E><><EFBFBD>ᵥ<EFBFBD><E1B5A5>,t_op_seae.ί<>е<EFBFBD>λ');
|
|
|
SQL.Add(',sum(isnull(t_op_ctn.TEU,0)) as <20><><EFBFBD><EFBFBD> ');
|
|
|
SQL.Add('from t_op_ctn,t_op_seae ');
|
|
|
SQL.Add('where t_op_seae.<2E><><EFBFBD><EFBFBD>=t_op_ctn.<2E><><EFBFBD><EFBFBD> and '+GetEtdStr(years,weeks));
|
|
|
|
|
|
if RxDBLookupCombo5.DisplayValues[1]<>'' then
|
|
|
SQL.Add(' and t_op_seae.ί<>е<EFBFBD>λ='''+RxDBLookupCombo5.DisplayValues[1]+'''');
|
|
|
if RxDBLookupCombo3.DisplayValue<>'' then begin
|
|
|
if wwDBComboBox14.Text='<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>' then
|
|
|
SQL.Add(' and t_op_seae.<2E><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><>'''+RxDBLookupCombo3.DisplayValues[0]+'''')
|
|
|
else
|
|
|
SQL.Add(' and t_op_seae.<2E><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>='''+RxDBLookupCombo3.DisplayValues[0]+'''');
|
|
|
end;
|
|
|
|
|
|
if RxDBLookupCombo10.DisplayValue<>'' then begin
|
|
|
SQL.Add(' and t_op_seae.<2E><><EFBFBD>۲<EFBFBD><DBB2><EFBFBD>='''+RxDBLookupCombo10.DisplayValues[0]+'''');
|
|
|
end;
|
|
|
|
|
|
if RxDBLookupCombo2.DisplayValue<>'' then begin
|
|
|
SQL.Add(' and t_op_seae.<2E><><EFBFBD><EFBFBD>˾='''+RxDBLookupCombo2.DisplayValues[1]+'''');
|
|
|
end;
|
|
|
|
|
|
if cntrstr<>'' then begin
|
|
|
SQL.Add(' and t_op_ctn.<2E><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʽ in '+cntrstr);
|
|
|
end;
|
|
|
|
|
|
if linestr<>'' then begin
|
|
|
if bsSkinRadioGroup3.ItemIndex=1 then
|
|
|
SQL.Add(' and EXISTS (select * from t_code_disport where t_code_disport.EDI<44><49><EFBFBD><EFBFBD>=t_op_seae.ж<><D0B6><EFBFBD><EFBFBD><EFBFBD><EFBFBD> and t_code_disport.<2E><><EFBFBD><EFBFBD> in '+linestr+')')
|
|
|
else
|
|
|
SQL.Add(' and t_op_seae.<2E><><EFBFBD><EFBFBD> in '+linestr)
|
|
|
end;
|
|
|
if wwDBLookupCombo52.Text<>'' then begin
|
|
|
SQL.Add(' and t_op_seae.ж<><D0B6><EFBFBD><EFBFBD> like ''%'+wwDBLookupCombo52.Text+'%''')
|
|
|
end;
|
|
|
|
|
|
SQL.Add(' and '+open_data('9009','t_op_seae.<2E><><EFBFBD><EFBFBD>Ա','t_op_seae.<2E><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>','no','no','no','no'));
|
|
|
SQL.Add('Group by t_op_seae.<2E><><EFBFBD><EFBFBD>,t_op_seae.<2E><><EFBFBD><EFBFBD>˾,t_op_seae.ί<>е<EFBFBD>λ,t_op_seae.<2E><>װ<EFBFBD><D7B0>,t_op_seae.ж<><D0B6><EFBFBD><EFBFBD>,t_op_seae.<2E><><EFBFBD>ᵥ<EFBFBD><E1B5A5>,t_op_seae.ί<>е<EFBFBD>λ');
|
|
|
Open;
|
|
|
end;
|
|
|
end;
|
|
|
|
|
|
|
|
|
procedure Tfrm_rp_zou_linehistry.bsSkinRadioGroup1Click(Sender: TObject);
|
|
|
begin
|
|
|
bsSkinButton10.OnClick(sender);
|
|
|
end;
|
|
|
|
|
|
procedure Tfrm_rp_zou_linehistry.RxDBLookupCombo1Change(Sender: TObject);
|
|
|
var
|
|
|
aQuery:TADOQuery;
|
|
|
begin
|
|
|
bsSkinRadioGroup2.Items.Clear;
|
|
|
bsSkinRadioGroup2.Items.Add('ȫ<><C8AB>');
|
|
|
if RxDBLookupCombo1.DisplayValue<>'' then begin
|
|
|
aQuery:=CreateAdoQuery;
|
|
|
try
|
|
|
with aQuery do begin
|
|
|
Close;SQL.Clear;
|
|
|
sql.Add('select <20><><EFBFBD><EFBFBD> from t_code_trade where 1=1 ');
|
|
|
if RxDBLookupCombo20.DisplayValue<>'' then
|
|
|
sql.Add(' and һ<><D2BB><EFBFBD><EFBFBD><EFBFBD><EFBFBD>='''+RxDBLookupCombo20.DisplayValue+'''');
|
|
|
if RxDBLookupCombo1.DisplayValue<>'' then
|
|
|
sql.Add(' and <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>='''+RxDBLookupCombo1.DisplayValue+'''');
|
|
|
Open;
|
|
|
first;
|
|
|
while not eof do begin
|
|
|
bsSkinRadioGroup2.Items.Add(FieldByName('<27><><EFBFBD><EFBFBD>').AsString);
|
|
|
Next;
|
|
|
end;
|
|
|
end;
|
|
|
finally
|
|
|
FreeAndNil(aQuery);
|
|
|
end;
|
|
|
end else begin
|
|
|
aQuery:=CreateAdoQuery;
|
|
|
try
|
|
|
with aQuery do begin
|
|
|
Close;SQL.Clear;
|
|
|
sql.Add('select <20><><EFBFBD><EFBFBD> from t_code_trade where 1=1 ');
|
|
|
Open;
|
|
|
first;
|
|
|
while not eof do begin
|
|
|
bsSkinRadioGroup2.Items.Add(FieldByName('<27><><EFBFBD><EFBFBD>').AsString);
|
|
|
Next;
|
|
|
end;
|
|
|
end;
|
|
|
finally
|
|
|
FreeAndNil(aQuery);
|
|
|
end;
|
|
|
end;
|
|
|
bsSkinRadioGroup2.ItemIndex:=0;
|
|
|
end;
|
|
|
|
|
|
procedure Tfrm_rp_zou_linehistry.bsSkinRadioGroup2Click(Sender: TObject);
|
|
|
begin
|
|
|
if frmshow then exit;
|
|
|
bsSkinButton10.OnClick(sender);
|
|
|
end;
|
|
|
|
|
|
procedure Tfrm_rp_zou_linehistry.Button1Click(Sender: TObject);
|
|
|
begin
|
|
|
showmessage(GetEtdStr(strtoint(cbYear.text),strtoint(edit1.text)));
|
|
|
end;
|
|
|
|
|
|
procedure Tfrm_rp_zou_linehistry.Chart1DblClick(Sender: TObject);
|
|
|
|
|
|
begin
|
|
|
//showmessage(Chart1.Title.);
|
|
|
|
|
|
//Chart1.SeriesList.g
|
|
|
|
|
|
|
|
|
end;
|
|
|
|
|
|
procedure Tfrm_rp_zou_linehistry.dxDBGrid1DblClick(Sender: TObject);
|
|
|
var years,weeks:integer;
|
|
|
begin
|
|
|
years:=strtoint(memtblDetail.FieldByName('<27><><EFBFBD><EFBFBD>').AsString);
|
|
|
weeks:=strtoint(Copy(dxDBGrid1.FocusedField.FieldName,1,2));
|
|
|
if bsSkinRadioGroup1.ItemIndex=0 then
|
|
|
begin
|
|
|
Getctnitems(years,weeks);
|
|
|
bsSkinPageControl1.ActivePageIndex:=2;
|
|
|
end;
|
|
|
end;
|
|
|
|
|
|
procedure Tfrm_rp_zou_linehistry.dxDBGrid2DblClick(Sender: TObject);
|
|
|
begin
|
|
|
fee_view(ado_bs_items.fieldbyname('<27><><EFBFBD><EFBFBD>').asstring);
|
|
|
end;
|
|
|
|
|
|
end.
|