<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; }
.types_class1 { 
    height: 25px; 
    width: 250px; 
    background-color: transparent;  
    border-style: solid;  
    border-width: 0px 0px 1px 0px;  
    border-color:#CCC; 
    outline:0;
	font-size:13px;
	font-family:Verdana;
	
  }
</style>

<?php 
error_reporting(0);
date_default_timezone_set('Asia/Kolkata');
include("../../include/db.php");
ob_start();
session_start();
$user_id = $_SESSION['login_user_id'];

$edit_ids=$_POST['edit_id'];
$sql="select * from  sticker_delivery_challan_sub where sub_id='$edit_ids'";

    $rs=mysql_query($sql);
	$sno=0;
   		while($rsdata=mysql_fetch_array($rs))
  			{ 
   				$sno=$sno+1;
   				$id1=$rsdata['sub_id'];
				$jobcard_no1=$rsdata['jobcard_no'];
				$delivery_date1=$rsdata['delivery_date'];
   			$particulars1=$rsdata['particulars'];
				$roll_width1=$rsdata['rollno_width'];
				$kg_height1=$rsdata['kg_meter_height'];
				$deliv_qty1=$rsdata['qty'];
				$deliv_qty2+=$rsdata['qty'];
				$date_time1=$rsdata['date_time'];
				}
