<style>
.style15 {
font-family: Verdana, Arial, Helvetica, sans-serif;
font-size: 14px;
font-weight: bold;
}
</style>
<script>
function edit_inward_details(edit_id,jobcard_no)
{
window.location.href="main_fram.php?file=inward_entry&edit_id=" + edit_id + "&jobcard_no=" + jobcard_no;
}
function print_inward(url)
{	
onmouseover10= window.open(url,'onmouseover10','height=500,width=1100,scrollbars=no,resizable=no,left=50,top=50,toolbar=no,location=no,directories=no,status=no');	
}
</script>

<?php error_reporting(0);
/***************************** PREVIOUS NEXT CODING ****************************************/
include ("../../include/db.php");
ob_start();
session_start();
$user_id = $_SESSION['login_user_id'];

function get_user_type($login_user_name,$login_pass_word)
{
    $sql_user="select * from  user_creation where user_name='$login_user_name' and password='$login_pass_word'";
	$rs_user=mysql_query($sql_user);
	while($rsdata_user=mysql_fetch_object($rs_user))
	{ 
	$user_type=$rsdata_user->user_type;
	}
	return $user_type;
}

$login_user_name=$_SESSION['login_user_name'];
$login_pass_word=$_SESSION['login_pass_word'];
$book_branch=$_SESSION['branch'];
$get_user_type=get_user_type($login_user_name,$login_pass_word);

$show = 20;
$num_links = 19;
$from = $_GET['from'];
if (empty($from))
	 {
		$from = "0";
	 } 
else 
	{
	$html_query = $html_query. "&from=$from";
	}
	
$from_date=$_GET['from_date'];
$to_date=$_GET['to_date'];
$current_date=date('Y-m-d');

if($from_date!=""){ $from_date1= "DATE_FORMAT(entry_date,'%Y-%m-%d')>='$from_date'"; }else{$from_date1="DATE_FORMAT(entry_date,'%Y-%m-%d')='$cur_dates'"; }
if($to_date!=""){ $to_date1 = "DATE_FORMAT(entry_date,'%Y-%m-%d')<='$to_date'";}else{$to_date1="DATE_FORMAT(entry_date,'%Y-%m-%d')='$cur_dates'";}

$all_value10 = $from_date1."@".$to_date1;
$all_array10 = explode('@',$all_value10);
foreach($all_array10 as $value10)
{ 
if($value10!='')
{
$get_query102 .= $value10." AND ";
}
}	  

	if(($from_date=='')&&($to_date==''))
  {
   $sql="select * from  inward_main where  DATE_FORMAT(entry_date,'%Y-%m-%d')='$current_date'  order by jobcard_no DESC";
  } 
  else
  {
   $sql="select * from  inward_main where $get_query102 main_id!=''  order by jobcard_no DESC";
  }

$html_query = "main_fram.php?file=inward_enrty_list";
$result=mysql_query($sql);
$num_results=mysql_num_rows($result);
if ($num_results == 0) 
{
 $confirmation = "No Records!";
} 
elseif ($num_results == 1) 
{
$confirmation = "Found 1 Record.";
} 
else 
{
$confirmation = "Found $num_results Records.";
} 
?>
<style type="text/css">
<!--
.style1 {font-size: 16px}
-->
</style>
<table width="100%">
   <tr>
<td width="1%">&nbsp;</td>
<td width="7%" class="style15">&nbsp;</td> 
<td width="13%" align="center">&nbsp;</td>
<td width="1%">&nbsp;</td>
<td width="6%" class="style15">&nbsp;</td>
<td width="14%" align="center"  class="style15">&nbsp;</td>
<td width="2%">&nbsp;</td>
<td width="11%" class="style15">&nbsp;</td>
<td width="24%" align="left" >&nbsp;</td>
<td width="8%" align="center">&nbsp;</td>
<td width="2%"></td>
<td width="7%" align="center"><a href="javascript:print_inward('jobcard/inward_entry/inward_main_print.php?from_date=<?php echo $_GET['from_date'];?>&to_date=<?php echo $_GET['to_date'];?>');" style="text-decoration:none;"><img src="img/PrinterBlack.png" width="35" height="35" title="Print" value="Print"/></a></td>
  </tr>
