-
Notifications
You must be signed in to change notification settings - Fork 0
/
pdfjahresendabrech.php
50 lines (42 loc) · 1.26 KB
/
pdfjahresendabrech.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
<?php
require('mysql_table.php');
class PDF extends PDF_MySQL_Table
{
function Header()
{
//Title
$this->SetFont('Arial','',18);
$this->Cell(0,6,'Jahresendabrechnung',0,1,'C');
$this->Ln(10);
//Ensure table header is output
parent::Header();
}
}
//Connect to database
mysql_connect('mysql.hostinger.de','u947198430_user','yes123');
mysql_select_db('u947198430_db');
$pdf=new PDF('L');
$pdf->AddPage();
$wasser = ("SELECT Kategorie, SUM(Betrag) AS Kosten
FROM Rechnungen
GROUP BY Kategorie
");
$total = ("SELECT SUM(Betrag) AS Totalnebenkosten
FROM Rechnungen
" );
//First table: put all columns automatically
$pdf->Table($wasser);
$pdf->Table($total);
//$pdf->AddPage();
//Second table: specify 3 columns
//$pdf->AddCol('Kategorie',40,'','C');
//$pdf->AddCol('Betrag',40,'','C');
//$prop=array('HeaderColor'=>array(255,150,100),
//'color1'=>array(210,245,255),
//'color2'=>array(255,255,210),
//'padding'=>2);
//$pdf->Table('SELECT Kategorie, SUM(Betrag) FROM `rechnungen` WHERE Kategorie =\'Wasser\'',$prop);
//$pdf->Output("C:\Users\John\Desktop/somename.pdf",'F');
$pdf->Output($downloadfilename.".pdf");
header('Location: '.$downloadfilename.".pdf");
?>