<?php 
include 'connection.php';
session_start();
if (!isset($_SESSION['is_logged_in'])) {
    header("Location:login.php");
    die();
    }
	
$queryls2 = "select * from delivery_challan where delivery_challan_id ='".$_REQUEST['delivery_challan_id']."' ";
$resultls2 = mysqli_query($conn,$queryls2);	
while($row=mysqli_fetch_array($resultls2))
{
$delivery_challan_no=$row['delivery_challan_no'];
$delivery_challan_date=$row['delivery_challan_date'];	

}
	
	
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Untitled Document</title>
<style type="text/css">
<!--
body {
	margin-left: 0px;
	margin-top: 0px;
	margin-right: 0px;
	margin-bottom: 0px;
}
-->
</style></head>

<body>

 <form action="<?php echo $_SERVER['PHP_SELF']; ?>" method="post" class="style10" >
        <input type="hidden" name="delivery_challan_id" value="<? echo $_REQUEST['delivery_challan_id'] ?>" >
		<input type="hidden" name="customer_id" value="<? echo $_REQUEST['customer_id'] ?>" >
				
        <div class="login-fields" id="non-printable" style="padding-left:5px;">
         <div class="field">
        			 <select name="space_01" id="space_01" class="login username-field input-small" required >
			<option>Select</option>
			<option value="<?php echo $_REQUEST['space_01']?>" selected="selected"><?php echo $_REQUEST['space_01']?></option>
			<option value="">Null</option>
			<option value="1">1</option>
			<option value="2">2</option>
    		<option value="3">3</option>
			<option value="4">4</option>
			<option value="5">5</option>
			</select>
			
			<input type="submit" value="Submit"></div></div></form>
<table width="100%" border="1" style="border-collapse:collapse">
<tr>
<td colspan="3"><div align="center"  style="padding:3px; font-family:Arial, Helvetica, sans-serif; font-size:16px;"><strong>DELIVERY CHALLAN CUM ANNEXTURE</strong></div></td>
</tr>
<tr>
<td colspan="3"><div align="center"  style="padding:3px; font-family:Arial, Helvetica, sans-serif; font-size:24px;"><strong>DINESH INDUSTRIES </strong></div></td>
</tr>
<tr>
<td colspan="3"><div align="center"  style="padding:3px; font-family:Arial, Helvetica, sans-serif; font-size:13px;"><strong>PLOT NO-W-251(a), TTC INDL. AREA, MIDC RABALE, THANE BELAPUR ROAD, NAVI MUMBAI-708</strong></div></td>
</tr>
<tr>
<td colspan="3"><div align="center"  style="padding:3px; font-family:Arial, Helvetica, sans-serif; font-size:13px;"><strong>GST/UIN:27AGGPP3822R1ZR</strong></div></td>
</tr>
<tr>
<td width="57%" rowspan="3" valign="top"><div align="left" style="padding:3px; font-family:Arial, Helvetica, sans-serif; font-size:13px;">TO,<br />BOMBAY METAL & STEEL TRADERS<br />A-81, T.T.C. INDUSTRIAL AREA, KHAIRNE. NEW BOMBAY<br />GST/UIN:27AAIPG3476A1ZZ</div></td>
<td width="17%"><div align="left" style="padding:3px; font-family:Arial, Helvetica, sans-serif; font-size:13px;">DC NO. : </div></td>
<td width="26%"><div align="left" style="padding:3px; font-family:Arial, Helvetica, sans-serif; font-size:13px;"><?php echo $delivery_challan_no?></div></td>
</tr>
<tr>
<td><div align="left" style="padding:3px; font-family:Arial, Helvetica, sans-serif; font-size:13px;">DC DATE : </div></td>
<td><div align="left" style="padding:3px; font-family:Arial, Helvetica, sans-serif; font-size:13px;"> <?php echo date("d-m-Y",strtotime($delivery_challan_date));?></div></td>
</tr>
<tr>
<td><div align="left" style="padding:3px; font-family:Arial, Helvetica, sans-serif; font-size:13px;">DELIVERY DATE : </div></td>
<td><div align="left" style="padding:3px; font-family:Arial, Helvetica, sans-serif; font-size:13px;"><?php echo date("d-m-Y",strtotime($delivery_challan_date));?></div></td>
</tr>

