Subversion Repositories wpShopGermany4

Rev

Rev 8241 | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
5972 daniel 1
<?php
2
 
3
	/**
4
	 * Template für die PDF Rechnungskorrektur
5
	 */
7352 daniel 6
 
7
	require_once WPSG_PATH_LIB.'FPDF_1.81/fpdf.php';
8
	require_once WPSG_PATH_LIB.'FPDI_2.2.0/autoload.php';
5972 daniel 9
	require_once WPSG_PATH_LIB.'wpsg_fpdf.class.php';
10
 
11
	global $absender_left, $absender_top, $adress_left, $adress_top, $rdata_left, $rdata_top;
8214 daniel 12
 
13
    /** @var wpsg\wpsg_invoice|null $oInvoice */
14
    $oInvoice = $this->view['oInvoice'];
15
 
5972 daniel 16
	// Positionierung der Absenderadresszeile
17
	$absender_left				= 25;
18
	$absender_top				= 50;
19
 
20
	// Positionierung der Zieladress
21
	$adress_left 				= 25;
22
	$adress_top					= 55;
23
 
24
	// Positionierung des Rechnungskopfes
25
	$rdata_left					= 25;
26
	$rdata_top					= 90;
27
 
28
	// Positionierung der Produktdaten
29
	$prod_left					= 25;
30
	$prod_top					= 105;
31
 
32
	// Anzahl an Produkten pro Seite
33
	$prod_break					= $this->get_option('wpsg_rechnungen_pdfperpage');
34
 
7490 daniel 35
	$arCalculation = $this->view['basket']['arCalculation'];
8190 karl 36
 
5972 daniel 37
	// Damit die Steuer bei der Kleinunternehmerregelung nicht angezeigt wird leer ich den Array sicherheitshalber
8190 karl 38
	if ( ($this->get_option('wpsg_kleinunternehmer') == '1') || ($this->view['oCalculationOrder']->getTaxMode() === \wpsg\wpsg_calculation::TAXMODE_SMALLBUSINESS) ) unset($this->view['basket']['mwst']);
5972 daniel 39
 
40
	if (!function_exists('AddRechnungPage'))
41
	{
42
 
43
		function AddRechnungPage($shop, $pdf)
44
		{
45
 
46
			global $absender_left, $absender_top, $adress_left, $adress_top, $rdata_left, $rdata_top;
47
 
48
			$pdf->AddPage();
49
 
8214 daniel 50
			if (file_exists($shop->callMod('wpsg_mod_rechnungen', 'getPaperPath', array())."wpsg_rechnungen_bp.pdf"))
5972 daniel 51
			{
52
 
8214 daniel 53
				$pagecount = $pdf->setSourceFile($shop->callMod('wpsg_mod_rechnungen', 'getPaperPath', array())."wpsg_rechnungen_bp.pdf");
5972 daniel 54
				$tplidx = $pdf->importPage(1, '/MediaBox');
55
				$pdf->useTemplate($tplidx, 0, 0, 210);
56
 
57
			}
8214 daniel 58
			if (file_exists($shop->callMod('wpsg_mod_rechnungen', 'getPaperPath', array())."wpsg_rechnungen_bp.jpg"))
5972 daniel 59
			{
8214 daniel 60
				$pdf->image($shop->callMod('wpsg_mod_rechnungen', 'getPaperPath', array())."wpsg_rechnungen_bp.jpg", 0, 0, 210, 297, 'jpg');
5972 daniel 61
			}
62
 
63
 
8214 daniel 64
			if (file_exists($shop->callMod('wpsg_mod_rechnungen', 'getPaperPath', array())."wpsg_rechnungen_logo.jpg"))
5972 daniel 65
			{
66
 
8214 daniel 67
				list($width, $height, $type, $attr) = getimagesize($shop->callMod('wpsg_mod_rechnungen', 'getPaperPath', array())."wpsg_rechnungen_logo.jpg");
5972 daniel 68
 
69
				//wpsg_debug($width.":".$height);
70
 
71
				$wPix = (25.4 * $width) / 96;
72
				$hPix = (25.4 * $height) / 96;
73
 
8214 daniel 74
				$pdf->image($shop->callMod('wpsg_mod_rechnungen', 'getPaperPath', array())."wpsg_rechnungen_logo.jpg", 210 - $wPix, 0, $wPix, $hPix);
5972 daniel 75
 
76
			}
77
 
78
			// Absenderadresszeile (Wird in der Konfiguration hinterlegt)
79
			$pdf->SetFont('Arial', '', 6);
80
			$pdf->Text($absender_left, $absender_top, $shop->replaceUniversalPlatzhalter(__($shop->get_option("wpsg_rechnungen_adresszeile"), 'wpsg'), $shop->view['data']['id']));
81
 
82
			if (wpsg_getStr($shop->view['kunde']['kuerzel']) != "") $shop->view['kunde']['kuerzel'] = $shop->view['kunde']['kuerzel'].'-';
83
 
84
			// Adresse des Kunden
85
			$pdf->SetFont('Arial', '', 12);
86
			$pdf->Text($adress_left, $adress_top, $shop->view['kunde']['firma']);
87
			$pdf->Text($adress_left, $adress_top + 5, $shop->view['kunde']['vname'].' '.$shop->view['kunde']['name']);
7247 daniel 88
			$pdf->Text($adress_left, $adress_top + 10, $shop->view['kunde']['strasse'].' '.wpsg_getStr($shop->view['kunde']['nr']));
5972 daniel 89
			$pdf->Text($adress_left, $adress_top + 15, $shop->view['kunde']['plz'].' '.$shop->view['kunde']['ort']);
90
 
8007 daniel 91
			if ($shop->get_option("wpsg_mod_rechnungen_hideCountry") == '0') $pdf->Text($adress_left, $adress_top + 20, strtoupper($shop->view['oOrder']->getInvoiceCountryName()));
92
 
5972 daniel 93
			// Rechnungsdaten
94
			$pdf->SetFont('Arial', 'B', 16);
7676 daniel 95
			$pdf->Text($rdata_left, $rdata_top, __('Rechnungskorrektur', 'wpsg'));
5972 daniel 96
			$pdf->SetFont('Arial', 'B', 9);
97
			$pdf->Text($rdata_left, $rdata_top + 6, $shop->view['rnr']);
98
			$pdf->SetFont('Arial', '', 9);
99
 
100
			if (isset($shop->view['faelligkeitdatum']))
101
			{
102
 
103
				$pdf->Text($rdata_left + 35, $rdata_top, __("Fällig am", "wpsg"));
8190 karl 104
				$pdf->Text($rdata_left + 35, $rdata_top + 6, date("d.m.Y", strtotime($shop->view['faelligkeitdatum'])));
5972 daniel 105
 
106
			}
107
 
108
			if (isset($shop->view['payment']))
109
			{
110
 
111
				$pdf->Text($rdata_left + 58, $rdata_top, __("Zahlungsbedingungen", "wpsg"));
112
				$pdf->Text($rdata_left + 58, $rdata_top + 6, $shop->view['payment']);
113
 
114
			}
115
 
116
			$pdf->Text($rdata_left + 105, $rdata_top, __("Kunden-Nr", "wpsg"));
117
			$pdf->Text($rdata_left + 105, $rdata_top + 6, (($shop->view['kunde']['knr'] != '')?$shop->view['kunde']['knr']:$shop->view['kunde']['id']));
118
 
119
			$pdf->Text($rdata_left + 135, $rdata_top, __("Best. Nr.", "wpsg"));
120
			$pdf->Text($rdata_left + 135, $rdata_top + 6, ((trim($shop->view['data']['onr']) != '')?$shop->view['data']['onr']:$shop->view['data']['id']));
121
 
122
			$pdf->Text($rdata_left + 155, $rdata_top, __("Datum", "wpsg"));
8190 karl 123
			$pdf->Text($rdata_left + 155, $rdata_top + 6, date("d.m.Y", strtotime($shop->view['rDatum'])));
5972 daniel 124
 
125
			if ($shop->view['oOrder']->isInnerEu())
126
			{
7153 thomas 127
 
128
            	$pdf->SetFont('Arial', '', 9);
129
                $pdf->Text($adress_left, $rdata_top + 11.5, __("Innergemeinschaftliche Lieferung.", "wpsg"));
130
 
131
            } else if (!$shop->view['oOrder']->isInnerEu() && $shop->view['oOrder']->getShippingCountryID() != $shop->getDefaultCountry(true)) {
132
 
133
			// Nicht InnerEU und Nicht Inland
134
 
135
             	$pdf->SetFont('Arial', '', 9);
136
                $pdf->Text($adress_left, $rdata_top + 11.5, __("Steuerfreie Ausfuhrlieferung.", "wpsg"));
137
 
5972 daniel 138
			}
7153 thomas 139
 
5972 daniel 140
			// Benutzerdefinierte Felder
141
			$arTexte = $shop->callMod('wpsg_mod_rechnungen', 'getRechnungstexte', array($shop->view['data']['id']));
142
 
143
			foreach ((array)$arTexte as $text)
144
			{
145
 
146
				if (isset($text['aktiv']) && $text['aktiv'] == 1)
147
				{
148
 
149
					$pdf->SetFont('Arial', 'B', ((intval($text['fontsize']) > 0)?intval($text['fontsize']):10));
150
					$pdf->wpsg_SetTextColor($text['color']);
151
					$pdf->wpsg_MultiCell($text['x'], $text['y'], 5, $text['text']);
152
					$pdf->wpsg_SetTextColor("#000000");
153
 
154
				}
155
 
156
			}
157
 
158
		}
159
 
160
	}
