<style>
.style15 {
font-family: Verdana, Arial, Helvetica, sans-serif;
font-size: 14px;
font-weight: bold;
}
</style>
<script>
function edit_job_details_sample(main_id,jobcard_no)
{
//alert()
window.location.href="main_fram.php?file=sample_jobcard&main_edit_id="+main_id+"&jobcard_no="+jobcard_no;
}
function print_sampl_jobcard(url)
{
onmouseover388= window.open(url,'onmouseover388','height=650,width=1100,scrollbars=yes,left=100,top=25,toolbar=no,location=no,directories=no,status=no,menubar=no');
}


function samp_individual_print_jobcard(url)
{
onmouseover455= window.open(url,'onmouseover455','height=650,width=1100,scrollbars=yes,left=100,top=25,toolbar=no,location=no,directories=no,status=no,menubar=no');
}


</script>

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


?>
<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_jobcard('jobcard/sample_jobcard/samp_jobcard_main_print.php?customer_name=<?php echo $_GET['customer_name'];?>&from_date=<?php echo $_GET['from_date'];?>&to_date=<?php echo $_GET['to_date'];?>&job_card_num=<?php echo $job_card_num; ?>');" 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 width="159" align="left" style="border:1px solid #ddd" scope="col" >&nbsp;&nbsp;Sample Jobcard No</th>
      <th scope="col" align="left" style="border:1px solid #ddd" >Customer Name</th>
      <th width="152" align="left" scope="col" style="border:1px solid #ddd" >Designer</th>
      <th width="170" align="left" scope="col" style="border:1px solid #ddd" >Design Name</th>
      <th width="138" align="left" style="border:1px solid #ddd" scope="col" >&nbsp;&nbsp;Color Profile</th>
        <th width="138" align="left" style="border:1px solid #ddd" scope="col" >&nbsp;&nbsp;Total Qty</th>
          <th width="138" align="left" style="border:1px solid #ddd" scope="col" >&nbsp;&nbsp;Total Value</th>
              <th width="87" align="center" style="border:1px solid #ddd" scope="col" >&nbsp;&nbsp;View</th>
      <?php if(($user_id=='1')||($user_id=='3'))
	 { 
	 ?>
      <th width="50" align="center" scope="col" style="border:1px solid #ddd" >Edit</th>
      <th width="76" align="center" scope="col" style="border:1px solid #ddd" >Delete</th>
	<?php } ?>
      </tr>
  <?php
  include ("../../include/db.php");
  
  function place_branch_name($book_branch)
  {
	$sql_user="select * from branch_creation where branch_id='$book_branch' and delete_status!='1' ";
	$rs_user=mysql_query($sql_user);
	while($rsdata_user=mysql_fetch_object($rs_user))
	{ 
	$branch_name=$rsdata_user->branch_name;
	}
	return $branch_name;
  }
 
  function book_place_names($book_place)
  {
	$sql_user="select * from place_creation where id='$book_place'";
	$rs_user=mysql_query($sql_user);
	while($rsdata_user=mysql_fetch_object($rs_user))
	{ 
	$location=$rsdata_user->location;
	}
	return $location;
  }
  function get_sample_jobcard_qtys($jobcard_no)
  {
	$sql_user="select sum(amount) as amount from sample_jobcard_sublist where jobcard_no='$jobcard_no'";
	$rs_user=mysql_query($sql_user);
	while($rsdata_user=mysql_fetch_object($rs_user))
	{ 
	$amount=$rsdata_user->amount;
	}
	return $amount;
  }
  
  function gets_book_count($booking_no)
  {
	  $sql_user="select * from booking_sub_list where book_no='$booking_no'";
	  $rs_user=mysql_query($sql_user);
	  $rs_count=mysql_num_rows($rs_user);
	  return $rs_count;
  }
  
 

$cust_name=$_GET['customer_name'];
$from_date=$_GET['from_date'];
$to_date=$_GET['to_date'];
$status=$_GET['jobtype'];
$current_date=date('Y-m-d');
$job_card_num=$_GET['job_card_num'];

if($cust_name!=""){ $customer_name1= "cust_name='$cust_name'"; }else{$customer_name1=''; }
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'";}
if($job_card_num!=""){ $job_card_nums = "jobcard_no='$job_card_num'";}else{$job_card_nums='';}

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


if(($from_date=='')&&($to_date==''))
  {
   $sql="select * from  sample_jobcard_main where  DATE_FORMAT( entry_date, '%Y-%m-%d' )='$current_date'  order by jobcard_no  ASC ";
  } 
  else
  {
   $sql="select * from  sample_jobcard_main where $get_query103 main_id!='' order by jobcard_no ASC ";
  }
	$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'];
				$created_by=$rsdata['created_by'];
	   			$cust_name=$rsdata['cust_name'];
				$book_place_names=book_place_names($book_place);
	   			$entry_date=$rsdata['entry_date'];
				$book_branch_names=place_branch_name($book_branch);
				$designer_name=$rsdata['designer_name'];
	   			$design=$rsdata['design'];
	   			$color_profile=$rsdata['color_profile'];
	   			$order_by=$rsdata['order_by'];
				$item_image=$rsdata['item_image'];
				$net_total=$rsdata['net_total'];
				$get_qtys=get_sample_jobcard_qtys($jobcard_no);
					
				
  ?>
  <tr>
    <td width="68"  align="center" style="border:1px solid #ddd"><?php echo $from; ?></td>
    <td width="122" align="left" style="border:1px solid #ddd">&nbsp;&nbsp;<?php echo date("d-m-Y",strtotime($entry_date));?></td>
    <td align="left" style="border:1px solid #ddd">&nbsp;&nbsp;&nbsp;&nbsp;<?php echo $jobcard_no;?></td>
    <td width="293" align="left" style="border:1px solid #ddd">&nbsp;&nbsp;<?php echo $cust_name;?></td>
    <td align="left" style="border:1px solid #ddd">&nbsp;&nbsp;<?php echo ucfirst($design);?></td>
    <td align="left" style="border:1px solid #ddd">&nbsp;<?php echo ucfirst($designer_name);?></td>
    <td align="left" style="border:1px solid #ddd">&nbsp;&nbsp;<?php echo ucfirst($color_profile);?></td>
        <td align="left" style="border:1px solid #ddd">&nbsp;&nbsp;<?php echo ucfirst($get_qtys);?></td>

    <td align="left" style="border:1px solid #ddd">&nbsp;&nbsp;<?php echo ucfirst($net_total);?></td>

    <td align="center" style="cursor:pointer; border:1px solid #ddd"><a href="javascript:samp_individual_print_jobcard('jobcard/sample_jobcard/sampl_jobcard_view_print.php?jobcard_no=<?php echo $jobcard_no;?>&cust_name=<?php echo $cust_name;?>');" style="text-decoration:none;"><img src="img/PrinterBlack.png" width="30" height="30" title="Print" value="Print"/></a></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_job_details_sample('<?php echo $main_id;?>','<?php echo $jobcard_no;?>');"/></td> <?php } ?><?php if(($user_id=='1'))
	 { 
	 ?> 
    <td align="center" style="border:1px solid #ddd" ><img src="img/trash.png" style="cursor:pointer" onClick="del_job_main_sample('<?php echo $main_id;?>','<?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>
</div>

