繁体   English   中英

Crystal Report公式中的动态公式与winform

[英]Dynamic Formula in Crystal Report Formula with winform

我使用视觉工作室。

我有 SQL 表 tbInvoice:amount1、amount2、invNumber。

在winform中,我有checkbox1,checkbox2。

如果 checkbox1 被选中,那么在 CR 中应该是 @total = amount1。

如果checkbox1 和checkbox2 被选中,那么在CR 中应该是@total = amount1 + amount2

我的打印公式:
frmInv.CrystalReportViewer1.SelectionFormula = "{tbInvoice.invNumber} = '" & FrmInvoice.txtInvNo.Text & "'"

我如何做到这一点?

如果在winform中选中复选框,CR中的公式@total如何读取?

我在 CR @total 中需要这样的东西:

如果 frmInvoice.checkbox1.checked = true 并且 frmInvoice.checkbox2.checked = false 那么 {tbInvoice.amount1}

elseif frmInvoice.checkbox1.checked = true 和 frmInvoice.checkbox2.checked = true 然后 {tbInvoice.amount1} + {tbInvoice.amount2}

万一

请帮忙。 谢谢你

  1. 向报告中添加参数。
  2. 公式逻辑可以取决于参数。
  3. 您的代码可以设置参数值。

我不明白你的最后一个问题,但这里是 {@YourValue} 公式的一个例子:

IF {?Your_Parameter} = "ABC" Then {tbInvoice.amount1} ELSE {tbInvoice.amount1} + {tbInvoice.amount2}

然后,只需在您需要的任何级别对​​该公式求和。

您的代码需要设置参数值。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM