<style type="text/css">
.style20 {
	font-family: Verdana;
	font-size: 12px;
}
.style5 {
font-family: Verdana, Arial, Helvetica, sans-serif;
font-size: 14px;
}
.style3 {
font-family: Verdana, Arial, Helvetica, sans-serif;
font-size: 13px;
}
.style10{ border-top:solid 1px; border-top-color:#999;}
.style11{ border-left:solid 1px; border-left-color:#333333;}
.style12{ border-right:solid 1px; border-right-color:#333333;}

.style4 {font-family: Verdana, Arial, Helvetica, sans-serif;
font-size: 13px;
}
.style23 {
	font-family: Verdana, Arial, Helvetica, sans-serif;
	font-weight: bold;
}
.style27 {font-size: 12px}
.style28 {
	font-size: 16px;
	font-weight: bold;
}
.text {font-family: Verdana; font-size:13px;}
.style29 {	font-family: Verdana;
	font-size: 14px;

}
.stylebottom
{
	

	
	border-bottom:1px solid #999;
}	

.prins {
  border: 1px solid black;
  border-collapse: collapse;
}

</style>  <?php
include("../../include/db.php"); 
function get_item_id_media_print($item_name4)
{
$sql_query11="select * from consumable_creation where id='$item_name4' and item='Media' ";
$rs11=mysql_query($sql_query11);
 while($rsdata11=mysql_fetch_object($rs11))
 {
 $particulars=$rsdata11->particulars;

 } 
 return $particulars;
}

 $job_card_no=$_GET['job_card_no'];
 $buyer_name=$_GET['buyer_name'];
  $roll_size=$_GET['roll_size'];
 $item_id4=$_GET['item_name'];
 $type_1=$_GET['type_1'];
 $item_name4=get_item_id_media_print($item_id4);
?>
<table width="980" height="30" border="0" align="center"  cellpadding="0" cellspacing="0">
<tr style="height:60">
<td width="157" height="106" align="right" style="font-size:12px;"><img src="../../img/logo_image.png" width="126" height="130"/></td>
<td colspan="5" align="center" valign="top" style=""><strong style="font-size: 30px; color: #06F; padding-top: 5px; width: 80px; font-family: Verdana, sans-serif">SRI AMMAN DIGITAL PRINTS</strong><br />
        <span width="80%" class="title1" style="font-size:14px;font-family:Verdana, sans-serif; font-weight:bold"><b></b> DOOR No: 1/2,1/3  KOMBAI THOTTAM MAIN ROAD,</span><br />
       <span width="80%" class="title0" style="font-size:14px;font-family:Verdana, sans-serif; font-weight:bold"><b></b>SELLANDIAMMAN THURAI ROAD,</span><br />
       <span width="80%" class="title0" style="font-size:14px;font-family:Verdana, sans-serif; font-weight:bold"><b></b>TIRUPPUR-641604 TAMILNADU STATE INDIA,</span><br/>
       <span width="80%" class="title00" style="font-size:14px;font-family:Verdana, sans-serif; font-weight:bold"><b></b>Contact Office: 0421-4355333,+91 83442-33555,+91 83442-33888,</span><br/>
       <span width="80%" class="title0" style="font-size:14px;font-family:Verdana, sans-serif; font-weight:bold"><b></b>Email Id : sriammandigitalprints@gmail.com/yahoo.com.</span><br/>
    
    <span width="80%" class="title1" style="font-size:18px;font-family:Verdana, sans-serif; font-weight:bold"><b></b>Media Report</span></p></td>
  </tr>
 
  <tr>
<td align="center" colspan="3" height="10px" style="font-family: Verdana, sans-serif; font-size: 14px; font-family: Verdana, sans-serif; font-weight: bold;"></td>
</tr>
<tr><td colspan="3"><table border="0" width="100%"  align="left" cellpadding="0" cellspacing="0"  >

<tr> <td width="250" align="left" class="style4 text" scope="col"><strong>&nbsp;From Date&nbsp;:&nbsp;</strong>
    <?php if($_GET['from_date']!=''){  echo $_GET['from_date'];} else { echo date("d-m-Y"); }?></td>
    <td width="200"  align="left" class="style4 text" scope="col"><strong>To Date&nbsp;:&nbsp;</strong>
    <?php if($_GET['to_date']!=''){  echo $_GET['to_date'];} else { echo date("d-m-Y"); }?>&nbsp;</td>
	 <td width="200"  align="left" class="style4 text" scope="col"><strong>&nbsp;Jobcard No&nbsp;:&nbsp;</strong>
    <?php if($_GET['job_card_no']!=''){  echo $job_card_no;} else { echo "All"; }?></td>
	</tr><tr>
	 <td width="200"  align="left" class="style4 text" scope="col"><strong>&nbsp;Buyer Name&nbsp;:&nbsp;</strong>
    <?php if($_GET['buyer_name']!=''){  echo $buyer_name;} else { echo "All"; }?></td>
	 <td width="200"  align="left" class="style4 text" scope="col"><strong>Roll Size&nbsp;:&nbsp;</strong>
    <?php if($_GET['roll_size']!=''){  echo $roll_size;} else { echo "All"; }?></td>
    <td width="200"  align="left" class="style4 text" scope="col"><strong>&nbsp;Type&nbsp;:&nbsp;</strong>
    <?php if($_GET['type_1']!=''){  echo $type_1;} else { echo "Purchases"; }?></td>
  </tr>
  <tr>
<td align="center" colspan="3" height="10px" style="font-family: Verdana, sans-serif; font-size: 14px; font-family: Verdana, sans-serif; font-weight: bold;"></td>
</tr></table></td></tr>

  </table></td>
</tr></table>
<table class="prins" width="100%"  align="center" cellpadding="0" cellspacing="0"  >
<thead>
<tr >
 
 <td width="52%" height="23" class="stylebottom style10 text style11 style12" align="center" colspan="16" valign="middle"><strong>Usages</strong></td>
</tr>
<tr class="prins" >
    <td  height="23" colspan="16" valign="middle" class="stylebottom style11 style12">
    
    <tr class="prins">
	<td   width="2%"  align="left" class="text style11" ><strong>&nbsp;S.No</strong></td>
	
   <td  width="8%"  align="left" class="text style11" ><strong>&nbsp;Date</strong></td>
   
     <td  width="10%"  align="left" class="text style11"><strong>Jobcard No</strong></td>
  
  <td  width="10%"  align="left" class="text style11"><strong>Buyer Name</strong></td>
    <td  width="7%"  align="left" class="text style11"><strong>Particulars</strong></td>
   
   <td width="5%"  align="left" class="text style11"><strong>Width</strong></td>
      <td width="5%"  align="left" class="text style11"><strong>Height</strong></td>
<td width="7%"  align="left" class="text style11"><strong>Order Qty</strong></td>
<td width="7%"  align="left" class="text style11"><strong>Plan Qty</strong></td>
<td  width="5%"  align="left" class="text style11"><strong>Roll Size</strong></td>
<td width="5%"  align="right" class="text style11"><strong>Req By</strong></td>
<td width="7%"  align="right" class="text style11"><strong>Steps Used</strong></td>
<td width="4%"  align="right" class="text style11"><strong>Steps</strong></td>
<td width="5%"  align="right" class="text style11"><strong>Total Repeats</strong></td>
<td width="3%"  align="right" class="text style11"><strong>Gap</strong></td>
<td width="5%"  align="right" class="text style11"><strong>Gap Mtr</strong></td>

 
   <td width="8%"  align="right" class="text style11"><strong>Total Req</strong></td>

<!--    <td width="9%"  align="right" class="text" ><strong>Qty</strong></td>
-->    </tr>
       </td>
    </tr>
<td colspan="8" class="stylebottom style11 style12"  valign="top">
      <?php 
 //$item_id4=$_GET['item_name'];
 //$item_name4=get_item_id_media_print($item_id4);

  $from_date=$_GET['from_date'];
 $to_date=$_GET['to_date'];
 $cur_date=date("Y-m-d");
if($from_date!=""){ $from_date1= "DATE_FORMAT(media_date,'%Y-%m-%d')>='$from_date'"; }else{$from_date1="DATE_FORMAT(media_date,'%Y-%m-%d')='$cur_date'"; }
if($to_date!=""){ $to_date1 = "DATE_FORMAT(media_date,'%Y-%m-%d')<='$to_date'";}else{$to_date1="DATE_FORMAT(media_date,'%Y-%m-%d')='$cur_date'";}
if($job_card_no!=""){ $job_card_no41 = "jobcard_no='$job_card_no'";}else{$job_card_no41="";}
if($buyer_name!=""){ $buyer_name41 = "in_cust_name='$buyer_name'";}else{$buyer_name41="";}
if($roll_size!=""){ $roll_size41 = "roll_name='$roll_size'";}else{$roll_size41="";}

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

 $sql="select *  from media_sub_list where $get_query105 id!='' order by jobcard_no ASC ";


    $rs=mysql_query($sql);
	 $rscount=mysql_num_rows($rs);
	if($rscount!='')
	{
	$s_no=0;
   		while($rsdata=mysql_fetch_array($rs))
  			{
   				 $s_no=$s_no+1;
				 $from=$from+1;
                 $media_date=$rsdata['media_date'];
				  $media_particular=$rsdata['media_particular'];
				$customer_name=$rsdata['in_cust_name'];
				 $jobcard_no=$rsdata['jobcard_no'];
				 $width=$rsdata['width'];
				 $roll_name=$rsdata['roll_name'];
				 $roll_size=$rsdata['roll_size'];
				  $total_qty=$rsdata['plan_qty'];
		 $order_qty=$rsdata['order_qty'];
				 $height=$rsdata['height'];
				  $tot_req_by=$rsdata['tot_req_by'];
				   $total_qty=$rsdata['plan_qty'];
				 $operator_name=$rsdata['operator_name'];
				 $steps=$rsdata['steps'];
				$steps_used=$rsdata['steps_used'];
				$gap_mtr = $rsdata['gap_mtr'];
				$gap=$rsdata['gap'];
				$total_steps=$rsdata['total_steps'];
				$req_by=$rsdata['req_by'];
				
			  $i=$i+1;	
		?>
      <tr>
	  <td width="120" align="left" class="text style11" ><?php echo $i; ?> &nbsp;&nbsp;</td>
        <td width="92" height="29" align="left" class="text style11">&nbsp;<?php echo date("d-m-Y",strtotime($media_date)); ?></td>
		 <td width="129" align="left" class="text style11" ><?php echo $jobcard_no; ?> &nbsp;&nbsp;</td>
		 <td width="120" align="left" class="text style11" ><?php echo $customer_name; ?> </td>
		  
       
        <td width="61" align="left" class="text style11">&nbsp;&nbsp;<?php  echo $media_particular; ?>&nbsp;&nbsp;</td>
        <td width="61" align="right" class="text style11"><?php  echo $width; ?>&nbsp;&nbsp;</td>
        <td width="61" align="right" class="text style11" ><?php  echo $height; ?>&nbsp;&nbsp;</td>
		 <td width="61" align="right" class="text style11" ><?php  echo number_format($order_qty,2); ?></td>
        <td width="61" align="right" class="text style11" ><?php  echo number_format($total_qty,2); ?></td>
		<td width="61" align="left" class="text style11"><?php echo $roll_name; ?> &nbsp;&nbsp;</td>
		<td width="61" align="right" class="text style11"><?php  echo $req_by; ?>&nbsp;&nbsp;</td>
		<td width="61" align="right" class="text style11" ><?php echo $steps_used; ?> &nbsp;&nbsp;</td>
		<td width="61" align="right" class="text style11" ><?php echo $steps; ?> &nbsp;&nbsp;</td>
		<td width="61" align="right" class="text style11" ><?php echo $total_steps; ?> &nbsp;&nbsp;</td>
		  <td width="61" align="right" class="text style11" ><?php echo $gap; ?> </td>
        <td width="61" align="right" class="text style11" ><?php echo $gap_mtr; ?> &nbsp;</td>
        
        <td width="61" align="right" class="text style11"><?php  echo number_format($tot_req_by,2); ?></td>

      </tr>
      <?php $sum_tot2+=$tot_req_by;
      $sum_tot3+=$order_qty;
      $sum_tot4+=$total_qty;
  			    
  			}
	} else { ?>
      <tr>
        <td width="92" height="29" align="left" class="text"></td>
        <td width="129" align="left" class="text"   ></td>
        <td width="61" align="left" class="text"  ></td>
        <td width="161" align="left" class="text"  >No Usages</td>
        <td width="61" align="left" class="text" ></td>
      </tr>
      <?php } ?>
    
   
 
 
    <tr>
         <td height="28"  align="right" class="text style10"><strong>Total&nbsp;&nbsp;</strong></td>
         <td  align="left" class="text style10"></td>
         <td  align="left"  class="text style10"></td>
         <td  align="left"  class="text style10"></td>
         <td  align="left" class="text style10" ></td>
         <td  align="left"  class="text style10"></td>
          <td  align="left"  class="text style10"></td>
        <td height="28"  align="right" class="text style10"><strong><?php  echo number_format($sum_tot3,2); ?></strong></td>
        <td height="28"  align="right" class="text style10"><strong><?php  echo number_format($sum_tot4,2); ?></strong></td>
      <td  align="left"  class="text style10"></td>
      <td  align="left"  class="text style10"></td>
      <td  align="left"  class="text style10"></td>
      <td  align="left"  class="text style10"></td>
      <td  align="left"  class="text style10"></td>
      <td  align="left"  class="text style10"></td>
      <td  align="left"  class="text style10"></td>
      <td  align="left"  class="text style10"></td>
          
          <td width="76" align="right" class="text style10"><strong><?php  echo number_format($sum_tot2,2); ?>&nbsp;&nbsp;</strong></td>
    </tr>
    
  
</table> </td>

<br><br>
<table border="collapse" width="50%"  align="right" cellpadding="0" cellspacing="0"  >
<thead>
<th>Roll Size</th>
<th>Sum of total Req</th>
</thead>
<tbody>

<?php
$from_date=$_GET['from_date'];
 $to_date=$_GET['to_date'];
 $cur_date=date("Y-m-d");
if($from_date!=""){ $from_date1= "DATE_FORMAT(media_date,'%Y-%m-%d')>='$from_date'"; }else{$from_date1="DATE_FORMAT(media_date,'%Y-%m-%d')='$cur_date'"; }
if($to_date!=""){ $to_date1 = "DATE_FORMAT(media_date,'%Y-%m-%d')<='$to_date'";}else{$to_date1="DATE_FORMAT(media_date,'%Y-%m-%d')='$cur_date'";}
if($job_card_no!=""){ $job_card_no41 = "jobcard_no='$job_card_no'";}else{$job_card_no41="";}

$all_value10 = $from_date1."@".$to_date1."@".$job_card_no41;

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

$sql="select roll_name,sum(tot_req_by) as tot from media_sub_list where $get_query1051 roll_name!='' group by roll_name ASC ";
   $rs=mysql_query($sql);
  while($rsdata=mysql_fetch_array($rs))
  			{
			$steps1=$rsdata['roll_name'];
			$tot=$rsdata['tot'];	
						
			
 ?>
 <tr>
 <td width="61" align="center" class="text"><?php echo $steps1; ?> &nbsp;&nbsp;</td>
<td width="61" align="right" class="text style12"><?php  echo number_format($tot,2);
?></td>
</tr>
<?php $sum_total+=$tot; } ?>
 <tr>
       <td align="right" ><strong>Grant Total&nbsp;&nbsp;</strong></td>
        <td align="right"><strong><?php  echo number_format($sum_total,2); ?>&nbsp;&nbsp;</strong></td>
</tr>
</tbody>
</table>