Created
April 11, 2012 21:50
-
-
Save niczak/2362980 to your computer and use it in GitHub Desktop.
Time Sheet Summary [Crystal]
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| select | |
| e.last_name, | |
| e.first_name, | |
| e.display_employee, | |
| e.other_string3, | |
| case when tso.pay_code in ('SICK', 'FURLOUGH_LEAVE', 'ANNUAL') then pc.short_description else ld3.short_description end proj_desc, | |
| case when tso.pay_code in ('SICK', 'FURLOUGH_LEAVE', 'ANNUAL') then 'leave' else 'charge' end usage, | |
| ld1.ld1 account_id, | |
| ld1.short_description account_name, | |
| ld3.ld1 project, | |
| sum(tso.pay) as salary, | |
| sum(tso.calc_value2) as fringe, | |
| sum(tso.calc_value4) as fringe_icr, | |
| sum(tso.hours) as hours | |
| from employee e | |
| join time_sheet_output tso on e.employee = tso.employee | |
| left outer join ld3 on tso.ld3 = ld3.ld1 and tso.work_dt between ld3.eff_dt and ld3.end_eff_dt | |
| left outer join ld1 on tso.ld1 = ld1.ld1 and tso.work_dt between ld1.eff_dt and ld1.end_eff_dt | |
| join pay_code pc on pc.pay_code = tso.pay_code | |
| join employee_periods ep on e.employee = ep.employee | |
| where (N' All' in ({?STD_DEPARTMENT_SQL}) or e.ld1 in ({?STD_DEPARTMENT_SQL})) and tso.pay_code in (select rsd.record_key | |
| from rule_set rs, | |
| rule_set_detail rsd | |
| where rsd.rule_set in ('DRI_TIMESHEET_SUMMARY_CODES') | |
| and rsd.rule_set = rs.rule_set | |
| and rs.source_table in (N'PAY_CODE') | |
| and tso.work_dt between rs.eff_dt and rs.end_eff_dt) | |
| and (N' All' in ({?DRI_ADMIN_DEPARTMENTS_SQL}) or e.other_string19 in ({?DRI_ADMIN_DEPARTMENTS_SQL})) | |
| and (N' All' in ({?DRI_EMPLOYEE_TYPE_SQL}) or e.other_string3 in ({?DRI_EMPLOYEE_TYPE_SQL})) | |
| and tso.transaction_type in (30, 40) | |
| and tso.employee_period_version = ep.calc_emp_period_version | |
| and tso.work_dt between e.eff_dt and e.end_eff_dt | |
| and tso.work_dt between {?STD_START_DATE_SQL} and {?STD_END_DATE_SQL} | |
| and ({?STD_START_DATE_SQL} between ep.pp_begin and ep.pp_end | |
| or {?STD_END_DATE_SQL} between ep.pp_begin and ep.pp_end | |
| or ep.pp_begin between {?STD_START_DATE_SQL} and {?STD_END_DATE_SQL}) | |
| group by e.last_name, e.first_name, e.display_employee, ld1.ld1, ld1.short_description, case when tso.pay_code in ('SICK', 'FURLOUGH_LEAVE', 'ANNUAL') then pc.short_description else ld3.short_description end, case when tso.pay_code in ('SICK', 'FURLOUGH_LEAVE', 'ANNUAL') then 'leave' else 'charge' end, ld3.ld1, e.other_string3 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment