<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;
}	
</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;
}


 $item_id4=$_GET['item_name'];
 $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>Ink 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="980"  align="center" cellpadding="0" cellspacing="0"  >

<tr> <td width="212" 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="529"  align="center" class="style4 text" scope="col"><strong>&nbsp;Item Name&nbsp;:&nbsp;</strong>
    <?php if($_GET['item_name']!=''){  echo $item_name4;} else { echo "All"; }?></td>
    <td width="239"  align="right" 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>
  </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 border="0" width="100%"  align="center" cellpadding="0" cellspacing="0"  >
<thead>
<tr >
 <td height="23" colspan="2" class="stylebottom style10 text style11" align="center" valign="middle"><strong>Purchases</strong></td>
 <td width="52%" height="23" class="stylebottom style10 text style11 style12" align="center" colspan="2" valign="middle"><strong>Usages</strong></td>
</tr>
<tr>   
    <td height="23" colspan="2" valign="middle" class="stylebottom style11">
<table border="0" width="99%"   align="center" cellpadding="0" cellspacing="0"  >
<tr>
    <td width="19%"  align="left" class="text" ><strong>&nbsp;Date</strong></td>
  
    <td width="22%"  align="left" class="text" ><strong>Invoice No</strong></td>
      
     <td width="24%"  align="left" class="text"><strong>Supplier</strong></td>

    <td width="22%"  align="left" class="text" ><strong>Particulars</strong></td>

    <td width="13%"  align="right" class="text"><strong>Qty</strong></td>
     <th width="10%"  align="right" class="text"><strong>Mtr Qty<strong></th>
    </tr>
    </table>    </td>
    <td  colspan="2" valign="middle" class="stylebottom style11 style12">
    <table border="0" width="99%"  align="center" cellpadding="0" cellspacing="0" >
    <tr>
   <td width="18%"  align="left" class="text"><strong>&nbsp;Date</strong></td>
  
   <td width="26%"  align="left" class="text"><strong>Jobcard No</strong></td>
      
   <td width="32%"  align="left" class="text"><strong>Particulars</strong></td>
   
   <td width="12%"  align="right" class="text"><strong>Width</strong></td>
      <td width="12%"  align="right" class="text"><strong>Height</strong></td>

   <td width="12%"  align="right" class="text"><strong>Qty</strong></td>
   <td width="12%"  align="right" class="text"><strong>Tot Req</strong></td>

<!--    <td width="9%"  align="right" class="text" ><strong>Qty</strong></td>
-->    </tr>
    </table>    </td>
    </tr>
<?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=""; }
if($to_date!=""){ $to_date1 = "DATE_FORMAT(media_date,'%Y-%m-%d')<='$to_date'";}else{$to_date1="";}
if($item_name4!=""){ $item_name41 = "particulars='$item_name4'";}else{$item_name41="";}

$all_value10 = $from_date1."@".$to_date1."@".$item_name41;
$all_array10 = explode('@',$all_value10);
foreach($all_array10 as $value10)
{ 
if($value10!='')
{
$get_query102 .= $value10." AND ";
}
} ?>
    <tr> 
    <td colspan="2" class="stylebottom style11" valign="top">
      <table border="0" width="100%"  align="center" cellpadding="0" cellspacing="0"  >
       <?php if($from_date!='')
{
 $sql="select sum(qty) as qty,entrydates,invoice_no,supplier_name,particulars,sum(mtr_roll) as mtr_roll from media_pur_sublist where $get_query102 id!=''  group by invoice_no,supplier_name,particulars,entrydates,mtr_roll order by particulars ASC ";
}
else
{  
  $sql="select sum(qty) as qty,entrydates,invoice_no,supplier_name,particulars,sum(mtr_roll) as mtr_roll from media_pur_sublist where DATE_FORMAT(media_date,'%Y-%m-%d')='$cur_date' group by invoice_no,supplier_name,particulars,entrydates,mtr_roll  order by particulars ASC ";

}
    $rs=mysql_query($sql);
	$rscount1=mysql_num_rows($rs);
	$s_no=0;
	if($rscount1!='')
	{
   		while($rsdata=mysql_fetch_array($rs))
  			{
   				 $s_no=$s_no+1;
				 $from=$from+1;
                 $id=$rsdata['id'];
                 $ink_pur_no=$rsdata['ink_pur_no'];
				 $invoice_no=$rsdata['invoice_no'];
				 $supplier_name=$rsdata['supplier_name'];
				 $particulars=$rsdata['particulars'];
				 $qty=$rsdata['qty'];
				 $mtr_roll=$rsdata['mtr_roll'];
			     $entrydates=$rsdata['entrydates'];
		 $tot_mtr=$rsdata['tot_mtr'];
		?>
        <tr>
          
          <td width="91" height="28" align="left" class="text" >&nbsp;<?php echo date("d-m-Y",strtotime($entrydates)); ?></td>
          
            <td width="103" align="left" class="text" >&nbsp;&nbsp;<?php  echo $invoice_no; ?></td>
            
            <td width="109" align="left" class="text" ><?php  echo $supplier_name; ?></td>
            
            <td width="105" align="left" class="text"  >&nbsp;&nbsp;<?php  echo $particulars; ?></td>
            
            <td width="62" align="right" class="text" ><?php  echo number_format($qty,2); ?>&nbsp;&nbsp;</td>
                <td width="62" align="right" class="text" ><?php  echo number_format($mtr_roll*$qty,2); ?>&nbsp;&nbsp;</td>
          </tr><?php $sum_tot+=$mtr_roll*$qty;
		  } 
		  } 
		  else 
		  {  ?>
    <tr>  
    <td width="91" height="29" align="left" class="text"></td>
  
    <td width="103" align="left" class="text"   ></td>
       
    <td width="109" align="left" class="text"  >No Usages</td>

    <td width="105" align="left" class="text"  ></td>

    <td width="62" align="right" class="text"  ></td>
    </tr>
<?php } ?>
        </table>    </td>
    <td colspan="2" class="stylebottom style11 style12"  valign="top"><table border="0" width="99%"  align="center" cellpadding="0" cellspacing="0" >
      <?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=""; }
