<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: 12px;}

#tot_amt::-webkit-input-placeholder { color:#666; }
</style>
<div id="return_id">

<?php 

error_reporting(0);
date_default_timezone_set('Asia/Kolkata');
include("../../include/db.php");
ob_start();
session_start();

// if($_GET['job_card_nos']!='')
// {
	
//  $fun_job=$_GET['job_card_nos'];	
// }
// elseif($_POST['job_card_nos']!='')
// {
	
//  $fun_job=$_POST['job_card_nos'];	
// }
  $user_id = $_SESSION['login_user_id'];
  $job_card_nos=$_POST['job_card_nos']; 
  $edit_ids=$_GET['edit_id'];
  $media_pur_no=$_GET['purchase_no'];
  $media_pur_no=$_POST['media_pur_no'];
 
  $sql="select * from empty_can_dc_sublist where id='$_GET[edit_id]' ";
  $rs=mysql_query($sql);
  while($rsdata=mysql_fetch_array($rs))
  {
				    $sno=$sno+1;
				    $id=$rsdata['id'];
					$entrydates1=$rsdata['entrydates'];
   					$particulars1_edit=$rsdata['particulars'];
					$batch_no1=$rsdata['batch_no'];
					$uom1=$rsdata['uom'];
				 	$nos1=$rsdata['nos'];
					$packing1=$rsdata['packing'];
				 	$qty1=$rsdata['qty'];
					$qty_hid1=$rsdata['qty_hid'];
}

	 	
			?>



<div style="height:200px; width:98%; padding-left:0px;  overflow-x:hidden; overflow-y:scroll; white-space:nowrap;" align="center">
<table width="100%" border="0" cellpadding="0" cellspacing="0" align="center" >
    <tr bgcolor="#F2F2F2">
    <td width="40" height="35"  class="text style5 style1 style21"><strong>&nbsp;S.No&nbsp;</strong></td>
    <td width="145" class="text style1 style5 style21"><strong>&nbsp;&nbsp;Date</strong></td>
    <!--<td width="145" class="text style1 style5 style21"><strong>Invoice No</strong></td>
     <td width="215" class="text style1 style5 style21"><strong>Supplier Name</strong></td>-->
    <td width="222" class="text style1 style5 style21"><strong>&nbsp;&nbsp;Particulars</strong></td>
      <td width="145" class="text style1 style5 style21"><strong>&nbsp;&nbsp;Batch No</strong></td>
     <td width="117" class="text style1 style5 style21"><strong>&nbsp;&nbsp;UOM</strong></td>
      <td width="117" class="text style1 style5 style21"><strong>&nbsp;&nbsp;NOS</strong></td>
    <td width="145" align="right" class="text style1 style5 style21"><strong>Packing</strong>&nbsp;</td>
     
    <td width="145" align="right" class="text style1 style5 style21"><strong>Quantity</strong>&nbsp;</td>
     
    <td width="101" align="center" class="text style1 style5 style3 style21"><strong>Action</strong></td>
   
 </tr>
   <?php
   
	       $sql="select * from  empty_can_dc_sublist WHERE (`empty_can_return_no`='$_POST[empty_return_no]' or  `empty_can_return_no`='$_GET[empty_return_no]' )";
    $rs=mysql_query($sql);
	$sno=0;
   		while($rsdata=mysql_fetch_array($rs))
  			{ 
   				$sno=$sno+1;
   				$id=$rsdata['id'];
   			//	echo $rsdata['entrydates'];
				$entrydates=$rsdata['entrydates'];
   				$particulars=$rsdata['particulars'];
				$batch_no=$rsdata['batch_no'];
				$uom=$rsdata['uom'];
				$nos=$rsdata['nos'];
				$packing=$rsdata['packing'];
				$qty=$rsdata['qty'];
				$empty_return_no=$rsdata['empty_can_return_no'];
				$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 align="center" class="text style4  style5"><?php echo $sno; ?></td>
      <td align="left" class="text style5 style4" style="padding-left:2px;">&nbsp;&nbsp;<?php echo date('d-m-Y H:i',strtotime($entrydates));?></td>
      <td align="left" class="text style5 style4" style="padding-left:2px;">&nbsp;<?php echo $particulars;?></td>
      <td align="left" class="text style5 style4" style="padding-left:2px;">&nbsp;&nbsp;<?php echo $batch_no;?></td>
            <td align="left" class="text style5 style4" style="padding-left:2px;">&nbsp;<?php echo $uom;?></td>
 <td align="right" class="text style5 style4" style="padding-left:2px;">&nbsp;<?php echo $nos;?></td>
  <td align="right" class="text style5 style4" style="padding-left:2px;">&nbsp;<?php echo $packing;?></td>
      <td align="right" class="text style5 style4"><?php echo $qty;?>&nbsp;&nbsp;</td>
    
        <?php if(($user_id=='1')||($user_id=='3'))
	 { ?>
   
      
    
	  <td align="center" class="style5 style3 style4" ><img src="img/edit.png" onClick="empty_return_sublist_edit('<?php echo $id;?>','<?php  echo $empty_return_no;?>')" width="18px" height="18px">&nbsp;&nbsp;<img src="img/cross-small.png"  title="Delete" onClick="delete_sublist_empty('<?php echo $id;?>','<?php echo $empty_return_no; ?>')" width="20px" height="20px"></td><?php } ?>
</tr>
<?php 
//$total_mtrs+=$tot_mtr;
$packing3+=$packing;

$qty2+=$qty;

} 
?> 
<?php error_reporting(0);
 include("../../include/db.php");
	?>