8190 karl 161
 
5972 daniel 162
	$pdf = new wpsg_fpdf();
163
	$pdf->SetAutoPageBreak(true, 5);
164
	AddRechnungPage($this, $pdf);
8190 karl 165
 
166
	if ( ($this->view['oCalculationOrder']->getTaxMode() === \wpsg\wpsg_calculation::TAXMODE_B2B && $this->view['oOrder']->isInnerEu())
167
	|| ($this->view['oCalculationOrder']->getTaxMode() === \wpsg\wpsg_calculation::TAXMODE_SMALLBUSINESS)
168
	) $bNoTax = true;
169
	else $bNoTax = false;
170
 
171
	$bTaxCol = false;
172
	if ($this->get_option('wpsg_showMwstAlways') === '1') $bTaxCol = true;
173
	else if (!$bNoTax) $bTaxCol = true;
174
 
175
	if ($bNoTax) {
176
 
177
		$discount_value = $this->view['basket']['arCalculation']['sum']['discount_netto'];
178
		$shipping_cost = $this->view['basket']['arCalculation']['sum']['shipping_netto'];
179
		$payment_cost = $this->view['basket']['arCalculation']['sum']['payment_netto'];
180
 
8302 karl 181
		$taxdisplay = 'netto';
182
 
8190 karl 183
	} else {
184
 
185
		$discount_value = $this->view['basket']['arCalculation']['sum']['discount_brutto'];
186
		$shipping_cost = $this->view['basket']['arCalculation']['sum']['shipping_brutto'];
187
		$payment_cost = $this->view['basket']['arCalculation']['sum']['payment_brutto'];
188
 
8302 karl 189
		$taxdisplay = 'brutto';
190
 
8190 karl 191
	}
5972 daniel 192
 
193
	$summe = 0;
194
 
195
	$bKopf = false; $pnr = 1; $offset = 0; $count = 0;
8190 karl 196
	foreach ($this->view['basket']['arCalculation']['product'] as $p)
