Subversion Repositories wpShopGermany4

Rev

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