File: //home/cafsindia/cloud_cafsinfotech_in/application/controllers/Individual_tax_calculation.php
<?php if ( ! defined('BASEPATH')) exit('No direct script is allowed');
require_once("Action_controller.php");
class Individual_tax_calculation extends Action_controller{
public function __construct(){
parent::__construct('individual_tax_calculation');
if(!$this->Appconfig->isAppvalid()){
redirect('config');
}
}
// LOAD PAGE WITH TABLE DATA
public function index(){
//PAGE INFO FUNCTION
$this->page_info();
$data['financial_info'] = $this->financial_info;
$earn_comp_query = 'select label_name, view_name from `cw_form_setting` where trans_status =1 and prime_module_id="employees" and taxable_check =1';
$earn_comp_data = $this->db->query("CALL sp_a_run ('SELECT','$earn_comp_query')");
$earn_comp_result = $earn_comp_data->result();
$earn_comp_data->next_result();
$earn_comp_list = array();
foreach($earn_comp_result as $earn_rslt){
$label_name = $earn_rslt->label_name;
$view_name = $earn_rslt->view_name;
$earn_comp_list[$label_name] = $view_name;
}
$data['earn_comp_list'] = $earn_comp_list;
$tax_section_qry = 'select cw_tax_section.tax_section,tax_act_details,tax_subsection_column from cw_tax_section inner join cw_tax_sub_section on cw_tax_sub_section.tax_section =cw_tax_section.prime_tax_section_id where cw_tax_sub_section.trans_status = 1 and prime_tax_sub_section_id NOT IN (select tax_sub_section from cw_section_matching where cw_section_matching.trans_status = 1) and ((cw_tax_sub_section.tax_section = 1 AND bill_required = 1) OR (cw_tax_sub_section.tax_section != 1)) order by cw_tax_section.tax_order, subsection_order';
$tax_section_info = $this->db->query("CALL sp_a_run ('SELECT','$tax_section_qry')");
$tax_section_result = $tax_section_info->result();
$tax_section_info->next_result();
$data['tax_section_result'] = $tax_section_result;
$add_other_income_qry = 'select cw_income_type.income_type,income_description,other_income_column from cw_other_income inner join cw_income_type on cw_income_type.prime_income_type_id =cw_other_income.income_type where cw_other_income.trans_status = 1 and cw_other_income.income_type !=2 order by cw_income_type.income_type';
$add_other_income_info = $this->db->query("CALL sp_a_run ('SELECT','$add_other_income_qry')");
$add_other_income_result = $add_other_income_info->result();
$add_other_income_info->next_result();
$data['add_other_income_result'] = $add_other_income_result;
$less_other_income_qry = 'select cw_income_type.income_type,income_description,other_income_column from cw_other_income inner join cw_income_type on cw_income_type.prime_income_type_id =cw_other_income.income_type where cw_other_income.trans_status = 1 and cw_other_income.income_type = 2 order by cw_income_type.income_type';
$less_other_income_info = $this->db->query("CALL sp_a_run ('SELECT','$less_other_income_qry')");
$less_other_income_result = $less_other_income_info->result();
$less_other_income_info->next_result();
$data['less_other_income_result'] = $less_other_income_result;
$this->load->view("$this->control_name/manage",$data);
}
public function save_ind_tax_value(){
$tax_cal_data = json_decode($this->input->post('tax_cal_data'));
$created_on = date("Y-m-d H:i:s");
$emp_info_query = 'select * from cw_employees where trans_status = 1 and prime_employees_id="'.$this->logged_id.'"';
$emp_data = $this->db->query("CALL sp_a_run ('SELECT','$emp_info_query')");
$emp_rslt = $emp_data->result();
$emp_data->next_result();
$emp_code = $emp_rslt[0]->employee_code;
$emp_age = $emp_rslt[0]->emp_age;
$metro_sts = $emp_rslt[0]->metro;
$prime_qry_key = '';
$prime_qry_value = '';
if(!empty($tax_cal_data)){
foreach($tax_cal_data as $tax_data){
$column_name = $tax_data->name;
$column_value = $tax_data->value;
$prime_qry_key .= $column_name.",";
$prime_qry_value .= '"'.$column_value.'",';
}
$prime_qry_key .= "emp_id,employee_code,emp_age,metro_sts,trans_created_by,trans_created_date";
$prime_qry_value .= '"'.$this->logged_id.'","'.$emp_code.'","'.$emp_age.'","'.$metro_sts.'","'.$this->logged_id.'",'.'"'.$created_on.'"';
$tax_insert_qry = "insert into cw_tax_ind_cal ($prime_qry_key) values ($prime_qry_value)";
$tax_insert_info = $this->db->query("CALL sp_a_run ('INSERT','$tax_insert_qry')");
$tax_insert_result = $tax_insert_info->result();
$tax_insert_info->next_result();
$ind_tax_id = $tax_insert_result[0]->ins_id;
}
$this->tax_calculation($ind_tax_id);
}
//Manually Tax Calculation for every employees
public function tax_calculation($ind_tax_id){
require_once "./dist/eos-1.0.0/eos.class.php";
$eq = new eqEOS();
$tax_info_query = 'select * from cw_tax_ind_cal where prime_tax_ind_cal_id ="'.$ind_tax_id.'"';
$tax_data = $this->db->query("CALL sp_a_run ('SELECT','$tax_info_query')");
$tax_rslt = $tax_data->result();
$tax_data->next_result();
$metro_sts = $tax_rslt[0]->metro_sts;
$tax_house_rent = $tax_rslt[0]->tax_house_rent;
$hra_received = $tax_rslt[0]->hra_received;
$childran_elig = $tax_rslt[0]->childran_elig;
$gross_tot = $tax_rslt[0]->tot_earn;
$emp_age = $tax_rslt[0]->emp_age;
$pre_tax = $tax_rslt[0]->pre_tax;
$relief_amt = $tax_rslt[0]->relief_amt;
$earn_comp_query = 'select label_name, view_name from `cw_form_setting` where trans_status =1 and prime_module_id="employees" and taxable_check =1';
$earn_comp_data = $this->db->query("CALL sp_a_run ('SELECT','$earn_comp_query')");
$earn_comp_result = $earn_comp_data->result();
$earn_comp_data->next_result();
$tr_line = "";
foreach($earn_comp_result as $earn_rslt){
$label_name = $earn_rslt->label_name;
$view_name = $earn_rslt->view_name;
$label_val = $tax_rslt[0]->$label_name;
$tr_line .="<tr><td colspan='3'>$view_name</td><td>$label_val</td></tr>";
}
//add other income details updates
$add_other_income_qry = 'select cw_income_type.income_type,income_description,other_income_column from cw_other_income inner join cw_income_type on cw_income_type.prime_income_type_id =cw_other_income.income_type where cw_other_income.trans_status = 1 and cw_other_income.income_type !=2 order by cw_income_type.income_type';
$add_other_income_info = $this->db->query("CALL sp_a_run ('SELECT','$add_other_income_qry')");
$add_other_income_result = $add_other_income_info->result();
$add_other_income_info->next_result();
$add_income_array = array();
foreach ($add_other_income_result as $add_income_key => $add_income_value){
$add_income_array[$add_income_value->income_type][] = array("income_type"=>$add_income_value->income_type,"other_income_column"=>$add_income_value->other_income_column,"income_description"=>$add_income_value->income_description);
}
$add_other_income_line = "";
foreach ($add_income_array as $income_key => $income_value){
foreach ($income_value as $addkey => $addvalue){
$other_income_column = $addvalue['other_income_column'];
$income_description = $addvalue['income_description'];
$add_income_type = $addvalue['income_type'];
$other_add_income_val = $tax_rslt[0]->$other_income_column;
$add_other_income_line .= "<tr><td colspan='3'>$add_income_type<br/>$income_description</td><td>$other_add_income_val</td></tr>";
}
}
$tr_tot_line ="<tr><td colspan='3' style='font-weight: bold;font-size: 16px;'>Total Earnings</td><td><b>$gross_tot</b></td></tr>";
//House rent Allowance examption calculations under section 10 calculations start
$section_10_val = 0;
$sec10_line = "<tr><td colspan='4' style='font-weight: bold;font-size: 16px;'>Total Allowance to the extent exempt under Section 10</td></tr>";
if($tax_house_rent != "0.00"){
$hra_query = 'SELECT formula,actual_rent_paid_percentage,metro_percentage,non_metro_percentage,education_cess_percentage FROM `cw_financial_setting` WHERE cw_financial_setting.trans_status = 1 and set_as_default_financial_year = 1';
$hra_data = $this->db->query("CALL sp_a_run ('SELECT','$hra_query')");
$hra_result = $hra_data->result();
$hra_data->next_result();
$hra_formula = $hra_result[0]->formula;
$actual_rent = $hra_result[0]->actual_rent_paid_percentage;
$metro = $hra_result[0]->metro_percentage;
$non_metro = $hra_result[0]->non_metro_percentage;
$edu_cess = $hra_result[0]->education_cess_percentage;
$actual_rent_pct = $hra_result[0]->actual_rent_paid_percentage;
$preg_match = preg_match_all('#\@(.*?)\@#', $hra_formula, $match);
foreach($match[1] as $for_rslt){
$find_value = "@$for_rslt@";
$for_value = $tax_rslt[0]->$for_rslt;
$hra_formula = str_replace($find_value,$for_value,$hra_formula);
}
$hra_formula = $eq->solveIF($hra_formula);
if($hra_formula){
$hra_res = $hra_formula;
}else{
$hra_res = 0;
}
$rent_pay = $hra_res*($actual_rent/100);
$rent_paid = round($tax_house_rent - $rent_pay);
$rent_paid = number_format((float)$rent_paid, 2, '.', '');
$metro_pct = 0;
if((int)$metro_sts === 1){
$metro_basic = $hra_formula*($metro/100);
$metro_pct = $metro;
}else{
$metro_basic = $hra_formula*($non_metro/100);
$metro_pct = $non_metro;
}
$metro_basic = number_format((float)$metro_basic, 2, '.', '');
$hra_rent = min($hra_received, $metro_basic, $rent_paid);
}else{
$hra_rent = 0;
}
if((int)$childran_elig === 1){
$childran_elig_amt = 1200.00;
}else
if((int)$childran_elig >= 2){
$childran_elig_amt = 2400.00;
}else{
$childran_elig_amt = 0.00;
}
$hra_rent = number_format((float)$hra_rent, 2, '.', '');
$childran_elig_amt = number_format((float)$childran_elig_amt, 2, '.', '');
$section_10_val = $hra_rent + $childran_elig_amt;
$gross_total = $gross_tot - $section_10_val;
$section_10_val = number_format((float)$section_10_val, 2, '.', '');
$gross_total = number_format((float)$gross_total, 2, '.', '');
if($section_10_val != 0){
if($hra_rent != 0){
$sec10_line .= "<tr><td>Tax Calculations</td><td></td><td></td><td></td></tr>";
$sec10_line .= "<tr><td> A) $metro_pct% Basic </td><td>$metro_basic</td><td></td><td></td></tr>";
$sec10_line .= "<tr><td> B) HRA Received </td><td>$hra_received</td><td></td><td></td></tr>";
$sec10_line .= "<tr><td> C) Excess of Rent Paid Over $actual_rent% Salary</td><td>$rent_paid</td><td></td><td></td></tr>";
$sec10_line .= "<tr><td> HRA Examption Amount</td><td></td><td></td><td><span style='color:red;'>$hra_rent</span></td></tr>";
}
$sec10_line .= "<tr><td> Children Eduction Amount</td><td></td><td></td><td><span style='color:red;'>$childran_elig_amt</span></td></tr>";
$sec10_line .= "<tr><td>Total Allowance to the extent exempt under Section 10</td><td></td><td></td><td><span style='color:red;'>$section_10_val</span></td></tr>";
}else{
$sec10_line .= "<tr><td colspan='3'><b>Total Allowance to the extent exempt under Section 10</b></td><td><span style='color:red;'><b>$section_10_val</b></span></td></tr>";
}
$tot_sec10_line = "<tr style='font-weight: bold;'><td colspan='3'><span style='color:green;'>GROSS Total</span></td><td><span style='color:green;'>$gross_total</span></td></tr>";
//House rent Allowance examption calculations under section 10 calculations end==
$section_query = 'SELECT tax_section_column,tax_subsection_column,tax_act_details,tax_subsection_limit,cw_tax_section.tax_section,bill_required,exemption_method,section_limit FROM `cw_tax_section` inner join cw_tax_sub_section on cw_tax_sub_section.tax_section = cw_tax_section.prime_tax_section_id WHERE cw_tax_sub_section.tax_section != 1 AND cw_tax_sub_section.trans_status = 1 order by prime_tax_section_id,subsection_order ASC';
$section_data = $this->db->query("CALL sp_a_run ('SELECT','$section_query')");
$section_result = $section_data->result();
$section_data->next_result();
$section_array = array();
foreach ($section_result as $key => $value){
$section_array[$value->tax_section][] = array("tax_section_column"=>$value->tax_section_column,"tax_subsection_column"=>$value->tax_subsection_column,"tax_act_details"=>$value->tax_act_details,"tax_subsection_limit"=>$value->tax_subsection_limit,"bill_required"=>$value->bill_required,"exemption_method"=>$value->exemption_method,"section_limit" => $value->section_limit);
}
//subsections Part START
$sub_section_line = "";
foreach ($section_array as $key => $sub_section){
$tot_limit = 0;
$tot_deduct = 0;
$total_sub = 0;
$sub_section_line .= "<tr><td style='font-weight: bold;font-size: 16px;'>$key</td><td style='font-size: 12px;'>Limit</td><td style='font-size: 12px;'>Declare</td><td></td></tr>";
foreach ($sub_section as $sub => $sub_value){
$tax_section_column = $sub_value['tax_section_column'];
$tax_subsection_column = $sub_value['tax_subsection_column'];
$tax_subsection_name = $sub_value['tax_act_details'];
$tax_subsection_limit = $sub_value['tax_subsection_limit'];
$tax_section = $sub_value['tax_section'];
$bill_required = $sub_value['bill_required'];
$section_limit = $sub_value['section_limit'];
$ind_tax_val = $tax_rslt[0]->$tax_subsection_column;
$total_sub = $total_sub + $ind_tax_val;
$tot_limit = $tot_limit + $tax_subsection_limit;
$tot_deduct = $tot_deduct + $ind_tax_val;
if ($key === "Under Section 80C") {
$sub_least_value = min($tot_deduct, $section_limit);
}else{
$sub_least_value = min($tot_limit, $tot_deduct);
}
$tot_limit = number_format((float)$tot_limit, 2, '.', '');
$sub_least_value = number_format((float)$sub_least_value, 2, '.', '');
$sub_section_line .= "<tr><td> $tax_subsection_name</td><td>$tax_subsection_limit</td><td>$ind_tax_val</td><td></td></tr>";
}
$sub_section_line .= "<tr style='font-weight: bold;'><td>Total $key</td><td>$tot_limit</td><td>$tot_deduct</td><td><span style='color:red;'>$sub_least_value</span></td></tr>";
$gross_total = $gross_total - $sub_least_value;
$gross_total = number_format((float)$gross_total, 2, '.', '');
$sub_section_line .= "<tr style='font-weight: bold;'><td><span style='color:green;'>GROSS Total</span></td><td></td><td></td><td><span style='color:green;'>$gross_total</span></td></tr>";
}
//less other income details updates
$less_other_income_qry = 'select cw_income_type.income_type,income_description,other_income_column from cw_other_income inner join cw_income_type on cw_income_type.prime_income_type_id =cw_other_income.income_type where cw_other_income.trans_status = 1 and cw_other_income.income_type =2 order by cw_income_type.income_type';
$less_other_income_info = $this->db->query("CALL sp_a_run ('SELECT','$less_other_income_qry')");
$less_other_income_result = $less_other_income_info->result();
$less_other_income_info->next_result();
$less_income_array = array();
foreach ($less_other_income_result as $less_key => $less_value){
$less_income_array[$less_value->income_type][] = array("income_type"=>$less_value->income_type,"other_income_column"=>$less_value->other_income_column,"income_description"=>$less_value->income_description);
}
$less_other_income_line = "";
foreach ($less_income_array as $less_income_key => $less_income_val){
$total_less_income = 0;
$less_other_income_line .= "<tr><td style='font-weight: bold;font-size: 16px;'>$less_income_key</td><td></td><td></td><td></td></tr>";
foreach ($less_income_val as $less_oth_key => $less_oth_val){
$less_other_income_column = $less_oth_val['other_income_column'];
$less_income_description = $less_oth_val['income_description'];
$less_income_type = $less_oth_val['income_type'];
$other_less_income_val = $tax_rslt[0]->$less_other_income_column;
$total_less_income = $total_less_income + $other_less_income_val;
$less_other_income_line .= "<tr><td> $less_income_description</td><td></td><td>$other_less_income_val</td><td></td></tr>";
}
$less_other_income_line .= "<tr style='font-weight: bold;'><td>$less_income_key</td><td></td><td></td><td><span style='color:red;'>$total_less_income</span></td></tr>";
}
$gross_total = $gross_total - $total_less_income;
$gross_total = number_format((float)$gross_total, 2, '.', '');
$other_less_section_line = "<tr style='font-weight: bold;'><td><span style='color:green;'>GROSS Total</span></td><td></td><td></td><td><span style='color:green;'>$gross_total</span></td></tr>";
$gross_total = ceil($gross_total / 10) * 10; //10 Rupee Rounding
$final_value = $gross_total;
$final_value = number_format((float)$final_value, 2, '.', '');
$final_line = "<tr style='font-weight: bold;'><td><span style='color:green;'>Total Income (Round By 10 Rupess)</span></td><td></td><td></td><td><span style='color:green;'>$final_value</span></td></tr>";
//Get TAX Slab
$tax_slab_query = 'select tax_range_start,tax_range_end,tax_amount from `cw_income_tax_slab_income_tax_slab_details` inner join cw_income_tax_slab on cw_income_tax_slab.prime_income_tax_slab_id = cw_income_tax_slab_income_tax_slab_details.prime_income_tax_slab_id where min_age <= "30" and max_age >= "30" and cw_income_tax_slab_income_tax_slab_details.trans_status = 1';
$tax_slab_data = $this->db->query("CALL sp_a_run ('SELECT','$tax_slab_query')");
$tax_slab_result = $tax_slab_data->result();
$tax_slab_data->next_result();
$tax_slab_line = "";
$total_tax = 0;
$tax_value = 0;
foreach ($tax_slab_result as $tax => $tax_slab){
$tax_range_start = $tax_slab->tax_range_start;
$tax_range_end = $tax_slab->tax_range_end;
$tax_amount = $tax_slab->tax_amount;
//Check Value Inside the range
if((int)$tax_range_start === 0 && (int)$tax_amount === 0){
if($final_value > $tax_range_end){
$final_tax = $final_value - $tax_range_end;
$final_tax = number_format((float)$final_tax, 2, '.', '');
$tax_slab_line .= "<tr><td> Tax Calculation<br/> Exemption Rs. $tax_range_end and the Balance Amount</td><td> <br/>$final_tax</td><td></td><td></td></tr>";
}else{
$final_tax = 0;
}
}else{
if((int)$final_tax > 0 && $final_value >= $tax_range_start && $final_value >= $tax_range_end){
$tax_value = ($tax_range_start * $tax_amount)/100;
$final_tax = $final_tax - $tax_range_start;
$final_tax = number_format((float)$final_tax, 2, '.', '');
$tax_slab_line .= "<tr><td> For $tax_range_start : $tax_amount% Tax Amount</td><td>$tax_value</td><td></td><td></td></tr>";
}else
if((int)$final_tax > 0 && $final_value >= $tax_range_start && $final_value <= $tax_range_end){
$tax_value = ($final_tax * $tax_amount)/100;
$tax_value = number_format((float)$tax_value, 2, '.', '');
$tax_slab_line .= "<tr><td> For $final_tax : $tax_amount% Tax Amount</td><td>$tax_value</td><td></td><td></td></tr>";
$final_tax = 0;
}else{
$tax_value = 0;
}
}
$total_tax = $total_tax + $tax_value;
}
$total_tax = round($total_tax);
$total_tax = number_format((float)$total_tax, 2, '.', '');
$margin_relief = $this->margin_relief_amt($final_value,$total_tax);
$margin_relief_line = "";
$surcharge_pct_line = "";
if(!empty($margin_relief)){
$surcharge_pct = $margin_relief['surcharge_pct'];
$surcharge_charge = $margin_relief['surcharge_charge'];
$margin_relief_amt = $margin_relief['margin_relief'];
$surcharge_charge = number_format((float)$surcharge_charge, 2, '.', '');
$margin_relief_amt = number_format((float)$margin_relief_amt, 2, '.', '');
if((int)$surcharge_pct !== 0){
$surcharge_pct_line = "<tr><td> Surcharge Add ($surcharge_pct %)</td><td></td><td></td><td>$surcharge_charge</td></tr>";
if((int)$margin_relief_amt !==0){
$margin_relief_line = "<tr><td> Margin Relief Fund</td><td></td><td></td><td>$margin_relief_amt</td></tr>";
}
}
}
$tax_slab_line .= "<tr style='font-weight: bold;'><td>Tax on Total Income </td><td></td><td></td><td>$total_tax</td></tr>";
//Less:87A of the Income Tax Act, 1961 rebate Tax refund calculation
$refund_line = "";
$refund_sts = 0;
if((int)$final_value <= 500000){
$refund_line = "<tr><td> Less:87A of the Income Tax Act, 1961 rebate</td><td></td><td></td><td>$total_tax</td></tr>";
$refund_sts = 1;
}
//education Cess Calculation
if((int)$refund_sts === 1){
$cess_value = 0;
$total_tax = 0;
}else{
if((int)$surcharge_charge !== 0){
$total_tax = $total_tax + $surcharge_charge;
$cess_value = round(($total_tax * $edu_cess)/100);
}else{
$cess_value = round(($total_tax * $edu_cess)/100);
}
}
$cess_value = number_format((float)$cess_value, 2, '.', '');
$edu_cess_line .= "<tr><td> Education Cess $edu_cess % of $total_tax </td><td></td><td></td><td>$cess_value</td></tr>";
//Tax Payable including Education Cess minus of Relief under section 89
$relif_cess_tax = round($total_tax + $cess_value - $relief_amt);
$relif_cess_tax = number_format((float)$relif_cess_tax, 2, '.', '');
$tax_cess_line .= "<tr style='font-weight: bold;'><td>Tax Payable including Education Cess minus of Relief under section 89</td><td></td><td></td><td>$relif_cess_tax</td></tr>";
$permonth_values = round($relif_cess_tax/12);
$permonth_values = number_format((float)$permonth_values, 2, '.', '');
$per_month_line = "<tr style='font-weight: bold;'><td>Tax amount of per month value is</td><td></td><td></td><td>$permonth_values</td></tr>";
$table_data = "<button style='float:right;' class='btn btn-success btn-xs' onclick='print()'>Print</button><div style='width:100%;'>
<div id = 'print_data'>
<table class='table table-bordered' border='1px'>
<tbody>
<tr>
<td colspan='4'>
<h3 style='color:#d3434d;margin:10px;font-size:21px;font-weight:bold;text-align: center;'>TDS WORK SHEET</h3>
</td>
</tr>
$tr_line
$add_other_income_line
$tr_tot_line
$sec10_line
$tot_sec10_line
$sub_section_line
$less_other_income_line
$other_less_section_line
$final_line
$tax_slab_line
$edu_cess_line
$relief_line
$tax_cess_line
$per_month_line
</tbody>
</table>
</div>
</div>";
echo $table_data;
}
//calculating margin relief for above 50laks and 1Cro but margin relief no negative values
public function margin_relief_amt($earn_value,$total_tax){
$margin_relief_qry = 'select * from cw_surcharge_slab where income_start_amount <="'.$earn_value.'" and income_end_amount >="'.$earn_value.'"';
$margin_relief_data = $this->db->query("CALL sp_a_run ('SELECT','$margin_relief_qry')");
$margin_relief_result = $margin_relief_data->result();
$margin_relief_data->next_result();
$margin_relief_arr = array();
if($margin_relief_result){
$surcharge_pct = $margin_relief_result[0]->surcharge_percentage;
if((int)$surcharge_pct !== 0){
$slab_start_amt = $margin_relief_result[0]->income_start_amount;
$slab_start_amt_pct = $slab_start_amt - 1;
$inc_surcharge_tax = round($total_tax * ($surcharge_pct/100));
$income_excess_amt = $earn_value - $slab_start_amt_pct;
//income excess amount default tax calculation is 30 percentage
$income_excess_amt_tax = $income_excess_amt * (30/100);
$income_tax_surch_amt = $inc_surcharge_tax + $income_excess_amt_tax;
$margin_relief = round($income_tax_surch_amt - $income_excess_amt);
if($margin_relief < 0){
$margin_relief = 0;
}
}else{
$margin_relief = 0;
$inc_surcharge_tax = 0;
}
$margin_relief_arr = array('surcharge_pct'=>$surcharge_pct,'surcharge_charge'=>$inc_surcharge_tax,'margin_relief'=>$margin_relief);
}
return $margin_relief_arr;
}
//Last data is showed to displayed to employees
public function get_last_data(){
$emp_id = $this->input->post('emp_id');
$ins_data_qry = 'select * from cw_tax_ind_cal where emp_id ="'.$emp_id.'" order by prime_tax_ind_cal_id desc limit 1';
$ins_data = $this->db->query("CALL sp_a_run ('SELECT','$ins_data_qry')");
$ins_data_result = $ins_data->result();
$ins_data->next_result();
echo json_encode(array('ins_last_data' =>$ins_data_result[0]));
}
}
?>