<link rel="stylesheet" href="css/font.css" type="text/css" />

<script>
function sticker_local_cnfrm_print(url)
{
onmouseover43= window.open(url,'onmouseover43','height=580,width=1100,scrollbars=yes,left=50,top=50,toolbar=no,location=no,directories=no,status=no,menubar=no');
}</script>
<?php error_reporting(0);
/*********************************Get Found Result And Pagination********************************************************/
include("../../include/db.php");
ob_start();
session_start();
$user_id = $_SESSION['login_user_id'];
$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'];
 $jobcard=$_GET['jobcard'];
 $current_date=date('Y-m-d');
if($jobcard!=""){ $jobcard1= "job_no='$cust_name'"; }else{$jobcard1=''; }
if($from_date!=""){ $from_date1= "DATE_FORMAT( date_time,'%Y-%m-%d' )>='$from_date'"; }else{$from_date1="DATE_FORMAT(date_time,'%Y-%m-%d' )='$current_date'"; }
if($to_date!=""){ $to_date1 = "DATE_FORMAT(date_time,'%Y-%m-%d' )<='$to_date'";}else{$to_date1="DATE_FORMAT(date_time,'%Y-%m-%d' )='$current_date'";}

$all_value10 = $customer_name1.";".$from_date1.";".$to_date1;
$all_array10 = explode(';',$all_value10);
foreach($all_array10 as $value10)
{ 
if($value10!='')
{
 $get_query1031 .= $value10." AND ";
}
}	  
if(($from_date=='')&&($to_date==''))
  {
   $sql="select * from  sticker_delivery_challan_main where  DATE_FORMAT( date_time,  '%Y-%m-%d' )='$current_date'  order by id  DESC";
  } 
else
  {
   $sql="select * from  sticker_delivery_challan_main where $get_query1031 	id!='' order by id DESC";
  }
if($jobcard!='')
{
$sql="select * from  sticker_delivery_challan_main where job_no='$jobcard' ";
}
$html_query = "main_fram.php?file=sticker_delivery_challan_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%" height="38">&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:sticker_local_cnfrm_print('jobcard/sticker_delivery_challan/delivery_confirm_print.php?from_date=<?php echo $_GET['from_date'];?>&to_date=<?php echo $_GET['to_date'];?>&jobcard=<?php echo $_GET['jobcard']?>');" style="text-decoration:none;"><img src="img/PrinterBlack.png" width="35" height="35" title="Print" value="Print"/></a></td>
  </tr>
</table>
<div class="container">
<div class="row-fluid">
<div class="span12">
<div class="table-responsive">
<div class="CSSTableGenerator">  

<table border="0" width="99%"  align="center" cellpadding="0" cellspacing="0" style="border:1px solid #ddd" >
<thead>
<tr>
    <th  align="center" width="47" style="border:1px solid #ddd" >S.No</th>
    <th width="108"  align="left" style="border:1px solid #ddd" >&nbsp;&nbsp;Delivery No</th>
    <th  align="left" style="border:1px solid #ddd" >&nbsp;Jobcard No</th>
    <th  align="left" style="border:1px solid #ddd" >&nbsp;Customer Name</th>
    <th  align="center" style="border:1px solid #ddd" >job_type</th>
    <th  align="center" style="border:1px solid #ddd" >fabric_type&nbsp;</th>
    <th  align="right" style="border:1px solid #ddd" >Tot Qty&nbsp;</th>
    <th  align="center" style="border:1px solid #ddd" >Deliv status</th>
    <th  align="center" style="border:1px solid #ddd" >view</th>
     <?php if(($user_id=='1')||($user_id=='3'))
	 { 
	 ?><th  width="64" style="border:1px solid #ddd" >Edit</th>
    <th  width="58" style="border:1px solid #ddd" >Delete</th><?php } ?>
</tr>
  <?php
include("../../include/db.php");  
 $from_date=$_GET['from_date'];
 $to_date=$_GET['to_date'];
 $jobcard=$_GET['jobcard'];
 $current_date=date('Y-m-d');
