Subversion Repositories wpShopGermany4

Rev

Rev 8007 | Rev 8214 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 8007 Rev 8190
Line 31... Line 31...
31
	
31
	
32
	$arCalculation = $this->view['basket']['arCalculation'];
32
	$arCalculation = $this->view['basket']['arCalculation'];
33
	
33
	
34
	if ($this->getFrontendTaxView() === WPSG_NETTO) $taxdisplay = 'netto';
34
	if ($this->getFrontendTaxView() === WPSG_NETTO) $taxdisplay = 'netto';
35
	else $taxdisplay = 'brutto';
35
	else $taxdisplay = 'brutto';
36
	
36
 
37
	// Damit die Steuer bei der Kleinunternehmerregelung nicht angezeigt wird leer ich den Array sicherheitshalber
37
	// Damit die Steuer bei der Kleinunternehmerregelung nicht angezeigt wird leer ich den Array sicherheitshalber
38
	if ($this->get_option('wpsg_kleinunternehmer') == '1')
38
	if ( ($this->get_option('wpsg_kleinunternehmer') == '1') || ($this->view['oCalculationOrder']->getTaxMode() === \wpsg\wpsg_calculation::TAXMODE_SMALLBUSINESS) ) unset($this->view['basket']['mwst']);
39
	{
-
 
40
		
-
 
41
		unset($this->view['basket']['mwst']);
-
 
42
		
-
 
43
	}
-
 
44
	
39
	
45
	if (!function_exists('AddRechnungPage'))
40
	if (!function_exists('AddRechnungPage'))
46
	{
41
	{
47
		
42
		
48
		function AddRechnungPage($shop, $pdf)
43
		function AddRechnungPage($shop, $pdf)
Line 104... Line 99...
104
			
99
			
105
			if (isset($shop->view['faelligkeitdatum']))
100
			if (isset($shop->view['faelligkeitdatum']))
106
			{
101
			{
107
	
102
	
108
				$pdf->Text($rdata_left + 35, $rdata_top, __("Fällig am", "wpsg"));
103
				$pdf->Text($rdata_left + 35, $rdata_top, __("Fällig am", "wpsg"));
109
				$pdf->Text($rdata_left + 35, $rdata_top + 6, $shop->view['faelligkeitdatum']);
104
				$pdf->Text($rdata_left + 35, $rdata_top + 6, date("d.m.Y", strtotime($shop->view['faelligkeitdatum'])));
110
				
105
				
111
			}
106
			}
112
					
107
					
113
			if (isset($shop->view['payment']))
108
			if (isset($shop->view['payment']))
114
			{
109
			{
Line 123... Line 118...
123
			
118
			
124
			$pdf->Text($rdata_left + 135, $rdata_top, __("Best. Nr.", "wpsg"));
119
			$pdf->Text($rdata_left + 135, $rdata_top, __("Best. Nr.", "wpsg"));
125
			$pdf->Text($rdata_left + 135, $rdata_top + 6, ((trim($shop->view['data']['onr']) != '')?$shop->view['data']['onr']:$shop->view['data']['id']));
120
			$pdf->Text($rdata_left + 135, $rdata_top + 6, ((trim($shop->view['data']['onr']) != '')?$shop->view['data']['onr']:$shop->view['data']['id']));
126
			
121
			
127
			$pdf->Text($rdata_left + 155, $rdata_top, __("Datum", "wpsg")); 
122
			$pdf->Text($rdata_left + 155, $rdata_top, __("Datum", "wpsg")); 
128
			$pdf->Text($rdata_left + 155, $rdata_top + 6, $shop->view['rDatum']);
123
			$pdf->Text($rdata_left + 155, $rdata_top + 6, date("d.m.Y", strtotime($shop->view['rDatum'])));
129
					
124
					
130
			if ($shop->view['oOrder']->isInnerEu())
125
			if ($shop->view['oOrder']->isInnerEu())
131
			{
126
			{
132
 
127
 
133
            	$pdf->SetFont('Arial', '', 9);
128
            	$pdf->SetFont('Arial', '', 9);
Line 161... Line 156...
161
			}
156
			}
162
			
157
			
163
		}
158
		}
164
		
159
		
165
	}
160
	}
166
	//wpsg_debug($this->view); die();
-
 
-
 
161
 
167
	$pdf = new wpsg_fpdf();	
162
	$pdf = new wpsg_fpdf();	
168
	$pdf->SetAutoPageBreak(true, 5);
163
	$pdf->SetAutoPageBreak(true, 5);
169
	AddRechnungPage($this, $pdf);
164
	AddRechnungPage($this, $pdf);
-
 
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
	}
170
				
189
				
171
	$summe = 0;
190
	$summe = 0;
172
	
191
	
173
	$bKopf = false; $pnr = 1; $offset = 0; $count = 0;
192
	$bKopf = false; $pnr = 1; $offset = 0; $count = 0;
174
	foreach ($this->view['basket']['produkte'] as $p)
193
	foreach ($this->view['basket']['arCalculation']['product'] as $p)
