为什么运行总计仅适用于第一个声明的变量?

时间:2012-05-11 05:11:18

标签: crystal-reports running-total

我在报告的页脚中使用三个公式显示页面总数:

@InitializeTotals(放在页眉中)

whileprintingrecords;
global currencyvar totalsssprem:=0;
global currencyvar totalhdmfprem:=0;
global currencyvar totalphilhealth:=0;
global currencyvar totalsalcal:=0;
global currencyvar totalhdmfloan:=0;
global currencyvar totalhousing:=0;
global currencyvar totallending:=0;
global currencyvar totalcashadv:=0;
global currencyvar totaldamages:=0;
global currencyvar totalcashbnd:=0;
global currencyvar totalfines:=0;
global currencyvar totallosttck:=0;
global currencyvar totalothers:=0;
global currencyvar totalasscntr:=0;
global currencyvar totalcndonation:=0;
global currencyvar totalnetpay:=0;

@IncrementTotals(放在详细信息部分)

whileprintingrecords;
global currencyvar totalsssprem;
global currencyvar totalhdmfprem;
global currencyvar totalphilhealth;
global currencyvar totalsalcal;
global currencyvar totalhdmfloan;
global currencyvar totalhousing;
global currencyvar totallending;
global currencyvar totalcashadv;
global currencyvar totaldamages;
global currencyvar totalcashbnd;
global currencyvar totalfines;
global currencyvar totallosttck;
global currencyvar totalothers;
global currencyvar totalasscntr;
global currencyvar totalcndonation;
global currencyvar totalnetpay;
totalsssprem:= totalsssprem + {deposit_summary.sss_prem};
totalhdmfprem:= totalhdmfprem + {deposit_summary.hdmf_prem};
totalphilhealth:= totalphilhealth + {deposit_summary.philhealth};
totalsalcal:= totalsalcal + {deposit_summary.sal_cal};
totalhdmfloan:= totalhdmfloan + {deposit_summary.hdmf_loan};
totalhousing:= totalhousing + {deposit_summary.housing};
totallending:= totallending + {deposit_summary.lending};
totalcashadv:= totalcashadv + {deposit_summary.cash_adv};
totaldamages:= totaldamages + {deposit_summary.damages};
totalcashbnd:= totalcashbnd + {deposit_summary.cash_bnd};
totalfines:= totalfines + {deposit_summary.fines};
totallosttck:= totallosttck + {deposit_summary.lost_tck};
totalothers:= totalothers + {deposit_summary.others};
totalasscntr:= totalasscntr + {deposit_summary.ass_cntr};
totalcndonation:= totalcndonation + {deposit_summary.cndonation};
totalnetpay:=totalnetpay + {@net_pay};

页面页脚中每个变量的显示公式。他们都看起来像这样:

whileprintingrecords;
global currencyvar totalsssprem;
totalsssprem

这显示第一个变量(totalsssprem)的正确总数就好了,但其余部分在页脚中显示为0.00。有什么想法吗?

1 个答案:

答案 0 :(得分:2)

首先想到的是,你的一个(或多个)字段可能为null,这会导致公式被废弃。在增量公式中尝试这样的行,看看它是否有帮助:

if not(isnull({deposit_summary.sss_prem})) then totalsssprem:=totalsssprem+{deposit_summary.sss_prem};