<?php include 'connection.php';
session_start();
if (!isset($_SESSION['is_logged_in'])) {
    header("Location:login.php");
    die();
    }
    date_default_timezone_set('Asia/Calcutta');
$today = date("d/m/Y");
$today1 = date("d/m");
$currentmonth = date(m);
    function randomPassword() {
    $alphabet = "0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ";
    $pass = array(); //remember to declare $pass as an array
    $alphaLength = strlen($alphabet) - 1; //put the length -1 in cache
    for ($i = 0; $i < 5; $i++) {
        $n = rand(0, $alphaLength);
        $pass[] = $alphabet[$n];
    }
    return implode($pass); //turn the array into a string
}
$unique_id = randomPassword();

?>


<?php
$customer_id = $_POST['customer_id'];
$inv_type = $_POST['inv_type'];
$trans_inv_date = $_POST['trans_inv_date'];
$transport_name = $_POST['transport_name'];

$query2tm = "select * from transport_master where transport_id = '$transport_name'";
$result2tm = mysql_query($query2tm,$conn);  
while($row = mysql_fetch_array($result2tm))
{
$short_form = $row['short_form'];
}


?>




<?php


$challan_id = $_POST['challan_id'];

$consignor = $_POST['consignor'];
$consignee = $_POST['consignee'];
$consignee_gst_no = $_POST['consignee_gst_no'];
$from_consignor = $_POST['from_consignor'];
$to_consignor = $_POST['to_consignor'];
$vehicle_no = $_POST['vehicle_no'];
$articles_no = $_POST['articles_no'];
$weight = $_POST['weight'];
$freight = $_POST['freight'];
$transportations_service = $_POST['transportations_service'];
$description = $_POST['description'];
$loaded_export_import = $_POST['loaded_export_import'];
$container_no = $_POST['container_no'];
$seal_no = $_POST['seal_no'];

$destinations = $_POST['destinations'];
$shipping_agent = $_POST['shipping_agent'];
$booking_no = $_POST['booking_no'];

$in_time = $_POST['in_time'];
$out_time = $_POST['out_time'];
$receiver_signature_with_seal = $_POST['receiver_signature_with_seal'];

$delivery_at = $_POST['delivery_at'];
$date = $today;


$query14 = "insert into challan_master (consignor,consignee,consignee_gst_no,articles_no,weight,freight,transportations_service,description,loaded_export_import,container_no,seal_no,destinations,shipping_agent,booking_no,in_time,out_time,receiver_signature_with_seal,delivery_at,vehicle_no,from_consignor,to_consignor,date) values ('$consignor','$consignee','$consignee_gst_no','$articles_no','$weight','$freight','$transportations_service','$description','$loaded_export_import','$container_no','$seal_no','$destinations','$shipping_agent','$booking_no','$in_time','$out_time','$receiver_signature_with_seal','$delivery_at','$vehicle_no','$from_consignor','$to_consignor','$date')";
$r14=mysql_query($query14,$conn);
// echo $query14;
// exit();
?> 

<script>
javascript:window.location.href="direct_challan.php?customer_id=<?php echo $customer_id?>&&consignee=<?php echo $consignee?>&&inv_type=<?php echo $inv_type?>";
</script>