在Acumatica中,当将一个Tabular报表作为子报表调用时,有时会出现意外的行生成。以下是解决这个问题的一种方法的代码示例:
public class MainReport : PXGraph
{
public PXReportRequiredException ReportException;
public MainReport()
{
// 添加子报表参数
ReportException = new PXReportRequiredException(new Dictionary
{
{"ReportID", "ChildReportID"},
{"ParentParam1", "ParentParam1Value"},
{"ParentParam2", "ParentParam2Value"}
}, "ChildReportID");
}
}
public class ChildReport : PXGraph
{
public PXSelect MyData;
public ChildReport()
{
// 获取父报表参数
string parentParam1 = PXContext.GetSlot("ParentParam1");
string parentParam2 = PXContext.GetSlot("ParentParam2");
// 使用父报表参数生成报表数据
MyData.Select();
}
}
public class MainReport : PXGraph
{
public PXReportRequiredException ReportException;
public MainReport()
{
// 添加子报表参数
ReportException = new PXReportRequiredException(new Dictionary
{
{"ReportID", "ChildReportID"},
{"ParentParam1", "ParentParam1Value"},
{"ParentParam2", "ParentParam2Value"}
}, "ChildReportID");
// 将子报表数据添加到主报表中
MyDAC childReportData = PXSelect.Select(this);
}
}
请注意,上述代码仅为示例,您需要根据您的实际情况进行适当的更改和调整。