if($jobcard!=""){ $jobcard1= "job_no='$cust_name'"; }else{$jobcard1=''; }
if($from_date!=""){ $from_date1= "DATE_FORMAT( date_time,'%Y-%m-%d' )>='$from_date'"; }else{$from_date1="DATE_FORMAT(date_time,'%Y-%m-%d' )='$current_date'"; }
if($to_date!=""){ $to_date1 = "DATE_FORMAT(date_time,'%Y-%m-%d' )<='$to_date'";}else{$to_date1="DATE_FORMAT(date_time,'%Y-%m-%d' )='$current_date'";}
$all_value10 = $from_date1.";".$to_date1;
$all_array10 = explode(';',$all_value10);
foreach($all_array10 as $value10)
{ 
if($value10!='')
{
 $get_query103 .= $value10." AND ";
}
}	  
if(($from_date=='')&&($to_date==''))
  {
   $sql="select * from  sticker_delivery_challan_main where  DATE_FORMAT( date_time,  '%Y-%m-%d' )='$current_date'  order by id  DESC LIMIT $from,20";
  } 
else
  {
   $sql="select * from  sticker_delivery_challan_main where $get_query103 	id!='' order by id DESC LIMIT $from,20";
  }
if($jobcard!='')
{
    $sql="select * from  sticker_delivery_challan_main where job_no='$jobcard' ";
	 
}
   $rs=mysql_query($sql);
	$s_no=0;
   		while($rsdata=mysql_fetch_array($rs))
  			{
   				 $s_no=$s_no+1;
				 $from=$from+1;
                 $id=$rsdata['id'];
                 $delivery_no=$rsdata['delivery_no'];
				 $date_time=$rsdata['date_time'];
				 $job_no=$rsdata['job_no'];
				 $created_by=$rsdata['created_by'];
                 $customer_name=$rsdata['customer_name'];
				 $style_no=$rsdata['style_no'];
				 $style_name=$rsdata['style_name'];
				 $combo=$rsdata['combo'];
				 $customer_po_no=$rsdata['customer_po_no'];
				 $job_type=$rsdata['job_type'];
				 $fabric_type=$rsdata['fabric_type'];
				 $remarks=$rsdata['remarks'];
				 $total_qty=$rsdata['total_qty'];
				 $deliv_status=$rsdata['deliv_status'];
 ?>
  <tr>
    <td width="47"  align="center" style="border:1px solid #ddd">&nbsp;<?php echo $from; ?></td>
    <td align="left" style="border:1px solid #ddd" >&nbsp;<?php echo $delivery_no; ?></td>
    <td width="118" align="left" style="border:1px solid #ddd" >&nbsp;<?php echo $job_no; ?></td>
    <td width="358" align="left" style="border:1px solid #ddd" >&nbsp;<?php echo $customer_name; ?></td>
    <td width="110" align="center" style="border:1px solid #ddd" >&nbsp;<?php echo $job_type; ?></td>
    <td width="124" align="center" style="border:1px solid #ddd" ><?php echo $fabric_type; ?>&nbsp;</td>
    <td width="94" align="right" style="border:1px solid #ddd" ><?php echo $total_qty; ?>&nbsp;</td>
    <td width="107" align="center" style="border:1px solid #ddd" ><?php echo $deliv_status; ?></td>
    <td width="53" align="center" style="border:1px solid #ddd" ><img src="img/PrinterBlack.png" style="cursor:pointer"width="19" height="19" title="EDIT" onclick="javascript:sticker_local_cnfrm_print('jobcard/sticker_delivery_challan/delivery_details_print.php?customer_name=<?php echo $customer_name;?>&delivery_no=<?php echo $delivery_no;?>');"/></td>
    <?php if(($user_id=='1')||($user_id=='3'))
	 { 
	 ?> <td align="center" style="border:1px solid #ddd"  ><img src="img/edit.png" style="cursor:pointer"width="13" height="16" title="EDIT" onclick="javascript:sticker_delivery_challan_edit('<?php echo $id;?>','<?php echo $delivery_no;?>');"/></td>
    <td align="center" style="border:1px solid #ddd" ><a href="#" onClick="sticker_delivery_challan_delete('<?php echo $id;?>','<?php echo $job_no;?>','<?php echo $delivery_no;?>');"><img src="img/trash.png" alt="delete" title="DELETE" border="0" width="17px;" height="20px;" /></a>   </td><?php } ?>
  </tr>
  <?php } ?>
  </thead>
</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>
</div>