5972 daniel 197
	{
8190 karl 198
		$product = wpsg_product::getInstance($p['product_id']);
5972 daniel 199
 
200
		if (!$bKopf)
201
		{
202
 
203
			$pdf->SetFont('Arial', 'B', 9);
204
			$pdf->setXY($prod_left, $prod_top);
205
			$pdf->Cell(10, 8, __("Nr.", "wpsg"), 1, 0, 'C');
206
 
207
			$pdf->setXY($prod_left + 10, $prod_top);
8190 karl 208
			$pdf->Cell( (($bTaxCol)?87:102), 8, "Name", 1, 0, 'L');
5972 daniel 209
 
8190 karl 210
			if ($bTaxCol)
5972 daniel 211
			{
212
 
213
				$pdf->setXY($prod_left + 97, $prod_top);
214
				$pdf->Cell(15, 8, __("MwSt.", "wpsg"), 1, 0, 'C');
215
 
216
			}
217
 
218
			$pdf->setXY($prod_left + 112, $prod_top);
219
			$pdf->Cell(15, 8, __("Menge", "wpsg"), 1, 0, 'C');
220
 
221
			$pdf->setXY($prod_left + 127, $prod_top);
222
			$pdf->Cell(25, 8, __("Einzelpreis", "wpsg"), 1, 0, 'R');
223
 
224
			$pdf->setXY($prod_left + 152, $prod_top);
225
			$pdf->Cell(25, 8, __("Gesamtpreis", "wpsg"), 1, 0, 'R');
226
 
227
			$offset = 8;
228
			$bKopf = true;
229
 
230
		}
231
 
232
		$pdf->SetFont('Arial', '', 9);
233
		$pdf->setXY($prod_left, $prod_top + $offset);
234
 
8190 karl 235
		if ($this->get_option('wpsg_mod_rechnungen_anr') == '1') $pdf->Cell(10, 8, $product->getNr(), 0, 0, 'C');
236
		else $pdf->Cell(10, 8, $pnr.".", 0, 0, 'C');
5972 daniel 237
 
8190 karl 238
		if ($this->get_option('wpsg_rechnungen_pdetailname') == '1') $produkt_text = $this->getProductName($this->getProduktID($p['product_id']), true);
239
		else $produkt_text = $this->getProductName($this->getProduktID($p['product_id']), false);
5972 daniel 240
 
8190 karl 241
		$produktBeschreibung = trim(strip_tags($product->getShortDescription()));
5972 daniel 242
 
243
		if ($this->isOtherLang())
244
		{
245
 
8190 karl 246
			$trans_db = $this->db->fetchRow("SELECT * FROM `".WPSG_TBL_PRODUCTS."` WHERE `lang_parent` = '".wpsg_q($this->getProduktID($p['product_id']))."' AND `lang_code` = '".wpsg_q($this->getCurrentLanguageCode())."'");
5972 daniel 247
 
248
			if (is_array($trans_db) && sizeof($trans_db) > 0)
249
			{
250
 
251
				$produkt_text = $trans_db['name'];
252
				$produktBeschreibung = trim(strip_tags($trans_db['beschreibung']));
253
 
254
			}
255
 
256
		}
257
 
258
		$height = 0; // Höhe der Zeile für den Rahmen
259
 
260
		$pdf->setXY($prod_left + 10, $prod_top + $offset);
261
 
262
		// Produktvariablen
263
		if ($this->hasMod('wpsg_mod_productvars') && $this->get_option("wpsg_mod_rechnungen_showpv") == "1")
264
		{
265
 
266
			$arPV = $this->callMod('wpsg_mod_productvars', 'getAllProductVarValues', array($this->view['data']['id'], $p['product_index']));
267
 
268
			if (wpsg_isSizedArray($arPV))
269
			{
270
 
271
				foreach ($arPV as $pv)
272
				{
273
 
274
					$produkt_text .= "\r\n".$pv['name'].': '.$pv['value'];
275
					$height += 5;
276
 
277
				}
278
 
279
			}
280
 
281
		}
282
 
6751 daniel 283
        if ($this->get_option('wpsg_mod_rechnungen_anr') === '2')
284
        {
285
 
8190 karl 286
            $anr = $this->getProductAnr($product->getProductKey());
6751 daniel 287
            $produkt_text .= "\r\n".wpsg_translate(__('Artikelnummer: #1#', 'wpsg'), $anr);
288
 
289
        }
290
 
5972 daniel 291
		$produkt_text_cell_width = 102;
8190 karl 292
		if ($bTaxCol) $produkt_text_cell_width = 87;
5972 daniel 293
 
294
		$produkt_text_width = $pdf->GetStringWidth($produkt_text);
295
		//$produkt_text_cell_width = (($this->arMwSt == "-1")?87:102);
296
 
297
		$height += 5 * ceil($produkt_text_width / $produkt_text_cell_width) + 3;
298
 
299
		$height_y = $pdf->getY();
300
		$height = 2 + $pdf->wpsg_MultiCell($prod_left + 10, $prod_top + $offset + 1.5, 5, $produkt_text, 0, 'L', 0, $produkt_text_cell_width);
301
 
302
		//$height += 3 + 5 + $pdf->getY() - $height_y;
303
		//$pdf->Cell((($this->arMwSt == "-1")?102:87), 8, $produkt_text, 0, 0, 'L');
304
 
8190 karl 305
		if ($bTaxCol) {
5972 daniel 306
 
307
			$pdf->setXY($prod_left + 97, $prod_top + $offset);
8190 karl 308
			$pdf->Cell(15, 8, (($bNoTax)?'0.00 %':wpsg_ff($this->view['basket']['arCalculation']['tax'][$p['tax_key']]['tax_value'], '%')), 0, 0, 'C');
5972 daniel 309
 
310
		}
311
 
312
		$pdf->setXY($prod_left + 112, $prod_top + $offset);
8190 karl 313
		$pdf->Cell(15, 8, $p['amount'], 0, 0, 'C');
5972 daniel 314
 
8190 karl 315
		if ( ( wpsg_ShopController::get_option('wpsg_preisangaben') == WPSG_NETTO ) || $bNoTax ) $preis_single = $p['netto_calculated_single'];
316
		else $preis_single =  $p['brutto_calculated_single'];
5972 daniel 317
 
318
		$pdf->setXY($prod_left + 127, $prod_top + $offset);
8190 karl 319
		$pdf->Cell(25, 8, wpsg_ff($preis_single, $this->get_option('wpsg_currency')), 0, 0, 'R');
5972 daniel 320
 
321
		$pdf->setXY($prod_left + 152, $prod_top + $offset);
8190 karl 322
		$pdf->Cell(25, 8, wpsg_ff($preis_single * $p['amount'], $this->get_option('wpsg_currency')), 0, 0, 'R');
5972 daniel 323
 
324
		/**
325
		 * Produktbeschreibung anzeigen Ja/Nein
326
		 */
327
		$pBeschreibungHeight = 0;
8190 karl 328
		if ($this->get_option("wpsg_rechnungen_pbeschreibung") == "1" && trim(strip_tags($product->getShortDescription())) != '')
5972 daniel 329
		{
330
 
331
			$produktBeschreibung = nl2br($produktBeschreibung);
332
			preg_match_all('/\<br \/\>/', $produktBeschreibung, $treffer);
333
			$produktBeschreibung = strip_tags($produktBeschreibung);
334
 
335
			$pBeschreibungWidth = $pdf->getStringWidth($produktBeschreibung);
336
			$pBeschreibungHeight = 5 * (ceil($pBeschreibungWidth / $produkt_text_cell_width) + @sizeof($treffer[0]));
337
 
338
			$pdf->SetFont('Arial', 'I', 9);
339
 
340
			$cellY = $pdf->getY();
341
			$pdf->wpsg_MultiCell($prod_left + 10, $prod_top + $height + $offset - 1, 5, $produktBeschreibung, 0, 'L', 0, $produkt_text_cell_width);
342
			$pBeschreibungHeight = $pdf->getY() - $cellY - $height + 1;
343
			$pdf->SetFont('Arial', '', 9);
344
 
345
		}
346
 
347
		$height += $pBeschreibungHeight;
348
 
349
		/**
350
		 * Produktattribute ?
351
		 */
352
		if ($this->get_option('wpsg_rechnungen_produktattribute') == '1')
353
		{
8190 karl 354
 
355
			$attributeInfo = $this->callMod('wpsg_mod_produktattribute', 'getProductAttributeByProductId', array($this->getProduktId($p['product_id'])));
5972 daniel 356
 
357
			foreach ($attributeInfo as $pa)
358
			{
8190 karl 359
 
360
				if ($pa['value'] == "") $pa['value'] = "Keine Angabe";
5972 daniel 361
				$pa_text = $pa['name'].': '.$pa['value'];
362
				$height += $pdf->wpsg_MultiCell($prod_left + 10, $prod_top + $height + $offset - 0.5, 5, $pa_text, 0, 'L', 0, $produkt_text_cell_width);
363
 
364
			}
365
		}
366
 
367
		/**
368
		 * Variante ?
369
		 */
8190 karl 370
		if (preg_match('/pv_(.*)/', $p['product_key']))
5972 daniel 371
		{
372
 
8190 karl 373
			$variInfo = $this->callMod('wpsg_mod_productvariants', 'getVariantenInfoArray', array($p['product_key']));
5972 daniel 374
 
375
			$height += $pdf->wpsg_MultiCell($prod_left + 10, $prod_top + $height + $offset - 0.5, 5, wpsg_translate(__('Variante: #1#', 'wpsg'), $variInfo['key']), 0, 'L', 0, $produkt_text_cell_width);
376
 
377
			//$height += 5;
378
 
379
		}
380
 
8190 karl 381
		if ($this->hasMod('wpsg_mod_deliverynote') && ($this->get_option('wpsg_rechnungen_deliverynote') == '1'))
5972 daniel 382
		{
383
 
384
			$arDN_order = $this->callMod('wpsg_mod_deliverynote', 'loadDeliveryNotesFromOrder', array($this->view['data']['id']));
385
 
386
			if (sizeof($arDN_order) > 1)
387
			{
388
 
389
				$deliveryTimeProduct = $this->callMod('wpsg_mod_deliverynote', 'getProductDeliveryTime', array($this->view['data']['id'], $p['product_index']));
390
 
391
				if ($deliveryTimeProduct !== false)
392
				{
393
 
394
					$height += $pdf->wpsg_MultiCell($prod_left + 10, $prod_top + $height + $offset - 0.5, 5, wpsg_translate(__('Lieferdatum: #1#', 'wpsg'), date('d.m.Y', $deliveryTimeProduct)), 0, 'L', 0, $produkt_text_cell_width);
395
 
396
				}
397
 
398
			}
399
 
400
		}
401
 
402
		// Jetzt die Rahmen zeichnen
403
		$pdf->Rect($prod_left, $prod_top + $offset, 10, $height);
404
 
8190 karl 405
		$pdf->Rect($prod_left + 10, $prod_top + $offset, (($bTaxCol)?87:102), $height);
5972 daniel 406
 
8190 karl 407
		if ($bTaxCol) $pdf->Rect($prod_left + 97, $prod_top + $offset, 15, $height);
5972 daniel 408
 
409
		$pdf->Rect($prod_left + 112, $prod_top + $offset, 15, $height);
410
		$pdf->Rect($prod_left + 127, $prod_top + $offset, 25, $height);
411
		$pdf->Rect($prod_left + 152, $prod_top + $offset, 25, $height);
412
 
413
		$offset += $height;
414
 
415
		$pnr ++;
416
		$count ++;
417
 
8190 karl 418
		if ($bNoTax) $price = $p['netto'];
419
		else $price = $p['brutto'];
420
 
421
		$summe += $price * $p['amount'];
5972 daniel 422
 
8190 karl 423
		if ($pdf->getY() > 220 || ($count >= $prod_break && sizeof($this->view['basket']['arCalculation']['product']) > ($pnr - 1)))
5972 daniel 424
		{
425
 
426
			AddRechnungPage($this, $pdf);
427
			$bKopf = false; $offset = 0; $count = 0;
428
 
429
		}
430
 
431
	} // produkte
