<?php
 	session_start(); 

	if(!isset($_SESSION['tulsilogin']))
	{
		header('Location: index.php');
		return;
	}


date_default_timezone_set("Asia/Kolkata");
$mdate1= date('Y-m-d H:i:s');
$mdate= date('d-m-Y');
$_SESSION['_token']=bin2hex(openssl_random_pseudo_bytes(16));
	
	$umid = $_SESSION['umid'];
	include("connect.php");
include("mylibrary.php");
	
	//$cmname=$_POST['cmname'];
	
	
	
	
	$acsdid=$_POST['acsdid'];
	$umid1=$_POST['umid'];
	
	$acincentivetype=checkvalidstring ($_POST['acincentivetype']);
	
	
	$actargettype=checkvalidstring ($_POST['actargettype']);
	
	
	
	$actargetvalue=checkvalidstring ($_POST['actargetvalue']);
	
	
	$commissionstrucher=checkvalidstring ($_POST['commissionstrucher']);
	
	
	$cmcurrency=checkvalidstring ($_POST['cmcurrency']);
	
	
	
	$cmgstincexc=checkvalidstring ($_POST['cmgstincexc']);
	
	$acmremark=checkvalidstring ($_POST['acmremark']);
	
	
	
	$ctaxpercent=checkvalidstring ($_POST['ctaxpercent']);
	
	
	$commissionstruchervalue=checkvalidstring ($_POST['commissionstruchervalue']);
	
	$ctaxname=checkvalidstring ($_POST['ctaxname']);
	
	
	
	$acstartdate = date("Y-m-d",strtotime($_POST['acstartdate']));
	$acenddate = date("Y-m-d",strtotime($_POST['acenddate']));
		
			
			 $eve1 = "Update res_agentcomission_master set commissionstrucher='$commissionstrucher',commissionstruchervalue='$commissionstruchervalue',ctaxname='$ctaxname',ctaxpercent='$ctaxpercent',cmgstincexc='$cmgstincexc',cmcurrency='$cmcurrency',acstartdate='$acstartdate',acenddate='$acenddate',acincentivetype='$acincentivetype',actargettype='$actargettype',actargetvalue='$actargetvalue',acmremark='$acmremark' where acsdid=$acsdid";
			
			if ($conn->query($eve1) === TRUE)
		{
			
			/*  if($commissionstrucher == 'Slab')
		  {
		  $delete_checkbox_array = $_POST['slabmid'];
		$n=0;
			foreach ($delete_checkbox_array as $one_by_one_sid) 
			{
				$slabmid=$one_by_one_sid;
					
				$svalue=$_POST['svalue'][$n];
				$n = $n + 1;
			
				
				if($slabmid==0)
				{
				}
				else
				{	
					$eve2="insert into res_agentcomissionslab_detail (acsdid,slabmid,svalue) values($last_id,'$slabmid','$svalue')";
					$re2 = mysqli_query($conn, $eve2);
				}	
				
			}
		  } */
			
			$_SESSION['msg'] = "Record has been Updated successfully";
		}else{
			$_SESSION['msg1'] = "Error";
		}
		
		
	
	
	
	
	
		 

	header("Location: userdetail.php?id=$umid1");
			
	
?>