<?php 
include "config.php";
include "financial_year_calculation.php";
include "current_date_time.php";
session_start();
$user=$_SESSION['log'];
$ticket = $_POST['ticket'];
$vehicleno = $_POST['vehicle'];
$customer = $_POST['customer'];
$tripno = $_POST['trip'];
$delivery = $_POST['delivery'];
$mattype = $_POST['matentrytype'];
$product = $_POST['product'];
$salestype = $_POST['salestype'];
$emptyweight = $_POST['emptyweight'];
$loadweight = $_POST['loadweight'];
$netweight = $_POST['netweight'];
$quantity = $_POST['quantity'];
$quantityori = $_POST['quantityori'];
$remark= $_POST['remark'];
$adjustment =$_POST['adjustment'];
$date = $_POST['datesinen'];
$time = $_POST['timesinen'];
$accountyear    = $financialYearStart."-".$financialYearEnd;
echo $vehicleno;

              error_reporting(0);
              $code = mysqli_query($connect,"select count(id) as count from ticket where status !='deleted' ");
              while($row=mysqli_fetch_array($code))
              {
                $codsin = mysqli_query($connect,"select count(id) as count from single_transaction where status !='deleted'");
              while($roww=mysqli_fetch_array($codsin))
              {
                $code = $row['count'];
                $codsin = $roww['count'];
                  $codee = $code + $codsin;
                  $year_code=substr($financialYearEnd,2);
                  $codeco = $year_code."-". ($codee+1);
              }}
             
//foreach ($productcode as $id => $value ){
$sql = "insert into single_transaction (ticket,vehicleno,customer,trip,delivery,entrydate,entrytime,matentrytype,product,salestype,emptyweight,loadweight,netweight,quantity,quantityori,adjustment,remark,editby,edittime,editdate,status,financialyear) values('T$codeco','$vehicleno','$customer','$tripno','$delivery','$date','$time','$mattype','$product','$salestype','$emptyweight','$loadweight','$netweight','$quantity','$quantityori','$adjustment','$remark','$user',CURTIME(),CURDATE(),'','$accountyear')";
echo $sql;
 $go = mysqli_query($connect,$sql);

 header('Location:singleentry.php');
// }
?>