</td></tr> </table> </td></tr>' . '</table> <table border="1" style="margin-left:40px;margin-top:50px; width:100%;" class="items table table-bordered">'; $PDFPayment .= '<thead> <tr style="font-weight:bold;" align="center"> <td width="150" class="lb-grid-header">' . Yii::t('lang', 'Name') . '</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>'; $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);
$customer_name = ''; while (strtotime($FromDate) < strtotime($Todate)) { $arrDate = dateMY($FromDate); $subtotal = 0; $tax = 0; $total = 0; $YStart = $arrDate[0]; $MStart = $arrDate[1]; $MEnd = dateMY($Todate)[1]; $YEnd = dateMY($Todate)[0]; $numberDate = $YStart . '-' . $MStart . '-' . numberDate($YStart, $MStart); $date_To = date('Y-m-d', strtotime($numberDate)); $day = dateMY($FromDate)[2]; $dayTo = dateMY($Todate)[2]; $month = dateMY($FromDate)[1]; $year = dateMY($FromDate)[0]; $AmountMonth = 0; for ($i = 0; $i < 5; $i++) { if ($YStart == $YEnd && $MStart == $MEnd) { $PaymentAll = LbPayment::model()->getAllPayment($FromDate, $Todate, $customer_id, false, false, $i); } else { $PaymentAll = LbPayment::model()->getAllPayment($FromDate, $numberDate, $customer_id, false, false, $i); } if (count($PaymentAll) > 0) { $paymentAmount = 0; foreach ($PaymentAll as $data) { if (LbCustomer::model()->isCustomer($data->attributes['lb_payment_customer_id']) != null) { $customer_information = LbCustomer::model()->find('lb_record_primary_key=' . intval($data->attributes['lb_payment_customer_id'])); $customer_name = $customer_information->lb_customer_name; echo '<tr>'; echo '<td>' . $data->attributes['lb_payment_date'] . '</td>';
$MStart = 1; $dateNext = $YStart . '-' . $MStart . '-01'; } $FromDate = date('Y-m-d', strtotime($dateNext)); } } else { $customer_arr = LbCustomer::model()->getCompanies($sort = 'lb_customer_name ASC', LbCustomer::LB_QUERY_RETURN_TYPE_MODELS_ARRAY); while (strtotime($FromDate) < strtotime($Todate)) { $arrDate = dateMY($FromDate); $subtotal = 0; $tax = 0; $total = 0; $YStart = $arrDate[0]; $MStart = $arrDate[1]; $MEnd = dateMY($Todate)[1]; $YEnd = dateMY($Todate)[0]; $numberDate = $YStart . '-' . $MStart . '-' . numberDate($YStart, $MStart); $date_To = date('Y-m-d', strtotime($numberDate)); if ($YStart == $YEnd && $MStart == $MEnd) { $a = LbInvoice::model()->getInvoiceMonth(false, $FromDate, $Todate, false, false); } else { $a = LbInvoice::model()->getInvoiceMonth(false, $FromDate, $numberDate, false, false); } ?> <?php foreach ($a as $data) { $customer_id = false; if (LbCustomer::model()->isCustomer($data->lb_invoice_customer_id) != null) {