432
 
7490 daniel 433
	if (wpsg_isSizedArray($this->view['basket']['arCalculation']['voucher'])) {
434
 
435
		foreach ($this->view['basket']['arCalculation']['voucher'] as $v) {
436
 
437
			$pdf->SetFont('Arial', '', 9);
438
			$pdf->setXY($prod_left, $prod_top + $offset);
439
			$pdf->Cell(10, 8, $pnr.'.', 1, 0, 'C'); $pnr ++;
440
 
441
			$pdf->setXY($prod_left + 10, $prod_top + $offset);
8190 karl 442
			$pdf->Cell( (($bTaxCol)?87:102), 8, wpsg_translate(__('Gutschein (#1#)', 'wpsg'), $v['code']), 1, 0, 'L');
7490 daniel 443
 
8190 karl 444
			if ($bTaxCol)
7490 daniel 445
			{
446
 
447
				$mwst = __('anteilig', 'wpsg');
448
 
449
				$pdf->setXY($prod_left + 97, $prod_top + $offset);
450
				$pdf->Cell(15, 8, $mwst, 1, 0, 'C');
451
 
452
			}
453
 
454
			$pdf->setXY($prod_left + 112, $prod_top + $offset);
455
			$pdf->Cell(15, 8, '1', 1, 0, 'C');
456
 
457
			$gs_value_einzel = wpsg_ff($v[$taxdisplay.'_single'], $this->get_option('wpsg_currency'));
458
			$gs_value_gesamt = wpsg_ff($v[$taxdisplay], $this->get_option('wpsg_currency'));
459
 
460
			$pdf->setXY($prod_left + 127, $prod_top + $offset);
461
			$pdf->Cell(25, 8, $gs_value_einzel, 1, 0, 'R');
462
 
463
			$pdf->setXY($prod_left + 152, $prod_top + $offset);
464
			$pdf->Cell(25, 8, $gs_value_gesamt, 1, 0, 'R');
465
 
466
			$offset += 8;
467
 
468
		}
469
 
470
	}
