<? 
 if($_SESSION['page'] == '1' and $_SESSION['section'] == '4') 
 	{ 
		if ($_GET['stat'] == 'adddb' )
		   {
						$date_now   		  = date("Y").'-'.date("m").'-'.date("d"); 
						$uid				  = $_SESSION['Login_user_id'];
						$note 	   			  = $_POST['note'];
						$bucket_no  	   	  = $_POST['bucket_no'];
						$prodect			  = $_POST['prodect'];
						$Created_Date		  = $date_now ;
						$cli_id				  = $_SESSION['1_2_cli_id'];
				mysql_query("INSERT INTO ".$dcm_table_start."bucket ( uid ,cli_id, note, bucket_no,prodect,created_date) VALUES ($uid,$cli_id,'$note','$bucket_no','$prodect','$Created_Date')");
				header("Location: index.php"); 
			}
		if ($_GET['stat'] == 'editdb' )
		   {
						$note 	   			  = $_POST['note'];
						$bucket_no  	   	  = $_POST['bucket_no'];
						$prodect			  = $_POST['prodect'];
						$bid 	   			  = $_POST['bid'];						
					 mysql_query("UPDATE ".$dcm_table_start."bucket SET note = '$note' , bucket_no = '$bucket_no', prodect = '$prodect' where bid = '$bid'");
				header("Location: index.php"); 
			}
		if ($_GET['stat'] == 'delete_case' )
		   {
				$case_id = $_GET['case_id'];
				$delete_uid = $_SESSION['Login_user_id'];
				mysql_query("UPDATE ".$dcm_table_start."case SET delete_case = 1 , delete_uid = $delete_uid  where case_id = $case_id");
				header("Location: index.php?stat=mc"); 
			}
		if ($_GET['stat'] == 'closedb' )
		   {
											
					 mysql_query("UPDATE ".$dcm_table_start."bucket SET stop_bucket = 1 where bid = '$bid'");
				header("Location: index.php");
			}
		if ($_GET['stat'] == 'adddb_case' ) 
			{
						$date_now   		  = date("Y").'-'.date("m").'-'.date("d"); 
						$Created_Date		  = $date_now ;
						
						$cus_id				  = $_SESSION['1_4_cus_id'];
						$bid				  = $_SESSION['1_4_bid'];
						$cli_id				  = $_SESSION['1_2_cli_id'];
						$account_no			  = $_POST['account_no'];
						$principle_amt		  = $_POST['principle_amt'];
						$manage_uid			  = $_POST['manage_uid'];
						$add_uid			  = $_SESSION['Login_user_id'];
			
						
				
				
				
				mysql_query("INSERT INTO ".$dcm_table_start."case ( cus_id ,bid,cli_id, account_no, principle_amt,manage_uid,add_uid) VALUES ($cus_id,$bid,$cli_id,'$account_no',$principle_amt,$manage_uid,$add_uid)");
				header("Location: index.php?stat=mc");
			}	
		if ($_GET['stat'] == 'addnewcusdb' ) 
			{
						$date_now   		  = date("Y").'-'.date("m").'-'.date("d"); 
						$uid				  = $_SESSION['Login_user_id'];
						$CPR 	   			  = $_POST['CPR'];
						$CR  	   			  = $_POST['CR'];
						$cus_name   		  = $_POST['cus_name'];
						$cus_mobile  		  = $_POST['cus_mobile'];
						$cus_address 		  = $_POST['cus_address'];
						$cus_fax			  = $_POST['cus_fax'];
						$Created_Date		  = $date_now ;
												
				$query = mysql_query("SELECT * FROM ".$dcm_table_start."customer where CPR = '".$CPR."' and CR = '".$CR."'"); 	
							if (mysql_num_rows($query) <> 0 and ( $CPR  <> "" or $CR <> "" ) )
								{
									header("Location: index.php?stat=Error101"); 
								}else{
									mysql_query("INSERT INTO ".$dcm_table_start."customer ( uid , CPR, CR, cus_name, cus_mobile, cus_address, cus_fax ,created_date) VALUES ($uid,'$CPR','$CR','$cus_name','$cus_mobile','$cus_address','$cus_fax','$Created_Date')");
									header("Location: index.php?stat=addcase"); 
								}	
				
			}
	
	
	
	
	}
?>