Subversion Repositories wpShopGermany4

Rev

Rev 8190 | Rev 8241 | Go to most recent revision | 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'];
36
 
37
	if ($this->getFrontendTaxView() === WPSG_NETTO) $taxdisplay = 'netto';
38
	else $taxdisplay = 'brutto';
8190 karl 39
 
5972 daniel 40
	// Damit die Steuer bei der Kleinunternehmerregelung nicht angezeigt wird leer ich den Array sicherheitshalber
8190 karl 41
	if ( ($this->get_option('wpsg_kleinunternehmer') == '1') || ($this->view['oCalculationOrder']->getTaxMode() === \wpsg\wpsg_calculation::TAXMODE_SMALLBUSINESS) ) unset($this->view['basket']['mwst']);
5972 daniel 42
 
43
	if (!function_exists('AddRechnungPage'))
44
	{
45
 
46
		function AddRechnungPage($shop, $pdf)
47
		{
48
 
49
			global $absender_left, $absender_top, $adress_left, $adress_top, $rdata_left, $rdata_top;
50
 
51
			$pdf->AddPage();
52
 
8214 daniel 53
			if (file_exists($shop->callMod('wpsg_mod_rechnungen', 'getPaperPath', array())."wpsg_rechnungen_bp.pdf"))
5972 daniel 54
			{
55
 
8214 daniel 56
				$pagecount = $pdf->setSourceFile($shop->callMod('wpsg_mod_rechnungen', 'getPaperPath', array())."wpsg_rechnungen_bp.pdf");
5972 daniel 57
				$tplidx = $pdf->importPage(1, '/MediaBox');
58
				$pdf->useTemplate($tplidx, 0, 0, 210);
59
 
60
			}
8214 daniel 61
			if (file_exists($shop->callMod('wpsg_mod_rechnungen', 'getPaperPath', array())."wpsg_rechnungen_bp.jpg"))
5972 daniel 62
			{
8214 daniel 63
				$pdf->image($shop->callMod('wpsg_mod_rechnungen', 'getPaperPath', array())."wpsg_rechnungen_bp.jpg", 0, 0, 210, 297, 'jpg');
5972 daniel 64
			}
65
 
66
 
8214 daniel 67
			if (file_exists($shop->callMod('wpsg_mod_rechnungen', 'getPaperPath', array())."wpsg_rechnungen_logo.jpg"))
5972 daniel 68
			{
69
 
8214 daniel 70
				list($width, $height, $type, $attr) = getimagesize($shop->callMod('wpsg_mod_rechnungen', 'getPaperPath', array())."wpsg_rechnungen_logo.jpg");
5972 daniel 71
 
72
				//wpsg_debug($width.":".$height);
73
 
74
				$wPix = (25.4 * $width) / 96;
75
				$hPix = (25.4 * $height) / 96;
76
 
8214 daniel 77
				$pdf->image($shop->callMod('wpsg_mod_rechnungen', 'getPaperPath', array())."wpsg_rechnungen_logo.jpg", 210 - $wPix, 0, $wPix, $hPix);
5972 daniel 78
 
79
			}
80
 
81
			// Absenderadresszeile (Wird in der Konfiguration hinterlegt)
82
			$pdf->SetFont('Arial', '', 6);
83
			$pdf->Text($absender_left, $absender_top, $shop->replaceUniversalPlatzhalter(__($shop->get_option("wpsg_rechnungen_adresszeile"), 'wpsg'), $shop->view['data']['id']));
84
 
85
			if (wpsg_getStr($shop->view['kunde']['kuerzel']) != "") $shop->view['kunde']['kuerzel'] = $shop->view['kunde']['kuerzel'].'-';
86
 
87
			// Adresse des Kunden
88
			$pdf->SetFont('Arial', '', 12);
89
			$pdf->Text($adress_left, $adress_top, $shop->view['kunde']['firma']);
90
			$pdf->Text($adress_left, $adress_top + 5, $shop->view['kunde']['vname'].' '.$shop->view['kunde']['name']);
7247 daniel 91
			$pdf->Text($adress_left, $adress_top + 10, $shop->view['kunde']['strasse'].' '.wpsg_getStr($shop->view['kunde']['nr']));
5972 daniel 92
			$pdf->Text($adress_left, $adress_top + 15, $shop->view['kunde']['plz'].' '.$shop->view['kunde']['ort']);
93
 
8007 daniel 94
			if ($shop->get_option("wpsg_mod_rechnungen_hideCountry") == '0') $pdf->Text($adress_left, $adress_top + 20, strtoupper($shop->view['oOrder']->getInvoiceCountryName()));
95
 
5972 daniel 96
			// Rechnungsdaten
97
			$pdf->SetFont('Arial', 'B', 16);
7676 daniel 98
			$pdf->Text($rdata_left, $rdata_top, __('Rechnungskorrektur', 'wpsg'));
5972 daniel 99
			$pdf->SetFont('Arial', 'B', 9);
100
			$pdf->Text($rdata_left, $rdata_top + 6, $shop->view['rnr']);
101
			$pdf->SetFont('Arial', '', 9);
102
 
103
			if (isset($shop->view['faelligkeitdatum']))
104
			{
105
 
106
				$pdf->Text($rdata_left + 35, $rdata_top, __("Fällig am", "wpsg"));
8190 karl 107
				$pdf->Text($rdata_left + 35, $rdata_top + 6, date("d.m.Y", strtotime($shop->view['faelligkeitdatum'])));
5972 daniel 108
 
109
			}
110
 
111
			if (isset($shop->view['payment']))
112
			{
113
 
114
				$pdf->Text($rdata_left + 58, $rdata_top, __("Zahlungsbedingungen", "wpsg"));
115
				$pdf->Text($rdata_left + 58, $rdata_top + 6, $shop->view['payment']);
116
 
117
			}
118
 
119
			$pdf->Text($rdata_left + 105, $rdata_top, __("Kunden-Nr", "wpsg"));
120
			$pdf->Text($rdata_left + 105, $rdata_top + 6, (($shop->view['kunde']['knr'] != '')?$shop->view['kunde']['knr']:$shop->view['kunde']['id']));
121
 
122
			$pdf->Text($rdata_left + 135, $rdata_top, __("Best. Nr.", "wpsg"));
123
			$pdf->Text($rdata_left + 135, $rdata_top + 6, ((trim($shop->view['data']['onr']) != '')?$shop->view['data']['onr']:$shop->view['data']['id']));
124
 
125
			$pdf->Text($rdata_left + 155, $rdata_top, __("Datum", "wpsg"));
8190 karl 126
			$pdf->Text($rdata_left + 155, $rdata_top + 6, date("d.m.Y", strtotime($shop->view['rDatum'])));
5972 daniel 127
 
128
			if ($shop->view['oOrder']->isInnerEu())
129
			{
7153 thomas 130
 
131
            	$pdf->SetFont('Arial', '', 9);
132
                $pdf->Text($adress_left, $rdata_top + 11.5, __("Innergemeinschaftliche Lieferung.", "wpsg"));
133
 
134
            } else if (!$shop->view['oOrder']->isInnerEu() && $shop->view['oOrder']->getShippingCountryID() != $shop->getDefaultCountry(true)) {
135
 
136
			// Nicht InnerEU und Nicht Inland
137
 
138
             	$pdf->SetFont('Arial', '', 9);
139
                $pdf->Text($adress_left, $rdata_top + 11.5, __("Steuerfreie Ausfuhrlieferung.", "wpsg"));
140
 
5972 daniel 141
			}
7153 thomas 142
 
5972 daniel 143
			// Benutzerdefinierte Felder
144
			$arTexte = $shop->callMod('wpsg_mod_rechnungen', 'getRechnungstexte', array($shop->view['data']['id']));
145
 
146
			foreach ((array)$arTexte as $text)
147
			{
148
 
149
				if (isset($text['aktiv']) && $text['aktiv'] == 1)
150
				{
151
 
152
					$pdf->SetFont('Arial', 'B', ((intval($text['fontsize']) > 0)?intval($text['fontsize']):10));
153
					$pdf->wpsg_SetTextColor($text['color']);
154
					$pdf->wpsg_MultiCell($text['x'], $text['y'], 5, $text['text']);
155
					$pdf->wpsg_SetTextColor("#000000");
156
 
157
				}
158
 
159
			}
160
 
161
		}
162
 
163
	}
