function loan_delete($id = '', $employee_id = '') { $di = new Deduction_loan(); $di->get_by_id($id); $di->delete(); return Redirect::to('payroll/deduction/loan/' . $employee_id, 'refresh'); }
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()) { $deduct = $dl->monthly_due; // Deduct from salary $net_pay_monthly = $net_pay_monthly - $dl->monthly_due; } // If tax if ($info->code == 'Tax Withheld') { $tt = new Tax_table(); $tt->where('start_range <', $monthly_salary); $tt->order_by('start_range', 'DESC'); $tt->get(1);
function loan_deductions() { $CI =& get_instance(); $date = $CI->input->post('year') . '-' . $CI->input->post('month') . '-15'; $d = new Deduction_loan(); $d->where('employee_id', $this->employee_id); $d->where('deduction_information_id', $this->deduction_id); $d->where('date_to >=', $date); $d->where('status', 'active'); $d->get(); $this->loan_id = $d->id; // The deduction loan id $this->share = 'employee_share'; $this->add_deductions($this->share, $d->monthly_pay); // add up deductions return $d->monthly_pay; }