<style>
body {
font-family: "Lucida Sans Unicode", "Lucida Grande", Sans-Serif;
font-size: 14px;
}
h1 {
font-size: 20px;
vertical-align: top;
}

table.pagehead {
  width: 100%;

}

table.pagebody {
  width: 100%;

}

table.pagebody td, table.pagebody th
{
  border:1px solid #000;
}

</style>

<div align="center"><img src="<?php echo base_url() ?>assets/img/shared/printimage.jpg"  align="center" valign="top" alt="Posics Technologies" width="220" height="60"/><br>
             <?php echo $companyinfo->COMPANYNAME.', '.$companyinfo->ADDRESS1.', '; ?><br>
               <?php echo $companyinfo->ADDRESS2.', '.$companyinfo->CITY.', '.$companyinfo->REGION ; ?>
                    <br>
                    Phone: <?php echo $companyinfo->PHONE1.', '.$companyinfo->PHONE2.', Fax: '.$companyinfo->FAX ?>
                    <br>
                     Email: <?php echo $companyinfo->EMAIL.', Web: '.$companyinfo->WEBSITE?>
<h3><u><big><?php echo $reporttitle ?> </big></u></h3></div>
<table class="pagehead" cellspacing="0">
<tbody>
<tr>
        <td width="30%" align="right">
        Date: <?php echo date('d-m-Y', time()); ?><br>
               <br>
        </td>

</tr>

</tbody>
</table>


<?php
echo "<table class='pagebody' cellspacing='0' cellpadding='5'>";
echo "<tbody>";
echo "<thead><tr>";
if ($columns) {

$xml = simplexml_load_string(htmlspecialchars_decode($columns));
foreach ($xml as $key => $value) {
foreach($value as $col)
{
echo '<th width="'.$col['width'].'" align="'.$col['align'].'" class="bborder">'.$col['title'].'</th>';
}
}

}
echo '<thead><tr>';

$totallines=0;
$LINETOTAL=0;
$LINETOTAL1=0;
foreach ($reportdata as $value) {
$totallines=$totallines+1;
echo "<tr>";
foreach ($xml as $key => $colvalue) {
foreach($colvalue as $col)
{
if($col['type'] && $col['type']=='currency' )
{
echo '<td width="'.$col['width'].'" align="'.$col['align'].'" class="rborder">'.number_format($value->$col['field'],2).'</td>';
if($col['sum']=='true' && $reporttitle == 'Warehouse' && $col['title'] == 'Sell')
{
    $LINETOTAL1 = $LINETOTAL1+($value->$col['field']);
}
}
else {
echo '<td width="'.$col['width'].'" align="'.$col['align'].'" class="rborder">'.$value->$col['field'].'</td>';
if($col['sum']=='true' && $reporttitle == 'Warehouse' && $col['title'] == 'Sell')
{
    $LINETOTAL1 = $LINETOTAL1+($value->$col['field']);
}
}
}
}
echo "</tr>";

if($col['sum']=='true'  )
{
    $LINETOTAL = $LINETOTAL+($value->$col['field']);
   
}
     } 

echo "</tbody>";
echo "</table>";
if($col['sum']=='true'  ){
    echo "<table align='right'>";
echo "<tbody>";
if($reporttitle!='Warehouse')
{
echo "<tr>
             <td><b>Grand Total:".$this->formatslist->formatCurrencywithHash($LINETOTAL)."</b></td>
  
    </tr>";
}
if($reporttitle=='Warehouse')
{
    echo "<tr>
             <td><b>Total Cost:".$this->formatslist->formatCurrencywithHash($LINETOTAL)."</b></td>
  
    </tr>";
    echo "<tr>
             <td><b>Total Sell:".$this->formatslist->formatCurrencywithHash($LINETOTAL1)."</b></td>
  
    </tr>";
}
  echo "</tbody>";
echo "</table>";}
?>