8190 karl 164
 
5972 daniel 165
	$pdf = new wpsg_fpdf();
166
	$pdf->SetAutoPageBreak(true, 5);
167
	AddRechnungPage($this, $pdf);
8190 karl 168
 
169
	if ( ($this->view['oCalculationOrder']->getTaxMode() === \wpsg\wpsg_calculation::TAXMODE_B2B && $this->view['oOrder']->isInnerEu())
170
	|| ($this->view['oCalculationOrder']->getTaxMode() === \wpsg\wpsg_calculation::TAXMODE_SMALLBUSINESS)
171
	) $bNoTax = true;
172
	else $bNoTax = false;
173
 
174
	$bTaxCol = false;
175
	if ($this->get_option('wpsg_showMwstAlways') === '1') $bTaxCol = true;
176
	else if (!$bNoTax) $bTaxCol = true;
177
 
178
 
179
	if ($bNoTax) {
180
 
181
		$discount_value = $this->view['basket']['arCalculation']['sum']['discount_netto'];
182
		$shipping_cost = $this->view['basket']['arCalculation']['sum']['shipping_netto'];
183
		$payment_cost = $this->view['basket']['arCalculation']['sum']['payment_netto'];
184
 
185
	} else {
186
 
187
		$discount_value = $this->view['basket']['arCalculation']['sum']['discount_brutto'];
188
		$shipping_cost = $this->view['basket']['arCalculation']['sum']['shipping_brutto'];
189
		$payment_cost = $this->view['basket']['arCalculation']['sum']['payment_brutto'];
190
 
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
 
8190 karl 486
			if ($this->arShipping[$this->view['data']['type_shipping']]['mwst_null'] == '1' && $bNoTax) $mwst = wpsg_ff(0.00, '%');
487
			else {
5972 daniel 488
 
8190 karl 489
				if ($this->view['basket']['arCalculation']['shipping'][0]['tax_key'] === '0') $mwst = _('anteilig');
490
				else {
5972 daniel 491
 
7642 daniel 492
					$mwst = wpsg_ff($this->view['basket']['arCalculation']['shipping'][0]['tax'], '%');
493
					$mwst = wpsg_ff($this->view['basket']['arCalculation']['tax'][$this->view['basket']['arCalculation']['shipping'][0]['tax_key']]['tax_value'], '%');
5972 daniel 494
 
495
				}
7642 daniel 496
 
5972 daniel 497
			}
498
 
499
			$pdf->setXY($prod_left + 97, $prod_top + $offset);
500
			$pdf->Cell(15, 8, $mwst, 1, 0, 'C');
501
 
502
		}
