/** * Used to enhance the provided timesheet with data from other tables. * * @param obj The timesheet object to enhance. * * @return Returns the enhanced timesheet. */ public function enhanceTimesheet($obj) { // Set the other timesheet information. if (is_numeric($obj->id)) { // Set the bills in the timesheet. $billDao = new BillDao(); $obj->bills = $billDao->getForTimesheet($obj->id, $obj->employee_id); // Set the employee. $employeeDao = new EmployeeDao(); $obj->employee = $employeeDao->get($obj->employee_id); // Set the audit log info. $auditLogDao = new AuditLogDao(); $obj->audit_log = $auditLogDao->getForTimesheet($obj->id); // Set the pay period. $payPeriodDao = new PayPeriodDao(); $obj->pay_period = $payPeriodDao->get($obj->pp_start); // Set the employee's contracts. $contractDao = new ContractDao(); $obj->contracts = $contractDao->getEmployeeContractsForPayPeriod($obj->employee_id, $obj->pay_period); // Set the holidays. $holidayDao = new HolidayDao(); $obj->holidays = $holidayDao->getForPayPeriod($obj->pay_period); } // Perform post-processing. $this->postProcess($obj); // Return the enhanced timesheet object. return $obj; }