5972 daniel 471
 
472
	// Versandkosten
8190 karl 473
	if ( ($shipping_cost != '') && ($shipping_cost != 0) )
5972 daniel 474
	{
475
 
476
		$pdf->SetFont('Arial', '', 9);
477
		$pdf->setXY($prod_left, $prod_top + $offset);
478
		$pdf->Cell(10, 8, $pnr.'.', 1, 0, 'C'); $pnr ++;
479
 
480
		$pdf->setXY($prod_left + 10, $prod_top + $offset);
8190 karl 481
		$pdf->Cell( (($bTaxCol)?87:102), 8, wpsg_translate(__('Versandkosten "#1#"', 'wpsg'), $this->view['oOrder']->getShippingLabel()), 1, 0, 'L');
5972 daniel 482
 
8190 karl 483
		if ($bTaxCol)
5972 daniel 484
		{
485
 
8302 karl 486
			// if ($this->arShipping[$this->view['data']['type_shipping']]['mwst_null'] == '1' && $bNoTax) $mwst = wpsg_ff(0.00, '%');
487
			// {
488
			if ($bNoTax)
489
			{
490
 
491
				$mwst = wpsg_ff(0.00, '%');
492
 
493
			} else {
5972 daniel 494
 
8302 karl 495
				if ($this->view['basket']['arCalculation']['shipping'][0]['tax_key'] === '0') {
496
 
497
					$mwst = _('anteilig');
498
 
499
				} else {
5972 daniel 500
 
7642 daniel 501
					$mwst = wpsg_ff($this->view['basket']['arCalculation']['shipping'][0]['tax'], '%');
502
					$mwst = wpsg_ff($this->view['basket']['arCalculation']['tax'][$this->view['basket']['arCalculation']['shipping'][0]['tax_key']]['tax_value'], '%');
5972 daniel 503
 
504
				}
7642 daniel 505
 
5972 daniel 506
			}
507
 
508
			$pdf->setXY($prod_left + 97, $prod_top + $offset);
509
			$pdf->Cell(15, 8, $mwst, 1, 0, 'C');
510
 
511
		}
512
 
513
		$pdf->setXY($prod_left + 112, $prod_top + $offset);
514
		$pdf->Cell(15, 8, '1', 1, 0, 'C');
515
 
516
		$pdf->setXY($prod_left + 127, $prod_top + $offset);
8190 karl 517
		$pdf->Cell(25, 8, wpsg_ff($shipping_cost, $this->get_option('wpsg_currency')), 1, 0, 'R');
5972 daniel 518
 
519
		$pdf->setXY($prod_left + 152, $prod_top + $offset);
8190 karl 520
		$pdf->Cell(25, 8, wpsg_ff($shipping_cost, $this->get_option('wpsg_currency')), 1, 0, 'R');
5972 daniel 521
 
522
		$offset += 8;
523
 
524
	}
525
 
526
	// Zahlungskosten
8190 karl 527
	if ( ($payment_cost != '') && ($payment_cost != 0) )
5972 daniel 528
	{
529
 
530
		$pdf->SetFont('Arial', '', 9);
531
		$pdf->setXY($prod_left, $prod_top + $offset);
532
		$pdf->Cell(10, 8, $pnr.'.', 1, 0, 'C'); $pnr ++;
533
 
534
		$pdf->setXY($prod_left + 10, $prod_top + $offset);
8190 karl 535
		$pdf->Cell( (($bTaxCol)?87:102), 8, $this->arPayment[$this->view['data']['type_payment']]['name'], 1, 0, 'L');
5972 daniel 536
 
8190 karl 537
		if ($bTaxCol)
5972 daniel 538
		{
539
 
8302 karl 540
			// if ($this->arPayment[$this->view['data']['type_payment']]['mwst_null'] == '1' && $bNoTax)
541
			// {
542
			if ($bNoTax)
5972 daniel 543
			{
8190 karl 544
 
545
				$mwst = wpsg_ff(0.00, '%');
546
 
547
			} else {
5972 daniel 548
 
7642 daniel 549
				if ($this->view['basket']['arCalculation']['payment'][0]['tax_key'] === '0') {
5972 daniel 550
 
7642 daniel 551
					$mwst = _('anteilig');
5972 daniel 552
 
7642 daniel 553
				} else {
554
 
555
					$mwst = wpsg_ff($this->view['basket']['arCalculation']['payment'][0]['tax'], '%');
556
					$mwst = wpsg_ff($this->view['basket']['arCalculation']['tax'][$this->view['basket']['arCalculation']['payment'][0]['tax_key']]['tax_value'], '%');
557
 
5972 daniel 558
				}
559
 
560
			}
561
 
562
			$pdf->setXY($prod_left + 97, $prod_top + $offset);
563
			$pdf->Cell(15, 8, $mwst, 1, 0, 'C');
564
 
565
		}
566
 
567
		$pdf->setXY($prod_left + 112, $prod_top + $offset);
568
		$pdf->Cell(15, 8, '1', 1, 0, 'C');
569
 
570
		$pdf->setXY($prod_left + 127, $prod_top + $offset);
8190 karl 571
		$pdf->Cell(25, 8, wpsg_ff($payment_cost, $this->get_option('wpsg_currency')), 1, 0, 'R');
5972 daniel 572
 
573
		$pdf->setXY($prod_left + 152, $prod_top + $offset);
8190 karl 574
		$pdf->Cell(25, 8, wpsg_ff($payment_cost, $this->get_option('wpsg_currency')), 1, 0, 'R');
5972 daniel 575
 
576
		$offset += 8;
577
 
578
	}
579
 
580
	// Gebühr
581
	if (wpsg_tf(wpsg_getStr($this->view['storno_fee'])) > 0)
