Line 8... |
Line 8... |
8 |
require_once WPSG_PATH_LIB.'fpdf/fpdi.php';
|
8 |
require_once WPSG_PATH_LIB.'fpdf/fpdi.php';
|
9 |
require_once WPSG_PATH_LIB.'wpsg_fpdf.class.php';
|
9 |
require_once WPSG_PATH_LIB.'wpsg_fpdf.class.php';
|
10 |
|
10 |
|
11 |
global $absender_left, $absender_top, $adress_left, $adress_top, $dndata_left, $dndata_top;
|
11 |
global $absender_left, $absender_top, $adress_left, $adress_top, $dndata_left, $dndata_top;
|
12 |
|
12 |
|
13 |
if (!function_exists('AddanschreibenPage'))
|
13 |
if (!function_exists('addCoverLetterPage')) {
|
14 |
{
|
- |
|
15 |
|
14 |
|
16 |
function AddanschreibenPage($shop, $pdf)
|
15 |
function addCoverLetterPage($shop, $pdf) {
|
17 |
{
|
- |
|
18 |
|
16 |
|
19 |
global $absender_left, $absender_top, $adress_left, $adress_top, $dndata_left, $dndata_top;
|
17 |
global $absender_left, $absender_top, $adress_left, $adress_top, $dndata_left, $dndata_top;
|
20 |
|
18 |
|
21 |
$rdata_left = 0;
|
19 |
$rdata_left = 0;
|
22 |
$pdf->AddPage();
|
20 |
$pdf->AddPage();
|
23 |
|
21 |
|
24 |
if (file_exists($shop->callMod('wpsg_mod_anschreiben', 'getFilePath', array(''))."wpsg_anschreiben_bp.pdf"))
|
22 |
if (file_exists($shop->callMod('wpsg_mod_coverletter', 'getFilePath', array(''))."wpsg_coverletter_bp.pdf")) {
|
25 |
{
|
- |
|
26 |
|
23 |
|
27 |
$pagecount = $pdf->setSourceFile($shop->callMod('wpsg_mod_anschreiben', 'getFilePath', array(''))."wpsg_anschreiben_bp.pdf");
|
24 |
$pdf->setSourceFile($shop->callMod('wpsg_mod_coverletter', 'getFilePath', array(''))."wpsg_coverletter_bp.pdf");
|
28 |
$tplidx = $pdf->importPage(1, '/MediaBox');
|
25 |
$tplidx = $pdf->importPage(1, '/MediaBox');
|
29 |
$pdf->useTemplate($tplidx, 0, 0, 210);
|
26 |
$pdf->useTemplate($tplidx, 0, 0, 210);
|
30 |
|
27 |
|
31 |
}
|
- |
|
32 |
else if (file_exists($shop->callMod('wpsg_mod_anschreiben', 'getFilePath', array(''))."wpsg_anschreiben_bp.jpg"))
|
28 |
} else if (file_exists($shop->callMod('wpsg_mod_coverletter', 'getFilePath', array(''))."wpsg_coverletter_bp.jpg")) {
|
33 |
{
|
- |
|
34 |
|
29 |
|
35 |
$pdf->image($shop->callMod('wpsg_mod_anschreiben', 'getFilePath', array(''))."wpsg_anschreiben_bp.jpg", 0, 0, 210, 297, 'jpg');
|
30 |
$pdf->image($shop->callMod('wpsg_mod_coverletter', 'getFilePath', array(''))."wpsg_coverletter_bp.jpg", 0, 0, 210, 297, 'jpg');
|
36 |
|
31 |
|
37 |
}
|
32 |
}
|
38 |
|
33 |
|
- |
|
34 |
if (file_exists($shop->callMod('wpsg_mod_coverletter', 'getFilePath', array(''))."wpsg_coverletter_logo.jpg")) {
|
39 |
|
35 |
|
40 |
if (file_exists($shop->callMod('wpsg_mod_anschreiben', 'getFilePath', array(''))."wpsg_anschreiben_logo.jpg"))
|
- |
|
41 |
{
|
- |
|
42 |
|
- |
|
43 |
list($width, $height, $type, $attr) = getimagesize($shop->callMod('wpsg_mod_anschreiben', 'getFilePath', array(''))."wpsg_anschreiben_logo.jpg");
|
36 |
list($width, $height, $type, $attr) = getimagesize($shop->callMod('wpsg_mod_coverletter', 'getFilePath', array(''))."wpsg_coverletter_logo.jpg");
|
44 |
|
37 |
|
45 |
// Umrechnung von Inch zu Pixel
|
38 |
// Umrechnung von Inch zu Pixel
|
46 |
$wPix = (25.4 * $width) / 96;
|
39 |
$wPix = (25.4 * $width) / 96;
|
47 |
$hPix = (25.4 * $height) / 96;
|
40 |
$hPix = (25.4 * $height) / 96;
|
48 |
|
41 |
|
49 |
$leftPos = 110 - $wPix;
|
- |
|
50 |
$midPos = $wPix * 2.6 - $width / 2;
|
- |
|
51 |
$rightPos = 210 - $wPix;
|
- |
|
52 |
|
- |
|
53 |
$abscissa = $rightPos;
|
- |
|
54 |
$ordinate = 0;
|
- |
|
55 |
|
- |
|
56 |
$transparency = str_replace("%", "", $shop->get_option('wpsg_mod_anschreiben_logo_transparency'));
|
42 |
$transparency = str_replace("%", "", $shop->get_option('wpsg_mod_coverletter_logo_transparency'));
|
57 |
if($transparency !== "100") $transparency = str_replace(array("0", "00"), "", $transparency);
|
43 |
if($transparency !== "100") $transparency = str_replace(array("0", "00"), "", $transparency);
|
58 |
|
44 |
|
59 |
$alpha = 1;
|
45 |
$alpha = 1;
|
60 |
if(!is_null($transparency) && $transparency !== "100") $alpha = "0.$transparency";
|
46 |
if (wpsg_isSizedString($transparency) && $transparency !== "100") $alpha = "0.$transparency";
|
61 |
if(!is_null($transparency) && $transparency === "100") $alpha = $transparency;
|
47 |
if (wpsg_isSizedString($transparency) && $transparency === "100") $alpha = $transparency;
|
62 |
|
48 |
|
63 |
$logo_pos = $shop->get_option('wpsg_mod_anschreiben_logo_position');
|
49 |
$logo_pos = $shop->get_option('wpsg_mod_coverletter_logo_position');
|
64 |
|
50 |
|
65 |
if(isset($logo_pos) && $logo_pos === "left") { $abscissa = $leftPos; $ordinate = 20; }
|
51 |
if(isset($logo_pos) && $logo_pos === "left") { $abscissa = 0; }
|
66 |
if(isset($logo_pos) && $logo_pos === "center") { $abscissa = $midPos; $ordinate = 20; }
|
52 |
if(isset($logo_pos) && $logo_pos === "center") { $abscissa = 105 - ($wPix / 2); }
|
67 |
if(isset($logo_pos) && $logo_pos === "right") { $abscissa = $rightPos; }
|
53 |
if(isset($logo_pos) && $logo_pos === "right") { $abscissa = 210 - $wPix; }
|
68 |
|
54 |
|
69 |
$pdf->SetAlpha($alpha);
|
55 |
$pdf->SetAlpha($alpha);
|
70 |
$pdf->image($shop->callMod('wpsg_mod_anschreiben', 'getFilePath', array(''))."wpsg_anschreiben_logo.jpg", $abscissa, $ordinate, $wPix, $hPix);
|
56 |
$pdf->image($shop->callMod('wpsg_mod_coverletter', 'getFilePath', array(''))."wpsg_coverletter_logo.jpg", $abscissa, 0, $wPix, $hPix);
|
71 |
$pdf->SetAlpha(1);
|
57 |
$pdf->SetAlpha(1);
|
72 |
|
58 |
|
73 |
}
|
59 |
}
|
74 |
|
60 |
|
75 |
// Absenderadresszeile (Wird in der Konfiguration hinterlegt)
|
- |
|
76 |
$pdf->SetFont('Arial', '', 6);
|
- |
|
77 |
$pdf->Text($absender_left, $absender_top, $shop->replaceUniversalPlatzhalter($shop->get_option("wpsg_mod_anschreiben_adressrow"), $shop->view['order']['id']));
|
- |
|
78 |
|
- |
|
79 |
if (wpsg_getStr($shop->view['kunde']['kuerzel']) != "") $shop->view['kunde']['kuerzel'] = $shop->view['kunde']['kuerzel'].'-';
|
- |
|
80 |
|
- |
|
81 |
// Adresse des Kunden
|
61 |
// Adresse des Kunden
|
82 |
$pdf->SetFont('Arial', '', 12);
|
62 |
$pdf->SetFont('Arial', '', 12);
|
83 |
$pdf->Text($adress_left, $adress_top, $shop->view['data']['firma']);
|
63 |
$pdf->Text($adress_left, $adress_top, $shop->view['data']['company']);
|
84 |
$pdf->Text($adress_left, $adress_top + 5, $shop->view['data']['vname'].' '.$shop->view['data']['name']);
|
64 |
$pdf->Text($adress_left, $adress_top + 5, $shop->view['data']['firstname'].' '.$shop->view['data']['name']);
|
85 |
$pdf->Text($adress_left, $adress_top + 10, $shop->view['data']['strasse'].' '.$shop->view['data']['hausnr']);
|
65 |
$pdf->Text($adress_left, $adress_top + 10, $shop->view['data']['street'].' '.$shop->view['data']['hnr']);
|
86 |
$pdf->Text($adress_left, $adress_top + 15, $shop->view['data']['plz'].' '.$shop->view['data']['ort']);
|
66 |
$pdf->Text($adress_left, $adress_top + 15, $shop->view['data']['zip'].' '.$shop->view['data']['city']);
|
87 |
//if ($shop->get_option('wpsg_mod_anschreiben_hideCountry') != '1') $pdf->Text($adress_left, $adress_top + 20, strtoupper($shop->view['oOrder']->getShippingCountryName()));
|
- |
|
88 |
if ($shop->get_option('wpsg_mod_anschreiben_hideCountry') != '1') $pdf->Text($adress_left, $adress_top + 20, $shop->view['data']['land']);
|
67 |
$pdf->Text($adress_left, $adress_top + 20, $shop->view['data']['country']);
|
89 |
|
68 |
|
90 |
// Daten
|
69 |
// Daten
|
91 |
$pdf->SetFont('Arial', 'B', 16);
|
70 |
$pdf->SetFont('Arial', 'B', 16);
|
92 |
$pdf->Text($dndata_left, $dndata_top, $shop->view['title']);
|
71 |
$pdf->Text($dndata_left, $dndata_top, $shop->view['title']);
|
93 |
$pdf->SetFont('Arial', 'B', 9);
|
72 |
$pdf->SetFont('Arial', 'B', 9);
|
94 |
$pdf->Text($dndata_left, $dndata_top + 6, $shop->view['lnr']);
|
73 |
$pdf->Text($dndata_left, $dndata_top + 6, $shop->view['clnr']);
|
95 |
$pdf->SetFont('Arial', '', 9);
|
74 |
$pdf->SetFont('Arial', '', 9);
|
96 |
|
75 |
|
97 |
$pdf->Text($rdata_left + 100, $dndata_top, __("Kunden-Nr", "wpsg"));
|
76 |
$pdf->Text($rdata_left + 100, $dndata_top, __("Kunden-Nr", "wpsg"));
|
98 |
$pdf->Text($rdata_left + 100, $dndata_top + 6, (($shop->view['customer']['knr'] != '')?$shop->view['customer']['knr']:$shop->view['customer']['id']));
|
77 |
$pdf->Text($rdata_left + 100, $dndata_top + 6, (($shop->view['customer']['knr'] != '')?$shop->view['customer']['knr']:$shop->view['customer']['id']));
|
99 |
|
78 |
|
Line 101... |
Line 80... |
101 |
$pdf->Text($rdata_left + 125, $dndata_top + 6, ((trim($shop->view['order']['onr']) != '')?$shop->view['order']['onr']:$shop->view['order']['id']));
|
80 |
$pdf->Text($rdata_left + 125, $dndata_top + 6, ((trim($shop->view['order']['onr']) != '')?$shop->view['order']['onr']:$shop->view['order']['id']));
|
102 |
|
81 |
|
103 |
$pdf->Text($rdata_left + 145, $dndata_top, __("Bestelldatum", "wpsg"));
|
82 |
$pdf->Text($rdata_left + 145, $dndata_top, __("Bestelldatum", "wpsg"));
|
104 |
$pdf->Text($rdata_left + 145, $dndata_top + 6, wpsg_formatTimestamp(strtotime($shop->view['order']['cdate']), true));
|
83 |
$pdf->Text($rdata_left + 145, $dndata_top + 6, wpsg_formatTimestamp(strtotime($shop->view['order']['cdate']), true));
|
105 |
|
84 |
|
106 |
$pdf->Text($rdata_left + 170, $dndata_top, __("Lieferdatum", "wpsg"));
|
85 |
$pdf->Text($rdata_left + 170, $dndata_top, __("Datum", "wpsg"));
|
107 |
$pdf->Text($rdata_left + 170, $dndata_top + 6, wpsg_formatTimestamp($shop->view['lDatum'], true));
|
86 |
$pdf->Text($rdata_left + 170, $dndata_top + 6, wpsg_formatTimestamp(time(), true));
|
108 |
|
87 |
|
109 |
if ($shop->view['oOrder']->isInnerEu())
|
88 |
foreach ($shop->view['arTexts'] as $text) {
|
110 |
{
|
- |
|
111 |
|
- |
|
112 |
$pdf->SetFont('Arial', '', 9);
|
- |
|
113 |
$pdf->Text($adress_left, $rdata_top + 11.5, __("Innergemeinschaftliche Lieferung.", "wpsg"));
|
- |
|
114 |
|
- |
|
115 |
} else if (!$shop->view['oOrder']->isInnerEu() && $shop->view['oOrder']->getShippingCountryID() != $shop->getDefaultCountry(true)) {
|
- |
|
116 |
|
- |
|
117 |
// Nicht InnerEU und Nicht Inland
|
- |
|
118 |
|
- |
|
119 |
$pdf->SetFont('Arial', '', 9);
|
- |
|
120 |
$pdf->Text($adress_left, $rdata_top + 11.5, __("Steuerfreie Ausfuhrlieferung.", "wpsg"));
|
- |
|
121 |
|
- |
|
122 |
}
|
- |
|
123 |
|
89 |
|
124 |
|
- |
|
125 |
// Benutzerdefinierte Felder
|
- |
|
126 |
$arTexte = $shop->callMod('wpsg_mod_anschreiben', 'getTexte', array($shop->view['data']['id']));
|
- |
|
127 |
|
- |
|
128 |
foreach ((array)$arTexte as $text)
|
- |
|
129 |
{
|
- |
|
130 |
|
- |
|
131 |
if (isset($text['aktiv']) && $text['aktiv'] == 1)
|
90 |
if (isset($text['aktiv']) && $text['aktiv'] == 1) {
|
132 |
{
|
- |
|
133 |
|
91 |
|
134 |
$pdf->SetFont('Arial', 'B', ((intval($text['fontsize']) > 0)?intval($text['fontsize']):10));
|
92 |
$pdf->SetFont('Arial', 'B', ((intval($text['fontsize']) > 0)?intval($text['fontsize']):10));
|
135 |
$pdf->wpsg_SetTextColor($text['color']);
|
93 |
$pdf->wpsg_SetTextColor($text['color']);
|
136 |
$pdf->wpsg_MultiCell($text['x'], $text['y'], 5, $text['text']);
|
94 |
$pdf->wpsg_MultiCell($text['x'], $text['y'], 5, $text['text']);
|
137 |
$pdf->wpsg_SetTextColor("#000000");
|
95 |
$pdf->wpsg_SetTextColor("#000000");
|
138 |
|
96 |
|
139 |
}
|
97 |
}
|
140 |
|
98 |
|
141 |
}
|
99 |
}
|
142 |
|
100 |
|
- |
|
101 |
// Text
|
- |
|
102 |
$pdf->setFont('Arial', '', 10);
|
- |
|
103 |
$pdf->wpsg_MultiCell($dndata_left - 1, $dndata_top + 12, 4, $shop->view['text']);
|
- |
|
104 |
|
143 |
}
|
105 |
}
|
144 |
|
106 |
|
145 |
}
|
107 |
}
|
146 |
|
108 |
|
147 |
// Positionierung der Absenderadresszeile
|
109 |
// Positionierung der Absenderadresszeile
|
Line 163... |
Line 125... |
163 |
// Anzahl an Produkten pro Seite
|
125 |
// Anzahl an Produkten pro Seite
|
164 |
$prod_break = 10;
|
126 |
$prod_break = 10;
|
165 |
|
127 |
|
166 |
$pdf = new wpsg_fpdf();
|
128 |
$pdf = new wpsg_fpdf();
|
167 |
$pdf->SetAutoPageBreak(true, 5);
|
129 |
$pdf->SetAutoPageBreak(true, 5);
|
168 |
AddanschreibenPage($this, $pdf);
|
130 |
addCoverLetterPage($this, $pdf);
|
169 |
|
131 |
|
170 |
$filename = $this->view['filename'].".pdf";
|
- |
|
171 |
|
- |
|
172 |
|
- |
|
173 |
$offset += 5;
|
132 |
$offset += 5;
|
174 |
|
133 |
|
175 |
if ($this->view['fussText'] != "")
|
- |
|
176 |
{
|
- |
|
177 |
|
- |
|
178 |
$pdf->wpsg_MultiCell($prod_left - 1, $prod_top + $offset, 5, $this->view['fussText']);
|
- |
|
179 |
$pdf->SetFont('Arial', 'B', 9);
|
- |
|
180 |
$offset += 10;
|
- |
|
181 |
|
- |
|
182 |
}
|
- |
|
183 |
|
- |
|
184 |
ob_end_clean();
|
134 |
ob_end_clean();
|
185 |
|
135 |
|
186 |
if ($this->view['preview'])
|
136 |
if ($this->view['preview']) {
|
187 |
{
|
137 |
|
188 |
$pdf->Output($this->view['filename'], 'I');
|
138 |
$pdf->Output($this->view['filename'], 'I');
|
189 |
}
|
139 |
|
190 |
else
|
140 |
} else {
|
191 |
{
|
- |
|
192 |
|
141 |
|
193 |
$pdf->Output($this->callMod('wpsg_mod_anschreiben', 'getFilePath', array($this->view['order']['id'])).$this->view['filename'], 'F');
|
142 |
$pdf->Output($this->view['filename'], 'F');
|
194 |
|
143 |
|
195 |
if ($this->view['output'] === true) $pdf->Output($filename, 'I');
|
144 |
if ($this->view['output'] === true) $pdf->Output($this->view['filename'], 'I');
|
196 |
|
145 |
|
197 |
}
|
146 |
}
|
198 |
|
- |
|
199 |
?>
|
- |
|
200 |
|
147 |
|
- |
|
148 |
|
201 |
|
149 |
|