503
 
504
		$pdf->setXY($prod_left + 112, $prod_top + $offset);
505
		$pdf->Cell(15, 8, '1', 1, 0, 'C');
506
 
507
		$pdf->setXY($prod_left + 127, $prod_top + $offset);
8190 karl 508
		$pdf->Cell(25, 8, wpsg_ff($shipping_cost, $this->get_option('wpsg_currency')), 1, 0, 'R');
5972 daniel 509
 
510
		$pdf->setXY($prod_left + 152, $prod_top + $offset);
8190 karl 511
		$pdf->Cell(25, 8, wpsg_ff($shipping_cost, $this->get_option('wpsg_currency')), 1, 0, 'R');
5972 daniel 512
 
513
		$offset += 8;
514
 
515
	}
516
 
517
	// Zahlungskosten
8190 karl 518
	if ( ($payment_cost != '') && ($payment_cost != 0) )
5972 daniel 519
	{
520
 
521
		$pdf->SetFont('Arial', '', 9);
522
		$pdf->setXY($prod_left, $prod_top + $offset);
523
		$pdf->Cell(10, 8, $pnr.'.', 1, 0, 'C'); $pnr ++;
524
 
525
		$pdf->setXY($prod_left + 10, $prod_top + $offset);
8190 karl 526
		$pdf->Cell( (($bTaxCol)?87:102), 8, $this->arPayment[$this->view['data']['type_payment']]['name'], 1, 0, 'L');
5972 daniel 527
 
8190 karl 528
		if ($bTaxCol)
5972 daniel 529
		{
530
 
8190 karl 531
			if ($this->arPayment[$this->view['data']['type_payment']]['mwst_null'] == '1' && $bNoTax)
5972 daniel 532
			{
8190 karl 533
 
534
				$mwst = wpsg_ff(0.00, '%');
535
 
536
			} else {
5972 daniel 537
 
7642 daniel 538
				if ($this->view['basket']['arCalculation']['payment'][0]['tax_key'] === '0') {
5972 daniel 539
 
7642 daniel 540
					$mwst = _('anteilig');
5972 daniel 541
 
7642 daniel 542
				} else {
543
 
544
					$mwst = wpsg_ff($this->view['basket']['arCalculation']['payment'][0]['tax'], '%');
545
					$mwst = wpsg_ff($this->view['basket']['arCalculation']['tax'][$this->view['basket']['arCalculation']['payment'][0]['tax_key']]['tax_value'], '%');
546
 
5972 daniel 547
				}
548
 
549
			}
550
 
551
			$pdf->setXY($prod_left + 97, $prod_top + $offset);
552
			$pdf->Cell(15, 8, $mwst, 1, 0, 'C');
553
 
554
		}
555
 
556
		$pdf->setXY($prod_left + 112, $prod_top + $offset);
557
		$pdf->Cell(15, 8, '1', 1, 0, 'C');
558
 
559
		$pdf->setXY($prod_left + 127, $prod_top + $offset);
8190 karl 560
		$pdf->Cell(25, 8, wpsg_ff($payment_cost, $this->get_option('wpsg_currency')), 1, 0, 'R');
5972 daniel 561
 
562
		$pdf->setXY($prod_left + 152, $prod_top + $offset);
8190 karl 563
		$pdf->Cell(25, 8, wpsg_ff($payment_cost, $this->get_option('wpsg_currency')), 1, 0, 'R');
5972 daniel 564
 
565
		$offset += 8;
566
 
567
	}
