<?php include 'header.php';?>
<style>
/* Chrome, Safari, Edge, Opera */
input::-webkit-outer-spin-button,
input::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

/* Firefox */
input[type=number] {
  -moz-appearance: textfield;
}

 
</style>
<?php 
$delivery_challan_id=$_REQUEST['delivery_challan_id'];
$customer_id=$_REQUEST['customer_id'];

$qry3z = "select * from delivery_challan where  delivery_challan_id='$delivery_challan_id' and customer_id='$customer_id'";
$re3z= mysqli_query($conn,$qry3z);
while($row=mysqli_fetch_array($re3z))
		{  
		$delivery_challan_id = $row['delivery_challan_id'];
		
		
$delivery_challan_no=$row['delivery_challan_no'];
$delivery_challan_date=$row['delivery_challan_date'];
$vehicle_no=$row['vehicle_no'];
$e_way_bill_no=$row['e_way_bill_no'];
$lr_no=$row['lr_no'];

		}




date_default_timezone_set('Asia/Calcutta');
$today = date("d/m/y");
$today1 = date("d-m-Y");
$today2 = date("Y-m-d");
$received_time = date("Y-m-d H:i:s");

$currentyear = date("Y");
$currentmonth = date("m");

if($currentmonth>03) { 
$cuyear = date("Y");
$cuyear1 = date("y")+1;
} 
else { 
$cuyear = date("Y")-1;
$cuyear1 =  date("y");
} 
$f_year = "$cuyear"."-"."$cuyear1";


?>

  <div class="content-page">
    <div class="content">
      <div class="container">
        <div class="row">
          <div class="col-sm-12">
            <div class="page-header-title">
             
              <div class="clearfix"></div>
            </div>
          </div>
        </div>
         <form name="chkForm" id="chkForm" action="update_delivery_challan.php"  method="post">
		 <input type="hidden" name="customer_id" value="<?php echo $_REQUEST['customer_id']?>" />
		 
		 
		 		 <input type="hidden" name="delivery_challan_id" value="<?php echo $_REQUEST['delivery_challan_id']?>" />


		<main>
		<div class="row">
                        <div class="col-sm-12">
                            <div class="panel panel-primary">
                                <div class="panel-heading">
                                    <h3 class="panel-title"> Customers Challan <br /><span style="color:#FF0000"><strong><?php echo $_REQUEST['massage']?></strong></span></h3></div>
									
									
									
									
                                <div class="panel-body">
                                    <div class="row">
                                      
									  
													
												
													
                                                    <div class="col-sm-3 col-xs-12"><div class="form-group">
                                                        <label>Customer Name </label>
   <select name="customer_name" class="form-control">
<option value="" selected>Select Customer</option>
<?php 
$qry97 = "select * from mst_customer where customer_id='".$_REQUEST['customer_id']."'";
$re97 = mysqli_query($conn,$qry97);
while($row=mysqli_fetch_array($re97))
{
$customer_name = $row['customer_name'];
?>
<option value="<?php echo $customer_name?>" selected="selected"><?php echo $customer_name?></option>
<?php }?>
</select>	
                                                    </div>
													</div>
													
										              
                                                    <div class="col-sm-3 col-xs-12"><div class="form-group">
                                                        <label>Delivery Challan No</label>
														
														<input type="text" name="delivery_challan_no" value="<?php echo $delivery_challan_no;?>" class="form-control" readonly="readonly" />
</div></div>    

                                                    <div class="col-sm-3 col-xs-12"><div class="form-group">
                                                        <label>Date</label>
														
														<input type="date" name="delivery_challan_date" value="<?php echo $delivery_challan_date; ?>" class="form-control" />
</div></div>                                                              


<div class="clearfix"></div>
<div class="col-sm-6 col-xs-12">
<div class="m-t-20">
<div class="form-group">
<label><b> Product </b></label>
   <select name="product_id" class="form-control select2">
<option value="" selected>Select Product</option>
<?php 
$qry97 = "select * from finish_product_master";
$re97 = mysqli_query($conn,$qry97);
while($row=mysqli_fetch_array($re97))
{
$product_id = $row['product_id'];
$item_code = $row['item_code'];
$description = $row['description'];
$bar_size = $row['bar_size'];
$material_name = $row['material_name'];

?>
<option value="<?php echo $product_id?>" ><?php echo $item_code?>&nbsp; <?php echo $description; ?>, <?php echo $material_name;?> Bar: <?php echo $bar_size?> </option>
<?php }?>
</select>	
 
