Пример #1
0
 public function actionEmpmonthlypdf()
 {
     $department_name = EmployeeDepartments::model()->findByAttributes(array('id' => $_REQUEST['id']));
     $pdf_name = ucfirst($department_name->name) . ' Employees Monthly Attendance Report ' . $_REQUEST['month'] . '.pdf';
     # HTML2PDF has very similar syntax
     $html2pdf = Yii::app()->ePdf->HTML2PDF();
     $html2pdf->WriteHTML($this->renderPartial('empmonthlypdf', array(), true));
     $html2pdf->Output($pdf_name);
 }
Пример #2
0
                    </table>
                </td>
            </tr>
        </table>
    </div>
	<!-- End Header -->

	<?php 
if (isset($_REQUEST['id'])) {
    ?>
   
    <br /><br />
    <span align="center"><h4>EMPLOYEES MONTHLY ATTENDANCE REPORT</h4></span>
    <?php 
    $employees = Employees::model()->findAll("employee_department_id=:x and is_deleted=:y", array(':x' => $_REQUEST['id'], ':y' => 0));
    $department_name = EmployeeDepartments::model()->findByAttributes(array('id' => $_REQUEST['id']));
    ?>
    <!-- Department details -->
    <div style="border:#CCC 1px; width:700px; padding:10px 10px; background:#E1EAEF;">
        <table style="font-size:14px;">
        	<tr>
            	<td style="width:100px;"><b><?php 
    echo Yii::t('report', 'Department');
    ?>
</b></td>
                <td style="width:10px;">:</td>
                <td style="width:250px;"><?php 
    echo ucfirst($department_name->name);
    ?>
</td>
                
 public function actionPdf()
 {
     $department = EmployeeDepartments::model()->findByAttributes(array('id' => $_REQUEST['id']));
     $department = $department->name . ' Department Attendance.pdf';
     # HTML2PDF has very similar syntax
     $html2pdf = Yii::app()->ePdf->HTML2PDF();
     $html2pdf->WriteHTML($this->renderPartial('attentancepdf', array(), true));
     $html2pdf->Output($department);
 }
Пример #4
0
            echo $date1;
        } else {
            echo $list_1->joining_date;
        }
        ?>
&nbsp;</td>
                    <td align="center"><?php 
        echo CHtml::link($list_1->first_name . '  ' . $list_1->middle_name . '  ' . $list_1->last_name, array('/employees/employees/view', 'id' => $list_1->id));
        ?>
&nbsp;</td>
                    <td align="center"><?php 
        echo $list_1->employee_number;
        ?>
</td>
					<?php 
        $dept = EmployeeDepartments::model()->findByAttributes(array('id' => $list_1->employee_department_id));
        ?>
                    <td align="center"><?php 
        if ($dept != NULL) {
            echo $dept->name;
        } else {
            echo '-';
        }
        ?>
 </td>
                    <?php 
        $pos = EmployeePositions::model()->findByAttributes(array('id' => $list_1->employee_position_id));
        ?>
                    <td align="center"><?php 
        if ($pos != NULL) {
            echo $pos->name;
Пример #5
0
            return 'Sa';
            break;
    }
}
?>

<h1><?php 
echo Yii::t('employees', 'Employee Attendances');
?>
</h1>


<div class="formCon">
<div class="formConInner">
<?php 
$data = CHtml::listData(EmployeeDepartments::model()->findAll(), 'id', 'name');
if (isset($_REQUEST['id'])) {
    $sel = $_REQUEST['id'];
} else {
    $sel = '';
}
echo Yii::t('employees', 'Select Department') . '&nbsp;&nbsp;&nbsp;';
echo CHtml::dropDownList('id', '', $data, array('prompt' => 'Select Department', 'onchange' => 'course()', 'id' => 'cou', 'options' => array($sel => array('selected' => true))));
?>

