水晶报表-积极的员工公式

时间:2019-01-11 20:11:58

标签: crystal-reports

我正在尝试制作一个报告,该报告提供了过去一个月的“活动快照”。例如-十月有多少活跃的妇女就业?

我要用于活动快照的日期(特定月份)将更改。我在公式employee中使用以下字段。hire_date是员工开始在我们组织中的日期,employee.term_date是工作结束的日期。

然后我将员工按性别分组,并使用employee.gender然后再使用employee.name

你们如何看待这种逻辑? employee.hire_date可以是该月的任何时间,减去最后一天? employee.term_date可以是该月的任何时间,减去最后一天?我说的最后一天是负号,因为该员工在该月中必须至少工作1天。我很困惑。...

然后创建一个公式,并将参数设置为该月的第一天和最后一天?

1 个答案:

答案 0 :(得分:0)

我认为您的方向是正确的,如果我告诉我我认为您需要在给定的月份内处理6种不同的情况,这可能会有所帮助。关键是员工的工作时间与给定的月份之间是否有交集。

假设:

  • h是hiring_date
  • T是term_date
  • m是给定月份的第一天
  • M是给定月份的最后一天

请参阅这些“时间表” :(对不起,有些混乱)

h..T..m........M...... (1- start and end before the month, no intersection) 
......m..h..T..M...... (2- start and end inside the month, there is intersection) 
......m........M..h..T (3- start and end after the month, no intersection) 
h.....m........M.....T (4- start before the month, end after the month, intersection)
h.....m....T...M...... (5- start before the month, end inside the month, intersection) 
......m...h....M.....T (6- start inside the month, end after the month, intersection)

因此,如果h <= M并且T> = m(哈里,卡诺地图!),则存在交点。

如您所说,要忽略最后一天,也许是:h m。

创建一个运行总计字段,如果有交叉点,则按性别对员工进行计数。

编辑:也许完整的公式应该是:

{EMPLOYEE.Hire_Date}<={?Last of Month} and (
  isnull({EMPLOYEE.Termination_Date}) OR 
  {EMPLOYEE.Termination_Date}>={?First of Month}
)