<?php
include("../include/db.php");

/********************************** CHECK ITEM FOR STORE CREATION***************************************/

function check_vehicle_no($vehicle_no)
  {   
       $sql_select = "select * from vehicle_entry where vehicle_no='$vehicle_no'";
       $rs=mysql_query($sql_select);
       $rs_count=mysql_num_rows($rs);
       return $rs_count; 
}

function get_vehicle_no_edit($vehicle_no)
{
  $sql_select = "select * from vehicle_entry where vehicle_no='$vehicle_no'";
  $rs=mysql_query($sql_select);
  $rscount1=mysql_num_rows($rs);
    if($rscount1!=0)
    {
      while($rsdata=mysql_fetch_object($rs))
     {
      $id=$rsdata->id;
     } 
	return $id;
    }
   }
 /********************************** ADD  QUERY ***************************************/
if(($_POST['action']=="ADD")) 
{
$customer_status=$_POST['customer_status'];
$status_type=$_POST['status_type'];
$create_date=date('Y-m-d');
$acadamic_yr=explode("-",$create_date);
$acdmc_yr_res=$acadamic_yr[0];
$Insql=mysql_query("insert into customer_status_creation(customer_status,status_type,cr_date)values('$customer_status','$status_type','$create_date')");
echo "Added Successfully!!";
}

/********************************** UPDATE QUERY ***************************************/
if(($_POST['action']=="EDIT"))
{
$edit_id = $_POST['edit_id']; 
$customer_status=$_POST['customer_status'];
$status_type=$_POST['status_type'];
$create_date=date('Y-m-d');
$acadamic_yr=explode("-",$create_date);
$acdmc_yr_res=$acadamic_yr[0];
$Insql=mysql_query("update customer_status_creation set customer_status='$customer_status',status_type='$status_type',cr_date='$create_date' where  id='$_POST[edit_id]'");
echo "Updated Successfully!!";

 
}

/********************************************DELETE*****************************************************************/
// if ($_POST['action'] == "delete") { 		  
//     $id = intval($_POST['id']);   // sanitize input

//     $delete2 = "DELETE FROM designer_creation WHERE id = '$id'";
//     mysql_query($delete2);

//     echo "<script>alert('Deleted Successfully')</script>";
//     include("designer_entry_list.php");
// }

?>