|
|
unit u_rp_hl_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, TeeFunci,
|
|
|
bsSkinBoxCtrls;
|
|
|
|
|
|
type
|
|
|
Tfrm_rp_hl_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;
|
|
|
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;
|
|
|
bsSkinPanel3: TbsSkinPanel;
|
|
|
Label3: TLabel;
|
|
|
Label4: TLabel;
|
|
|
Label1: TLabel;
|
|
|
Label2: TLabel;
|
|
|
Label5: TLabel;
|
|
|
Label6: TLabel;
|
|
|
Label22: TLabel;
|
|
|
Label23: TLabel;
|
|
|
cbmonth: TwwDBComboBox;
|
|
|
cbYear: TwwDBComboBox;
|
|
|
cbeYear: TwwDBComboBox;
|
|
|
cbemonth: TwwDBComboBox;
|
|
|
RxDBLookupCombo10: TRxDBLookupCombo;
|
|
|
RxDBLookupCombo12: TRxDBLookupCombo;
|
|
|
dxDBGrid1: TdxDBGrid;
|
|
|
dxDBGrid1Column5: TdxDBGridColumn;
|
|
|
dxDBGridMaskColumn95: TdxDBGridMaskColumn;
|
|
|
bsSkinComboBox1: TbsSkinComboBox;
|
|
|
bsSkinLabel1: TbsSkinLabel;
|
|
|
bsSkinLabel2: TbsSkinLabel;
|
|
|
bsSkinComboBox2: TbsSkinComboBox;
|
|
|
RxDBLookupCombo2: TRxDBLookupCombo;
|
|
|
Label9: TLabel;
|
|
|
Label12: TLabel;
|
|
|
RxDBLookupCombo1: TRxDBLookupCombo;
|
|
|
Label39: TLabel;
|
|
|
wwDBDateTimePicker7: TwwDBDateTimePicker;
|
|
|
wwDBDateTimePicker8: TwwDBDateTimePicker;
|
|
|
Label7: TLabel;
|
|
|
Edit1: TEdit;
|
|
|
Label8: TLabel;
|
|
|
procedure bsSkinButton5Click(Sender: TObject);
|
|
|
procedure FormClose(Sender: TObject; var Action: TCloseAction);
|
|
|
procedure Panel1Resize(Sender: TObject);
|
|
|
procedure bsSkinButton1Click(Sender: TObject);
|
|
|
procedure bsSkinButton10Click(Sender: TObject);
|
|
|
private
|
|
|
{ Private declarations }
|
|
|
procedure CreatememtblTEU;
|
|
|
procedure GetTeu;
|
|
|
procedure Creatememtbllr;
|
|
|
procedure Getlr;
|
|
|
procedure Getywlr;
|
|
|
procedure CreatememtblCount;
|
|
|
procedure GetCount;
|
|
|
|
|
|
procedure Creatememtblzjzy;
|
|
|
procedure Getzjzy;
|
|
|
|
|
|
procedure Creatememtblnodr;
|
|
|
procedure Getnodr;
|
|
|
|
|
|
procedure Creatememtblnocr;
|
|
|
procedure Getnocr;
|
|
|
|
|
|
procedure Creatememtblmlv;
|
|
|
procedure Getmlv;
|
|
|
|
|
|
public
|
|
|
{ Public declarations }
|
|
|
end;
|
|
|
|
|
|
var
|
|
|
frm_rp_hl_histry: Tfrm_rp_hl_histry;
|
|
|
FmDate,ToDate:String;
|
|
|
sqlstr:WideString;
|
|
|
|
|
|
implementation
|
|
|
|
|
|
uses u_main, my_sys_function,u_sys_progress;
|
|
|
|
|
|
{$R *.dfm}
|
|
|
|
|
|
|
|
|
procedure Tfrm_rp_hl_histry.CreatememtblTEU;
|
|
|
var
|
|
|
aDate,aToDate:TDate;
|
|
|
sDate,aYear,aMonth:String;
|
|
|
aColumn:TdxDBTreeListColumn;
|
|
|
aBand:TdxTreeListBand;
|
|
|
i:integer;
|
|
|
begin
|
|
|
|
|
|
|
|
|
dxDBGrid1.Bands.Clear;
|
|
|
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, 60, false);
|
|
|
|
|
|
aBand:=dxDBGrid1.Bands.Add;
|
|
|
aBand.Caption:='<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϣ';
|
|
|
aBand.Fixed:=BFLEFT;
|
|
|
aColumn:=dxDBGrid1.CreateColumn(TdxDBGridColumn);
|
|
|
if bsSkinComboBox1.ItemIndex<>0 then
|
|
|
aColumn.Caption:=bsSkinComboBox1.Text;
|
|
|
aColumn.BandIndex:=0;
|
|
|
aColumn.FieldName:='ͳ<>Ʊ<EFBFBD>';
|
|
|
|
|
|
|
|
|
|
|
|
aDate:=EncodeDate(strtoint(cbyear.text),strtoint(cbmonth.Text),1);
|
|
|
aToDate:=EncodeDate(strtoint(cbeyear.text),strtoint(cbemonth.Text),2);
|
|
|
i:=1;
|
|
|
|
|
|
while aDate<aToDate do begin
|
|
|
sDate:=FormatDateTime('YYYYMM',aDate);
|
|
|
aYear:=FormatDateTime('YYYY',aDate);
|
|
|
aMonth:=FormatDateTime('MM',aDate);
|
|
|
aBand:=dxDBGrid1.Bands.Add;
|
|
|
aBand.Caption:=aYear+aMonth;
|
|
|
|
|
|
aColumn:=dxDBGrid1.CreateColumn(TdxDBGridColumn);
|
|
|
aColumn.Caption:='TEU';
|
|
|
aColumn.FieldName:=sDate+'TEU';
|
|
|
aColumn.Width:=60;
|
|
|
aColumn.SummaryFooterType:=cstSum;
|
|
|
aColumn.BandIndex:=i;
|
|
|
memtblDetail.FieldDefs.Add(sDate+'TEU',ftFloat, 0, false);
|
|
|
aDate:=IncMonth(aDate,1);
|
|
|
Inc(i);
|
|
|
end;
|
|
|
|
|
|
|
|
|
aBand:=dxDBGrid1.Bands.Add;
|
|
|
aBand.Caption:='<27>ϼ<EFBFBD>';
|
|
|
aColumn:=dxDBGrid1.CreateColumn(TdxDBGridColumn);
|
|
|
aColumn.Caption:='TEU';
|
|
|
aColumn.FieldName:='<27>ϼ<EFBFBD>TEU';
|
|
|
aColumn.SummaryFooterType:=cstSum;
|
|
|
aColumn.BandIndex:=i;
|
|
|
aColumn.Width:=60;
|
|
|
memtblDetail.FieldDefs.Add('<27>ϼ<EFBFBD>TEU',ftFloat, 0, false);
|
|
|
memtblDetail.CreateTable;
|
|
|
memtblDetail.Open;
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
procedure Tfrm_rp_hl_histry.GetTeu;
|
|
|
var
|
|
|
aQuery:TAdoQuery;
|
|
|
aDate,aToDate:TDate;
|
|
|
strdate,stredate,sDate,sqlstr:String;
|
|
|
i:integer;
|
|
|
// S:TChartSeries;
|
|
|
begin
|
|
|
|
|
|
|
|
|
|
|
|
aQuery:=CreateAdoQuery;
|
|
|
|
|
|
try
|
|
|
with aQuery do begin
|
|
|
aDate:=EncodeDate(strtoint(cbYear.Text),strtoint(cbmonth.Text),1);
|
|
|
aToDate:=EncodeDate(strtoint(cbeYear.Text),strtoint(cbemonth.Text),2);
|
|
|
|
|
|
if not ASSIGNED(frm_sys_progress) then
|
|
|
frm_sys_progress:=tfrm_sys_progress.Create(application);
|
|
|
frm_sys_progress.Show;
|
|
|
if MonthsBetween(aDate,aToDate)=0 then
|
|
|
frm_sys_progress.bsSkinGauge1.MaxValue:=1
|
|
|
|
|
|
else
|
|
|
frm_sys_progress.bsSkinGauge1.MaxValue:=MonthsBetween(aDate,aToDate);
|
|
|
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',aDate)),strtoint(FormatDateTime('MM',aDate)),MonthDays[isLeapYear(strtoint(FormatDateTime('YYYY',aDate))),strtoint(FormatDateTime('MM',aDate))]));
|
|
|
stredate:=FormatDateTime('YYYY-MM-DD',aDate);
|
|
|
sDate:=FormatDateTime('YYYYMM',aDate);
|
|
|
CLOSE;
|
|
|
SQL.Clear;
|
|
|
if(bsSkinComboBox1.text='ί<>е<EFBFBD>λ_<CEBB><5F><EFBFBD><EFBFBD>˾') then begin
|
|
|
SQL.Add('Select V_op_bscard_All.ί<>е<EFBFBD>λ+''_''+V_op_bscard_All.<2E><><EFBFBD><EFBFBD>˾ ί<>е<EFBFBD>λ_<CEBB><5F><EFBFBD><EFBFBD>˾ ');
|
|
|
SQL.Add(',sum(<28><>TEU) TEU');
|
|
|
SQL.Add('from V_op_bscard_All where V_op_bscard_All.<2E><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>>='''+stredate+''' and V_op_bscard_All.<2E><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><='''+strdate+'''');
|
|
|
if RxDBLookupCombo2.DisplayValues[1]<>'' then
|
|
|
SQL.Add(' and V_op_bscard_All.ί<>е<EFBFBD>λ='''+RxDBLookupCombo2.DisplayValues[1]+''' ');
|
|
|
if RxDBLookupCombo1.DisplayValues[1]<>'' then
|
|
|
SQL.Add(' and V_op_bscard_All.<2E><><EFBFBD><EFBFBD>˾='''+RxDBLookupCombo1.DisplayValues[1]+''' ');
|
|
|
|
|
|
if wwDBDateTimePicker7.text<>'' then
|
|
|
SQL.Add(' and V_op_bscard_All.ƾ֤<C6BE><D6A4><EFBFBD><EFBFBD>>='''+wwDBDateTimePicker7.text+''' ');
|
|
|
if wwDBDateTimePicker8.text<>'' then
|
|
|
SQL.Add(' and V_op_bscard_All.ƾ֤<C6BE><D6A4><EFBFBD><EFBFBD><='''+wwDBDateTimePicker8.text+''' ');
|
|
|
if Edit1.text<>''then
|
|
|
SQL.Add(' and V_op_bscard_All.<2E>˷<EFBFBD>Э<EFBFBD><D0AD><EFBFBD><EFBFBD> like ''%'+Edit1.text+'%'' ');
|
|
|
|
|
|
SQL.Add('group by V_op_bscard_All.ί<>е<EFBFBD>λ+''_''+V_op_bscard_All.<2E><><EFBFBD><EFBFBD>˾ ');
|
|
|
|
|
|
end else if(bsSkinComboBox1.text='<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>_<EFBFBD><5F><EFBFBD><EFBFBD>') then begin
|
|
|
SQL.Add('Select V_op_bscard_All.<2E><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>+''_''+V_op_bscard_All.<2E><><EFBFBD>۲<EFBFBD><DBB2><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>_<EFBFBD><5F><EFBFBD><EFBFBD> ');
|
|
|
SQL.Add(',sum(<28><>TEU) TEU');
|
|
|
SQL.Add('from V_op_bscard_All where V_op_bscard_All.<2E><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>>='''+stredate+''' and V_op_bscard_All.<2E><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><='''+strdate+'''');
|
|
|
if RxDBLookupCombo2.DisplayValues[1]<>'' then
|
|
|
SQL.Add(' and V_op_bscard_All.ί<>е<EFBFBD>λ='''+RxDBLookupCombo2.DisplayValues[1]+''' ');
|
|
|
if RxDBLookupCombo1.DisplayValues[1]<>'' then
|
|
|
SQL.Add(' and V_op_bscard_All.<2E><><EFBFBD><EFBFBD>˾='''+RxDBLookupCombo1.DisplayValues[1]+''' ');
|
|
|
|
|
|
if wwDBDateTimePicker7.text<>'' then
|
|
|
SQL.Add(' and V_op_bscard_All.ƾ֤<C6BE><D6A4><EFBFBD><EFBFBD>>='''+wwDBDateTimePicker7.text+''' ');
|
|
|
if wwDBDateTimePicker8.text<>'' then
|
|
|
SQL.Add(' and V_op_bscard_All.ƾ֤<C6BE><D6A4><EFBFBD><EFBFBD><='''+wwDBDateTimePicker8.text+''' ');
|
|
|
if Edit1.text<>''then
|
|
|
SQL.Add(' and V_op_bscard_All.<2E>˷<EFBFBD>Э<EFBFBD><D0AD><EFBFBD><EFBFBD> like ''%'+Edit1.text+'%'' ');
|
|
|
|
|
|
SQL.Add('group by V_op_bscard_All.<2E><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>+''_''+V_op_bscard_All.<2E><><EFBFBD>۲<EFBFBD><DBB2><EFBFBD> ');
|
|
|
|
|
|
end else begin
|
|
|
SQL.Add('Select V_op_bscard_All.'+bsSkinComboBox1.text+'');
|
|
|
SQL.Add(',sum(<28><>TEU) TEU');
|
|
|
SQL.Add('from V_op_bscard_All where V_op_bscard_All.<2E><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>>='''+stredate+''' and V_op_bscard_All.<2E><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><='''+strdate+'''');
|
|
|
if RxDBLookupCombo2.DisplayValues[1]<>'' then
|
|
|
SQL.Add(' and V_op_bscard_All.ί<>е<EFBFBD>λ='''+RxDBLookupCombo2.DisplayValues[1]+''' ');
|
|
|
if RxDBLookupCombo1.DisplayValues[1]<>'' then
|
|
|
SQL.Add(' and V_op_bscard_All.<2E><><EFBFBD><EFBFBD>˾='''+RxDBLookupCombo1.DisplayValues[1]+''' ');
|
|
|
if wwDBDateTimePicker7.text<>'' then
|
|
|
SQL.Add(' and V_op_bscard_All.ƾ֤<C6BE><D6A4><EFBFBD><EFBFBD>>='''+wwDBDateTimePicker7.text+''' ');
|
|
|
if wwDBDateTimePicker8.text<>'' then
|
|
|
SQL.Add(' and V_op_bscard_All.ƾ֤<C6BE><D6A4><EFBFBD><EFBFBD><='''+wwDBDateTimePicker8.text+''' ');
|
|
|
if Edit1.text<>''then
|
|
|
SQL.Add(' and V_op_bscard_All.<2E>˷<EFBFBD>Э<EFBFBD><D0AD><EFBFBD><EFBFBD> like ''%'+Edit1.text+'%'' ');
|
|
|
|
|
|
SQL.Add('group by V_op_bscard_All.'+bsSkinComboBox1.text+'');
|
|
|
end;
|
|
|
Open;
|
|
|
if not IsEmpty then begin
|
|
|
first;
|
|
|
while not eof do begin
|
|
|
if memtblDetail.Locate('ͳ<>Ʊ<EFBFBD>',FieldbyName(bsSkinComboBox1.text).AsString,[]) then begin
|
|
|
memtblDetail.Edit;
|
|
|
memtblDetail.FieldByName(sDate+'TEU').AsFloat:=memtblDetail.FieldByName(sDate+'TEU').AsFloat+FieldByName('TEU').AsFloat;
|
|
|
memtblDetail.FieldByName('<27>ϼ<EFBFBD>TEU').AsFloat:=memtblDetail.FieldByName('<27>ϼ<EFBFBD>TEU').AsFloat+FieldByName('TEU').AsFloat;
|
|
|
memtblDetail.Post;
|
|
|
end else begin
|
|
|
memtblDetail.Insert;
|
|
|
for i:=0 to memtbldetail.FieldCount-1 do begin
|
|
|
if memtbldetail.Fields[i].FieldName='ͳ<>Ʊ<EFBFBD>' then begin
|
|
|
memtbldetail.Fields[i].AsString:=FieldByName(bsSkinComboBox1.text).AsString
|
|
|
end else
|
|
|
memtbldetail.Fields[i].AsFloat:=0;
|
|
|
end;
|
|
|
memtblDetail.FieldByName(sDate+'TEU').AsFloat:=memtblDetail.FieldByName(sDate+'TEU').AsFloat+FieldbyName('TEU').AsFloat;
|
|
|
memtblDetail.FieldByName('<27>ϼ<EFBFBD>TEU').AsFloat:=memtblDetail.FieldByName('<27>ϼ<EFBFBD>TEU').AsFloat+FieldbyName('TEU').AsFloat;
|
|
|
memtblDetail.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_hl_histry.Creatememtbllr;
|
|
|
var
|
|
|
aDate,aToDate:TDate;
|
|
|
sDate,aYear,aMonth:String;
|
|
|
aColumn:TdxDBTreeListColumn;
|
|
|
aBand:TdxTreeListBand;
|
|
|
i:integer;
|
|
|
begin
|
|
|
|
|
|
|
|
|
dxDBGrid1.Bands.Clear;
|
|
|
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, 60, false);
|
|
|
|
|
|
aBand:=dxDBGrid1.Bands.Add;
|
|
|
aBand.Caption:='<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϣ';
|
|
|
aBand.Fixed:=BFLEFT;
|
|
|
aColumn:=dxDBGrid1.CreateColumn(TdxDBGridColumn);
|
|
|
if bsSkinComboBox1.ItemIndex<>0 then
|
|
|
aColumn.Caption:=bsSkinComboBox1.Text;
|
|
|
aColumn.BandIndex:=0;
|
|
|
aColumn.FieldName:='ͳ<>Ʊ<EFBFBD>';
|
|
|
|
|
|
|
|
|
|
|
|
aDate:=EncodeDate(strtoint(cbyear.text),strtoint(cbmonth.Text),1);
|
|
|
aToDate:=EncodeDate(strtoint(cbeyear.text),strtoint(cbemonth.Text),2);
|
|
|
i:=1;
|
|
|
|
|
|
while aDate<aToDate do begin
|
|
|
sDate:=FormatDateTime('YYYYMM',aDate);
|
|
|
aYear:=FormatDateTime('YYYY',aDate);
|
|
|
aMonth:=FormatDateTime('MM',aDate);
|
|
|
aBand:=dxDBGrid1.Bands.Add;
|
|
|
aBand.Caption:=aYear+aMonth;
|
|
|
|
|
|
aColumn:=dxDBGrid1.CreateColumn(TdxDBGridColumn);
|
|
|
aColumn.Caption:='<27><><EFBFBD><EFBFBD>';
|
|
|
aColumn.FieldName:=sDate+'<27><><EFBFBD><EFBFBD>';
|
|
|
aColumn.Width:=100;
|
|
|
aColumn.SummaryFooterType:=cstSum;
|
|
|
aColumn.BandIndex:=i;
|
|
|
memtblDetail.FieldDefs.Add(sDate+'<27><><EFBFBD><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:='<27><><EFBFBD><EFBFBD>';
|
|
|
aColumn.FieldName:='<27>ϼ<EFBFBD><CFBC><EFBFBD><EFBFBD><EFBFBD>';
|
|
|
aColumn.SummaryFooterType:=cstSum;
|
|
|
aColumn.BandIndex:=i;
|
|
|
aColumn.Width:=120;
|
|
|
memtblDetail.FieldDefs.Add('<27>ϼ<EFBFBD><CFBC><EFBFBD><EFBFBD><EFBFBD>',ftFloat, 0, false);
|
|
|
memtblDetail.CreateTable;
|
|
|
memtblDetail.Open;
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
procedure Tfrm_rp_hl_histry.Getlr;
|
|
|
var
|
|
|
aQuery:TAdoQuery;
|
|
|
aDate,aToDate:TDate;
|
|
|
strdate,stredate,sDate:String;
|
|
|
i:integer;
|
|
|
// S:TChartSeries;
|
|
|
begin
|
|
|
|
|
|
|
|
|
|
|
|
aQuery:=CreateAdoQuery_rpt();
|
|
|
aQuery.CommandTimeout:=120000;
|
|
|
try
|
|
|
with aQuery do begin
|
|
|
aDate:=EncodeDate(strtoint(cbYear.Text),strtoint(cbmonth.Text),1);
|
|
|
aToDate:=EncodeDate(strtoint(cbeYear.Text),strtoint(cbemonth.Text),2);
|
|
|
|
|
|
if not ASSIGNED(frm_sys_progress) then
|
|
|
frm_sys_progress:=tfrm_sys_progress.Create(application);
|
|
|
frm_sys_progress.Show;
|
|
|
if MonthsBetween(aDate,aToDate)=0 then
|
|
|
frm_sys_progress.bsSkinGauge1.MaxValue:=1
|
|
|
|
|
|
else
|
|
|
frm_sys_progress.bsSkinGauge1.MaxValue:=MonthsBetween(aDate,aToDate);
|
|
|
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',aDate)),strtoint(FormatDateTime('MM',aDate)),MonthDays[isLeapYear(strtoint(FormatDateTime('YYYY',aDate))),strtoint(FormatDateTime('MM',aDate))]));
|
|
|
stredate:=FormatDateTime('YYYY-MM-DD',aDate);
|
|
|
sDate:=FormatDateTime('YYYYMM',aDate);
|
|
|
CLOSE;
|
|
|
SQL.Clear;
|
|
|
if(bsSkinComboBox1.text='ί<>е<EFBFBD>λ_<CEBB><5F><EFBFBD><EFBFBD>˾') then begin
|
|
|
SQL.Add('Select v_op_bscard.ί<>е<EFBFBD>λ+''_''+v_op_bscard.<2E><><EFBFBD><EFBFBD>˾ ί<>е<EFBFBD>λ_<CEBB><5F><EFBFBD><EFBFBD>˾ ');
|
|
|
SQL.Add(',sum(ë<><C3AB><EFBFBD><EFBFBD>) <20><><EFBFBD><EFBFBD>');
|
|
|
SQL.Add('from v_op_bscard where ҵ<><D2B5><EFBFBD><EFBFBD><EFBFBD><EFBFBD>=''<27><><EFBFBD>˳<EFBFBD><CBB3><EFBFBD>'' and v_op_bscard.<2E><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>>='''+stredate+''' and v_op_bscard.<2E><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><='''+strdate+'''');
|
|
|
if RxDBLookupCombo2.DisplayValues[1]<>'' then
|
|
|
SQL.Add(' and V_op_bscard.ί<>е<EFBFBD>λ='''+RxDBLookupCombo2.DisplayValues[1]+''' ');
|
|
|
if RxDBLookupCombo1.DisplayValues[1]<>'' then
|
|
|
SQL.Add(' and V_op_bscard.<2E><><EFBFBD><EFBFBD>˾='''+RxDBLookupCombo1.DisplayValues[1]+''' ');
|
|
|
if wwDBDateTimePicker7.text<>'' then
|
|
|
SQL.Add(' and V_op_bscard.ƾ֤<C6BE><D6A4><EFBFBD><EFBFBD>>='''+wwDBDateTimePicker7.text+''' ');
|
|
|
if wwDBDateTimePicker8.text<>'' then
|
|
|
SQL.Add(' and V_op_bscard.ƾ֤<C6BE><D6A4><EFBFBD><EFBFBD><='''+wwDBDateTimePicker8.text+''' ');
|
|
|
if Edit1.text<>''then
|
|
|
SQL.Add(' and V_op_bscard.<2E>˷<EFBFBD>Э<EFBFBD><D0AD><EFBFBD><EFBFBD> like ''%'+Edit1.text+'%'' ');
|
|
|
|
|
|
|
|
|
SQL.Add('group by v_op_bscard.ί<>е<EFBFBD>λ+''_''+v_op_bscard.<2E><><EFBFBD><EFBFBD>˾ ');
|
|
|
|
|
|
end else if(bsSkinComboBox1.text='<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>_<EFBFBD><5F><EFBFBD><EFBFBD>') then begin
|
|
|
SQL.Add('Select v_op_bscard.<2E><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>+''_''+v_op_bscard.<2E><><EFBFBD>۲<EFBFBD><DBB2><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>_<EFBFBD><5F><EFBFBD><EFBFBD> ');
|
|
|
SQL.Add(',sum(ë<><C3AB><EFBFBD><EFBFBD>) <20><><EFBFBD><EFBFBD>');
|
|
|
SQL.Add('from v_op_bscard where ҵ<><D2B5><EFBFBD><EFBFBD><EFBFBD><EFBFBD>=''<27><><EFBFBD>˳<EFBFBD><CBB3><EFBFBD>'' and v_op_bscard.<2E><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>>='''+stredate+''' and v_op_bscard.<2E><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><='''+strdate+'''');
|
|
|
if RxDBLookupCombo2.DisplayValues[1]<>'' then
|
|
|
SQL.Add(' and V_op_bscard.ί<>е<EFBFBD>λ='''+RxDBLookupCombo2.DisplayValues[1]+''' ');
|
|
|
if RxDBLookupCombo1.DisplayValues[1]<>'' then
|
|
|
SQL.Add(' and V_op_bscard.<2E><><EFBFBD><EFBFBD>˾='''+RxDBLookupCombo1.DisplayValues[1]+''' ');
|
|
|
if wwDBDateTimePicker7.text<>'' then
|
|
|
SQL.Add(' and V_op_bscard.ƾ֤<C6BE><D6A4><EFBFBD><EFBFBD>>='''+wwDBDateTimePicker7.text+''' ');
|
|
|
if wwDBDateTimePicker8.text<>'' then
|
|
|
SQL.Add(' and V_op_bscard.ƾ֤<C6BE><D6A4><EFBFBD><EFBFBD><='''+wwDBDateTimePicker8.text+''' ');
|
|
|
if Edit1.text<>''then
|
|
|
SQL.Add(' and V_op_bscard.<2E>˷<EFBFBD>Э<EFBFBD><D0AD><EFBFBD><EFBFBD> like ''%'+Edit1.text+'%'' ');
|
|
|
|
|
|
|
|
|
SQL.Add('group by v_op_bscard.<2E><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>+''_''+v_op_bscard.<2E><><EFBFBD>۲<EFBFBD><DBB2><EFBFBD> ');
|
|
|
|
|
|
end else begin
|
|
|
|
|
|
SQL.Add('Select v_op_bscard.'+bsSkinComboBox1.text+'');
|
|
|
SQL.Add(',sum(ë<><C3AB><EFBFBD><EFBFBD>) <20><><EFBFBD><EFBFBD>');
|
|
|
SQL.Add('from v_op_bscard where ҵ<><D2B5><EFBFBD><EFBFBD><EFBFBD><EFBFBD>=''<27><><EFBFBD>˳<EFBFBD><CBB3><EFBFBD>'' and v_op_bscard.<2E><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>>='''+stredate+''' and v_op_bscard.<2E><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><='''+strdate+'''');
|
|
|
if RxDBLookupCombo2.DisplayValues[1]<>'' then
|
|
|
SQL.Add(' and V_op_bscard.ί<>е<EFBFBD>λ='''+RxDBLookupCombo2.DisplayValues[1]+''' ');
|
|
|
if RxDBLookupCombo1.DisplayValues[1]<>'' then
|
|
|
SQL.Add(' and V_op_bscard.<2E><><EFBFBD><EFBFBD>˾='''+RxDBLookupCombo1.DisplayValues[1]+''' ');
|
|
|
if wwDBDateTimePicker7.text<>'' then
|
|
|
SQL.Add(' and V_op_bscard.ƾ֤<C6BE><D6A4><EFBFBD><EFBFBD>>='''+wwDBDateTimePicker7.text+''' ');
|
|
|
if wwDBDateTimePicker8.text<>'' then
|
|
|
SQL.Add(' and V_op_bscard.ƾ֤<C6BE><D6A4><EFBFBD><EFBFBD><='''+wwDBDateTimePicker8.text+''' ');
|
|
|
if Edit1.text<>''then
|
|
|
SQL.Add(' and V_op_bscard.<2E>˷<EFBFBD>Э<EFBFBD><D0AD><EFBFBD><EFBFBD> like ''%'+Edit1.text+'%'' ');
|
|
|
|
|
|
|
|
|
SQL.Add('group by v_op_bscard.'+bsSkinComboBox1.text+'');
|
|
|
end;
|
|
|
Open;
|
|
|
if not IsEmpty then begin
|
|
|
first;
|
|
|
while not eof do begin
|
|
|
if memtblDetail.Locate('ͳ<>Ʊ<EFBFBD>',FieldbyName(bsSkinComboBox1.text).AsString,[]) then begin
|
|
|
memtblDetail.Edit;
|
|
|
memtblDetail.FieldByName(sDate+'<27><><EFBFBD><EFBFBD>').AsFloat:=memtblDetail.FieldByName(sDate+'<27><><EFBFBD><EFBFBD>').AsFloat+FieldByName('<27><><EFBFBD><EFBFBD>').AsFloat;
|
|
|
memtblDetail.FieldByName('<27>ϼ<EFBFBD><CFBC><EFBFBD><EFBFBD><EFBFBD>').AsFloat:=memtblDetail.FieldByName('<27>ϼ<EFBFBD><CFBC><EFBFBD><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='ͳ<>Ʊ<EFBFBD>' then begin
|
|
|
memtbldetail.Fields[i].AsString:=FieldByName(bsSkinComboBox1.text).AsString
|
|
|
end 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.FieldByName('<27>ϼ<EFBFBD><CFBC><EFBFBD><EFBFBD><EFBFBD>').AsFloat:=memtblDetail.FieldByName('<27>ϼ<EFBFBD><CFBC><EFBFBD><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;
|
|
|
aDate:=IncMonth(aDate,1);
|
|
|
end;
|
|
|
end;
|
|
|
finally
|
|
|
FreeAndNil(aQuery);
|
|
|
freeAndNil(frm_sys_progress);
|
|
|
end;
|
|
|
|
|
|
end;
|
|
|
procedure Tfrm_rp_hl_histry.Getywlr;
|
|
|
var
|
|
|
aQuery:TAdoQuery;
|
|
|
aDate,aToDate:TDate;
|
|
|
strdate,stredate,sDate:String;
|
|
|
i:integer;
|
|
|
// S:TChartSeries;
|
|
|
begin
|
|
|
aQuery:=CreateAdoQuery_rpt();
|
|
|
|
|
|
try
|
|
|
with aQuery do begin
|
|
|
aDate:=EncodeDate(strtoint(cbYear.Text),strtoint(cbmonth.Text),1);
|
|
|
aToDate:=EncodeDate(strtoint(cbeYear.Text),strtoint(cbemonth.Text),2);
|
|
|
|
|
|
if not ASSIGNED(frm_sys_progress) then
|
|
|
frm_sys_progress:=tfrm_sys_progress.Create(application);
|
|
|
frm_sys_progress.Show;
|
|
|
if MonthsBetween(aDate,aToDate)=0 then
|
|
|
frm_sys_progress.bsSkinGauge1.MaxValue:=1
|
|
|
|
|
|
else
|
|
|
frm_sys_progress.bsSkinGauge1.MaxValue:=MonthsBetween(aDate,aToDate);
|
|
|
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',aDate)),strtoint(FormatDateTime('MM',aDate)),MonthDays[isLeapYear(strtoint(FormatDateTime('YYYY',aDate))),strtoint(FormatDateTime('MM',aDate))]));
|
|
|
stredate:=FormatDateTime('YYYY-MM-DD',aDate);
|
|
|
sDate:=FormatDateTime('YYYYMM',aDate);
|
|
|
CLOSE;
|
|
|
SQL.Clear;
|
|
|
if(bsSkinComboBox1.text='ί<>е<EFBFBD>λ_<CEBB><5F><EFBFBD><EFBFBD>˾') then begin
|
|
|
SQL.Add('Select v_op_bscard.ί<>е<EFBFBD>λ+''_''+v_op_bscard.<2E><><EFBFBD><EFBFBD>˾ ί<>е<EFBFBD>λ_<CEBB><5F><EFBFBD><EFBFBD>˾ ');
|
|
|
SQL.Add(',sum(ë<><C3AB><EFBFBD><EFBFBD>)-sum(isnull(v_ch_fee_cd.<2E>շѲյ<D1B2>,0)-isnull(v_ch_fee_cd.<2E><><EFBFBD>Ѳյ<D1B2>,0))-sum(isnull(v_ch_fee_cd.<2E>շ<EFBFBD>VGM,0)-isnull(v_ch_fee_cd.<2E><><EFBFBD><EFBFBD>VGM,0))-sum(isnull(v_ch_fee_cd.<2E>շ<EFBFBD>Σ<EFBFBD>걨<EFBFBD><EAB1A8>,0)-isnull(v_ch_fee_cd.<2E><><EFBFBD><EFBFBD>Σ<EFBFBD>걨<EFBFBD><EAB1A8>,0))');
|
|
|
SQL.Add('-sum(isnull(v_ch_fee_cd.<2E>շ<EFBFBD>CFS,0)-isnull(v_ch_fee_cd.<2E><><EFBFBD><EFBFBD>CFS,0))-sum(isnull(v_ch_fee_bg.<2E><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>,0))-sum(isnull(v_ch_fee_cd.<2E><><EFBFBD>ɽ<EFBFBD>RMB,0)) <20><><EFBFBD><EFBFBD>');
|
|
|
SQL.Add(' from v_op_bscard left JOIN v_ch_fee_cd ON v_op_bscard.<2E><><EFBFBD><EFBFBD> = v_ch_fee_cd.<2E><><EFBFBD><EFBFBD> left JOIN v_ch_fee_bg ON v_op_bscard.<2E><><EFBFBD><EFBFBD> = v_ch_fee_bg.<2E><><EFBFBD><EFBFBD>');
|
|
|
SQL.Add(' where v_op_bscard.ҵ<><D2B5><EFBFBD><EFBFBD><EFBFBD><EFBFBD>=''<27><><EFBFBD>˳<EFBFBD><CBB3><EFBFBD>'' and v_op_bscard.<2E><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>>='''+stredate+''' and v_op_bscard.<2E><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><='''+strdate+'''');
|
|
|
if RxDBLookupCombo2.DisplayValues[1]<>'' then
|
|
|
SQL.Add(' and V_op_bscard.ί<>е<EFBFBD>λ='''+RxDBLookupCombo2.DisplayValues[1]+''' ');
|
|
|
if RxDBLookupCombo1.DisplayValues[1]<>'' then
|
|
|
SQL.Add(' and V_op_bscard.<2E><><EFBFBD><EFBFBD>˾='''+RxDBLookupCombo1.DisplayValues[1]+''' ');
|
|
|
if wwDBDateTimePicker7.text<>'' then
|
|
|
SQL.Add(' and V_op_bscard.ƾ֤<C6BE><D6A4><EFBFBD><EFBFBD>>='''+wwDBDateTimePicker7.text+''' ');
|
|
|
if wwDBDateTimePicker8.text<>'' then
|
|
|
SQL.Add(' and V_op_bscard.ƾ֤<C6BE><D6A4><EFBFBD><EFBFBD><='''+wwDBDateTimePicker8.text+''' ');
|
|
|
if Edit1.text<>''then
|
|
|
SQL.Add(' and V_op_bscard.<2E>˷<EFBFBD>Э<EFBFBD><D0AD><EFBFBD><EFBFBD> like ''%'+Edit1.text+'%'' ');
|
|
|
|
|
|
|
|
|
SQL.Add('group by v_op_bscard.ί<>е<EFBFBD>λ+''_''+v_op_bscard.<2E><><EFBFBD><EFBFBD>˾ ');
|
|
|
|
|
|
end else if(bsSkinComboBox1.text='<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>_<EFBFBD><5F><EFBFBD><EFBFBD>') then begin
|
|
|
SQL.Add('Select v_op_bscard.<2E><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>+''_''+v_op_bscard.<2E><><EFBFBD>۲<EFBFBD><DBB2><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>_<EFBFBD><5F><EFBFBD><EFBFBD> ');
|
|
|
SQL.Add(',sum(ë<><C3AB><EFBFBD><EFBFBD>)-sum(isnull(v_ch_fee_cd.<2E>շѲյ<D1B2>,0)-isnull(v_ch_fee_cd.<2E><><EFBFBD>Ѳյ<D1B2>,0))-sum(isnull(v_ch_fee_cd.<2E>շ<EFBFBD>VGM,0)-isnull(v_ch_fee_cd.<2E><><EFBFBD><EFBFBD>VGM,0))-sum(isnull(v_ch_fee_cd.<2E>շ<EFBFBD>Σ<EFBFBD>걨<EFBFBD><EAB1A8>,0)-isnull(v_ch_fee_cd.<2E><><EFBFBD><EFBFBD>Σ<EFBFBD>걨<EFBFBD><EAB1A8>,0))');
|
|
|
SQL.Add('-sum(isnull(v_ch_fee_cd.<2E>շ<EFBFBD>CFS,0)-isnull(v_ch_fee_cd.<2E><><EFBFBD><EFBFBD>CFS,0))-sum(isnull(v_ch_fee_bg.<2E><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>,0))-sum(isnull(v_ch_fee_cd.<2E><><EFBFBD>ɽ<EFBFBD>RMB,0)) <20><><EFBFBD><EFBFBD>');
|
|
|
SQL.Add(' from v_op_bscard left JOIN v_ch_fee_cd ON v_op_bscard.<2E><><EFBFBD><EFBFBD> = v_ch_fee_cd.<2E><><EFBFBD><EFBFBD> left JOIN v_ch_fee_bg ON v_op_bscard.<2E><><EFBFBD><EFBFBD> = v_ch_fee_bg.<2E><><EFBFBD><EFBFBD>');
|
|
|
SQL.Add(' where v_op_bscard.ҵ<><D2B5><EFBFBD><EFBFBD><EFBFBD><EFBFBD>=''<27><><EFBFBD>˳<EFBFBD><CBB3><EFBFBD>'' and v_op_bscard.<2E><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>>='''+stredate+''' and v_op_bscard.<2E><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><='''+strdate+'''');
|
|
|
if RxDBLookupCombo2.DisplayValues[1]<>'' then
|
|
|
SQL.Add(' and V_op_bscard.ί<>е<EFBFBD>λ='''+RxDBLookupCombo2.DisplayValues[1]+''' ');
|
|
|
if RxDBLookupCombo1.DisplayValues[1]<>'' then
|
|
|
SQL.Add(' and V_op_bscard.<2E><><EFBFBD><EFBFBD>˾='''+RxDBLookupCombo1.DisplayValues[1]+''' ');
|
|
|
if wwDBDateTimePicker7.text<>'' then
|
|
|
SQL.Add(' and V_op_bscard.ƾ֤<C6BE><D6A4><EFBFBD><EFBFBD>>='''+wwDBDateTimePicker7.text+''' ');
|
|
|
if wwDBDateTimePicker8.text<>'' then
|
|
|
SQL.Add(' and V_op_bscard.ƾ֤<C6BE><D6A4><EFBFBD><EFBFBD><='''+wwDBDateTimePicker8.text+''' ');
|
|
|
if Edit1.text<>''then
|
|
|
SQL.Add(' and V_op_bscard.<2E>˷<EFBFBD>Э<EFBFBD><D0AD><EFBFBD><EFBFBD> like ''%'+Edit1.text+'%'' ');
|
|
|
|
|
|
|
|
|
SQL.Add('group by v_op_bscard.<2E><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>+''_''+v_op_bscard.<2E><><EFBFBD>۲<EFBFBD><DBB2><EFBFBD> ');
|
|
|
|
|
|
end else begin
|
|
|
|
|
|
SQL.Add('Select v_op_bscard.'+bsSkinComboBox1.text+'');
|
|
|
SQL.Add(',sum(ë<><C3AB><EFBFBD><EFBFBD>)-sum(isnull(v_ch_fee_cd.<2E>շѲյ<D1B2>,0)-isnull(v_ch_fee_cd.<2E><><EFBFBD>Ѳյ<D1B2>,0))-sum(isnull(v_ch_fee_cd.<2E>շ<EFBFBD>VGM,0)-isnull(v_ch_fee_cd.<2E><><EFBFBD><EFBFBD>VGM,0))-sum(isnull(v_ch_fee_cd.<2E>շ<EFBFBD>Σ<EFBFBD>걨<EFBFBD><EAB1A8>,0)-isnull(v_ch_fee_cd.<2E><><EFBFBD><EFBFBD>Σ<EFBFBD>걨<EFBFBD><EAB1A8>,0))');
|
|
|
SQL.Add('-sum(isnull(v_ch_fee_cd.<2E>շ<EFBFBD>CFS,0)-isnull(v_ch_fee_cd.<2E><><EFBFBD><EFBFBD>CFS,0))-sum(isnull(v_ch_fee_bg.<2E><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>,0))-sum(isnull(v_ch_fee_cd.<2E><><EFBFBD>ɽ<EFBFBD>RMB,0)) <20><><EFBFBD><EFBFBD>');
|
|
|
SQL.Add(' from v_op_bscard left JOIN v_ch_fee_cd ON v_op_bscard.<2E><><EFBFBD><EFBFBD> = v_ch_fee_cd.<2E><><EFBFBD><EFBFBD> left JOIN v_ch_fee_bg ON v_op_bscard.<2E><><EFBFBD><EFBFBD> = v_ch_fee_bg.<2E><><EFBFBD><EFBFBD>');
|
|
|
SQL.Add(' where v_op_bscard.ҵ<><D2B5><EFBFBD><EFBFBD><EFBFBD><EFBFBD>=''<27><><EFBFBD>˳<EFBFBD><CBB3><EFBFBD>'' and v_op_bscard.<2E><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>>='''+stredate+''' and v_op_bscard.<2E><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><='''+strdate+'''');
|
|
|
if RxDBLookupCombo2.DisplayValues[1]<>'' then
|
|
|
SQL.Add(' and V_op_bscard.ί<>е<EFBFBD>λ='''+RxDBLookupCombo2.DisplayValues[1]+''' ');
|
|
|
if RxDBLookupCombo1.DisplayValues[1]<>'' then
|
|
|
SQL.Add(' and V_op_bscard.<2E><><EFBFBD><EFBFBD>˾='''+RxDBLookupCombo1.DisplayValues[1]+''' ');
|
|
|
if wwDBDateTimePicker7.text<>'' then
|
|
|
SQL.Add(' and V_op_bscard.ƾ֤<C6BE><D6A4><EFBFBD><EFBFBD>>='''+wwDBDateTimePicker7.text+''' ');
|
|
|
if wwDBDateTimePicker8.text<>'' then
|
|
|
SQL.Add(' and V_op_bscard.ƾ֤<C6BE><D6A4><EFBFBD><EFBFBD><='''+wwDBDateTimePicker8.text+''' ');
|
|
|
if Edit1.text<>''then
|
|
|
SQL.Add(' and V_op_bscard.<2E>˷<EFBFBD>Э<EFBFBD><D0AD><EFBFBD><EFBFBD> like ''%'+Edit1.text+'%'' ');
|
|
|
|
|
|
|
|
|
SQL.Add(' group by v_op_bscard.'+bsSkinComboBox1.text+'');
|
|
|
end;
|
|
|
Open;
|
|
|
if not IsEmpty then begin
|
|
|
first;
|
|
|
while not eof do begin
|
|
|
if memtblDetail.Locate('ͳ<>Ʊ<EFBFBD>',FieldbyName(bsSkinComboBox1.text).AsString,[]) then begin
|
|
|
memtblDetail.Edit;
|
|
|
memtblDetail.FieldByName(sDate+'<27><><EFBFBD><EFBFBD>').AsFloat:=memtblDetail.FieldByName(sDate+'<27><><EFBFBD><EFBFBD>').AsFloat+FieldByName('<27><><EFBFBD><EFBFBD>').AsFloat;
|
|
|
memtblDetail.FieldByName('<27>ϼ<EFBFBD><CFBC><EFBFBD><EFBFBD><EFBFBD>').AsFloat:=memtblDetail.FieldByName('<27>ϼ<EFBFBD><CFBC><EFBFBD><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='ͳ<>Ʊ<EFBFBD>' then begin
|
|
|
memtbldetail.Fields[i].AsString:=FieldByName(bsSkinComboBox1.text).AsString
|
|
|
end 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.FieldByName('<27>ϼ<EFBFBD><CFBC><EFBFBD><EFBFBD><EFBFBD>').AsFloat:=memtblDetail.FieldByName('<27>ϼ<EFBFBD><CFBC><EFBFBD><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;
|
|
|
aDate:=IncMonth(aDate,1);
|
|
|
end;
|
|
|
end;
|
|
|
finally
|
|
|
FreeAndNil(aQuery);
|
|
|
freeAndNil(frm_sys_progress);
|
|
|
end;
|
|
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
///
|
|
|
|
|
|
|
|
|
procedure Tfrm_rp_hl_histry.CreatememtblCOUNT;
|
|
|
var
|
|
|
aDate,aToDate:TDate;
|
|
|
sDate,aYear,aMonth:String;
|
|
|
aColumn:TdxDBTreeListColumn;
|
|
|
aBand:TdxTreeListBand;
|
|
|
i:integer;
|
|
|
begin
|
|
|
|
|
|
|
|
|
dxDBGrid1.Bands.Clear;
|
|
|
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, 60, false);
|
|
|
|
|
|
aBand:=dxDBGrid1.Bands.Add;
|
|
|
aBand.Caption:='<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϣ';
|
|
|
aBand.Fixed:=BFLEFT;
|
|
|
aColumn:=dxDBGrid1.CreateColumn(TdxDBGridColumn);
|
|
|
if bsSkinComboBox1.ItemIndex<>0 then
|
|
|
aColumn.Caption:=bsSkinComboBox1.Text;
|
|
|
aColumn.BandIndex:=0;
|
|
|
aColumn.FieldName:='ͳ<>Ʊ<EFBFBD>';
|
|
|
|
|
|
|
|
|
|
|
|
aDate:=EncodeDate(strtoint(cbyear.text),strtoint(cbmonth.Text),1);
|
|
|
aToDate:=EncodeDate(strtoint(cbeyear.text),strtoint(cbemonth.Text),2);
|
|
|
i:=1;
|
|
|
|
|
|
while aDate<aToDate do begin
|
|
|
sDate:=FormatDateTime('YYYYMM',aDate);
|
|
|
aYear:=FormatDateTime('YYYY',aDate);
|
|
|
aMonth:=FormatDateTime('MM',aDate);
|
|
|
aBand:=dxDBGrid1.Bands.Add;
|
|
|
aBand.Caption:=aYear+aMonth;
|
|
|
|
|
|
aColumn:=dxDBGrid1.CreateColumn(TdxDBGridColumn);
|
|
|
aColumn.Caption:='Ʊ<><C6B1>';
|
|
|
aColumn.FieldName:=sDate+'Ʊ<><C6B1>';
|
|
|
aColumn.Width:=60;
|
|
|
aColumn.SummaryFooterType:=cstSum;
|
|
|
aColumn.BandIndex:=i;
|
|
|
memtblDetail.FieldDefs.Add(sDate+'Ʊ<><C6B1>',ftFloat, 0, false);
|
|
|
aDate:=IncMonth(aDate,1);
|
|
|
Inc(i);
|
|
|
end;
|
|
|
|
|
|
|
|
|
aBand:=dxDBGrid1.Bands.Add;
|
|
|
aBand.Caption:='<27>ϼ<EFBFBD>';
|
|
|
aColumn:=dxDBGrid1.CreateColumn(TdxDBGridColumn);
|
|
|
aColumn.Caption:='Ʊ<><C6B1>';
|
|
|
aColumn.FieldName:='<27>ϼ<EFBFBD>Ʊ<EFBFBD><C6B1>';
|
|
|
aColumn.SummaryFooterType:=cstSum;
|
|
|
aColumn.BandIndex:=i;
|
|
|
aColumn.Width:=60;
|
|
|
memtblDetail.FieldDefs.Add('<27>ϼ<EFBFBD>Ʊ<EFBFBD><C6B1>',ftFloat, 0, false);
|
|
|
memtblDetail.CreateTable;
|
|
|
memtblDetail.Open;
|
|
|
end;
|
|
|
|
|
|
//
|
|
|
procedure Tfrm_rp_hl_histry.GetCount;
|
|
|
var
|
|
|
aQuery:TAdoQuery;
|
|
|
aDate,aToDate:TDate;
|
|
|
strdate,stredate,sDate:String;
|
|
|
i:integer;
|
|
|
// S:TChartSeries;
|
|
|
begin
|
|
|
aQuery:=CreateAdoQuery_rpt();
|
|
|
|
|
|
try
|
|
|
with aQuery do begin
|
|
|
aDate:=EncodeDate(strtoint(cbYear.Text),strtoint(cbmonth.Text),1);
|
|
|
aToDate:=EncodeDate(strtoint(cbeYear.Text),strtoint(cbemonth.Text),2);
|
|
|
|
|
|
if not ASSIGNED(frm_sys_progress) then
|
|
|
frm_sys_progress:=tfrm_sys_progress.Create(application);
|
|
|
frm_sys_progress.Show;
|
|
|
if MonthsBetween(aDate,aToDate)=0 then
|
|
|
frm_sys_progress.bsSkinGauge1.MaxValue:=1
|
|
|
|
|
|
else
|
|
|
frm_sys_progress.bsSkinGauge1.MaxValue:=MonthsBetween(aDate,aToDate);
|
|
|
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',aDate)),strtoint(FormatDateTime('MM',aDate)),MonthDays[isLeapYear(strtoint(FormatDateTime('YYYY',aDate))),strtoint(FormatDateTime('MM',aDate))]));
|
|
|
stredate:=FormatDateTime('YYYY-MM-DD',aDate);
|
|
|
sDate:=FormatDateTime('YYYYMM',aDate);
|
|
|
CLOSE;
|
|
|
SQL.Clear;
|
|
|
if(bsSkinComboBox1.text='ί<>е<EFBFBD>λ_<CEBB><5F><EFBFBD><EFBFBD>˾') then begin
|
|
|
SQL.Add('Select V_op_bscard_All.ί<>е<EFBFBD>λ+''_''+V_op_bscard_All.<2E><><EFBFBD><EFBFBD>˾ ί<>е<EFBFBD>λ_<CEBB><5F><EFBFBD><EFBFBD>˾ ');
|
|
|
SQL.Add(',count(*) Ʊ<><C6B1>');
|
|
|
SQL.Add('from V_op_bscard_All where V_op_bscard_All.װ<>˷<EFBFBD>ʽ=''<27><><EFBFBD><EFBFBD>'' and V_op_bscard_All.ҵ<><D2B5><EFBFBD><EFBFBD><EFBFBD><EFBFBD>=''<27><>ͨ<EFBFBD><CDA8>'' and V_op_bscard_All.<2E><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>>='''+stredate+''' and V_op_bscard_All.<2E><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><='''+strdate+'''');
|
|
|
if RxDBLookupCombo2.DisplayValues[1]<>'' then
|
|
|
SQL.Add(' and V_op_bscard_All.ί<>е<EFBFBD>λ='''+RxDBLookupCombo2.DisplayValues[1]+''' ');
|
|
|
if RxDBLookupCombo1.DisplayValues[1]<>'' then
|
|
|
SQL.Add(' and V_op_bscard_All.<2E><><EFBFBD><EFBFBD>˾='''+RxDBLookupCombo1.DisplayValues[1]+''' ');
|
|
|
if wwDBDateTimePicker7.text<>'' then
|
|
|
SQL.Add(' and V_op_bscard_All.ƾ֤<C6BE><D6A4><EFBFBD><EFBFBD>>='''+wwDBDateTimePicker7.text+''' ');
|
|
|
if wwDBDateTimePicker8.text<>'' then
|
|
|
SQL.Add(' and V_op_bscard_All.ƾ֤<C6BE><D6A4><EFBFBD><EFBFBD><='''+wwDBDateTimePicker8.text+''' ');
|
|
|
if Edit1.text<>''then
|
|
|
SQL.Add(' and V_op_bscard_All.<2E>˷<EFBFBD>Э<EFBFBD><D0AD><EFBFBD><EFBFBD> like ''%'+Edit1.text+'%'' ');
|
|
|
|
|
|
SQL.Add('group by V_op_bscard_All.ί<>е<EFBFBD>λ+''_''+V_op_bscard_All.<2E><><EFBFBD><EFBFBD>˾ ');
|
|
|
|
|
|
end else if(bsSkinComboBox1.text='<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>_<EFBFBD><5F><EFBFBD><EFBFBD>') then begin
|
|
|
SQL.Add('Select V_op_bscard_All.<2E><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>+''_''+V_op_bscard_All.<2E><><EFBFBD>۲<EFBFBD><DBB2><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>_<EFBFBD><5F><EFBFBD><EFBFBD> ');
|
|
|
SQL.Add(',count(*) Ʊ<><C6B1>');
|
|
|
SQL.Add('from V_op_bscard_All where V_op_bscard_All.װ<>˷<EFBFBD>ʽ=''<27><><EFBFBD><EFBFBD>'' and V_op_bscard_All.ҵ<><D2B5><EFBFBD><EFBFBD><EFBFBD><EFBFBD>=''<27><>ͨ<EFBFBD><CDA8>'' and V_op_bscard_All.<2E><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>>='''+stredate+''' and V_op_bscard_All.<2E><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><='''+strdate+'''');
|
|
|
if RxDBLookupCombo2.DisplayValues[1]<>'' then
|
|
|
SQL.Add(' and V_op_bscard_All.ί<>е<EFBFBD>λ='''+RxDBLookupCombo2.DisplayValues[1]+''' ');
|
|
|
if RxDBLookupCombo1.DisplayValues[1]<>'' then
|
|
|
SQL.Add(' and V_op_bscard_All.<2E><><EFBFBD><EFBFBD>˾='''+RxDBLookupCombo1.DisplayValues[1]+''' ');
|
|
|
if wwDBDateTimePicker7.text<>'' then
|
|
|
SQL.Add(' and V_op_bscard_All.ƾ֤<C6BE><D6A4><EFBFBD><EFBFBD>>='''+wwDBDateTimePicker7.text+''' ');
|
|
|
if wwDBDateTimePicker8.text<>'' then
|
|
|
SQL.Add(' and V_op_bscard_All.ƾ֤<C6BE><D6A4><EFBFBD><EFBFBD><='''+wwDBDateTimePicker8.text+''' ');
|
|
|
if Edit1.text<>''then
|
|
|
SQL.Add(' and V_op_bscard_All.<2E>˷<EFBFBD>Э<EFBFBD><D0AD><EFBFBD><EFBFBD> like ''%'+Edit1.text+'%'' ');
|
|
|
|
|
|
SQL.Add('group by V_op_bscard_All.<2E><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>+''_''+V_op_bscard_All.<2E><><EFBFBD>۲<EFBFBD><DBB2><EFBFBD> ');
|
|
|
|
|
|
end else begin
|
|
|
|
|
|
|
|
|
SQL.Add('Select V_op_bscard_All.'+bsSkinComboBox1.text+'');
|
|
|
SQL.Add(',count(*) Ʊ<><C6B1>');
|
|
|
SQL.Add('from V_op_bscard_All where V_op_bscard_All.װ<>˷<EFBFBD>ʽ=''<27><><EFBFBD><EFBFBD>'' and V_op_bscard_All.ҵ<><D2B5><EFBFBD><EFBFBD><EFBFBD><EFBFBD>=''<27><>ͨ<EFBFBD><CDA8>'' and V_op_bscard_All.<2E><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>>='''+stredate+''' and V_op_bscard_All.<2E><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><='''+strdate+'''');
|
|
|
if RxDBLookupCombo2.DisplayValues[1]<>'' then
|
|
|
SQL.Add(' and V_op_bscard_All.ί<>е<EFBFBD>λ='''+RxDBLookupCombo2.DisplayValues[1]+''' ');
|
|
|
if RxDBLookupCombo1.DisplayValues[1]<>'' then
|
|
|
SQL.Add(' and V_op_bscard_All.<2E><><EFBFBD><EFBFBD>˾='''+RxDBLookupCombo1.DisplayValues[1]+''' ');
|
|
|
if wwDBDateTimePicker7.text<>'' then
|
|
|
SQL.Add(' and V_op_bscard_All.ƾ֤<C6BE><D6A4><EFBFBD><EFBFBD>>='''+wwDBDateTimePicker7.text+''' ');
|
|
|
if wwDBDateTimePicker8.text<>'' then
|
|
|
SQL.Add(' and V_op_bscard_All.ƾ֤<C6BE><D6A4><EFBFBD><EFBFBD><='''+wwDBDateTimePicker8.text+''' ');
|
|
|
if Edit1.text<>''then
|
|
|
SQL.Add(' and V_op_bscard_All.<2E>˷<EFBFBD>Э<EFBFBD><D0AD><EFBFBD><EFBFBD> like ''%'+Edit1.text+'%'' ');
|
|
|
|
|
|
SQL.Add('group by V_op_bscard_All.'+bsSkinComboBox1.text+'');
|
|
|
end;
|
|
|
Open;
|
|
|
if not IsEmpty then begin
|
|
|
first;
|
|
|
while not eof do begin
|
|
|
if memtblDetail.Locate('ͳ<>Ʊ<EFBFBD>',FieldbyName(bsSkinComboBox1.text).AsString,[]) then begin
|
|
|
memtblDetail.Edit;
|
|
|
memtblDetail.FieldByName(sDate+'Ʊ<><C6B1>').AsFloat:=memtblDetail.FieldByName(sDate+'Ʊ<><C6B1>').AsFloat+FieldByName('Ʊ<><C6B1>').AsFloat;
|
|
|
memtblDetail.FieldByName('<27>ϼ<EFBFBD>Ʊ<EFBFBD><C6B1>').AsFloat:=memtblDetail.FieldByName('<27>ϼ<EFBFBD>Ʊ<EFBFBD><C6B1>').AsFloat+FieldByName('Ʊ<><C6B1>').AsFloat;
|
|
|
memtblDetail.Post;
|
|
|
end else begin
|
|
|
memtblDetail.Insert;
|
|
|
for i:=0 to memtbldetail.FieldCount-1 do begin
|
|
|
if memtbldetail.Fields[i].FieldName='ͳ<>Ʊ<EFBFBD>' then begin
|
|
|
memtbldetail.Fields[i].AsString:=FieldByName(bsSkinComboBox1.text).AsString
|
|
|
end else
|
|
|
memtbldetail.Fields[i].AsFloat:=0;
|
|
|
end;
|
|
|
memtblDetail.FieldByName(sDate+'Ʊ<><C6B1>').AsFloat:=memtblDetail.FieldByName(sDate+'Ʊ<><C6B1>').AsFloat+FieldbyName('Ʊ<><C6B1>').AsFloat;
|
|
|
memtblDetail.FieldByName('<27>ϼ<EFBFBD>Ʊ<EFBFBD><C6B1>').AsFloat:=memtblDetail.FieldByName('<27>ϼ<EFBFBD>Ʊ<EFBFBD><C6B1>').AsFloat+FieldbyName('Ʊ<><C6B1>').AsFloat;
|
|
|
memtblDetail.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_hl_histry.Creatememtblzjzy;
|
|
|
var
|
|
|
aDate,aToDate:TDate;
|
|
|
sDate,aYear,aMonth:String;
|
|
|
aColumn:TdxDBTreeListColumn;
|
|
|
aBand:TdxTreeListBand;
|
|
|
i:integer;
|
|
|
begin
|
|
|
|
|
|
|
|
|
dxDBGrid1.Bands.Clear;
|
|
|
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, 60, false);
|
|
|
|
|
|
aBand:=dxDBGrid1.Bands.Add;
|
|
|
aBand.Caption:='<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϣ';
|
|
|
aBand.Fixed:=BFLEFT;
|
|
|
aColumn:=dxDBGrid1.CreateColumn(TdxDBGridColumn);
|
|
|
if bsSkinComboBox1.ItemIndex<>0 then
|
|
|
aColumn.Caption:=bsSkinComboBox1.Text;
|
|
|
aColumn.BandIndex:=0;
|
|
|
aColumn.FieldName:='ͳ<>Ʊ<EFBFBD>';
|
|
|
|
|
|
|
|
|
|
|
|
aDate:=EncodeDate(strtoint(cbyear.text),strtoint(cbmonth.Text),1);
|
|
|
aToDate:=EncodeDate(strtoint(cbeyear.text),strtoint(cbemonth.Text),2);
|
|
|
i:=1;
|
|
|
|
|
|
while aDate<aToDate do begin
|
|
|
sDate:=FormatDateTime('YYYYMM',aDate);
|
|
|
aYear:=FormatDateTime('YYYY',aDate);
|
|
|
aMonth:=FormatDateTime('MM',aDate);
|
|
|
aBand:=dxDBGrid1.Bands.Add;
|
|
|
aBand.Caption:=aYear+aMonth;
|
|
|
|
|
|
aColumn:=dxDBGrid1.CreateColumn(TdxDBGridColumn);
|
|
|
aColumn.Caption:='<27>ʽ<EFBFBD>ռ<EFBFBD><D5BC>';
|
|
|
aColumn.FieldName:=sDate+'<27>ʽ<EFBFBD>ռ<EFBFBD><D5BC>';
|
|
|
aColumn.Width:=60;
|
|
|
aColumn.SummaryFooterType:=cstSum;
|
|
|
aColumn.BandIndex:=i;
|
|
|
memtblDetail.FieldDefs.Add(sDate+'<27>ʽ<EFBFBD>ռ<EFBFBD><D5BC>',ftFloat, 0, false);
|
|
|
aDate:=IncMonth(aDate,1);
|
|
|
Inc(i);
|
|
|
end;
|
|
|
|
|
|
|
|
|
aBand:=dxDBGrid1.Bands.Add;
|
|
|
aBand.Caption:='<27>ϼ<EFBFBD>';
|
|
|
aColumn:=dxDBGrid1.CreateColumn(TdxDBGridColumn);
|
|
|
aColumn.Caption:='<27>ʽ<EFBFBD>ռ<EFBFBD><D5BC>';
|
|
|
aColumn.FieldName:='<27>ϼ<EFBFBD><CFBC>ʽ<EFBFBD>ռ<EFBFBD><D5BC>';
|
|
|
aColumn.SummaryFooterType:=cstSum;
|
|
|
aColumn.BandIndex:=i;
|
|
|
aColumn.Width:=60;
|
|
|
memtblDetail.FieldDefs.Add('<27>ϼ<EFBFBD><CFBC>ʽ<EFBFBD>ռ<EFBFBD><D5BC>',ftFloat, 0, false);
|
|
|
memtblDetail.CreateTable;
|
|
|
memtblDetail.Open;
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
procedure Tfrm_rp_hl_histry.Getzjzy;
|
|
|
var
|
|
|
aQuery:TAdoQuery;
|
|
|
aDate,aToDate:TDate;
|
|
|
strdate,stredate,sDate:String;
|
|
|
i:integer;
|
|
|
// S:TChartSeries;
|
|
|
begin
|
|
|
aQuery:=CreateAdoQuery_rpt();
|
|
|
|
|
|
try
|
|
|
with aQuery do begin
|
|
|
aDate:=EncodeDate(strtoint(cbYear.Text),strtoint(cbmonth.Text),1);
|
|
|
aToDate:=EncodeDate(strtoint(cbeYear.Text),strtoint(cbemonth.Text),2);
|
|
|
|
|
|
if not ASSIGNED(frm_sys_progress) then
|
|
|
frm_sys_progress:=tfrm_sys_progress.Create(application);
|
|
|
frm_sys_progress.Show;
|
|
|
if MonthsBetween(aDate,aToDate)=0 then
|
|
|
frm_sys_progress.bsSkinGauge1.MaxValue:=1
|
|
|
|
|
|
else
|
|
|
frm_sys_progress.bsSkinGauge1.MaxValue:=MonthsBetween(aDate,aToDate);
|
|
|
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',aDate)),strtoint(FormatDateTime('MM',aDate)),MonthDays[isLeapYear(strtoint(FormatDateTime('YYYY',aDate))),strtoint(FormatDateTime('MM',aDate))]));
|
|
|
stredate:=FormatDateTime('YYYY-MM-DD',aDate);
|
|
|
sDate:=FormatDateTime('YYYYMM',aDate);
|
|
|
CLOSE;
|
|
|
SQL.Clear;
|
|
|
if(bsSkinComboBox1.text='ί<>е<EFBFBD>λ_<CEBB><5F><EFBFBD><EFBFBD>˾') then begin
|
|
|
SQL.Add('Select v_op_bscard.ί<>е<EFBFBD>λ+''_''+v_op_bscard.<2E><><EFBFBD><EFBFBD>˾ ί<>е<EFBFBD>λ_<CEBB><5F><EFBFBD><EFBFBD>˾ ');
|
|
|
case bsSkinComboBox1.ItemIndex of
|
|
|
2,3:SQL.Add(',sum(<28>ϼ<EFBFBD>Ӧ<EFBFBD><D3A6>) <20>ʽ<EFBFBD>ռ<EFBFBD><D5BC>');
|
|
|
else SQL.Add(',sum(<28>ϼ<EFBFBD>Ӧ<EFBFBD><D3A6>) <20>ʽ<EFBFBD>ռ<EFBFBD><D5BC>');
|
|
|
end;
|
|
|
|
|
|
|
|
|
SQL.Add('from v_op_bscard where ҵ<><D2B5><EFBFBD><EFBFBD><EFBFBD><EFBFBD>=''<27><><EFBFBD>˳<EFBFBD><CBB3><EFBFBD>'' and v_op_bscard.<2E><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>>='''+stredate+''' and v_op_bscard.<2E><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><='''+strdate+'''');
|
|
|
if RxDBLookupCombo2.DisplayValues[1]<>'' then
|
|
|
SQL.Add(' and V_op_bscard.ί<>е<EFBFBD>λ='''+RxDBLookupCombo2.DisplayValues[1]+''' ');
|
|
|
if RxDBLookupCombo1.DisplayValues[1]<>'' then
|
|
|
SQL.Add(' and V_op_bscard.<2E><><EFBFBD><EFBFBD>˾='''+RxDBLookupCombo1.DisplayValues[1]+''' ');
|
|
|
if wwDBDateTimePicker7.text<>'' then
|
|
|
SQL.Add(' and V_op_bscard.ƾ֤<C6BE><D6A4><EFBFBD><EFBFBD>>='''+wwDBDateTimePicker7.text+''' ');
|
|
|
if wwDBDateTimePicker8.text<>'' then
|
|
|
SQL.Add(' and V_op_bscard.ƾ֤<C6BE><D6A4><EFBFBD><EFBFBD><='''+wwDBDateTimePicker8.text+''' ');
|
|
|
if Edit1.text<>''then
|
|
|
SQL.Add(' and V_op_bscard.<2E>˷<EFBFBD>Э<EFBFBD><D0AD><EFBFBD><EFBFBD> like ''%'+Edit1.text+'%'' ');
|
|
|
|
|
|
SQL.Add('group by v_op_bscard.ί<>е<EFBFBD>λ+''_''+v_op_bscard.<2E><><EFBFBD><EFBFBD>˾ ');
|
|
|
|
|
|
end else if(bsSkinComboBox1.text='<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>_<EFBFBD><5F><EFBFBD><EFBFBD>') then begin
|
|
|
SQL.Add('Select v_op_bscard.<2E><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>+''_''+v_op_bscard.<2E><><EFBFBD>۲<EFBFBD><DBB2><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>_<EFBFBD><5F><EFBFBD><EFBFBD> ');
|
|
|
case bsSkinComboBox1.ItemIndex of
|
|
|
2,3:SQL.Add(',sum(<28>ϼ<EFBFBD>Ӧ<EFBFBD><D3A6>) <20>ʽ<EFBFBD>ռ<EFBFBD><D5BC>');
|
|
|
else SQL.Add(',sum(<28>ϼ<EFBFBD>Ӧ<EFBFBD><D3A6>) <20>ʽ<EFBFBD>ռ<EFBFBD><D5BC>');
|
|
|
end;
|
|
|
|
|
|
|
|
|
SQL.Add('from v_op_bscard where ҵ<><D2B5><EFBFBD><EFBFBD><EFBFBD><EFBFBD>=''<27><><EFBFBD>˳<EFBFBD><CBB3><EFBFBD>'' and v_op_bscard.<2E><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>>='''+stredate+''' and v_op_bscard.<2E><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><='''+strdate+'''');
|
|
|
if RxDBLookupCombo2.DisplayValues[1]<>'' then
|
|
|
SQL.Add(' and V_op_bscard.ί<>е<EFBFBD>λ='''+RxDBLookupCombo2.DisplayValues[1]+''' ');
|
|
|
if RxDBLookupCombo1.DisplayValues[1]<>'' then
|
|
|
SQL.Add(' and V_op_bscard.<2E><><EFBFBD><EFBFBD>˾='''+RxDBLookupCombo1.DisplayValues[1]+''' ');
|
|
|
if wwDBDateTimePicker7.text<>'' then
|
|
|
SQL.Add(' and V_op_bscard.ƾ֤<C6BE><D6A4><EFBFBD><EFBFBD>>='''+wwDBDateTimePicker7.text+''' ');
|
|
|
if wwDBDateTimePicker8.text<>'' then
|
|
|
SQL.Add(' and V_op_bscard.ƾ֤<C6BE><D6A4><EFBFBD><EFBFBD><='''+wwDBDateTimePicker8.text+''' ');
|
|
|
if Edit1.text<>''then
|
|
|
SQL.Add(' and V_op_bscard.<2E>˷<EFBFBD>Э<EFBFBD><D0AD><EFBFBD><EFBFBD> like ''%'+Edit1.text+'%'' ');
|
|
|
|
|
|
SQL.Add('group by v_op_bscard.<2E><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>+''_''+v_op_bscard.<2E><><EFBFBD>۲<EFBFBD><DBB2><EFBFBD> ');
|
|
|
|
|
|
end else begin
|
|
|
|
|
|
|
|
|
SQL.Add('Select v_op_bscard.'+bsSkinComboBox1.text+'');
|
|
|
case bsSkinComboBox1.ItemIndex of
|
|
|
2,3:SQL.Add(',sum(<28>ϼ<EFBFBD>Ӧ<EFBFBD><D3A6>) <20>ʽ<EFBFBD>ռ<EFBFBD><D5BC>');
|
|
|
else SQL.Add(',sum(<28>ϼ<EFBFBD>Ӧ<EFBFBD><D3A6>) <20>ʽ<EFBFBD>ռ<EFBFBD><D5BC>');
|
|
|
end;
|
|
|
|
|
|
|
|
|
SQL.Add('from v_op_bscard where ҵ<><D2B5><EFBFBD><EFBFBD><EFBFBD><EFBFBD>=''<27><><EFBFBD>˳<EFBFBD><CBB3><EFBFBD>'' and v_op_bscard.<2E><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>>='''+stredate+''' and v_op_bscard.<2E><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><='''+strdate+'''');
|
|
|
if RxDBLookupCombo2.DisplayValues[1]<>'' then
|
|
|
SQL.Add(' and V_op_bscard.ί<>е<EFBFBD>λ='''+RxDBLookupCombo2.DisplayValues[1]+''' ');
|
|
|
if RxDBLookupCombo1.DisplayValues[1]<>'' then
|
|
|
SQL.Add(' and V_op_bscard.<2E><><EFBFBD><EFBFBD>˾='''+RxDBLookupCombo1.DisplayValues[1]+''' ');
|
|
|
if wwDBDateTimePicker7.text<>'' then
|
|
|
SQL.Add(' and V_op_bscard.ƾ֤<C6BE><D6A4><EFBFBD><EFBFBD>>='''+wwDBDateTimePicker7.text+''' ');
|
|
|
if wwDBDateTimePicker8.text<>'' then
|
|
|
SQL.Add(' and V_op_bscard.ƾ֤<C6BE><D6A4><EFBFBD><EFBFBD><='''+wwDBDateTimePicker8.text+''' ');
|
|
|
if Edit1.text<>''then
|
|
|
SQL.Add(' and V_op_bscard.<2E>˷<EFBFBD>Э<EFBFBD><D0AD><EFBFBD><EFBFBD> like ''%'+Edit1.text+'%'' ');
|
|
|
|
|
|
|
|
|
SQL.Add('group by v_op_bscard.'+bsSkinComboBox1.text+'');
|
|
|
end;
|
|
|
Open;
|
|
|
if not IsEmpty then begin
|
|
|
first;
|
|
|
while not eof do begin
|
|
|
if memtblDetail.Locate('ͳ<>Ʊ<EFBFBD>',FieldbyName(bsSkinComboBox1.text).AsString,[]) then begin
|
|
|
memtblDetail.Edit;
|
|
|
memtblDetail.FieldByName(sDate+'<27>ʽ<EFBFBD>ռ<EFBFBD><D5BC>').AsFloat:=memtblDetail.FieldByName(sDate+'<27>ʽ<EFBFBD>ռ<EFBFBD><D5BC>').AsFloat+FieldByName('<27>ʽ<EFBFBD>ռ<EFBFBD><D5BC>').AsFloat;
|
|
|
memtblDetail.FieldByName('<27>ϼ<EFBFBD><CFBC>ʽ<EFBFBD>ռ<EFBFBD><D5BC>').AsFloat:=memtblDetail.FieldByName('<27>ϼ<EFBFBD><CFBC>ʽ<EFBFBD>ռ<EFBFBD><D5BC>').AsFloat+FieldByName('<27>ʽ<EFBFBD>ռ<EFBFBD><D5BC>').AsFloat;
|
|
|
memtblDetail.Post;
|
|
|
end else begin
|
|
|
memtblDetail.Insert;
|
|
|
for i:=0 to memtbldetail.FieldCount-1 do begin
|
|
|
if memtbldetail.Fields[i].FieldName='ͳ<>Ʊ<EFBFBD>' then begin
|
|
|
memtbldetail.Fields[i].AsString:=FieldByName(bsSkinComboBox1.text).AsString
|
|
|
end else
|
|
|
memtbldetail.Fields[i].AsFloat:=0;
|
|
|
end;
|
|
|
memtblDetail.FieldByName(sDate+'<27>ʽ<EFBFBD>ռ<EFBFBD><D5BC>').AsFloat:=memtblDetail.FieldByName(sDate+'<27>ʽ<EFBFBD>ռ<EFBFBD><D5BC>').AsFloat+FieldbyName('<27>ʽ<EFBFBD>ռ<EFBFBD><D5BC>').AsFloat;
|
|
|
memtblDetail.FieldByName('<27>ϼ<EFBFBD><CFBC>ʽ<EFBFBD>ռ<EFBFBD><D5BC>').AsFloat:=memtblDetail.FieldByName('<27>ϼ<EFBFBD><CFBC>ʽ<EFBFBD>ռ<EFBFBD><D5BC>').AsFloat+FieldbyName('<27>ʽ<EFBFBD>ռ<EFBFBD><D5BC>').AsFloat;
|
|
|
memtblDetail.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_hl_histry.bsSkinButton5Click(Sender: TObject);
|
|
|
begin
|
|
|
close;
|
|
|
end;
|
|
|
|
|
|
procedure Tfrm_rp_hl_histry.FormClose(Sender: TObject;
|
|
|
var Action: TCloseAction);
|
|
|
begin
|
|
|
frm_rp_hl_histry.Hide;
|
|
|
frm_rp_hl_histry.ManualFloat(frm_rp_hl_histry.BoundsRect );
|
|
|
frm_main.freeTabs('frm_rp_hl_histry');
|
|
|
action:=cafree;
|
|
|
frm_rp_hl_histry:=nil;
|
|
|
end;
|
|
|
|
|
|
procedure Tfrm_rp_hl_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_hl_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_hl_histry.bsSkinButton10Click(Sender: TObject);
|
|
|
begin
|
|
|
if cbyear.Text='' then begin
|
|
|
MessageDlg('ͳ<><CDB3><EFBFBD>겻<EFBFBD><EAB2BB>Ϊ<EFBFBD><CEAA>!',mtWarning,[mbOk],0);
|
|
|
exit;
|
|
|
end;
|
|
|
|
|
|
if cbeyear.Text='' then begin
|
|
|
MessageDlg('ͳ<><CDB3><EFBFBD>겻<EFBFBD><EAB2BB>Ϊ<EFBFBD><CEAA>!',mtWarning,[mbOk],0);
|
|
|
exit;
|
|
|
end;
|
|
|
|
|
|
|
|
|
if cbmonth.Text='' then begin
|
|
|
MessageDlg('ͳ<><CDB3><EFBFBD>²<EFBFBD><C2B2><EFBFBD>Ϊ<EFBFBD><CEAA>!',mtWarning,[mbOk],0);
|
|
|
exit;
|
|
|
end;
|
|
|
|
|
|
if cbemonth.Text='' then begin
|
|
|
MessageDlg('ͳ<><CDB3><EFBFBD>²<EFBFBD><C2B2><EFBFBD>Ϊ<EFBFBD><CEAA>!',mtWarning,[mbOk],0);
|
|
|
exit;
|
|
|
end;
|
|
|
|
|
|
|
|
|
if EncodeDate(strtoint(cbyear.text),strtoint(cbmonth.Text),1)>EncodeDate(strtoint(cbeyear.text),strtoint(cbemonth.Text),1) then begin
|
|
|
MessageDlg('<27><>ʼ<EFBFBD><CABC><EFBFBD>ڲ<EFBFBD><DAB2>ܴ<EFBFBD><DCB4>ڽ<EFBFBD><DABD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>!',mtWarning,[mbOk],0);
|
|
|
exit;
|
|
|
end;
|
|
|
|
|
|
case bsSkinComboBox2.ItemIndex of
|
|
|
0:
|
|
|
begin
|
|
|
CreatememtblTeu;
|
|
|
GetTeu;
|
|
|
end;
|
|
|
1:
|
|
|
begin
|
|
|
Creatememtbllr;
|
|
|
Getlr;
|
|
|
end;
|
|
|
2:
|
|
|
begin
|
|
|
CreatememtblCount;
|
|
|
GetCount;
|
|
|
end;
|
|
|
3:
|
|
|
begin
|
|
|
Creatememtblzjzy;
|
|
|
Getzjzy;
|
|
|
end;
|
|
|
4:
|
|
|
begin
|
|
|
Creatememtbllr;
|
|
|
Getywlr;
|
|
|
end;
|
|
|
5:
|
|
|
begin
|
|
|
Creatememtblnodr;
|
|
|
Getnodr;
|
|
|
end;
|
|
|
6:
|
|
|
begin
|
|
|
Creatememtblnocr;
|
|
|
Getnocr;
|
|
|
end;
|
|
|
7:
|
|
|
begin
|
|
|
Creatememtblmlv;
|
|
|
Getmlv;
|
|
|
end;
|
|
|
|
|
|
end;
|
|
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
|
|
procedure Tfrm_rp_hl_histry.Creatememtblnodr;
|
|
|
var
|
|
|
aDate,aToDate:TDate;
|
|
|
sDate,aYear,aMonth:String;
|
|
|
aColumn:TdxDBTreeListColumn;
|
|
|
aBand:TdxTreeListBand;
|
|
|
i:integer;
|
|
|
begin
|
|
|
|
|
|
|
|
|
dxDBGrid1.Bands.Clear;
|
|
|
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, 60, false);
|
|
|
|
|
|
aBand:=dxDBGrid1.Bands.Add;
|
|
|
aBand.Caption:='<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϣ';
|
|
|
aBand.Fixed:=BFLEFT;
|
|
|
aColumn:=dxDBGrid1.CreateColumn(TdxDBGridColumn);
|
|
|
if bsSkinComboBox1.ItemIndex<>0 then
|
|
|
aColumn.Caption:=bsSkinComboBox1.Text;
|
|
|
aColumn.BandIndex:=0;
|
|
|
aColumn.FieldName:='ͳ<>Ʊ<EFBFBD>';
|
|
|
|
|
|
|
|
|
|
|
|
aDate:=EncodeDate(strtoint(cbyear.text),strtoint(cbmonth.Text),1);
|
|
|
aToDate:=EncodeDate(strtoint(cbeyear.text),strtoint(cbemonth.Text),2);
|
|
|
i:=1;
|
|
|
|
|
|
while aDate<aToDate do begin
|
|
|
sDate:=FormatDateTime('YYYYMM',aDate);
|
|
|
aYear:=FormatDateTime('YYYY',aDate);
|
|
|
aMonth:=FormatDateTime('MM',aDate);
|
|
|
aBand:=dxDBGrid1.Bands.Add;
|
|
|
aBand.Caption:=aYear+aMonth;
|
|
|
|
|
|
aColumn:=dxDBGrid1.CreateColumn(TdxDBGridColumn);
|
|
|
aColumn.Caption:='δ<><CEB4>USD';
|
|
|
aColumn.FieldName:=sDate+'δ<><CEB4>USD';
|
|
|
aColumn.Width:=100;
|
|
|
aColumn.SummaryFooterType:=cstSum;
|
|
|
aColumn.BandIndex:=i;
|
|
|
memtblDetail.FieldDefs.Add(sDate+'δ<><CEB4>USD',ftFloat, 0, false);
|
|
|
|
|
|
aColumn:=dxDBGrid1.CreateColumn(TdxDBGridColumn);
|
|
|
aColumn.Caption:='δ<><CEB4>RMB';
|
|
|
aColumn.FieldName:=sDate+'δ<><CEB4>RMB';
|
|
|
aColumn.Width:=100;
|
|
|
aColumn.SummaryFooterType:=cstSum;
|
|
|
aColumn.BandIndex:=i;
|
|
|
memtblDetail.FieldDefs.Add(sDate+'δ<><CEB4>RMB',ftFloat, 0, false);
|
|
|
|
|
|
aColumn:=dxDBGrid1.CreateColumn(TdxDBGridColumn);
|
|
|
aColumn.Caption:='δ<>պϼ<D5BA>';
|
|
|
aColumn.FieldName:=sDate+'δ<>պϼ<D5BA>';
|
|
|
aColumn.Width:=100;
|
|
|
aColumn.SummaryFooterType:=cstSum;
|
|
|
aColumn.BandIndex:=i;
|
|
|
memtblDetail.FieldDefs.Add(sDate+'δ<>պϼ<D5BA>',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>δ<EFBFBD><CEB4>USD';
|
|
|
aColumn.SummaryFooterType:=cstSum;
|
|
|
aColumn.BandIndex:=i;
|
|
|
aColumn.Width:=120;
|
|
|
memtblDetail.FieldDefs.Add('<27>ϼ<EFBFBD>δ<EFBFBD><CEB4>USD',ftFloat, 0, false);
|
|
|
|
|
|
aColumn:=dxDBGrid1.CreateColumn(TdxDBGridColumn);
|
|
|
aColumn.Caption:='δ<><CEB4>RMB';
|
|
|
aColumn.FieldName:='<27>ϼ<EFBFBD>δ<EFBFBD><CEB4>RMB';
|
|
|
aColumn.SummaryFooterType:=cstSum;
|
|
|
aColumn.BandIndex:=i;
|
|
|
aColumn.Width:=120;
|
|
|
memtblDetail.FieldDefs.Add('<27>ϼ<EFBFBD>δ<EFBFBD><CEB4>RMB',ftFloat, 0, false);
|
|
|
|
|
|
aColumn:=dxDBGrid1.CreateColumn(TdxDBGridColumn);
|
|
|
aColumn.Caption:='δ<>պϼ<D5BA>';
|
|
|
aColumn.FieldName:='<27>ϼ<EFBFBD>δ<EFBFBD><CEB4>';
|
|
|
aColumn.SummaryFooterType:=cstSum;
|
|
|
aColumn.BandIndex:=i;
|
|
|
aColumn.Width:=120;
|
|
|
memtblDetail.FieldDefs.Add('<27>ϼ<EFBFBD>δ<EFBFBD><CEB4>',ftFloat, 0, false);
|
|
|
|
|
|
memtblDetail.CreateTable;
|
|
|
memtblDetail.Open;
|
|
|
end;
|
|
|
|
|
|
procedure Tfrm_rp_hl_histry.Getnodr;
|
|
|
var
|
|
|
aQuery:TAdoQuery;
|
|
|
aDate,aToDate:TDate;
|
|
|
strdate,stredate,sDate:String;
|
|
|
i:integer;
|
|
|
// S:TChartSeries;
|
|
|
begin
|
|
|
aQuery:=CreateAdoQuery_rpt();
|
|
|
|
|
|
try
|
|
|
with aQuery do begin
|
|
|
aDate:=EncodeDate(strtoint(cbYear.Text),strtoint(cbmonth.Text),1);
|
|
|
aToDate:=EncodeDate(strtoint(cbeYear.Text),strtoint(cbemonth.Text),2);
|
|
|
|
|
|
if not ASSIGNED(frm_sys_progress) then
|
|
|
frm_sys_progress:=tfrm_sys_progress.Create(application);
|
|
|
frm_sys_progress.Show;
|
|
|
if MonthsBetween(aDate,aToDate)=0 then
|
|
|
frm_sys_progress.bsSkinGauge1.MaxValue:=1
|
|
|
|
|
|
else
|
|
|
frm_sys_progress.bsSkinGauge1.MaxValue:=MonthsBetween(aDate,aToDate);
|
|
|
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',aDate)),strtoint(FormatDateTime('MM',aDate)),MonthDays[isLeapYear(strtoint(FormatDateTime('YYYY',aDate))),strtoint(FormatDateTime('MM',aDate))]));
|
|
|
stredate:=FormatDateTime('YYYY-MM-DD',aDate);
|
|
|
sDate:=FormatDateTime('YYYYMM',aDate);
|
|
|
CLOSE;
|
|
|
SQL.Clear;
|
|
|
if(bsSkinComboBox1.text='ί<>е<EFBFBD>λ_<CEBB><5F><EFBFBD><EFBFBD>˾') then begin
|
|
|
SQL.Add('Select V_op_bscard.ί<>е<EFBFBD>λ+''_''+V_op_bscard.<2E><><EFBFBD><EFBFBD>˾ ί<>е<EFBFBD>λ_<CEBB><5F><EFBFBD><EFBFBD>˾ ');
|
|
|
SQL.Add(',sum(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) δ<><CEB4>USD');
|
|
|
SQL.Add(',sum(case t_ch_fee.<2E>ұ<EFBFBD> when ''RMB'' then (t_ch_fee.<2E><><EFBFBD><EFBFBD>-t_ch_fee.<2E><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>) else 0 end) δ<><CEB4>RMB');
|
|
|
SQL.Add(',sum((t_ch_fee.<2E><><EFBFBD><EFBFBD>-t_ch_fee.<2E><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>)*t_ch_fee.<2E><><EFBFBD><EFBFBD>) δ<>պϼ<D5BA>');
|
|
|
SQL.Add(' from t_ch_fee inner join v_op_bscard on t_ch_fee.<2E><><EFBFBD><EFBFBD>=v_op_bscard.<2E><><EFBFBD><EFBFBD>');
|
|
|
SQL.Add(' where v_op_bscard.ҵ<><D2B5><EFBFBD><EFBFBD><EFBFBD><EFBFBD>=''<27><><EFBFBD>˳<EFBFBD><CBB3><EFBFBD>'' and v_op_bscard.<2E><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>>='''+stredate+''' and v_op_bscard.<2E><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><='''+strdate+'''');
|
|
|
SQL.Add(' and t_ch_fee.<2E><><EFBFBD><EFBFBD><>t_ch_fee.<2E><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> and t_ch_fee.<2E><><EFBFBD><EFBFBD>=''<27><>'' ');
|
|
|
if RxDBLookupCombo2.DisplayValues[1]<>'' then
|
|
|
SQL.Add(' and V_op_bscard.ί<>е<EFBFBD>λ='''+RxDBLookupCombo2.DisplayValues[1]+''' ');
|
|
|
if RxDBLookupCombo1.DisplayValues[1]<>'' then
|
|
|
SQL.Add(' and V_op_bscard.<2E><><EFBFBD><EFBFBD>˾='''+RxDBLookupCombo1.DisplayValues[1]+''' ');
|
|
|
if wwDBDateTimePicker7.text<>'' then
|
|
|
SQL.Add(' and V_op_bscard.ƾ֤<C6BE><D6A4><EFBFBD><EFBFBD>>='''+wwDBDateTimePicker7.text+''' ');
|
|
|
if wwDBDateTimePicker8.text<>'' then
|
|
|
SQL.Add(' and V_op_bscard.ƾ֤<C6BE><D6A4><EFBFBD><EFBFBD><='''+wwDBDateTimePicker8.text+''' ');
|
|
|
if Edit1.text<>''then
|
|
|
SQL.Add(' and V_op_bscard.<2E>˷<EFBFBD>Э<EFBFBD><D0AD><EFBFBD><EFBFBD> like ''%'+Edit1.text+'%'' ');
|
|
|
|
|
|
SQL.Add('group by V_op_bscard.ί<>е<EFBFBD>λ+''_''+V_op_bscard.<2E><><EFBFBD><EFBFBD>˾ ');
|
|
|
|
|
|
end else if(bsSkinComboBox1.text='<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>_<EFBFBD><5F><EFBFBD><EFBFBD>') then begin
|
|
|
SQL.Add('Select V_op_bscard.<2E><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>+''_''+V_op_bscard.<2E><><EFBFBD>۲<EFBFBD><DBB2><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>_<EFBFBD><5F><EFBFBD><EFBFBD> ');
|
|
|
SQL.Add(',sum(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) δ<><CEB4>USD');
|
|
|
SQL.Add(',sum(case t_ch_fee.<2E>ұ<EFBFBD> when ''RMB'' then (t_ch_fee.<2E><><EFBFBD><EFBFBD>-t_ch_fee.<2E><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>) else 0 end) δ<><CEB4>RMB');
|
|
|
SQL.Add(',sum((t_ch_fee.<2E><><EFBFBD><EFBFBD>-t_ch_fee.<2E><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>)*t_ch_fee.<2E><><EFBFBD><EFBFBD>) δ<>պϼ<D5BA>');
|
|
|
SQL.Add(' from t_ch_fee inner join v_op_bscard on t_ch_fee.<2E><><EFBFBD><EFBFBD>=v_op_bscard.<2E><><EFBFBD><EFBFBD>');
|
|
|
SQL.Add(' where v_op_bscard.ҵ<><D2B5><EFBFBD><EFBFBD><EFBFBD><EFBFBD>=''<27><><EFBFBD>˳<EFBFBD><CBB3><EFBFBD>'' and v_op_bscard.<2E><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>>='''+stredate+''' and v_op_bscard.<2E><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><='''+strdate+'''');
|
|
|
SQL.Add(' and t_ch_fee.<2E><><EFBFBD><EFBFBD><>t_ch_fee.<2E><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> and t_ch_fee.<2E><><EFBFBD><EFBFBD>=''<27><>'' ');
|
|
|
if RxDBLookupCombo2.DisplayValues[1]<>'' then
|
|
|
SQL.Add(' and V_op_bscard.ί<>е<EFBFBD>λ='''+RxDBLookupCombo2.DisplayValues[1]+''' ');
|
|
|
if RxDBLookupCombo1.DisplayValues[1]<>'' then
|
|
|
SQL.Add(' and V_op_bscard.<2E><><EFBFBD><EFBFBD>˾='''+RxDBLookupCombo1.DisplayValues[1]+''' ');
|
|
|
if wwDBDateTimePicker7.text<>'' then
|
|
|
SQL.Add(' and V_op_bscard.ƾ֤<C6BE><D6A4><EFBFBD><EFBFBD>>='''+wwDBDateTimePicker7.text+''' ');
|
|
|
if wwDBDateTimePicker8.text<>'' then
|
|
|
SQL.Add(' and V_op_bscard.ƾ֤<C6BE><D6A4><EFBFBD><EFBFBD><='''+wwDBDateTimePicker8.text+''' ');
|
|
|
if Edit1.text<>''then
|
|
|
SQL.Add(' and V_op_bscard.<2E>˷<EFBFBD>Э<EFBFBD><D0AD><EFBFBD><EFBFBD> like ''%'+Edit1.text+'%'' ');
|
|
|
|
|
|
SQL.Add('group by V_op_bscard.<2E><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>+''_''+V_op_bscard.<2E><><EFBFBD>۲<EFBFBD><DBB2><EFBFBD> ');
|
|
|
|
|
|
end else begin
|
|
|
|
|
|
SQL.Add('Select v_op_bscard.'+bsSkinComboBox1.text+'');
|
|
|
SQL.Add(',sum(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) δ<><CEB4>USD');
|
|
|
SQL.Add(',sum(case t_ch_fee.<2E>ұ<EFBFBD> when ''RMB'' then (t_ch_fee.<2E><><EFBFBD><EFBFBD>-t_ch_fee.<2E><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>) else 0 end) δ<><CEB4>RMB');
|
|
|
SQL.Add(',sum((t_ch_fee.<2E><><EFBFBD><EFBFBD>-t_ch_fee.<2E><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>)*t_ch_fee.<2E><><EFBFBD><EFBFBD>) δ<>պϼ<D5BA>');
|
|
|
SQL.Add(' from t_ch_fee inner join v_op_bscard on t_ch_fee.<2E><><EFBFBD><EFBFBD>=v_op_bscard.<2E><><EFBFBD><EFBFBD>');
|
|
|
SQL.Add(' where v_op_bscard.ҵ<><D2B5><EFBFBD><EFBFBD><EFBFBD><EFBFBD>=''<27><><EFBFBD>˳<EFBFBD><CBB3><EFBFBD>'' and v_op_bscard.<2E><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>>='''+stredate+''' and v_op_bscard.<2E><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><='''+strdate+'''');
|
|
|
if RxDBLookupCombo2.DisplayValues[1]<>'' then
|
|
|
SQL.Add(' and V_op_bscard.ί<>е<EFBFBD>λ='''+RxDBLookupCombo2.DisplayValues[1]+''' ');
|
|
|
if RxDBLookupCombo1.DisplayValues[1]<>'' then
|
|
|
SQL.Add(' and V_op_bscard.<2E><><EFBFBD><EFBFBD>˾='''+RxDBLookupCombo1.DisplayValues[1]+''' ');
|
|
|
if wwDBDateTimePicker7.text<>'' then
|
|
|
SQL.Add(' and V_op_bscard.ƾ֤<C6BE><D6A4><EFBFBD><EFBFBD>>='''+wwDBDateTimePicker7.text+''' ');
|
|
|
if wwDBDateTimePicker8.text<>'' then
|
|
|
SQL.Add(' and V_op_bscard.ƾ֤<C6BE><D6A4><EFBFBD><EFBFBD><='''+wwDBDateTimePicker8.text+''' ');
|
|
|
if Edit1.text<>''then
|
|
|
SQL.Add(' and V_op_bscard.<2E>˷<EFBFBD>Э<EFBFBD><D0AD><EFBFBD><EFBFBD> like ''%'+Edit1.text+'%'' ');
|
|
|
|
|
|
|
|
|
|
|
|
SQL.Add(' and t_ch_fee.<2E><><EFBFBD><EFBFBD><>t_ch_fee.<2E><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> and t_ch_fee.<2E><><EFBFBD><EFBFBD>=''<27><>'' ');
|
|
|
|
|
|
SQL.Add(' group by v_op_bscard.'+bsSkinComboBox1.text+'');
|
|
|
end;
|
|
|
Open;
|
|
|
if not IsEmpty then begin
|
|
|
first;
|
|
|
while not eof do begin
|
|
|
if memtblDetail.Locate('ͳ<>Ʊ<EFBFBD>',FieldbyName(bsSkinComboBox1.text).AsString,[]) then begin
|
|
|
memtblDetail.Edit;
|
|
|
memtblDetail.FieldByName(sDate+'δ<><CEB4>USD').AsFloat:=memtblDetail.FieldByName(sDate+'δ<><CEB4>USD').AsFloat+FieldByName('δ<><CEB4>USD').AsFloat;
|
|
|
memtblDetail.FieldByName('<27>ϼ<EFBFBD>δ<EFBFBD><CEB4>USD').AsFloat:=memtblDetail.FieldByName('<27>ϼ<EFBFBD>δ<EFBFBD><CEB4>USD').AsFloat+FieldByName('δ<><CEB4>USD').AsFloat;
|
|
|
memtblDetail.FieldByName(sDate+'δ<><CEB4>RMB').AsFloat:=memtblDetail.FieldByName(sDate+'δ<><CEB4>RMB').AsFloat+FieldByName('δ<><CEB4>RMB').AsFloat;
|
|
|
memtblDetail.FieldByName('<27>ϼ<EFBFBD>δ<EFBFBD><CEB4>RMB').AsFloat:=memtblDetail.FieldByName('<27>ϼ<EFBFBD>δ<EFBFBD><CEB4>RMB').AsFloat+FieldByName('δ<><CEB4>RMB').AsFloat;
|
|
|
memtblDetail.FieldByName(sDate+'δ<>պϼ<D5BA>').AsFloat:=memtblDetail.FieldByName(sDate+'δ<>պϼ<D5BA>').AsFloat+FieldByName('δ<>պϼ<D5BA>').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 begin
|
|
|
memtbldetail.Fields[i].AsString:=FieldByName(bsSkinComboBox1.text).AsString
|
|
|
end else
|
|
|
memtbldetail.Fields[i].AsFloat:=0;
|
|
|
end;
|
|
|
memtblDetail.FieldByName(sDate+'δ<><CEB4>USD').AsFloat:=memtblDetail.FieldByName(sDate+'δ<><CEB4>USD').AsFloat+FieldByName('δ<><CEB4>USD').AsFloat;
|
|
|
memtblDetail.FieldByName('<27>ϼ<EFBFBD>δ<EFBFBD><CEB4>USD').AsFloat:=memtblDetail.FieldByName('<27>ϼ<EFBFBD>δ<EFBFBD><CEB4>USD').AsFloat+FieldByName('δ<><CEB4>USD').AsFloat;
|
|
|
memtblDetail.FieldByName(sDate+'δ<><CEB4>RMB').AsFloat:=memtblDetail.FieldByName(sDate+'δ<><CEB4>RMB').AsFloat+FieldByName('δ<><CEB4>RMB').AsFloat;
|
|
|
memtblDetail.FieldByName('<27>ϼ<EFBFBD>δ<EFBFBD><CEB4>RMB').AsFloat:=memtblDetail.FieldByName('<27>ϼ<EFBFBD>δ<EFBFBD><CEB4>RMB').AsFloat+FieldByName('δ<><CEB4>RMB').AsFloat;
|
|
|
memtblDetail.FieldByName(sDate+'δ<>պϼ<D5BA>').AsFloat:=memtblDetail.FieldByName(sDate+'δ<>պϼ<D5BA>').AsFloat+FieldByName('δ<>պϼ<D5BA>').AsFloat;
|
|
|
memtblDetail.FieldByName('<27>ϼ<EFBFBD>δ<EFBFBD><CEB4>').AsFloat:=memtblDetail.FieldByName('<27>ϼ<EFBFBD>δ<EFBFBD><CEB4>').AsFloat+FieldByName('δ<>պϼ<D5BA>').AsFloat;
|
|
|
memtblDetail.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_hl_histry.Creatememtblnocr;
|
|
|
var
|
|
|
aDate,aToDate:TDate;
|
|
|
sDate,aYear,aMonth:String;
|
|
|
aColumn:TdxDBTreeListColumn;
|
|
|
aBand:TdxTreeListBand;
|
|
|
i:integer;
|
|
|
begin
|
|
|
|
|
|
|
|
|
dxDBGrid1.Bands.Clear;
|
|
|
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, 60, false);
|
|
|
|
|
|
aBand:=dxDBGrid1.Bands.Add;
|
|
|
aBand.Caption:='<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϣ';
|
|
|
aBand.Fixed:=BFLEFT;
|
|
|
aColumn:=dxDBGrid1.CreateColumn(TdxDBGridColumn);
|
|
|
if bsSkinComboBox1.ItemIndex<>0 then
|
|
|
aColumn.Caption:=bsSkinComboBox1.Text;
|
|
|
aColumn.BandIndex:=0;
|
|
|
aColumn.FieldName:='ͳ<>Ʊ<EFBFBD>';
|
|
|
|
|
|
|
|
|
|
|
|
aDate:=EncodeDate(strtoint(cbyear.text),strtoint(cbmonth.Text),1);
|
|
|
aToDate:=EncodeDate(strtoint(cbeyear.text),strtoint(cbemonth.Text),2);
|
|
|
i:=1;
|
|
|
|
|
|
while aDate<aToDate do begin
|
|
|
sDate:=FormatDateTime('YYYYMM',aDate);
|
|
|
aYear:=FormatDateTime('YYYY',aDate);
|
|
|
aMonth:=FormatDateTime('MM',aDate);
|
|
|
aBand:=dxDBGrid1.Bands.Add;
|
|
|
aBand.Caption:=aYear+aMonth;
|
|
|
|
|
|
aColumn:=dxDBGrid1.CreateColumn(TdxDBGridColumn);
|
|
|
aColumn.Caption:='δ<><CEB4>USD';
|
|
|
aColumn.FieldName:=sDate+'δ<><CEB4>USD';
|
|
|
aColumn.Width:=100;
|
|
|
aColumn.SummaryFooterType:=cstSum;
|
|
|
aColumn.BandIndex:=i;
|
|
|
memtblDetail.FieldDefs.Add(sDate+'δ<><CEB4>USD',ftFloat, 0, false);
|
|
|
|
|
|
aColumn:=dxDBGrid1.CreateColumn(TdxDBGridColumn);
|
|
|
aColumn.Caption:='δ<><CEB4>RMB';
|
|
|
aColumn.FieldName:=sDate+'δ<><CEB4>RMB';
|
|
|
aColumn.Width:=100;
|
|
|
aColumn.SummaryFooterType:=cstSum;
|
|
|
aColumn.BandIndex:=i;
|
|
|
memtblDetail.FieldDefs.Add(sDate+'δ<><CEB4>RMB',ftFloat, 0, false);
|
|
|
|
|
|
aColumn:=dxDBGrid1.CreateColumn(TdxDBGridColumn);
|
|
|
aColumn.Caption:='δ<><CEB4><EFBFBD>ϼ<EFBFBD>';
|
|
|
aColumn.FieldName:=sDate+'δ<><CEB4><EFBFBD>ϼ<EFBFBD>';
|
|
|
aColumn.Width:=100;
|
|
|
aColumn.SummaryFooterType:=cstSum;
|
|
|
aColumn.BandIndex:=i;
|
|
|
memtblDetail.FieldDefs.Add(sDate+'δ<><CEB4><EFBFBD>ϼ<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>δ<EFBFBD><CEB4>USD';
|
|
|
aColumn.SummaryFooterType:=cstSum;
|
|
|
aColumn.BandIndex:=i;
|
|
|
aColumn.Width:=120;
|
|
|
memtblDetail.FieldDefs.Add('<27>ϼ<EFBFBD>δ<EFBFBD><CEB4>USD',ftFloat, 0, false);
|
|
|
|
|
|
aColumn:=dxDBGrid1.CreateColumn(TdxDBGridColumn);
|
|
|
aColumn.Caption:='δ<><CEB4>RMB';
|
|
|
aColumn.FieldName:='<27>ϼ<EFBFBD>δ<EFBFBD><CEB4>RMB';
|
|
|
aColumn.SummaryFooterType:=cstSum;
|
|
|
aColumn.BandIndex:=i;
|
|
|
aColumn.Width:=120;
|
|
|
memtblDetail.FieldDefs.Add('<27>ϼ<EFBFBD>δ<EFBFBD><CEB4>RMB',ftFloat, 0, false);
|
|
|
|
|
|
aColumn:=dxDBGrid1.CreateColumn(TdxDBGridColumn);
|
|
|
aColumn.Caption:='δ<><CEB4><EFBFBD>ϼ<EFBFBD>';
|
|
|
aColumn.FieldName:='<27>ϼ<EFBFBD>δ<EFBFBD><CEB4>';
|
|
|
aColumn.SummaryFooterType:=cstSum;
|
|
|
aColumn.BandIndex:=i;
|
|
|
aColumn.Width:=120;
|
|
|
memtblDetail.FieldDefs.Add('<27>ϼ<EFBFBD>δ<EFBFBD><CEB4>',ftFloat, 0, false);
|
|
|
|
|
|
memtblDetail.CreateTable;
|
|
|
memtblDetail.Open;
|
|
|
end;
|
|
|
|
|
|
procedure Tfrm_rp_hl_histry.Getnocr;
|
|
|
var
|
|
|
aQuery:TAdoQuery;
|
|
|
aDate,aToDate:TDate;
|
|
|
strdate,stredate,sDate:String;
|
|
|
i:integer;
|
|
|
// S:TChartSeries;
|
|
|
begin
|
|
|
aQuery:=CreateAdoQuery_rpt();
|
|
|
|
|
|
try
|
|
|
with aQuery do begin
|
|
|
aDate:=EncodeDate(strtoint(cbYear.Text),strtoint(cbmonth.Text),1);
|
|
|
aToDate:=EncodeDate(strtoint(cbeYear.Text),strtoint(cbemonth.Text),2);
|
|
|
|
|
|
if not ASSIGNED(frm_sys_progress) then
|
|
|
frm_sys_progress:=tfrm_sys_progress.Create(application);
|
|
|
frm_sys_progress.Show;
|
|
|
if MonthsBetween(aDate,aToDate)=0 then
|
|
|
frm_sys_progress.bsSkinGauge1.MaxValue:=1
|
|
|
|
|
|
else
|
|
|
frm_sys_progress.bsSkinGauge1.MaxValue:=MonthsBetween(aDate,aToDate);
|
|
|
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',aDate)),strtoint(FormatDateTime('MM',aDate)),MonthDays[isLeapYear(strtoint(FormatDateTime('YYYY',aDate))),strtoint(FormatDateTime('MM',aDate))]));
|
|
|
stredate:=FormatDateTime('YYYY-MM-DD',aDate);
|
|
|
sDate:=FormatDateTime('YYYYMM',aDate);
|
|
|
CLOSE;
|
|
|
SQL.Clear;
|
|
|
if(bsSkinComboBox1.text='ί<>е<EFBFBD>λ_<CEBB><5F><EFBFBD><EFBFBD>˾') then begin
|
|
|
SQL.Add('Select V_op_bscard.ί<>е<EFBFBD>λ+''_''+V_op_bscard.<2E><><EFBFBD><EFBFBD>˾ ί<>е<EFBFBD>λ_<CEBB><5F><EFBFBD><EFBFBD>˾ ');
|
|
|
SQL.Add(',sum(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) δ<><CEB4>USD');
|
|
|
SQL.Add(',sum(case t_ch_fee.<2E>ұ<EFBFBD> when ''RMB'' then (t_ch_fee.<2E><><EFBFBD><EFBFBD>-t_ch_fee.<2E><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>) else 0 end) δ<><CEB4>RMB');
|
|
|
SQL.Add(',sum((t_ch_fee.<2E><><EFBFBD><EFBFBD>-t_ch_fee.<2E><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>)*t_ch_fee.<2E><><EFBFBD><EFBFBD>) δ<><CEB4><EFBFBD>ϼ<EFBFBD>');
|
|
|
SQL.Add(' from t_ch_fee inner join v_op_bscard on t_ch_fee.<2E><><EFBFBD><EFBFBD>=v_op_bscard.<2E><><EFBFBD><EFBFBD>');
|
|
|
SQL.Add(' where v_op_bscard.ҵ<><D2B5><EFBFBD><EFBFBD><EFBFBD><EFBFBD>=''<27><><EFBFBD>˳<EFBFBD><CBB3><EFBFBD>'' and v_op_bscard.<2E><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>>='''+stredate+''' and v_op_bscard.<2E><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><='''+strdate+'''');
|
|
|
SQL.Add(' and t_ch_fee.<2E><><EFBFBD><EFBFBD><>t_ch_fee.<2E><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> and t_ch_fee.<2E><><EFBFBD><EFBFBD>=''<27><>'' ');
|
|
|
if RxDBLookupCombo2.DisplayValues[1]<>'' then
|
|
|
SQL.Add(' and V_op_bscard.ί<>е<EFBFBD>λ='''+RxDBLookupCombo2.DisplayValues[1]+''' ');
|
|
|
if RxDBLookupCombo1.DisplayValues[1]<>'' then
|
|
|
SQL.Add(' and V_op_bscard.<2E><><EFBFBD><EFBFBD>˾='''+RxDBLookupCombo1.DisplayValues[1]+''' ');
|
|
|
if wwDBDateTimePicker7.text<>'' then
|
|
|
SQL.Add(' and V_op_bscard.ƾ֤<C6BE><D6A4><EFBFBD><EFBFBD>>='''+wwDBDateTimePicker7.text+''' ');
|
|
|
if wwDBDateTimePicker8.text<>'' then
|
|
|
SQL.Add(' and V_op_bscard.ƾ֤<C6BE><D6A4><EFBFBD><EFBFBD><='''+wwDBDateTimePicker8.text+''' ');
|
|
|
if Edit1.text<>''then
|
|
|
SQL.Add(' and V_op_bscard.<2E>˷<EFBFBD>Э<EFBFBD><D0AD><EFBFBD><EFBFBD> like ''%'+Edit1.text+'%'' ');
|
|
|
|
|
|
|
|
|
SQL.Add('group by V_op_bscard.ί<>е<EFBFBD>λ+''_''+V_op_bscard.<2E><><EFBFBD><EFBFBD>˾ ');
|
|
|
|
|
|
end else if(bsSkinComboBox1.text='<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>_<EFBFBD><5F><EFBFBD><EFBFBD>') then begin
|
|
|
SQL.Add('Select V_op_bscard.<2E><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>+''_''+V_op_bscard.<2E><><EFBFBD>۲<EFBFBD><DBB2><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>_<EFBFBD><5F><EFBFBD><EFBFBD> ');
|
|
|
SQL.Add(',sum(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) δ<><CEB4>USD');
|
|
|
SQL.Add(',sum(case t_ch_fee.<2E>ұ<EFBFBD> when ''RMB'' then (t_ch_fee.<2E><><EFBFBD><EFBFBD>-t_ch_fee.<2E><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>) else 0 end) δ<><CEB4>RMB');
|
|
|
SQL.Add(',sum((t_ch_fee.<2E><><EFBFBD><EFBFBD>-t_ch_fee.<2E><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>)*t_ch_fee.<2E><><EFBFBD><EFBFBD>) δ<><CEB4><EFBFBD>ϼ<EFBFBD>');
|
|
|
SQL.Add(' from t_ch_fee inner join v_op_bscard on t_ch_fee.<2E><><EFBFBD><EFBFBD>=v_op_bscard.<2E><><EFBFBD><EFBFBD>');
|
|
|
SQL.Add(' where v_op_bscard.ҵ<><D2B5><EFBFBD><EFBFBD><EFBFBD><EFBFBD>=''<27><><EFBFBD>˳<EFBFBD><CBB3><EFBFBD>'' and v_op_bscard.<2E><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>>='''+stredate+''' and v_op_bscard.<2E><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><='''+strdate+'''');
|
|
|
SQL.Add(' and t_ch_fee.<2E><><EFBFBD><EFBFBD><>t_ch_fee.<2E><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> and t_ch_fee.<2E><><EFBFBD><EFBFBD>=''<27><>'' ');
|
|
|
if RxDBLookupCombo2.DisplayValues[1]<>'' then
|
|
|
SQL.Add(' and V_op_bscard.ί<>е<EFBFBD>λ='''+RxDBLookupCombo2.DisplayValues[1]+''' ');
|
|
|
if RxDBLookupCombo1.DisplayValues[1]<>'' then
|
|
|
SQL.Add(' and V_op_bscard.<2E><><EFBFBD><EFBFBD>˾='''+RxDBLookupCombo1.DisplayValues[1]+''' ');
|
|
|
if wwDBDateTimePicker7.text<>'' then
|
|
|
SQL.Add(' and V_op_bscard.ƾ֤<C6BE><D6A4><EFBFBD><EFBFBD>>='''+wwDBDateTimePicker7.text+''' ');
|
|
|
if wwDBDateTimePicker8.text<>'' then
|
|
|
SQL.Add(' and V_op_bscard.ƾ֤<C6BE><D6A4><EFBFBD><EFBFBD><='''+wwDBDateTimePicker8.text+''' ');
|
|
|
if Edit1.text<>''then
|
|
|
SQL.Add(' and V_op_bscard.<2E>˷<EFBFBD>Э<EFBFBD><D0AD><EFBFBD><EFBFBD> like ''%'+Edit1.text+'%'' ');
|
|
|
|
|
|
|
|
|
SQL.Add('group by V_op_bscard.<2E><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>+''_''+V_op_bscard.<2E><><EFBFBD>۲<EFBFBD><DBB2><EFBFBD> ');
|
|
|
|
|
|
end else begin
|
|
|
SQL.Add('Select v_op_bscard.'+bsSkinComboBox1.text+'');
|
|
|
SQL.Add(',sum(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) δ<><CEB4>USD');
|
|
|
SQL.Add(',sum(case t_ch_fee.<2E>ұ<EFBFBD> when ''RMB'' then (t_ch_fee.<2E><><EFBFBD><EFBFBD>-t_ch_fee.<2E><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>) else 0 end) δ<><CEB4>RMB');
|
|
|
SQL.Add(',sum((t_ch_fee.<2E><><EFBFBD><EFBFBD>-t_ch_fee.<2E><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>)*t_ch_fee.<2E><><EFBFBD><EFBFBD>) δ<><CEB4><EFBFBD>ϼ<EFBFBD>');
|
|
|
SQL.Add(' from t_ch_fee inner join v_op_bscard on t_ch_fee.<2E><><EFBFBD><EFBFBD>=v_op_bscard.<2E><><EFBFBD><EFBFBD>');
|
|
|
SQL.Add(' where v_op_bscard.ҵ<><D2B5><EFBFBD><EFBFBD><EFBFBD><EFBFBD>=''<27><><EFBFBD>˳<EFBFBD><CBB3><EFBFBD>'' and v_op_bscard.<2E><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>>='''+stredate+''' and v_op_bscard.<2E><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><='''+strdate+'''');
|
|
|
SQL.Add(' and t_ch_fee.<2E><><EFBFBD><EFBFBD><>t_ch_fee.<2E><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> and t_ch_fee.<2E><><EFBFBD><EFBFBD>=''<27><>'' ');
|
|
|
if RxDBLookupCombo2.DisplayValues[1]<>'' then
|
|
|
SQL.Add(' and V_op_bscard.ί<>е<EFBFBD>λ='''+RxDBLookupCombo2.DisplayValues[1]+''' ');
|
|
|
if RxDBLookupCombo1.DisplayValues[1]<>'' then
|
|
|
SQL.Add(' and V_op_bscard.<2E><><EFBFBD><EFBFBD>˾='''+RxDBLookupCombo1.DisplayValues[1]+''' ');
|
|
|
if wwDBDateTimePicker7.text<>'' then
|
|
|
SQL.Add(' and V_op_bscard.ƾ֤<C6BE><D6A4><EFBFBD><EFBFBD>>='''+wwDBDateTimePicker7.text+''' ');
|
|
|
if wwDBDateTimePicker8.text<>'' then
|
|
|
SQL.Add(' and V_op_bscard.ƾ֤<C6BE><D6A4><EFBFBD><EFBFBD><='''+wwDBDateTimePicker8.text+''' ');
|
|
|
if Edit1.text<>''then
|
|
|
SQL.Add(' and V_op_bscard.<2E>˷<EFBFBD>Э<EFBFBD><D0AD><EFBFBD><EFBFBD> like ''%'+Edit1.text+'%'' ');
|
|
|
|
|
|
|
|
|
SQL.Add(' group by v_op_bscard.'+bsSkinComboBox1.text+'');
|
|
|
end;
|
|
|
Open;
|
|
|
if not IsEmpty then begin
|
|
|
first;
|
|
|
while not eof do begin
|
|
|
if memtblDetail.Locate('ͳ<>Ʊ<EFBFBD>',FieldbyName(bsSkinComboBox1.text).AsString,[]) then begin
|
|
|
memtblDetail.Edit;
|
|
|
memtblDetail.FieldByName(sDate+'δ<><CEB4>USD').AsFloat:=memtblDetail.FieldByName(sDate+'δ<><CEB4>USD').AsFloat+FieldByName('δ<><CEB4>USD').AsFloat;
|
|
|
memtblDetail.FieldByName('<27>ϼ<EFBFBD>δ<EFBFBD><CEB4>USD').AsFloat:=memtblDetail.FieldByName('<27>ϼ<EFBFBD>δ<EFBFBD><CEB4>USD').AsFloat+FieldByName('δ<><CEB4>USD').AsFloat;
|
|
|
memtblDetail.FieldByName(sDate+'δ<><CEB4>RMB').AsFloat:=memtblDetail.FieldByName(sDate+'δ<><CEB4>RMB').AsFloat+FieldByName('δ<><CEB4>RMB').AsFloat;
|
|
|
memtblDetail.FieldByName('<27>ϼ<EFBFBD>δ<EFBFBD><CEB4>RMB').AsFloat:=memtblDetail.FieldByName('<27>ϼ<EFBFBD>δ<EFBFBD><CEB4>RMB').AsFloat+FieldByName('δ<><CEB4>RMB').AsFloat;
|
|
|
memtblDetail.FieldByName(sDate+'δ<><CEB4><EFBFBD>ϼ<EFBFBD>').AsFloat:=memtblDetail.FieldByName(sDate+'δ<><CEB4><EFBFBD>ϼ<EFBFBD>').AsFloat+FieldByName('δ<><CEB4><EFBFBD>ϼ<EFBFBD>').AsFloat;
|
|
|
memtblDetail.FieldByName('<27>ϼ<EFBFBD>δ<EFBFBD><CEB4>').AsFloat:=memtblDetail.FieldByName('<27>ϼ<EFBFBD>δ<EFBFBD><CEB4>').AsFloat+FieldByName('δ<><CEB4><EFBFBD>ϼ<EFBFBD>').AsFloat;
|
|
|
memtblDetail.Post;
|
|
|
end else begin
|
|
|
memtblDetail.Insert;
|
|
|
for i:=0 to memtbldetail.FieldCount-1 do begin
|
|
|
if memtbldetail.Fields[i].FieldName='ͳ<>Ʊ<EFBFBD>' then begin
|
|
|
memtbldetail.Fields[i].AsString:=FieldByName(bsSkinComboBox1.text).AsString
|
|
|
end else
|
|
|
memtbldetail.Fields[i].AsFloat:=0;
|
|
|
end;
|
|
|
memtblDetail.FieldByName(sDate+'δ<><CEB4>USD').AsFloat:=memtblDetail.FieldByName(sDate+'δ<><CEB4>USD').AsFloat+FieldByName('δ<><CEB4>USD').AsFloat;
|
|
|
memtblDetail.FieldByName('<27>ϼ<EFBFBD>δ<EFBFBD><CEB4>USD').AsFloat:=memtblDetail.FieldByName('<27>ϼ<EFBFBD>δ<EFBFBD><CEB4>USD').AsFloat+FieldByName('δ<><CEB4>USD').AsFloat;
|
|
|
memtblDetail.FieldByName(sDate+'δ<><CEB4>RMB').AsFloat:=memtblDetail.FieldByName(sDate+'δ<><CEB4>RMB').AsFloat+FieldByName('δ<><CEB4>RMB').AsFloat;
|
|
|
memtblDetail.FieldByName('<27>ϼ<EFBFBD>δ<EFBFBD><CEB4>RMB').AsFloat:=memtblDetail.FieldByName('<27>ϼ<EFBFBD>δ<EFBFBD><CEB4>RMB').AsFloat+FieldByName('δ<><CEB4>RMB').AsFloat;
|
|
|
memtblDetail.FieldByName(sDate+'δ<><CEB4><EFBFBD>ϼ<EFBFBD>').AsFloat:=memtblDetail.FieldByName(sDate+'δ<><CEB4><EFBFBD>ϼ<EFBFBD>').AsFloat+FieldByName('δ<><CEB4><EFBFBD>ϼ<EFBFBD>').AsFloat;
|
|
|
memtblDetail.FieldByName('<27>ϼ<EFBFBD>δ<EFBFBD><CEB4>').AsFloat:=memtblDetail.FieldByName('<27>ϼ<EFBFBD>δ<EFBFBD><CEB4>').AsFloat+FieldByName('δ<><CEB4><EFBFBD>ϼ<EFBFBD>').AsFloat;
|
|
|
memtblDetail.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_hl_histry.Creatememtblmlv;
|
|
|
var
|
|
|
aDate,aToDate:TDate;
|
|
|
sDate,aYear,aMonth:String;
|
|
|
aColumn:TdxDBTreeListColumn;
|
|
|
aBand:TdxTreeListBand;
|
|
|
i:integer;
|
|
|
begin
|
|
|
|
|
|
|
|
|
dxDBGrid1.Bands.Clear;
|
|
|
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, 60, false);
|
|
|
|
|
|
aBand:=dxDBGrid1.Bands.Add;
|
|
|
aBand.Caption:='<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϣ';
|
|
|
aBand.Fixed:=BFLEFT;
|
|
|
aColumn:=dxDBGrid1.CreateColumn(TdxDBGridColumn);
|
|
|
if bsSkinComboBox1.ItemIndex<>0 then
|
|
|
aColumn.Caption:=bsSkinComboBox1.Text;
|
|
|
aColumn.BandIndex:=0;
|
|
|
aColumn.FieldName:='ͳ<>Ʊ<EFBFBD>';
|
|
|
|
|
|
|
|
|
|
|
|
aDate:=EncodeDate(strtoint(cbyear.text),strtoint(cbmonth.Text),1);
|
|
|
aToDate:=EncodeDate(strtoint(cbeyear.text),strtoint(cbemonth.Text),2);
|
|
|
i:=1;
|
|
|
|
|
|
while aDate<aToDate do begin
|
|
|
sDate:=FormatDateTime('YYYYMM',aDate);
|
|
|
aYear:=FormatDateTime('YYYY',aDate);
|
|
|
aMonth:=FormatDateTime('MM',aDate);
|
|
|
aBand:=dxDBGrid1.Bands.Add;
|
|
|
aBand.Caption:=aYear+aMonth;
|
|
|
|
|
|
aColumn:=dxDBGrid1.CreateColumn(TdxDBGridColumn);
|
|
|
aColumn.Caption:='ë<><C3AB><EFBFBD><EFBFBD>';
|
|
|
aColumn.FieldName:=sDate+'ë<><C3AB><EFBFBD><EFBFBD>';
|
|
|
aColumn.Width:=100;
|
|
|
// aColumn.SummaryFooterType:=cstSum;
|
|
|
aColumn.BandIndex:=i;
|
|
|
memtblDetail.FieldDefs.Add(sDate+'<27><><EFBFBD><EFBFBD>',ftFloat, 0, false);
|
|
|
memtblDetail.FieldDefs.Add(sDate+'<27>ʽ<EFBFBD>ռ<EFBFBD><D5BC>',ftFloat, 0, false);
|
|
|
memtblDetail.FieldDefs.Add(sDate+'ë<><C3AB><EFBFBD><EFBFBD>',ftString, 20, false);
|
|
|
aDate:=IncMonth(aDate,1);
|
|
|
Inc(i);
|
|
|
end;
|
|
|
|
|
|
|
|
|
aBand:=dxDBGrid1.Bands.Add;
|
|
|
aBand.Caption:='<27>ϼ<EFBFBD>';
|
|
|
aColumn:=dxDBGrid1.CreateColumn(TdxDBGridColumn);
|
|
|
aColumn.Caption:='ë<><C3AB><EFBFBD><EFBFBD>';
|
|
|
aColumn.FieldName:='<27>ϼ<EFBFBD>ë<EFBFBD><C3AB><EFBFBD><EFBFBD>';
|
|
|
// aColumn.SummaryFooterType:=cstSum;
|
|
|
aColumn.BandIndex:=i;
|
|
|
aColumn.Width:=120;
|
|
|
memtblDetail.FieldDefs.Add('<27>ϼ<EFBFBD><CFBC><EFBFBD><EFBFBD><EFBFBD>',ftFloat, 0, false);
|
|
|
memtblDetail.FieldDefs.Add('<27>ϼ<EFBFBD><CFBC>ʽ<EFBFBD>ռ<EFBFBD><D5BC>',ftFloat, 0, false);
|
|
|
memtblDetail.FieldDefs.Add('<27>ϼ<EFBFBD>ë<EFBFBD><C3AB><EFBFBD><EFBFBD>',ftString, 20, false);
|
|
|
memtblDetail.CreateTable;
|
|
|
memtblDetail.Open;
|
|
|
end;
|
|
|
|
|
|
procedure Tfrm_rp_hl_histry.Getmlv;
|
|
|
var
|
|
|
aQuery:TAdoQuery;
|
|
|
aDate,aToDate:TDate;
|
|
|
strdate,stredate,sDate:String;
|
|
|
i:integer;
|
|
|
// S:TChartSeries;
|
|
|
begin
|
|
|
|
|
|
|
|
|
|
|
|
aQuery:=CreateAdoQuery_rpt();
|
|
|
|
|
|
try
|
|
|
with aQuery do begin
|
|
|
aDate:=EncodeDate(strtoint(cbYear.Text),strtoint(cbmonth.Text),1);
|
|
|
aToDate:=EncodeDate(strtoint(cbeYear.Text),strtoint(cbemonth.Text),2);
|
|
|
|
|
|
if not ASSIGNED(frm_sys_progress) then
|
|
|
frm_sys_progress:=tfrm_sys_progress.Create(application);
|
|
|
frm_sys_progress.Show;
|
|
|
if MonthsBetween(aDate,aToDate)=0 then
|
|
|
frm_sys_progress.bsSkinGauge1.MaxValue:=1
|
|
|
|
|
|
else
|
|
|
frm_sys_progress.bsSkinGauge1.MaxValue:=MonthsBetween(aDate,aToDate);
|
|
|
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',aDate)),strtoint(FormatDateTime('MM',aDate)),MonthDays[isLeapYear(strtoint(FormatDateTime('YYYY',aDate))),strtoint(FormatDateTime('MM',aDate))]));
|
|
|
stredate:=FormatDateTime('YYYY-MM-DD',aDate);
|
|
|
sDate:=FormatDateTime('YYYYMM',aDate);
|
|
|
CLOSE;
|
|
|
SQL.Clear;
|
|
|
if(bsSkinComboBox1.text='ί<>е<EFBFBD>λ_<CEBB><5F><EFBFBD><EFBFBD>˾') then begin
|
|
|
SQL.Add('Select v_op_bscard.ί<>е<EFBFBD>λ+''_''+v_op_bscard.<2E><><EFBFBD><EFBFBD>˾ ί<>е<EFBFBD>λ_<CEBB><5F><EFBFBD><EFBFBD>˾ ');
|
|
|
SQL.Add(',sum(ë<><C3AB><EFBFBD><EFBFBD>) <20><><EFBFBD><EFBFBD>');
|
|
|
case bsSkinComboBox1.ItemIndex of
|
|
|
2,3:SQL.Add(',sum(<28>ϼ<EFBFBD>Ӧ<EFBFBD><D3A6>) <20>ʽ<EFBFBD>ռ<EFBFBD><D5BC>');
|
|
|
else SQL.Add(',sum(<28>ϼ<EFBFBD>Ӧ<EFBFBD><D3A6>) <20>ʽ<EFBFBD>ռ<EFBFBD><D5BC>');
|
|
|
end;
|
|
|
SQL.Add('from v_op_bscard where ҵ<><D2B5><EFBFBD><EFBFBD><EFBFBD><EFBFBD>=''<27><><EFBFBD>˳<EFBFBD><CBB3><EFBFBD>'' and v_op_bscard.<2E><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>>='''+stredate+''' and v_op_bscard.<2E><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><='''+strdate+'''');
|
|
|
if RxDBLookupCombo2.DisplayValues[1]<>'' then
|
|
|
SQL.Add(' and V_op_bscard.ί<>е<EFBFBD>λ='''+RxDBLookupCombo2.DisplayValues[1]+''' ');
|
|
|
if RxDBLookupCombo1.DisplayValues[1]<>'' then
|
|
|
SQL.Add(' and V_op_bscard.<2E><><EFBFBD><EFBFBD>˾='''+RxDBLookupCombo1.DisplayValues[1]+''' ');
|
|
|
if wwDBDateTimePicker7.text<>'' then
|
|
|
SQL.Add(' and V_op_bscard.ƾ֤<C6BE><D6A4><EFBFBD><EFBFBD>>='''+wwDBDateTimePicker7.text+''' ');
|
|
|
if wwDBDateTimePicker8.text<>'' then
|
|
|
SQL.Add(' and V_op_bscard.ƾ֤<C6BE><D6A4><EFBFBD><EFBFBD><='''+wwDBDateTimePicker8.text+''' ');
|
|
|
if Edit1.text<>''then
|
|
|
SQL.Add(' and V_op_bscard.<2E>˷<EFBFBD>Э<EFBFBD><D0AD><EFBFBD><EFBFBD> like ''%'+Edit1.text+'%'' ');
|
|
|
|
|
|
|
|
|
SQL.Add('group by v_op_bscard.ί<>е<EFBFBD>λ+''_''+v_op_bscard.<2E><><EFBFBD><EFBFBD>˾ ');
|
|
|
|
|
|
end else if(bsSkinComboBox1.text='<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>_<EFBFBD><5F><EFBFBD><EFBFBD>') then begin
|
|
|
SQL.Add('Select v_op_bscard.<2E><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>+''_''+v_op_bscard.<2E><><EFBFBD>۲<EFBFBD><DBB2><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>_<EFBFBD><5F><EFBFBD><EFBFBD> ');
|
|
|
SQL.Add(',sum(ë<><C3AB><EFBFBD><EFBFBD>) <20><><EFBFBD><EFBFBD>');
|
|
|
case bsSkinComboBox1.ItemIndex of
|
|
|
2,3:SQL.Add(',sum(<28>ϼ<EFBFBD>Ӧ<EFBFBD><D3A6>) <20>ʽ<EFBFBD>ռ<EFBFBD><D5BC>');
|
|
|
else SQL.Add(',sum(<28>ϼ<EFBFBD>Ӧ<EFBFBD><D3A6>) <20>ʽ<EFBFBD>ռ<EFBFBD><D5BC>');
|
|
|
end;
|
|
|
SQL.Add('from v_op_bscard where ҵ<><D2B5><EFBFBD><EFBFBD><EFBFBD><EFBFBD>=''<27><><EFBFBD>˳<EFBFBD><CBB3><EFBFBD>'' and v_op_bscard.<2E><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>>='''+stredate+''' and v_op_bscard.<2E><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><='''+strdate+'''');
|
|
|
if RxDBLookupCombo2.DisplayValues[1]<>'' then
|
|
|
SQL.Add(' and V_op_bscard.ί<>е<EFBFBD>λ='''+RxDBLookupCombo2.DisplayValues[1]+''' ');
|
|
|
if RxDBLookupCombo1.DisplayValues[1]<>'' then
|
|
|
SQL.Add(' and V_op_bscard.<2E><><EFBFBD><EFBFBD>˾='''+RxDBLookupCombo1.DisplayValues[1]+''' ');
|
|
|
if wwDBDateTimePicker7.text<>'' then
|
|
|
SQL.Add(' and V_op_bscard.ƾ֤<C6BE><D6A4><EFBFBD><EFBFBD>>='''+wwDBDateTimePicker7.text+''' ');
|
|
|
if wwDBDateTimePicker8.text<>'' then
|
|
|
SQL.Add(' and V_op_bscard.ƾ֤<C6BE><D6A4><EFBFBD><EFBFBD><='''+wwDBDateTimePicker8.text+''' ');
|
|
|
if Edit1.text<>''then
|
|
|
SQL.Add(' and V_op_bscard.<2E>˷<EFBFBD>Э<EFBFBD><D0AD><EFBFBD><EFBFBD> like ''%'+Edit1.text+'%'' ');
|
|
|
|
|
|
|
|
|
SQL.Add('group by v_op_bscard.<2E><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>+''_''+v_op_bscard.<2E><><EFBFBD>۲<EFBFBD><DBB2><EFBFBD> ');
|
|
|
|
|
|
end else begin
|
|
|
|
|
|
SQL.Add('Select v_op_bscard.'+bsSkinComboBox1.text+'');
|
|
|
SQL.Add(',sum(ë<><C3AB><EFBFBD><EFBFBD>) <20><><EFBFBD><EFBFBD>');
|
|
|
case bsSkinComboBox1.ItemIndex of
|
|
|
2,3:SQL.Add(',sum(<28>ϼ<EFBFBD>Ӧ<EFBFBD><D3A6>) <20>ʽ<EFBFBD>ռ<EFBFBD><D5BC>');
|
|
|
else SQL.Add(',sum(<28>ϼ<EFBFBD>Ӧ<EFBFBD><D3A6>) <20>ʽ<EFBFBD>ռ<EFBFBD><D5BC>');
|
|
|
end;
|
|
|
SQL.Add('from v_op_bscard where ҵ<><D2B5><EFBFBD><EFBFBD><EFBFBD><EFBFBD>=''<27><><EFBFBD>˳<EFBFBD><CBB3><EFBFBD>'' and v_op_bscard.<2E><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>>='''+stredate+''' and v_op_bscard.<2E><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><='''+strdate+'''');
|
|
|
if RxDBLookupCombo2.DisplayValues[1]<>'' then
|
|
|
SQL.Add(' and V_op_bscard.ί<>е<EFBFBD>λ='''+RxDBLookupCombo2.DisplayValues[1]+''' ');
|
|
|
if RxDBLookupCombo1.DisplayValues[1]<>'' then
|
|
|
SQL.Add(' and V_op_bscard.<2E><><EFBFBD><EFBFBD>˾='''+RxDBLookupCombo1.DisplayValues[1]+''' ');
|
|
|
if wwDBDateTimePicker7.text<>'' then
|
|
|
SQL.Add(' and V_op_bscard.ƾ֤<C6BE><D6A4><EFBFBD><EFBFBD>>='''+wwDBDateTimePicker7.text+''' ');
|
|
|
if wwDBDateTimePicker8.text<>'' then
|
|
|
SQL.Add(' and V_op_bscard.ƾ֤<C6BE><D6A4><EFBFBD><EFBFBD><='''+wwDBDateTimePicker8.text+''' ');
|
|
|
if Edit1.text<>''then
|
|
|
SQL.Add(' and V_op_bscard.<2E>˷<EFBFBD>Э<EFBFBD><D0AD><EFBFBD><EFBFBD> like ''%'+Edit1.text+'%'' ');
|
|
|
|
|
|
|
|
|
SQL.Add('group by v_op_bscard.'+bsSkinComboBox1.text+'');
|
|
|
end;
|
|
|
Open;
|
|
|
if not IsEmpty then begin
|
|
|
first;
|
|
|
while not eof do begin
|
|
|
if memtblDetail.Locate('ͳ<>Ʊ<EFBFBD>',FieldbyName(bsSkinComboBox1.text).AsString,[]) then begin
|
|
|
memtblDetail.Edit;
|
|
|
memtblDetail.FieldByName(sDate+'<27><><EFBFBD><EFBFBD>').AsFloat:=memtblDetail.FieldByName(sDate+'<27><><EFBFBD><EFBFBD>').AsFloat+FieldByName('<27><><EFBFBD><EFBFBD>').AsFloat;
|
|
|
memtblDetail.FieldByName(sDate+'<27>ʽ<EFBFBD>ռ<EFBFBD><D5BC>').AsFloat:=memtblDetail.FieldByName(sDate+'<27>ʽ<EFBFBD>ռ<EFBFBD><D5BC>').AsFloat+FieldByName('<27>ʽ<EFBFBD>ռ<EFBFBD><D5BC>').AsFloat;
|
|
|
memtblDetail.FieldByName('<27>ϼ<EFBFBD><CFBC><EFBFBD><EFBFBD><EFBFBD>').AsFloat:=memtblDetail.FieldByName('<27>ϼ<EFBFBD><CFBC><EFBFBD><EFBFBD><EFBFBD>').AsFloat+FieldByName('<27><><EFBFBD><EFBFBD>').AsFloat;
|
|
|
memtblDetail.FieldByName('<27>ϼ<EFBFBD><CFBC>ʽ<EFBFBD>ռ<EFBFBD><D5BC>').AsFloat:=memtblDetail.FieldByName('<27>ϼ<EFBFBD><CFBC>ʽ<EFBFBD>ռ<EFBFBD><D5BC>').AsFloat+FieldByName('<27>ʽ<EFBFBD>ռ<EFBFBD><D5BC>').AsFloat;
|
|
|
if (memtblDetail.FieldByName(sDate+'<27>ʽ<EFBFBD>ռ<EFBFBD><D5BC>').AsFloat=0) then
|
|
|
memtblDetail.FieldByName(sDate+'ë<><C3AB><EFBFBD><EFBFBD>').AsString:='<27><EFBFBD><DEB7><EFBFBD><EFBFBD><EFBFBD>'
|
|
|
else
|
|
|
memtblDetail.FieldByName(sDate+'ë<><C3AB><EFBFBD><EFBFBD>').AsString:=FormatFloat('0.00;-0.00;0.0', memtblDetail.FieldByName(sDate+'<27><><EFBFBD><EFBFBD>').AsFloat/memtblDetail.FieldByName(sDate+'<27>ʽ<EFBFBD>ռ<EFBFBD><D5BC>').AsFloat);
|
|
|
|
|
|
if (memtblDetail.FieldByName('<27>ϼ<EFBFBD><CFBC>ʽ<EFBFBD>ռ<EFBFBD><D5BC>').AsFloat=0) then
|
|
|
memtblDetail.FieldByName('<27>ϼ<EFBFBD>ë<EFBFBD><C3AB><EFBFBD><EFBFBD>').AsString:='<27><EFBFBD><DEB7><EFBFBD><EFBFBD><EFBFBD>'
|
|
|
else
|
|
|
memtblDetail.FieldByName('<27>ϼ<EFBFBD>ë<EFBFBD><C3AB><EFBFBD><EFBFBD>').AsString:=FormatFloat('0.00;-0.00;0.0',memtblDetail.FieldByName('<27>ϼ<EFBFBD><CFBC><EFBFBD><EFBFBD><EFBFBD>').AsFloat/memtblDetail.FieldByName('<27>ϼ<EFBFBD><CFBC>ʽ<EFBFBD>ռ<EFBFBD><D5BC>').AsFloat);
|
|
|
|
|
|
memtblDetail.Post;
|
|
|
end else begin
|
|
|
memtblDetail.Insert;
|
|
|
for i:=0 to memtbldetail.FieldCount-1 do begin
|
|
|
if memtbldetail.Fields[i].FieldName='ͳ<>Ʊ<EFBFBD>' then begin
|
|
|
memtbldetail.Fields[i].AsString:=FieldByName(bsSkinComboBox1.text).AsString
|
|
|
end 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.FieldByName(sDate+'<27>ʽ<EFBFBD>ռ<EFBFBD><D5BC>').AsFloat:=memtblDetail.FieldByName(sDate+'<27>ʽ<EFBFBD>ռ<EFBFBD><D5BC>').AsFloat+FieldByName('<27>ʽ<EFBFBD>ռ<EFBFBD><D5BC>').AsFloat;
|
|
|
memtblDetail.FieldByName('<27>ϼ<EFBFBD><CFBC><EFBFBD><EFBFBD><EFBFBD>').AsFloat:=memtblDetail.FieldByName('<27>ϼ<EFBFBD><CFBC><EFBFBD><EFBFBD><EFBFBD>').AsFloat+FieldByName('<27><><EFBFBD><EFBFBD>').AsFloat;
|
|
|
memtblDetail.FieldByName('<27>ϼ<EFBFBD><CFBC>ʽ<EFBFBD>ռ<EFBFBD><D5BC>').AsFloat:=memtblDetail.FieldByName('<27>ϼ<EFBFBD><CFBC>ʽ<EFBFBD>ռ<EFBFBD><D5BC>').AsFloat+FieldByName('<27>ʽ<EFBFBD>ռ<EFBFBD><D5BC>').AsFloat;
|
|
|
if (memtblDetail.FieldByName(sDate+'<27>ʽ<EFBFBD>ռ<EFBFBD><D5BC>').AsFloat=0) then
|
|
|
memtblDetail.FieldByName(sDate+'ë<><C3AB><EFBFBD><EFBFBD>').AsString:='<27><EFBFBD><DEB7><EFBFBD><EFBFBD><EFBFBD>'
|
|
|
else
|
|
|
memtblDetail.FieldByName(sDate+'ë<><C3AB><EFBFBD><EFBFBD>').AsString:=FormatFloat('0.00;-0.00;0.0',memtblDetail.FieldByName(sDate+'<27><><EFBFBD><EFBFBD>').AsFloat/memtblDetail.FieldByName(sDate+'<27>ʽ<EFBFBD>ռ<EFBFBD><D5BC>').AsFloat);
|
|
|
|
|
|
if (memtblDetail.FieldByName('<27>ϼ<EFBFBD><CFBC>ʽ<EFBFBD>ռ<EFBFBD><D5BC>').AsFloat=0) then
|
|
|
memtblDetail.FieldByName('<27>ϼ<EFBFBD>ë<EFBFBD><C3AB><EFBFBD><EFBFBD>').AsString:='<27><EFBFBD><DEB7><EFBFBD><EFBFBD><EFBFBD>'
|
|
|
else
|
|
|
memtblDetail.FieldByName('<27>ϼ<EFBFBD>ë<EFBFBD><C3AB><EFBFBD><EFBFBD>').AsString:=FormatFloat('0.00;-0.00;0.0',memtblDetail.FieldByName('<27>ϼ<EFBFBD><CFBC><EFBFBD><EFBFBD><EFBFBD>').AsFloat/memtblDetail.FieldByName('<27>ϼ<EFBFBD><CFBC>ʽ<EFBFBD>ռ<EFBFBD><D5BC>').AsFloat);
|
|
|
|
|
|
memtblDetail.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;
|
|
|
|
|
|
end.
|