1093 |
daniel |
1 |
<?php
|
|
|
2 |
|
|
|
3 |
/**
|
|
|
4 |
* Template für die PDF Rechnung
|
|
|
5 |
*/
|
|
|
6 |
|
|
|
7 |
include dirname(__FILE__).'/../../../lib/fpdf/fpdf.php';
|
|
|
8 |
include dirname(__FILE__).'/../../../lib/fpdf/fpdi.php';
|
|
|
9 |
include dirname(__FILE__).'/../../../mods/mod_rechnungen/wpsg_fpdf.class.php';
|
|
|
10 |
|
|
|
11 |
global $absender_left, $absender_top;
|
|
|
12 |
|
|
|
13 |
// Positionierung der Absenderadresszeile
|
|
|
14 |
$absender_left = 25;
|
|
|
15 |
$absender_top = 50;
|
|
|
16 |
|
|
|
17 |
// Positionierung der Zieladress
|
|
|
18 |
$adress_left = 25;
|
|
|
19 |
$adress_top = 55;
|
|
|
20 |
|
|
|
21 |
// Positionierund des Rechnungskopfes
|
|
|
22 |
$rdata_left = 25;
|
|
|
23 |
$rdata_top = 90;
|
|
|
24 |
|
|
|
25 |
// Positionierung der Produktdaten
|
|
|
26 |
$prod_left = 25;
|
|
|
27 |
$prod_top = 105;
|
|
|
28 |
|
|
|
29 |
// Anzahl an Produkten pro Seite
|
|
|
30 |
$prod_break = 15;
|
|
|
31 |
|
|
|
32 |
$cur = $this->get_option("wpshopgermany_currency");
|
|
|
33 |
|
|
|
34 |
function AddRechnungPage($shop, $pdf)
|
|
|
35 |
{
|
|
|
36 |
|
|
|
37 |
global $absender_left, $absender_top;
|
|
|
38 |
|
|
|
39 |
$pdf->AddPage();
|
|
|
40 |
|
|
|
41 |
if (file_exists($shop->callMod('wpsg_mod_rechnungen', getFilePath, array(''))."wpsg_rechnungen_bp.pdf"))
|
|
|
42 |
{
|
|
|
43 |
|
|
|
44 |
$pagecount = $pdf->setSourceFile($shop->callMod('wpsg_mod_rechnungen', getFilePath, array(''))."wpsg_rechnungen_bp.pdf");
|
|
|
45 |
$tplidx = $pdf->importPage(1, '/MediaBox');
|
|
|
46 |
$pdf->useTemplate($tplidx, 0, 0, 210);
|
|
|
47 |
|
|
|
48 |
}
|
|
|
49 |
if (file_exists($shop->callMod('wpsg_mod_rechnungen', getFilePath, array(''))."wpsg_rechnungen_bp.jpg"))
|
|
|
50 |
{
|
|
|
51 |
$pdf->image($shop->callMod('wpsg_mod_rechnungen', getFilePath, array(''))."wpsg_rechnungen_bp.jpg", 0, 0, 210, 297, 'jpg');
|
|
|
52 |
}
|
|
|
53 |
|
|
|
54 |
|
|
|
55 |
if (file_exists($shop->callMod('wpsg_mod_rechnungen', getFilePath, array(''))."wpsg_rechnungen_logo.jpg"))
|
|
|
56 |
{
|
|
|
57 |
|
|
|
58 |
list($width, $height, $type, $attr) = getimagesize($shop->callMod('wpsg_mod_rechnungen', getFilePath, array(''))."wpsg_rechnungen_logo.jpg");
|
|
|
59 |
|
|
|
60 |
//wpsg_debug($width.":".$height);
|
|
|
61 |
|
|
|
62 |
$wPix = (25.4 * $width) / 96;
|
|
|
63 |
$hPix = (25.4 * $height) / 96;
|
|
|
64 |
|
|
|
65 |
$pdf->image($shop->callMod('wpsg_mod_rechnungen', getFilePath, array(''))."wpsg_rechnungen_logo.jpg", 210 - $wPix, 0, $wPix, $hPix);
|
|
|
66 |
|
|
|
67 |
}
|
|
|
68 |
|
|
|
69 |
// Absenderadresszeile (Wird in der Konfiguration hinterlegt)
|
|
|
70 |
$pdf->SetFont('Arial', '', 6);
|
|
|
71 |
$pdf->Text($absender_left, $absender_top, $shop->get_option("wpsg_rechnungen_adresszeile"));
|
|
|
72 |
return;
|
|
|
73 |
if ($mod->kunde['land_krzl'] != "") $mod->kunde['land_krzl'] = $mod->kunde['land_krzl'].'-';
|
|
|
74 |
|
|
|
75 |
// Adresse des Kunden
|
|
|
76 |
$pdf->SetFont('Arial', '', 12);
|
|
|
77 |
$pdf->Text($adress_left, $adress_top, $mod->kunde['firma']);
|
|
|
78 |
$pdf->Text($adress_left, $adress_top + 5, $mod->kunde['vname'].' '.$mod->kunde['name']);
|
|
|
79 |
$pdf->Text($adress_left, $adress_top + 10, $mod->kunde['strasse'].' '.$mod->kunde['hausnr']);
|
|
|
80 |
$pdf->Text($adress_left, $adress_top + 15, $mod->kunde['land_krzl'].$mod->kunde['plz'].' '.$mod->kunde['ort']);
|
|
|
81 |
|
|
|
82 |
// Wenn Gutschrift und Option aktiviert dann die Rechnungsnummer hinter die Gutschriftsnummer
|
|
|
83 |
if (get_option("wpsg_mod_rechnungen_showgutschriftrechnung") == "1" && $bGutschrift)
|
|
|
84 |
{
|
|
|
85 |
|
|
|
86 |
$mod->rnr .= ' ('.__("RNr.", "wpsg").' '.$mod->last_nr.')';
|
|
|
87 |
|
|
|
88 |
}
|
|
|
89 |
|
|
|
90 |
// Rechnungsdaten
|
|
|
91 |
$pdf->SetFont('Arial', 'B', 16);
|
|
|
92 |
$pdf->Text($rdata_left, $rdata_top, $strTitle);
|
|
|
93 |
$pdf->SetFont('Arial', 'B', 9);
|
|
|
94 |
$pdf->Text($rdata_left, $rdata_top + 6, $mod->rnr.' '.(($mod->preview)?__("Vorschau", "wpsg"):""));
|
|
|
95 |
$pdf->SetFont('Arial', '', 9);
|
|
|
96 |
|
|
|
97 |
if (!$bGutschrift)
|
|
|
98 |
{
|
|
|
99 |
|
|
|
100 |
if ($mod->showFaelligkeit == true)
|
|
|
101 |
{
|
|
|
102 |
$pdf->Text($rdata_left + 35, $rdata_top, __("Fällig am", "wpsg"));
|
|
|
103 |
$pdf->Text($rdata_left + 35, $rdata_top + 6, $mod->faelligkeitdatum);
|
|
|
104 |
}
|
|
|
105 |
|
|
|
106 |
$pdf->Text($rdata_left + 55, $rdata_top, __("Zahlungsbedingungen", "wpsg"));
|
|
|
107 |
$pdf->Text($rdata_left + 55, $rdata_top + 6, $mod->zahlung);
|
|
|
108 |
|
|
|
109 |
}
|
|
|
110 |
|
|
|
111 |
$pdf->Text($rdata_left + 100, $rdata_top, __("Kunden-Nr", "wpsg"));
|
|
|
112 |
$pdf->Text($rdata_left + 100, $rdata_top + 6, $mod->kunde['id']);
|
|
|
113 |
|
|
|
114 |
$pdf->Text($rdata_left + 125, $rdata_top, __("Best. Nr.", "wpsg"));
|
|
|
115 |
$pdf->Text($rdata_left + 125, $rdata_top + 6, ((trim($mod->order['onr']) != '')?$mod->order['onr']:$mod->order['id']));
|
|
|
116 |
|
|
|
117 |
$pdf->Text($rdata_left + 145, $rdata_top, __("Datum", "wpsg"));
|
|
|
118 |
$pdf->Text($rdata_left + 145, $rdata_top + 6, $mod->rDatum);
|
|
|
119 |
|
|
|
120 |
if ($mod->controller->noMwSt)
|
|
|
121 |
{
|
|
|
122 |
|
|
|
123 |
$pdf->SetFont('Arial', '', 9);
|
|
|
124 |
$pdf->Text($adress_left, $rdata_top + 11.5, __("Innergemeinschaftliche Lieferung.", "wpsg"));
|
|
|
125 |
|
|
|
126 |
}
|
|
|
127 |
|
|
|
128 |
// Benutzerdefinierte Felder
|
|
|
129 |
$arTexte = get_option("wpsg_mod_rechnungen_texte");
|
|
|
130 |
|
|
|
131 |
foreach ((array)$arTexte as $text)
|
|
|
132 |
{
|
|
|
133 |
|
|
|
134 |
if (isset($text['aktiv']) && $text['aktiv'] == 1)
|
|
|
135 |
{
|
|
|
136 |
|
|
|
137 |
$pdf->SetFont('Arial', 'B', ((intval($text['fontsize']) > 0)?intval($text['fontsize']):10));
|
|
|
138 |
$pdf->SetTextColor($text['color']);
|
|
|
139 |
$pdf->MultiCell($text['x'], $text['y'], 5, utf8_encode($text['text']));
|
|
|
140 |
$pdf->SetTextColor("#000000");
|
|
|
141 |
|
|
|
142 |
}
|
|
|
143 |
|
|
|
144 |
}
|
|
|
145 |
|
|
|
146 |
}
|
|
|
147 |
|
|
|
148 |
$pdf = new wpsg_fpdf();
|
|
|
149 |
$pdf->SetAutoPageBreak(true, 5);
|
|
|
150 |
AddRechnungPage($this, $pdf);
|
|
|
151 |
|
|
|
152 |
$summe = 0;
|
|
|
153 |
|
|
|
154 |
$bKopf = false; $pnr = 1; $offset = 0; $count = 0;
|
|
|
155 |
foreach ($this->view['basket']['produkte'] as $p)
|
|
|
156 |
{
|
|
|
157 |
|
|
|
158 |
if (!$bKopf)
|
|
|
159 |
{
|
|
|
160 |
|
|
|
161 |
$pdf->SetFont('Arial', 'B', 9);
|
|
|
162 |
$pdf->setXY($prod_left, $prod_top);
|
|
|
163 |
$pdf->Cell(10, 8, __("Nr.", "wpsg"), 1, 0, 'C');
|
|
|
164 |
|
|
|
165 |
$pdf->setXY($prod_left + 10, $prod_top);
|
|
|
166 |
$pdf->Cell( ((sizeof($this->view['basket']['mwst']) > 1 || $this->get_option('wpsg_showMwstAlways') == '1')?102:87), 8, "Name", 1, 0, 'L');
|
|
|
167 |
|
|
|
168 |
if (sizeof($this->view['basket']['mwst']) > 1 || $this->get_option('wpsg_showMwstAlways') == '1')
|
|
|
169 |
{
|
|
|
170 |
|
|
|
171 |
$pdf->setXY($prod_left + 97, $prod_top);
|
|
|
172 |
$pdf->Cell(15, 8, __("MwSt.", "wpsg"), 1, 0, 'R');
|
|
|
173 |
|
|
|
174 |
}
|
|
|
175 |
|
|
|
176 |
$pdf->setXY($prod_left + 112, $prod_top);
|
|
|
177 |
$pdf->Cell(15, 8, __("Menge", "wpsg"), 1, 0, 'C');
|
|
|
178 |
|
|
|
179 |
$pdf->setXY($prod_left + 127, $prod_top);
|
|
|
180 |
$pdf->Cell(25, 8, __("Einzelpreis", "wpsg"), 1, 0, 'R');
|
|
|
181 |
|
|
|
182 |
$pdf->setXY($prod_left + 152, $prod_top);
|
|
|
183 |
$pdf->Cell(25, 8, __("Gesamtpreis", "wpsg"), 1, 0, 'R');
|
|
|
184 |
|
|
|
185 |
$offset = 8;
|
|
|
186 |
$bKopf = true;
|
|
|
187 |
|
|
|
188 |
}
|
|
|
189 |
|
|
|
190 |
$pdf->SetFont('Arial', '', 9);
|
|
|
191 |
$pdf->setXY($prod_left, $prod_top + $offset);
|
|
|
192 |
$pdf->Cell(10, 8, $pnr.".", 0, 0, 'C');
|
|
|
193 |
|
|
|
194 |
$produkt_text = $p['name'];
|
|
|
195 |
$produktBeschreibung = trim(strip_tags($p['beschreibung']));
|
|
|
196 |
|
|
|
197 |
if ($this->isOtherLang())
|
|
|
198 |
{
|
|
|
199 |
|
|
|
200 |
/*
|
|
|
201 |
* TODO: Übersetzung
|
|
|
202 |
$trans_db = $this->controller->db->fetchRow("SELECT * FROM `".$this->controller->tbl_pr."` WHERE `lang_parent` = '".wpsg_q($p['produkt_id'])."' AND `lang_locale` = '".wpsg_q(get_locale())."'");
|
|
|
203 |
if (is_array($trans_db) && sizeof($trans_db) > 0)
|
|
|
204 |
{
|
|
|
205 |
|
|
|
206 |
$produkt_text = $trans_db['name'];
|
|
|
207 |
$produktBeschreibung = trim(strip_tags($p['beschreibung']));
|
|
|
208 |
|
|
|
209 |
}
|
|
|
210 |
*/
|
|
|
211 |
|
|
|
212 |
}
|
|
|
213 |
|
|
|
214 |
$height = 0; // Höhe der Zeile für den Rahmen
|
|
|
215 |
|
|
|
216 |
$pdf->setXY($prod_left + 10, $prod_top + $offset);
|
|
|
217 |
|
|
|
218 |
// Produktvariablen
|
|
|
219 |
// TODO:Produktvariablen in Rechnung
|
|
|
220 |
/*
|
|
|
221 |
if (array_key_exists("mod_produktvars", $this->controller->mods) && get_option("wpsg_mod_rechnungen_showpv") == "1")
|
|
|
222 |
{
|
|
|
223 |
|
|
|
224 |
if (array_key_exists("mod_produktvars", $this->controller->mods))
|
|
|
225 |
{
|
|
|
226 |
|
|
|
227 |
$pvars = @unserialize($this->order['pvars']);
|
|
|
228 |
if (!is_array($pvars)) $pvars = array();
|
|
|
229 |
|
|
|
230 |
if (array_key_exists($p['produkt_id'], $pvars))
|
|
|
231 |
{
|
|
|
232 |
|
|
|
233 |
foreach ($pvars[$p['produkt_id']] as $pvars_id => $pvars_value)
|
|
|
234 |
{
|
|
|
235 |
|
|
|
236 |
$pvars_name = $this->controller->mods['mod_produktvars']->getNameFromID($pvars_id);
|
|
|
237 |
|
|
|
238 |
$produkt_text .= "\r\n".$pvars_name.": ".$pvars_value;
|
|
|
239 |
$height += 5;
|
|
|
240 |
|
|
|
241 |
}
|
|
|
242 |
|
|
|
243 |
}
|
|
|
244 |
|
|
|
245 |
}
|
|
|
246 |
|
|
|
247 |
}
|
|
|
248 |
*/
|
|
|
249 |
|
|
|
250 |
$produkt_text_width = $pdf->GetStringWidth($produkt_text);
|
|
|
251 |
$produkt_text_cell_width = (($this->arMwSt == "-1")?102:87);
|
|
|
252 |
|
|
|
253 |
$height = 5 * ceil($produkt_text_width / $produkt_text_cell_width) + 3;
|
|
|
254 |
|
|
|
255 |
$pdf->MultiCell($prod_left + 10, $prod_top + $offset + 1.5, 5, utf8_encode($produkt_text), 0, 'L', 0, $produkt_text_cell_width);
|
|
|
256 |
//$pdf->Cell((($this->arMwSt == "-1")?102:87), 8, $produkt_text, 0, 0, 'L');
|
|
|
257 |
|
|
|
258 |
if (sizeof($this->view['basket']['mwst']) > 1 || $this->get_option('wpsg_showMwstAlways') == '1')
|
|
|
259 |
{
|
|
|
260 |
|
|
|
261 |
$pdf->setXY($prod_left + 97, $prod_top + $offset);
|
|
|
262 |
$pdf->Cell(15, 8, (($this->view['basket']['noMwSt'] == '1')?0:wpsg_ff($p['mwst_value'], '%')), 0, 0, 'R');
|
|
|
263 |
|
|
|
264 |
}
|
|
|
265 |
|
|
|
266 |
$pdf->setXY($prod_left + 112, $prod_top + $offset);
|
|
|
267 |
$pdf->Cell(15, 8, $p['menge'], 0, 0, 'C');
|
|
|
268 |
|
|
|
269 |
if ($this->get_option('wpsg_preisangaben_frontend') == WPSG_BRUTTO || $this->get_option('wpsg_kleinunternehmer') == '1')
|
|
|
270 |
{
|
|
|
271 |
$preis = $p['preis_brutto'];
|
|
|
272 |
}
|
|
|
273 |
else
|
|
|
274 |
{
|
|
|
275 |
$preis = $p['preis_netto'];
|
|
|
276 |
}
|
|
|
277 |
|
|
|
278 |
$pdf->setXY($prod_left + 127, $prod_top + $offset);
|
|
|
279 |
$pdf->Cell(25, 8, wpsg_ff($preis, $this->get_option('wpsg_currency')), 0, 0, 'R');
|
|
|
280 |
|
|
|
281 |
$pdf->setXY($prod_left + 152, $prod_top + $offset);
|
|
|
282 |
$pdf->Cell(25, 8, wpsg_ff($preis * $p['menge'], $this->get_option('wpsg_currency')), 0, 0, 'R');
|
|
|
283 |
|
|
|
284 |
/**
|
|
|
285 |
* Produktbeschreibung anzeigen Ja/Nein
|
|
|
286 |
*/
|
|
|
287 |
$pBeschreibungHeight = 0;
|
|
|
288 |
if ($this->get_option("wpsg_rechnungen_pbeschreibung") == "1" && trim(strip_tags($p['beschreibung'])) != '')
|
|
|
289 |
{
|
|
|
290 |
|
|
|
291 |
$pBeschreibungWidth = $pdf->getStringWidth($produktBeschreibung);
|
|
|
292 |
|
|
|
293 |
$pBeschreibungHeight = 5 * ceil($pBeschreibungWidth / $produkt_text_cell_width);
|
|
|
294 |
|
|
|
295 |
$pdf->SetFont('Arial', 'I', 9);
|
|
|
296 |
$pdf->MultiCell($prod_left + 10, $prod_top + $height + $offset - 1.5, 5, utf8_encode($produktBeschreibung), 0, 'L', 0, $produkt_text_cell_width);
|
|
|
297 |
$pdf->SetFont('Arial', '', 9);
|
|
|
298 |
|
|
|
299 |
}
|
|
|
300 |
|
|
|
301 |
$height += $pBeschreibungHeight;
|
|
|
302 |
|
|
|
303 |
// Jetzt die Rahmen zeichnen
|
|
|
304 |
$pdf->Rect($prod_left, $prod_top + $offset, 10, $height);
|
|
|
305 |
|
|
|
306 |
$pdf->Rect($prod_left + 10, $prod_top + $offset, ((sizeof($this->view['basket']['mwst']) > 1 || $this->get_option('wpsg_showMwstAlways') == '1')?102:87), $height);
|
|
|
307 |
|
|
|
308 |
if (sizeof($this->view['basket']['mwst']) > 1 || $this->get_option('wpsg_showMwstAlways') == '1')
|
|
|
309 |
{
|
|
|
310 |
|
|
|
311 |
$pdf->Rect($prod_left + 97, $prod_top + $offset, 15, $height);
|
|
|
312 |
|
|
|
313 |
}
|
|
|
314 |
|
|
|
315 |
$pdf->Rect($prod_left + 112, $prod_top + $offset, 15, $height);
|
|
|
316 |
$pdf->Rect($prod_left + 127, $prod_top + $offset, 25, $height);
|
|
|
317 |
$pdf->Rect($prod_left + 152, $prod_top + $offset, 25, $height);
|
|
|
318 |
|
|
|
319 |
$offset += $height;
|
|
|
320 |
|
|
|
321 |
$pnr ++;
|
|
|
322 |
$count ++;
|
|
|
323 |
|
|
|
324 |
$summe += $p['price'] * $p['menge'];
|
|
|
325 |
|
|
|
326 |
if ($count >= $prod_break && sizeof($this->view['basket']['produkte']) > ($pnr - 1))
|
|
|
327 |
{
|
|
|
328 |
|
|
|
329 |
AddRechnungPage($this, $pdf);
|
|
|
330 |
$bKopf = false; $offset = 0; $count = 0;
|
|
|
331 |
|
|
|
332 |
}
|
|
|
333 |
|
|
|
334 |
}
|
|
|
335 |
|
|
|
336 |
$pdf->SetFont('Arial', '', 9);
|
|
|
337 |
|
|
|
338 |
if ($this->view['kunde']['ustidnr'] != "")
|
|
|
339 |
{
|
|
|
340 |
$offset += 10;
|
|
|
341 |
$pdf->Text($prod_left, $prod_top + $offset, __("Ihre Umsatzsteuer-Identifikationsnummer:", "wpsg"));
|
|
|
342 |
$pdf->setXY($prod_left + 140, $prod_top + $offset - 5);
|
|
|
343 |
$pdf->Cell(37, 8, $this->view['kunde']['ustidnr'], 0, 0, 'R');
|
|
|
344 |
}
|
|
|
345 |
|
|
|
346 |
$offset += 10;
|
|
|
347 |
if ($this->view['basket']['noMwSt'] == '1' || $this->get_option('wpsg_kleinunternehmer') == '1')
|
|
|
348 |
{
|
|
|
349 |
|
|
|
350 |
$pdf->Text($prod_left, $prod_top + $offset, __("Es ergibt sich folgender Gesamtbetrag", "wpsg").':');
|
|
|
351 |
$pdf->Text($prod_left + 100, $prod_top + $offset, __("BRUTTOBETRAG", "wpsg"));
|
|
|
352 |
$pdf->setXY($prod_left + 140, $prod_top + $offset - 5);
|
|
|
353 |
$pdf->Cell(37, 8, wpsg_ff($this->view['basket']['preis_brutto'], $this->get_option('wpsg_currency')), 0, 0, 'R');
|
|
|
354 |
|
|
|
355 |
}
|
|
|
356 |
else
|
|
|
357 |
{
|
|
|
358 |
$pdf->Text($prod_left, $prod_top + $offset, __("Der Gesamtbetrag setzt sich wie folgt zusammen", "wpsg"));
|
|
|
359 |
|
|
|
360 |
if ($this->get_option('wpsg_preisangaben_frontend') == WPSG_NETTO)
|
|
|
361 |
{
|
|
|
362 |
|
|
|
363 |
$pdf->Text($prod_left + 100, $prod_top + $offset, __("NETTOBETRAG", "wpsg"));
|
|
|
364 |
$pdf->setXY($prod_left + 140, $prod_top + $offset - 5);
|
|
|
365 |
$pdf->Cell(37, 8, wpsg_ff($this->view['basket']['sum']['preis_gesamt_netto'], $this->get_option('wpsg_currency')), 0, 0, 'R');
|
|
|
366 |
|
|
|
367 |
}
|
|
|
368 |
else
|
|
|
369 |
{
|
|
|
370 |
|
|
|
371 |
$pdf->Text($prod_left + 100, $prod_top + $offset, __("BRUTTOBETRAG", "wpsg"));
|
|
|
372 |
$pdf->setXY($prod_left + 140, $prod_top + $offset - 5);
|
|
|
373 |
$pdf->Cell(37, 8, wpsg_ff($this->view['basket']['sum']['preis_gesamt_brutto'], $this->get_option('wpsg_currency')), 0, 0, 'R');
|
|
|
374 |
|
|
|
375 |
}
|
|
|
376 |
|
|
|
377 |
if (sizeof($this->view['basket']['mwst']) > 1)
|
|
|
378 |
{
|
|
|
379 |
|
|
|
380 |
foreach ($this->view['basket']['mwst'] as $mw)
|
|
|
381 |
{
|
|
|
382 |
|
|
|
383 |
$offset += 5;
|
|
|
384 |
$pdf->Text($prod_left + 100, $prod_top + $offset, __("MwSt. ", "wpsg").$mw['value'].'%');
|
|
|
385 |
$pdf->setXY($prod_left + 140, $prod_top + $offset - 5);
|
|
|
386 |
$pdf->Cell(37, 8, wpsg_ff($mw['sum'], $this->get_option('wpsg_currency')), 0, 0, 'R');
|
|
|
387 |
|
|
|
388 |
}
|
|
|
389 |
|
|
|
390 |
}
|
|
|
391 |
|
|
|
392 |
$offset += 5;
|
|
|
393 |
$pdf->Text($prod_left + 100, $prod_top + $offset, __("MwSt. GESAMT", "wpsg"));
|
|
|
394 |
$pdf->setXY($prod_left + 140, $prod_top + $offset - 5);
|
|
|
395 |
$pdf->Cell(37, 8, wpsg_ff($this->view['basket']['sum']['mwst'], $this->get_option('wpsg_currency')), 0, 0, 'R');
|
|
|
396 |
|
|
|
397 |
$offset += 5;
|
|
|
398 |
|
|
|
399 |
}
|
|
|
400 |
|
|
|
401 |
$pdf->Text($prod_left + 100, $prod_top + $offset, __("SUMME", "wpsg"));
|
|
|
402 |
$pdf->setXY($prod_left + 140, $prod_top + $offset - 5);
|
|
|
403 |
$pdf->Cell(37, 8, wpsg_ff($this->view['basket']['sum']['preis_gesamt'], $this->get_option('wpsg_currency')), 0, 0, 'R');
|
|
|
404 |
|
|
|
405 |
if ($this->get_option('wpsg_kleinunternehmer') == '1')
|
|
|
406 |
{
|
|
|
407 |
|
|
|
408 |
$pdf->MultiCell($prod_left - 1, $prod_top + $offset + 5, 5, utf8_encode(__('Alle angegebenen Preise sind Endpreise zzgl. Liefer-/Versandkosten. Aufgrund des Kleinunternehmerstatus gemäß § 19 UStG erhebe ich keine Umsatzsteuer und weise diese daher auch nicht aus.', 'wpsg')));
|
|
|
409 |
$offset += 15;
|
|
|
410 |
|
|
|
411 |
}
|
|
|
412 |
|
|
|
413 |
$offset += 5;
|
|
|
414 |
|
|
|
415 |
if ($this->view['fussText'] != "")
|
|
|
416 |
{
|
|
|
417 |
|
|
|
418 |
$pdf->MultiCell($prod_left - 1, $prod_top + $offset, 5, utf8_encode($this->view['fussText']));
|
|
|
419 |
$pdf->SetFont('Arial', 'B', 9);
|
|
|
420 |
$offset += 10;
|
|
|
421 |
|
|
|
422 |
}
|
|
|
423 |
|
|
|
424 |
/*
|
|
|
425 |
//TODO: Versandadresse in Rechnung
|
|
|
426 |
$shipping_adress = false;
|
|
|
427 |
if ($this->order['shipping_strasse'] != "" || $this->order['shipping_plz'] != "" || $this->order['shipping_ort'] != "")
|
|
|
428 |
{
|
|
|
429 |
|
|
|
430 |
$pdf->setFont('Arial', 'B', 9);
|
|
|
431 |
$pdf->Text($prod_left, $prod_top + $offset, __("Lieferanschrift", "wpsg").":");
|
|
|
432 |
$offset += 5;
|
|
|
433 |
|
|
|
434 |
$pdf->setFont('Arial', '', 9);
|
|
|
435 |
|
|
|
436 |
$shipping_adress = "";
|
|
|
437 |
if ($this->order['shipping_firma'] != "")
|
|
|
438 |
{
|
|
|
439 |
$shipping_adress .= $this->order['shipping_firma']."\r\n";
|
|
|
440 |
}
|
|
|
441 |
$shipping_adress .= $this->order['shipping_vname'].' '.$this->order['shipping_name']."\r\n";
|
|
|
442 |
$shipping_adress .= $this->order['shipping_strasse']."\r\n";
|
|
|
443 |
|
|
|
444 |
if (array_key_exists("mod_land", $this->controller->mods) && $this->order['shipping_land'] > 0)
|
|
|
445 |
{
|
|
|
446 |
|
|
|
447 |
$land = $this->controller->db->fetchOne("SELECT `kuerzel` FROM `".$this->controller->tbl_la."` WHERE `id` = '".wpsg_q($this->order['shipping_land'])."' ");
|
|
|
448 |
if ($land != "") $shipping_adress .= $land.'-';
|
|
|
449 |
|
|
|
450 |
}
|
|
|
451 |
|
|
|
452 |
$shipping_adress .= $this->order['shipping_plz'].' '.$this->order['shipping_ort'];
|
|
|
453 |
|
|
|
454 |
$start = $pdf->getY();
|
|
|
455 |
$pdf->MultiCell($prod_left - 1, $prod_top + $offset, 5, utf8_encode($shipping_adress), 0, 'L', 0, 100);
|
|
|
456 |
$offset += $pdf->getY() - $start;
|
|
|
457 |
|
|
|
458 |
$shipping_adress = true;
|
|
|
459 |
|
|
|
460 |
}
|
|
|
461 |
/*
|
|
|
462 |
|
|
|
463 |
$offset += 5;
|
|
|
464 |
|
|
|
465 |
// Bestellvariablen
|
|
|
466 |
// TODO: Bestellvariablen in Rechnung
|
|
|
467 |
/*
|
|
|
468 |
if (array_key_exists("mod_bestellvars", $this->controller->mods) && get_option("wpsg_mod_rechnungen_showov") == "1")
|
|
|
469 |
{
|
|
|
470 |
|
|
|
471 |
$bvars = @unserialize($this->order['bvars']);
|
|
|
472 |
if (!is_array($bvars)) $bvars = array();
|
|
|
473 |
|
|
|
474 |
$strBVars = "";
|
|
|
475 |
foreach ($bvars as $bvars_id => $bvars_value)
|
|
|
476 |
{
|
|
|
477 |
|
|
|
478 |
$bvars = $this->controller->db->fetchRow("SELECT * FROM `".wpsg_q($this->controller->tbl_ov)."` WHERE `id` = '".wpsg_q($bvars_id)."'");
|
|
|
479 |
|
|
|
480 |
if ($bvars['typ'] == "1") // Auswahl
|
|
|
481 |
{
|
|
|
482 |
if ($bvars_value <= 0) $bvars_value = __("Keine Angabe", "wpsg");
|
|
|
483 |
}
|
|
|
484 |
else if ($bvars['typ'] == "2") // Texteingabe
|
|
|
485 |
{
|
|
|
486 |
if (trim($bvars_value) == "") $bvars_value = __("Keine Angabe", "wpsg");
|
|
|
487 |
}
|
|
|
488 |
else if ($bvars['typ'] == "3") // Checkbox
|
|
|
489 |
{
|
|
|
490 |
if ($bvars_value <= 0) $bvars_value = __("Keine Angabe", "wpsg");
|
|
|
491 |
}
|
|
|
492 |
|
|
|
493 |
$bvars_name = $this->controller->mods['mod_bestellvars']->getNameFromId($bvars_id);
|
|
|
494 |
$strBVars .= "\r\n".$bvars_name.": ".$bvars_value;
|
|
|
495 |
|
|
|
496 |
}
|
|
|
497 |
|
|
|
498 |
$pdf->SetFont('Arial', 'B', 9);
|
|
|
499 |
$pdf->Text($prod_left, $prod_top + $offset, __("Angaben während der Bestellung", "wpsg").":");
|
|
|
500 |
$pdf->SetFont('Arial', '', 9);
|
|
|
501 |
$pdf->MultiCell($prod_left - 1, $prod_top + $offset, 5, utf8_encode($strBVars));
|
|
|
502 |
|
|
|
503 |
}
|
|
|
504 |
*/
|
|
|
505 |
|
|
|
506 |
if (!file_exists($this->callMod('wpsg_mod_rechnungen', 'getFilePath', array($this->view['data']['id']))))
|
|
|
507 |
{
|
|
|
508 |
|
|
|
509 |
mkdir($this->callMod('wpsg_mod_rechnungen', 'getFilePath', array($this->view['data']['id'])), 0777, true);
|
|
|
510 |
|
|
|
511 |
}
|
|
|
512 |
|
|
|
513 |
$filename = $this->view['rnr'].".pdf";
|
|
|
514 |
|
|
|
515 |
if ($this->view['preview'])
|
|
|
516 |
{
|
|
|
517 |
$pdf->Output($filename, 'I');
|
|
|
518 |
}
|
|
|
519 |
else
|
|
|
520 |
{
|
|
|
521 |
|
|
|
522 |
$pdf->Output($this->callMod('wpsg_mod_rechnungen', 'getFilePath', array($this->view['data']['id'])).$filename, 'F');
|
|
|
523 |
if (!$this->bFile) $pdf->Output($filename, 'I');
|
|
|
524 |
|
|
|
525 |
}
|
|
|
526 |
|
|
|
527 |
?>
|