</table>
<div class="row-fluid">
<div class="span12">
<div class="table-responsive">
<div class="CSSTableGenerator">  
<table width="99%" border="0" align="center"  cellpadding="0" cellspacing="0" style="border:2px solid #eaeaea;border:1px solid #ddd"  >
      <tr>
      <th align="center" style="border:1px solid #ddd" >S.No</th>
      <th scope="col" align="left" style="border:1px solid #ddd" >&nbsp;Date</th>
      <th scope="col" align="left" style="border:1px solid #ddd" >Customer DC No</th>
      <th width="210" align="left" style="border:1px solid #ddd" scope="col" >&nbsp;&nbsp;Jobcard No</th>
      <th scope="col" align="left" style="border:1px solid #ddd" >Customer Name</th>
      <th width="166" align="left" scope="col" style="border:1px solid #ddd" >Fabric Type</th>
      <th width="111" align="right" scope="col" style="border:1px solid #ddd" >Qty&nbsp;</th>
    <?php if(($user_id=='1')||($user_id=='3'))
	 { 
	 ?>   <th width="75" align="center" scope="col" style="border:1px solid #ddd" >Edit</th>
      <th width="79" align="center" scope="col" style="border:1px solid #ddd" >Delete</th><?php } ?>
      </tr>
  <?php
include ("../../include/db.php");  
$from_date=$_GET['from_date'];
$to_date=$_GET['to_date'];
$cur_dates=date('Y-m-d');


if($from_date!=""){ $from_date1= "DATE_FORMAT( entry_date,'%Y-%m-%d' )>='$from_date'"; }else{$from_date1="DATE_FORMAT(entry_date,'%Y-%m-%d' )='$cur_dates'"; }
if($to_date!=""){ $to_date1 = "DATE_FORMAT(entry_date,'%Y-%m-%d' )<='$to_date'";}else{$to_date1="DATE_FORMAT(entry_date,'%Y-%m-%d' )='$cur_dates'";}
$all_value10 = $customer_name1.";".$from_date1.";".$to_date1.";".$jobtype1;
$all_array10 = explode(';',$all_value10);
foreach($all_array10 as $value10)
{ 
if($value10!='')
{
$get_query102 .= $value10." AND ";
}
}	  
 
  
  if(($from_date=='')&&($to_date==''))
  {
   $sql="select * from  inward_main where  DATE_FORMAT(entry_date,'%Y-%m-%d')='$cur_dates' order by jobcard_no DESC LIMIT $from,20";
  } 
  else
  {
    $sql="select * from  inward_main where $get_query102 main_id!='' order by jobcard_no DESC  LIMIT $from,20 ";
  }
    $rs=mysql_query($sql);
	$sno=0;
   		while($rsdata=mysql_fetch_array($rs))
  			{
   				$sno=$sno+1;
				$from=$from+1;
   				$main_id=$rsdata['main_id'];
   				$jobcard_no=$rsdata['jobcard_no'];
				$entry_date=$rsdata['entry_date'];
	   			$cust_name=$rsdata['cust_name'];
	   			$job_type=$rsdata['job_type'];
				$fabric_type=$rsdata['fabric_type'];
				$overall_value=$rsdata['overall_value'];
				$customer_dc_no=$rsdata['customer_dc_no'];
				
  ?>
  <tr>
    <td width="67"  align="center" style="border:1px solid #ddd"><?php echo $from; ?></td>
    <td width="180" align="left" style="border:1px solid #ddd">&nbsp;&nbsp;<?php echo date("d-m-Y",strtotime($entry_date));?></td>
    <td width="194" align="left" style="border:1px solid #ddd"><?php echo $customer_dc_no;?>&nbsp;</td>
    <td align="left" style="border:1px solid #ddd">&nbsp;&nbsp;&nbsp;&nbsp;<?php echo $jobcard_no;?></td>
    <td width="231" align="left" style="border:1px solid #ddd">&nbsp;&nbsp;<?php echo $cust_name;?></td>
    <td align="left" style="border:1px solid #ddd">&nbsp;<?php echo $fabric_type;?></td>
    <td align="right" style="border:1px solid #ddd"><?php echo number_format($overall_value,2);?>&nbsp;</td>
     <?php if(($user_id=='1')||($user_id=='3'))
	 { 
	 ?><td align="center" style="cursor:pointer; border:1px solid #ddd"><img src="img/edit.png" width="17" height="20" title="EDIT" onclick="javascript:edit_inward_details('<?php echo $main_id;?>','<?php echo $jobcard_no;?>');"/></td>
    <td align="center" style="border:1px solid #ddd" ><img src="img/trash.png" style="cursor:pointer" onClick="delete_inward_main22('<?php echo $jobcard_no;?>')" width="20px" height="22px">
   </td><?php } ?>
   </tr>
  <?php } ?>
</table>
</div>
<table border="0" width="99%"  align="center" cellpadding="0" cellspacing="0" >

 <tr>
    <th height="19" align="left" style="font-size:12px; font-family:sans-serif; padding-top:10px;" scope="col"><?php echo $confirmation;?></th>
	<th scope="cols" width="8%" align="right"><?php  
			  if ($num_results > $show) 
			  { 			  $show;
			include("footer_links1.php");
			  }
	?></th>
 </tr>
</table>
</div>
</div>