Files
2026-09-03 11:24:19 +02:00

124 lines
3.7 KiB
PHP

<?php session_start();
require_once('../fpdf/fpdf.php');
require_once('../language/polish.php');
class PDF extends FPDF
{
// Page header
function Header()
{
// Arial bold 15
$this -> SetFont('arial_ce', 'B', 15);
// Title
$title = iconv('utf-8','windows-1250','Lista zleceń ['.$_SESSION['site810_inDatefrom'].' - '.$_SESSION['site810_inDateto'].']');
$this->Cell(0,10,$title,0,0,'L');
// Line break
$this->Ln(15);
}
// Page footer
function Footer()
{
// Position at 1.5 cm from bottom
$this->SetY(-15);
// Arial italic 8
$this->SetFont('Arial','I',8);
// Page number
$this->Cell(0,10,'Strona '.$this->PageNo().'/{nb}',0,0,'R');
}
// Simple table
function BasicTable($header, $data)
{
// Header
$this->SetLineWidth(.1);
$this -> SetFont('arial_ce', 'B', 8);
$this->Cell(30,7,iconv('utf-8','windows-1250',$header['1']),1,0,'C');
$this->Cell(20,7,iconv('utf-8','windows-1250',$header['2']),1,0,'C');
$this->Cell(15,7,iconv('utf-8','windows-1250',$header['3']),1,0,'C');
$this->Cell(60,7,iconv('utf-8','windows-1250',$header['4']),1,0,'C');
$this->Cell(35,7,iconv('utf-8','windows-1250',$header['5']),1,0,'C');
$this->Cell(25,7,iconv('utf-8','windows-1250',$header['6']),1,0,'C');
$this->Ln();
// Data
$this -> SetFont('arial_ce', '', 7);
for($i=0;$i<count($data);$i++)
{
$this->Cell(30,6,iconv('utf-8','windows-1250',$data[$i]['orderNo']),1,0,'C');
$this->Cell(20,6,iconv('utf-8','windows-1250',$data[$i]['devName']),1,0,'C');
$this->Cell(15,6,iconv('utf-8','windows-1250',$data[$i]['bariera']),1,0,'C');
$this->Cell(60,6,iconv('utf-8','windows-1250',$data[$i]['orderScope']),1,0,'C');
$this->Cell(35,6,iconv('utf-8','windows-1250',$data[$i]['orderDate']),1,0,'C');
$this->Cell(25,6,iconv('utf-8','windows-1250',$data[$i]['orderStatus']),1,0,'C');
$this->Ln();
}
}
function FancyTable($header, $data)
{
// Colors, line width and bold font
$this->SetFillColor(255,255,0);
$this->SetTextColor(255);
$this->SetDrawColor(128,128,0);
$this->SetLineWidth(.1);
$this -> SetFont('arial_ce', 'B', 8);
// Header
$w = array(40, 35, 40, 45);
for($i=0;$i<count($header);$i++)
$this->Cell($w[$i],7,$header[$i],1,0,'C',true);
$this->Ln();
// Color and font restoration
$this->SetFillColor(234,234,234);
$this->SetTextColor(0);
$this -> SetFont('arial_ce', '', 8);
// Data
$fill = false;
foreach($data as $row)
{
$this->Cell($w[0],4,$row[0],'LR',0,'L',$fill);
$this->Cell($w[1],4,$row[1],'LR',0,'L',$fill);
$this->Cell($w[2],4,number_format($row[2]),'LR',0,'R',$fill);
$this->Cell($w[3],4,number_format($row[3]),'LR',0,'R',$fill);
$this->Ln();
$fill = !$fill;
}
// Closing line
$this->Cell(array_sum($w),0,'','T');
}
}
// Instanciation of inherited class
$pdf = new PDF();
$pdf->AddFont('arial_ce','','arial_ce.php');
$pdf->AddFont('arial_ce','I','arial_ce_i.php');
$pdf->AddFont('arial_ce','B','arial_ce_b.php');
$pdf->AddFont('arial_ce','BI','arial_ce_bi.php');
$pdf->AliasNbPages();
$pdf->AddPage();
//$pdf->SetFont('Times','',12);
$head = array(
'1'=>$lab_Field_site810_001,
'2'=>$lab_Field_site810_002,
'3'=>$lab_Field_site810_003,
'4'=>$lab_Field_site810_004,
'5'=>$lab_Field_site810_005,
'6'=>$lab_Field_site810_006
);
$pdf->BasicTable($head, $_SESSION['site810_array']);
$pdf->Output();
?>