<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>
<?php 
error_reporting(0);
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'];

  $edit_ids=$_GET['edit_id']; 
  $media_pur_no=$_POST['media_pur_no'];
  
  $sql="select * from return_ink_pur_sublist where id='$_GET[edit_id]' ";
  $rs=mysql_query($sql);
  while($rsdata=mysql_fetch_array($rs))
  {
				   $sno=$sno+1;
				   $id=$rsdata['id'];
				   $media_pur_no1=$rsdata['ink_pur_no'];
				$entrydates1=$rsdata['entrydates'];
				$invoice_no1=$rsdata['invoice_no'];
				$supplier_name1=$rsdata['supplier_name'];
   				$particulars1=$rsdata['particulars_id'];
				 $qty1=$rsdata['qty'];
				 $mtr_roll1=$rsdata['mtr_roll'];
				$tot_mtr1=$rsdata['tot_mtr'];
				 $qty_hids=$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="50" height="35"  class="text style5 style1 style21"><strong>&nbsp;S.No&nbsp;</strong></td>
    <td width="160" class="text style1 style5 style21"><strong>&nbsp;&nbsp;Date</strong></td>
    <td width="200" class="text style1 style5 style21"><strong>Invoice No</strong></td>
     <td width="300" class="text style1 style5 style21"><strong>Supplier Name</strong></td>
    <td width="300" class="text style1 style5 style21"><strong>&nbsp;&nbsp;Particulars</strong></td>
     <td width="200" class="text style1 style5 style21"><strong>&nbsp;&nbsp;Qty</strong></td>

    <td width="101" align="center" class="text style1 style5 style3 style21"><strong>Action</strong></td>
   
 </tr>
   <?php
    $media_pur_no=$_GET['media_pur_no'];
    $media_pur_no=$_POST['media_pur_no'];
      $sql="select * from  return_ink_pur_sublist WHERE (`return_no`='$_POST[return_no]'  or  `return_no`='$_GET[return_no]')";
    $rs=mysql_query($sql); 
	$sno=0;
   		while($rsdata=mysql_fetch_array($rs))
  			{ 
   				$sno=$sno+1;
   				$id=$rsdata['id'];
				$media_pur_no=$rsdata['ink_pur_no'];
				$entrydates=$rsdata['entrydates'];
				$invoice_no=$rsdata['invoice_no'];
				$supplier_name=$rsdata['supplier_name'];
   				$particulars=$rsdata['particulars'];
				$qty=$rsdata['qty'];
				$return_no=$rsdata['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 $invoice_no;?></td>
      <td align="left" class="text style5 style4" style="padding-left:2px;">&nbsp;&nbsp;<?php echo $supplier_name;?></td>
            <td align="left" class="text style5 style4" style="padding-left:2px;">&nbsp;<?php echo $particulars;?></td>
 <td align="right" class="text style5 style4" style="padding-left:2px;">&nbsp;<?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="inkpurchase_sublist_edit_con_ret('<?php echo $id;?>','<?php echo $media_pur_no; ?>','<?php echo $return_no; ?>')" width="20px" height="20px">&nbsp;&nbsp;<img src="img/cross-small.png"  title="Delete" onClick="delete_sublist_ink_pur_cons_ret('<?php echo $id;?>','<?php echo $return_no; ?>')" width="20px" height="20px"></td><?php } ?>
</tr>
<?php 
$total_mtrs+=$tot_mtr;
$mtr_roll3+=$mtr_roll;

$qty2+=$qty;

} 
?>
<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="ink_entrydates" id="ink_entrydates"  <?php if($_SESSION['user_type']!=1) { ?> readonly <?php } ?>   tabindex="3" style="width:100%; height:28px;" value="<?php if($edit_ids!='') { echo $entrydates; } 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="ink_voice_div">
      <select name="ink_invoice_no"   id="ink_invoice_no" class="types_class1" onChange="get_con_ret_sup_part_ink1(return_no.value,job_card_nos.value,ink_invoice_no.value),cons_ret_ink_clear_valid_sub(this.value)"  tabindex="4" style="width:100%;  height:28px;" >
     <option value="">Select</option>
	 <?php 
	 	$sql_user="select DISTINCT invoice_no  from  ink_pur_sublist WHERE (`ink_pur_no`='$_POST[job_card_nos]' or  `ink_pur_no`='$_GET[job_card_nos]')";
		$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 } ?>
	 <?php error_reporting(0);
 include("../../include/db.php");
	?></select>
     