582
	{
583
 
584
		$pdf->SetFont('Arial', '', 9);
585
		$pdf->setXY($prod_left, $prod_top + $offset);
586
		$pdf->Cell(10, 8, $pnr.'.', 1, 0, 'C'); $pnr ++;
587
 
588
		$label = __('Bearbeitungsgebühr', 'wpsg');
589
 
590
		if (strpos($this->view['storno_fee'], '%') !== false) $label .= ' ('.wpsg_ff($this->view['storno_fee'], '%').')';
591
 
592
		$pdf->setXY($prod_left + 10, $prod_top + $offset);
8190 karl 593
		$pdf->Cell( (($bTaxCol)?87:102), 8, $label, 1, 0, 'L');
5972 daniel 594
 
8190 karl 595
		if ($bTaxCol)
5972 daniel 596
		{
597
 
8190 karl 598
			if ($bNoTax) $mwst = wpsg_ff(0.00, '%');
599
			else $mwst = wpsg_ff($this->view['storno_fee_tax_value'], '%');
5972 daniel 600
 
601
			$pdf->setXY($prod_left + 97, $prod_top + $offset);
602
			$pdf->Cell(15, 8, $mwst, 1, 0, 'C');
603
 
604
		}
605
 
606
		$pdf->setXY($prod_left + 112, $prod_top + $offset);
607
		$pdf->Cell(15, 8, '1', 1, 0, 'C');
608
 
609
		$pdf->setXY($prod_left + 127, $prod_top + $offset);
610
		$pdf->Cell(25, 8, '-'.wpsg_ff($this->view['storno_fee_value'], $this->get_option('wpsg_currency')), 1, 0, 'R');
611
 
612
		$pdf->setXY($prod_left + 152, $prod_top + $offset);
613
		$pdf->Cell(25, 8, '-'.wpsg_ff($this->view['storno_fee_value'], $this->get_option('wpsg_currency')), 1, 0, 'R');
614
 
615
		$offset += 8;
616
 
617
	}
618
 
619
	$pdf->SetFont('Arial', '', 9);
620
 
621
	if ($this->view['kunde']['ustidnr'] != "")
622
	{
623
		$offset += 10;
624
		$pdf->Text($prod_left, $prod_top + $offset, __("Ihre Umsatzsteuer-Identifikationsnummer:", "wpsg"));
625
		$pdf->setXY($prod_left + 140, $prod_top + $offset - 5);
626
		$pdf->Cell(37, 8, $this->view['kunde']['ustidnr'], 0, 0, 'R');
627
	}
628
 
8302 karl 629
	$offset += 5; // Abstand zwischen Tabelle und Rabatt
8190 karl 630
 
8302 karl 631
	// Rabatt
632
	if ($discount_value > 0)
633
	{
634
 
635
		$offset += 5;
636
		$pdf->Text($prod_left + 80, $prod_top + $offset, __("Rabatt", "wpsg"));
637
		$pdf->setXY($prod_left + 140, $prod_top + $offset - 5);
638
		$pdf->Cell(37, 8, '-'.wpsg_ff($discount_value, $this->get_option('wpsg_currency')), 0, 0, 'R');
639
 
640
	}
641
 
642
	$offset += 5; // Abstand zwischen Rabatt und Auswertung
643
 
8241 karl 644
	if ( ($this->get_option('wpsg_kleinunternehmer') == '1') || ($this->view['oCalculationOrder']->getTaxMode() === \wpsg\wpsg_calculation::TAXMODE_SMALLBUSINESS) )
5972 daniel 645
	{
8190 karl 646
 
5972 daniel 647
		$pdf->Text($prod_left, $prod_top + $offset, __("Es ergibt sich folgender Gesamtbetrag", "wpsg").':');
7490 daniel 648
		$pdf->Text($prod_left + 80, $prod_top + $offset, __("Summe", "wpsg"));
5972 daniel 649
		$pdf->setXY($prod_left + 140, $prod_top + $offset - 5);
8302 karl 650
		$pdf->Cell(37, 8, wpsg_ff($this->view['basket']['arCalculation']['sum']['brutto'], $this->get_option('wpsg_currency')), 0, 0, 'R');
8190 karl 651
 
8302 karl 652
		$offset += 5;
653
 
8190 karl 654
	} else {
5972 daniel 655
 
8190 karl 656
		if ($bNoTax)
5972 daniel 657
		{
658
 
659
			$pdf->Text($prod_left, $prod_top + $offset, __("Es ergibt sich folgender Gesamtbetrag", "wpsg").':');
8190 karl 660
			$pdf->Text($prod_left + 80, $prod_top + $offset, __("Summe", "wpsg"));
5972 daniel 661
			$pdf->setXY($prod_left + 140, $prod_top + $offset - 5);
8190 karl 662
			$pdf->Cell(37, 8, wpsg_ff($this->view['basket']['arCalculation']['sum']['brutto'] + $this->view['basket']['arCalculation']['sum']['discount_brutto'], $this->get_option('wpsg_currency')), 0, 0, 'R');
663
			//if ( !$bNoTax || ($arCalculation['sum']['topay_brutto'] != $arCalculation['sum']['brutto']) )
5972 daniel 664
			$offset += 5;
8190 karl 665
 
666
			if ( !(($this->view['oOrder']->isInnerEu()) && ($this->view['oCalculationOrder']->getTaxMode() === \wpsg\wpsg_calculation::TAXMODE_B2B)) ) {
667
 
668
				if (sizeof($this->view['basket']['arCalculation']['tax']) >= 1)
669
				{
670
 
671
					$mw_count = 0;
672
					foreach ($this->view['basket']['arCalculation']['tax'] as $mw)
673
					{
674
 
675
						if ( $mw['tax_value'] > 0 && $mw['sum'] > 0 ) {
676
 
677
							$offset += 5;
678
							$pdf->Text($prod_left + 80, $prod_top + $offset, __("MwSt. ", "wpsg").wpsg_ff($mw['tax_value'], '%'));
679
							$pdf->setXY($prod_left + 140, $prod_top + $offset - 5);
680
							$pdf->Cell(37, 8, wpsg_ff($mw['sum'], $this->get_option('wpsg_currency')), 0, 0, 'R');
681
 
682
							$mw_count++;
683
 
684
						}
685
 
686
					}
5972 daniel 687
 
8190 karl 688
				}
5972 daniel 689
 
8190 karl 690
				if ($mw_count >= 2)
5972 daniel 691
				{
692
 
693
					$offset += 5;
8190 karl 694
					$pdf->Text($prod_left + 80, $prod_top + $offset, __("MwSt. GESAMT", "wpsg"));
5972 daniel 695
					$pdf->setXY($prod_left + 140, $prod_top + $offset - 5);
8190 karl 696
					$pdf->Cell(37, 8, wpsg_ff($this->view['basket']['arCalculation']['sum']['brutto'] - $this->view['basket']['arCalculation']['sum']['netto'], $this->get_option('wpsg_currency')), 0, 0, 'R');
5972 daniel 697
 
698
				}
8190 karl 699
 
700
			} else if ( !($arCalculation['sum']['topay_brutto'] != $arCalculation['sum']['brutto']) ) $offset -= 5;
701
 
702
		} else {
703
 
704
			$pdf->Text($prod_left, $prod_top + $offset, __("Der Gesamtbetrag setzt sich wie folgt zusammen", "wpsg").':');
705
 
706
			$pdf->Text($prod_left + 80, $prod_top + $offset, __("NETTOBETRAG", "wpsg"));
707
			$pdf->setXY($prod_left + 140, $prod_top + $offset - 5);
8302 karl 708
			$pdf->Cell(37, 8, wpsg_ff($this->view['basket']['arCalculation']['sum']['topay_netto'], $this->get_option('wpsg_currency')), 0, 0, 'R');
8190 karl 709
 
710
			if (sizeof($this->view['basket']['arCalculation']['tax']) >= 1)
711
			{
712
 
713
				$mw_count = 0;
714
				foreach ($this->view['basket']['arCalculation']['tax'] as $mw)
715
				{
716
 
717
					if ( $mw['tax_value'] > 0 && $mw['sum'] > 0) {
718
 
719
						$offset += 5;
720
						$pdf->Text($prod_left + 80, $prod_top + $offset, __("MwSt. ", "wpsg").wpsg_ff($mw['tax_value'], '%'));
721
						$pdf->setXY($prod_left + 140, $prod_top + $offset - 5);
722
						$pdf->Cell(37, 8, wpsg_ff($mw['sum'], $this->get_option('wpsg_currency')), 0, 0, 'R');
723
 
724
						$mw_count++;
725
 
726
					}
727
 
728
				}
5972 daniel 729
 
730
			}
8190 karl 731
 
732
			if ($mw_count >= 2)
5972 daniel 733
			{
734
 
735
				$offset += 5;
7490 daniel 736
				$pdf->Text($prod_left + 80, $prod_top + $offset, __("MwSt. GESAMT", "wpsg"));
5972 daniel 737
				$pdf->setXY($prod_left + 140, $prod_top + $offset - 5);
8190 karl 738
				$pdf->Cell(37, 8, wpsg_ff($this->view['basket']['arCalculation']['sum']['brutto'] - $this->view['basket']['arCalculation']['sum']['netto'], $this->get_option('wpsg_currency')), 0, 0, 'R');
739
 
740
			}
5972 daniel 741
 
8190 karl 742
		}
5972 daniel 743
 
744
	}
