Subversion Repositories wpShopGermany4

Rev

Rev 8073 | Rev 8075 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed

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