<?php 
include "config.php";
session_start();
$user=$_SESSION['log'];
$ticket = $_POST['ticket'];
$vehicleno = $_POST['vehicleno'];
$chakka = $_POST['chakka'];
$limit = $_POST['limitvalue'];
$customer = $_POST['customer'];
$product = $_POST['product'];
$load_type = $_POST['weight'];
$emptyweight = $_POST['emptyweight'];
$vehicle_capacity = $_POST['vehiclecapacity'];
$remark = $_POST['remark'];
$date = $_POST['datetkt'];
$time = $_POST['timetkt'];
$delivery = $_POST['delivery'];
$block_date=$_POST['blockdate'];
$ori_capacity=$_POST['oricapacity'];
$trip_no=$_POST['tripno'];
$process=$_POST['process'];
$financial_year=$_POST['financialyear'];
echo $vehicleno;
$modetrans=$_POST['modetrans'];
$upi_number=$_POST['upi_number'];
             
              
              $update = mysqli_query($connect,"update ticket set status='deleted',editdate=CURRENT_DATE(),edittime=CURRENT_TIME() where ticket='$ticket'");
              $code_validate = mysqli_query($connect,"select count(ticket) as code from ticket where ticket='$ticket' && status!='deleted'");
              $code_count=mysqli_fetch_assoc($code_validate);
              $code_val = $code_count['code'];
              if($code_val==0)
              {
              
//foreach ($productcode as $id => $value ){
$sql = "INSERT INTO ticket(ticket, vehicleno, customer, limitvalue, product, loadtype,emptyweight,cft,ori_cft,tripno,chakka,remarks, date, time, delivery,modetrans,upi_number,blockdate,editby, editdate, edittime, status, financialyear, process,syncdata) VALUES ('$ticket','$vehicleno','$customer','$limit','$product','$load_type','$emptyweight','$vehicle_capacity','$ori_capacity','$trip_no','$chakka','$remark','$date','$time','$delivery','$modetrans','$upi_number','$block_date','$user','','','','$financial_year','$process','0')";
echo $sql;
 $go = mysqli_query($connect,$sql);
 }
 header('Location:ticket.php');

?>