<tr>
<td colspan="3"><div align="left" style="padding:3px; font-family:Arial, Helvetica, sans-serif; font-size:13px;"><strong>PROCESS :-</strong></div></td>
</tr>
<tr>
<td colspan="3"><table width="100%" border="1" style="border-collapse:collapse">
<tr>
<td><div align="center"  style="padding:3px; font-family:Arial, Helvetica, sans-serif; font-size:13px;"><strong>SR</strong></div></td>
<td><div align="center"  style="padding:3px; font-family:Arial, Helvetica, sans-serif; font-size:13px;"><strong>COMPONANT</strong></div></td>
<td><div align="center"  style="padding:3px; font-family:Arial, Helvetica, sans-serif; font-size:13px;"><strong>DESCRIPTION</strong></div></td>
<td><div align="center"  style="padding:3px; font-family:Arial, Helvetica, sans-serif; font-size:13px;"><strong>P.O. SR NO.</strong></div></td>
<td><div align="left"    style="padding:3px; font-family:Arial, Helvetica, sans-serif; font-size:13px;"><strong>MATERIAL CODE</strong></div></td>
<td><div align="center"  style="padding:3px; font-family:Arial, Helvetica, sans-serif; font-size:13px;"><strong>USE KGS</strong></div></td>
<td><div align="center"  style="padding:3px; font-family:Arial, Helvetica, sans-serif; font-size:13px;"><strong>QTY</strong></div></td>
<td><div align="center"  style="padding:3px; font-family:Arial, Helvetica, sans-serif; font-size:13px;"><strong>UNIT</strong></div></td>
</tr>
<?php $i=1;
$query2="select * from delivery_challan_more_product_02 where delivery_challan_id = '".$_REQUEST['delivery_challan_id']."' AND customer_id = '".$_REQUEST['customer_id']."' AND deleted !='YES' ORDER BY  delivery_challan_more_product_id ASC";
$result=mysqli_query($conn,$query2);
while($row=mysqli_fetch_array($result))

		{  
$product_id = $row['product_id'];
$componant = $row['componant'];
$description = $row['description'];

$delivery_challan_more_product_id  = $row['delivery_challan_more_product_id'];
if($description==''){


$bar_size = $row['bar_size'];
$material_name = $row['material_name'];
$description=$material_name."BAR".$bar_size;
}
$row_id=$row['row_id'];
$cust_po_more_product_id = $row['cust_po_more_product_id'];
$cust_more_row_id=$row['cust_more_row_id'];
$material_code = $row['material_code'];
$use_kg = $row['use_kg'];
$qty = $row['qty'];
$unit = $row['unit'];

$totalusekg+= $use_kg;
$totalqty+=$qty;

$finish_shaft_wt_kg=$row['finish_shaft_wt_kg'];

  $po_number='';
  $challan_no='';
$qry97 = "select * from customer_po_more_product_02 where product_id='$product_id' and cust_po_more_product_id='$cust_po_more_product_id'";
$re97 = mysqli_query($conn,$qry97);
while($row=mysqli_fetch_array($re97))
{
$po_number = $row['po_number'];
$po_date = $row['po_date'];

}

?>
<tr>
<td><div align="center"  style="padding:3px; font-family:Arial, Helvetica, sans-serif; font-size:13px;"><?php echo $i?></div></td>
<td valign="top"><div align="center"  style="padding:3px; font-family:Arial, Helvetica, sans-serif; font-size:13px;"><?php echo $componant?></div></td>
<td valign="top"><div align="left"  style="padding:3px; font-family:Arial, Helvetica, sans-serif; font-size:13px;"><?php echo $material_code?></div></td>
<td valign="top"><div align="center"  style="padding:3px; font-family:Arial, Helvetica, sans-serif; font-size:13px;"><?php echo $po_number;?> Dt. <?php echo date("d-m-Y",strtotime($po_date));?><?php ?></div></td>
<td valign="top"><div align="left"    style="padding:3px; font-family:Arial, Helvetica, sans-serif; font-size:13px;"><?php echo $description?></div></td>
<td><div align="center"  style="padding:3px; font-family:Arial, Helvetica, sans-serif; font-size:13px;"><?php echo number_format($use_kg,3,'.','');?></div></td>
<td><div align="center"  style="padding:3px; font-family:Arial, Helvetica, sans-serif; font-size:13px;"><?php echo $qty?></div></td>
<td><div align="center"  style="padding:3px; font-family:Arial, Helvetica, sans-serif; font-size:13px;"><?php echo $unit?></div></td>
</tr><?php $i++;} ?>

<?php if($_REQUEST['space_01'] != '') {?>
<tr>
<td colspan="5"><?php if($_REQUEST['space_01'] == 1) {?><div align="left" style="height:100px;">&nbsp;</div><?php } ?>

<?php if($_REQUEST['space_01'] == 2) {?><div align="left" style="height:200px;">&nbsp;</div><?php } ?>
<?php if($_REQUEST['space_01'] == 3) {?><div align="left" style="height:300px;">&nbsp;</div><?php } ?>
<?php if($_REQUEST['space_01'] == 4) {?><div align="left" style="height:400px;">&nbsp;</div><?php } ?>
<?php if($_REQUEST['space_01'] == 5) {?><div align="left" style="height:500px;">&nbsp;</div><?php } ?>


</td>
<td>&nbsp;</td>
<td>&nbsp;</td>
<td>&nbsp;</td>
</tr>
<?php } ?>

<tr>
<td colspan="5"><div align="right" style="padding:3px; font-family:Arial, Helvetica, sans-serif; font-size:13px;"><strong>TOTAL</strong></div></td>
<td><div align="center" style="padding:3px; font-family:Arial, Helvetica, sans-serif; font-size:13px;"><?php echo number_format($totalusekg,3,'.','');?></div></td>
<td><div align="center" style="padding:3px; font-family:Arial, Helvetica, sans-serif; font-size:13px;"><?php echo $totalqty?></div></td>
<td><div align="center" style="padding:3px; font-family:Arial, Helvetica, sans-serif; font-size:13px;"><?php echo $unit?></div></td>
</tr>
</table></td>
</tr>
<tr>
<td valign="top"><div align="left" style="padding:3px; font-family:Arial, Helvetica, sans-serif; font-size:13px;">Vehicle No-MH-05-BH-8534</div></td>
<td colspan="2"><div align="right" style="padding:3px; font-family:Arial, Helvetica, sans-serif; font-size:13px;">Receiver's signature<br /><br /><br />FOR :DINESH INDUSTRIES</div></td>
</tr>
</table>



</body>
</html>