8190 karl 745
 
7490 daniel 746
	// Wertgutschein
8190 karl 747
	if ( $arCalculation['sum']['topay_brutto'] != $arCalculation['sum']['brutto'] ) {
748
 
749
		if (!$bNoTax) {
7490 daniel 750
 
8190 karl 751
			$offset += 5;
752
			$pdf->Text($prod_left + 80, $prod_top + $offset, __("SUMME", "wpsg"));
753
			$pdf->setXY($prod_left + 140, $prod_top + $offset - 5);
754
 
755
			$pdf->setFont('Arial', '', '9');
756
			$pdf->Cell(37, 8, wpsg_ff($this->view['basket']['arCalculation']['sum']['brutto'], $this->get_option('wpsg_currency')), 0, 0, 'R');
757
			$pdf->setFont('Arial', '', '9');
7490 daniel 758
 
8190 karl 759
		} else if (!($mw_count >= 2)) $offset -= 5;
760
 
7490 daniel 761
		foreach ($arCalculation['coupon'] as $c) {
762
 
763
			$offset += 5;
764
			$pdf->Text($prod_left + 80, $prod_top + $offset, __('Wertgutschein', 'wpsg').' '.((wpsg_isSizedString($c['code']))?'('.$c['code'].')':''));
765
			$pdf->setXY($prod_left + 140, $prod_top + $offset - 5);
766
 
767
			$pdf->setFont('Arial', '', '9');
768
			$pdf->Cell(37, 8, wpsg_ff($c[$taxdisplay], $this->get_option('wpsg_currency')), 0, 0, 'R');
769
			$pdf->setFont('Arial', '', '9');
770
 
771
		}
772
 
773
		$offset += 5;
774
		$pdf->setFont('Arial', 'B', '9');
8190 karl 775
		$pdf->Text($prod_left + 80, $prod_top + $offset, __("ZU ZAHLEN", "wpsg"));
7490 daniel 776
		$pdf->setXY($prod_left + 140, $prod_top + $offset - 5);
777
 
778
		/* Endbetrag wird fett ausgegeben */
779
		$pdf->setFont('Arial', 'B', '9');
780
		$pdf->Cell(37, 8, wpsg_ff($arCalculation['sum']['topay_brutto'], $this->get_option('wpsg_currency')), 0, 0, 'R');
781
		$pdf->setFont('Arial', '', '9');
782
 
783
	} else {
8190 karl 784
 
7490 daniel 785
		$offset += 5;
8190 karl 786
		$pdf->setFont('Arial', 'B', '9');
787
		$pdf->Text($prod_left + 80, $prod_top + $offset, __("GESAMTSUMME", "wpsg"));
7490 daniel 788
		$pdf->setXY($prod_left + 140, $prod_top + $offset - 5);
8241 karl 789
 
7490 daniel 790
		/* Endbetrag wird fett ausgegeben */
8190 karl 791
		$pdf->Cell(37, 8, wpsg_ff($arCalculation['sum']['topay_brutto'], $this->get_option('wpsg_currency')), 0, 0, 'R');
7490 daniel 792
		$pdf->setFont('Arial', '', '9');
8190 karl 793
 
7490 daniel 794
	}
795
 
8241 karl 796
	if ( ($this->get_option('wpsg_kleinunternehmer') == '1') || ($this->view['oCalculationOrder']->getTaxMode() === \wpsg\wpsg_calculation::TAXMODE_SMALLBUSINESS) )
5972 daniel 797
	{
8190 karl 798
 
799
		$offset += 3;
800
		$pdf->setFont('Arial', '', '8');
801
		$pdf->wpsg_MultiCell($prod_left - 1, $prod_top + $offset, 5, '('.$this->get_option('wpsg_kleinunternehmer_text').')');
802
		$offset += 8;
5972 daniel 803
 
804
	}
8190 karl 805
 
806
	$offset += 5;
5972 daniel 807
 
8190 karl 808
	if ($this->hasMod('wpsg_mod_deliverynote') && ($this->get_option('wpsg_rechnungen_deliverynote') == '1'))
