Subversion Repositories wpShopGermany4

Rev

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

Rev 8154 Rev 8214
Line 7... Line 7...
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
	 
9
	 
10
	require_once WPSG_PATH_LIB.'wpsg_fpdf.class.php';
10
	require_once WPSG_PATH_LIB.'wpsg_fpdf.class.php';
11
	
11
	
12
	global $absender_left, $absender_top, $adress_left, $adress_top, $rdata_left, $rdata_top, $rhead_left, $rhead_top, $sum_multi_offset, $pdf;
12
	global $absender_left, $absender_top, $adress_left, $adress_top, $rdata_left, $rdata_top, $rhead_left, $rhead_top, $sum_multi_offset, $pdf, $data;
13
	 
13
	 
14
	// Positionierung der Absenderadresszeile
14
	// Positionierung der Absenderadresszeile
15
	$absender_left				= 25;
15
	$absender_left				= 25;
16
	$absender_top				= 50;
16
	$absender_top				= 50;
17
	
17
	
Line 31... Line 31...
31
	$prod_left					= 25;
31
	$prod_left					= 25;
32
	$prod_top					= 120;
32
	$prod_top					= 120;
33
	
33
	
34
	// Anzahl an Produkten pro Seite
34
	// Anzahl an Produkten pro Seite
35
	$prod_break					= $this->get_option('wpsg_rechnungen_pdfperpage');
35
	$prod_break					= $this->get_option('wpsg_rechnungen_pdfperpage');
36
	
36
 
-
 
37
    /*
37
	$arCalculation = $this->view['basket']['arCalculation'];
38
    $arCalculation = $this->view['basket']['arCalculation'];
38
    $data = $this->view['multi_data']['orders'][0]['data'];
39
    $data = $this->view['multi_data']['orders'][0]['data'];
39
    $sum = $this->view['multi_data']['orders'][0]['sum'];
40
    $sum = $this->view['multi_data']['orders'][0]['sum'];
-
 
41
	*/
40
	
42
 
-
 
43
    $arCalculation = array_values($this->view['multi_data']['order_data'])[0]['arCalculation'];
-
 
44
    $data = $this->view['data'];
-
 
45
    $sum = $arCalculation['sum'];
-
 
46
 
41
	if ($this->getFrontendTaxView() === WPSG_NETTO) $taxdisplay = 'netto';
47
	if ($this->getFrontendTaxView() === WPSG_NETTO) $taxdisplay = 'netto';
42
	else $taxdisplay = 'brutto';
48
	else $taxdisplay = 'brutto';
43
	
49
	
