Subversion Repositories wpShopGermany4

Rev

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

Rev 8179 Rev 8189
Line 4... Line 4...
4
	 * Template für die PDF Rechnung
4
	 * Template für die PDF Rechnung
5
	 */
5
	 */
6
	
6
	
7
	require_once WPSG_PATH_LIB.'FPDF_1.81/fpdf.php';
7
	require_once WPSG_PATH_LIB.'FPDF_1.81/fpdf.php';
8
	require_once WPSG_PATH_LIB.'FPDI_2.2.0/autoload.php';
8
	require_once WPSG_PATH_LIB.'FPDI_2.2.0/autoload.php';
9
	 
-
 
10
	require_once WPSG_PATH_LIB.'wpsg_fpdf.class.php';
9
	require_once WPSG_PATH_LIB.'wpsg_fpdf.class.php';
11
	
10
	
12
	global $absender_left, $absender_top, $adress_left, $adress_top, $rdata_left, $rdata_top;
11
	global $absender_left, $absender_top, $adress_left, $adress_top, $rdata_left, $rdata_top;
13
	
12
	
14
	// Positionierung der Absenderadresszeile
13
	// Positionierung der Absenderadresszeile
Line 34... Line 33...
34
	
33
	
35
	if ($this->getFrontendTaxView() === WPSG_NETTO) $taxdisplay = 'netto';
34
	if ($this->getFrontendTaxView() === WPSG_NETTO) $taxdisplay = 'netto';
36
	else $taxdisplay = 'brutto';
35
	else $taxdisplay = 'brutto';
37
	
36
	
38
	// 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
39
	if ( ($this->get_option('wpsg_kleinunternehmer') == '1') || ($this->view['oCalculationOrder']->getTaxMode() === \wpsg\wpsg_calculation::TAXMODE_SMALLBUSINESS) )
38
	if ( ($this->get_option('wpsg_kleinunternehmer') == '1') || ($this->view['oCalculationOrder']->getTaxMode() === \wpsg\wpsg_calculation::TAXMODE_SMALLBUSINESS) ) unset($this->view['basket']['mwst']);
40
	{
-
 
41
		
-
 
42
		unset($this->view['basket']['mwst']);
-
 
43
		
-
 
44
	}
-
 
45
	
39
	
46
	if (!function_exists('AddRechnungPage'))
40
	if (!function_exists('AddRechnungPage'))
47
	{
41
	{
48
		
42
		
49
		function AddRechnungPage($shop, $pdf)
43
		function AddRechnungPage($shop, $pdf)
Line 110... Line 104...
110
			$pdf->SetFont('Arial', '', 12);
104
			$pdf->SetFont('Arial', '', 12);
111
			$pdf->Text($adress_left, $adress_top, $shop->view['kunde']['firma']);
105
			$pdf->Text($adress_left, $adress_top, $shop->view['kunde']['firma']);
112
			$pdf->Text($adress_left, $adress_top + 5, $shop->view['kunde']['vname'].' '.$shop->view['kunde']['name']);
106
			$pdf->Text($adress_left, $adress_top + 5, $shop->view['kunde']['vname'].' '.$shop->view['kunde']['name']);
113
			$pdf->Text($adress_left, $adress_top + 10, $shop->view['kunde']['strasse'].' '.wpsg_getStr($shop->view['kunde']['nr']));
107
			$pdf->Text($adress_left, $adress_top + 10, $shop->view['kunde']['strasse'].' '.wpsg_getStr($shop->view['kunde']['nr']));
114
			$pdf->Text($adress_left, $adress_top + 15, $shop->view['kunde']['plz'].' '.$shop->view['kunde']['ort']);
108
			$pdf->Text($adress_left, $adress_top + 15, $shop->view['kunde']['plz'].' '.$shop->view['kunde']['ort']);
115
			if ($shop->get_option("wpsg_mod_rechnungen_hideCountry") == '0')
-
 
-
 
109
 
116
				$pdf->Text($adress_left, $adress_top + 20, strtoupper($shop->view['oOrder']->getInvoiceCountryName()));
110
			if ($shop->get_option("wpsg_mod_rechnungen_hideCountry") == '0') $pdf->Text($adress_left, $adress_top + 20, strtoupper($shop->view['oOrder']->getInvoiceCountryName()));
117
			
111
			
118
			// Rechnungsdaten
112
			// Rechnungsdaten
119
			$pdf->SetFont('Arial', 'B', 16);
113
			$pdf->SetFont('Arial', 'B', 16);
120
			$pdf->Text($rdata_left, $rdata_top, __('Rechnung', 'wpsg'));
114
			$pdf->Text($rdata_left, $rdata_top, __('Rechnung', 'wpsg'));
121
			$pdf->SetFont('Arial', 'B', 9);
115
			$pdf->SetFont('Arial', 'B', 9);
Line 180... Line 174...
180
	$pdf = new wpsg_fpdf();
174
	$pdf = new wpsg_fpdf();
181
	$pdf->SetAutoPageBreak(true, 5);
175
	$pdf->SetAutoPageBreak(true, 5);
182
	AddRechnungPage($this, $pdf);
176
	AddRechnungPage($this, $pdf);
183
 
177
 
184
    if ( ($this->view['oCalculationOrder']->getTaxMode() === \wpsg\wpsg_calculation::TAXMODE_B2B && $this->view['oOrder']->isInnerEu()) 
178
    if ( ($this->view['oCalculationOrder']->getTaxMode() === \wpsg\wpsg_calculation::TAXMODE_B2B && $this->view['oOrder']->isInnerEu()) 
185
		|| ($this->view['oCalculationOrder']->getTaxMode() === \wpsg\wpsg_calculation::TAXMODE_SMALLBUSINESS) 
179
	|| ($this->view['oCalculationOrder']->getTaxMode() === \wpsg\wpsg_calculation::TAXMODE_SMALLBUSINESS) 
186
	) {
-
 
187
        $bNoTax = true;
180
	) $bNoTax = true;
188
    } else {
-
 
189
	    $bNoTax = false;
181
	else $bNoTax = false;
190
    }
-
 
191
 
182
 
192
	$bTaxCol = false;
183
	$bTaxCol = false;
193
	if ($this->get_option('wpsg_showMwstAlways') === '1') $bTaxCol = true;
184
	if ($this->get_option('wpsg_showMwstAlways') === '1') $bTaxCol = true;
194
	else if (!$bNoTax) $bTaxCol = true;
185
	else if (!$bNoTax) $bTaxCol = true;
195
 
186
 
Line 248... Line 239...
248
		}
239
		}