5972 daniel 809
	{
810
 
811
		$arDN_order = $this->callMod('wpsg_mod_deliverynote', 'loadDeliveryNotesFromOrder', array($this->view['data']['id']));
812
		$delivery_date = $this->callMod('wpsg_mod_deliverynote', 'getDeliveryTime', array($this->view['data']['id']));
8190 karl 813
 
5972 daniel 814
		// Wenn es ein Gesamtlieferdatum gibt und nur einen Lieferschein, dann unter der Bestellung anzeigen
815
		if ($delivery_date !== false && sizeof($arDN_order) == 1)
816
		{
817
 
8190 karl 818
			$pdf->setFont('Arial', 'B', '9');
819
			$pdf->wpsg_MultiCell($prod_left - 1, $prod_top + $offset, 5, __('Lieferung:', 'wpsg'));
820
			$pdf->setFont('Arial', '', '9');
821
			$pdf->wpsg_MultiCell($prod_left + 16, $prod_top + $offset, 5, wpsg_translate(__('#1#', 'wpsg'), date('d.m.Y', $delivery_date)));
822
			$offset += 8;
5972 daniel 823
 
824
		}
825
 
826
	}
8190 karl 827
 
5972 daniel 828
	if ($this->view['fussText'] != "")
829
	{
8190 karl 830
 
831
		$pdf->setFont('Arial', '', '9');
5972 daniel 832
		$pdf->wpsg_MultiCell($prod_left - 1, $prod_top + $offset, 5, $this->view['fussText']);
8190 karl 833
		$offset += 8;
5972 daniel 834
 
835
	}
836
 
8190 karl 837
	$offset += 10;
838
 
5972 daniel 839
	$shipping_adress = false;
8190 karl 840
	if ($this->hasMod('wpsg_mod_shippingadress') && $this->callMod('wpsg_mod_shippingadress', 'check_different_shippingadress', array('k_id' => $this->view['data']['k_id'], 'o_id' => $this->view['data']['id']))) {
841
 
5972 daniel 842
		$pdf->setFont('Arial', 'B', 9);
843
		$pdf->Text($prod_left, $prod_top + $offset, __("Lieferanschrift", "wpsg").":");
8190 karl 844
		$offset += 2;
5972 daniel 845
 
8190 karl 846
		$pdf->setFont('Arial', '', 9);
5972 daniel 847
 
8190 karl 848
			$shipping_adress = "";
849
			if ($this->view['data']['shipping_firma'] != "")
850
			{
851
				$shipping_adress .= $this->view['data']['shipping_firma']."\r\n";
852
			}
853
			$shipping_adress .= $this->view['data']['shipping_vname'].' '.$this->view['data']['shipping_name']."\r\n";
854
			$shipping_adress .= $this->view['data']['shipping_strasse'].' '.$this->view['data']['shipping_nr']."\r\n";
855
			// $shipping_adress .= $this->view['data']['shipping_land']['kuerzel'].'-';
856
 
857
			$shipping_adress .= $this->view['data']['shipping_plz'].' '.$this->view['data']['shipping_ort']."\r\n";
858
			$shipping_adress .= $this->view['data']['shipping_land']['name'];
5972 daniel 859
 
860
		$start = $pdf->getY();
861
		$pdf->wpsg_MultiCell($prod_left - 1, $prod_top + $offset, 5, $shipping_adress, 0, 'L', 0, 100);
862
		$offset += $pdf->getY() - $start;
863
 
864
		$shipping_adress = true;
865
 
866
	}
8190 karl 867
 
5972 daniel 868
	// Bestellvariablen
869
	if ($this->hasMod('wpsg_mod_ordervars') && $this->get_option('wpsg_mod_rechnungen_showov') == '1')
870
	{
8190 karl 871
 
872
		$pdf->SetFont('Arial', 'B', 9);
873
		$pdf->wpsg_MultiCell($prod_left - 1, $prod_top + $offset - 7, 5, __("Angaben während der Bestellung", "wpsg").":");
5972 daniel 874
 
8190 karl 875
		$pdf->SetFont('Arial', '', 9);
876
 
877
			$bvars = @unserialize($this->view['data']['bvars']);
878
			if (!is_array($bvars)) $bvars = array();
5972 daniel 879
 
8190 karl 880
			$strBVars = "";
881
			foreach ($bvars as $bvars_id => $bvars_value)
5972 daniel 882
			{
8190 karl 883
 
884
				$bvars = $this->db->fetchRow("SELECT * FROM `".wpsg_q(WPSG_TBL_ORDERVARS)."` WHERE `id` = '".wpsg_q($bvars_id)."' ORDER BY `pos` ASC, `id` ASC ");
885
 
886
				if ($bvars['typ'] == "1") // Auswahl
887
				{
888
					if ($bvars_value <= 0) $bvars_value = __("Keine Angabe", "wpsg");
889
				}
890
				else if ($bvars['typ'] == "2") // Texteingabe
891
				{
892
					if (trim($bvars_value) == "") $bvars_value = __("Keine Angabe", "wpsg");
893
				}
894
				else if ($bvars['typ'] == "3") // Checkbox
895
				{
896
					if ($bvars_value <= 0) $bvars_value = __("Keine Angabe", "wpsg");
897
				}
898
 
899
				$bvars_name = $this->callMod('wpsg_mod_ordervars', 'getNameById', array($bvars_id));
900
				$strBVars .= "\r\n".$bvars_name.": ".$bvars_value;
901
 
5972 daniel 902
			}
903
 
8190 karl 904
		$pdf->wpsg_MultiCell($prod_left - 1, $prod_top + $offset - 6, 5, $strBVars);
905
 
906
	}
8214 daniel 907
 
5972 daniel 908
	$this->callMods('wpsg_mod_rechnungen_pdf', array(&$pdf, &$this->view['data']['id'], &$this->view['preview'], &$this->view['invoice']));
909
 
910
	$filename = $this->view['filename'].".pdf";
6901 daniel 911
 
912
    ob_end_clean();
913
 
8007 daniel 914
	if ($this->view['preview']) {
6901 daniel 915
 
5972 daniel 916
		$pdf->Output($filename, 'I');
6901 daniel 917
 
8007 daniel 918
	} else {
5972 daniel 919
 
8214 daniel 920
		$pdf->Output($oInvoice->getFilePath(), 'F');
5972 daniel 921
 
922
		// Hier wird der Dateiname an FPD übergeben. Er soll sich aus der Rechnungsnummer ergeben, auch wenn das Dokument über die ID gespeichert ist.
8007 daniel 923
		$pdf->Output($this->view['filename_out'], 'I');
5972 daniel 924
 
925
	}
8190 karl 926
 
927
?>