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

568 lines
18 KiB
Plaintext

11 months ago
unit u_ch_bankday;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, RxLookup, StdCtrls, bsSkinCtrls, BusinessSkinForm, dxExEdtr,
DBCtrls, Grids, Wwdbigrd, Wwdbgrid, bsdbctrls, wwdblook,
wwdbdatetimepicker, Mask, wwdbedit, Wwdotdot, Wwdbcomb, dxDBTLCl,
dxGrClms, dxDBCtrl, dxDBGrid, dxTL, dxCntner, ComCtrls, bsSkinTabs,
ExtCtrls, DB, ADODB, Menus, kbmMemTable, bsSkinBoxCtrls,DateUtils;
type
Tfrm_ch_ch_bankday = class(TForm)
bsBusinessSkinForm1: TbsBusinessSkinForm;
bsSkinPageControl1: TbsSkinPageControl;
bsSkinTabSheet1: TbsSkinTabSheet;
bsSkinPanel4: TbsSkinPanel;
bsSkinPanel3: TbsSkinPanel;
Label3: TLabel;
wwDBDateTimePicker5: TwwDBDateTimePicker;
bsSkinButton10: TbsSkinButton;
memtblDetail: TkbmMemTable;
memtblDetail1: TDataSource;
dxDBGrid1: TdxDBGrid;
dxDBGrid1Column1: TdxDBGridColumn;
bsSkinButton1: TbsSkinButton;
bsSkinButton5: TbsSkinButton;
wwDBDateTimePicker1: TwwDBDateTimePicker;
bsSkinLabel1: TbsSkinLabel;
bsSkinEdit1: TbsSkinEdit;
bsSkinLabel2: TbsSkinLabel;
procedure FormClose(Sender: TObject; var Action: TCloseAction);
procedure FormShow(Sender: TObject);
procedure bsSkinButton10Click(Sender: TObject);
procedure bsSkinButton5Click(Sender: TObject);
procedure bsSkinButton1Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
procedure Creatememtbl;
// procedure Creatememtbl_One;
end;
var
frm_ch_ch_bankday: Tfrm_ch_ch_bankday;
implementation
uses u_main, u_data_share, my_sys_function, u_sys_progress;
{$R *.dfm}
procedure Tfrm_ch_ch_bankday.Creatememtbl;
var
aColumn:TdxDBTreeListColumn;
aBand:TdxTreeListBand;
i:integer;
aAdoQuery,Query_v_op_fee:TAdoQuery;
y,m,d,hh,mm,ss,ssss:Word;
aDateTime:TDateTime;
begin
aAdoQuery:=CreateAdoQuery;
Query_v_op_fee:=CreateAdoQuery;
dxDBGrid1.Bands.Clear;
y:=0;
m:=0;
d:=0;
hh:=23;
mm:=59;
ss:=0;
ssss:=0;
decodedate(wwDBDateTimePicker1.Date,y,m,d);
aDateTime:=encodedatetime(y,m,d,hh,mm,ss,ssss);
while dxDBGrid1.columncount>0 do
begin
dxDBGrid1.Columns[0].Destroy;
end;
memtblDetail.Close;
memtblDetail.EmptyTable;
memtblDetail.Fields.Clear;
memtblDetail.FieldDefs.Clear;
aBand:=dxDBGrid1.Bands.Add;
aBand.Index:=0;
aBand.Caption:='<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϣ';
aBand.Alignment:=taCenter;
// aBand.Fixed:=BFLEFT;
memtblDetail.FieldDefs.Add('<27><><EFBFBD><EFBFBD>', ftString, 20, false);
aColumn:=dxDBGrid1.CreateColumn(TdxDBGridColumn);
aColumn.Caption:='<27><><EFBFBD><EFBFBD>';
aColumn.BandIndex:=0;
aColumn.FieldName:='<27><><EFBFBD><EFBFBD>';
aColumn.HeaderAlignment:=taCenter;
memtblDetail.FieldDefs.Add('ժҪ', ftString, 100, false);
aColumn:=dxDBGrid1.CreateColumn(TdxDBGridColumn);
aColumn.Caption:='ժҪ';
aColumn.BandIndex:=0;
aColumn.FieldName:='ժҪ';
aColumn.Width:=500;
aColumn.HeaderAlignment:=taCenter;
aBand:=dxDBGrid1.Bands.Add;
aBand.Index:=1;
aBand.Caption:='<27><><EFBFBD><EFBFBD><EFBFBD>ʽ<EFBFBD>';
aBand.Alignment:=taCenter;
with aAdoQuery do
try
Close;SQL.Clear;
sql.Add('select * from t_sys_bank');
sql.Add('order by <20><><EFBFBD><EFBFBD>');
Open;First;
while not eof do
begin
aColumn:=dxDBGrid1.CreateColumn(TdxDBGridColumn);
aColumn.BandIndex:=1;
aColumn.FieldName:=trim(FieldByName('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').asstring+FieldByName('<27>ұ<EFBFBD>').asstring);
aColumn.SummaryFooterField:=trim(FieldByName('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').asstring+FieldByName('<27>ұ<EFBFBD>').asstring);
// aColumn.SummaryField:=trim(FieldByName('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').asstring);
aColumn.HeaderAlignment:=taCenter;
aColumn.SummaryFooterType:=cstSum;
memtblDetail.FieldDefs.Add(trim(FieldByName('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').asstring+FieldByName('<27>ұ<EFBFBD>').asstring), ftFloat, 0, false);
Next;
end;
finally;
Free;
end;
aColumn:=dxDBGrid1.CreateColumn(TdxDBGridColumn);
aColumn.BandIndex:=1;
aColumn.FieldName:='<27><><EFBFBD><EFBFBD><EFBFBD>˻<EFBFBD>RMB';
aColumn.SummaryFooterField:='<27><><EFBFBD><EFBFBD><EFBFBD>˻<EFBFBD>RMB';
// aColumn.SummaryField:=trim(FieldByName('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').asstring);
aColumn.HeaderAlignment:=taCenter;
aColumn.SummaryFooterType:=cstSum;
memtblDetail.FieldDefs.Add('<27><><EFBFBD><EFBFBD><EFBFBD>˻<EFBFBD>RMB', ftFloat, 0, false);
aColumn:=dxDBGrid1.CreateColumn(TdxDBGridColumn);
aColumn.BandIndex:=1;
aColumn.FieldName:='<27><><EFBFBD><EFBFBD><EFBFBD>˻<EFBFBD>USD';
aColumn.SummaryFooterField:='<27><><EFBFBD><EFBFBD><EFBFBD>˻<EFBFBD>USD';
// aColumn.SummaryField:=trim(FieldByName('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').asstring);
aColumn.HeaderAlignment:=taCenter;
aColumn.SummaryFooterType:=cstSum;
memtblDetail.FieldDefs.Add('<27><><EFBFBD><EFBFBD><EFBFBD>˻<EFBFBD>USD', ftFloat, 0, false);
memtblDetail.CreateTable;
memtblDetail.Open;
with Query_v_op_fee do
try
Close;SQL.Clear;
sql.Add('select <20><><EFBFBD><EFBFBD>');
sql.Add(' ,sum(case <20><><EFBFBD><EFBFBD>');
sql.Add(' when ''<27><>'' then <20><><EFBFBD><EFBFBD><EFBFBD>ҽ<EFBFBD><D2BD><EFBFBD>');
sql.Add(' end) <20>跽');
sql.Add(' ,sum(case <20><><EFBFBD><EFBFBD> ');
sql.Add(' when ''<27><>'' then <20><><EFBFBD><EFBFBD><EFBFBD>ҽ<EFBFBD><D2BD><EFBFBD> ');
sql.Add(' end) <20><><EFBFBD><EFBFBD>');
sql.Add('from v_op_fee');
sql.Add('where <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><:<3A><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> and <20><><EFBFBD><EFBFBD><>'''' and <20><><EFBFBD><EFBFBD><EFBFBD>ҽ<EFBFBD><D2BD><EFBFBD><>0');
sql.Add('group by <20><><EFBFBD><EFBFBD>');
Parameters.ParamByName('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').Value:=FormatDateTime('YYYY-MM-DD',wwDBDateTimePicker5.Date);
Open;First;
while not eof do
begin
if memtblDetail.Locate('ժҪ','<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>',[]) then
begin
if memtblDetail.findfield(trim(FieldByName('<27><><EFBFBD><EFBFBD>').asstring+'RMB'))<>nil then begin
memtblDetail.Edit;
memtblDetail.FieldByName(trim(FieldByName('<27><><EFBFBD><EFBFBD>').asstring+'RMB')).asFloat:=memtblDetail.FieldByName(trim(FieldByName('<27><><EFBFBD><EFBFBD>').asstring+'RMB')).asFloat+FieldByName('<27>跽').asFloat-FieldByName('<27><><EFBFBD><EFBFBD>').asFloat;
memtblDetail.Post;
end else begin
memtblDetail.Edit;
memtblDetail.FieldByName('<27><><EFBFBD><EFBFBD><EFBFBD>˻<EFBFBD>RMB').asFloat:=memtblDetail.FieldByName('<27><><EFBFBD><EFBFBD><EFBFBD>˻<EFBFBD>RMB').asFloat+FieldByName('<27>跽').asFloat-FieldByName('<27><><EFBFBD><EFBFBD>').asFloat;
memtblDetail.Post;
end;
end
else
begin
if memtblDetail.findfield(trim(FieldByName('<27><><EFBFBD><EFBFBD>').asstring+'RMB'))<>nil then begin
memtblDetail.Insert;
memtblDetail.FieldByName('<27><><EFBFBD><EFBFBD>').Value:=FormatDateTime('YY.MM',wwDBDateTimePicker5.Date);
memtblDetail.FieldByName('ժҪ').Value:='<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>';
memtblDetail.FieldByName(trim(FieldByName('<27><><EFBFBD><EFBFBD>').asstring+'RMB')).asFloat:=FieldByName('<27>跽').asFloat-FieldByName('<27><><EFBFBD><EFBFBD>').asFloat;
memtblDetail.Post;
end else begin
memtblDetail.Insert;
memtblDetail.FieldByName('<27><><EFBFBD><EFBFBD>').Value:=FormatDateTime('YY.MM',wwDBDateTimePicker5.Date);
memtblDetail.FieldByName('ժҪ').Value:='<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>';
memtblDetail.FieldByName('<27><><EFBFBD><EFBFBD><EFBFBD>˻<EFBFBD>RMB').asFloat:=FieldByName('<27>跽').asFloat-FieldByName('<27><><EFBFBD><EFBFBD>').asFloat;
memtblDetail.Post;
end;
end;
Next;
end;
finally;
// Free;
end;
with Query_v_op_fee do
try
Close;SQL.Clear;
sql.Add('select <20><>Ԫ<EFBFBD><D4AA><EFBFBD><EFBFBD>');
sql.Add(' ,sum(case <20><><EFBFBD><EFBFBD>');
sql.Add(' when ''<27><>'' then <20><>Ԫ<EFBFBD><D4AA><EFBFBD><EFBFBD>');
sql.Add(' end) <20>跽');
sql.Add(' ,sum(case <20><><EFBFBD><EFBFBD> ');
sql.Add(' when ''<27><>'' then <20><>Ԫ<EFBFBD><D4AA><EFBFBD><EFBFBD> ');
sql.Add(' end) <20><><EFBFBD><EFBFBD>');
sql.Add('from v_op_fee');
sql.Add('where <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><:<3A><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> and <20><>Ԫ<EFBFBD><D4AA><EFBFBD><EFBFBD><>'''' and <20><>Ԫ<EFBFBD><D4AA><EFBFBD><EFBFBD><>0');
sql.Add('group by <20><>Ԫ<EFBFBD><D4AA><EFBFBD><EFBFBD>');
Parameters.ParamByName('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').Value:=FormatDateTime('YYYY-MM-DD',wwDBDateTimePicker5.Date);
Open;First;
while not eof do
begin
if memtblDetail.Locate('ժҪ','<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>',[]) then
begin
if memtblDetail.findfield(trim(FieldByName('<27><>Ԫ<EFBFBD><D4AA><EFBFBD><EFBFBD>').asstring+'USD'))<>nil then begin
memtblDetail.Edit;
memtblDetail.FieldByName(trim(FieldByName('<27><>Ԫ<EFBFBD><D4AA><EFBFBD><EFBFBD>').asstring+'USD')).asFloat:=memtblDetail.FieldByName(trim(FieldByName('<27><>Ԫ<EFBFBD><D4AA><EFBFBD><EFBFBD>').asstring+'USD')).asFloat+FieldByName('<27>跽').asFloat-FieldByName('<27><><EFBFBD><EFBFBD>').asFloat;
memtblDetail.Post;
end else begin
memtblDetail.Edit;
memtblDetail.FieldByName('<27><><EFBFBD><EFBFBD><EFBFBD>˻<EFBFBD>USD').asFloat:=memtblDetail.FieldByName('<27><><EFBFBD><EFBFBD><EFBFBD>˻<EFBFBD>USD')).asFloat+FieldByName('<27>跽').asFloat-FieldByName('<27><><EFBFBD><EFBFBD>').asFloat;
memtblDetail.Post;
end;
end
else
begin
if memtblDetail.findfield(trim(FieldByName('<27><>Ԫ<EFBFBD><D4AA><EFBFBD><EFBFBD>').asstring+'USD'))<>nil then begin
memtblDetail.Insert;
memtblDetail.FieldByName('<27><><EFBFBD><EFBFBD>').Value:=FormatDateTime('YY.MM',wwDBDateTimePicker5.Date);
memtblDetail.FieldByName('ժҪ').Value:='<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>';
memtblDetail.FieldByName(trim(FieldByName('<27><>Ԫ<EFBFBD><D4AA><EFBFBD><EFBFBD>').asstring+'USD')).asFloat:=FieldByName('<27>跽').asFloat-FieldByName('<27><><EFBFBD><EFBFBD>').asFloat;
memtblDetail.Post;
end else begin
memtblDetail.Insert;
memtblDetail.FieldByName('<27><><EFBFBD><EFBFBD>').Value:=FormatDateTime('YY.MM',wwDBDateTimePicker5.Date);
memtblDetail.FieldByName('ժҪ').Value:='<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>';
memtblDetail.FieldByName('<27><><EFBFBD><EFBFBD><EFBFBD>˻<EFBFBD>USD').asFloat:=FieldByName('<27>跽').asFloat-FieldByName('<27><><EFBFBD><EFBFBD>').asFloat;
memtblDetail.Post;
end;
end;
Next;
end;
finally;
// Free;
end;
with Query_v_op_fee do
try
Close;SQL.Clear;
sql.Add('select * from v_op_fee');
sql.Add('where <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>>=:<3A><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> and <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><=:<3A><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>1 and <20><><EFBFBD><EFBFBD><>'''' and <20><><EFBFBD><EFBFBD><EFBFBD>ҽ<EFBFBD><D2BD><EFBFBD><>0 ');
// sql.Add('where CONVERT(varchar(30),<2C><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>,102)>=:<3A><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> and CONVERT(varchar(30),<2C><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>,102)<=:<3A><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>1 and <20><><EFBFBD><EFBFBD><>'''' and <20><><EFBFBD><EFBFBD><EFBFBD>ҽ<EFBFBD><D2BD><EFBFBD><>0 ');
if Trim(bsSkinEdit1.Text)<>'' then
begin
sql.Add('and <20><>ע like '+''''+'%'+bsSkinEdit1.Text+'%'+'''');
end;
sql.Add('order by <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>');
Parameters.ParamByName('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').Value:=FormatDateTime('YYYY-MM-DD',wwDBDateTimePicker5.Date);
Parameters.ParamByName('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>1').Value:=aDateTime;
Open;First;
while not eof do
begin
memtblDetail.Append;
memtblDetail.FieldByName('<27><><EFBFBD><EFBFBD>').Value:=FormatDateTime('YY.MM.DD',FieldByName('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').asDateTime);
memtblDetail.FieldByName('ժҪ').Value:=trim(FieldByName('<27><>ע').asstring);
if (trim(FieldByName('<27><><EFBFBD><EFBFBD>').asstring)='<27><>') or (trim(FieldByName('<27><><EFBFBD><EFBFBD>').asstring)='<27>շ<EFBFBD>') then
begin
if memtblDetail.findfield(trim(FieldByName('<27><><EFBFBD><EFBFBD>').asstring+'RMB'))<>nil then begin
memtblDetail.FieldByName(trim(FieldByName('<27><><EFBFBD><EFBFBD>').asstring+'RMB')).asFloat:=FieldByName('<27><><EFBFBD><EFBFBD><EFBFBD>ҽ<EFBFBD><D2BD><EFBFBD>').asFloat;
end else begin
memtblDetail.FieldByName('<27><><EFBFBD><EFBFBD><EFBFBD>˻<EFBFBD>RMB').asFloat:=FieldByName('<27><><EFBFBD><EFBFBD><EFBFBD>ҽ<EFBFBD><D2BD><EFBFBD>').asFloat;
end;
end
else
begin
if memtblDetail.findfield(trim(FieldByName('<27><><EFBFBD><EFBFBD>').asstring+'RMB'))<>nil then begin
memtblDetail.FieldByName(trim(FieldByName('<27><><EFBFBD><EFBFBD>').asstring+'RMB')).asFloat:=0-FieldByName('<27><><EFBFBD><EFBFBD><EFBFBD>ҽ<EFBFBD><D2BD><EFBFBD>').asFloat;
end else begin
memtblDetail.FieldByName('<27><><EFBFBD><EFBFBD><EFBFBD>˻<EFBFBD>RMB').asFloat:=0-FieldByName('<27><><EFBFBD><EFBFBD><EFBFBD>ҽ<EFBFBD><D2BD><EFBFBD>').asFloat;
end;
end;
memtblDetail.Post;
Next;
end;
finally;
// Free;
end;
with Query_v_op_fee do
try
Close;SQL.Clear;
sql.Add('select * from v_op_fee');
sql.Add('where <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>>=:<3A><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> and <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><=:<3A><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>1 and <20><>Ԫ<EFBFBD><D4AA><EFBFBD><EFBFBD><>'''' and <20><>Ԫ<EFBFBD><D4AA><EFBFBD><EFBFBD><>0 ');
// sql.Add('where CONVERT(varchar(30),<2C><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>,102)>=:<3A><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> and CONVERT(varchar(30),<2C><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>,102)<=:<3A><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>1 and <20><>Ԫ<EFBFBD><D4AA><EFBFBD><EFBFBD><>'''' and <20><>Ԫ<EFBFBD><D4AA><EFBFBD><EFBFBD><>0 ');
if Trim(bsSkinEdit1.Text)<>'' then
begin
sql.Add('and <20><>ע like '+''''+'%'+bsSkinEdit1.Text+'%'+'''');
end;
sql.Add('order by <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>');
Parameters.ParamByName('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').Value:=FormatDateTime('YYYY-MM-DD',wwDBDateTimePicker5.Date);
Parameters.ParamByName('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>1').Value:=aDateTime;
Open;First;
while not eof do
begin
memtblDetail.Append;
memtblDetail.FieldByName('<27><><EFBFBD><EFBFBD>').Value:=FormatDateTime('YY.MM.DD',FieldByName('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').asDateTime);
memtblDetail.FieldByName('ժҪ').Value:=trim(FieldByName('<27><>ע').asstring);
if (trim(FieldByName('<27><><EFBFBD><EFBFBD>').asstring)='<27><>') or (trim(FieldByName('<27><><EFBFBD><EFBFBD>').asstring)='<27>շ<EFBFBD>') then
begin
if memtblDetail.findfield(trim(FieldByName('<27><>Ԫ<EFBFBD><D4AA><EFBFBD><EFBFBD>').asstring+'USD'))<>nil then begin
memtblDetail.FieldByName(trim(FieldByName('<27><>Ԫ<EFBFBD><D4AA><EFBFBD><EFBFBD>').asstring+'USD')).asFloat:=FieldByName('<27><>Ԫ<EFBFBD><D4AA><EFBFBD><EFBFBD>').asFloat
end else begin
memtblDetail.FieldByName('<27><><EFBFBD><EFBFBD><EFBFBD>˻<EFBFBD>USD').asFloat:=FieldByName('<27><>Ԫ<EFBFBD><D4AA><EFBFBD><EFBFBD>').asFloat
end;
end
else
begin
if memtblDetail.findfield(trim(FieldByName('<27><>Ԫ<EFBFBD><D4AA><EFBFBD><EFBFBD>').asstring+'USD'))<>nil then begin
memtblDetail.FieldByName(trim(FieldByName('<27><>Ԫ<EFBFBD><D4AA><EFBFBD><EFBFBD>').asstring+'USD')).asFloat:=0-FieldByName('<27><>Ԫ<EFBFBD><D4AA><EFBFBD><EFBFBD>').asFloat
end else begin
memtblDetail.FieldByName('<27><><EFBFBD><EFBFBD><EFBFBD>˻<EFBFBD>USD').asFloat:=0-FieldByName('<27><>Ԫ<EFBFBD><D4AA><EFBFBD><EFBFBD>').asFloat
end;
end;
memtblDetail.Post;
Next;
end;
finally;
Free;
end;
end;
{
procedure Tfrm_ch_ch_bankday.Creatememtbl_One;
var
aColumn:TdxDBTreeListColumn;
aBand:TdxTreeListBand;
i:integer;
aAdoQuery,Query_v_op_fee:TAdoQuery;
begin
aAdoQuery:=CreateAdoQuery;
Query_v_op_fee:=CreateAdoQuery;
dxDBGrid1.Bands.Clear;
while dxDBGrid1.columncount>0 do
begin
dxDBGrid1.Columns[0].Destroy;
end;
memtblDetail.Close;
memtblDetail.EmptyTable;
memtblDetail.Fields.Clear;
memtblDetail.FieldDefs.Clear;
aBand:=dxDBGrid1.Bands.Add;
aBand.Index:=0;
aBand.Caption:='<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϣ';
aBand.Alignment:=taCenter;
// aBand.Fixed:=BFLEFT;
memtblDetail.FieldDefs.Add('<27><><EFBFBD><EFBFBD>', ftString, 20, false);
aColumn:=dxDBGrid1.CreateColumn(TdxDBGridColumn);
aColumn.Caption:='<27><><EFBFBD><EFBFBD>';
aColumn.BandIndex:=0;
aColumn.FieldName:='<27><><EFBFBD><EFBFBD>';
aColumn.HeaderAlignment:=taCenter;
memtblDetail.FieldDefs.Add('ժҪ', ftString, 20, false);
aColumn:=dxDBGrid1.CreateColumn(TdxDBGridColumn);
aColumn.Caption:='ժҪ';
aColumn.BandIndex:=0;
aColumn.FieldName:='ժҪ';
aColumn.HeaderAlignment:=taCenter;
aBand:=dxDBGrid1.Bands.Add;
aBand.Index:=1;
aBand.Caption:='<27><><EFBFBD><EFBFBD><EFBFBD>ʽ<EFBFBD>';
aBand.Alignment:=taCenter;
with aAdoQuery do
try
Close;SQL.Clear;
sql.Add('select * from t_sys_bank');
sql.Add('order by <20><><EFBFBD><EFBFBD>');
Open;First;
while not eof do
begin
memtblDetail.FieldDefs.Add(trim(FieldByName('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').asstring), ftFloat, 0, false);
aColumn:=dxDBGrid1.CreateColumn(TdxDBGridColumn);
aColumn.BandIndex:=1;
aColumn.FieldName:=trim(FieldByName('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').asstring);
aColumn.HeaderAlignment:=taCenter;
aColumn.SummaryFooterType:=cstSum;
Next;
end;
finally;
Free;
end;
memtblDetail.CreateTable;
memtblDetail.Open;
with Query_v_op_fee do
try
Close;SQL.Clear;
sql.Add('select <20><><EFBFBD><EFBFBD>');
sql.Add(' ,sum(case <20><><EFBFBD><EFBFBD>');
sql.Add(' when ''<27><>'' then <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>');
sql.Add(' end) <20>跽');
sql.Add(' ,sum(case <20><><EFBFBD><EFBFBD> ');
sql.Add(' when ''<27><>'' then <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> ');
sql.Add(' end) <20><><EFBFBD><EFBFBD>');
sql.Add('from v_op_fee');
sql.Add('where <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><:<3A><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> and <20><><EFBFBD><EFBFBD><>''''');
sql.Add('group by <20><><EFBFBD><EFBFBD>');
Parameters.ParamByName('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').Value:=FormatDateTime('YYYY-MM-DD',wwDBDateTimePicker5.Date);
Open;First;
while not eof do
begin
if memtblDetail.Locate('ժҪ','<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>',[]) then
begin
memtblDetail.Edit;
memtblDetail.FieldByName(trim(FieldByName('<27><><EFBFBD><EFBFBD>').asstring)).asFloat:=FieldByName('<27>跽').asFloat-FieldByName('<27><><EFBFBD><EFBFBD>').asFloat;
memtblDetail.Post;
end
else
begin
memtblDetail.Insert;
memtblDetail.FieldByName('<27><><EFBFBD><EFBFBD>').Value:=FormatDateTime('YY.MM',wwDBDateTimePicker5.Date);
memtblDetail.FieldByName('ժҪ').Value:='<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>';
memtblDetail.FieldByName(trim(FieldByName('<27><><EFBFBD><EFBFBD>').asstring)).asFloat:=FieldByName('<27>跽').asFloat-FieldByName('<27><><EFBFBD><EFBFBD>').asFloat;
memtblDetail.Post;
end;
Next;
end;
finally;
// Free;
end;
with Query_v_op_fee do
try
Close;SQL.Clear;
sql.Add('select * from v_op_fee');
sql.Add('where CONVERT(varchar(30),<2C><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>,102)>=:<3A><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> and CONVERT(varchar(30),<2C><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>,102)<=:<3A><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>1 and <20><><EFBFBD><EFBFBD><>''''');
// sql.Add('where CONVERT(varchar(30),<2C><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>,102)=:<3A><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> and <20><><EFBFBD><EFBFBD><>''''');
sql.Add('order by <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>');
Parameters.ParamByName('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').Value:=FormatDateTime('YYYY.MM.DD',wwDBDateTimePicker5.Date);
Parameters.ParamByName('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').Value:=FormatDateTime('YYYY.MM.DD',wwDBDateTimePicker1.Date);
Open;First;
while not eof do
begin
memtblDetail.Append;
memtblDetail.FieldByName('<27><><EFBFBD><EFBFBD>').Value:=FormatDateTime('YY.MM.DD',FieldByName('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').asDateTime);
memtblDetail.FieldByName('ժҪ').Value:=FieldByName('<27><>ע').asstring;
if FieldByName('<27><><EFBFBD><EFBFBD>').asstring='<27><>' then
begin
if FieldByName('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').asFloat<>0 then
memtblDetail.FieldByName(trim(FieldByName('<27><><EFBFBD><EFBFBD>').asstring)).asFloat:=FieldByName('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').asFloat
else
memtblDetail.FieldByName(trim(FieldByName('<27><><EFBFBD><EFBFBD>').asstring)).asFloat:=FieldByName('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').asFloat;
end
else
begin
if FieldByName('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').asFloat<>0 then
memtblDetail.FieldByName(trim(FieldByName('<27><><EFBFBD><EFBFBD>').asstring)).asFloat:=0-FieldByName('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').asFloat
else
memtblDetail.FieldByName(trim(FieldByName('<27><><EFBFBD><EFBFBD>').asstring)).asFloat:=0-FieldByName('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').asFloat;
end;
memtblDetail.Post;
Next;
end;
finally;
Free;
end;
end;
}
procedure Tfrm_ch_ch_bankday.FormClose(Sender: TObject;
var Action: TCloseAction);
begin
savereggrid(dxdbgrid1,caption);
frm_ch_ch_bankday.Hide;
frm_ch_ch_bankday.ManualFloat(frm_ch_ch_bankday.BoundsRect );
frm_main.freeTabs('frm_ch_ch_bankday');
action:=cafree;
frm_ch_ch_bankday:=nil;
end;
procedure Tfrm_ch_ch_bankday.FormShow(Sender: TObject);
begin
wwDBDateTimePicker5.Date:=Date;
wwDBDateTimePicker1.Date:=Date;
end;
procedure Tfrm_ch_ch_bankday.bsSkinButton10Click(Sender: TObject);
begin
Creatememtbl;
end;
procedure Tfrm_ch_ch_bankday.bsSkinButton5Click(Sender: TObject);
begin
close;
end;
procedure Tfrm_ch_ch_bankday.bsSkinButton1Click(Sender: TObject);
begin
grid_save_xls(dxdbgrid1);
end;
end.