Esempio n. 1
0
 <?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);
     // The tax fix amount
     // If fix amount is not equal to zero meaning the
     // salary is more than 10,000.00
     if ($tt->fix_amount != 0) {
         $tax_with_held = $tt->fix_amount;
         //echo $tax_with_held;
         // Well lets check how much excess
         $excess = $monthly_salary - $tt->start_range;
         $percentage = intval($tt->percentage);
         // Add the excess to tax with held
         $tax_percentage = $excess / 100 * $percentage;
         $tax_with_held = $tax_with_held + $tax_percentage;
         //echo $tax_percentage;
Esempio n. 2
0
 function compute_tax()
 {
     $t = new Tax_table();
     $t->where('monthly', $this->tax_table_status);
     $t->where('status', 'percent_over');
     $t->get();
     $tax = $this->taxable_amount - $this->bracket_amount;
     // The column in tax table like bracket7
     $column = $this->column;
     $int = intval($t->{$column});
     $decimal = floatval($int . "%") / 100;
     // like 30% to 0.3
     $tax = $tax * $decimal;
     $t->where('monthly', $this->tax_table_status);
     $t->where('status', 'exemption');
     $t->get();
     $add_exemption = $t->{$column};
     $tax = $tax + $add_exemption;
     $this->wtax = $tax;
     $this->total_deduction += $this->wtax;
 }