<script>

var sm = jQuery.noConflict();
sm().ready(function() 
{ 
	sm("#book_particulars").autocomplete("include/autocomplete/particulars_auto.php", {
	width: 650,
	matchContains: true,
	selectFirst: true
	});	
});
</script>
<style>
.style1 {border-top: solid 1px;border-top-color: #CCCCCC;}
.style21 {border-bottom: solid 1px;border-bottom-color: #CCCCCC;}
.style5 {border-left: solid 1px;border-left-color: #CCCCCC;}
.style3{ border-right: solid 1px;border-right-color: #CCCCCC; }
.style4 {border-bottom: solid 1px;border-bottom-color: #CCCCCC;}
.text{ font-family: Verdana; font-size:13px;}
#tot_amt::-webkit-input-placeholder { color:#666; }
</style>
<?php error_reporting(0);
/***************************** PREVIOUS NEXT CODING ****************************************/
 include("../../include/db.php");
  
/***********edit id**********************/	
  $edit_ids=$_POST['edit_id']; 
  $book_no=$_POST['book_no'];
  $sql="select * from booking_sub_list where sub_id='$_POST[edit_id]' ";
  $rs=mysql_query($sql);
  while($rsdata=mysql_fetch_array($rs))
  {
       $sno=$sno+1;
	   $sub_ids=$rsdata['sub_id'];
	   $book_no1=$rsdata['book_no'];
   	   $book_date1=$rsdata['book_date'];
	   $book_place1=$rsdata['book_place'];
	   $book_branch1=$rsdata['book_branch'];
	   $pay_type1=$rsdata['pay_type'];
	   $particulars1=$rsdata['particulars'];
	   $weight_kg1=$rsdata['weight_kg'];
	   $kg_rate1=$rsdata['kg_rate'];
	   $frieght_charge2=$rsdata['frieght_charge'];
	   $create_date1=date("d-m-Y",strtotime($create_date));
	   }
 ?>
<div style="height:180px; width:98%; padding-left:0px;  overflow-x:hidden; overflow-y:scroll; white-space:nowrap; ">
<table width="100%" border="0" cellpadding="0" cellspacing="0" align="center" >
  <tr  bgcolor="#F2F2F2">
    <td width="42" height="25" class="text style5 style1 style21"><strong>&nbsp;S.No&nbsp;</strong></td>
    <td width="588" class="text style1 style5 style21"><strong>&nbsp;&nbsp;Particulars</strong><span style="color:#FF0000"> *</span></td>
    <td width="159" class="text style1 style5 style21" align="right"><strong>Weight/No's </strong>&nbsp;</td>
    <td width="162" class="text style1 style5 style21" align="right"><strong>Rate&nbsp;&nbsp;</strong></td>
    <td width="145" class="text style1 style5 style21" align="right"><strong>Freight Rs&nbsp;&nbsp;</strong></td>
    <td width="124" class="text style1 style5 style3 style21" align="center"><strong>Action</strong></td>
 </tr>
   <?php
  
   $purchase_number=$_GET['edit_id'];
   $sql1="select * from  purchase_order_entry where purchase_order_no='$purchase_no' or purchase_no='$purchase_no1'";
   $rs1=mysql_query($sql1);
   $sno=0;
   while($rsdata1=mysql_fetch_array($rs))
   {
   $sno=$sno+1;
   $id=$rsdata1['id'];
   $purchase_no=$rsdata1['purchase_order_no'];
   }
    $book_no=$_GET['book_no'];
    $book_no1=$_POST['book_no'];
  
    $sql="select * from  booking_sub_list where book_no='$book_no1' or book_no='$book_no'";
    $rs=mysql_query($sql);
	$sno=0;
   		while($rsdata=mysql_fetch_array($rs))
  			{ 
   				$sno=$sno+1;
   				$sub_id=$rsdata['sub_id'];
				$book_no=$rsdata['book_no'];
   				$particulars=$rsdata['particulars'];
				$weight_kg=$rsdata['weight_kg'];
				if($weight_kg=="0.00")
				{
					$weight_kg_res='';
				}
				else
				{
					$weight_kg_res=$weight_kg;
				}
				$kg_rate=$rsdata['kg_rate'];
				
				if($kg_rate=="0.00")
				{
					$kg_rate_res='';
				}
				else
				{
					$kg_rate_res=$kg_rate;
				}
				$frieght_charge=$rsdata['frieght_charge'];
				
				$row=$row+1;
								  $row1=$row%2;
								  if($row1==0)
								  {
								  $class='style="background-color:#f6faff;border-bottom:solid 1px;border-color:#E2E2E2"';
								  }
								  else
								  {
								  $class='style="background-color:#f3f3ff;border-bottom:solid 1px;border-color:#E2E2E2"';
								  }
  ?>
   <tr>
      <td width="42" height="27"  align="center" class="text style4  style5"><?php echo $sno; ?></td>
      <td width="588" align="left" class="text style5 style4" style="padding-left:2px;">&nbsp;&nbsp;<?php echo $particulars;?></td>
      <td width="159" align="right" class="text style5 style4"><?php echo $weight_kg_res;?>&nbsp;&nbsp;</td>
      <td width="162" align="right" class="text style5 style4"><?php echo $kg_rate_res;?>&nbsp;&nbsp;</td>
      <td width="145" align="right" class="text style5 style4"><?php echo $frieght_charge;?>&nbsp;&nbsp;</td>
      <td width="124" colspan="2"  align="center" class="style5 style3 style4" > <img src="img/edit-icon.png" onClick="edit_booking_sub('<?php echo $sub_id;?>',
      '<?php echo $book_no; ?>')" width="18px" height="18px">&nbsp;&nbsp;&nbsp;<img src="img/cross-small.png"  title="Delete" onClick="del_book_sub('<?php echo $sub_id;?>','<?php echo $book_no; ?>',this.value)" width="20px" height="20px"></td>
  </tr>
    <?php 
	$frieght_charge1+=$frieght_charge;
	} ?>
 <tr height="20px">
    <td width="42" height="28"  align="center" class="text style4 style5" ><?php echo $sno+1; ?></td>
      <td width="588" align="left" class="style5" >
        
    <input type="text" class="types_class1" name="book_particulars" id="book_particulars" tabindex="8" onKeyUp="book_sub_clear_valid(this.value),enterevent(event,'weight_kg','book_particulars')" style="width:100%; height:100%;"  
    value="<?php if($edit_ids!=''){ echo $particulars1; } else {  }?>" />    </td>
    <td align="center" class="style5 "><input type="text" class="types_class1" name="weight_kg" id="weight_kg" tabindex="9" onKeyUp="get_fright_amt(weight_kg.value,rates.value),enterevent(event,'rates','weight_kg')" onKeyPress="if ((event.keyCode &lt; 46) || (event.keyCode &gt; 57)) event.returnValue = false"  style="width:100%; height:100%;"  
    value="<?php if($edit_ids!=''){ echo $weight_kg1; } else {  }?>" /></td>
    <td align="center" class="style5 "><input type="text" name="rates" id="rates"  class="types_class1" tabindex="10"  onKeyUp="get_fright_amt(weight_kg.value,rates.value),enterevent(event,'add','rates')" onKeyPress="if ((event.keyCode &lt; 46) || (event.keyCode &gt; 57)) event.returnValue = false" style="width:100%; height:100%;"  
    value="<?php if($edit_ids!=''){ echo $kg_rate1; } else {  }?>" /></td>
    <td align="center" class="style5 "><input type="text" name="freight_rs" id="freight_rs" onKeyUp="enterevent(event,'add','freight_rs')" tabindex="11"  class="types_class1"  style="width:100%; height:100%;"  
    value="<?php if($edit_ids!=''){ echo $frieght_charge2; } else {  }?>" /></td>
    <td colspan="2"><input type="button" name="add" id="add" tabindex="12" value="<?php if($edit_ids!='') { echo "EDIT"; } else { echo "ADD"; } ?>" style="width:100%; height:120%;" onClick="booking_sub_list(book_no.value,from_party_name.value,to_party_name.value,booking_date.value,booking_place.value,booking_branch.value,pay_to_pay_val.value,book_particulars.value,weight_kg.value,rates.value,freight_rs.value,'<?php echo $edit_ids;?> ',this.value),enterevent(event,'book_particulars','add'),reload_div();"></td>
  </tr><tr><td class="style5"></td><td><div id="book_particulars_valid_div" style="color:#F00"></div></td><td>
  </td>
    <td></td>
    <td></td>
    <td class="style3">
  <input type="hidden" name="overal_tot" id="overal_tot"   
    value="<?php  echo $frieght_charge1; ?>" />
  </td> </tr>
 <tr height="145px">
   <td colspan="7"  align="center" class="style4 style3 style5" ><table width="100%" border="0" cellpadding="0" cellspacing="0">
    
   </table></td>
   </tr>
    </table>
 </div>
 