<?php 
if(!isset($_SESSION)) { 
  session_start(); 
  include('../includes/dbcon.php');
}
if(empty($_SESSION['hrm_id'])):
header('Location:../index.php');
endif;

include 'fpdf.php';
include 'exfpdf.php';
include 'easyTable.php';


$pp=' ' ;
$pdf=new exFPDF();
$pdf->AliasNbPages();
$pdf->addPage('L');

$pdf->SetFont('helvetica','',10);

$table1=new easyTable($pdf, 2);
$table1->easyCell($pp, 'font-size:20; font-style:B; font-color:#00bfff;');

$table1->printRow();

 $table1->rowStyle('font-size:12; ');
 $table1->easyCell("<b>Item Stock Report/b> ");



$table1->endTable(5);
 $table=new easyTable($pdf, '{8,40,90,30,15,30,40,20}','align:C{LLLLLLLR};border:1; border-color:#a1a1a1; ');

 $table->rowStyle('align:{CCCC};valign:M;bgcolor:#2D4F85; font-color:#ffffff; font-family:times; font-style:B;');

 $table->easyCell('#');
 $table->easyCell('Part Number');
 $table->easyCell('Description');
 $table->easyCell('Brand');
 $table->easyCell('Country');
 $table->easyCell('Sales Price');
 $table->easyCell('QOH');
 
 
 $table->printRow();

$rcount=0;

 $query=mysqli_query($con,"SELECT * from view_item_master where qoh<>0")or die(mysqli_error()); 

 while($row=mysqli_fetch_array($query)){   $rcount=$rcount+1;

                $item_name=$row['item_name']; 
                 $item_id=$row['item_id']; 
                $description=$row['description']; 
                $cat_des=$row['cat_des'];
                $type_des=$row['type_des'];
                $sp=$row['sales_price'];
                $cp=$row['cost_price'];
                $qoh=$row['qoh'];
                $rol=$row['rol'];
                 $cat_id=$row['cat_id'];
                  $type_id=$row['type_id'];
                 $case_id=$row['case_id'];
                 $Weight=$row['Weight'];
                  $unit_des=$row['unit_des'];
                   $b_des=$row['b_des'];
                    $country_des=$row['country_des'];


        
          $table->easyCell($rcount);
            $table->easyCell($item_name);
               $table->easyCell($description);
                $table->easyCell($b_des);  
                $table->easyCell($country_des);  
                 $table->easyCell($sp); 
          $table->easyCell($qoh);  
           
              
        
                               
          $table->printRow();



}







 $pdf->Cell(0,10,'Page '.$pdf->PageNo().'/{nb}',0,0,'C');
$pdf->Output(); 