<tr>
    <td class="text style4 style5"><?php echo $sno+1; ?></td>
    <td  align="left" class="text style4 style5" ><div id="date_div"><input type="datetime-local" name="entrydates" id="entrydates"  <?php if($_SESSION['user_type']!=1) { ?> readonly <?php } ?>   tabindex="3" style="width:100%; height:28px;" value="<?php if($edit_ids!='') { echo $entrydates1; } else{ echo date('Y-m-d').'T'.date('H:i'); } ?>" class="types_class1" onkeypress="enterevent(event,'media_particular','entrydates')" /></div></td>
     <!--<td align="left" class="text style4 style5" ><div id="voice_div">
     
     <select name="invoice_no"   id="invoice_no" onChange="cons_ret_media_clear_valid_sub(this.value),get_con_ret_sup_part_name_media(return_no.value,job_card_nos.value,invoice_no.value)" class="types_class1"  tabindex="4" style="width:100%;  height:28px;" >
         <?php if($_GET['edit_id']=='') { ?><option value="">Select</option><?php } ?>

    <?php /*
	 	$sql_user="select DISTINCT invoice_no  from  media_pur_sublist WHERE (`media_pur_no`='$_POST[job_card_nos]' or  `media_pur_no`='$_GET[job_card_nos]' or  `media_pur_no`='$_GET[media_pur_no1]')";
		$rs_user=mysql_query($sql_user);
			while($rsdata_user=mysql_fetch_object($rs_user))
			{ 
			$id=$rsdata_user->id;
			$invoice_no=$rsdata_user->invoice_no;
		*/	?>
	<option value="<?php  echo $invoice_no; ?>" <?php if($invoice_no1==$invoice_no){?> selected="selected" <?php }?>><?php echo $invoice_no;?></option><?php //} ?>
	 </select>
     
     </div></td>-->
    <!--<td align="left" class="text style4 style5" ><div id="sup_div"><select name="sup_name"   id="sup_name" onChange="cons_ret_media_clear_valid_sub(this.value)" class="types_class1"  tabindex="4" style="width:100%;  height:28px;" >
    <?php if($_GET['edit_id']=='') { ?><option value="">Select</option><?php } ?>
	 <?php /*
	 	$sql_user="select DISTINCT supplier_name  from  media_pur_sublist WHERE (`media_pur_no`='$_POST[job_card_nos]' or  `media_pur_no`='$_GET[job_card_nos]' or  `media_pur_no`='$_GET[purchase_no]') and invoice_no='$invoice_no1'";
			while($rsdata_user=mysql_fetch_object($rs_user))
			{ 
			$id=$rsdata_user->id;
			$supplier_name133=$rsdata_user->supplier_name;
		*/	?>