568
 
569
	// Gebühr
570
	if (wpsg_tf(wpsg_getStr($this->view['storno_fee'])) > 0)
571
	{
572
 
573
		$pdf->SetFont('Arial', '', 9);
574
		$pdf->setXY($prod_left, $prod_top + $offset);
575
		$pdf->Cell(10, 8, $pnr.'.', 1, 0, 'C'); $pnr ++;
576
 
577
		$label = __('Bearbeitungsgebühr', 'wpsg');
578
 
579
		if (strpos($this->view['storno_fee'], '%') !== false) $label .= ' ('.wpsg_ff($this->view['storno_fee'], '%').')';
580
 
581
		$pdf->setXY($prod_left + 10, $prod_top + $offset);
8190 karl 582
		$pdf->Cell( (($bTaxCol)?87:102), 8, $label, 1, 0, 'L');
5972 daniel 583
 
8190 karl 584
		if ($bTaxCol)
5972 daniel 585
		{
586
 
8190 karl 587
			if ($bNoTax) $mwst = wpsg_ff(0.00, '%');
588
			else $mwst = wpsg_ff($this->view['storno_fee_tax_value'], '%');
5972 daniel 589
 
590
			$pdf->setXY($prod_left + 97, $prod_top + $offset);
591
			$pdf->Cell(15, 8, $mwst, 1, 0, 'C');
592
 
593
		}
594
 
595
		$pdf->setXY($prod_left + 112, $prod_top + $offset);
596
		$pdf->Cell(15, 8, '1', 1, 0, 'C');
597
 
598
		$pdf->setXY($prod_left + 127, $prod_top + $offset);
599
		$pdf->Cell(25, 8, '-'.wpsg_ff($this->view['storno_fee_value'], $this->get_option('wpsg_currency')), 1, 0, 'R');
600
 
601
		$pdf->setXY($prod_left + 152, $prod_top + $offset);
602
		$pdf->Cell(25, 8, '-'.wpsg_ff($this->view['storno_fee_value'], $this->get_option('wpsg_currency')), 1, 0, 'R');
603
 
604
		$offset += 8;
605
 
606
	}
607
 
608
	$pdf->SetFont('Arial', '', 9);
609
 
610
	if ($this->view['kunde']['ustidnr'] != "")