249
		
240
		
250
		$pdf->SetFont('Arial', '', 9);
241
		$pdf->SetFont('Arial', '', 9);
251
		$pdf->setXY($prod_left, $prod_top + $offset);
242
		$pdf->setXY($prod_left, $prod_top + $offset);
252
		
243
		
253
		if ($this->get_option('wpsg_mod_rechnungen_anr') == '1')
244
		if ($this->get_option('wpsg_mod_rechnungen_anr') == '1') $pdf->Cell(10, 8, $product->getNr(), 0, 0, 'C');
254
		{
-
 
255
			
-
 
256
			$pdf->Cell(10, 8,  $product->getNr(), 0, 0, 'C');
-
 
257
			
-
 
258
		}
-
 
259
		else
-
 
260
		{
-
 
261
			
-
 
262
			$pdf->Cell(10, 8, $pnr.".", 0, 0, 'C');
245
		else $pdf->Cell(10, 8, $pnr.".", 0, 0, 'C');
263
			
-
 
264
		}
-
 
265
		
246
		
266
		if ($this->get_option('wpsg_rechnungen_pdetailname') == '1') {
-
 
267
 
-
 
268
			$produkt_text = $this->getProductName($this->getProduktID($p['product_id']), true);
247
		if ($this->get_option('wpsg_rechnungen_pdetailname') == '1') $produkt_text = $this->getProductName($this->getProduktID($p['product_id']), true);
269
 
-
 
270
		} else {
-
 
271
 
-
 
272
			$produkt_text = $this->getProductName($this->getProduktID($p['product_id']), false);
248
		else $produkt_text = $this->getProductName($this->getProduktID($p['product_id']), false);
273
 
-
 
274
		}
-
 
275
 
249
 
276
		$produktBeschreibung = trim(strip_tags($product->getShortDescription()));
250
		$produktBeschreibung = trim(strip_tags($product->getShortDescription()));
277
		
251
		
278
		if ($this->isOtherLang())
252
		if ($this->isOtherLang())
279
		{
253
		{
Line 322... Line 296...
322
			$produkt_text .= "\r\n".wpsg_translate(__('Artikelnummer: #1#', 'wpsg'), $anr);
296
			$produkt_text .= "\r\n".wpsg_translate(__('Artikelnummer: #1#', 'wpsg'), $anr);
323
			
297
			
324
		}
298
		}
325
		
299
		
326
		$produkt_text_cell_width = 102;
300
		$produkt_text_cell_width = 102;
327
		if ($bTaxCol)
-
 
328
		{
-
 
329
			$produkt_text_cell_width = 87;
301
		if ($bTaxCol) $produkt_text_cell_width = 87;
330
		}
