用fastreport作主从表
主表:
fh name
1 张三
2 李四
3 王五
从表:
fh 费用类型 金额
1 电费 1.2
1 水费 1.35
2 电费 2
2 水费 2
3 电费 3
3 水费 3
在主表有金额合计项:例如
fh :1 name: 张三 合计:2.5 (大写:) 贰元伍角
----------------------------------------------
电费:1
水费:1回答正确再加分
主表:
fh name
1 张三
2 李四
3 王五
从表:
fh 费用类型 金额
1 电费 1.2
1 水费 1.35
2 电费 2
2 水费 2
3 电费 3
3 水费 3
在主表有金额合计项:例如
fh :1 name: 张三 合计:2.5 (大写:) 贰元伍角
----------------------------------------------
电费:1
水费:1回答正确再加分
解决方案 »
- delphi下 oracle8i客户端连9i服务器的问题!急
- EMC面试题
- 余3BCD码是怎么回事?请高人做答。UP有分。
- 关于用TNMHTTP实现在线升级,请高手帮忙解析调试,或其他实例!!!
- 谁知道Trzpanel和Trzchecktree是哪个第三方控件里的?
- 急,Excel的保护问题。
- 送分题:我有一个WebBrowser控件,如何得到我当前浏览网页的网址和标题?
- 怎样截获网络的数据经处理后在交给ie显示呢?
- ADO中如何一次返回多个数据集?如何知道update后影响了多少笔数据?
- Socket数据传输问题
- fastreport主从表字段计算问题?
- 百分征集_开发零售业MIS系统的图标
var
money : Real;
zheng : Int64;
ling : Integer;
yi : Int64;
wan : Int64;
ge : Int64;
jiao : Int64;
fen : Int64;
begin
// The function 'StrToFloat' might rase an 'EConverError' exception.
try
money := StrToFloat(Edit1.Text);
except
on EConvertError do
begin
ShowMessage('请检查你是否输入了正确的数字.');
Exit;
end;
end;
//预防四舍五入时出错
zheng := Round (money * 1000);
ling := (zheng - (zheng div 1000) * 1000) div 10;
zheng := zheng div 1000;
if zheng > 999999999999 then
begin
ShowMessage ('Overflow.');
Exit;
end;
// The amount is devided into several parts.
yi := zheng div 100000000;
zheng := zheng - yi * 100000000;
wan := zheng div 10000;
zheng := zheng - wan * 10000;
ge := zheng;
jiao := ling div 10;
fen := ling - jiao * 10;
////输出亿
if yi > 0 then
begin
AddToResult (yi);
Edit2.Text := Edit2.Text + ListBox1.Items.Strings[13];
end;
////输出万
if wan > 0 then
begin
AddToResult (wan);
Edit2.Text := Edit2.Text + ListBox1.Items.Strings[12];
end;
////输出万以下
AddToResult (ge);
if (yi = 0) and (wan = 0) and (ge = 0) then
Edit2.Text := Edit2.Text + ListBox1.Items.Strings[17];
// if ge > 0 then
Edit2.Text := Edit2.Text + ListBox1.Items.Strings[16];
////输出角
if jiao > 0 then
begin
Edit2.Text := Edit2.Text + ListBox1.Items.Strings[jiao-1];
Edit2.Text := Edit2.Text + ListBox1.Items.Strings[15];
end;
////输出分
if fen > 0 then
begin
Edit2.Text := Edit2.Text + ListBox1.Items.Strings[fen-1];
Edit2.Text := Edit2.Text + ListBox1.Items.Strings[14];
end;
if (jiao = 0) and (fen = 0) then
Edit2.Text := Edit2.Text + ListBox1.Items.Strings[18];
end;
//------------------------------------------------------
//逐位输出
procedure TForm1.AddtoResult (Value : Integer);
var
qian : Integer;
bai : Integer;
shi : Integer;
begin
//------
qian := Value div 1000;
Value := Value - qian * 1000;
bai := Value div 100;
Value := Value - bai * 100;
shi := Value div 10;
Value := Value - shi * 10;
if qian > 0 then
begin
IsNotHeader := true;
Edit2.Text := Edit2.Text + ListBox1.Items.Strings[qian-1];
Edit2.Text := Edit2.Text + ListBox1.Items.Strings[11];
if (bai = 0) and ((shi > 0) or (Value > 0)) then
Edit2.Text := Edit2.Text + ListBox1.Items.Strings[17];
end
else
if IsNotHeader and ((bai <> 0) or (shi <> 0) or (Value <> 0)) then
Edit2.Text := Edit2.Text + ListBox1.Items.Strings[17];
//------
if bai > 0 then
begin
IsNotHeader := true;
Edit2.Text := Edit2.Text + ListBox1.Items.Strings[bai-1];
Edit2.Text := Edit2.Text + ListBox1.Items.Strings[10];
if (shi = 0) and (Value > 0) then
Edit2.Text := Edit2.Text + ListBox1.Items.Strings[17];
end;
//------
if shi > 0 then
begin
IsNotHeader := true;
Edit2.Text := Edit2.Text + ListBox1.Items.Strings[shi-1];
Edit2.Text := Edit2.Text + ListBox1.Items.Strings[9];
end;
//-----
if Value > 0 then
begin
IsNotHeader := true;
Edit2.Text := Edit2.Text + ListBox1.Items.Strings[Value-1];
end;
select 主表.*,sum(从表1.金额) as 合计,sum(从表2.金额) as 合计
怎样把从表1和从表2的合计金额再次合计.啊
你也可以在数据库返回结果集的时候把合计也追加到你的结果集上