Upgrade to v15.0.OS

This commit is contained in:
Thilina Hasantha
2016-02-08 04:25:58 +05:30
parent b99b6f6f77
commit 078396d5d7
91 changed files with 3332 additions and 1720 deletions

View File

@@ -0,0 +1,67 @@
<?php
if(!interface_exists('ReportBuilderInterface')){
include_once APP_BASE_PATH.'admin/reports/reportClasses/ReportBuilderInterface.php';
}
class EmployeeTimeSheetData implements ReportBuilderInterface{
public function getData($report,$request){
$employeeCache = array();
$employeeList = array();
if(!empty($request['employee'])){
$employeeList = json_decode($request['employee'],true);
}
if(in_array("NULL", $employeeList) ){
$employeeList = array();
}
$employee_query = "";
if(!empty($employeeList)){
$employee_query = "employee in (".implode(",", $employeeList).") and ";
}
$timeSheet = new EmployeeTimeSheet();
if($request['status'] != "NULL"){
$timeSheets = $timeSheet->Find($employee_query."status = ? and date_start >= ? and date_end <= ?",
array($request['status'],$request['date_start'],$request['date_end']));
}else{
$timeSheets = $timeSheet->Find($employee_query."date_start >= ? and date_end <= ?",
array($request['date_start'],$request['date_end']));
}
if(!$timeSheets){
LogManager::getInstance()->info($timeSheet->ErrorMsg());
}
$reportData = array();
$reportData[] = array("Employee ID","Employee","Time Sheet","Total Time","Status");
foreach($timeSheets as $ts){
$employee = $employeeCache[$ts->employee];
if(empty($employee)){
$employee = new Employee();
$employee->Load("id = ?",array($ts->employee));
if(empty($employee->id)){
continue;
}
$employeeCache[$employee->id] = $employee;
}
$reportData[] = array(
$employee->employee_id,
$employee->first_name." ".$employee->last_name,
$ts->name,
$ts->getTotalTime(),
$ts->status
);
}
return $reportData;
}
}