简体   繁体   English

如何计算 Crystal Report 上的 YTD 小时数?

[英]How to calculate YTD hours on a Crystal Report?

My company has a payroll program that prints payroll checks and pay stubs using Crystal Reports.我的公司有一个薪资程序,可以使用 Crystal Reports 打印薪资支票和工资单。 The report selects payroll data from a table that has these columns: Hours, PeriodAmount, and YTDAmount.该报告从包含以下列的表中选择工资数据:Hours、PeriodAmount 和 YTDAmount。 The hours are based on payroll period ending date.小时数基于薪资期结束日期。 The report selects records based on a single pay period end date.该报告根据单个支付期结束日期选择记录。 So, hours would be selected for a single pay period only.因此,只会为单个支付周期选择小时数。 However, we would like to print YTD hours on the pay stub.但是,我们想在工资单上打印 YTD 小时数。 In other words, hours accumulated from beginning of year to current pay period.换句话说,从年初到当前支付期累计的小时数。 Since YTD hours is not a column in the table, would we need to include a sub report to accumulate hours?由于 YTD 小时数不是表中的一列,我们是否需要包含一个子报告来累积小时数? I don't think running totals would work since we are selecting a single period only.我不认为运行总计会起作用,因为我们只选择一个时期。 Any thoughts?有什么想法吗? Thanks.谢谢。

Yes, a subreport is one option.是的,子报表是一种选择。

Another option is to select all pay periods in the current year and compute the total for the current period using a conditional total.另一种选择是 select 当年的所有支付期,并使用条件总数计算当前期的总数。 For example, create af ormula that returns the hours if the record belongs to the current period and zero otherwise.例如,创建一个公式,如果记录属于当前期间则返回小时数,否则返回零。 Then, SUM that formula per employee.然后,对每个员工的公式求和。 That SUM would give you the hours in the current period.该 SUM 将为您提供当前期间的小时数。

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

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