Subversion Repositories wpShopGermany4

Rev

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

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