611
	{
612
		$offset += 10;
613
		$pdf->Text($prod_left, $prod_top + $offset, __("Ihre Umsatzsteuer-Identifikationsnummer:", "wpsg"));
614
		$pdf->setXY($prod_left + 140, $prod_top + $offset - 5);
615
		$pdf->Cell(37, 8, $this->view['kunde']['ustidnr'], 0, 0, 'R');
616
	}
617
 
8190 karl 618
	$offset += 10; // Abstand zwischen Tabelle und Auswertung
619
 
620
	if ( $this->get_option('wpsg_kleinunternehmer') || ($this->view['oCalculationOrder']->getTaxMode() === \wpsg\wpsg_calculation::TAXMODE_SMALLBUSINESS) )
5972 daniel 621
	{
8190 karl 622
 
5972 daniel 623
		$pdf->Text($prod_left, $prod_top + $offset, __("Es ergibt sich folgender Gesamtbetrag", "wpsg").':');
7490 daniel 624
		$pdf->Text($prod_left + 80, $prod_top + $offset, __("Summe", "wpsg"));
5972 daniel 625
		$pdf->setXY($prod_left + 140, $prod_top + $offset - 5);
8190 karl 626
		$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');
627
		if ( !$bNoTax || ($arCalculation['sum']['topay_brutto'] != $arCalculation['sum']['brutto']) ) $offset += 5;
628
 
629
	} else {
5972 daniel 630
 
8190 karl 631
		if ($bNoTax)
5972 daniel 632
		{
633
 
634
			$pdf->Text($prod_left, $prod_top + $offset, __("Es ergibt sich folgender Gesamtbetrag", "wpsg").':');
8190 karl 635
			$pdf->Text($prod_left + 80, $prod_top + $offset, __("Summe", "wpsg"));
5972 daniel 636
			$pdf->setXY($prod_left + 140, $prod_top + $offset - 5);
8190 karl 637
			$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');
638
			//if ( !$bNoTax || ($arCalculation['sum']['topay_brutto'] != $arCalculation['sum']['brutto']) )
5972 daniel 639
			$offset += 5;
8190 karl 640
 
641
			if ( !(($this->view['oOrder']->isInnerEu()) && ($this->view['oCalculationOrder']->getTaxMode() === \wpsg\wpsg_calculation::TAXMODE_B2B)) ) {
642
 
643
				if (sizeof($this->view['basket']['arCalculation']['tax']) >= 1)
644
				{
645
 
646
					$mw_count = 0;
647
					foreach ($this->view['basket']['arCalculation']['tax'] as $mw)
648
					{
649
 
650
						if ( $mw['tax_value'] > 0 && $mw['sum'] > 0 ) {
651
 
652
							$offset += 5;
653
							$pdf->Text($prod_left + 80, $prod_top + $offset, __("MwSt. ", "wpsg").wpsg_ff($mw['tax_value'], '%'));
654
							$pdf->setXY($prod_left + 140, $prod_top + $offset - 5);
655
							$pdf->Cell(37, 8, wpsg_ff($mw['sum'], $this->get_option('wpsg_currency')), 0, 0, 'R');
656
 
657
							$mw_count++;
658
 
659
						}
660
 
661
					}
5972 daniel 662
 
8190 karl 663
				}
5972 daniel 664
 
8190 karl 665
				if ($mw_count >= 2)
5972 daniel 666
				{
667
 
668
					$offset += 5;
8190 karl 669
					$pdf->Text($prod_left + 80, $prod_top + $offset, __("MwSt. GESAMT", "wpsg"));
5972 daniel 670
					$pdf->setXY($prod_left + 140, $prod_top + $offset - 5);
8190 karl 671
					$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 672
 
673
				}
8190 karl 674
 
675
			} else if ( !($arCalculation['sum']['topay_brutto'] != $arCalculation['sum']['brutto']) ) $offset -= 5;
676
 
677
		} else {
678
 
679
			$pdf->Text($prod_left, $prod_top + $offset, __("Der Gesamtbetrag setzt sich wie folgt zusammen", "wpsg").':');
680
 
681
			$pdf->Text($prod_left + 80, $prod_top + $offset, __("NETTOBETRAG", "wpsg"));
682
			$pdf->setXY($prod_left + 140, $prod_top + $offset - 5);
683
			$pdf->Cell(37, 8, wpsg_ff($this->view['basket']['arCalculation']['sum']['netto'] + $this->view['basket']['arCalculation']['sum']['discount_netto'], $this->get_option('wpsg_currency')), 0, 0, 'R');
684
 
685
			if (sizeof($this->view['basket']['arCalculation']['tax']) >= 1)
686
			{
687
 
688
				$mw_count = 0;
689
				foreach ($this->view['basket']['arCalculation']['tax'] as $mw)
690
				{
691
 
692
					if ( $mw['tax_value'] > 0 && $mw['sum'] > 0) {
693
 
694
						$offset += 5;
695
						$pdf->Text($prod_left + 80, $prod_top + $offset, __("MwSt. ", "wpsg").wpsg_ff($mw['tax_value'], '%'));
696
						$pdf->setXY($prod_left + 140, $prod_top + $offset - 5);
697
						$pdf->Cell(37, 8, wpsg_ff($mw['sum'], $this->get_option('wpsg_currency')), 0, 0, 'R');
698
 
699
						$mw_count++;
700
 
701
					}
702
 
703
				}
5972 daniel 704
 
705
			}
8190 karl 706
 
707
			if ($mw_count >= 2)
5972 daniel 708
			{
709
 
710
				$offset += 5;
7490 daniel 711
				$pdf->Text($prod_left + 80, $prod_top + $offset, __("MwSt. GESAMT", "wpsg"));
5972 daniel 712
				$pdf->setXY($prod_left + 140, $prod_top + $offset - 5);
8190 karl 713
				$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');
714
 
715
			}
5972 daniel 716
 
8190 karl 717
		}
5972 daniel 718
 
719
	}
