Hi all,
I have a report that tracks the 'headcount' of people in different departments in different regions. Based on that different calculations can then be made. To find out this number I have two formulas (for every month of the year) that will theoretically determine what is the Active headcount and what is the InActive headcount. I then simply subtract the Inactive from the Active to get my final value.
To keep it simple, we have a Users database file that stores the current status of employees and a Transfers table that tracks when employees have changed location/assigned to, process/deptarment, or status (terminated, long-term disability, active, etc.).
The problem lies in the fact that employees tend to move around some and catching these is turning out to be harder than I thought (isn't that always the case). I'm using Crystal Decisions 8.5 with SQL 7.0. The reports is grouped by 'assigned_to' and then by 'processname'.
I have the Inactive Headcount formula for January (below) which seems to work fine. What I'm concentrating on currently is the 'Active' formula. I'm having a hard time (and I don't know if it's possible) getting the report to find past employees that used to belong in a certian process and then add that number to the affected month's value since the report is grouped by processname. Restated, I have no problem finding the prior status if a person has stayed in the same process group but trying to find out who USED TO belong in the processgroup is quite a different story.
Within the Users table the current status is maintained. Within the Transfers table we have a copy of all the employees with the current status as well as a 'base'. When changes are made, changes are made to both tables but the Transfers table lists the trans_date which is the date of the transaction and an edate field that will have a value IF the last status has changed. In the case that this record is the current info the edate field will have a null value.
==============================================
Inactive 'Salary' Headcount formula:
Local Stringvar endofmonth := "1/31/" + {@Current_YEAR};
if CurrentDate > CDate(endofmonth)
then
//looking for a closed status (edate)
((
{cccusers.userID} = {ccctransfers.frn_userID} AND {ccctransfers.trans_date} < CDateTime(endofmonth) AND
{ccctransfers.edate} >= CDateTime(endofmonth) AND {cccusers.paytype} = 'S')
AND
//that has one of these status changes
(
{ccctransfers.new_status} <> 'A' OR {cccusers.frn_locationID} <> {ccctransfers.new_frn_locID} OR
{cccusers.processname} <> {ccctransfers.new_processname} OR {cccusers.assigned_to} <> {ccctransfers.new_frn_locID}
))
OR
//looking for an open status (isNull (edate))
((
{cccusers.userID} = {ccctransfers.frn_userID} AND
CDateTime(endofmonth) >= {ccctransfers.trans_date} AND
{cccusers.STATUS} = 'S' AND
isNull ({ccctransfers.edate}
)
AND
//that has one of these status changes
(
{ccctransfers.new_status} <> 'A' OR {cccusers.frn_locationID} <> {ccctransfers.new_frn_locID} OR
{cccusers.processname} <> {ccctransfers.new_processname} OR {cccusers.assigned_to} <> {ccctransfers.new_frn_locID}
))
=====================================================
Any suggestions/comments are welcomed,
Thanks in advance,
NGonz
I have a report that tracks the 'headcount' of people in different departments in different regions. Based on that different calculations can then be made. To find out this number I have two formulas (for every month of the year) that will theoretically determine what is the Active headcount and what is the InActive headcount. I then simply subtract the Inactive from the Active to get my final value.
To keep it simple, we have a Users database file that stores the current status of employees and a Transfers table that tracks when employees have changed location/assigned to, process/deptarment, or status (terminated, long-term disability, active, etc.).
The problem lies in the fact that employees tend to move around some and catching these is turning out to be harder than I thought (isn't that always the case). I'm using Crystal Decisions 8.5 with SQL 7.0. The reports is grouped by 'assigned_to' and then by 'processname'.
I have the Inactive Headcount formula for January (below) which seems to work fine. What I'm concentrating on currently is the 'Active' formula. I'm having a hard time (and I don't know if it's possible) getting the report to find past employees that used to belong in a certian process and then add that number to the affected month's value since the report is grouped by processname. Restated, I have no problem finding the prior status if a person has stayed in the same process group but trying to find out who USED TO belong in the processgroup is quite a different story.
Within the Users table the current status is maintained. Within the Transfers table we have a copy of all the employees with the current status as well as a 'base'. When changes are made, changes are made to both tables but the Transfers table lists the trans_date which is the date of the transaction and an edate field that will have a value IF the last status has changed. In the case that this record is the current info the edate field will have a null value.
==============================================
Inactive 'Salary' Headcount formula:
Local Stringvar endofmonth := "1/31/" + {@Current_YEAR};
if CurrentDate > CDate(endofmonth)
then
//looking for a closed status (edate)
((
{cccusers.userID} = {ccctransfers.frn_userID} AND {ccctransfers.trans_date} < CDateTime(endofmonth) AND
{ccctransfers.edate} >= CDateTime(endofmonth) AND {cccusers.paytype} = 'S')
AND
//that has one of these status changes
(
{ccctransfers.new_status} <> 'A' OR {cccusers.frn_locationID} <> {ccctransfers.new_frn_locID} OR
{cccusers.processname} <> {ccctransfers.new_processname} OR {cccusers.assigned_to} <> {ccctransfers.new_frn_locID}
))
OR
//looking for an open status (isNull (edate))
((
{cccusers.userID} = {ccctransfers.frn_userID} AND
CDateTime(endofmonth) >= {ccctransfers.trans_date} AND
{cccusers.STATUS} = 'S' AND
isNull ({ccctransfers.edate}
)
AND
//that has one of these status changes
(
{ccctransfers.new_status} <> 'A' OR {cccusers.frn_locationID} <> {ccctransfers.new_frn_locID} OR
{cccusers.processname} <> {ccctransfers.new_processname} OR {cccusers.assigned_to} <> {ccctransfers.new_frn_locID}
))
=====================================================
Any suggestions/comments are welcomed,
Thanks in advance,
NGonz