-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathinvoice_a4.php
More file actions
206 lines (186 loc) · 5.88 KB
/
Copy pathinvoice_a4.php
File metadata and controls
206 lines (186 loc) · 5.88 KB
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
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
<?php
/*
* (C)2016 by Tim Rühsen
* License: MIT style license, see LICENSE
*/
class item {
public $name;
public $description;
public $units;
public $unitprice;
public function __construct(Array $value = array()) {
$this->name = $value[0];
$this->description = $value[1];
$this->units = $value[2];
$this->unitprice = $value[3];
}
}
function de_float($number) {
return number_format($number, 2, ',', '.');
}
function currency($number) {
return de_float($number) . " €";
}
require 'config.php';
require 'receiver.php';
/*
$orderDate = "03/2016";
$orderId = "RE/190416/1";
// Leistungsempfänger
$receiver_company = "Muster GmbH";
$receiver_name = "Max Mustermann";
$receiver_street = "Musterstraße 55";
$receiver_postal = "20123 Musterstadt";
$receiver_country = "";
$receiver_custid = 100;
// Rechnungspositionen
$items = array(
new item(array("Outbound","Nutzung pro Minute ausgehend",753.6,0.02)),
new item(array("IVR","IVR Dienste pro Minute eingehend",75.57,0.03)),
new item(array("Intro","Nutzung pro Minute eingehend",14.06,0.03)),
new item(array("Passiv","Passiv Nutzung pro Minute eingehend",3421.43,0.05)),
new item(array("Chat","Tarif 29ct",4723,0.29)),
new item(array("Chat","Tarif 32ct",3940.12,0.32)),
);
*/
$price = 0;
$subTotalPrice = 0;
?>
<!DOCTYPE html>
<html>
<head>
<title>Invoice Template</title>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<style>
page { size:A4; margin-left:auto; margin-right:auto; }
html { height:100%; }
body { margin-left:2.2cm; margin-right:1cm; }
table { border-collapse:collapse; border-spacing:0; border:0; width:100%; }
th, td { padding:0; }
@media print { footer {page-break-after:always; } }
.foldmark { position:absolute; background-color:black; height:1px; width:3mm; left:4mm; }
</style>
</head>
<body>
<div class="foldmark" style="top:35.35%;"></div>
<div class="foldmark" style="top:70.70%;"></div>
<div style="width:100%; height:5.1cm; background:url(<?php echo $logoImage ?>) right center no-repeat;"></div>
<div style="font-size:100%; font-family:Helvetica, sans-serif; float:left; width:100%;">
<table>
<tr>
<td><span style="width:70%; font-size:65%; text-decoration:underline;"><?php
echo $sender_company . " · ";
echo $sender_street . " · ";
echo $sender_zip . " " . $sender_city;
echo "</span><br><br>";
echo $receiver_company ? "<strong>" . $receiver_company . "</strong><br>" : "";
echo $receiver_name ? $receiver_name . "<br>" : "";
echo $receiver_street ? $receiver_street . "<br><br>" : "<br>";
echo $receiver_postal ? $receiver_postal . "<br>" : "";
echo $receiver_country ? $receiver_country . "<br>" : "<br>";
?>
<br><br><br><br><br>
</td>
<td style="width:30%; vertical-align:top;">
<?php
echo "<strong>" . $sender_company . "</strong><br>";
echo $sender_street . "<br>";
echo $sender_zip . " " . $sender_city . "<br>";
?>
<br>
<table>
<?php echo "<tr><td><strong>fon</strong></td><td>" . $sender_fon . "</td></tr>"; ?>
<?php echo "<tr><td><strong>fax</strong></td><td>" . $sender_fax . "</td></tr>"; ?>
<?php echo "<tr><td><strong>eml</strong></td><td>" . $sender_eml . "</td></tr>"; ?>
<?php echo "<tr><td><strong>www</strong></td><td>" . $sender_www . "</td></tr>"; ?>
</table>
</td>
</tr>
</table>
<table>
<tr>
<td style="font-size: 100%; font-weight: bold;">
<?php echo "Rechnung " . $orderId; ?>
</td>
<td style="text-align:right; font-size: 90%;">
<?php echo $sender_city . ", den " . date("d.m.Y"); ?>
</td>
</tr>
<tr>
<td colspan="2" style="border-bottom: 1px solid #000;">
<br>
KundenNr.: <?php echo $receiver_custid; ?><br>
Zeitraum: <?php echo $orderDate; ?><br>
<br><br>
</td>
</tr>
</table>
<table>
<tr style="font-weight: bold;">
<td style="width:15%;">Artikel</td>
<td style="width:45%;">Beschreibung</td>
<td style="width:10%; text-align:right;">Menge</td>
<td style="width:15%; text-align:right;">Einzelpreis</td>
<td style="width:15%; text-align:right;">Preis</td>
</tr>
<tr>
<td colspan="5" style="border-top:1px solid #000;"> </td>
</tr>
<?php foreach( $items as $item ):
$price = $item->units * $item->unitprice;
$subTotalPrice = $subTotalPrice + $price;
?>
<tr>
<td><?php echo $item->name; ?></td>
<td><?php echo $item->description; ?></td>
<td style="text-align:right;"><?php echo de_float($item->units); ?></td>
<td style="text-align:right;"><?php echo currency($item->unitprice); ?></td>
<td style="text-align:right;"><?php echo currency($price); ?></td>
</tr>
<?php endforeach; ?>
<tr>
<td colspan="5" style="border-bottom:1px solid #000;"> </td>
</tr>
<tr>
<td colspan="5"> </td>
</tr>
<tr>
<td colspan="4" style="text-align:right;">Nettobetrag</td>
<td style="text-align:right;"><?php echo currency($subTotalPrice); ?></td>
</tr>
<tr>
<td colspan="4" style="text-align:right;">Umsatzsteuer <?php echo $tax . "%";?></td>
<td style="text-align:right;"><?php echo currency($subTotalPrice * $tax / 100); ?></td>
</tr>
<tr>
<td colspan="5" style="border-bottom: 1px solid #000;"> </td>
</tr>
<tr>
<td colspan="5"> </td>
</tr>
<tr>
<td colspan="4" style="text-align:right; font-weight:bold;">Rechnungsbetrag</td>
<td style="text-align:right; font-weight:bold;"><?php echo currency(round($subTotalPrice,2) + round($subTotalPrice * $tax / 100,2)); ?></td>
</tr>
</table>
<br><br><br>
<table>
<tr>
<td style="font-weight:bold;"><u>Hinweise</u></td>
</tr>
<tr>
<td>
<br>
Der Rechnungsbetrag ist zahlbar innerhalb 14 Tagen ohne Abzug.<br>
Irrtum und Änderungen vorbehalten. Es gelten unsere AGB.<br><br><br>
Vielen Dank für Ihren Auftrag.
</td>
</tr>
</table>
<footer style="position:fixed; bottom:5mm; left:0; font-size: 70%; font-weight: bold; text-align: center; width: 100%; vertical-align:bottom;">
<?php echo $sender_footer; ?>
</footer>
</div>
</body>
</html>