Subversion Repositories wpShopGermany4

Rev

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

Rev Author Line No. Line
7256 thomas 1
<?php
2
 
3
	/**
4
	 * FPDF Template für die Generierung des Lieferscheins
5
	 */
6
 
7
	require_once WPSG_PATH_LIB.'fpdf/fpdf.php';
8
	require_once WPSG_PATH_LIB.'fpdf/fpdi.php';
9
	require_once WPSG_PATH_LIB.'wpsg_fpdf.class.php';
10
 
11
	global $absender_left, $absender_top, $adress_left, $adress_top, $dndata_left, $dndata_top;
12
 
7258 daniel 13
	if (!function_exists('addCoverLetterPage')) {
7256 thomas 14
 
7258 daniel 15
		function addCoverLetterPage($shop, $pdf) {
7256 thomas 16
 
17
			global $absender_left, $absender_top, $adress_left, $adress_top, $dndata_left, $dndata_top;
18
 
19
			$rdata_left = 0;
20
			$pdf->AddPage();
21
 
7258 daniel 22
			if (file_exists($shop->callMod('wpsg_mod_coverletter', 'getFilePath', array(''))."wpsg_coverletter_bp.pdf")) {
7256 thomas 23
 
7258 daniel 24
				$pdf->setSourceFile($shop->callMod('wpsg_mod_coverletter', 'getFilePath', array(''))."wpsg_coverletter_bp.pdf");
7256 thomas 25
				$tplidx = $pdf->importPage(1, '/MediaBox');
26
				$pdf->useTemplate($tplidx, 0, 0, 210);
27
 
7258 daniel 28
			} else if (file_exists($shop->callMod('wpsg_mod_coverletter', 'getFilePath', array(''))."wpsg_coverletter_bp.jpg")) {
7256 thomas 29
 
7258 daniel 30
				$pdf->image($shop->callMod('wpsg_mod_coverletter', 'getFilePath', array(''))."wpsg_coverletter_bp.jpg", 0, 0, 210, 297, 'jpg');
7256 thomas 31
 
32
			}
33
 
7258 daniel 34
			if (file_exists($shop->callMod('wpsg_mod_coverletter', 'getFilePath', array(''))."wpsg_coverletter_logo.jpg")) {
7256 thomas 35
 
7258 daniel 36
				list($width, $height, $type, $attr) = getimagesize($shop->callMod('wpsg_mod_coverletter', 'getFilePath', array(''))."wpsg_coverletter_logo.jpg");
7256 thomas 37
 
38
				// Umrechnung von Inch zu Pixel
39
				$wPix = (25.4 * $width) / 96;
40
				$hPix = (25.4 * $height) / 96;
7258 daniel 41
 
42
				$transparency = str_replace("%", "", $shop->get_option('wpsg_mod_coverletter_logo_transparency'));
7256 thomas 43
				if($transparency !== "100") $transparency = str_replace(array("0", "00"), "", $transparency);
44
 
45
				$alpha = 1;
7258 daniel 46
				if (wpsg_isSizedString($transparency) && $transparency !== "100") $alpha = "0.$transparency";
47
				if (wpsg_isSizedString($transparency) && $transparency === "100") $alpha = $transparency;
7256 thomas 48
 
7258 daniel 49
				$logo_pos = $shop->get_option('wpsg_mod_coverletter_logo_position');
7256 thomas 50
 
7258 daniel 51
				if(isset($logo_pos) && $logo_pos === "left") { $abscissa = 0; }
52
				if(isset($logo_pos) && $logo_pos === "center") { $abscissa = 105 - ($wPix / 2); }
53
				if(isset($logo_pos) && $logo_pos === "right") { $abscissa = 210 - $wPix; }
7256 thomas 54
 
55
				$pdf->SetAlpha($alpha);
7258 daniel 56
				$pdf->image($shop->callMod('wpsg_mod_coverletter', 'getFilePath', array(''))."wpsg_coverletter_logo.jpg", $abscissa, 0, $wPix, $hPix);
7256 thomas 57
				$pdf->SetAlpha(1);
58
 
59
			}
7258 daniel 60
 
7256 thomas 61
			// Adresse des Kunden
62
			$pdf->SetFont('Arial', '', 12);
7258 daniel 63
			$pdf->Text($adress_left, $adress_top, $shop->view['data']['company']);
64
			$pdf->Text($adress_left, $adress_top + 5, $shop->view['data']['firstname'].' '.$shop->view['data']['name']);
65
			$pdf->Text($adress_left, $adress_top + 10, $shop->view['data']['street'].' '.$shop->view['data']['hnr']);
66
			$pdf->Text($adress_left, $adress_top + 15, $shop->view['data']['zip'].' '.$shop->view['data']['city']);
67
			$pdf->Text($adress_left, $adress_top + 20, $shop->view['data']['country']);
7256 thomas 68
 
69
			// Daten
70
			$pdf->SetFont('Arial', 'B', 16);
71
			$pdf->Text($dndata_left, $dndata_top, $shop->view['title']);
72
			$pdf->SetFont('Arial', 'B', 9);
7258 daniel 73
			$pdf->Text($dndata_left, $dndata_top + 6, $shop->view['clnr']);
7256 thomas 74
			$pdf->SetFont('Arial', '', 9);
75
 
7285 thomas 76
			$pdf->Text($rdata_left + 100, $dndata_top, __("Kunden-Nr.", "wpsg"));
7256 thomas 77
			$pdf->Text($rdata_left + 100, $dndata_top + 6, (($shop->view['customer']['knr'] != '')?$shop->view['customer']['knr']:$shop->view['customer']['id']));
78
 
79
			$pdf->Text($rdata_left + 125, $dndata_top, __("Best. Nr.", "wpsg"));
80
			$pdf->Text($rdata_left + 125, $dndata_top + 6, ((trim($shop->view['order']['onr']) != '')?$shop->view['order']['onr']:$shop->view['order']['id']));
81
 
82
			$pdf->Text($rdata_left + 145, $dndata_top, __("Bestelldatum", "wpsg"));
83
			$pdf->Text($rdata_left + 145, $dndata_top + 6, wpsg_formatTimestamp(strtotime($shop->view['order']['cdate']), true));
84
 
7258 daniel 85
			$pdf->Text($rdata_left + 170, $dndata_top, __("Datum", "wpsg"));
86
			$pdf->Text($rdata_left + 170, $dndata_top + 6, wpsg_formatTimestamp(time(), true));
87
 
88
			foreach ($shop->view['arTexts'] as $text) {
7256 thomas 89
 
7258 daniel 90
				if (isset($text['aktiv']) && $text['aktiv'] == 1) {
7256 thomas 91
 
92
					$pdf->SetFont('Arial', 'B', ((intval($text['fontsize']) > 0)?intval($text['fontsize']):10));
93
					$pdf->wpsg_SetTextColor($text['color']);
94
					$pdf->wpsg_MultiCell($text['x'], $text['y'], 5, $text['text']);
95
					$pdf->wpsg_SetTextColor("#000000");
96
 
97
				}
98
 
99
			}
100
 
7258 daniel 101
			// Text
102
			$pdf->setFont('Arial', '', 10);
103
			$pdf->wpsg_MultiCell($dndata_left - 1, $dndata_top + 12, 4, $shop->view['text']);
104
 
7256 thomas 105
		}
106
 
107
	}