if($to_date!=""){ $to_date1 = "DATE_FORMAT(media_date,'%Y-%m-%d')<='$to_date'";}else{$to_date1="";}
if($item_name4!=""){ $item_name41 = "roll_name='$item_name4'";}else{$item_name41="";}

$all_value10 = $from_date1."@".$to_date1."@".$item_name41;
$all_array10 = explode('@',$all_value10);
foreach($all_array10 as $value10)
{ 
if($value10!='')
{
$get_query105 .= $value10." AND ";
}
}	   ?>
      <?php if($from_date!='')
{
 $sql="select *  from media_sub_list where $get_query105 id!='' order by roll_name ASC ";
}
else
{  
  $sql="select * from media_sub_list where  DATE_FORMAT(media_date,'%Y-%m-%d')='$cur_date' order by roll_name 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'];
				 $jobcard_no=$rsdata['jobcard_no'];
				 $width=$rsdata['width'];
				 $roll_name=$rsdata['roll_name'];
				 $height=$rsdata['height'];
				  $tot_req_by=$rsdata['tot_req_by'];
				   $total_qty=$rsdata['plan_qty'];
				 $operator_name=$rsdata['operator_name'];
				
				
				
		?>
      <tr>
        <td width="92" height="29" align="left" class="text">&nbsp;<?php echo date("d-m-Y",strtotime($media_date)); ?></td>
        <td width="129" align="left" class="text"><?php  echo $jobcard_no; ?>
          &nbsp;&nbsp;</td>
        <td width="161" align="left" class="text"><?php  echo $roll_name; ?>
          &nbsp;&nbsp;</td>
        <td width="61" align="right" class="text"><?php  echo $width; ?>
          &nbsp;&nbsp;</td>
             <td width="61" align="right" class="text"><?php  echo $height; ?>
          &nbsp;&nbsp;</td>
        <td width="61" align="right" class="text"><?php  echo number_format($total_qty,2); ?></td>
                <td width="61" align="right" class="text"><?php  echo number_format($tot_req_by,2); ?></td>

      </tr>
      <?php $sum_tot2+=$total_qty;}
	} else { ?>
      <tr>
        <td width="92" height="29" align="left" class="text"></td>
        <td width="129" align="left" class="text"   ></td>
        <td width="161" align="left" class="text"  >No Usages</td>
        <td width="61" align="left" class="text"  ></td>
        <td width="61" align="left" class="text" ></td>
      </tr>
      <?php } ?>
    </table></td>
    </tr>
 <tr>
 <td colspan="2" class="stylebottom style11 ">
    <table border="0" width="99%"  align="center" cellpadding="0" cellspacing="0"  >
    <tr>
       <td height="28" colspan="5" align="right" class="text" ><strong>Total&nbsp;&nbsp;</strong></td>
          
          <td width="129" align="right" class="text" ><strong><?php  echo number_format($sum_tot,2); ?>&nbsp;&nbsp;</strong></td>
    </tr>
    </table> </td>
 <td colspan="2" class="stylebottom style12 style11">
    <table border="0" width="99%"  align="center" cellpadding="0" cellspacing="0">
    <tr>
       <td height="28" colspan="5" align="right" class="text"><strong>Total&nbsp;&nbsp;</strong></td>
          
          <td width="76" align="right" class="text"><strong><?php  echo number_format($sum_tot2,2); ?>&nbsp;&nbsp;</strong></td>
    </tr>
    </table> </td>
 </tr>
  </thead>
</table>