<?php 
if (isset($_REQUEST['id'])) {
    if (!isset($_REQUEST['mon'])) {
        $mon = date('F');
        $mon_num = date('n');
        $curr_year = date('Y');
Пример #6
0
echo 'Course';
echo CHtml::dropDownList('id', '', $data, array('prompt' => 'Select', 'ajax' => array('type' => 'POST', 'url' => CController::createUrl('EmployeesSubjects/subject'), 'update' => '#subject_id', 'data' => 'js:$(this).serialize()')));
echo '&nbsp;&nbsp;&nbsp;';
echo 'Subject';
?>


<?php 
//$data=CHtml::listData(Subjects::model()->findAll(),'id','name');
echo CHtml::activeDropDownList($model, 'subject_id', array(), array('prompt' => 'Select', 'id' => 'subject_id', 'ajax' => array('type' => 'POST', 'url' => CController::createUrl('EmployeesSubjects/current'), 'update' => '#current')));
?>

	<div id="current"></div> 
    
<?php 
$data = CHtml::listData(EmployeeDepartments::model()->findAll(array('order' => 'name DESC')), 'id', 'name');
echo 'Departments';
echo CHtml::dropDownList('did', '', $data, array('prompt' => 'Select', 'ajax' => array('type' => 'POST', 'url' => CController::createUrl('EmployeesSubjects/employee'), 'update' => '#employee_id', 'data' => 'js:$(this).serialize()')));
echo '&nbsp;&nbsp;&nbsp;';
?>

<?php 
$data1 = CHtml::listData(Employees::model()->findAll(array('order' => 'first_name DESC')), 'id', 'first_name');
?>
	<div class="row">
		<?php 
echo $form->labelEx($model, 'Select Employee');
?>
		<?php 
echo CHtml::activeDropDownList($model, 'employee_id', $data1, array('prompt' => 'Select', 'id' => 'employee_id'));
?>
Пример #7
0
</td>
    </tr>
    <?php 
        }
        ?>
    </table>
   </div>
    <?php 
    }
    echo '<br><span style="font-size:14px; font-weight:bold; color:#666;">Departments</span>&nbsp;&nbsp;';
    if (isset($_REQUEST['dep'])) {
        $sel_2 = $_REQUEST['dep'];
    } else {
        $sel_2 = '';
    }
    echo CHtml::dropDownList('dep_id', '', CHtml::listData(EmployeeDepartments::model()->findAll(), 'id', 'name'), array('prompt' => 'Select', 'id' => 'depart_id', 'onchange' => 'depname()', 'options' => array($sel_2 => array('selected' => true))));
    echo '<br>';
    if (isset($_REQUEST['dep']) and $_REQUEST['dep'] != NULL) {
        $employee = EmployeeElectiveSubjects::model()->Employeenotassigned($_REQUEST['dep'], $_REQUEST['elect']);
        //$employee_subjects = EmployeesSubjects::models()->findAll("employee_id=:x", array(':x'=>$_REQUEST['dept']));
        //echo count($employee);
        //exit;
        if (count($employee) != 0) {
            ?>
    <h3><?php 
            echo Yii::t('employees', 'Assign New:');
            ?>
</h3>
      <div class="tableinnerlist">
     <table width="80%" cellpadding="0" cellspacing="0">
     <tr>
 /**
  * Updates a particular model.
  * If update is successful, the browser will be redirected to the 'view' page.
  * @param integer $id the ID of the model to be updated
  */
 public function actionUpdate($id)
 {
     $model = $this->loadModel($id);
     // Uncomment the following line if AJAX validation is needed
     // $this->performAjaxValidation($model);
     $settings = UserSettings::model()->findByAttributes(array('user_id' => Yii::app()->user->id));
     if ($settings != NULL) {
         $date1 = date($settings->displaydate, strtotime($model->joining_date));
         $date2 = date($settings->displaydate, strtotime($model->date_of_birth));
     }
     $model->joining_date = $date1;
     $model->date_of_birth = $date2;
     if (isset($_POST['Employees'])) {
         $old_model = $model->attributes;
         // For activity feed
         $model->attributes = $_POST['Employees'];
         if ($model->joining_date) {
             $model->joining_date = date('Y-m-d', strtotime($model->joining_date));
         }
         if ($model->date_of_birth) {
             $model->date_of_birth = date('Y-m-d', strtotime($model->date_of_birth));
         }
         if ($file = CUploadedFile::getInstance($model, 'photo_data')) {
             $model->photo_file_name = $file->name;
             $model->photo_content_type = $file->type;
             $model->photo_file_size = $file->size;
             $model->photo_data = file_get_contents($file->tempName);
         }
         if ($model->save()) {
             // Saving to activity feed
             $results = array_diff_assoc($_POST['Employees'], $old_model);
             // To get the fields that are modified.
             //print_r($old_model);echo '<br/><br/>';print_r($_POST['Students']);echo '<br/><br/>';print_r($results);echo '<br/><br/>'.count($results);echo '<br/><br/>';
             foreach ($results as $key => $value) {
                 if ($key != 'updated_at') {
                     if ($key == 'gender') {
                         if ($value == 'F') {
                             $value = 'Female';
                         } else {
                             $value = 'Male';
                         }
                         if ($old_model[$key] == 'F') {
                             $old_model[$key] = 'Female';
                         } else {
                             $old_model[$key] = 'Male';
                         }
                     } elseif ($key == 'employee_category_id') {
                         $value = EmployeeCategories::model()->findByAttributes(array('id' => $value));
                         $value = ucfirst($value->name);
                         $old_model_value = EmployeeCategories::model()->findByAttributes(array('id' => $old_model[$key]));
                         $old_model[$key] = ucfirst($old_model_value->name);
                     } elseif ($key == 'employee_position_id') {
                         $value = EmployeePositions::model()->findByAttributes(array('id' => $value));
                         $value = ucfirst($value->name);
                         $old_model_value = EmployeePositions::model()->findByAttributes(array('id' => $old_model[$key]));
                         $old_model[$key] = ucfirst($old_model_value->name);
                     } elseif ($key == 'employee_department_id') {
                         $value = EmployeeDepartments::model()->findByAttributes(array('id' => $value));
                         $value = ucfirst($value->name);
                         $old_model_value = EmployeeDepartments::model()->findByAttributes(array('id' => $old_model[$key]));
                         $old_model[$key] = ucfirst($old_model_value->name);
                     } elseif ($key == 'employee_grade_id') {
                         $value = EmployeeGrades::model()->findByAttributes(array('id' => $value));
                         $value = ucfirst($value->name);
                         $old_model_value = EmployeeGrades::model()->findByAttributes(array('id' => $old_model[$key]));
                         $old_model[$key] = ucfirst($old_model_value->name);
                     } elseif ($key == 'nationality_id' or $key == 'country_id') {
                         $value = Countries::model()->findByAttributes(array('id' => $value));
                         $value = $value->name;
                         $old_model_value = Countries::model()->findByAttributes(array('id' => $old_model[$key]));
                         $old_model[$key] = $old_model_value->name;
                     }
                     //echo $key.'-'.$model->getAttributeLabel($key).'-'.$value.'-'.$old_model[$key].'<br/>';
                     //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, '24', $model->id, ucfirst($model->first_name) . ' ' . ucfirst($model->middle_name) . ' ' . ucfirst($model->last_name), $model->getAttributeLabel($key), $old_model[$key], $value);
                 }
             }
             //END saving to activity feed
             $this->redirect(array('update2', 'id' => $model->id));
         }
     }
     $this->render('update', array('model' => $model));
 }
Пример #9
0
    <td >&nbsp;</td>
  </tr>
  <tr>
  	<td>&nbsp;</td>
    <td>&nbsp;</td>
    <td>&nbsp;</td>
    <td>&nbsp;</td>
    <td>&nbsp;</td>
  </tr>
  <tr>
    <td valign="middle"><?php 
echo $form->labelEx($model, Yii::t('employees', 'employee_department_id'));
?>
</td>
    <td><?php 
echo $form->dropDownList($model, 'employee_department_id', CHtml::listData(EmployeeDepartments::model()->findAll(), 'id', 'name'), array('empty' => 'Select Department'));
?>
		<?php 
echo $form->error($model, 'employee_department_id');
?>
</td>
    <td valign="middle">&nbsp;</td>
    <td valign="middle"><?php 
echo $form->labelEx($model, Yii::t('employees', 'employee_position_id'));
?>
</td>
    <td valign="middle"><?php 
echo $form->dropDownList($model, 'employee_position_id', CHtml::listData(EmployeePositions::model()->findAll(), 'id', 'name'), array('empty' => 'Select Postition'));
?>
		<?php 
echo $form->error($model, 'employee_position_id');
 /**
  * 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 = EmployeeDepartments::model()->findByPk($id);
     if ($model === null) {
         throw new CHttpException(404, 'The requested page does not exist.');
     }
     return $model;
 }