108
 
109
	// Positionierung der Absenderadresszeile
110
	$absender_left				= 25;
111
	$absender_top				= 50;
112
 
113
	// Positionierung der Zieladress
114
	$adress_left 				= 25;
115
	$adress_top					= 55;
116
 
117
	// Positionierund des Lieferscheinkopfes
118
	$dndata_left				= 25;
119
	$dndata_top					= 90;
120
 
121
	// Positionierung der Produktdaten
122
	$prod_left					= 25;
123
	$prod_top					= 105;
124
 
125
	// Anzahl an Produkten pro Seite
126
	$prod_break					= 10;
127
 
128
	$pdf = new wpsg_fpdf();
129
	$pdf->SetAutoPageBreak(true, 5);
7258 daniel 130
	addCoverLetterPage($this, $pdf);
7256 thomas 131
 
132
	$offset += 5;
7258 daniel 133
 
7256 thomas 134
    ob_end_clean();
135
 
7258 daniel 136
	if ($this->view['preview']) {
137
 
7256 thomas 138
		$pdf->Output($this->view['filename'], 'I');
7258 daniel 139
 
140
	} else {
7256 thomas 141
 
7258 daniel 142
		$pdf->Output($this->view['filename'], 'F');
7256 thomas 143
 
7258 daniel 144
		if ($this->view['output'] === true) $pdf->Output($this->view['filename'], 'I');
7256 thomas 145
 
146
	}
7258 daniel 147