
<?php
 
ini_set('session.gc_maxlifetime', 864000);

// it is now 7 days =  604800 seconds and can be increased.

session_set_cookie_params(864000);
 

session_start();
if (isset($_COOKIE['INT'])) {
  $_SESSION['INT'] = $_COOKIE['INT'];
  setcookie("INT", "", time()-3600);
}

if (isset($_COOKIE['CMT'])) {
  $_SESSION['CMT'] = $_COOKIE['CMT'];
  setcookie("CMT", "", time()-3600);
}

if (isset($_COOKIE['Ext'])) {
  $_SESSION['Ext'] = $_COOKIE['Ext'];
  setcookie("Ext", "", time()-3600);
}

if (isset($_COOKIE['ENG'])) {
  $_SESSION['ENG'] = $_COOKIE['ENG'];
  setcookie("ENG", "", time()-3600);
}
 
 
function Footer()
{
    // Position at 1.5 cm from bottom
    $pdf->SetY(-15);
    // Arial italic 8
    $pdf->SetFont('Arial','I',8);
    // Page number
    $pdf->Cell(0,5,'Page '.$this->PageNo().'/{nb}',0,0,'C');
}

//echo json_encode($result_array);
require_once dirname(__FILE__).'/fpdf.php' ;
require_once __DIR__  .'/FPDI/fpdi.php';


$textColour = array( 0, 0, 0 );
$headerColour = array( 100, 100, 100 );
$tableHeaderTopTextColour = array( 255, 255, 255 );
$tableHeaderTopFillColour = array( 125, 152, 179 );
$tableHeaderTopProductTextColour = array( 0, 0, 0 );
$tableHeaderTopProductFillColour = array( 143, 173, 204 );
$tableHeaderLeftTextColour = array( 99, 42, 57 );
$tableHeaderLeftFillColour = array( 184, 207, 229 );
$tableBorderColour = array( 50, 50, 50 );
$timezone = date_default_timezone_get();
$today = date("Y-m-d H:i:s"); 
$reportName = "Inspection Report - Generated on ".$today;
$reportNameYPos = 140;
//$logoFile = "widget-company-logo.png";
$logoXPos = 50;
$logoYPos = 108;
$logoWidth = 110;
//, "OM", "PHOSPHORUS", "POTASSUM", "SP","Texture"

$columnLabels = array( "EC", "Dist", "PH" , "OM", "PHO", "POT","Texture","latitude","longitude");
//$rowLabels = array( "EC", "Dist", "PH" , "OM", "PHO", "POT","Texture","latitude","longitude" );
$chartXPos = 20;
$chartYPos = 250;
$chartWidth = 160;
$chartHeight = 80;
$chartXLabel = "Crops";
$chartYLabel = "Prof";
$chartYStep = 20000;


$chartColours = array(
                  array( 255, 100, 100 ),
                  array( 100, 255, 100 ),
                  array( 100, 100, 255 ),
                  array( 255, 255, 100 ),
                );


 
$pdf = new Fpdi();
 
// $pdf->SetTextColor( $textColour[0], $textColour[1], $textColour[2] );

// $pdf->AddPage("L","A4");

// $pdf->setSourceFile('report.pdf');

// $tplIdx = $pdf->importPage(1);


// $pdf->useTemplate($tplIdx, 0, 0);
// $pdf->AliasNbPages(); 
// $pdf->SetFont( 'Arial', 'B', 24 );
// //$pdf->SetTextColor( 0, 96, 175);
// $pdf->SetTextColor( 0,0,0 ); 
// $pdf->Ln( 20 );
// $pdf->Cell( 0, 15, 'Nisan Dayz "X" 2019', 0, 0, 'C' );
// $pdf->Ln( $reportNameYPos );
// $pdf->SetFont( 'Arial', 'I', 18 );
// $pdf->Cell( 0, 15, $reportName, 0, 0, 'R' );

$pdf->AddPage("L","A4");

$pdf->setSourceFile('report.pdf');

$tplIdx = $pdf->importPage(1);

$pdf->useTemplate($tplIdx, 0, 0);

// $pdf->SetTextColor( $headerColour[0], $headerColour[1], $headerColour[2] );
// $pdf->SetFont( 'Arial', 'B', 24 );
// $pdf->SetTextColor( 0,0,0 ); 
// //$pdf->Cell( 0, 15, $reportName, 0, 2, 'L' );
// $pdf->SetTextColor( 0,0,0 ); 
// $pdf->SetFont( 'Arial', 'B', 17 ); 
// $pdf->Cell('',10,'Nisan Dayz "X" 2019',1,'','C');   

// $pdf->Ln(16);
$pdf->SetFont( 'Arial', 'B', 18 );
$pdf->Cell( 0, -10, 'Nisan Dayz "X" 2019', 0, 0, 'C' );
$image1 = "images/".$_GET['stock']."/1.png"; 
 
$pdf->Image($image1,5,20,290,170,'PNG');
 
 
// $pdf->AddPage("L","A4");

// $pdf->setSourceFile('report.pdf');

// $tplIdx = $pdf->importPage(1);

// $pdf->useTemplate($tplIdx, 0, 0);

// $pdf->SetTextColor( $headerColour[0], $headerColour[1], $headerColour[2] );
// $pdf->SetFont( 'Arial', 'B', 24 );
// $pdf->SetTextColor( 0,0,0 );
// $pdf->Ln( 12 );
// //$pdf->Cell( 0, 15, $reportName, 0, 2, 'L' );
// $pdf->SetTextColor( 0,0,0 ); 
// $pdf->SetFont( 'Arial', 'B', 17 ); 
// $pdf->Cell('',10,'Nisan Dayz "X" 2019',1,'','C');   

// $pdf->Ln(16);

// $image1 = "cbimage.png";
// //$pdf->Cell(' ', 40,"", 0, 0, 'L', false );
// $pdf->Image( $image1,5,50,'','','PNG'); 
 
 
// $pdf->AddPage("L","A4");

// $pdf->setSourceFile('report.pdf');

// $tplIdx = $pdf->importPage(1);

// $pdf->useTemplate($tplIdx, 0, 0);

// $pdf->SetTextColor( $headerColour[0], $headerColour[1], $headerColour[2] );
// $pdf->SetFont( 'Arial', 'B', 24 );
// $pdf->SetTextColor( 0,0,0 );
// $pdf->Ln( 12 );
// //$pdf->Cell( 0, 15, $reportName, 0, 2, 'L' );
// $pdf->SetTextColor( 0,0,0 ); 
// $pdf->SetFont( 'Arial', 'B', 17 ); 
// $pdf->Cell('',10,'Nisan Dayz "X" 2019',1,'','C');   

// $pdf->Ln(16);

// $image1 = "test.png";
// //$pdf->Cell(' ', 40,"", 0, 0, 'L', false );
// $pdf->Image( $image1,5,50,'','','PNG');
 
$pdf->Output( "Report.pdf", "I" );

?>