<option value="<?php  echo $supplier_name133; ?>" <?php if($supplier_name133==$supplier_name1){?> selected="selected" <?php }?>><?php echo $supplier_name133;?></option><?php //} ?>
	 </select></div></td>-->

    <td align="left" class="text style4 style5"><div id="ret_particulars_div"><select name="particulars" onchange="get_particular_batchno(this.value),cons_ret_media_clear_valid_sub(this.value)"  class="types_class1" id="particulars"  tabindex="4" style="width:100%;  height:28px;" >
        <option value="">Select</option>
    <?php //if($_GET['edit_id']=='') { ?><?php //} ?>
	
	<?php 
	    $sql_user="SELECT ink_sub_id,prod_size FROM `ink_sublist` WHERE ink_sub_id!='' GROUP BY prod_size ORDER BY prod_size ASC";
		$rs_user=mysql_query($sql_user);
			while($rsdata_user=mysql_fetch_object($rs_user))
			{ 
			 $id=$rsdata_user->ink_sub_id;
			$res_part11=$rsdata_user->prod_size;
			
			?>
<option value="<?php  echo $rsdata_user->prod_size; ?>" <?php if($particulars1_edit==$rsdata_user->prod_size){?> selected="selected" <?php }?>><?php echo $res_part11;?></option><?php } ?></select></div></td>

    <td  class="text style4 style5"><div id="empty_batch_no_div"><select class="types_class1" name="batch_no"  id="batch_no" style="width:100%;  height:28px;"  onKeyPress="if ((event.keyCode &lt; 46) || (event.keyCode &gt; 57)) event.returnValue = false" onchange="get_ink_details(particulars.value,this.value)" >
    <option value="">Select</option>
    <?php if($_GET['edit_id']!='') { ?> <option value="<?php echo $batch_no1; ?>" <?php if($edit_ids!=''){?> selected="selected" <?php }?>><?php echo $batch_no1; ?></option><?php } ?> 
    </select></div></td>

    <td  class="text style4 style5"><div id="empty_uom_div"><input type="text" class="types_class1" name="uom"  id="uom" style="width:100%;  height:28px;"  onKeyPress="if ((event.keyCode &lt; 46) || (event.keyCode &gt; 57)) event.returnValue = false" readonly  value="<?php if($edit_ids!=''){ echo $uom1; } else {  }?>" /></div></td>

    <td  class="text style4 style5"><div id="empty_nos_div"><input type="text" class="types_class1" name="nos"  readonly id="nos" style="width:100%;  height:28px;"  onKeyPress="if ((event.keyCode &lt; 46) || (event.keyCode &gt; 57)) event.returnValue = false"  value="<?php if($edit_ids!=''){ echo $nos1; } else {  }?>" /></div></td>
  

    <td  class="text style4 style5"><div id="empty_packing_div"><input type="text" class="types_class1" name="packing"  id="packing" style="width:100%;  height:28px;"  onKeyPress="if ((event.keyCode &lt; 46) || (event.keyCode &gt; 57)) event.returnValue = false" onKeyUp="cons_ret_media_clear_valid_sub(this.value),get_tot_mtr(qty.value,this.value)" value="<?php if($edit_ids!=''){ echo $packing1; } else {  }?>" /></div></td>

    <td  class="text style4 style5"><div id="qty_div_media_con"><input type="text" class="types_class1" name="qty" id="qty" style="width:100%;  height:28px;"  onKeyPress="if ((event.keyCode &lt; 46) || (event.keyCode &gt; 57)) event.returnValue = false" onKeyUp="cons_ret_media_clear_valid_sub(this.value)" value="<?php if($edit_ids!=''){ echo $qty1; } else {  }?>" /><input type="hidden" class="types_class1" name="qty_hide1" id="qty_hide1" style="width:100%;  height:28px;"  value="<?php if($edit_ids!=''){  echo $qty_hid1;} else {  }  ?>" /></div></td>
  
  
<td class="text style4 style5"><input type="button" name="add" style="width:100%;  height:28px;" id="add" tabindex="6" value="<?php if($edit_ids!='') { echo "EDIT"; } else { echo "ADD"; } ?>"   onClick="empty_can_sublist(entrydates.value,particulars.value,batch_no.value,uom.value,nos.value,packing.value,qty.value,'<?php echo $_GET['edit_id'];?>',this.value,empty_return_no.value,qty_hide1.value)" ></td>
  </tr>
  <tr>
  <td></td> 
  <td ></td> 
  <!--<td><div id="invoice_no_media_con_ret_valid_div" style="color:#F00;"></div></td>
  <td><div id="supp_name_media_con_ret_valid_div" style="color:#F00;"></div></td>-->
  <td><div id="particulars_media_con_ret_valid_div" style="color:#F00;"></div></td>
  <td><div id="qty_media_con_ret_valid_div" style="color:#F00;"></div></td>
  <td><div id="mtr_roll_media_con_ret_valid_div" style="color:#F00;"></div></td>
  <td></td>
  <td width="1"></td>
  <td width="1"></td>
  <td width="1"></td>
  <td width="6"></td>
  </tr>
  <tr height="100px">
  <td></td> 
  <td></td> 
  <td></td>
  <td></td>
  <td></td>
  <td></td>
  <td></td>
<td></td>

 </tr>
</table>

<input type="hidden" name="total" id="total" value="<?php echo $qty2; ?>"/>
<input type="hidden" name="pac_total" id="pac_total" value="<?php echo $packing3; ?>"/>
</div><table width="100%">
  <tr >

  <td  align="center"  style="padding-left:55%;" class="text"><strong>Total</strong></td>
  <!--<td width="15%" align="right" class="text"><strong><?php echo number_format($qty2,2) ?></strong></td>-->
  <td width="9%" align="right" class="text"><strong><?php echo number_format($packing3,2) ?></strong></td>
<td width="12%" align="right" class="text"><strong><?php echo number_format($qty2,2) ?></strong></td>
<td width="10%"></td>
 </tr></table></div>
 
