如何从 Crystal 报告中的主报告组中减去子报告组
how to subtract Sub-Report group from main report group in Crystal Report
子报表公式
whileprintingrecords;
shared numbervar exp_credit:= Sum ({Exp_credit.amount}, {Exp_credit.date}, "monthly"
子报表值
04/2014 1500
05/2014 2000
06/2014 1500
07/2014 1000
08/2014 3000
09/2014 4000
10/2014 3500
11/2014 2800
12/2014 2600
01/2015 2800
02/2015 2800
03/2015 2600
主要报表公式
whileprintingrecords;
shared numbervar exp_debit:= Sum ({Exp_debit.amount}, {Exp_debit.date}, "monthly"
主要报表值
04/2014 3500
05/2014 3500
06/2014 3000
07/2014 4000
08/2014 3900
09/2014 3900
10/2014 4000
11/2014 5000
12/2014 2800
01/2015 3500
02/2015 3700
03/2015 3700
净公式
whileprintingrecords;
shared numbervar exp_credit;
shared numbervar exp_debit;
shared numbervar net:= (exp_debit-exp_credit);
我得到净公式值
04/2014 900
05/2014 900
06/2014 400
07/2014 1400
08/2014 1300
09/2014 1300
10/2014 1400
11/2014 2400
12/2014 200
01/2015 900
02/2015 1100
03/2015 1100
我认为每个月都会扣除子报告的最后一个值 2600,我需要单独的每个月值,请帮助我。
您可以尝试以下方法:
为借方和贷方创建 2 个子报表,并在 header 中一一放置。将借方的所有值存储在数组中,贷方的所有值存储在数组中,并将两者传递给主报表。
使用下面的代码将值存储在数组中。
Shared StringVar array store;
store:=store+ (Date&"-"&ToText(Value));
//append date and value to retrieve correctly in main report
1
在具有不同共享变量的两个子报表中创建相同的公式
在主报告中
Shared Stringvar Store //assume debit value
Shared stringvar store1 //assume credit
//now split and convert to number and subtract the values
Tonumber(拆分(Store[1],"-")[2]) - Tonumber(拆分(Store1[1],"-")[2])
注意减去相似的日期
这将为您提供第一个值的差异..以相同的方式更改存储中的数字并存储 1 个大括号以获取其他值的值
子报表公式
whileprintingrecords;
shared numbervar exp_credit:= Sum ({Exp_credit.amount}, {Exp_credit.date}, "monthly"
子报表值
04/2014 1500
05/2014 2000
06/2014 1500
07/2014 1000
08/2014 3000
09/2014 4000
10/2014 3500
11/2014 2800
12/2014 2600
01/2015 2800
02/2015 2800
03/2015 2600
主要报表公式
whileprintingrecords;
shared numbervar exp_debit:= Sum ({Exp_debit.amount}, {Exp_debit.date}, "monthly"
主要报表值
04/2014 3500
05/2014 3500
06/2014 3000
07/2014 4000
08/2014 3900
09/2014 3900
10/2014 4000
11/2014 5000
12/2014 2800
01/2015 3500
02/2015 3700
03/2015 3700
净公式
whileprintingrecords;
shared numbervar exp_credit;
shared numbervar exp_debit;
shared numbervar net:= (exp_debit-exp_credit);
我得到净公式值
04/2014 900
05/2014 900
06/2014 400
07/2014 1400
08/2014 1300
09/2014 1300
10/2014 1400
11/2014 2400
12/2014 200
01/2015 900
02/2015 1100
03/2015 1100
我认为每个月都会扣除子报告的最后一个值 2600,我需要单独的每个月值,请帮助我。
您可以尝试以下方法:
为借方和贷方创建 2 个子报表,并在 header 中一一放置。将借方的所有值存储在数组中,贷方的所有值存储在数组中,并将两者传递给主报表。
使用下面的代码将值存储在数组中。
Shared StringVar array store;
store:=store+ (Date&"-"&ToText(Value));
//append date and value to retrieve correctly in main report
1
在具有不同共享变量的两个子报表中创建相同的公式
在主报告中
Shared Stringvar Store //assume debit value
Shared stringvar store1 //assume credit
//now split and convert to number and subtract the values
Tonumber(拆分(Store[1],"-")[2]) - Tonumber(拆分(Store1[1],"-")[2])
注意减去相似的日期
这将为您提供第一个值的差异..以相同的方式更改存储中的数字并存储 1 个大括号以获取其他值的值