175
	{
194
	{
-
 
195
		$product = wpsg_product::getInstance($p['product_id']);
176
			 
196
			 
177
		if (!$bKopf)
197
		if (!$bKopf)
178
		{
198
		{
179
 
199
 
180
			$pdf->SetFont('Arial', 'B', 9);
200
			$pdf->SetFont('Arial', 'B', 9);
181
			$pdf->setXY($prod_left, $prod_top);
201
			$pdf->setXY($prod_left, $prod_top);
182
			$pdf->Cell(10, 8, __("Nr.", "wpsg"), 1, 0, 'C');
202
			$pdf->Cell(10, 8, __("Nr.", "wpsg"), 1, 0, 'C');
183
 
203
 
184
			$pdf->setXY($prod_left + 10, $prod_top);
204
			$pdf->setXY($prod_left + 10, $prod_top);
185
			$pdf->Cell( ((sizeof($this->view['basket']['mwst']) >= 1 || $this->get_option('wpsg_showMwstAlways') == '1')?87:102), 8, "Name", 1, 0, 'L');
205
			$pdf->Cell( (($bTaxCol)?87:102), 8, "Name", 1, 0, 'L');
186
			
206
			
187
			if (sizeof($this->view['basket']['mwst']) >= 1 || $this->get_option('wpsg_showMwstAlways') == '1')
207
			if ($bTaxCol)
188
			{
208
			{
189
			
209
			
190
				$pdf->setXY($prod_left + 97, $prod_top);
210
				$pdf->setXY($prod_left + 97, $prod_top);
191
				$pdf->Cell(15, 8, __("MwSt.", "wpsg"), 1, 0, 'C');
211
				$pdf->Cell(15, 8, __("MwSt.", "wpsg"), 1, 0, 'C');
192
				
212
				
Line 207... Line 227...
207
		}
227
		}
208
		
228
		
209
		$pdf->SetFont('Arial', '', 9);
229
		$pdf->SetFont('Arial', '', 9);
210
		$pdf->setXY($prod_left, $prod_top + $offset);
230
		$pdf->setXY($prod_left, $prod_top + $offset);
211
		
231
		
212
		if ($this->get_option('wpsg_mod_rechnungen_anr') == '1')
232
		if ($this->get_option('wpsg_mod_rechnungen_anr') == '1') $pdf->Cell(10, 8, $product->getNr(), 0, 0, 'C');
213
		{
-
 
214
			
-
 
215
			$pdf->Cell(10, 8, $p['anr'], 0, 0, 'C');
-
 
216
			
-
 
217
		}
-
 
218
		else
-
 
219
		{
-
 
220
		
-
 
221
			$pdf->Cell(10, 8, $pnr.".", 0, 0, 'C');
233
		else $pdf->Cell(10, 8, $pnr.".", 0, 0, 'C');
222
			
-
 
223
		}
-
 
224
 
234
 
225
		/* Wenn Detailname vorhanden, wird der Detailname auf Rechnung verwendet */
-
 
226
		$produkt_text = $this->getProductName($this->getProduktID($p['id']), true);
235
		if ($this->get_option('wpsg_rechnungen_pdetailname') == '1') $produkt_text = $this->getProductName($this->getProduktID($p['product_id']), true);
227
		
-
 
228
		/* Falls Detailname vorhanden, wird jetzt der Produktname verwendet */
-
 
229
		/* $produkt_text = $this->getProductName($this->getProduktID($p['id']), false); */
236
		else $produkt_text = $this->getProductName($this->getProduktID($p['product_id']), false);
230
		
237
		
231
		$produktBeschreibung = trim(strip_tags($p['beschreibung']));
238
		$produktBeschreibung = trim(strip_tags($product->getShortDescription()));
232
		
239
		
233
		if ($this->isOtherLang())
240
		if ($this->isOtherLang())
234
		{ 
241
		{ 
235
			
242
			
236
			$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())."'");
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())."'");
237
			
244
			
238
			if (is_array($trans_db) && sizeof($trans_db) > 0)
245
			if (is_array($trans_db) && sizeof($trans_db) > 0)
239
			{
246
			{
240
				
247
				
241
				$produkt_text = $trans_db['name'];
248
				$produkt_text = $trans_db['name'];
Line 271... Line 278...
271
		}
278
		}
272
 
279
 
273
        if ($this->get_option('wpsg_mod_rechnungen_anr') === '2')
280
        if ($this->get_option('wpsg_mod_rechnungen_anr') === '2')
274
        {
281
        {
275
 
282
 
276
            $anr = $this->getProductAnr($p['productkey']);
283
            $anr = $this->getProductAnr($product->getProductKey());
277
            $produkt_text .= "\r\n".wpsg_translate(__('Artikelnummer: #1#', 'wpsg'), $anr);
284
            $produkt_text .= "\r\n".wpsg_translate(__('Artikelnummer: #1#', 'wpsg'), $anr);
278
 
285
 
279
        }
286
        }
280
 
287
 
281
		$produkt_text_cell_width = 102;
288
		$produkt_text_cell_width = 102;
282
		if (sizeof($this->view['basket']['mwst']) >= 1 || $this->get_option('wpsg_showMwstAlways') == '1')
-
 
283
		{
-
 
284
			$produkt_text_cell_width = 87;	
289
		if ($bTaxCol) $produkt_text_cell_width = 87;
285
		}
-
 
286
		
290
		
287
		$produkt_text_width = $pdf->GetStringWidth($produkt_text);
291
		$produkt_text_width = $pdf->GetStringWidth($produkt_text);
288
		//$produkt_text_cell_width = (($this->arMwSt == "-1")?87:102);
292
		//$produkt_text_cell_width = (($this->arMwSt == "-1")?87:102);
289
		
293
		
290
		$height += 5 * ceil($produkt_text_width / $produkt_text_cell_width) + 3;
294
		$height += 5 * ceil($produkt_text_width / $produkt_text_cell_width) + 3;
Line 293... Line 297...
293
		$height = 2 + $pdf->wpsg_MultiCell($prod_left + 10, $prod_top + $offset + 1.5, 5, $produkt_text, 0, 'L', 0, $produkt_text_cell_width);
297
		$height = 2 + $pdf->wpsg_MultiCell($prod_left + 10, $prod_top + $offset + 1.5, 5, $produkt_text, 0, 'L', 0, $produkt_text_cell_width);
294
		
298
		
295
		//$height += 3 + 5 + $pdf->getY() - $height_y;
299
		//$height += 3 + 5 + $pdf->getY() - $height_y;
296
		//$pdf->Cell((($this->arMwSt == "-1")?102:87), 8, $produkt_text, 0, 0, 'L');
300
		//$pdf->Cell((($this->arMwSt == "-1")?102:87), 8, $produkt_text, 0, 0, 'L');
297
 
301
 
298
		if (sizeof($this->view['basket']['mwst']) >= 1 || $this->get_option('wpsg_showMwstAlways') == '1')
-
 
299
		{
302
		if ($bTaxCol) {
300
		
303
		
301
			$pdf->setXY($prod_left + 97, $prod_top + $offset);		
304
			$pdf->setXY($prod_left + 97, $prod_top + $offset);		
302
			$pdf->Cell(15, 8, (($this->view['basket']['noMwSt'] == '1')?'0.00 %':wpsg_ff($p['mwst_value'], '%')), 0, 0, 'C');
305
			$pdf->Cell(15, 8, (($bNoTax)?'0.00 %':wpsg_ff($this->view['basket']['arCalculation']['tax'][$p['tax_key']]['tax_value'], '%')), 0, 0, 'C');
303
			
306
			
304
		}
307
		}
305
		
308
		
306
		$pdf->setXY($prod_left + 112, $prod_top + $offset);
309
		$pdf->setXY($prod_left + 112, $prod_top + $offset);
307
		$pdf->Cell(15, 8, $p['menge'], 0, 0, 'C');
310
		$pdf->Cell(15, 8, $p['amount'], 0, 0, 'C');
308
						
311
						
309
		if (wpsg_ShopController::get_option('wpsg_preisangaben') == WPSG_NETTO)
312
		if ( ( wpsg_ShopController::get_option('wpsg_preisangaben') == WPSG_NETTO ) || $bNoTax ) $preis_single = $p['netto_calculated_single'];
310
		{
-
 
311
			$preis = $p['preis_netto'];
-
 
312
			
-
 
313
			//TODO
-
 
314
		}
-
 
315
		else
-
 
316
		{
-
 
317
			$preis = $p['preis_brutto'];
313
		else $preis_single =  $p['brutto_calculated_single'];
318
		}
-
 
319
		
314
		
320
		$pdf->setXY($prod_left + 127, $prod_top + $offset);
315
		$pdf->setXY($prod_left + 127, $prod_top + $offset);
321
		$pdf->Cell(25, 8, wpsg_ff($preis, $this->get_option('wpsg_currency')), 0, 0, 'R');
316
		$pdf->Cell(25, 8, wpsg_ff($preis_single, $this->get_option('wpsg_currency')), 0, 0, 'R');
322
		
317
		
323
		$pdf->setXY($prod_left + 152, $prod_top + $offset);
318
		$pdf->setXY($prod_left + 152, $prod_top + $offset);
324
		$pdf->Cell(25, 8, wpsg_ff($preis * $p['menge'], $this->get_option('wpsg_currency')), 0, 0, 'R');		
319
		$pdf->Cell(25, 8, wpsg_ff($preis_single * $p['amount'], $this->get_option('wpsg_currency')), 0, 0, 'R');		
325
 
320
 
326
		/**
321
		/**
327
		 * Produktbeschreibung anzeigen Ja/Nein
322
		 * Produktbeschreibung anzeigen Ja/Nein
328
		 */
323
		 */
329
		$pBeschreibungHeight = 0;
324
		$pBeschreibungHeight = 0;
330
		if ($this->get_option("wpsg_rechnungen_pbeschreibung") == "1" && trim(strip_tags($p['beschreibung'])) != '')
325
		if ($this->get_option("wpsg_rechnungen_pbeschreibung") == "1" && trim(strip_tags($product->getShortDescription())) != '')
331
		{
326
		{
332
			
327
			
333
			$produktBeschreibung = nl2br($produktBeschreibung);			
328
			$produktBeschreibung = nl2br($produktBeschreibung);			
334
			preg_match_all('/\<br \/\>/', $produktBeschreibung, $treffer);
329
			preg_match_all('/\<br \/\>/', $produktBeschreibung, $treffer);
335
			$produktBeschreibung = strip_tags($produktBeschreibung);
330
			$produktBeschreibung = strip_tags($produktBeschreibung);
Line 351... Line 346...
351
		/**
346
		/**
352
		 * Produktattribute ?
347
		 * Produktattribute ?
353
		 */
348
		 */
354
		if ($this->get_option('wpsg_rechnungen_produktattribute') == '1')
349
		if ($this->get_option('wpsg_rechnungen_produktattribute') == '1')
355
		{
350
		{
356
				
351
 
357
			$attributeInfo = $this->callMod('wpsg_mod_produktattribute', 'getProductAttributeByProductId', array($this->getProduktId($p['id'])));
352
			$attributeInfo = $this->callMod('wpsg_mod_produktattribute', 'getProductAttributeByProductId', array($this->getProduktId($p['product_id'])));
358
		
353
		
359
			foreach ($attributeInfo as $pa)
354
			foreach ($attributeInfo as $pa)
360
			{
355
			{
361
					
356
 
-
 
357
				if ($pa['value'] == "") $pa['value'] = "Keine Angabe";
362
				$pa_text = $pa['name'].': '.$pa['value'];
358
				$pa_text = $pa['name'].': '.$pa['value'];
363
				$height += $pdf->wpsg_MultiCell($prod_left + 10, $prod_top + $height + $offset - 0.5, 5, $pa_text, 0, 'L', 0, $produkt_text_cell_width);
359
				$height += $pdf->wpsg_MultiCell($prod_left + 10, $prod_top + $height + $offset - 0.5, 5, $pa_text, 0, 'L', 0, $produkt_text_cell_width);
364
					
360
					
365
			}
361
			}
366
		}		
362
		}		
367
		
363
		
368
		/**
364
		/**
369
		 * Variante ? 
365
		 * Variante ? 
370
		 */
366
		 */
371
		if (preg_match('/pv_(.*)/', $p['productkey']))
367
		if (preg_match('/pv_(.*)/', $p['product_key']))
372
		{
368
		{
373
			
369
			
374
			$variInfo = $this->callMod('wpsg_mod_productvariants', 'getVariantenInfoArray', array($p['productkey']));
370
			$variInfo = $this->callMod('wpsg_mod_productvariants', 'getVariantenInfoArray', array($p['product_key']));
375
 
371
 
376
			$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);			
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);			
377
			
373
			
378
			//$height += 5;
374
			//$height += 5;
379
			
375
			
380
		}
376
		}
381
		
377
		
382
		if ($this->hasMod('wpsg_mod_deliverynote'))
378
		if ($this->hasMod('wpsg_mod_deliverynote') && ($this->get_option('wpsg_rechnungen_deliverynote') == '1'))
383
		{
379
		{
384
			
380
			
385
			$arDN_order = $this->callMod('wpsg_mod_deliverynote', 'loadDeliveryNotesFromOrder', array($this->view['data']['id']));
381
			$arDN_order = $this->callMod('wpsg_mod_deliverynote', 'loadDeliveryNotesFromOrder', array($this->view['data']['id']));
386
			
382
			
387
			if (sizeof($arDN_order) > 1)
383
			if (sizeof($arDN_order) > 1)
Line 401... Line 397...
401
		}
397
		}
402
		
398
		
403
		// Jetzt die Rahmen zeichnen
399
		// Jetzt die Rahmen zeichnen
404
		$pdf->Rect($prod_left, $prod_top + $offset, 10, $height);
400
		$pdf->Rect($prod_left, $prod_top + $offset, 10, $height);
405
		
401
		
406
		$pdf->Rect($prod_left + 10, $prod_top + $offset, ((sizeof($this->view['basket']['mwst']) >= 1 || $this->get_option('wpsg_showMwstAlways') == '1')?87:102), $height);
402
		$pdf->Rect($prod_left + 10, $prod_top + $offset, (($bTaxCol)?87:102), $height);
407
		
-
 
408
		if (sizeof($this->view['basket']['mwst']) >= 1 || $this->get_option('wpsg_showMwstAlways') == '1')
-
 
409
		{
-
 
410
		
403
		
411
			$pdf->Rect($prod_left + 97, $prod_top + $offset, 15, $height);
404
		if ($bTaxCol) $pdf->Rect($prod_left + 97, $prod_top + $offset, 15, $height);
412
			
-
 
413
		}
-
 
414
		
405
		
415
		$pdf->Rect($prod_left + 112, $prod_top + $offset, 15, $height);
406
		$pdf->Rect($prod_left + 112, $prod_top + $offset, 15, $height);
416
		$pdf->Rect($prod_left + 127, $prod_top + $offset, 25, $height);
407
		$pdf->Rect($prod_left + 127, $prod_top + $offset, 25, $height);
417
		$pdf->Rect($prod_left + 152, $prod_top + $offset, 25, $height);
408
		$pdf->Rect($prod_left + 152, $prod_top + $offset, 25, $height);
418
		
409
		
419
		$offset += $height;
410
		$offset += $height;
420
		 		
411
		 		
421
		$pnr ++;
412
		$pnr ++;
422
		$count ++;
413
		$count ++;
423
				
414
				
-
 
415
		if ($bNoTax) $price = $p['netto'];
-
 
416
		else $price = $p['brutto'];
-
 
417
 
424
		$summe += $p['price'] * $p['menge'];
418
		$summe += $price * $p['amount'];
425
		
419
		
426
		if ($pdf->getY() > 220 || ($count >= $prod_break && sizeof($this->view['basket']['produkte']) > ($pnr - 1)))		
420
		if ($pdf->getY() > 220 || ($count >= $prod_break && sizeof($this->view['basket']['arCalculation']['product']) > ($pnr - 1)))		
427
		{
421
		{
428
			
422
			
429
			AddRechnungPage($this, $pdf);
423
			AddRechnungPage($this, $pdf);
430
			$bKopf = false; $offset = 0; $count = 0;
424
			$bKopf = false; $offset = 0; $count = 0;
431
			
425
			
432
		}
426
		}
433
		
427
		
434
	} // produkte
428
	} // produkte