?>
<div style="height:210px; 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="4%"  height="25" class="text style5 style1 style21"><strong>&nbsp;S.No&nbsp;</strong></td>
    <td width="12%"  class="text style5 style1 style21"> <strong>&nbsp;&nbsp;Date</strong></td>
    <td width="34%"  class="text style1 style5 style21"><strong>&nbsp;&nbsp;Particulars</strong><span style="color:#FF0000"> *</span></td>
    <td width="16%" align="right"  class="text style1 style5 style21"><strong>Width<span style="color:#FF0000"> *</span></strong>&nbsp;</td>
    <td width="16%" align="right"  class="text style1 style5 style21"><strong>Height<span style="color:#FF0000"> *</span>&nbsp;&nbsp;</strong>
    </td>
    <td width="12%" align="right"  class="text style1 style5 style21"><strong>Qty<span style="color:#FF0000"> *</span>&nbsp;&nbsp;</strong></td>
    <td width="6%"  align="center" class="text style1 style5 style21" ><strong>Action</strong></td>
    </tr>
   <?php
     $delivery_no=$_GET['delivery_no'];
    $delivery_nos=$_POST['delivery_no'];
    $sql="select * from  sticker_delivery_challan_sub where (delivery_no='$delivery_no' or delivery_no='$delivery_nos')";
   
    $rs=mysql_query($sql);
	$sno=0;
   		while($rsdata=mysql_fetch_array($rs))
  			{ 
   				$sno=$sno+1;
   				$id=$rsdata['sub_id'];
				$delivery_no=$rsdata['delivery_no'];
				$jobcard_no=$rsdata['job_no'];
				$delivery_date=$rsdata['delivery_date'];
				$date_time=$rsdata['date_time'];
   			$particulars=$rsdata['particulars'];
				$roll_width=$rsdata['rollno_width'];
				$kg_height=$rsdata['kg_meter_height'];
				$deliv_qty=$rsdata['qty'];
				
				$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  height="27"  align="center" class="text style4  style5"><?php echo $sno; ?></td>
      <td  height="27"  align="left" class="text style4  style5">&nbsp;<?php echo date('d-m-Y H:i',strtotime($date_time));?></td>
      <td  align="left" class="text style5 style4" style="padding-left:2px;">&nbsp;&nbsp;<?php echo $particulars;?></td>
      <td  align="right" class="text style5 style4"><?php echo $roll_width;?>&nbsp;&nbsp;</td>
      <td  align="right" class="text style5 style4"><?php echo $kg_height;?>&nbsp;&nbsp;</td>
      <td  align="right" class="text style5 style4"><?php echo $deliv_qty;?>&nbsp;&nbsp;</td>
     <?php if(($user_id=='1')||($user_id=='3'))
	 { 
	 ?>  <td  align="center" class="text style5 style4"><img src="img/edit-icon.png" onClick="sticker_edit_sublist_delivery('<?php echo $id;?>','<?php echo $delivery_no; ?>')" width="18px" height="18px">&nbsp;&nbsp;&nbsp;<img src="img/cross-small.png"  title="Delete" onClick="sticker_delete_sublist_delivery('<?php echo $id;?>','<?php echo $delivery_no; ?>')" width="20px" height="20px"></td><?php } ?>
   </tr>
    <?php 
	$inward_qty1+=$deliv_qty;
	} ?>
 <tr><td height="32" align="center" class="text style4  style5"><?php echo $sno+1; ?></td>
   <td class="text style4  style5"><input type="datetime-local"  <?php if($_SESSION['user_type']!=1) { ?> readonly <?php } ?>  name="delivery_dates" id="delivery_dates" tabindex="2"   value="<?php if($edit_ids!='') {  echo $date_time1; } else{ echo date('Y-m-d').'T'.date('H:i');  }  ?>" style="height:31px; width:200px;"class="types_class1" onkeypress="enterevent(event,'deliv_particular','delivery_dates')" /></td>
   <td class="text style4  style5"><div id="sticker_deliv_particulars_div">
   <select name="deliv_particular" id="deliv_particular" class="types_class1" tabindex="3"  style="width:100%; height:32px; font-family:Segoe, 'Segoe UI', 'DejaVu Sans', 'Trebuchet MS', Verdana, sans-serif; font-size:14px" onChange="enterevent(event,'inward_qty','deliv_particular')">
  
    <option value="<?php if($edit_ids!='') { echo $particulars1; }?>" ><?php if($edit_ids!='') { echo $particulars1; }?></option>
    </option>
    </select></div></td>   <td class="text style4  style5"><div id="sticker_delivery_roll_width_div"><input type="text" readonly class="types_class1" name="roll_width" id="roll_width"   onKeyPress="if ((event.keyCode &lt; 46) || (event.keyCode &gt; 57)) event.returnValue = false"  style="width:100%; height:29px; text-align:right;" value="<?php if($edit_ids!=''){ echo $roll_width1; } else {  }?>" /></div>
  </td>
    <td class="text style4  style5"><div id="sticker_delivery_kg_height_div"><input type="text" readonly name="kg_height" id="kg_height"  class="types_class1"     onKeyPress="if ((event.keyCode &lt; 46) || (event.keyCode &gt; 57)) event.returnValue = false" style="width:100%; height:29px; text-align:right;" value="<?php if($edit_ids!=''){ echo $kg_height1; } else {  }?>" /></div></td>
    <td class="text style4  style5"><div id="sticker_delivery_qty_div"><input type="text" name="inward_qty" id="inward_qty"    class="types_class1"   tabindex="4"  style="width:100%; height:29px; text-align:right;" value="<?php if($edit_ids!=''){ echo $deliv_qty1; } else {  }?>" onkeypress="enterevent(event,'add','inward_qty')" />
    <input type="hidden" name="tot_qty" id="tot_qty"    class="types_class1"  style="width:100%; height:29px; text-align:right;" /></div></td>
    <td class="text style4  style5"><input type="button" name="add" id="add" tabindex="5" value="<?php if($edit_ids!='') { echo "EDIT"; } else { echo "ADD"; } ?>" style="width:100%; height:120%;" onClick="sticker_delivery_sublist_add(delivery_no.value,date_time.value,job_no.value,customer_name.value,job_type.value,fabric_type.value,delivery_dates.value,deliv_particular.value,roll_width.value,kg_height.value,inward_qty.value,tot_qty.value,'<?php echo $edit_ids;?>',this.value),enterevent(event,'deliv_status','add');"></td>
    </tr>
 <tr height="145px">
   <td height="12" colspan="9"  align="center" class="style4 style3 style5" >
   <table width="100%" border="0" cellpadding="0" cellspacing="0">
   </table></td>
   </tr>
    </table>
 </div>
<table width="100%">
  <tr >
    <td width="79%"  align="center" ></td>
    <td width="11%"><span class="text" style="font-size: 14px;"><strong><strong>Total</strong></strong></span></td>
    <td width="10%">&nbsp;<input type="hidden" name="overal_qty" id="overal_qty" value="<?php echo $inward_qty1; ?>" >
	<?php   echo $inward_qty1;  ?></td>
  </tr>
</table>