720
 
721
	// Rabatt
8190 karl 722
	if ($discount_value > 0)
5972 daniel 723
	{
724
 
725
		$offset += 5;
7490 daniel 726
		$pdf->Text($prod_left + 80, $prod_top + $offset, __("Rabatt", "wpsg"));
5972 daniel 727
		$pdf->setXY($prod_left + 140, $prod_top + $offset - 5);
8190 karl 728
		$pdf->Cell(37, 8, '-'.wpsg_ff($discount_value, $this->get_option('wpsg_currency')), 0, 0, 'R');
5972 daniel 729
 
730
	}
8190 karl 731
 
7490 daniel 732
	// Wertgutschein
8190 karl 733
	if ( $arCalculation['sum']['topay_brutto'] != $arCalculation['sum']['brutto'] ) {
734
 
735
		if (!$bNoTax) {
7490 daniel 736
 
8190 karl 737
			$offset += 5;
738
			$pdf->Text($prod_left + 80, $prod_top + $offset, __("SUMME", "wpsg"));
739
			$pdf->setXY($prod_left + 140, $prod_top + $offset - 5);
740
 
741
			$pdf->setFont('Arial', '', '9');
742
			$pdf->Cell(37, 8, wpsg_ff($this->view['basket']['arCalculation']['sum']['brutto'], $this->get_option('wpsg_currency')), 0, 0, 'R');
743
			$pdf->setFont('Arial', '', '9');
7490 daniel 744
 
8190 karl 745
		} else if (!($mw_count >= 2)) $offset -= 5;
746
 
7490 daniel 747
		foreach ($arCalculation['coupon'] as $c) {
748
 
749
			$offset += 5;
750
			$pdf->Text($prod_left + 80, $prod_top + $offset, __('Wertgutschein', 'wpsg').' '.((wpsg_isSizedString($c['code']))?'('.$c['code'].')':''));
751
			$pdf->setXY($prod_left + 140, $prod_top + $offset - 5);
752
 
753
			$pdf->setFont('Arial', '', '9');
754
			$pdf->Cell(37, 8, wpsg_ff($c[$taxdisplay], $this->get_option('wpsg_currency')), 0, 0, 'R');
755
			$pdf->setFont('Arial', '', '9');
756
 
757
		}
758
 
759
		$offset += 5;
760
		$pdf->setFont('Arial', 'B', '9');
8190 karl 761
		$pdf->Text($prod_left + 80, $prod_top + $offset, __("ZU ZAHLEN", "wpsg"));
7490 daniel 762
		$pdf->setXY($prod_left + 140, $prod_top + $offset - 5);
763
 
764
		/* Endbetrag wird fett ausgegeben */
765
		$pdf->setFont('Arial', 'B', '9');
766
		$pdf->Cell(37, 8, wpsg_ff($arCalculation['sum']['topay_brutto'], $this->get_option('wpsg_currency')), 0, 0, 'R');
767
		$pdf->setFont('Arial', '', '9');
768
 
769
	} else {
8190 karl 770
 
7490 daniel 771
		$offset += 5;
8190 karl 772
		$pdf->setFont('Arial', 'B', '9');
773
		$pdf->Text($prod_left + 80, $prod_top + $offset, __("GESAMTSUMME", "wpsg"));
7490 daniel 774
		$pdf->setXY($prod_left + 140, $prod_top + $offset - 5);
8190 karl 775
 
7490 daniel 776
		/* Endbetrag wird fett ausgegeben */
8190 karl 777
		$pdf->Cell(37, 8, wpsg_ff($arCalculation['sum']['topay_brutto'], $this->get_option('wpsg_currency')), 0, 0, 'R');
7490 daniel 778
		$pdf->setFont('Arial', '', '9');
8190 karl 779
 
7490 daniel 780
	}
