Example #1
0
 public function getSalaryByEmployee($employee_id = false)
 {
     $salaryManage = array();
     if ($employee_id) {
         $salaryManage = LbEmployeeSalary::model()->findAll('employee_id =' . $employee_id);
     }
     return $salaryManage;
 }
Example #2
0
 public function actionAjaxDeleteItem($id, $employee_id)
 {
     $invoiceItem = LbEmployeeSalary::model()->findByPk($id);
     $invoiceItem->delete();
     $this->redirect(array('update', 'id' => $employee_id));
 }
Example #3
0
                    
                        <tr style="font-weight:bold;" align="center">                        
                            <td width="150" class="lb-grid-header">' . Yii::t('lang', 'Paid For Month') . '</td>
                            <td width="100" class="lb-grid-header">' . Yii::t('lang', 'Total Salary') . '</td>
                            <td width="100" class="lb-grid-header">' . Yii::t('lang', 'Payment') . '</td>
                            <td width="100" class="lb-grid-header">' . Yii::t('lang', 'Amount') . '</td>
                            <td width="200" class="lb-grid-header">' . Yii::t('lang', 'Note') . '</td>
                        </tr>
                </thead>';
$a = LbEmployeePayment::model()->getMonthByEmployeeAndYear($employee_id, $year->payment_year);
$totalAllPayment = 0;
$totalAllAmount = 0;
$totalAllSalary = 0;
foreach ($a as $data) {
    // total salary
    $salary = LbEmployeeSalary::model()->totalSalaryEmployee($employee_id);
    $benefit = LbEmployeeBenefits::model()->caculatorBenefitByEmployee($employee_id);
    $totalSalary = $salary - $benefit;
    $totalAllSalary += $totalSalary;
    //total Payment
    $payment_salary = LbEmployeePayment::model()->getPaidByMonth($data->payment_month, $employee_id, $year->payment_year);
    $totalAllPayment += $payment_salary;
    // $payment = number_format($payment_salary,2);
    //amount
    $amount = $totalSalary - $payment_salary;
    $totalAllAmount = $totalAllAmount + $amount;
    //view report
    $PDFPayment .= '<tr>';
    $PDFPayment .= '<td align="center">' . $data->payment_month . '/' . $data->payment_year . '</td>';
    $PDFPayment .= '<td align="right">$' . number_format($totalSalary, 2) . '</td>';
    $PDFPayment .= '<td align="right">$' . number_format($payment_salary, 2) . '</td>';
Example #4
0
" target="_blank"><img width="16" style="margin-left: 50px;" src="<?php 
    echo Yii::app()->baseUrl . '/images/icons/icon_pdf.png';
    ?>
" /> <?php 
    echo Yii::t('lang', 'Print');
    ?>
</a>
             </p>
        <?php 
} else {
    echo '<p class="note">Fields with <span class="required">*</span> are required.</p>';
}
$test = array();
$benefit = array();
if (isset($_GET['id'])) {
    $test = LbEmployeeSalary::model()->findAll('employee_id=' . $_GET['id']);
    $benefit = LbEmployeeBenefits::model()->findAll('employee_id=' . $_GET['id']);
    $salaryModel = new LbEmployeeSalary();
    $benefitModel = new LbEmployeeBenefits();
}
$salary = UserList::model()->getItemsForListCode('salary');
$benefit_employee = UserList::model()->getItemsForListCode('benefit');
$option_salary_update = CHtml::listData($salary, 'system_list_item_id', 'system_list_item_name');
$option_benefit_update = CHtml::listData($benefit_employee, 'system_list_item_id', 'system_list_item_name');
$option_salary = '<option value="0">choose salary</option>';
foreach ($salary as $data) {
    $option_salary .= '<option value="' . $data['system_list_item_id'] . '">' . $data['system_list_item_name'] . '</option>';
}
$option_benefit = '<option value="0">choose benefit</option>';
foreach ($benefit_employee as $value) {
    $option_benefit .= '<option value="' . $value['system_list_item_id'] . '">' . $value['system_list_item_name'] . '</option>';
Example #5
0
 public function caculatorAmount($employee_id = false)
 {
     $paid = $this->getPaidByEmployee($employee_id);
     $salary = LbEmployeeSalary::model()->totalSalaryEmployee($employee_id) - LbEmployeeBenefits::model()->caculatorBenefitByEmployee($employee_id);
     $oustanding = $salary - $paid;
     return $oustanding;
 }
Example #6
0
          </td></tr>' . '</table>   
         <table border="0" style="margin-left:30px;margin-top:50px; width:100%" class="items table table-bordered">';
$PDFEmployee .= '<thead>        
                            <tr>
                                <th width="120" class="lb-grid-header">' . Yii::t('lang', 'Name') . '</th>
                                <th width="100" class="lb-grid-header">' . Yii::t('lang', 'Birthday') . '</th>
                                <th width="100" class="lb-grid-header">' . Yii::t('lang', 'Phone') . '</th>
                                <th width="100"  class="lb-grid-header">' . Yii::t('lang', 'Total Salary') . '</th>
                                <th width="130" class="lb-grid-header">' . Yii::t('lang', 'Email') . '</th>
                                
                                <th width="70" class="lb-grid-header">' . Yii::t('lang', 'Address') . '</th>
                                
                            </tr>
                    </thead>';
foreach ($model as $key => $value) {
    $salary = LbEmployeeSalary::model()->totalSalaryEmployee($model[$key]['lb_record_primary_key']);
    $benefit = LbEmployeeBenefits::model()->caculatorBenefitByEmployee($model[$key]['lb_record_primary_key']);
    $totalSalary = number_format($salary - $benefit, 2);
    $PDFEmployee .= '<tr>';
    $PDFEmployee .= '<td>' . $model[$key]['employee_name'] . '</td>';
    $PDFEmployee .= '<td>' . date('d/M/Y', strtotime($model[$key]['employee_birthday'])) . '</td>';
    $PDFEmployee .= '<td>' . $model[$key]['employee_phone_1'] . '</td>';
    $PDFEmployee .= '<td style="float:left;">' . $totalSalary . '</td>';
    $PDFEmployee .= '<td>' . $model[$key]['employee_email_1'] . '</td>';
    $PDFEmployee .= '<td>' . $model[$key]['employee_address'] . '</td>';
    $PDFEmployee .= '</tr> ';
}
$PDFEmployee .= '
                        
          </table>';
echo $PDFEmployee;
Example #7
0
                        <span style="margin-top:20px;"></span>
                    </td></tr>
                </table>
                </td></tr>' . '</table>
            <h4 style="margin-left:20px;">Salary Components:</h4>
             <table border="1" style="width:100%;margin-top:20px;margin-left:10px;" cellpadding="0" cellspacing="0">';
$PDFSalaryEmployee .= '<thead>
                    
                        <tr style="font-weight:bold;" align="center">                        
                           
                            <td width="350" class="lb-grid-header">' . Yii::t('lang', 'Salary Name') . '</td>
                            <td width="350" class="lb-grid-header">' . Yii::t('lang', 'Salary Amount') . '</td>
                            
                        </tr>
                    </thead>';
$a = LbEmployeeSalary::model()->getSalaryByEmployee($employee_id);
$salary = 0;
foreach ($a as $value) {
    $salary_name = UserList::model()->findByPk($value->salary_name)['system_list_item_name'];
    $PDFSalaryEmployee .= '<tr>';
    $PDFSalaryEmployee .= '<td align="center">' . $salary_name . '</td>';
    $PDFSalaryEmployee .= '<td align="center">$' . number_format($value->salary_amount, 2) . '</td>';
    $PDFSalaryEmployee .= '</tr>';
    $salary += $value->salary_amount;
}
$PDFSalaryEmployee .= '            
            </table>
            <h4 ">Benefits Detail:</h4>
            <table border="1" style="width:100%;margin-top:20px;margin-left:10px;" cellpadding="0" cellspacing="0">';
$PDFSalaryEmployee .= '<thead>
                        
Example #8
0
                            <td width="100" class="lb-grid-header">' . Yii::t('lang', 'Payment') . '</td>
                            <td width="100" class="lb-grid-header">' . Yii::t('lang', 'Amount') . '</td>
                            <td width="200" class="lb-grid-header">' . Yii::t('lang', 'Note') . '</td>
                        </tr>
                </thead>';
$month = dateMY($month_year)[0];
$year = dateMY($month_year)[1];
$model = LbEmployeePayment::model()->getAllByMonthYear($month, $year);
$totalAllAmount = 0;
$totalAllSalary = 0;
$totalAllPayment = 0;
foreach ($model as $key) {
    //Employee name
    $employee = LbEmployee::model()->getInfoEmployee($key['employee_id'])["employee_name"];
    // total salary
    $salary = LbEmployeeSalary::model()->totalSalaryEmployee($key['employee_id']);
    $benefit = LbEmployeeBenefits::model()->caculatorBenefitByEmployee($key['employee_id']);
    $totalSalary = $salary - $benefit;
    $totalAllSalary += $totalSalary;
    //total Payment
    //$totalPaid = 0;
    $payment_salary = LbEmployeePayment::model()->getPaidByEmployee($key['employee_id'], $month, $year);
    //$totalPaid += $payment_salary;
    $payment = $payment_salary;
    $totalAllPayment += $payment;
    //amount
    //   $amount = number_format(LbEmployeePayment::model()->caculatorAmount($key['employee_id']),2);
    $amount = $salary - $benefit - $payment_salary;
    $totalAllAmount += $amount;
    //note
    $note = $key['payment_note'];