<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>'; $PDFPayment .= '<td align="right">$' . number_format($amount, 2) . '</td>'; $PDFPayment .= '<td>' . $data->payment_note . '</td>'; $PDFPayment .= '</tr>'; } $PDFPayment .= '<tr>';
public function actionajaxDeletePayment($id) { $paymentItem = LbEmployeePayment::model()->findByPk($id); $paymentItem->delete(); }
public function totalPaidByDate($month = false, $employee_id, $year = false, $date = false) { $criteria = new CDbCriteria(); $total = 0; if ($month) { $criteria->compare('payment_month', $month); } if ($year) { $criteria->compare('payment_year', $year); } if ($employee_id) { $criteria->compare('employee_id', $employee_id); } $a = LbEmployeePayment::model()->findAll($criteria); if (count($a) > 0) { foreach ($a as $value) { // $total+=$value->payment_paid; $payment_date = strtotime($value->payment_date); if ($payment_date < strtotime($date)) { $total += $value->payment_paid; } } } return $total; }
<?php echo '<div id="show_payment">'; $date_now = date_format(date_create('01-' . $date), 'Y-m-d'); $month_default = date('m', strtotime($date_now)); $year_default = date('Y', strtotime($date_now)); $model = LbEmployeePayment::model()->search($name, $month_default, $year_default); $this->Widget('bootstrap.widgets.TbGridView', array('id' => 'lb_expenses_gridview', 'dataProvider' => $model, 'type' => 'striped bordered condensed', 'columns' => array(array('class' => 'bootstrap.widgets.TbButtonColumn', 'template' => '{delete}', 'htmlOptions' => array('width' => '10'), 'deleteButtonUrl' => '"' . LbEmployee::model()->getActionURLNormalized("ajaxDeletePayment") . '" . "?id={$data->lb_record_primary_key}"', 'afterDelete' => 'function(link,success,data){ ' . 'if(data){ responseJSON = jQuery.parseJSON(data);' . ' alert(responseJSON.error); }' . '}'), array('header' => Yii::t('lang', 'Paid For Month'), 'type' => 'raw', 'value' => '$data->payment_month."/".$data->payment_year', 'htmlOptions' => array('width' => '90')), array('header' => Yii::t('lang', 'Date'), 'type' => 'raw', 'value' => 'date("d-m-Y", strtotime($data->payment_date))', 'htmlOptions' => array('width' => '90')), array('header' => Yii::t('lang', 'Name'), 'type' => 'raw', 'value' => ' LbEmployee::model()->getInfoEmployee($data->employee_id)["employee_name"];', 'htmlOptions' => array('width' => '130')), array('header' => Yii::t('lang', 'Total Salary($)'), 'type' => 'raw', 'value' => 'number_format(LbEmployeeSalary::model()->totalSalaryEmployee($data->employee_id),2)', 'htmlOptions' => array('width' => '80', 'style' => 'text-align:right;')), array('header' => Yii::t('lang', 'Paid($)'), 'type' => 'raw', 'value' => 'number_format(LbEmployeePayment::model()->totalPaidByDate($data->payment_month,$data->employee_id,$data->payment_year,$data->payment_date),2);', 'htmlOptions' => array('width' => '80', 'style' => 'text-align:right;')), array('header' => Yii::t('lang', 'Balance($)'), 'type' => 'raw', 'value' => 'number_format(LbEmployeeSalary::model()->totalSalaryEmployee($data->employee_id)-LbEmployeePayment::model()->totalPaidByDate($data->payment_month,$data->employee_id,$data->payment_year,$data->payment_date),2)', 'htmlOptions' => array('width' => '80', 'style' => 'text-align:right;')), array('header' => Yii::t('lang', 'New Payment($)'), 'type' => 'raw', 'value' => 'LbEmployeePayment::model()->getEmployeePayment(false,$data->lb_record_primary_key)["payment_paid"];', 'htmlOptions' => array('width' => '80', 'style' => 'text-align:right;')), array('header' => Yii::t('lang', 'Note'), 'type' => 'raw', 'value' => 'LbEmployeePayment::model()->getEmployeePayment(false,$data->lb_record_primary_key)["payment_note"];', 'htmlOptions' => array('width' => '130'))))); echo '</div><br/>';
<div style="margin-bottom: 15px; margin-left: 170px;"> <span style="font-size: 16px;"><?php echo Yii::t('lang', 'Employee Name'); ?> :</span> <?php echo CHtml::dropDownList('employee', '', CHtml::listData(LbEmployee::model()->findAll(array('order' => 'employee_name')), 'lb_record_primary_key', 'employee_name'), array('empty' => 'All')); ?> <span style="font-size: 16px;"><?php echo Yii::t('lang', 'Choose year'); ?> :</span> <?php echo CHtml::dropDownList('payment_year', '', CHtml::listData(LbEmployeePayment::model()->findAll(array('group' => 'payment_year', 'order' => 'payment_year')), 'lb_record_primary_key', 'payment_year'), array('empty' => 'All', 'class' => 'span2')); ?> <?php echo CHtml::button(Yii::t('lang', 'Search'), array('onclick' => 'load_search_aging_report();return false;', 'class' => 'btn', 'style' => 'margin-top:-9px;')); ?> </div> </div> <div id="form_view_employee_report"> </div><br/>
$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']; //view report $PDFPayment .= '<tr>'; $PDFPayment .= '<td>' . $employee . '</td>'; $PDFPayment .= '<td align="right">$' . number_format($totalSalary, 2) . '</td>'; $PDFPayment .= '<td align="right">$' . number_format($payment, 2) . '</td>'; $PDFPayment .= '<td align="right">$' . number_format($amount, 2) . '</td>';
<?php $m = $this->module->id; $canAdd = BasicPermission::model()->checkModules($m, 'add'); $canList = BasicPermission::model()->checkModules($m, 'list'); //echo $m; $canAddQuotation = BasicPermission::model()->checkModules('lbQuotation', 'add'); $canListQuotation = BasicPermission::model()->checkModules('lbQuotation', 'list'); $canAddPayment = BasicPermission::model()->checkModules('lbPayment', 'add'); $canView = BasicPermission::model()->checkModules($m, 'view'); $model = new LbEmployeePayment(); echo '<div id="lb-container-header">'; echo '<div style="margin-left: -10px" class="lb-header-right"><h4>Employees</h4></div>'; echo '<div class="lb-header-left">'; // LBApplicationUI::backButton(LbExpenses::model()->getActionURLNormalized('expenses')); echo ' '; $this->widget('bootstrap.widgets.TbButtonGroup', array('type' => '', 'buttons' => array(array('label' => '<i class="icon-plus"></i> ' . Yii::t('lang', 'New'), 'items' => array(array('label' => Yii::t('lang', 'New Employee'), 'url' => LbEmployee::model()->getActionURLNormalized('create')), array('label' => Yii::t('lang', 'New Payment Voucher'), 'url' => LbExpenses::model()->getActionURLNormalized('createPaymentVoucher'))))), 'encodeLabel' => false)); echo '</div>'; echo '</div><br>'; ?> <div class="panel"> <div style="margin-top: 10px;" class="panel-header-title"> <div class="panel-header-title-left"> <span style="font-size: 16px;"><b><?php echo Yii::t('lang', 'Enter Payment'); ?> </b></span> </div> <div style="margin-left:-50px;" class="panel-header-title-right"> <?php if ($canAdd) {
foreach ($a as $value) { $salary = LbEmployeeSalary::model()->totalSalaryEmployee($value['employee_id']); $benefit = LbEmployeeBenefits::model()->caculatorBenefitByEmployee($value['employee_id']); $totalSalary = $salary - $benefit; $totalAllSalary += $totalSalary; } 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 Paid $paid = LbEmployeePayment::model()->totalPaidByDate($month, $key->employee_id, $year, $key->payment_date); $totalPaid += $paid; //New Payment $payment = $key->payment_paid; $totalAllPayment += $payment; //amount $amount = $totalSalary - $paid; $totalAllAmount += $amount; //note $note = $key['payment_note']; //view report $PDFPayment .= '<tr>'; $PDFPayment .= '<td align="center">' . date('d-m-Y', strtotime($key->payment_date)) . '</td>'; $PDFPayment .= '<td>' . $employee . '</td>'; $PDFPayment .= '<td align="right">$' . number_format($totalSalary, 2) . '</td>'; $PDFPayment .= '<td align="right">$' . number_format($paid, 2) . '</td>';
<?php $m = $this->module->id; $canAdd = BasicPermission::model()->checkModules($m, 'add'); $canList = BasicPermission::model()->checkModules($m, 'list'); //echo $m; $canAddQuotation = BasicPermission::model()->checkModules('lbQuotation', 'add'); $canListQuotation = BasicPermission::model()->checkModules('lbQuotation', 'list'); $canAddPayment = BasicPermission::model()->checkModules('lbPayment', 'add'); $canView = BasicPermission::model()->checkModules($m, 'view'); $model = new LbEmployeePayment(); echo '<div id="lb-container-header">'; echo '<div style="margin-left: -10px" class="lb-header-right"><h3>Employees</h3></div>'; echo '<div class="lb-header-left">'; // LBApplicationUI::backButton(LbExpenses::model()->getActionURLNormalized('expenses')); echo ' '; $this->widget('bootstrap.widgets.TbButtonGroup', array('type' => '', 'buttons' => array(array('label' => '<i class="icon-plus"></i> ' . Yii::t('lang', 'New'), 'items' => array(array('label' => Yii::t('lang', 'New Employee'), 'url' => LbEmployee::model()->getActionURLNormalized('create')), array('label' => Yii::t('lang', 'New Payment Voucher'), 'url' => LbExpenses::model()->getActionURLNormalized('createPaymentVoucher'))))), 'encodeLabel' => false)); echo '</div>'; echo '</div><br>'; ?> <div class="panel"> <div style="margin-top: 10px;" class="panel-header-title"> <div class="panel-header-title-left"> <span style="font-size: 16px;"><b><?php echo Yii::t('lang', 'Enter Payment'); ?> </b></span> </div> <div style="margin-left:-50px;" class="panel-header-title-right"> <?php if ($canAdd) {
$totalAllAmount = 0; $totalAllSalary = 0; foreach ($a as $data) { $payment_month = $data->payment_month; $payment_year = $data->payment_year; //if(($month == $payment_month) ){ //Employee name $employee = LbEmployee::model()->getInfoEmployee($data->employee_id); // total salary // $salary = LbEmployeeSalary::model()->totalSalaryEmployee($data->employee_id); $benefit = LbEmployeeBenefits::model()->caculatorBenefitByEmployee($data->employee_id); $totalSalary = $salary - $benefit; $totalAllSalary += $totalSalary; //total Payment $payment_salary = LbEmployeePayment::model()->getPaidByEmployee($data->employee_id, $month, $year); $totalPayment += $payment_salary; // $payment = number_format($payment_salary,2); //amount $amount = $salary - $benefit - $payment_salary; $totalAllAmount = $totalAllAmount + $amount; //view report // $i=0; echo '<tr>'; // echo '<td style="text-align:center">'.$i.'</td>'; echo '<td>' . $employee->employee_name . '</td>'; echo '<td style="text-align:right">$' . number_format($totalSalary, 2) . '</td>'; echo '<td style="text-align:right">$' . number_format($payment_salary, 2) . '</td>'; echo '<td style="text-align:right">$' . number_format($amount, 2) . '</td>'; echo '<td>' . $data->payment_note . '</td>'; echo '</tr>';
// $salary = LbEmployeeSalary::model()->totalSalaryEmployee($value['employee_id']); // $benefit = LbEmployeeBenefits::model()->caculatorBenefitByEmployee($value['employee_id']); // $totalSalary = $salary-$benefit; // $totalAllSalary += $totalSalary; // } foreach ($a as $value) { //Employee name $employee = LbEmployee::model()->getInfoEmployee($value['employee_id'])["employee_name"]; // total salary $payment = LbEmployeePayment::model()->getPaidByEmployee($value['employee_id'], $month, $year); $salary = LbEmployeeSalary::model()->totalSalaryEmployee($value['employee_id']); $benefit = LbEmployeeBenefits::model()->caculatorBenefitByEmployee($value['employee_id']); $totalSalary = $salary - $benefit - $payment + $value->payment_paid; $totalAllSalary += $totalSalary; //Paid salary $paid = LbEmployeePayment::model()->getPaidByMonth($month, $value['employee_id'], $year); $balance = $totalSalary - $paid; $totalAllPaid += $paid; $totalAllBalance += $balance; //total Payment // $payment = LbEmployeePayment::model()->getPaidByEmployee($value['employee_id'],$month, $year) ; $payment = $value->payment_paid; $totalAllPayment += $payment; // //amount // // $amount = $totalSalary-$payment ; // $totalAllAmount += $amount; //note $note = $value['payment_note']; //view report $PDFPayment .= '<tr>';