435
 
429
 
436
	// Gutschein
-
 
437
	/*
-
 
438
	if ((isset($this->view['basket']['gs'])) && ($this->view['basket']['gs_value'] > 0))
-
 
439
	{
-
 
440
		
-
 
441
		$pdf->SetFont('Arial', '', 9);
-
 
442
		$pdf->setXY($prod_left, $prod_top + $offset);
-
 
443
		$pdf->Cell(10, 8, $pnr.'.', 1, 0, 'C'); $pnr ++;
-
 
444
 
-
 
445
		$pdf->setXY($prod_left + 10, $prod_top + $offset);
-
 
446
		$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');
-
 
447
		
-
 
448
		if (sizeof($this->view['basket']['mwst']) >= 1 || $this->get_option('wpsg_showMwstAlways') == '1')
-
 
449
		{
-
 
450
		
-
 
451
			$mwst = __('anteilig', 'wpsg');
-
 
452
				
-
 
453
			$pdf->setXY($prod_left + 97, $prod_top + $offset);
-
 
454
			$pdf->Cell(15, 8, $mwst, 1, 0, 'C');
-
 
455
			
-
 
456
		}
-
 
457
		
-
 
458
		$pdf->setXY($prod_left + 112, $prod_top + $offset);
-
 
459
		$pdf->Cell(15, 8, '1', 1, 0, 'C');		
-
 
460
					
-
 
461
		$gs_value_einzel = '-'.wpsg_ff($this->view['basket']['sum']['gs'], $this->get_option('wpsg_currency'));
-
 
462
		$gs_value_gesamt = '-'.wpsg_ff($this->view['basket']['sum']['gs'], $this->get_option('wpsg_currency'));
-
 
463
		
-
 
464
		$pdf->setXY($prod_left + 127, $prod_top + $offset);
-
 
465
		$pdf->Cell(25, 8, $gs_value_einzel, 1, 0, 'R');
-
 
466
		
-
 
467
		$pdf->setXY($prod_left + 152, $prod_top + $offset);
-
 
468
		$pdf->Cell(25, 8, $gs_value_gesamt, 1, 0, 'R');
-
 
469
		 												
-
 
470
		$offset += 8; 
-
 
471
		
-
 
472
	} 
-
 
473
	*/
