case 5: return 'F<br>'; break; case 6: return 'S<br>'; break; } } //$subjects=Subjects::model()->findAll("batch_id=:x", array(':x'=>$_REQUEST['id'])); //echo CHtml::dropDownList('batch_id','',CHtml::listData(Subjects::model()->findAll("batch_id=:x",array(':x'=>$_REQUEST['id'])), 'id', 'name'), array('empty'=>'Select Type')); if (isset($_REQUEST['id'])) { if (!isset($_REQUEST['mon'])) { $mon = date('F'); $mon_num = date('n'); } else { $mon = EmployeeAttendances::model()->getMonthname($_REQUEST['mon']); $mon_num = $_REQUEST['mon']; } $num = cal_days_in_month(CAL_GREGORIAN, $mon_num, $_REQUEST['year']); // 31 ?> <table width="100%" border="0" cellspacing="0" cellpadding="0"> <tr> <td class="first"> <?php $logo = Logo::model()->findAll(); ?> <?php if ($logo != NULL) { //echo $logo[0]->photo_file_name; //Yii::app()->runController('Configurations/displayLogoImage/id/'.$logo[0]->primaryKey);
echo '<td>'; $date = EmployeeAttendances::model()->findAllByAttributes(array('employee_id' => $data1->id)); $fullday = 0; $halfday = 0; ?> <?php foreach ($date as $date1) { $attd_month = date('m', strtotime($date1->attendance_date)); $attd_year = date('y', strtotime($date1->attendance_date)); $crrnt_month = date('m'); $crrnt_year = date('y'); if ($attd_year == $crrnt_year) { echo $date1->attendance_date . '<br/><br/>'; $fullday = $fullday + count(EmployeeAttendances::model()->findAllByAttributes(array('employee_id' => $data1->id, 'is_half_day' => '0', 'attendance_date' => $date1->attendance_date))); $halfday = $halfday + count(EmployeeAttendances::model()->findAllByAttributes(array('employee_id' => $data1->id, 'is_half_day' => '1', 'attendance_date' => $date1->attendance_date))); } } echo '</td>'; echo '<td>' . $halfday . '</td>'; echo '<td>' . $fullday . '</td>'; echo '</tr>'; } ?> </table> <?php } } else { echo '<td align="center" colspan="5"><strong>' . 'No Data Available!' . '</td>'; }
/** * Returns the data model based on the primary key given in the GET variable. * If the data model is not found, an HTTP exception will be raised. * @param integer the ID of the model to be loaded */ public function loadModel($id) { $model = EmployeeAttendances::model()->findByPk($id); if ($model === null) { throw new CHttpException(404, 'The requested page does not exist.'); } return $model; }
return 'W<br>'; break; case 4: return 'T<br>'; break; case 5: return 'F<br>'; break; case 6: return 'S<br>'; break; } } $subjects = Subjects::model()->findAll("batch_id=:x", array(':x' => $_REQUEST['id'])); //echo CHtml::dropDownList('batch_id','',CHtml::listData(Subjects::model()->findAll("batch_id=:x",array(':x'=>$_REQUEST['id'])), 'id', 'name'), array('empty'=>'Select Type')); $model = new EmployeeAttendances(); if (isset($_REQUEST['id'])) { if (!isset($_REQUEST['mon'])) { $mon = date('F'); $mon_num = date('n'); $curr_year = date('Y'); } else { $mon = $model->getMonthname($_REQUEST['mon']); $mon_num = $_REQUEST['mon']; $curr_year = date('Y'); } $num = cal_days_in_month(CAL_GREGORIAN, $mon_num, $curr_year); // 31 ?> <?php
<?php $find = EmployeeAttendances::model()->findAll("attendance_date=:x AND employee_id=:y", array(':x' => $year . '-' . $month . '-' . $day, ':y' => $emp_id)); if (count($find) == 0) { /* Column with no leave marked */ echo CHtml::ajaxLink(Yii::t('job', 'll'), $this->createUrl('employeeAttendances/Addnew'), array('onclick' => '$("#jobDialog' . $day . $emp_id . '").dialog("open"); return false;', 'update' => '#jobDialog123' . $day . $emp_id, 'type' => 'GET', 'data' => array('day' => $day, 'month' => $month, 'year' => $year, 'emp_id' => $emp_id)), array('id' => 'showJobDialog' . $day . $emp_id, 'class' => 'at_abs', 'title' => 'Add leave')); //echo '<div id="jobDialog'.$day.$emp_id.'"></div>'; } else { /* Column with leave marked */ echo CHtml::ajaxLink(Yii::t('job', '<span class="abs"></span>'), $this->createUrl('employeeAttendances/EditLeave'), array('onclick' => '$("#jobDialog' . $day . $emp_id . '").dialog("open"); return false;', 'update' => '#jobDialogupdate' . $day . $emp_id, 'type' => 'GET', 'data' => array('id' => $find[0]['id'], 'day' => $day, 'month' => $month, 'year' => $year, 'emp_id' => $emp_id)), array('id' => 'showJobDialog' . $day . $emp_id, 'title' => 'Reason: ' . $find['0']['reason'])); }
echo ucfirst($employee->first_name) . ' ' . ucfirst($employee->middle_name) . ' ' . ucfirst($employee->last_name); ?> </td> <td> <?php if ($employee->job_title != NULL) { echo ucfirst($employee->job_title); } else { echo '-'; } ?> </td> <!-- Monthly Attendance column --> <td> <?php $attendances = EmployeeAttendances::model()->findAllByAttributes(array('employee_id' => $employee->id)); $required_month = date('Y-m', strtotime($_REQUEST['month'])); //$joining_month = date('Y-m',strtotime($employee->joining_date)); //if($required_month >= $joining_month) //{ $leaves = 0; foreach ($attendances as $attendance) { $attendance_month = date('Y-m', strtotime($attendance->attendance_date)); if ($attendance_month == $required_month) { if ($attendance->is_half_day) { $leaves = $leaves + 0.5; } else { $leaves++; } } }
public function actionDeleteLeave() { $flag = true; $delete = EmployeeAttendances::model()->findByAttributes(array('id' => $_REQUEST['id'])); $model = EmployeeAttendances::model()->DeleteAllByAttributes(array('id' => $_REQUEST['id'])); $employee = Employees::model()->findByAttributes(array('id' => $delete->employee_id)); $settings = UserSettings::model()->findByAttributes(array('user_id' => 1)); if ($settings != NULL) { $date = date($settings->displaydate, strtotime($delete->attendance_date)); } //Adding activity to feed via saveFeed($initiator_id,$activity_type,$goal_id,$goal_name,$field_name,$initial_field_value,$new_field_value) ActivityFeed::model()->saveFeed(Yii::app()->user->Id, '28', $delete->employee_id, ucfirst($employee->first_name) . ' ' . ucfirst($employee->middle_name) . ' ' . ucfirst($employee->last_name), $date, NULL, NULL); if ($flag) { Yii::app()->clientScript->scriptMap['jquery.js'] = false; $this->renderPartial('update', array('model' => $model, 'day' => $_GET['day'], 'month' => $_GET['month'], 'year' => $_GET['year'], 'emp_id' => $_GET['emp_id']), false, true); } }
public function actionDeleteLeave() { $flag = true; $model = EmployeeAttendances::model()->DeleteAllByAttributes(array('id' => $_REQUEST['id'])); if ($flag) { Yii::app()->clientScript->scriptMap['jquery.js'] = false; $this->renderPartial('update', array('model' => $model, 'day' => $_GET['day'], 'month' => $_GET['month'], 'year' => $_GET['year'], 'emp_id' => $_GET['emp_id']), false, true); } }
<div id="parent_Sect"> <?php $this->renderPartial('leftside'); ?> <?php $cal = '{ title: "All Day Event", start: new Date(y, m, 1) },'; $m = ''; $d = ''; $y = ''; //$result=TaskAssignToPatients::model()->findAll(('status=:t1 OR status=:t2 OR status=:t3 OR status=:t4 OR status=:t5 OR status IS NULL group by target_date'),array(':t1'=>'C',':t2'=>'S',':t3'=>'A',':t4'=>'E',':t5'=>'R')); $employee = Employees::model()->findByAttributes(array('uid' => Yii::app()->user->id)); $student = EmployeeAttendances::model()->findAll('employee_id=:x group by attendance_date', array(':x' => $employee->id)); foreach ($student as $student_1) { $m = date('m', strtotime($student_1['attendance_date'])) - 1; $d = date('d', strtotime($student_1['attendance_date'])); $y = date('Y', strtotime($student_1['attendance_date'])); $cal .= "{\n\t\t\t\t\ttitle: '" . '<div align="center"><img src="images/portal/atend_cross.png" width="26" border="0" height="25" /></div>' . "',\n\t\t\t\t\tstart: new Date('" . $y . "', '" . $m . "', '" . $d . "')\n\t\t\t\t},"; } ?> <div class="right_col" id="req_res123">
} else { $class = 'class="even"'; } ?> <tr <?php echo $class; ?> > <td class="name"><?php echo $posts_1->first_name; ?> </td> <?php for ($i = 1; $i <= $num; $i++) { echo '<td>'; $find = EmployeeAttendances::model()->findAll("attendance_date=:x AND employee_id=:y", array(':x' => $_REQUEST['year'] . '-' . $mon_num . '-' . $i, ':y' => $posts_1->id)); if (count($find) == 0) { echo ''; } else { echo "<span style='color:#ce0606'><strong>X</strong></span>"; } echo '</td>'; } ?> </tr> <?php $j++; } ?> </table> <?php
?> </td> </tr> <tr> <td> <strong><?php echo Yii::t('report', 'Leaves Taken'); ?> </strong> </td> <td> <strong>:</strong> </td> <td> <?php $leaves = EmployeeAttendances::model()->findAll('employee_id=:x ORDER BY attendance_date ASC', array(':x' => $individual->id)); $emp_leave = 0; foreach ($leaves as $leave) { if ($leave->is_half_day == 1) { $emp_leave = $emp_leave + 0.5; } else { $emp_leave++; } } echo $emp_leave; ?> </td> </tr> </table> </div> <!-- END Individual Details -->