<input name="textfield2" type="text" id="textfield2" value="<?php echo number_format($gross_amount_earned, 2); ?> " size="7" style="text-align:right" /> <br /> <input name="textfield3" type="text" id="textfield3" value="<?php echo number_format($gross_amount_earned, 2); ?> " size="7" style="text-align:right" /></td> <?php foreach ($agencies as $agency) { ?> <?php // Lets count info per agency $d = new Deduction_information(); $d->order_by('report_order'); $infos = $d->get_by_deduction_agency_id($agency->id); ?> <?php foreach ($infos as $info) { ?> <?php // To do: we are going to check for active deductions per employee $dl = new Deduction_loan(); $dl->where('employee_id', $employee->id); $dl->where('deduction_information_id', $info->id); $dl->get(); $deduct = 0; if ($dl->exists()) {
function loan_save($id = '', $employee_id = '') { $data['page_name'] = '<b>Save Loan Schedule</b>'; $data['employee_id'] = $employee_id; $data['msg'] = ''; $di = new Deduction_loan(); $data['deduction'] = $di->get_by_id($id); if (Input::get('op')) { // Add employee id if insert only if ($id == 0) { $di->employee_id = $employee_id; } $di->deduction_information_id = Input::get('deduction_information_id'); $di->date_loan = Input::get('date_loan'); $di->loan_gross = Input::get('loan_gross'); $di->months_pay = Input::get('months_pay'); $di->monthly_pay = Input::get('monthly_pay'); $di->date_from = Input::get('date_from'); $di->date_to = Input::get('date_to'); $di->status = Input::get('status') ? Input::get('status') : 'inactive'; $di->save(); return Redirect::to('payroll/deduction/loan/' . $employee_id, 'refresh'); } $d = new Deduction_information(); $d->order_by('desc'); $d->where('type', 'loan'); $data['informations'] = $d->get(); $data['main_content'] = 'deduction/loan/loan_save'; return View::make('includes/template', $data); }