-
 
474
	if (wpsg_isSizedArray($this->view['basket']['arCalculation']['voucher'])) {
430
	if (wpsg_isSizedArray($this->view['basket']['arCalculation']['voucher'])) {
475
		
431
		
476
		foreach ($this->view['basket']['arCalculation']['voucher'] as $v) {
432
		foreach ($this->view['basket']['arCalculation']['voucher'] as $v) {
477
			
433
			
478
			$pdf->SetFont('Arial', '', 9);
434
			$pdf->SetFont('Arial', '', 9);
479
			$pdf->setXY($prod_left, $prod_top + $offset);
435
			$pdf->setXY($prod_left, $prod_top + $offset);
480
			$pdf->Cell(10, 8, $pnr.'.', 1, 0, 'C'); $pnr ++;
436
			$pdf->Cell(10, 8, $pnr.'.', 1, 0, 'C'); $pnr ++;
481
			
437
			
482
			$pdf->setXY($prod_left + 10, $prod_top + $offset);
438
			$pdf->setXY($prod_left + 10, $prod_top + $offset);
483
			$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');
439
			$pdf->Cell( (($bTaxCol)?87:102), 8, wpsg_translate(__('Gutschein (#1#)', 'wpsg'), $v['code']), 1, 0, 'L');
484
			
440
			
485
			if (sizeof($this->view['basket']['mwst']) >= 1 || $this->get_option('wpsg_showMwstAlways') == '1')
441
			if ($bTaxCol)
486
			{
442
			{
487
				
443
				
488
				$mwst = __('anteilig', 'wpsg');
444
				$mwst = __('anteilig', 'wpsg');
489
				
445
				
490
				$pdf->setXY($prod_left + 97, $prod_top + $offset);
446
				$pdf->setXY($prod_left + 97, $prod_top + $offset);
Line 509... Line 465...
509
		}
465
		}
510
		
466
		
511
	}
467
	}
512
	
468
	
513
	// Versandkosten
469
	// Versandkosten
514
	if ($this->view['basket']['sum']['preis_shipping'] != '' && $this->view['basket']['sum']['preis_shipping'] != 0)
470
	if ( ($shipping_cost != '') && ($shipping_cost != 0) )
515
	{
471
	{
516
			 
472
			 
517
		$pdf->SetFont('Arial', '', 9);
473
		$pdf->SetFont('Arial', '', 9);
518
		$pdf->setXY($prod_left, $prod_top + $offset);
474
		$pdf->setXY($prod_left, $prod_top + $offset);
519
		$pdf->Cell(10, 8, $pnr.'.', 1, 0, 'C'); $pnr ++;
475
		$pdf->Cell(10, 8, $pnr.'.', 1, 0, 'C'); $pnr ++;
520
 
476
 
521
		$pdf->setXY($prod_left + 10, $prod_top + $offset);
477
		$pdf->setXY($prod_left + 10, $prod_top + $offset);
522
		$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');
478
		$pdf->Cell( (($bTaxCol)?87:102), 8, wpsg_translate(__('Versandkosten "#1#"', 'wpsg'), $this->view['oOrder']->getShippingLabel()), 1, 0, 'L');
523
		
479
		
524
		if (sizeof($this->view['basket']['mwst']) >= 1 || $this->get_option('wpsg_showMwstAlways') == '1')
480
		if ($bTaxCol)
525
		{
481
		{
526
		
482
		
527
			if ($this->arShipping[$this->view['data']['type_shipping']]['mwst_null'] == '1' && $this->view['basket']['noMwSt'] == '1')
483
			if ($this->arShipping[$this->view['data']['type_shipping']]['mwst_null'] == '1' && $bNoTax) $mwst = wpsg_ff(0.00, '%');
528
			{
484
			else {
529
				
-
 
530
				$mwst = 0;
-
 
531
				
485
				
532
			}
-
 
533
			else
-
 
534
			{
-
 
535
				
-
 
536
				if ($this->view['basket']['arCalculation']['shipping'][0]['tax_key'] === '0') {
486
				if ($this->view['basket']['arCalculation']['shipping'][0]['tax_key'] === '0') $mwst = _('anteilig');
537
					
-
 
538
					$mwst = _('anteilig');
-
 
539
					
-
 
540
				} else {
487
				else {
541
					
488
					
542
					$mwst = wpsg_ff($this->view['basket']['arCalculation']['shipping'][0]['tax'], '%');
489
					$mwst = wpsg_ff($this->view['basket']['arCalculation']['shipping'][0]['tax'], '%');
543
					$mwst = wpsg_ff($this->view['basket']['arCalculation']['tax'][$this->view['basket']['arCalculation']['shipping'][0]['tax_key']]['tax_value'], '%');
490
					$mwst = wpsg_ff($this->view['basket']['arCalculation']['tax'][$this->view['basket']['arCalculation']['shipping'][0]['tax_key']]['tax_value'], '%');
544
					
491
					
545
				}
492
				}
Line 553... Line 500...
553
		
500
		
554
		$pdf->setXY($prod_left + 112, $prod_top + $offset);
501
		$pdf->setXY($prod_left + 112, $prod_top + $offset);
555
		$pdf->Cell(15, 8, '1', 1, 0, 'C');		
502
		$pdf->Cell(15, 8, '1', 1, 0, 'C');		
556
					
503
					
557
		$pdf->setXY($prod_left + 127, $prod_top + $offset);
504
		$pdf->setXY($prod_left + 127, $prod_top + $offset);
558
		$pdf->Cell(25, 8, wpsg_ff($this->view['basket']['sum']['preis_shipping'], $this->get_option('wpsg_currency')), 1, 0, 'R');
505
		$pdf->Cell(25, 8, wpsg_ff($shipping_cost, $this->get_option('wpsg_currency')), 1, 0, 'R');
559
		
506
		
560
		$pdf->setXY($prod_left + 152, $prod_top + $offset);
507
		$pdf->setXY($prod_left + 152, $prod_top + $offset);
561
		$pdf->Cell(25, 8, wpsg_ff($this->view['basket']['sum']['preis_shipping'], $this->get_option('wpsg_currency')), 1, 0, 'R');
508
		$pdf->Cell(25, 8, wpsg_ff($shipping_cost, $this->get_option('wpsg_currency')), 1, 0, 'R');
562
		 												
509
		 												
563
		$offset += 8;
510
		$offset += 8;
564
 
511
 
565
		// Zusammengesetzte Versandarten darstellen
-
 
566
		/*
-
 
567
		if (wpsg_isSizedArray($this->view['basket']['shipping']['methods'])) {
-
 
568
		
-
 
569
			foreach ($this->view['basket']['shipping']['methods'] as $shipping) {
-
 
570
					
-
 
571
				$pdf->SetFont('Arial', '', 9);
-
 
572
				$pdf->setXY($prod_left, $prod_top + $offset);
-
 
573
				$pdf->Cell(10, 8, '', 1, 0, 'C'); $pnr ++;
-
 
574
					
-
 
575
				$pdf->setXY($prod_left + 10, $prod_top + $offset);
-
 
576
				$pdf->Cell( ((sizeof($this->view['basket']['mwst']) >= 1 || $this->get_option('wpsg_showMwstAlways') == '1')?87:102), 8, $this->getShippingName($shipping), 1, 0, 'L');
-
 
577
					
-
 
578
				if (sizeof($this->view['basket']['mwst']) >= 1 || $this->get_option('wpsg_showMwstAlways') == '1')
-
 
579
				{
-
 
580
				
-
 
581
					if ($this->view['basket']['shipping'][$shipping]['tax_rata'] == 1) { $mwst = __('Anteilig', 'wpsg'); }
-
 
582
					else { $mwst = wpsg_ff($this->view['basket']['shipping'][$shipping]['mwst'], '%'); }
-
 
583
					
-
 
584
					$pdf->setXY($prod_left + 97, $prod_top + $offset);
-
 
585
					$pdf->Cell(15, 8, $mwst, 1, 0, 'C');
-
 
586
					
-
 
587
				}
-
 
588
				
-
 
589
				$pdf->setXY($prod_left + 112, $prod_top + $offset);
-
 
590
				$pdf->Cell(15, 8, '1', 1, 0, 'C');
-
 
591
					
-
 
592
				$pdf->setXY($prod_left + 127, $prod_top + $offset);
-
 
593
				$pdf->Cell(25, 8, wpsg_ff($this->view['basket']['shipping'][$shipping]['preis_shipping_brutto'], $this->get_option('wpsg_currency')), 1, 0, 'R');
-
 
594
				
-
 
595
				$pdf->setXY($prod_left + 152, $prod_top + $offset);
-
 
596
				$pdf->Cell(25, 8, wpsg_ff($this->view['basket']['shipping'][$shipping]['preis_shipping_brutto'], $this->get_option('wpsg_currency')), 1, 0, 'R');
-
 
597
					
-
 
598
				$offset += 8;
-
 
599
				
-
 
600
			}
-
 
601
		
-
 
602
		}
-
 
603
		*/
-
 
604
			
-
 
605
		
-
 
606
	}
512
	}
607
	
513
	
608
	// Zahlungskosten
514
	// Zahlungskosten
609
	if ($this->view['basket']['sum']['preis_payment'] != '' && $this->view['basket']['sum']['preis_payment'] != 0)
515
	if ( ($payment_cost != '') && ($payment_cost != 0) )
610
	{
516
	{
611
		
517
		
612
		$pdf->SetFont('Arial', '', 9);
518
		$pdf->SetFont('Arial', '', 9);
613
		$pdf->setXY($prod_left, $prod_top + $offset);
519
		$pdf->setXY($prod_left, $prod_top + $offset);
614
		$pdf->Cell(10, 8, $pnr.'.', 1, 0, 'C'); $pnr ++;
520
		$pdf->Cell(10, 8, $pnr.'.', 1, 0, 'C'); $pnr ++;
615
 
521
 
616
		$pdf->setXY($prod_left + 10, $prod_top + $offset);
522
		$pdf->setXY($prod_left + 10, $prod_top + $offset);
617
		$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');
523
		$pdf->Cell( (($bTaxCol)?87:102), 8, $this->arPayment[$this->view['data']['type_payment']]['name'], 1, 0, 'L');
618
		
524
		
619
		if (sizeof($this->view['basket']['mwst']) >= 1 || $this->get_option('wpsg_showMwstAlways') == '1')
525
		if ($bTaxCol)
620
		{
526
		{
621
		
527
		
622
			if ($this->arPayment[$this->view['data']['type_payment']]['mwst_null'] == '1' && $this->view['basket']['noMwSt'] == '1')
528
			if ($this->arPayment[$this->view['data']['type_payment']]['mwst_null'] == '1' && $bNoTax)
623
			{
-
 
624
				$mwst = 0;
-
 
625
			}
-
 
626
			else
-
 
627
			{
529
			{
-
 
530
 
-
 
531
				$mwst = wpsg_ff(0.00, '%');
-
 
532
 
-
 
533
			} else {
628
				
534
				
629
				if ($this->view['basket']['arCalculation']['payment'][0]['tax_key'] === '0') {
535
				if ($this->view['basket']['arCalculation']['payment'][0]['tax_key'] === '0') {
630
					
536
					
631
					$mwst = _('anteilig');
537
					$mwst = _('anteilig');
632
					
538
					
Line 646... Line 552...
646
		
552
		
647
		$pdf->setXY($prod_left + 112, $prod_top + $offset);
553
		$pdf->setXY($prod_left + 112, $prod_top + $offset);
648
		$pdf->Cell(15, 8, '1', 1, 0, 'C');		
554
		$pdf->Cell(15, 8, '1', 1, 0, 'C');		
649
					
555
					
650
		$pdf->setXY($prod_left + 127, $prod_top + $offset);
556
		$pdf->setXY($prod_left + 127, $prod_top + $offset);
651
		$pdf->Cell(25, 8, wpsg_ff($this->view['basket']['sum']['preis_payment'], $this->get_option('wpsg_currency')), 1, 0, 'R');
557
		$pdf->Cell(25, 8, wpsg_ff($payment_cost, $this->get_option('wpsg_currency')), 1, 0, 'R');
652
		
558
		
653
		$pdf->setXY($prod_left + 152, $prod_top + $offset);
559
		$pdf->setXY($prod_left + 152, $prod_top + $offset);
654
		$pdf->Cell(25, 8, wpsg_ff($this->view['basket']['sum']['preis_payment'], $this->get_option('wpsg_currency')), 1, 0, 'R');
560
		$pdf->Cell(25, 8, wpsg_ff($payment_cost, $this->get_option('wpsg_currency')), 1, 0, 'R');
655
		 												
561
		 												
656
		$offset += 8;
562
		$offset += 8;
657
		
563
		
658
	}
564
	}
659
		 	 
565
		 	 
Line 668... Line 574...
668
		$label = __('Bearbeitungsgebühr', 'wpsg');
574
		$label = __('Bearbeitungsgebühr', 'wpsg');
669
 
575
 
670
		if (strpos($this->view['storno_fee'], '%') !== false) $label .= ' ('.wpsg_ff($this->view['storno_fee'], '%').')';
576
		if (strpos($this->view['storno_fee'], '%') !== false) $label .= ' ('.wpsg_ff($this->view['storno_fee'], '%').')';
671
		
577
		
672
		$pdf->setXY($prod_left + 10, $prod_top + $offset);
578
		$pdf->setXY($prod_left + 10, $prod_top + $offset);
673
		$pdf->Cell( ((sizeof($this->view['basket']['mwst']) >= 1 || $this->get_option('wpsg_showMwstAlways') == '1')?87:102), 8, $label, 1, 0, 'L');
579
		$pdf->Cell( (($bTaxCol)?87:102), 8, $label, 1, 0, 'L');
674
		
580
		
675
		if (sizeof($this->view['basket']['mwst']) >= 1 || $this->get_option('wpsg_showMwstAlways') == '1')
581
		if ($bTaxCol)
676
		{
582
		{
677
		
583
		
678
			if ($this->view['basket']['noMwSt'] == '1')
584
			if ($bNoTax) $mwst = wpsg_ff(0.00, '%');
679
			{
-
 
680
				$mwst = 0;
-
 
681
			}
-
 
682
			else
-
 
683
			{ 
-
 
684
				
-
 
685
				
-
 
686
				$mwst = wpsg_ff($this->view['storno_fee_tax_value'], '%');
585
			else $mwst = wpsg_ff($this->view['storno_fee_tax_value'], '%');
687
				
-
 
688
			}
-
 
689
			
586
			
690
			$pdf->setXY($prod_left + 97, $prod_top + $offset);
587
			$pdf->setXY($prod_left + 97, $prod_top + $offset);
691
			$pdf->Cell(15, 8, $mwst, 1, 0, 'C');
588
			$pdf->Cell(15, 8, $mwst, 1, 0, 'C');
692
			
589
			
693
		}
590
		}
Line 713... Line 610...
713
		$pdf->Text($prod_left, $prod_top + $offset, __("Ihre Umsatzsteuer-Identifikationsnummer:", "wpsg"));
610
		$pdf->Text($prod_left, $prod_top + $offset, __("Ihre Umsatzsteuer-Identifikationsnummer:", "wpsg"));
714
		$pdf->setXY($prod_left + 140, $prod_top + $offset - 5);
611
		$pdf->setXY($prod_left + 140, $prod_top + $offset - 5);
715
		$pdf->Cell(37, 8, $this->view['kunde']['ustidnr'], 0, 0, 'R');
612
		$pdf->Cell(37, 8, $this->view['kunde']['ustidnr'], 0, 0, 'R');
716
	}
613
	}
717
	
614
	
718
	$offset += 10;
-
 
719
	if ($this->get_option('wpsg_kleinunternehmer'))
615
	$offset += 10; // Abstand zwischen Tabelle und Auswertung
720
	{
-
 
721
 
616
 
-
 
617
	if ( $this->get_option('wpsg_kleinunternehmer') || ($this->view['oCalculationOrder']->getTaxMode() === \wpsg\wpsg_calculation::TAXMODE_SMALLBUSINESS) )
-
 
618
	{
-
 
619
		
722
		$pdf->Text($prod_left, $prod_top + $offset, __("Es ergibt sich folgender Gesamtbetrag", "wpsg").':');
620
		$pdf->Text($prod_left, $prod_top + $offset, __("Es ergibt sich folgender Gesamtbetrag", "wpsg").':');
723
		$pdf->Text($prod_left + 80, $prod_top + $offset, __("Summe", "wpsg"));
621
		$pdf->Text($prod_left + 80, $prod_top + $offset, __("Summe", "wpsg"));
724
		$pdf->setXY($prod_left + 140, $prod_top + $offset - 5);
622
		$pdf->setXY($prod_left + 140, $prod_top + $offset - 5);
725
		$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');
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');
726
		$offset += 5;
624
		if ( !$bNoTax || ($arCalculation['sum']['topay_brutto'] != $arCalculation['sum']['brutto']) ) $offset += 5;
727
		
625
 
728
	}
-
 
729
	else
626
	} else {
730
	{
-
 
731
		
627
		
732
		if ($this->view['basket']['noMwSt'] == '1')
628
		if ($bNoTax)
733
		{
629
		{
734
			
630
			
735
			$pdf->Text($prod_left, $prod_top + $offset, __("Es ergibt sich folgender Gesamtbetrag", "wpsg").':');
631
			$pdf->Text($prod_left, $prod_top + $offset, __("Es ergibt sich folgender Gesamtbetrag", "wpsg").':');
736
			$pdf->Text($prod_left + 80, $prod_top + $offset, __("BRUTTOBETRAG", "wpsg"));
632
			$pdf->Text($prod_left + 80, $prod_top + $offset, __("Summe", "wpsg"));
737
			$pdf->setXY($prod_left + 140, $prod_top + $offset - 5);
633
			$pdf->setXY($prod_left + 140, $prod_top + $offset - 5);
738
			$pdf->Cell(37, 8, wpsg_ff($this->view['basket']['sum']['preis_gesamt_netto'], $this->get_option('wpsg_currency')), 0, 0, 'R');
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']) ) 
739
			$offset += 5;
636
			$offset += 5;
740
			
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;
741
			$pdf->Text($prod_left + 80, $prod_top + $offset, __("MwSt. GESAMT", "wpsg"));
650
							$pdf->Text($prod_left + 80, $prod_top + $offset, __("MwSt. ", "wpsg").wpsg_ff($mw['tax_value'], '%'));
742
			$pdf->setXY($prod_left + 140, $prod_top + $offset - 5);
651
							$pdf->setXY($prod_left + 140, $prod_top + $offset - 5);
743
			$pdf->Cell(37, 8, wpsg_ff(0, $this->get_option('wpsg_currency')), 0, 0, 'R');
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
					}
744
					
659
					
745
		}
-
 
746
		else  
-
 
747
		{
-
 
748
			
-
 
749
			$pdf->Text($prod_left, $prod_top + $offset, __("Der Gesamtbetrag setzt sich wie folgt zusammen", "wpsg"));
-
 
750
				 
-
 
751
			$pdf->Text($prod_left + 80, $prod_top + $offset, __("NETTOBETRAG", "wpsg"));
-
 
752
			$pdf->setXY($prod_left + 140, $prod_top + $offset - 5);
-
 
753
			$pdf->Cell(37, 8, wpsg_ff($this->view['basket']['sum']['preis_gesamt_netto'], $this->get_option('wpsg_currency')), 0, 0, 'R');
-
 
754
							
-
 
755
			if (sizeof($this->view['basket']['mwst']) >= 1)
-
 
756
			{
660
				}
757
				
661
				
758
				foreach ($this->view['basket']['mwst'] as $mw)
662
				if ($mw_count >= 2)
759
				{
663
				{
760
					
664
					
761
					$offset += 5;
665
					$offset += 5;
762
					$pdf->Text($prod_left + 80, $prod_top + $offset, __("MwSt. ", "wpsg").wpsg_ff($mw['value'], '%'));
666
					$pdf->Text($prod_left + 80, $prod_top + $offset, __("MwSt. GESAMT", "wpsg"));
763
					$pdf->setXY($prod_left + 140, $prod_top + $offset - 5);
667
					$pdf->setXY($prod_left + 140, $prod_top + $offset - 5);
-
 
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');
-
 
669
					
-
 
670
				}
-
 
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);
764
					$pdf->Cell(37, 8, wpsg_ff($mw['sum'], $this->get_option('wpsg_currency')), 0, 0, 'R');
694
						$pdf->Cell(37, 8, wpsg_ff($mw['sum'], $this->get_option('wpsg_currency')), 0, 0, 'R');
765
					
695
					
-
 
696
						$mw_count++;
-
 
697
 
-
 
698
					}
-
 
699
 
766
				}
700
				}
767
				
701
				
768
			}
702
			}
769
		 	
703
			
770
			if (sizeof($this->view['basket']['mwst']) > 1)
704
			if ($mw_count >= 2)
771
			{
705
			{
772
				
706
				
773
				$offset += 5;
707
				$offset += 5;
774
				$pdf->Text($prod_left + 80, $prod_top + $offset, __("MwSt. GESAMT", "wpsg"));
708
				$pdf->Text($prod_left + 80, $prod_top + $offset, __("MwSt. GESAMT", "wpsg"));
775
				$pdf->setXY($prod_left + 140, $prod_top + $offset - 5);
709
				$pdf->setXY($prod_left + 140, $prod_top + $offset - 5);
776
				$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');
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');
777
			
711
				
778
			}
712
			}
779
	
713
			
780
		} 
714
		}
781
		
715
		
782
	}
716
	}
783
	
717
	
784
	// Rabatt
718
	// Rabatt
785
	if ($this->view['basket']['sum']['preis_rabatt'] > 0)
719
	if ($discount_value > 0)
786
	{
720
	{
787
		
721
		
788
		$offset += 5;
722
		$offset += 5;
789
		
-
 
790
		$pdf->Text($prod_left + 80, $prod_top + $offset, __("Rabatt", "wpsg"));
723
		$pdf->Text($prod_left + 80, $prod_top + $offset, __("Rabatt", "wpsg"));
791
		$pdf->setXY($prod_left + 140, $prod_top + $offset - 5);
724
		$pdf->setXY($prod_left + 140, $prod_top + $offset - 5);
792
		$pdf->Cell(37, 8, '-'.wpsg_ff($this->view['basket']['sum']['preis_rabatt'], $this->get_option('wpsg_currency')), 0, 0, 'R');
725
		$pdf->Cell(37, 8, '-'.wpsg_ff($discount_value, $this->get_option('wpsg_currency')), 0, 0, 'R');
793
		
726
		
794
	}
727
	}
795
	
728
 
796
	// Wertgutschein
729
	// Wertgutschein
797
	if ($arCalculation['sum']['topay_brutto'] !== $arCalculation['sum']['brutto']) {
730
	if ( $arCalculation['sum']['topay_brutto'] != $arCalculation['sum']['brutto'] ) {
798
		
731
 
799
		$offset += 5;
732
		if (!$bNoTax) {
800
		$pdf->Text($prod_left + 80, $prod_top + $offset, __("Bruttobetrag", "wpsg"));
-
 
801
		$pdf->setXY($prod_left + 140, $prod_top + $offset - 5);
-
 
802
		
733
		
-
 
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
			
803
		$pdf->setFont('Arial', '', '9');
738
			$pdf->setFont('Arial', '', '9');
804
		$pdf->Cell(37, 8, wpsg_ff($this->view['basket']['sum']['preis_gesamt_brutto'], $this->get_option('wpsg_currency')), 0, 0, 'R');
739
			$pdf->Cell(37, 8, wpsg_ff($this->view['basket']['arCalculation']['sum']['brutto'], $this->get_option('wpsg_currency')), 0, 0, 'R');
805
		$pdf->setFont('Arial', '', '9');
740
			$pdf->setFont('Arial', '', '9');
806
		
741
		
-
 
742
		} else if (!($mw_count >= 2)) $offset -= 5;
-
 
743
 
807
		foreach ($arCalculation['coupon'] as $c) {
744
		foreach ($arCalculation['coupon'] as $c) {
808
			
745
			
809
			$offset += 5;
746
			$offset += 5;
810
			$pdf->Text($prod_left + 80, $prod_top + $offset, __('Wertgutschein', 'wpsg').' '.((wpsg_isSizedString($c['code']))?'('.$c['code'].')':''));
747
			$pdf->Text($prod_left + 80, $prod_top + $offset, __('Wertgutschein', 'wpsg').' '.((wpsg_isSizedString($c['code']))?'('.$c['code'].')':''));
811
			$pdf->setXY($prod_left + 140, $prod_top + $offset - 5);
748
			$pdf->setXY($prod_left + 140, $prod_top + $offset - 5);
Line 816... Line 753...
816
			
753
			
817
		}
754
		}
818
		
755
		
819
		$offset += 5;
756
		$offset += 5;
820
		$pdf->setFont('Arial', 'B', '9');
757
		$pdf->setFont('Arial', 'B', '9');
821
		$pdf->Text($prod_left + 80, $prod_top + $offset, __("SUMME", "wpsg"));
758
		$pdf->Text($prod_left + 80, $prod_top + $offset, __("ZU ZAHLEN", "wpsg"));
822
		$pdf->setXY($prod_left + 140, $prod_top + $offset - 5);
759
		$pdf->setXY($prod_left + 140, $prod_top + $offset - 5);
823
		
760
		
824
		/* Endbetrag wird fett ausgegeben */
761
		/* Endbetrag wird fett ausgegeben */
825
		$pdf->setFont('Arial', 'B', '9');
762
		$pdf->setFont('Arial', 'B', '9');
826
		$pdf->Cell(37, 8, wpsg_ff($arCalculation['sum']['topay_brutto'], $this->get_option('wpsg_currency')), 0, 0, 'R');
763
		$pdf->Cell(37, 8, wpsg_ff($arCalculation['sum']['topay_brutto'], $this->get_option('wpsg_currency')), 0, 0, 'R');
827
		$pdf->setFont('Arial', '', '9');
764
		$pdf->setFont('Arial', '', '9');
828
		
765
		
829
	} else {
766
	} else {
830
	
767
 
831
		$offset += 5;
768
		$offset += 5;
-
 
769
		$pdf->setFont('Arial', 'B', '9');
832
		$pdf->Text($prod_left + 80, $prod_top + $offset, __("SUMME", "wpsg"));
770
		$pdf->Text($prod_left + 80, $prod_top + $offset, __("GESAMTSUMME", "wpsg"));
833
		$pdf->setXY($prod_left + 140, $prod_top + $offset - 5);
771
		$pdf->setXY($prod_left + 140, $prod_top + $offset - 5);
834
	
772
		
835
		/* Endbetrag wird fett ausgegeben */
773
		/* Endbetrag wird fett ausgegeben */
836
		$pdf->setFont('Arial', 'B', '9');
-
 
837
		$pdf->Cell(37, 8, wpsg_ff($this->view['basket']['sum']['preis_gesamt_brutto'], $this->get_option('wpsg_currency')), 0, 0, 'R');
774
		$pdf->Cell(37, 8, wpsg_ff($arCalculation['sum']['topay_brutto'], $this->get_option('wpsg_currency')), 0, 0, 'R');
838
		$pdf->setFont('Arial', '', '9');
775
		$pdf->setFont('Arial', '', '9');
839
			
776
				
840
		/* Endbetrag wird normal ausgegeben */
-
 
841
		//$pdf->Cell(37, 8, wpsg_ff($this->view['basket']['sum']['preis_gesamt_brutto'], $this->get_option('wpsg_currency')), 0, 0, 'R');
-
 
842
		
-
 
843
	}
777
	}
844
	
778
	
845
	if ($this->get_option('wpsg_kleinunternehmer') == '1')
779
	if (($this->get_option('wpsg_kleinunternehmer') == '1') || ($this->view['oCalculationOrder']->getTaxMode() === \wpsg\wpsg_calculation::TAXMODE_SMALLBUSINESS) )
846
	{
780
	{
847
 
781
 
-
 
782
		$offset += 3;
-
 
783
		$pdf->setFont('Arial', '', '8');
848
		$pdf->wpsg_MultiCell($prod_left - 1, $prod_top + $offset + 5, 5, $this->get_option('wpsg_kleinunternehmer_text')); 
784
		$pdf->wpsg_MultiCell($prod_left - 1, $prod_top + $offset, 5, '('.$this->get_option('wpsg_kleinunternehmer_text').')');
849
		$offset += 15;
785
		$offset += 8;
850
		
786
		
851
	}
787
	}
-
 
788
 
-
 
789
	$offset += 5;
852
	
790
	
853
	if ($this->hasMod('wpsg_mod_deliverynote'))
791
	if ($this->hasMod('wpsg_mod_deliverynote') && ($this->get_option('wpsg_rechnungen_deliverynote') == '1'))
854
	{
792
	{
855
		
793
		
856
		$arDN_order = $this->callMod('wpsg_mod_deliverynote', 'loadDeliveryNotesFromOrder', array($this->view['data']['id']));
794
		$arDN_order = $this->callMod('wpsg_mod_deliverynote', 'loadDeliveryNotesFromOrder', array($this->view['data']['id']));
857
		$delivery_date = $this->callMod('wpsg_mod_deliverynote', 'getDeliveryTime', array($this->view['data']['id']));
795
		$delivery_date = $this->callMod('wpsg_mod_deliverynote', 'getDeliveryTime', array($this->view['data']['id']));
858
		
796
 
859
		// Wenn es ein Gesamtlieferdatum gibt und nur einen Lieferschein, dann unter der Bestellung anzeigen
797
		// Wenn es ein Gesamtlieferdatum gibt und nur einen Lieferschein, dann unter der Bestellung anzeigen
860
		if ($delivery_date !== false && sizeof($arDN_order) == 1)
798
		if ($delivery_date !== false && sizeof($arDN_order) == 1)
861
		{
799
		{
862
			
800
			
-
 
801
			$pdf->setFont('Arial', 'B', '9');
-
 
802
			$pdf->wpsg_MultiCell($prod_left - 1, $prod_top + $offset, 5, __('Lieferung:', 'wpsg'));
863
			$offset += 10; 
803
			$pdf->setFont('Arial', '', '9');
864
			
-
 
865
			$pdf->wpsg_MultiCell($prod_left, $prod_top + $offset, 5, wpsg_translate(__('Lieferung: #1#', 'wpsg'), date('d.m.Y', $delivery_date)));
804
			$pdf->wpsg_MultiCell($prod_left + 16, $prod_top + $offset, 5, wpsg_translate(__('#1#', 'wpsg'), date('d.m.Y', $delivery_date)));
866
 
-
 
867
			$offset += 5;
805
			$offset += 8;
868
			
806
			
869
		}
807
		}
870
		
808
		
871
	}
809
	}
872
	
810
 
873
	$offset += 5;
-
 
874
	
-
 
875
	if ($this->view['fussText'] != "")
811
	if ($this->view['fussText'] != "")
876
	{
812
	{
877
	
813
		
878
		//$pdf->wpsg_MultiCell($prod_left - 1, $prod_top + $offset, 5, utf8_encode($this->view['fussText']));		
814
		$pdf->setFont('Arial', '', '9');	
879
		$pdf->wpsg_MultiCell($prod_left - 1, $prod_top + $offset, 5, $this->view['fussText']);
815
		$pdf->wpsg_MultiCell($prod_left - 1, $prod_top + $offset, 5, $this->view['fussText']);
880
		$pdf->SetFont('Arial', 'B', 9);
-
 
881
		$offset += 10;	
816
		$offset += 8;
882
		
817
		
883
	}
818
	}
884
	
819
	
885
	$shipping_adress = false;
820
	$offset += 10;
886
 
821
 
-
 
822
	$shipping_adress = false;
887
	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'])))
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']))) {
888
	{
-
 
889
 
824
		
890
		$pdf->setFont('Arial', 'B', 9);
825
		$pdf->setFont('Arial', 'B', 9);
891
		$pdf->Text($prod_left, $prod_top + $offset, __("Lieferanschrift", "wpsg").":");
826
		$pdf->Text($prod_left, $prod_top + $offset, __("Lieferanschrift", "wpsg").":");
892
		$offset += 5;
827
		$offset += 2;
893
		
-
 
894
		$pdf->setFont('Arial', '', 9);		
-
 
895
		
828
		
896
		$shipping_adress = "";
829
		$pdf->setFont('Arial', '', 9);
897
		if ($this->view['data']['shipping_firma'] != "")
-
 
898
		{
-
 
899
			$shipping_adress .= $this->view['data']['shipping_firma']."\r\n";
-
 
900
		}
-
 
901
		$shipping_adress .= $this->view['data']['shipping_vname'].' '.$this->view['data']['shipping_name']."\r\n";
-
 
902
		$shipping_adress .= $this->view['data']['shipping_strasse']."\r\n";
-
 
903
		//$shipping_adress .= $this->view['data']['shipping_land']['kuerzel'].'-';
-
 
904
		
-
 
905
		$shipping_adress .= $this->view['data']['shipping_plz'].' '.$this->view['data']['shipping_ort']."\r\n";
-
 
906
		$shipping_adress .= $this->view['data']['shipping_land']['name'];
-
 
907
		
830
		
-
 
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'];	
908
		
842
		
909
		$start = $pdf->getY();
843
		$start = $pdf->getY();
910
		$pdf->wpsg_MultiCell($prod_left - 1, $prod_top + $offset, 5, $shipping_adress, 0, 'L', 0, 100);
844
		$pdf->wpsg_MultiCell($prod_left - 1, $prod_top + $offset, 5, $shipping_adress, 0, 'L', 0, 100);
911
		$offset += $pdf->getY() - $start;
845
		$offset += $pdf->getY() - $start;
912
		
846
		
913
		$shipping_adress = true;
847
		$shipping_adress = true;
914
		
848
		
915
	}
849
	}
916
		
-
 
917
	
850
		 
918
	$offset += 5;
-
 
919
	 
-
 
920
	// Bestellvariablen
851
	// Bestellvariablen
921
	if ($this->hasMod('wpsg_mod_ordervars') && $this->get_option('wpsg_mod_rechnungen_showov') == '1')
852
	if ($this->hasMod('wpsg_mod_ordervars') && $this->get_option('wpsg_mod_rechnungen_showov') == '1')
922
	{
853
	{
-
 
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").":");
923
		
857
		
924
		$bvars = @unserialize($this->view['data']['bvars']);		
-
 
925
		if (!is_array($bvars)) $bvars = array();
858
		$pdf->SetFont('Arial', '', 9);
926
		
859
 
927
		$strBVars = "";
860
			$bvars = @unserialize($this->view['data']['bvars']);
928
		foreach ($bvars as $bvars_id => $bvars_value)
861
			if (!is_array($bvars)) $bvars = array();
929
		{
-
 
930
				
-
 
931
			$bvars = $this->db->fetchRow("SELECT * FROM `".wpsg_q(WPSG_TBL_ORDERVARS)."` WHERE `id` = '".wpsg_q($bvars_id)."' ORDER BY `pos` ASC, `id` ASC ");
-
 
932
			
862
			
-
 
863
			$strBVars = "";
933
			if ($bvars['typ'] == "1") // Auswahl
864
			foreach ($bvars as $bvars_id => $bvars_value)
934
			{
865
			{
-
 
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
				{
935
				if ($bvars_value <= 0) $bvars_value = __("Keine Angabe", "wpsg");
871
					if ($bvars_value <= 0) $bvars_value = __("Keine Angabe", "wpsg");
936
			}
872
				}
937
			else if ($bvars['typ'] == "2") // Texteingabe
873
				else if ($bvars['typ'] == "2") // Texteingabe
938
			{
874
				{
939
				if (trim($bvars_value) == "") $bvars_value = __("Keine Angabe", "wpsg");
875
					if (trim($bvars_value) == "") $bvars_value = __("Keine Angabe", "wpsg");
940
			}
876
				}
941
			else if ($bvars['typ'] == "3") // Checkbox
877
				else if ($bvars['typ'] == "3") // Checkbox
942
			{
878
				{
943
				if ($bvars_value <= 0) $bvars_value = __("Keine Angabe", "wpsg");					
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
				
944
			}
885
			}
945
			
-
 
946
			$bvars_name = $this->callMod('wpsg_mod_ordervars', 'getNameById', array($bvars_id));			
-
 
947
			$strBVars .= "\r\n".$bvars_name.": ".$bvars_value;	
-
 
948
			
-
 
949
		}
-
 
950
		
-
 
951
		$pdf->SetFont('Arial', 'B', 9);	
-
 
952
		$pdf->Text($prod_left, $prod_top + $offset, __("Angaben während der Bestellung", "wpsg").":");
-
 
953
		$pdf->SetFont('Arial', '', 9);
-
 
954
		$pdf->wpsg_MultiCell($prod_left - 1, $prod_top + $offset, 5, $strBVars);
-
 
955
		
886
		
-
 
887
		$pdf->wpsg_MultiCell($prod_left - 1, $prod_top + $offset - 6, 5, $strBVars);
-
 
888
 
956
	}  
889
	}
957
	
890
	
958
	if (!file_exists($this->callMod('wpsg_mod_rechnungen', 'getFilePath', array($this->view['data']['id']))))
891
	if (!file_exists($this->callMod('wpsg_mod_rechnungen', 'getFilePath', array($this->view['data']['id']))))
959
	{
892
	{
960
		
893
		
961
		mkdir($this->callMod('wpsg_mod_rechnungen', 'getFilePath', array($this->view['data']['id'])), 0777, true);
894
		mkdir($this->callMod('wpsg_mod_rechnungen', 'getFilePath', array($this->view['data']['id'])), 0777, true);
Line 966... Line 899...
966
	
899
	
967
	$filename = $this->view['filename'].".pdf";
900
	$filename = $this->view['filename'].".pdf";
968
 
901
 
969
    ob_end_clean();
902
    ob_end_clean();
970
 
903
 
-
 
904
	wpsg_debug($pdf->Output($filename, 'I'));
-
 
905
	die();
-
 
906
 
971
	if ($this->view['preview']) {
907
	if ($this->view['preview']) {
972
	    
908
	    
973
		$pdf->Output($filename, 'I');
909
		$pdf->Output($filename, 'I');
974
        
910
        
975
	} else {
911
	} else {
Line 978... Line 914...
978
		
914
		
979
		// Hier wird der Dateiname an FPD übergeben. Er soll sich aus der Rechnungsnummer ergeben, auch wenn das Dokument über die ID gespeichert ist.
915
		// Hier wird der Dateiname an FPD übergeben. Er soll sich aus der Rechnungsnummer ergeben, auch wenn das Dokument über die ID gespeichert ist.
980
		$pdf->Output($this->view['filename_out'], 'I');
916
		$pdf->Output($this->view['filename_out'], 'I');
981
			
917
			
982
	} 
918
	} 
983
	 
919
 
-
 
920
?>
984
921