</div></div></div><div class="col-sm-6 col-xs-12">
<div class="m-t-20">
<div class="form-group"><br /><input type="submit" name="PRO_ADD" value="ADD" class="btn btn-sm btn-primary add-more"   id="prod_check"/>

</div></div></div>      <table class="table table-striped table-bordered dt-responsive nowrap">

<tr>
<td>#</td>
<td>COMPONANT </td>
<td>DESCRIPTION</td>
<td> P.O.No </td>
<td> INWARD CHALLAN </td>

<td>REMARK </td>
<td>QTY</td>
<td>Wt.PER KG</td>
<td>USE KGS</td>

</tr>

<?php
if($_REQUEST['delivery_challan_id']!=''){


$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'];
$use_kg_scrap=$row['use_kg_scrap'];
$finish_shaft_wt_kg=$row['finish_shaft_wt_kg'];
$turning_scrap_wt=$row['turning_scrap_wt'];


?>

<tr>
    <input type="hidden" name="delivery_challan_more_product_id<? echo $k?>" value="<? echo $delivery_challan_more_product_id?>">

<td><a href="delete_delivery_challan_more_product_edit.php?delivery_challan_more_product_id=<?php echo $delivery_challan_more_product_id?>&&delivery_challan_id=<?php echo $_REQUEST['delivery_challan_id'];?>&&customer_id=<?php echo $_REQUEST['customer_id'];?>" class="btn waves-light" style="float:right; background-color:#65bd77; color: #FFFFFF">Del</a></td>

<td>
    <input type="text" class="form-control" name="componant<? echo $delivery_challan_more_product_id?>" value="<? echo $componant?>">
</td>

<td><textarea  class="form-control" name="description<? echo $delivery_challan_more_product_id?>"><? echo $description;?></textarea>
</td>
<td> 

  <select name="cust_po_more_product_id<? echo $delivery_challan_more_product_id?>" class="form-control" >
  
  <?php 
  $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'];
}
?>
<option value="<?php echo $cust_po_more_product_id;?>" selected><?php echo $po_number?></option>

<?php 
$qry97 = "select * from customer_po_more_product_02 where product_id='$product_id' and bal_po_qty!='0' and status='SAVE'";
$re97 = mysqli_query($conn,$qry97);
while($row=mysqli_fetch_array($re97))
{
$po_number = $row['po_number'];
$sr_no=$row['sr_no'];
$cust_po_more_product_id=$row['cust_po_more_product_id'];
$po_date=$row['po_date'];
 $query202="select * from delivery_challan_more_product_02 where product_id='$product_id' and status='SAVE' and receipt_no='' and cust_po_more_product_id='$cust_po_more_product_id'";
$result02=mysqli_query($conn,$query202);
while($row=mysqli_fetch_array($result02))

		{  
$book_qty='0';
$book_qty01=$row['qty'];
$book_qty_tat+=$book_qty01;
}
?>
<option value="<?php echo $cust_po_more_product_id?>" ><?php echo $po_number ?> Dt. <?php echo $po_date;?> Sr.No. <?php echo $sr_no;?></option>

<?php } ?>
</select></td>


<td> 

  <select name="cust_more_row_id<?php echo $delivery_challan_more_product_id;?>" class="form-control" >
  
  <?php 
$qry97 = "select * from cust_inward_more_row_02 where row_id='$row_id' and cust_more_row_id='$cust_more_row_id'";
$re97 = mysqli_query($conn,$qry97);
while($row=mysqli_fetch_array($re97))
{
$challan_no = $row['challan_no'];
}
?>
<option value="<?php echo $cust_more_row_id;?>" selected><?php echo $challan_no?></option>
<?php 
$book_kg_tot='';
 $qry97 = "select * from cust_inward_more_row_02 where row_id='$row_id' and bal_weight!='0' and status='SAVE'";
