Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/vb.net/17.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C# 显示时,运行总计也会记录下一条记录_C#_Vb.net_Crystal Reports - Fatal编程技术网

C# 显示时,运行总计也会记录下一条记录

C# 显示时,运行总计也会记录下一条记录,c#,vb.net,crystal-reports,C#,Vb.net,Crystal Reports,我必须使用期初和期末余额为日记账创建CR。我使用SQL通过参数传递startdate的期初余额。基于该期初余额,我必须显示每个日期(截止日期)的期初余额、日记账条目和期末余额 我使用以下公式: 对于我使用的期初余额 local bal as Number bal = {?openingbalance} if DateDiff ("d",CDate({DataTable0.date}) ,{?startdate} ) = 0 then formula = {?openin

我必须使用期初和期末余额为日记账创建CR。我使用SQL通过参数传递startdate的期初余额。基于该期初余额,我必须显示每个日期(截止日期)的期初余额、日记账条目和期末余额

我使用以下公式:

对于我使用的期初余额

local bal as Number bal = {?openingbalance}
 if DateDiff ("d",CDate({DataTable0.date}) ,{?startdate} ) = 0 
then 
formula = {?openingbalance} 
else 
bal = {?openingbalance} + {#RTotal1}-{#RTotal2} 
formula = bal 
end if 
我用了期末余额

local bal as Number bal = {?openingbalance} + {#RTotal1}-{#RTotal2} 
formula = bal 
利用这个公式,我可以正确地生成期初余额和期末余额。但我的问题是,最后一天期末余额显示在当前日期期初余额中,并添加了当前日期的第一个分录

日记帐报告

看起来问题出在
{DataTable0.date}
{?startdate}
上,因为这种差异总是不存在
0
,所以期初余额部分每次都会转到其他部分,并且您会为期初余额添加期末余额

我怀疑你们是怎么在报告中得到第一张收集记录的。。。请检查这些值,然后重试

如果无法检查
{DataTable0.date}
,请务必在startdate参数中提供今天的日期,并在crystal report中更改如下值

local bal as Number bal = {?openingbalance}
 if {?startdate}  = currentdate 
then 
formula = {?openingbalance} 
else 
bal = {?openingbalance} + {#RTotal1}-{#RTotal2} 
formula = bal 
end if 

如果这部分有任何问题,请告诉我

欢迎访问SO。你能给我们看一些你试过的代码吗?嗨,Maverick,对于我使用的期初余额,本地余额为数字bal={?openingbalance}如果DateDiff(“d”,CDate({DataTable0.date}),{?startdate})=0,那么公式={?openingbalance}否则bal={?openingbalance}+{RTotal1}-{RTotal2}公式=bal end如果并且对于期末余额,我使用本地余额作为数字bal={?openingbalance}+{#RTotal1}-{#RTotal2}公式=bal@Priyas如果要添加代码,请编辑问题,而不是编写注释。。现在,我已经添加了您的问题代码,下次请编辑问题