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_no_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_no_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;
Label5: TLabel;
Label10: TLabel;
Label1: TLabel;
cbdate: TwwDBComboBox;
Label2: TLabel;
wwDBComboBox2: TwwDBComboBox;
Label3: TLabel;
cbYear: TwwDBComboBox;
cbbmonth: TwwDBComboBox;
cbemonth: TwwDBComboBox;
Label13: TLabel;
RxDBLookupCombo5: TRxDBLookupCombo;
Label14: TLabel;
wwDBComboBox14: TwwDBComboBox;
RxDBLookupCombo3: TRxDBLookupCombo;
bsSkinPageControl1: TbsSkinPageControl;
bsSkinTabSheet1: TbsSkinTabSheet;
bsSkinTabSheet2: TbsSkinTabSheet;
dxDBGrid1: TdxDBGrid;
dxDBGrid1Column5: TdxDBGridColumn;
dxDBGridMaskColumn95: TdxDBGridMaskColumn;
DBChart3: TDBChart;
Series1: TLineSeries;
memtotal1: TDataSource;
memtotal: TkbmMemTable;
memtotalField: TStringField;
memtotalField2: TFloatField;
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);
private
procedure GetNoFee;
procedure Creatememtbl;
{ Private declarations }
public
sqlstr:WideString;
{ Public declarations }
end;
var
frm_rp_no_histry: Tfrm_rp_no_histry;
FmDate,ToDate:String;
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;
{$R *.dfm}
procedure Tfrm_rp_no_histry.bsSkinButton5Click(Sender: TObject);
begin
close;
end;
procedure Tfrm_rp_no_histry.FormClose(Sender: TObject;
var Action: TCloseAction);
begin
frm_rp_no_histry.Hide;
frm_rp_no_histry.ManualFloat(frm_rp_no_histry.BoundsRect );
frm_main.freeTabs('frm_rp_no_histry');
action:=cafree;
frm_rp_no_histry:=nil;
end;
procedure Tfrm_rp_no_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_no_histry.bsSkinButton10Click(Sender: TObject);
begin
if cbyear.Text='' then begin
MessageDlg('ͳ<><CDB3><EFBFBD><EFBFBD><EAB2BB>Ϊ<EFBFBD><CEAA>!',mtWarning,[mbOk],0);
exit;
end;
if cbbmonth.Text='' then begin
MessageDlg('<27><>ʼ<EFBFBD>·ݲ<C2B7><DDB2><EFBFBD>Ϊ<EFBFBD><CEAA>!',mtWarning,[mbOk],0);
exit;
end;
if cbemonth.Text='' then begin
MessageDlg('<27><><EFBFBD><EFBFBD><EFBFBD>·ݲ<C2B7><DDB2><EFBFBD>Ϊ<EFBFBD><CEAA>!',mtWarning,[mbOk],0);
exit;
end;
if strtoint(cbemonth.Text)<strtoint(cbbmonth.Text) then begin
MessageDlg('<27><>ʼ<EFBFBD>·ݲ<C2B7><DDB2>ܴ<EFBFBD><DCB4>ڽ<EFBFBD><DABD><EFBFBD><EFBFBD>·<EFBFBD>!',mtWarning,[mbOk],0);
exit;
end;
if cbdate.Text='' then begin
MessageDlg('ͳ<><CDB3><EFBFBD><EFBFBD><EFBFBD>ڲ<EFBFBD><DAB2><EFBFBD>Ϊ<EFBFBD><CEAA>!',mtWarning,[mbOk],0);
exit;
end;
if wwDBComboBox2.Text='' then begin
MessageDlg('ͳ<>Ʊ<EFBFBD>׼<EFBFBD><D7BC><EFBFBD><EFBFBD>Ϊ<EFBFBD><CEAA>!',mtWarning,[mbOk],0);
exit;
end;
// sDate:=FormatDateTime('YYYYMM',aDate);
// aYear:=FormatDateTime('YYYY',aDate);
sqlstr:='';
query_seae(12,'0033');
if sqlstr='' then sqlstr:=' where 1=1 ';
Creatememtbl;
GetNoFee;
end;
procedure Tfrm_rp_no_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_no_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_no_histry.GetNoFee;
var
aQuery:TAdoQuery;
aDate,aToDate:TDate;
strdate,sDate:String;
i:integer;
begin
aQuery:=CreateAdoQuery;
try
with aQuery do begin
aDate:=EncodeDate(strtoint(cbYear.Text),strtoint(cbbmonth.Text),1);
aToDate:=EncodeDate(strtoint(cbYear.Text),strtoint(cbemonth.Text),2);
if not ASSIGNED(frm_sys_progress) then
frm_sys_progress:=tfrm_sys_progress.Create(application);
frm_sys_progress.Show;
frm_sys_progress.bsSkinGauge1.MaxValue:=MonthsBetween(aDate,aToDate)*2;
frm_sys_progress.bsSkinGauge1.MinValue:=0;
frm_sys_progress.bsSkinGauge1.Value:=0;
frm_sys_progress.Update;
while not (aDate>aToDate) do begin
if MonthDays[isLeapYear(strtoint(cbYear.Text)),strtoint(FormatDateTime('MM',aDate))]<strtoint(cbdate.text) then
strdate:=FormatDateTime('YYYY-MM-DD',EncodeDate(strtoint(cbYear.Text),strtoint(FormatDateTime('MM',aDate)),MonthDays[isLeapYear(strtoint(cbYear.Text)),strtoint(FormatDateTime('MM',aDate))]))
else
strdate:=FormatDateTime('YYYY-MM',aDate)+'-'+cbdate.Text;
sDate:=FormatDateTime('YYYYMM',aDate);
CLOSE;
SQL.Clear;
SQL.Add('Select t_ch_fee.<2E>ͻ<EFBFBD><CDBB><EFBFBD><EFBFBD><EFBFBD>, ');
SQL.Add('sum(case t_ch_fee.<2E><><EFBFBD><EFBFBD> when ''<27><>'' then (case t_ch_fee.<2E>ұ<EFBFBD> when ''USD'' then t_ch_fee.<2E><><EFBFBD><EFBFBD>-t_ch_fee.<2E><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> else 0 end) else 0 end) as δ<><CEB4>USD,');
SQL.Add('sum(case t_ch_fee.<2E><><EFBFBD><EFBFBD> when ''<27><>'' then (case t_ch_fee.<2E>ұ<EFBFBD> when ''USD'' then 0 else t_ch_fee.<2E><><EFBFBD><EFBFBD>-t_ch_fee.<2E><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> end) else 0 end) as δ<><CEB4>RMB,');
SQL.Add('sum(case t_ch_fee.<2E><><EFBFBD><EFBFBD> when ''<27><>'' then (t_ch_fee.<2E><><EFBFBD><EFBFBD>-t_ch_fee.<2E><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>)*t_ch_fee.<2E><><EFBFBD><EFBFBD> else 0 end) as δ<>պϼ<D5BA>');
if RxDBLookupCombo3.DisplayValue<>'' then begin
SQL.Add('from t_ch_fee inner join t_op_seae on t_ch_fee.<2E><><EFBFBD><EFBFBD>=t_op_seae.<2E><><EFBFBD><EFBFBD> ');
SQL.Add(sqlstr);
sql.Add(' and t_op_seae.<2E><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><='''+strdate+'''');
if RxDBLookupCombo5.DisplayValues[1]<>'' then
SQL.Add(' and t_ch_fee.<2E>ͻ<EFBFBD><CDBB><EFBFBD><EFBFBD><EFBFBD>='''+RxDBLookupCombo5.DisplayValues[1]+'''');
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]+'''');
SQL.Add('group by t_ch_fee.<2E>ͻ<EFBFBD><CDBB><EFBFBD><EFBFBD><EFBFBD> order by t_ch_fee.<2E>ͻ<EFBFBD><CDBB><EFBFBD><EFBFBD><EFBFBD> ');
end else begin
SQL.Add('from t_ch_fee inner join t_op_seae on t_ch_fee.<2E><><EFBFBD><EFBFBD>=t_op_seae.<2E><><EFBFBD><EFBFBD> ');
SQL.Add(sqlstr);
sql.Add(' and t_op_seae.<2E><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><='''+strdate+'''');
if RxDBLookupCombo5.DisplayValues[1]<>'' then
SQL.Add(' and t_ch_fee.<2E>ͻ<EFBFBD><CDBB><EFBFBD><EFBFBD><EFBFBD>='''+RxDBLookupCombo5.DisplayValues[1]+'''');
SQL.Add('group by t_ch_fee.<2E>ͻ<EFBFBD><CDBB><EFBFBD><EFBFBD><EFBFBD> order by t_ch_fee.<2E>ͻ<EFBFBD><CDBB><EFBFBD><EFBFBD><EFBFBD> ');
end;
Open;
if not IsEmpty then begin
first;
while not eof do begin
if memtblDetail.Locate('ͳ<>Ʊ<EFBFBD>׼',FieldbyName('<27>ͻ<EFBFBD><CDBB><EFBFBD><EFBFBD><EFBFBD>').AsString,[]) then begin
memtblDetail.Edit;
memtblDetail.FieldByName(sDate+'USD').AsFloat:=memtblDetail.FieldByName(sDate+'USD').AsFloat+FieldbyName('δ<><CEB4>USD').AsFloat;
memtblDetail.FieldByName(sDate+'RMB').AsFloat:=memtblDetail.FieldByName(sDate+'RMB').AsFloat+FieldbyName('δ<><CEB4>RMB').AsFloat;
memtblDetail.FieldByName(sDate+'<27>ϼ<EFBFBD>').AsFloat:=memtblDetail.FieldByName(sDate+'<27>ϼ<EFBFBD>').AsFloat+FieldbyName('δ<>պϼ<D5BA>').AsFloat;
memtblDetail.FieldByName('<27>ϼ<EFBFBD>USD').AsFloat:=memtblDetail.FieldByName('<27>ϼ<EFBFBD>USD').AsFloat+FieldbyName('δ<><CEB4>USD').AsFloat;
memtblDetail.FieldByName('<27>ϼ<EFBFBD>RMB').AsFloat:=memtblDetail.FieldByName('<27>ϼ<EFBFBD>RMB').AsFloat+FieldbyName('δ<><CEB4>RMB').AsFloat;
memtblDetail.FieldByName('<27>ϼ<EFBFBD>δ<EFBFBD><CEB4>').AsFloat:=memtblDetail.FieldByName('<27>ϼ<EFBFBD>δ<EFBFBD><CEB4>').AsFloat+FieldbyName('δ<>պϼ<D5BA>').AsFloat;
memtblDetail.Post;
end else begin
memtblDetail.Insert;
for i:=0 to memtbldetail.FieldCount-1 do begin
if memtbldetail.Fields[i].FieldName='ͳ<>Ʊ<EFBFBD>׼' then
memtbldetail.Fields[i].AsString:=FieldByName('<27>ͻ<EFBFBD><CDBB><EFBFBD><EFBFBD><EFBFBD>').AsString
else
memtbldetail.Fields[i].AsFloat:=0;
end;
memtblDetail.FieldByName(sDate+'USD').AsFloat:=memtblDetail.FieldByName(sDate+'USD').AsFloat+FieldbyName('δ<><CEB4>USD').AsFloat;
memtblDetail.FieldByName(sDate+'RMB').AsFloat:=memtblDetail.FieldByName(sDate+'RMB').AsFloat+FieldbyName('δ<><CEB4>RMB').AsFloat;
memtblDetail.FieldByName(sDate+'<27>ϼ<EFBFBD>').AsFloat:=memtblDetail.FieldByName(sDate+'<27>ϼ<EFBFBD>').AsFloat+FieldbyName('δ<>պϼ<D5BA>').AsFloat;
memtblDetail.FieldByName('<27>ϼ<EFBFBD>USD').AsFloat:=memtblDetail.FieldByName('<27>ϼ<EFBFBD>USD').AsFloat+FieldbyName('δ<><CEB4>USD').AsFloat;
memtblDetail.FieldByName('<27>ϼ<EFBFBD>RMB').AsFloat:=memtblDetail.FieldByName('<27>ϼ<EFBFBD>RMB').AsFloat+FieldbyName('δ<><CEB4>RMB').AsFloat;
memtblDetail.FieldByName('<27>ϼ<EFBFBD>δ<EFBFBD><CEB4>').AsFloat:=memtblDetail.FieldByName('<27>ϼ<EFBFBD>δ<EFBFBD><CEB4>').AsFloat+FieldbyName('δ<>պϼ<D5BA>').AsFloat;
memtblDetail.Post;
end;
if memtotal.Locate('<27>·<EFBFBD>',SDate,[]) then begin
memtotal.Edit;
memtotal.FieldByName('<27>ϼ<EFBFBD>').AsFloat:=memtotal.FieldByName('<27>ϼ<EFBFBD>').AsFloat+FieldbyName('δ<>պϼ<D5BA>').AsFloat;
memtotal.Post;
end else begin
memtotal.last;
memtotal.Insert;
memtotal.FieldByName('<27>·<EFBFBD>').AsString:=sDate;
memtotal.FieldByName('<27>ϼ<EFBFBD>').AsFloat:=memtotal.FieldByName('<27>ϼ<EFBFBD>').AsFloat+FieldbyName('δ<>պϼ<D5BA>').AsFloat;
memtotal.Post;
end;
Next;
end;
end;
frm_sys_progress.bsSkinGauge1.Value:=frm_sys_progress.bsSkinGauge1.Value+1;
CLOSE;
SQL.Clear;
SQL.Add('Select v_fee_do_detail.<2E>ͻ<EFBFBD><CDBB><EFBFBD><EFBFBD><EFBFBD>, ');
SQL.Add('sum(case v_fee_do_detail.<2E><><EFBFBD><EFBFBD> when ''<27><>'' then (case v_fee_do_detail.ԭʼ<D4AD>ұ<EFBFBD> when ''USD'' then v_fee_do_detail.ԭʼ<D4AD><CABC><EFBFBD><EFBFBD> else 0 end) else 0 end) as δ<><CEB4>USD,');
SQL.Add('sum(case v_fee_do_detail.<2E><><EFBFBD><EFBFBD> when ''<27><>'' then (case v_fee_do_detail.ԭʼ<D4AD>ұ<EFBFBD> when ''USD'' then 0 else v_fee_do_detail.ԭʼ<D4AD><CABC><EFBFBD><EFBFBD> end) else 0 end) as δ<><CEB4>RMB,');
SQL.Add('sum(case v_fee_do_detail.<2E><><EFBFBD><EFBFBD> when ''<27><>'' then v_fee_do_detail.ԭʼ<D4AD><CABC><EFBFBD><EFBFBD>*v_fee_do_detail.<2E><><EFBFBD><EFBFBD> else 0 end) as δ<>պϼ<D5BA>');
if RxDBLookupCombo3.DisplayValue<>'' then begin
SQL.Add('from v_fee_do_detail inner join t_op_seae on v_fee_do_detail.<2E><><EFBFBD><EFBFBD>=t_op_seae.<2E><><EFBFBD><EFBFBD> ');
SQL.Add(sqlstr);
sql.Add(' and t_op_seae.<2E><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><='''+strdate+''' and v_fee_do_detail.<2E><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>>'''+strdate+'''');
if RxDBLookupCombo5.DisplayValues[1]<>'' then
SQL.Add(' and v_fee_do_detail.<2E>ͻ<EFBFBD><CDBB><EFBFBD><EFBFBD><EFBFBD>='''+RxDBLookupCombo5.DisplayValues[1]+'''');
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]+'''');
SQL.Add('group by v_fee_do_detail.<2E>ͻ<EFBFBD><CDBB><EFBFBD><EFBFBD><EFBFBD> order by v_fee_do_detail.<2E>ͻ<EFBFBD><CDBB><EFBFBD><EFBFBD><EFBFBD> ');
end else begin
SQL.Add('from v_fee_do_detail inner join t_op_seae on v_fee_do_detail.<2E><><EFBFBD><EFBFBD>=t_op_seae.<2E><><EFBFBD><EFBFBD> ');
SQL.Add(sqlstr);
sql.Add(' and t_op_seae.<2E><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><='''+strdate+''' and v_fee_do_detail.<2E><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>>'''+strdate+'''');
if RxDBLookupCombo5.DisplayValues[1]<>'' then
SQL.Add(' and v_fee_do_detail.<2E>ͻ<EFBFBD><CDBB><EFBFBD><EFBFBD><EFBFBD>='''+RxDBLookupCombo5.DisplayValues[1]+'''');
SQL.Add('group by v_fee_do_detail.<2E>ͻ<EFBFBD><CDBB><EFBFBD><EFBFBD><EFBFBD> order by v_fee_do_detail.<2E>ͻ<EFBFBD><CDBB><EFBFBD><EFBFBD><EFBFBD> ');
end;
Open;
if not IsEmpty then begin
first;
while not eof do begin
if memtblDetail.Locate('ͳ<>Ʊ<EFBFBD>׼',FieldbyName('<27>ͻ<EFBFBD><CDBB><EFBFBD><EFBFBD><EFBFBD>').AsString,[]) then begin
memtblDetail.Edit;
memtblDetail.FieldByName(sDate+'USD').AsFloat:=memtblDetail.FieldByName(sDate+'USD').AsFloat+FieldbyName('δ<><CEB4>USD').AsFloat;
memtblDetail.FieldByName(sDate+'RMB').AsFloat:=memtblDetail.FieldByName(sDate+'RMB').AsFloat+FieldbyName('δ<><CEB4>RMB').AsFloat;
memtblDetail.FieldByName(sDate+'<27>ϼ<EFBFBD>').AsFloat:=memtblDetail.FieldByName(sDate+'<27>ϼ<EFBFBD>').AsFloat+FieldbyName('δ<>պϼ<D5BA>').AsFloat;
memtblDetail.FieldByName('<27>ϼ<EFBFBD>USD').AsFloat:=memtblDetail.FieldByName('<27>ϼ<EFBFBD>USD').AsFloat+FieldbyName('δ<><CEB4>USD').AsFloat;
memtblDetail.FieldByName('<27>ϼ<EFBFBD>RMB').AsFloat:=memtblDetail.FieldByName('<27>ϼ<EFBFBD>RMB').AsFloat+FieldbyName('δ<><CEB4>RMB').AsFloat;
memtblDetail.FieldByName('<27>ϼ<EFBFBD>δ<EFBFBD><CEB4>').AsFloat:=memtblDetail.FieldByName('<27>ϼ<EFBFBD>δ<EFBFBD><CEB4>').AsFloat+FieldbyName('δ<>պϼ<D5BA>').AsFloat;
memtblDetail.Post;
end else begin
memtblDetail.Insert;
for i:=0 to memtbldetail.FieldCount-1 do begin
if memtbldetail.Fields[i].FieldName='ͳ<>Ʊ<EFBFBD>׼' then
memtbldetail.Fields[i].AsString:=FieldByName('<27>ͻ<EFBFBD><CDBB><EFBFBD><EFBFBD><EFBFBD>').AsString
else
memtbldetail.Fields[i].AsFloat:=0;
end;
memtblDetail.FieldByName(sDate+'USD').AsFloat:=memtblDetail.FieldByName(sDate+'USD').AsFloat+FieldbyName('δ<><CEB4>USD').AsFloat;
memtblDetail.FieldByName(sDate+'RMB').AsFloat:=memtblDetail.FieldByName(sDate+'RMB').AsFloat+FieldbyName('δ<><CEB4>RMB').AsFloat;
memtblDetail.FieldByName(sDate+'<27>ϼ<EFBFBD>').AsFloat:=memtblDetail.FieldByName(sDate+'<27>ϼ<EFBFBD>').AsFloat+FieldbyName('δ<>պϼ<D5BA>').AsFloat;
memtblDetail.FieldByName('<27>ϼ<EFBFBD>USD').AsFloat:=memtblDetail.FieldByName('<27>ϼ<EFBFBD>USD').AsFloat+FieldbyName('δ<><CEB4>USD').AsFloat;
memtblDetail.FieldByName('<27>ϼ<EFBFBD>RMB').AsFloat:=memtblDetail.FieldByName('<27>ϼ<EFBFBD>RMB').AsFloat+FieldbyName('δ<><CEB4>RMB').AsFloat;
memtblDetail.FieldByName('<27>ϼ<EFBFBD>δ<EFBFBD><CEB4>').AsFloat:=memtblDetail.FieldByName('<27>ϼ<EFBFBD>δ<EFBFBD><CEB4>').AsFloat+FieldbyName('δ<>պϼ<D5BA>').AsFloat;
memtblDetail.Post;
end;
if memtotal.Locate('<27>·<EFBFBD>',SDate,[]) then begin
memtotal.Edit;
memtotal.FieldByName('<27>ϼ<EFBFBD>').AsFloat:=memtotal.FieldByName('<27>ϼ<EFBFBD>').AsFloat+FieldbyName('δ<>պϼ<D5BA>').AsFloat;
memtotal.Post;
end else begin
memtotal.last;
memtotal.Insert;
memtotal.FieldByName('<27>·<EFBFBD>').AsString:=sDate;
memtotal.FieldByName('<27>ϼ<EFBFBD>').AsFloat:=memtotal.FieldByName('<27>ϼ<EFBFBD>').AsFloat+FieldbyName('δ<>պϼ<D5BA>').AsFloat;
memtotal.Post;
end;
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_no_histry.Creatememtbl;
var
aDate,aToDate:TDate;
sDate,aYear,aMonth:String;
aColumn:TdxDBTreeListColumn;
aBand:TdxTreeListBand;
i:integer;
begin
dxDBGrid1.Bands.Clear;
// dxDBGrid1.DestroyColumns;
while dxDBGrid1.columncount>0 do
begin
dxDBGrid1.Columns[0].Destroy;
end;
memtblDetail.Close;
memtblDetail.EmptyTable;
memtblDetail.Fields.Clear;
memtblDetail.FieldDefs.Clear;
memtblDetail.FieldDefs.Add('ͳ<>Ʊ<EFBFBD>׼', ftString, 20, false);
aBand:=dxDBGrid1.Bands.Add;
aBand.Caption:='<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϣ';
aColumn:=dxDBGrid1.CreateColumn(TdxDBGridColumn);
aColumn.Caption:=wwDBComboBox2.Text;
aColumn.BandIndex:=0;
aColumn.FieldName:='ͳ<>Ʊ<EFBFBD>׼';
i:=1;
aDate:=EncodeDate(strtoint(cbYear.Text),strtoint(cbbmonth.Text),1);
aToDate:=EncodeDate(strtoint(cbYear.Text),strtoint(cbemonth.Text),2);
while not (aDate>aToDate) do begin
sDate:=FormatDateTime('YYYYMM',aDate);
aYear:=FormatDateTime('YYYY',aDate);
aMonth:=FormatDateTime('MM',aDate);
aBand:=dxDBGrid1.Bands.Add;
aBand.Caption:=aYear+'<27><>'+aMonth+'<27><>';
aColumn:=dxDBGrid1.CreateColumn(TdxDBGridColumn);
aColumn.Caption:='δ<><CEB4>USD';
aColumn.FieldName:=sDate+'USD';
aColumn.SummaryFooterType:=cstSum;
aColumn.BandIndex:=i;
aColumn:=dxDBGrid1.CreateColumn(TdxDBGridColumn);
aColumn.Caption:='δ<><CEB4>RMB';
aColumn.FieldName:=sDate+'RMB';
aColumn.SummaryFooterType:=cstSum;
aColumn.BandIndex:=i;
aColumn:=dxDBGrid1.CreateColumn(TdxDBGridColumn);
aColumn.Caption:='δ<>պϼ<D5BA>';
aColumn.FieldName:=sDate+'<27>ϼ<EFBFBD>';
aColumn.SummaryFooterType:=cstSum;
aColumn.BandIndex:=i;
memtblDetail.FieldDefs.Add(sDate+'USD',ftFloat, 0, false);
memtblDetail.FieldDefs.Add(sDate+'RMB',ftFloat, 0, false);
memtblDetail.FieldDefs.Add(sDate+'<27>ϼ<EFBFBD>',ftFloat, 0, false);
aDate:=IncMonth(aDate,1);
Inc(i);
end;
aBand:=dxDBGrid1.Bands.Add;
aBand.Caption:='<27>ϼ<EFBFBD>';
aColumn:=dxDBGrid1.CreateColumn(TdxDBGridColumn);
aColumn.Caption:='δ<><CEB4>USD';
aColumn.FieldName:='<27>ϼ<EFBFBD>USD';
aColumn.SummaryFooterType:=cstSum;
aColumn.BandIndex:=i;
aColumn:=dxDBGrid1.CreateColumn(TdxDBGridColumn);
aColumn.Caption:='δ<><CEB4>RMB';
aColumn.FieldName:='<27>ϼ<EFBFBD>RMB';
aColumn.SummaryFooterType:=cstSum;
aColumn.BandIndex:=i;
aColumn:=dxDBGrid1.CreateColumn(TdxDBGridColumn);
aColumn.Caption:='δ<>պϼ<D5BA>';
aColumn.FieldName:='<27>ϼ<EFBFBD>δ<EFBFBD><CEB4>';
aColumn.SummaryFooterType:=cstSum;
aColumn.BandIndex:=i;
memtblDetail.FieldDefs.Add('<27>ϼ<EFBFBD>USD',ftFloat, 0, false);
memtblDetail.FieldDefs.Add('<27>ϼ<EFBFBD>RMB',ftFloat, 0, false);
memtblDetail.FieldDefs.Add('<27>ϼ<EFBFBD>δ<EFBFBD><CEB4>',ftFloat, 0, false);
memtblDetail.CreateTable;
memtblDetail.Open;
memtotal.close;
memtotal.EmptyTable;
memtotal.Open;
memtotal.SortOn('<27>·<EFBFBD>',[]);
end;
procedure Tfrm_rp_no_histry.bsSkinCheckRadioBox3Click(Sender: TObject);
begin
GetNoFee;
end;
procedure Tfrm_rp_no_histry.bsSkinCheckRadioBox2Click(Sender: TObject);
begin
GetNoFee;
end;
procedure Tfrm_rp_no_histry.FormShow(Sender: TObject);
begin
cbyear.Items.IndexOf(FormatDateTime('YYYY',Now));
cbyear.text:=FormatDateTime('YYYY',Now);
cbbmonth.Items.IndexOf('01');
cbbmonth.text:='01';
cbemonth.Items.IndexOf(FormatDateTime('MM',Now));
cbemonth.text:=FormatDateTime('MM',Now);
cbdate.Items.IndexOf('31');
cbdate.text:='31';
end;
procedure Tfrm_rp_no_histry.N1101Click(Sender: TObject);
begin
chartpreview(frm_rp_no_histry,dbchart3);
end;
end.