$re97 = mysqli_query($conn,$qry97);
while($row=mysqli_fetch_array($re97))
{
$challan_no = $row['challan_no'];
$cust_more_row_id=$row['cust_more_row_id'];
$challan_date = $row['challan_date'];
$bal_weight=$row['bal_weight'];

$query202="select * from delivery_challan_more_product_02 where row_id='$row_id' and status='SAVE' and receipt_no='' and cust_more_row_id='$cust_more_row_id'";
$result02=mysqli_query($conn,$query202);
while($row=mysqli_fetch_array($result02))

		{  
$book_kg='0';
$book_kg01=$row['use_kg'];
$book_kg_scrap  =$row['use_kg_scrap'];
$book_kg=$book_kg01+$book_kg_scrap;
$book_kg_tot+=$book_kg;
}
 $query202="select * from delivery_challan_more_product_02 where row_id='$row_id' and   receipt_no='' and cust_more_row_id='$cust_more_row_id' and delivery_challan_id='".$_REQUEST['delivery_challan_id']."'";
$result02=mysqli_query($conn,$query202);
while($row=mysqli_fetch_array($result02))

		{  
$book_kg01=$row['use_kg'];
$book_kg_scrap  =$row['use_kg_scrap'];
$book_kg=$book_kg01+$book_kg_scrap;
$book_kg_tot+=$book_kg;
}

?>
<option value="<?php echo $cust_more_row_id?>" ><?php echo $challan_no ?> Dt. <?php echo $challan_date;?>, Bal. Weight : <?php echo number_format($bal_weight-$book_kg_tot,3);?> , Book Weight: <?php echo $book_kg_tot?></option>

<?php } ?>
</select></td>

<td>

<textarea  class="form-control" name="material_code<? echo $delivery_challan_more_product_id?>"> <?php echo $material_code?></textarea>
</td>
<td>
    <input type="text" class="form-control"  id="qty<? echo $delivery_challan_more_product_id?>"name="qty<? echo $delivery_challan_more_product_id?>" value="<? echo $qty?>"> <br />
	
	<select name="unit<? echo $delivery_challan_more_product_id?>" class="form-control">
	
<option value="" selected>Select Unit</option>
<?php 
$qrybu = "select * from bar_unit_master ORDER BY bar_unit ASC";
$rebu = mysqli_query($conn,$qrybu);
while($row=mysqli_fetch_array($rebu))
{
$unit = $row['bar_unit'];
?>
<option value="<?php echo $unit?>"><?php echo $unit?></option>
<?php }?>
</select>
</td>

<td>    Finish Shaft :

<input type="text" class="form-control"  id="finish_shaft_wt_kg<? echo $delivery_challan_more_product_id?>" name="finish_shaft_wt_kg<? echo $delivery_challan_more_product_id?>" value="<? echo number_format($finish_shaft_wt_kg,3,'.','');?>">
Turning Scrap:

 <input type="text" class="form-control"  id="turning_scrap_wt<? echo $delivery_challan_more_product_id?>" name="turning_scrap_wt<? echo $delivery_challan_more_product_id?>" value="<? echo number_format($turning_scrap_wt,3,'.','');?>" required >

</td>
<td> Finish Shaft :

    <input type="text" class="form-control" id="use_kg<? echo $delivery_challan_more_product_id?>" name="use_kg<? echo $delivery_challan_more_product_id?>" value="<? echo number_format($use_kg,3,'.','');?>" readonly="readonly">
	Turning Scrap:
    <input type="text" class="form-control" id="use_kg_scrap<? echo $delivery_challan_more_product_id?>" name="use_kg_scrap<? echo $delivery_challan_more_product_id?>" value="<? echo number_format($use_kg_scrap,3,'.','');?>" readonly="readonly">

</td>





</tr> <script>
$('#finish_shaft_wt_kg<? echo $delivery_challan_more_product_id;?>,#qty<? echo $delivery_challan_more_product_id;?>,#turning_scrap_wt<? echo $delivery_challan_more_product_id;?>').on('input',function(){
    var qty<? echo $delivery_challan_more_product_id;?> = parseFloat($('#qty<? echo $delivery_challan_more_product_id;?>').val()) || 0;
	var finish_shaft_wt_kg<? echo $delivery_challan_more_product_id;?> = parseFloat($('#finish_shaft_wt_kg<? echo $delivery_challan_more_product_id;?>').val()) || 0;
		var turning_scrap_wt<? echo $delivery_challan_more_product_id;?> = parseFloat($('#turning_scrap_wt<? echo $delivery_challan_more_product_id;?>').val()) || 0;

    $('#use_kg<? echo $delivery_challan_more_product_id;?>').val(finish_shaft_wt_kg<? echo $delivery_challan_more_product_id;?> * qty<? echo $delivery_challan_more_product_id;?>);   
	    $('#use_kg_scrap<? echo $delivery_challan_more_product_id;?>').val(turning_scrap_wt<? echo $delivery_challan_more_product_id;?> * qty<? echo $delivery_challan_more_product_id;?>);   
 
});</script>


             
                 <?php } 
				 
				 }
				 ?>                               <div class="col-sm-12 col-xs-12">
                    </div></table>             
					
					
					
<div class="col-sm-3 col-xs-12"><div class="form-group">
<label>Vehicle No</label>