44
	if (!function_exists('AddRechnungPage')) {
50
	if (!function_exists('AddRechnungPage')) {
45
		
51
		
46
		function AddRechnungPage($shop, $pdf) {
52
		function AddRechnungPage($shop, $pdf) {
47
 
53
 
48
			global $absender_left, $absender_top, $adress_left, $adress_top, $rdata_left, $rdata_top, $offset, $sum_multi_offset;
54
			global $absender_left, $absender_top, $adress_left, $adress_top, $rdata_left, $rdata_top, $offset, $sum_multi_offset, $data;
49
			
55
			
50
			$pdf->AddPage();
56
			$pdf->AddPage();
51
            $sum_multi_offset = 0;
57
            $sum_multi_offset = 0;
52
			
58
			
53
			if (file_exists($shop->callMod('wpsg_mod_rechnungen', 'getFilePath', array(''))."wpsg_rechnungen_bp.pdf")) {
59
			if (file_exists($shop->callMod('wpsg_mod_rechnungen', 'getPaperPath', array())."wpsg_rechnungen_bp.pdf")) {
54
				
60
				
55
				$pdf->setSourceFile($shop->callMod('wpsg_mod_rechnungen', 'getFilePath', array(''))."wpsg_rechnungen_bp.pdf");
61
				$pdf->setSourceFile($shop->callMod('wpsg_mod_rechnungen', 'getPaperPath', array())."wpsg_rechnungen_bp.pdf");
56
				$tplidx = $pdf->importPage(1, '/MediaBox');
62
				$tplidx = $pdf->importPage(1, '/MediaBox');
57
				$pdf->useTemplate($tplidx, 0, 0, 210);
63
				$pdf->useTemplate($tplidx, 0, 0, 210);
58
				
64
				
59
			} else if (file_exists($shop->callMod('wpsg_mod_rechnungen', 'getFilePath', array(''))."wpsg_rechnungen_bp.jpg")) {
65
			} else if (file_exists($shop->callMod('wpsg_mod_rechnungen', 'getPaperPath', array())."wpsg_rechnungen_bp.jpg")) {
60
				
66
				
61
				$pdf->image($shop->callMod('wpsg_mod_rechnungen', 'getFilePath', array(''))."wpsg_rechnungen_bp.jpg", 0, 0, 210, 297, 'jpg');
67
				$pdf->image($shop->callMod('wpsg_mod_rechnungen', 'getPaperPath', array())."wpsg_rechnungen_bp.jpg", 0, 0, 210, 297, 'jpg');
62
				
68
				
63
			}
69
			}
64
			
70
			
65
			
71
			
66
			if (file_exists($shop->callMod('wpsg_mod_rechnungen', 'getFilePath', array(''))."wpsg_rechnungen_logo.jpg"))
72
			if (file_exists($shop->callMod('wpsg_mod_rechnungen', 'getPaperPath', array())."wpsg_rechnungen_logo.jpg"))
67
			{
73
			{
68
				
74
				
69
				list($width, $height, $type, $attr) = getimagesize($shop->callMod('wpsg_mod_rechnungen', 'getFilePath', array(''))."wpsg_rechnungen_logo.jpg");
75
				list($width, $height, $type, $attr) = getimagesize($shop->callMod('wpsg_mod_rechnungen', 'getPaperPath', array())."wpsg_rechnungen_logo.jpg");
70
				
76
				
71
				// Umrechnung von Inch zu Pixel
77
				// Umrechnung von Inch zu Pixel
72
				$wPix = (25.4 * (int)$width) / 96;
78
				$wPix = (25.4 * (int)$width) / 96;
73
				$hPix = (25.4 * (int)$height) / 96;
79
				$hPix = (25.4 * (int)$height) / 96;
74
				
80
				
Line 91... Line 97...
91
				if(isset($logo_pos) && $logo_pos === "left") { $abscissa = $leftPos; $ordinate = 20; }
97
				if(isset($logo_pos) && $logo_pos === "left") { $abscissa = $leftPos; $ordinate = 20; }
92
				if(isset($logo_pos) && $logo_pos === "center") { $abscissa = $midPos; $ordinate = 20; }
98
				if(isset($logo_pos) && $logo_pos === "center") { $abscissa = $midPos; $ordinate = 20; }
93
				if(isset($logo_pos) && $logo_pos === "right") { $abscissa = $rightPos; }
99
				if(isset($logo_pos) && $logo_pos === "right") { $abscissa = $rightPos; }
94
				
100
				
95
				$pdf->SetAlpha($alpha);
101
				$pdf->SetAlpha($alpha);
96
				$pdf->image($shop->callMod('wpsg_mod_rechnungen', 'getFilePath', array(''))."wpsg_rechnungen_logo.jpg", $abscissa, $ordinate, $wPix, $hPix);
102
				$pdf->image($shop->callMod('wpsg_mod_rechnungen', 'getPaperPath', array())."wpsg_rechnungen_logo.jpg", $abscissa, $ordinate, $wPix, $hPix);
97
				$pdf->SetAlpha(1);
103
				$pdf->SetAlpha(1);
98
				
104
				
99
			}
105
			}
100
			
106
 
101
			// Absenderadresszeile (Wird in der Konfiguration hinterlegt)
107
            // Absenderadresszeile (Wird in der Konfiguration hinterlegt)
102
			$pdf->SetFont('Arial', '', 6);
108
			$pdf->SetFont('Arial', '', 6);
103
			$pdf->Text($absender_left, $absender_top, $shop->replaceUniversalPlatzhalter(__($shop->get_option("wpsg_rechnungen_adresszeile"), 'wpsg'), $data['id']));
109
			$pdf->Text($absender_left, $absender_top, $shop->replaceUniversalPlatzhalter(__($shop->get_option("wpsg_rechnungen_adresszeile"), 'wpsg'), $data['id']));
104
			
110
			
105
			if (wpsg_getStr($shop->view['kunde']['kuerzel']) != "") $shop->view['kunde']['kuerzel'] = $shop->view['kunde']['kuerzel'].'-';
111
			if (wpsg_getStr($shop->view['kunde']['kuerzel']) != "") $shop->view['kunde']['kuerzel'] = $shop->view['kunde']['kuerzel'].'-';
106
			
112
			
Line 186... Line 192...
186
		
192
		
187
	};
193
	};
188
	
194
	
189
    $rhead_count = 1;
195
    $rhead_count = 1;
190
    $sum_multi_offset = 0;
196
    $sum_multi_offset = 0;
191
    $orders = $this->view['multi_data']['orders']; 
197
    // $orders = $this->view['multi_data']['orders'];
192
 
198
 
193
	// noMwSt
199
	// noMwSt
194
    $head_data = array_values($this->view['multi_data']['order_data'])[0];
200
    $head_data = array_values($this->view['multi_data']['order_data'])[0];
195
    if ( ($head_data['oCalculation']->getTaxMode() === \wpsg\wpsg_calculation::TAXMODE_B2B) && ($head_data['oOrder']->isInnerEu()) ) {
201
    if ( ($head_data['oCalculation']->getTaxMode() === \wpsg\wpsg_calculation::TAXMODE_B2B) && ($head_data['oOrder']->isInnerEu()) ) {
196
        $bNoTax = true;
202
        $bNoTax = true;
Line 235... Line 241...
235
        $pdf->Text($rhead_left + 115, $rhead_top + $sum_multi_offset + 6, $oOrder->getPaymentLabel());
241
        $pdf->Text($rhead_left + 115, $rhead_top + $sum_multi_offset + 6, $oOrder->getPaymentLabel());
236
         
242
         
237
        // Bestellnummer anzeigen
243
        // Bestellnummer anzeigen
238
        $pdf->Text($rhead_left + 155, $rhead_top + $sum_multi_offset, __("Best. Nr.", "wpsg"));
244
        $pdf->Text($rhead_left + 155, $rhead_top + $sum_multi_offset, __("Best. Nr.", "wpsg"));
239
        $pdf->Text($rhead_left + 155, $rhead_top + $sum_multi_offset + 6, $oOrder->getNr());
245
        $pdf->Text($rhead_left + 155, $rhead_top + $sum_multi_offset + 6, $oOrder->getNr());
240
        
-
 
241
        $summe = 0;
-
 
242
 
246
 
243
        $bKopf = false; $pnr = 1; $offset = 0; $count = 0; 
247
        $bKopf = false; $pnr = 1; $offset = 0; $count = 0; 
244
        
248
        
245
        foreach ($oOrder->getOrderProducts() as $oOrderProduct) {
249
        foreach ($oOrder->getOrderProducts() as $oOrderProduct) {
246
 
250
 
Line 466... Line 470...
466
            
470
            
467
            $offset += $height;
471
            $offset += $height;
468
            
472
            
469
            $pnr ++;
473
            $pnr ++;
470
            $count ++;
474
            $count ++;
471
            
475
 
472
            $summe += $p['price'] * $p['menge'];
-
 
473
            
-
 
474
            if ($pdf->getY() > 220 || ($count >= $prod_break && sizeof($oOrder->getOrderProducts()) > ($pnr - 1))) {
476
            if ($pdf->getY() > 220 || ($count >= $prod_break && sizeof($oOrder->getOrderProducts()) > ($pnr - 1))) {
475
                
477
                
476
                AddRechnungPage($this, $pdf);
478
                AddRechnungPage($this, $pdf);
477
                $bKopf = false; $count = 0; $offset = 0;
479
                $bKopf = false; $count = 0; $offset = 0;
478
                
480
                
Line 895... Line 897...
895
		
897
		
896
	$filename = $this->view['filename'].".pdf";
898
	$filename = $this->view['filename'].".pdf";
897
	 
899
	 
898
	if ($this->view['preview']) {
900
	if ($this->view['preview']) {
899
 
901
 
900
		//$pdf->Output($this->callMod('wpsg_mod_rechnungen', 'getFilePath', array('multi')).$filename, 'F');
-
 
901
		$pdf->Output();
902
		$pdf->Output();
902
		
903
		
903
	    exit;
904
	    exit;
904
		
905
		
905
	} else {
906
	} else {