kuberacupidagra
Programmer
Hello All,
Using CR 10.
I am creating a Subreport called "Overhead Hours". The Main report is called "Overhead Dollars". There are three tables in each report. There are no variables passed from the Main to the Sub report. The Overhead Dollar report gives correct values for each Month and YTD for each department.
The Subreport has three tables namely:
Departments:
Fields: T_CWOC, T_DSCA, Category, Dept
Overheadlaborhours:
Fields: Acctg_date, work_dept, Activity, Acct, Hours
Overheadhours:
Fields: T_Leac, T_Desc and Overhead_type
The tables are joined as:
Departments.Dept = Overheadlaborhours.work_dept
Overheadlaborhours.Acct = Overheadhours.T_Leac
For December data I use the following:
@Hr_12=
Local DateVar d_start ;
Local DateVar d_end ;
Local Numbervar RptMonth := 12 ;
// start of fiscal month
d_start := DateSerial ({@ReportYear1}, RptMonth , 1-1 ) ;
d_start := d_start - (DayOfWeek(d_start, crFriday) - 1) ;
// end of fiscal month
d_end := DateSerial ({@ReportYear1}, RptMonth , 31 ) ;
// select data for fiscal month
if ( {OVERHEADLABORHOURS.ACCTG_DATE} in ( d_start to d_end ) )
and ({OVERHEADLABORHOURS.ACTIVITY} = 'OVERHEAD' )
then {OVERHEADLABORHOURS.HOURS}
else 0 ;
I then Sum by Group 1 as:
@Hr_12_Dept_Sum=
sum({@Hr_12},{DEPARTMENTS.DEPT})
There are about 30 departments in the subreport and about 20 of them give correct results when summed on the Department.Dept. However, others are 2 or 15 times higher than what the values should be.
I feel there is a Cartesian Product which is increasing the values.
I would appreciate some feedback and how to resolve it.
Thanks and Regards,
AA
Using CR 10.
I am creating a Subreport called "Overhead Hours". The Main report is called "Overhead Dollars". There are three tables in each report. There are no variables passed from the Main to the Sub report. The Overhead Dollar report gives correct values for each Month and YTD for each department.
The Subreport has three tables namely:
Departments:
Fields: T_CWOC, T_DSCA, Category, Dept
Overheadlaborhours:
Fields: Acctg_date, work_dept, Activity, Acct, Hours
Overheadhours:
Fields: T_Leac, T_Desc and Overhead_type
The tables are joined as:
Departments.Dept = Overheadlaborhours.work_dept
Overheadlaborhours.Acct = Overheadhours.T_Leac
For December data I use the following:
@Hr_12=
Local DateVar d_start ;
Local DateVar d_end ;
Local Numbervar RptMonth := 12 ;
// start of fiscal month
d_start := DateSerial ({@ReportYear1}, RptMonth , 1-1 ) ;
d_start := d_start - (DayOfWeek(d_start, crFriday) - 1) ;
// end of fiscal month
d_end := DateSerial ({@ReportYear1}, RptMonth , 31 ) ;
// select data for fiscal month
if ( {OVERHEADLABORHOURS.ACCTG_DATE} in ( d_start to d_end ) )
and ({OVERHEADLABORHOURS.ACTIVITY} = 'OVERHEAD' )
then {OVERHEADLABORHOURS.HOURS}
else 0 ;
I then Sum by Group 1 as:
@Hr_12_Dept_Sum=
sum({@Hr_12},{DEPARTMENTS.DEPT})
There are about 30 departments in the subreport and about 20 of them give correct results when summed on the Department.Dept. However, others are 2 or 15 times higher than what the values should be.
I feel there is a Cartesian Product which is increasing the values.
I would appreciate some feedback and how to resolve it.
Thanks and Regards,
AA