<?php
include_once 'db_functions.php';     
$db = new DB_Functions();  

$emp_id = $_REQUEST['EmpId'];
$salary_month = $_REQUEST['SalaryMonth'];
$salary_year = $_REQUEST['SalaryYear'];

////// get folder location url
$url = $db->getAttachmentUrl();
$res_tada = $db->SalarySlipItems($emp_id, $salary_month, $salary_year);     
$a = array();     
$b = array(); 
 
 if ($res_tada != false){ 
   while($row = mysql_fetch_array($res_tada)) {
	   
	$b["sno"] = $row["sno"];
  	$b["update_date"] = $row["update_date"];
	$b["update_time"] = $row["update_time"];
	$b["update_by"] = $row["update_by"];
	$b["salary_month"] = $row["salary_month"];
	$b["salary_year"] = $row["salary_year"];
	$b["emp_id"] = $row["emp_id"];
	$b["bank_name"] = $row["bank_name"];
   $b["bank_ac_no"] = $row["bank_ac_no"];
	$b["basic_pay"] = $row["basic_pay"];
	$b["hra"] = $row["hra"];
	$b["spl_allow"] = $row["spl_allow"];
	$b["edu_med_allow"] = $row["edu_med_allow"];
	$b["conve_allown"] = $row["conve_allown"];
	$b["mobile_exp"] = $row["mobile_exp"];
	$b["local_trav_claim"] = $row["local_trav_claim"];
	$b["award"] = $row["award"];
	$b["diwali_bonus"] = $row["diwali_bonus"];
	$b["birth_bonus"] = $row["birth_bonus"];
	$b["performence_bonus"] = $row["performence_bonus"];
	$b["advance"] = $row["advance"];
	$b["out_station_travel_claim"] = $row["out_station_travel_claim"];
	$b["out_station_lodge"] = $row["out_station_lodge"];
	$b["privious_claim"] = $row["privious_claim"];
	$b["leave_rembers"] = $row["leave_rembers"];
	$b["incentive"] = $row["incentive"];
	$b["loan"] = $row["loan"];
	$b["med_rembers"] = $row["med_rembers"];
	$b["travel_allownse"] = $row["travel_allownse"];
	$b["dearness_allownse"] = $row["dearness_allownse"];
	$b["special_pay"] = $row["special_pay"];
	$b["maintain_allownse"] = $row["maintain_allownse"];
	$b["special_furn_allownse"] = $row["special_furn_allownse"];
	$b["family_allownse"] = $row["family_allownse"];
	$b["medi_exp_payble"] = $row["medi_exp_payble"];
	$b["intrest_medi_claim"] = $row["intrest_medi_claim"];
	$b["soft_loan_amt"] = $row["soft_loan_amt"];
	$b["gratuity"] = $row["gratuity"];
	$b["pf_12"] = $row["pf_12"];
	$b["insurance"] = $row["insurance"];
	$b["instalment_advan_taken"] = $row["instalment_advan_taken"];
	$b["instalment_against_staff"] = $row["instalment_against_staff"];
	$b["late_mark_dedection"] = $row["late_mark_dedection"];
	$b["mobile_dedection"] = $row["mobile_dedection"];
	$b["absent_dedection"] = $row["absent_dedection"];
	$b["veh_loan"] = $row["veh_loan"];
	$b["misc_dedection"] = $row["misc_dedection"];
	$b["staff_scheam"] = $row["staff_scheam"];
	$b["esi"] = $row["esi"];
	$b["esi_arears"] = $row["esi_arears"];
	$b["school_fee"] = $row["school_fee"];
	$b["fa_recovry"] = $row["fa_recovry"];
	$b["pf_on_leave_encas"] = $row["pf_on_leave_encas"];
	$b["penalty_any"] = $row["penalty_any"];
	$b["staff_loan"] = $row["staff_loan"];
	$b["loan_installm"] = $row["loan_installm"];
	$b["vpf"] = $row["vpf"];
	$b["fw_fund"] = $row["fw_fund"];
	$b["other"] = $row["other"];
	$b["gross_earning"] = $row["gross_earning"];	
	$b["gross_dedection"] = $row["gross_dedection"];
	$b["net_amount"] = $row["net_amount"];
	$b["el_this_month"] = $row["el_this_month"];
	$b["cl_this_month"] = $row["cl_this_month"];
	$b["el_taken"] = $row["el_taken"];
	$b["cl_taken"] = $row["cl_taken"];
	$b["late_marked"] = $row["late_marked"];
	$b["leave_balence"] = $row["leave_balence"];	
		
	if($row["file_name"]){
		$b["file_name"] = $url."salary_slip/".$row["file_name"];
	}else{
		$b["file_name"] = null;
	}
	
	array_push($a,$b);
   }	
	echo json_encode($a);
 }
?>