<input type="text" name="vehicle_no" value="<?php echo $vehicle_no;?>" class="form-control" />
</div></div>    
			
			
			<div class="col-sm-3 col-xs-12"><div class="form-group">
<label>
E-Way Bill  No</label>

<input type="text" name="e_way_bill_no" value="<?php echo $e_way_bill_no;?>" class="form-control" />
</div></div>  <div class="col-sm-3 col-xs-12"><div class="form-group">
<label>
LR No</label>

<input type="text" name="lr_no" value="<?php echo $lr_no;?>" class="form-control" />
</div></div>  
				
					          
                                            <div class="m-t-20">
                                                    <div class="form-group">
                                                        <div>
													<input name="Submit"  type="submit" value="Save"  onclick="validate()" class="btn btn-sm btn-primary"/>
													
							
                                                        </div>
                                                    </div>
                                               
                                            </div>
                                        </div>
                                        
                                    </div>
                                </div>
                            </div>
                        </div>
                    </div>
        </main>
        </form>
		
		
		
        
      </div>
    </div>
<script  src="./script.js"></script>
 <script src="vendors/bower_components/jquery/dist/jquery.min.js"></script>
        <script src="vendors/bower_components/bootstrap/dist/js/bootstrap.min.js"></script>
        <script type="text/javascript" src="vendors/bower_components/moment/min/moment-with-locales.min.js"></script>
        <script src="vendors/bower_components/mjolnic-bootstrap-colorpicker/dist/js/bootstrap-colorpicker.min.js"></script>
        <script src="vendors/bower_components/switchery/dist/switchery.min.js"></script>
        <script src="vendors/bower_components/select2/dist/js/select2.full.min.js"></script>
        <script src="vendors/bower_components/bootstrap-select/dist/js/bootstrap-select.min.js"></script>
        
        <!-- Bootstrap Tagsinput JavaScript -->
        <script src="vendors/bower_components/bootstrap-tagsinput/dist/bootstrap-tagsinput.min.js"></script>
        
        <!-- Bootstrap Touchspin JavaScript -->
        <script src="vendors/bower_components/bootstrap-touchspin/dist/jquery.bootstrap-touchspin.min.js"></script>
        
        <!-- Multiselect JavaScript -->
        <script src="vendors/bower_components/multiselect/js/jquery.multi-select.js"></script>
        
         
        <!-- Bootstrap Switch JavaScript -->
        <script src="vendors/bower_components/bootstrap-switch/dist/js/bootstrap-switch.min.js"></script>
        
        <!-- Bootstrap Datetimepicker JavaScript -->
        <script type="text/javascript" src="vendors/bower_components/eonasdan-bootstrap-datetimepicker/build/js/bootstrap-datetimepicker.min.js"></script>

        
        <!-- Form Advance Init JavaScript -->
        <script src="dist/js/form-advance-data.js"></script>
        
        <!-- Slimscroll JavaScript -->
        <script src="dist/js/jquery.slimscroll.js"></script>
    
        <!-- Fancy Dropdown JS -->
        <script src="dist/js/dropdown-bootstrap-extended.js"></script>
        
        <!-- Owl JavaScript -->
        <script src="vendors/bower_components/owl.carousel/dist/owl.carousel.min.js"></script>
    
        <!-- Init JavaScript -->
        <script src="dist/js/init.js"></script>   <script src="assets/js/bootstrap.min.js"></script>
	<!-- Select2 JavaScript -->
		<script src="vendors/bower_components/select2/dist/js/select2.full.min.js"></script>
		
		<!-- Bootstrap Select JavaScript -->
		<script src="vendors/bower_components/bootstrap-select/dist/js/bootstrap-select.min.js"></script>
<script src="assets/js/bootstrap.min.js"></script>
<script src="assets/js/modernizr.min.js"></script>
<script src="assets/js/detect.js"></script>
<script src="assets/js/fastclick.js"></script>
<script src="assets/js/jquery.slimscroll.js"></script>
<script src="assets/js/jquery.blockUI.js"></script>
<script src="assets/js/waves.js"></script>
<script src="assets/js/wow.min.js"></script>
<script src="assets/js/jquery.nicescroll.js"></script>
<script src="assets/js/jquery.scrollTo.min.js"></script>
<script src="assets/js/app.js"></script>
</body>
<!-- Mirrored from themesdesign.in/xadmino/form-elements.html by HTTrack Website Copier/3.x [XR&CO'2014], Wed, 03 Feb 2021 12:05:08 GMT -->
</html>