无法显示与crystalreport中已分组的列表相同的级别列表 [英] Trouble displaying the same level listing as a list that has been group in crystalreport

查看:240
本文介绍了无法显示与crystalreport中已分组的列表相同的级别列表的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我无法显示与已为组"的列表相同的级别列表.在这里,我将尝试最轻松地解释

我的数据如下:

I''m having trouble displaying the same level listing as a list that has been Group. Here I will try to explain most easily

My data is as follows:

Driver
{
0_Code: 01 | Name: A | Salary: 1000
1_Code: 02 | Name: B | Salary: 2000
}
Travel
{
0_DriverC: 01 | Name: A | Salary: 1000 | Date: 5/2 | Route: ABC 
1_DriverC: 01 | Name: A | Salary: 1000 | Date: 7/2 | Route: XYZ
2_DriverC: 02 | Name: B | Salary: 2000 | Date: 1/2 | Route: EFG
}
Expense
{
0_DriverC: 01 | ExpenseN: X | ExpenseMoney: 100
1_DriverC: 01 | ExpenseN: Y | ExpenseMoney: 500
2_DriverC: 01 | ExpenseN: Z | ExpenseMoney: 300
3_DriverC: 02 | ExpenseN: K | ExpenseMoney: 400
}


在CrystalReport中,我设计了以下内容:


In CrystalReport i designed the following:

Section1(Report Header)
_____________________________
Section2(Page Header)
_____________________________
GroupHeaderSection2(Group Header#1: Travel.DriverC-A)
_____________________________
Section3(Details)
Driver Name: ?Name
?Date    ?DriverC     ?Nane    ?Route   ?Salary
_____________________________
GroupHeaderSection2(Group Footer#1: Travel.DriverC-A)
TotalSalary                                                 Sum of ?Salary
ExpenseN (Here i will list the costs by the Driver group)   ?ExpenseMoney
Total                                             Sum of (?Salary,?ExpenseMoney)


我想要的结果报告可以如下:


The results Report i want can be as follows:

Driver Name: A
5/2    01     A     ABC    1000
7/2    01     A     XYZ    1000
TotalSalary                2000
X                          100
Y                          500
Z                          300
Total                      4900
_____________________________
Driver Name: B
1/2    02     B     EFG    2000
TotalSalary                2000
K                          400
Total                      2400


这是将值分配给DataRow的代码:


This is the code that assigns values to DataRow:

var travel = TravelService.GetAllQueryable().ToList();
for(int i = 0; i < travel.Count; i++)
{
    row = dt.NewRow();
    row["Date"] = travel[i].Date;
    row["DriverC"] = travel[i].DriverC;
    row["Nane"] = travel[i].Nane;
    row["Route"] = travel[i].Route;
    row["Salary"] = travel[i].Salary;
    var expense = ExpenseService.Query(p => p.DriverC == travel[i].DriverC).ToList();
    for(int k = 0; k < expense.Count; k++)
    {
       row["ExpenseN"] = expense[k].ExpenseN;
       row["ExpenseMoney"] = expense[k].ExpenseMoney;
    }
    dt.Rows.Add(row);
}



我尝试过的事情:

我认为将代码分配给Expense的代码有问题.显示相同级别的列表时,我感到困惑.



What I have tried:

I think the code assigning value to Expense has a problem. I am confused when displaying a list of the same level. How can I display the list of Expense by Travel has been grouped?

推荐答案

我认为您需要使用子报告-我说我认为,因为问题是不太清楚.
我的理解是您在Driver&旅游与驱动程序与驱动程序之间的另一个一对多费用.
Crystal不允许您将两者都列为详细信息部分,因此您可以执行以下操作;
a)使用上面确定的部分创建报告(按驾驶员分组,然后在详细信息"部分显示旅行")
b)添加一个新的详细信息"部分(右键单击详细信息"并选择在下面插入部分")
c)选择插入>>子报表菜单项
d)创建有关费用数据的报告
e)将链接设置为驱动程序ID-或驱动程序和费用之间的任何链接

亲切的问候
I think you need to use a sub-report - I say I think because the question is not really clear.
My understanding is you have a One to Many join between Driver & Travel & another One to Many between Driver & Expenses.
Crystal will not allow you to list both as the details section, hence you would do as follows;
a) Create your Report using the sections identified above (Group by Driver, then display Travel in Details section)
b) Add a new Detail section (right-click on Details & select Insert Section Below)
c) Select Insert >> Subreport menu item
d) Create a report on the Expenses data
e) Set the Link to be the Driver ID - or whatever the link is between Driver and Expenses

Kind Regards


这篇关于无法显示与crystalreport中已分组的列表相同的级别列表的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