-
 
331
		
302
		
332
		$produkt_text_width = $pdf->GetStringWidth($produkt_text);
303
		$produkt_text_width = $pdf->GetStringWidth($produkt_text);
333
		//$produkt_text_cell_width = (($this->arMwSt == "-1")?87:102);
304
		//$produkt_text_cell_width = (($this->arMwSt == "-1")?87:102);
334
		
305
		
335
		$height += 5 * ceil($produkt_text_width / $produkt_text_cell_width) + 3;
306
		$height += 5 * ceil($produkt_text_width / $produkt_text_cell_width) + 3;
Line 341... Line 312...
341
		//$pdf->Cell((($this->arMwSt == "-1")?102:87), 8, $produkt_text, 0, 0, 'L');
312
		//$pdf->Cell((($this->arMwSt == "-1")?102:87), 8, $produkt_text, 0, 0, 'L');
342
		 
313
		 
343
		if ($bTaxCol) {
314
		if ($bTaxCol) {
344
 
315
 
345
			$pdf->setXY($prod_left + 97, $prod_top + $offset);
316
			$pdf->setXY($prod_left + 97, $prod_top + $offset);
346
			$pdf->Cell(15, 8, (($bNoTax)?'0.00 %':wpsg_ff($this->view['basket']['arCalculation']['tax'][$p['tax_key']]['tax_value'], '%')), 0, 0, 'C'); // BUG
317
			$pdf->Cell(15, 8, (($bNoTax)?'0.00 %':wpsg_ff($this->view['basket']['arCalculation']['tax'][$p['tax_key']]['tax_value'], '%')), 0, 0, 'C');
347
 
318
 
348
		}
319
		}
349
		
320
		
350
		$pdf->setXY($prod_left + 112, $prod_top + $offset);
321
		$pdf->setXY($prod_left + 112, $prod_top + $offset);
351
		$pdf->Cell(15, 8, $p['amount'], 0, 0, 'C');
322
		$pdf->Cell(15, 8, $p['amount'], 0, 0, 'C');
352
		
323
		
353
		if ( ( wpsg_ShopController::get_option('wpsg_preisangaben') == WPSG_NETTO ) || $bNoTax ) {
324
		if ( ( wpsg_ShopController::get_option('wpsg_preisangaben') == WPSG_NETTO ) || $bNoTax ) $preis_single = $p['netto_calculated_single'];
354
			
-
 
355
			$preis_single = $p['netto_calculated_single'];
-
 
356
			
-
 
357
		} else {
-
 
358
			
-
 
359
			$preis_single =  $p['brutto_calculated_single'];
325
		else $preis_single =  $p['brutto_calculated_single'];
360
			
-
 
361
		}
-
 
362
		
326
		
363
		$pdf->setXY($prod_left + 127, $prod_top + $offset);
327
		$pdf->setXY($prod_left + 127, $prod_top + $offset);
364
		$pdf->Cell(25, 8, wpsg_ff($preis_single, $this->get_option('wpsg_currency')), 0, 0, 'R');
328
		$pdf->Cell(25, 8, wpsg_ff($preis_single, $this->get_option('wpsg_currency')), 0, 0, 'R');
365
		
329
		
366
		$pdf->setXY($prod_left + 152, $prod_top + $offset);
330
		$pdf->setXY($prod_left + 152, $prod_top + $offset);
Line 447... Line 411...
447
		// Jetzt die Rahmen zeichnen
411
		// Jetzt die Rahmen zeichnen
448
		$pdf->Rect($prod_left, $prod_top + $offset, 10, $height);
412
		$pdf->Rect($prod_left, $prod_top + $offset, 10, $height);
449
		
413
		
450
		$pdf->Rect($prod_left + 10, $prod_top + $offset, (($bTaxCol)?87:102), $height);
414
		$pdf->Rect($prod_left + 10, $prod_top + $offset, (($bTaxCol)?87:102), $height);
451
		
415
		
452
		if ($bTaxCol)
-
 
453
		{
-
 
454
			
-
 
455
			$pdf->Rect($prod_left + 97, $prod_top + $offset, 15, $height);
416
		if ($bTaxCol) $pdf->Rect($prod_left + 97, $prod_top + $offset, 15, $height);
456
			
-
 
457
		}
-
 
458
		
417
		
459
		$pdf->Rect($prod_left + 112, $prod_top + $offset, 15, $height);
418
		$pdf->Rect($prod_left + 112, $prod_top + $offset, 15, $height);
460
		$pdf->Rect($prod_left + 127, $prod_top + $offset, 25, $height);