781
 
8190 karl 782
	if (($this->get_option('wpsg_kleinunternehmer') == '1') || ($this->view['oCalculationOrder']->getTaxMode() === \wpsg\wpsg_calculation::TAXMODE_SMALLBUSINESS) )
5972 daniel 783
	{
8190 karl 784
 
785
		$offset += 3;
786
		$pdf->setFont('Arial', '', '8');
787
		$pdf->wpsg_MultiCell($prod_left - 1, $prod_top + $offset, 5, '('.$this->get_option('wpsg_kleinunternehmer_text').')');
788
		$offset += 8;
5972 daniel 789
 
790
	}
8190 karl 791
 
792
	$offset += 5;
5972 daniel 793
 
8190 karl 794
	if ($this->hasMod('wpsg_mod_deliverynote') && ($this->get_option('wpsg_rechnungen_deliverynote') == '1'))
5972 daniel 795
	{
796
 
797
		$arDN_order = $this->callMod('wpsg_mod_deliverynote', 'loadDeliveryNotesFromOrder', array($this->view['data']['id']));
798
		$delivery_date = $this->callMod('wpsg_mod_deliverynote', 'getDeliveryTime', array($this->view['data']['id']));
8190 karl 799
 
5972 daniel 800
		// Wenn es ein Gesamtlieferdatum gibt und nur einen Lieferschein, dann unter der Bestellung anzeigen
801
		if ($delivery_date !== false && sizeof($arDN_order) == 1)
802
		{
803
 
8190 karl 804
			$pdf->setFont('Arial', 'B', '9');
805
			$pdf->wpsg_MultiCell($prod_left - 1, $prod_top + $offset, 5, __('Lieferung:', 'wpsg'));
806
			$pdf->setFont('Arial', '', '9');
807
			$pdf->wpsg_MultiCell($prod_left + 16, $prod_top + $offset, 5, wpsg_translate(__('#1#', 'wpsg'), date('d.m.Y', $delivery_date)));
808
			$offset += 8;
5972 daniel 809
 
810
		}
811
 
812
	}
8190 karl 813
 
5972 daniel 814
	if ($this->view['fussText'] != "")
815
	{
8190 karl 816
 
817
		$pdf->setFont('Arial', '', '9');
5972 daniel 818
		$pdf->wpsg_MultiCell($prod_left - 1, $prod_top + $offset, 5, $this->view['fussText']);
8190 karl 819
		$offset += 8;
5972 daniel 820
 
821
	}
822
 
8190 karl 823
	$offset += 10;
824
 
5972 daniel 825
	$shipping_adress = false;
8190 karl 826
	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']))) {
827
 
5972 daniel 828
		$pdf->setFont('Arial', 'B', 9);
829
		$pdf->Text($prod_left, $prod_top + $offset, __("Lieferanschrift", "wpsg").":");
8190 karl 830
		$offset += 2;
5972 daniel 831
 
8190 karl 832
		$pdf->setFont('Arial', '', 9);
