ok
Direktori : /proc/thread-self/root/home2/selectio/www/obnovit-tracking/api/ |
Current File : //proc/thread-self/root/home2/selectio/www/obnovit-tracking/api/payslip-generation-api.php |
<?php session_start(); include"../config/config.php"; //if(isset($_POST['employe_id']) && $_POST['type']=='Payslip_generation'){ try{ $query="INSERT INTO `tbl_payslip_generation`(`employee_id`, `basic_salary`, `pf_type`, `month`, `year`, `working_days`, `special_holidays`, `holidays`, `permission_leaves`, `salary_processing_days`, `net_salary`, `earnings_total`, `reduction_total`, `total_ctc`, `net_pay_employee`, `earnings_details`, `reduction_details`) VALUES"; $query_array=array(); $querys=''; for($i=0;$i<count($_POST['employee_id']);$i++){ $earning_details=array();$reduction_details=array(); $employee_id=$_POST['employee_id'][$i]; $nam='create_earnings_name_'.$employee_id; $count=count($_POST[$nam]); for($v=0;$v<count($_POST[$nam]);$v++){ $earning_details[]=array($_POST['create_earnings_name_'.$employee_id][$v], $_POST['create_earnings_percentage_'.$employee_id][$v],$_POST['create_earnings_percentage_type_'.$employee_id][$v],$_POST['create_earnings_subtotal_'.$employee_id][$v]); } $nam='create_reduction_name_'.$employee_id; $count=count($_POST[$nam]); for($s=0;$s<$count;$s++){ $reduction_details[]=array($_POST['create_reduction_name_'.$employee_id][$s], $_POST['create_reduction_percentage_'.$employee_id][$s],$_POST['create_reduction_percentage_type_'.$employee_id][$s],$_POST['create_reduction_subtotal_'.$employee_id][$s]); } $query_array[]="('".$_POST['employee_id'][$i]."','".$_POST['basic_salary'][$i]."','".$_POST['pf_type'][$i]."','".$_POST['month'][$i]."','".$_POST['year'][$i]."','".$_POST['working_days'][$i]."','".$_POST['special_holidays'][$i]."','".$_POST['holiday'][$i]."','".$_POST['permission_leave'][$i]."','".$_POST['salary_processing_day'][$i]."','".$_POST['net_salary'][$i]."','".$_POST['create_earning_total'][$i]."','".$_POST['create_reduction_total'][$i]."','".$_POST['total_ctc'][$i]."','".$_POST['net_pay_to_employee'][$i]."','".json_encode($earning_details)."','".json_encode($reduction_details)."')"; //insert Details } $querys=implode(',', $query_array); $query.=$querys; $statement = $pdo->prepare($query); $result=$statement->execute(); // $result=1; if($result){ error_log('uery :'.$query); $return_arr['message'] = 'Pay Slip added successfully!'; $return_arr['status']=200; }else{ $return_arr['message']="Something went wrong try again..."; $return_arr['status']=400; } }catch(Exception $e){ $return_arr['message']='0987'.$e; $return_arr['status']=500; } echo json_encode($return_arr); // } ?>