419
		$pdf->Rect($prod_left + 127, $prod_top + $offset, 25, $height);
461
		$pdf->Rect($prod_left + 152, $prod_top + $offset, 25, $height);
420
		$pdf->Rect($prod_left + 152, $prod_top + $offset, 25, $height);
462
		
421
		
463
		$offset += $height;
422
		$offset += $height;
464
		
423
		
465
		$pnr ++;
424
		$pnr ++;
466
		$count ++;
425
		$count ++;
467
		
426
		
468
		if ($bNoTax) {
-
 
469
			$price = $p['netto'];
427
		if ($bNoTax) $price = $p['netto'];
470
		} else {
-
 
471
			$price = $p['brutto'];
428
		else $price = $p['brutto'];
472
		}
-
 
473
 
429
 
474
		$summe += $price * $p['amount'];
430
		$summe += $price * $p['amount'];
475
		
431
		
476
		if ($pdf->getY() > 220 || ($count >= $prod_break && sizeof($this->view['basket']['arCalculation']['product']) > ($pnr - 1)))
432
		if ($pdf->getY() > 220 || ($count >= $prod_break && sizeof($this->view['basket']['arCalculation']['product']) > ($pnr - 1)))
477
		{
433
		{
Line 534... Line 490...
534
		$pdf->Cell( (($bTaxCol)?87:102), 8, wpsg_translate(__('Versandkosten "#1#"', 'wpsg'), $this->view['oOrder']->getShippingLabel()), 1, 0, 'L');
490
		$pdf->Cell( (($bTaxCol)?87:102), 8, wpsg_translate(__('Versandkosten "#1#"', 'wpsg'), $this->view['oOrder']->getShippingLabel()), 1, 0, 'L');
535
		
491
		
536
		if ($bTaxCol)
492
		if ($bTaxCol)
537
		{
493
		{
538
 
494
 
539
			if ($this->arShipping[$this->view['data']['type_shipping']]['mwst_null'] == '1' && $bNoTax)
495
			if ($this->arShipping[$this->view['data']['type_shipping']]['mwst_null'] == '1' && $bNoTax) $mwst = wpsg_ff(0.00, '%');
540
			{
-
 
541
 
-
 
542
				$mwst = wpsg_ff(0.00, '%');
-
 
543
 
-
 
544
			} else {
496
			else {
545
				
497
				
546
				if ($this->view['basket']['arCalculation']['shipping'][0]['tax_key'] === '0') {
498
				if ($this->view['basket']['arCalculation']['shipping'][0]['tax_key'] === '0') $mwst = _('anteilig');
547
 
-
 
548
					$mwst = _('anteilig');
-
 
549
					
-
 
550
				} else {
499
				else {
551
 
500
 
552
					$mwst = wpsg_ff($this->view['basket']['arCalculation']['shipping'][0]['tax'], '%');
501
					$mwst = wpsg_ff($this->view['basket']['arCalculation']['shipping'][0]['tax'], '%');
553
					$mwst = wpsg_ff($this->view['basket']['arCalculation']['tax'][$this->view['basket']['arCalculation']['shipping'][0]['tax_key']]['tax_value'], '%');
502
					$mwst = wpsg_ff($this->view['basket']['arCalculation']['tax'][$this->view['basket']['arCalculation']['shipping'][0]['tax_key']]['tax_value'], '%');
554
					
503
					
555
				}
504
				}
Line 642... Line 591...
642
		$pdf->Cell( (($bTaxCol)?87:102), 8, $label, 1, 0, 'L');
591
		$pdf->Cell( (($bTaxCol)?87:102), 8, $label, 1, 0, 'L');
643
		
592
		
644
		if ($bTaxCol)
593
		if ($bTaxCol)
645
		{
594
		{
646
			
595
			
647
			if ($bNoTax)
-
 
648
			{
-
 
649
				$mwst = wpsg_ff(0.00, '%');
596
			if ($bNoTax) $mwst = wpsg_ff(0.00, '%');
650
			}
-
 
651
			else
-
 
652
			{
-
 
653
				$mwst = wpsg_ff($this->view['storno_fee_tax_value'], '%');
597
			else $mwst = wpsg_ff($this->view['storno_fee_tax_value'], '%');
654
			}
-
 
655
			
598
			
656
			$pdf->setXY($prod_left + 97, $prod_top + $offset);
599
			$pdf->setXY($prod_left + 97, $prod_top + $offset);
657
			$pdf->Cell(15, 8, $mwst, 1, 0, 'C');
600
			$pdf->Cell(15, 8, $mwst, 1, 0, 'C');
658
			
601
			
659
		}
602
		}