</div></td>
    <td align="left" class="text style4 style5" ><div id="ink_sup_div"><select name="ink_sup_name"   id="ink_sup_name" onChange="cons_ret_ink_clear_valid_sub(this.value)" class="types_class1"  tabindex="4" style="width:100%;  height:28px;" >
     <option value="">Select</option><?php error_reporting(0);
 include("../../include/db.php");
	 	$sql_user="select DISTINCT supplier_name  from  ink_pur_sublist  WHERE (`ink_pur_no`='$_POST[job_card_nos]' or  `ink_pur_no`='$_GET[job_card_nos]') and invoice_no='$invoice_no1'";
		$rs_user=mysql_query($sql_user);
			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="ink_ret_particulars_div"><select name="ink_particulars" onchange="get_ink_qty_con(this.value,'<?php echo $fun_job;?>',return_no.value),cons_ret_ink_clear_valid_sub(this.value)"  class="types_class1" id="ink_particulars"  tabindex="4" style="width:100%;  height:28px;" >
     <option value="">Select</option><?php error_reporting(0);
 include("../../include/db.php");
	$sql_user="select * from  ink_pur_sublist where (`ink_pur_no`='$_POST[job_card_nos]' or  `ink_pur_no`='$_GET[job_card_nos]') and invoice_no='$invoice_no1'";
		$rs_user=mysql_query($sql_user);
			while($rsdata_user=mysql_fetch_object($rs_user))
			{ 
			$id=$rsdata_user->particulars_id;
			$particulars4545=$rsdata_user->particulars;
			?>
<option value="<?php  echo $id; ?>" <?php if($particulars1==$id){?> selected="selected" <?php }?>><?php echo $particulars4545;?></option><?php } ?></select></div></td>
        <td  class="text style4 style5"><div id="ink_qty_div"><input type="text" class="types_class1" name="ink_qty" id="ink_qty" style="width:100%;  height:28px;"  onKeyPress="if ((event.keyCode &lt; 46) || (event.keyCode &gt; 57)) event.returnValue = false" onKeyUp="cons_ret_ink_clear_valid_sub(this.value),get_tot_mtr(this.value,mtr_roll.value)"    value="<?php if($edit_ids!=''){ echo $qty1; } else {  }?>" /><input type="hidden" name="qty_hide" id="qty_hide" value="<?php if($edit_ids!=''){ echo $qty_hids;} 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 "INK EDIT"; } else { echo "INK ADD"; } ?>"   onClick="ink_pur_sub_con_ret(job_card_nos.value,ink_entrydates.value,ink_invoice_no.value,ink_sup_name.value,ink_particulars.value,ink_qty.value,'<?php echo $edit_ids;?> ',this.value,return_no.value,qty_hide.value)"></td>
  </tr>
  <tr>
  <td></td> 
  <td ></td> 
  <td><div id="ink_invoice_no_con_ret_valid_div" style="color:#F00;"></div></td>
  <td><div id="ink_supp_name_con_ret_valid_div" style="color:#F00;"></div></td>
  <td><div id="ink_particulars_con_ret_valid_div" style="color:#F00;"></div></td>
  <td><div id="ink_qty_con_ret_valid_div" style="color:#F00;"></div></td>
  <td></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="total22" id="total22" value="<?php echo $qty2; ?>"/>
</div><table width="100%">
  <tr >

  <td  align="center" style="padding-left:500px;" class="text"><strong>Total</strong></td>
  <td align="center" style="padding-right:250px;"><strong><?php echo number_format($qty2,2) ?></strong></td>
<td width="10%"></td>
 </tr></table>
 
 <input type="hidden" name="ink_total_res" id="ink_total_res" value="<?php echo $qty2; ?>"/>
