/** * Finds the Deductions model based on its primary key value. * If the model is not found, a 404 HTTP exception will be thrown. * @param integer $id * @return Deductions the loaded model * @throws NotFoundHttpException if the model cannot be found */ protected function findModel($id) { if (($model = Deductions::findOne($id)) !== null) { return $model; } else { throw new NotFoundHttpException('The requested page does not exist.'); } }
function payslip() { $p = new Payslip(); $users = $p->where('office_id', '=', 21)->get(); foreach ($users as $user) { $deductions = $user->deductions; foreach ($deductions as $d) { echo $d->amount . '<br>'; } } $d = new Deductions(); $deductions = $d->where('id', '=', 126)->get(); foreach ($deductions as $dd) { echo $dd->employee->lname; } // For single record $deductions = $d->find(126); echo $deductions->employee->lname; }
echo number_format($row->monthly_pay, 2); ?> </td> <td align="right"><a href="<?php echo base_url() . 'payroll/report/loan_payments/' . $row->id . '/' . $employee_id; ?> "><?php echo number_format(Deductions::amountPaid($row->id), 2); ?> </a></td> <td align="right"><?php echo number_format($row->loan_gross - Deductions::amountPaid($row->id), 2); ?> </td> <td align="right"><?php echo $row->months_pay - Deductions::countMonthPaid($row->id); ?> </td> <td><?php echo $row->status; ?> </td> <td></td> </tr> <?php } ?> <tr> <td></td> <td> </td> <td> </td>