5972 daniel 833
 
8190 karl 834
			$shipping_adress = "";
835
			if ($this->view['data']['shipping_firma'] != "")
836
			{
837
				$shipping_adress .= $this->view['data']['shipping_firma']."\r\n";
838
			}
839
			$shipping_adress .= $this->view['data']['shipping_vname'].' '.$this->view['data']['shipping_name']."\r\n";
840
			$shipping_adress .= $this->view['data']['shipping_strasse'].' '.$this->view['data']['shipping_nr']."\r\n";
841
			// $shipping_adress .= $this->view['data']['shipping_land']['kuerzel'].'-';
842
 
843
			$shipping_adress .= $this->view['data']['shipping_plz'].' '.$this->view['data']['shipping_ort']."\r\n";
844
			$shipping_adress .= $this->view['data']['shipping_land']['name'];
5972 daniel 845
 
846
		$start = $pdf->getY();
847
		$pdf->wpsg_MultiCell($prod_left - 1, $prod_top + $offset, 5, $shipping_adress, 0, 'L', 0, 100);
848
		$offset += $pdf->getY() - $start;
849
 
850
		$shipping_adress = true;
851
 
852
	}
8190 karl 853
 
5972 daniel 854
	// Bestellvariablen
855
	if ($this->hasMod('wpsg_mod_ordervars') && $this->get_option('wpsg_mod_rechnungen_showov') == '1')
856
	{
8190 karl 857
 
858
		$pdf->SetFont('Arial', 'B', 9);
859
		$pdf->wpsg_MultiCell($prod_left - 1, $prod_top + $offset - 7, 5, __("Angaben während der Bestellung", "wpsg").":");
5972 daniel 860
 
8190 karl 861
		$pdf->SetFont('Arial', '', 9);
862
 
863
			$bvars = @unserialize($this->view['data']['bvars']);
864
			if (!is_array($bvars)) $bvars = array();
5972 daniel 865
 
8190 karl 866
			$strBVars = "";
867
			foreach ($bvars as $bvars_id => $bvars_value)
5972 daniel 868
			{
8190 karl 869
 
870
				$bvars = $this->db->fetchRow("SELECT * FROM `".wpsg_q(WPSG_TBL_ORDERVARS)."` WHERE `id` = '".wpsg_q($bvars_id)."' ORDER BY `pos` ASC, `id` ASC ");
871
 
872
				if ($bvars['typ'] == "1") // Auswahl
873
				{
874
					if ($bvars_value <= 0) $bvars_value = __("Keine Angabe", "wpsg");
875
				}
876
				else if ($bvars['typ'] == "2") // Texteingabe
877
				{
878
					if (trim($bvars_value) == "") $bvars_value = __("Keine Angabe", "wpsg");
879
				}
880
				else if ($bvars['typ'] == "3") // Checkbox
881
				{
882
					if ($bvars_value <= 0) $bvars_value = __("Keine Angabe", "wpsg");
883
				}
884
 
885
				$bvars_name = $this->callMod('wpsg_mod_ordervars', 'getNameById', array($bvars_id));
886
				$strBVars .= "\r\n".$bvars_name.": ".$bvars_value;
887
 
5972 daniel 888
			}
889
 
8190 karl 890
		$pdf->wpsg_MultiCell($prod_left - 1, $prod_top + $offset - 6, 5, $strBVars);
891
 
892
	}
8214 daniel 893
 
5972 daniel 894
	$this->callMods('wpsg_mod_rechnungen_pdf', array(&$pdf, &$this->view['data']['id'], &$this->view['preview'], &$this->view['invoice']));
895
 
896
	$filename = $this->view['filename'].".pdf";
6901 daniel 897
 
898
    ob_end_clean();
899
 
8007 daniel 900
	if ($this->view['preview']) {
6901 daniel 901
 
5972 daniel 902
		$pdf->Output($filename, 'I');
6901 daniel 903
 
8007 daniel 904
	} else {
5972 daniel 905
 
8214 daniel 906
		$pdf->Output($oInvoice->getFilePath(), 'F');
5972 daniel 907
 
908
		// 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 909
		$pdf->Output($this->view['filename_out'], 'I');
5972 daniel 910
 
911
	}
8190 karl 912
 
913
?>