<?php
include 'connection.php';
session_start();
if (!isset($_SESSION['is_logged_in'])) {
    header("Location:login.php");
    die();
    }
?>
<?php 
$query3 = "select * from customer_invoice_details where customer_id='".$_REQUEST['customer_id']."'";
$result3 = mysql_query($query3,$conn);	
while($row=mysql_fetch_array($result3))
{
$customer_name = $row['customer_name'];
}
?>  
<?php
$customer_id = $_REQUEST['customer_id'];
$serial_no = $_POST['serial_no'];
$update_date = $_POST['update_date'];

$query = "update dispatched_product_details set serial_no='$serial_no',update_date='$update_date',serial_no_updated='Done' where dispatched_id='".$_REQUEST['dispatched_id']."' AND customer_id='".$_REQUEST['customer_id']."'";
//echo $query;
$r=mysql_query($query,$conn);

$queryacc = mysql_query("select * from  dispatched_product_details where serial_no ='' and customer_id = '".$_REQUEST['customer_id']."' and serial_no_updated!='Forward'");
$num_rowacc = mysql_num_rows($queryacc);
if($num_rowacc == 0) {
$query3 = "update customer_invoice_details set serial_no_updated='Done' where inv_id='".$_REQUEST['inv_id']."' AND customer_id='".$_REQUEST['customer_id']."'";
//echo $query;
$r3=mysql_query($query3,$conn);

}
//echo $queryacc;
//echo $query;
//exit();
?>
<script>
javascript:window.location.href="index.php";
</script>