8068 |
karl |
1 |
<?php
|
|
|
2 |
|
|
|
3 |
/**
|
|
|
4 |
* Template für die PDF Rechnung
|
|
|
5 |
*/
|
|
|
6 |
|
|
|
7 |
require_once WPSG_PATH_LIB.'FPDF_1.81/fpdf.php';
|
|
|
8 |
require_once WPSG_PATH_LIB.'FPDI_2.2.0/autoload.php';
|
|
|
9 |
|
|
|
10 |
require_once WPSG_PATH_LIB.'wpsg_fpdf.class.php';
|
|
|
11 |
|
8069 |
daniel |
12 |
global $absender_left, $absender_top, $adress_left, $adress_top, $rdata_left, $rdata_top, $rhead_left, $rhead_top, $sum_multi_offset, $pdf;
|
|
|
13 |
|
8068 |
karl |
14 |
// Positionierung der Absenderadresszeile
|
|
|
15 |
$absender_left = 25;
|
|
|
16 |
$absender_top = 50;
|
|
|
17 |
|
|
|
18 |
// Positionierung der Zieladress
|
|
|
19 |
$adress_left = 25;
|
|
|
20 |
$adress_top = 55;
|
|
|
21 |
|
|
|
22 |
// Positionierung des Rechnungskopfes
|
|
|
23 |
$rdata_left = 25;
|
|
|
24 |
$rdata_top = 90;
|
|
|
25 |
|
|
|
26 |
// Positionierung des Teilrechnungskopfes
|
|
|
27 |
$rhead_left = 25;
|
|
|
28 |
$rhead_top = 110;
|
|
|
29 |
|
|
|
30 |
// Positionierung der Produktdaten
|
|
|
31 |
$prod_left = 25;
|
|
|
32 |
$prod_top = 120;
|
|
|
33 |
|
|
|
34 |
// Anzahl an Produkten pro Seite
|
|
|
35 |
$prod_break = $this->get_option('wpsg_rechnungen_pdfperpage');
|
|
|
36 |
|
|
|
37 |
$arCalculation = $this->view['basket']['arCalculation'];
|
|
|
38 |
$data = $this->view['multi_data']['orders'][0]['data'];
|
|
|
39 |
$sum = $this->view['multi_data']['orders'][0]['sum'];
|
|
|
40 |
|
|
|
41 |
if ($this->getFrontendTaxView() === WPSG_NETTO) $taxdisplay = 'netto';
|
|
|
42 |
else $taxdisplay = 'brutto';
|
|
|
43 |
|
8069 |
daniel |
44 |
if (!function_exists('AddRechnungPage')) {
|
8068 |
karl |
45 |
|
8069 |
daniel |
46 |
function AddRechnungPage($shop, $pdf) {
|
8068 |
karl |
47 |
|
|
|
48 |
global $absender_left, $absender_top, $adress_left, $adress_top, $rdata_left, $rdata_top, $offset, $sum_multi_offset;
|
|
|
49 |
|
|
|
50 |
$pdf->AddPage();
|
|
|
51 |
$sum_multi_offset = 0;
|
|
|
52 |
|
|
|
53 |
if (file_exists($shop->callMod('wpsg_mod_rechnungen', 'getFilePath', array(''))."wpsg_rechnungen_bp.pdf")) {
|
|
|
54 |
|
|
|
55 |
$pdf->setSourceFile($shop->callMod('wpsg_mod_rechnungen', 'getFilePath', array(''))."wpsg_rechnungen_bp.pdf");
|
|
|
56 |
$tplidx = $pdf->importPage(1, '/MediaBox');
|
|
|
57 |
$pdf->useTemplate($tplidx, 0, 0, 210);
|
|
|
58 |
|
|
|
59 |
} else if (file_exists($shop->callMod('wpsg_mod_rechnungen', 'getFilePath', array(''))."wpsg_rechnungen_bp.jpg")) {
|
|
|
60 |
|
|
|
61 |
$pdf->image($shop->callMod('wpsg_mod_rechnungen', 'getFilePath', array(''))."wpsg_rechnungen_bp.jpg", 0, 0, 210, 297, 'jpg');
|
|
|
62 |
|
|
|
63 |
}
|
|
|
64 |
|
|
|
65 |
|
|
|
66 |
if (file_exists($shop->callMod('wpsg_mod_rechnungen', 'getFilePath', array(''))."wpsg_rechnungen_logo.jpg"))
|
|
|
67 |
{
|
|
|
68 |
|
|
|
69 |
list($width, $height, $type, $attr) = getimagesize($shop->callMod('wpsg_mod_rechnungen', 'getFilePath', array(''))."wpsg_rechnungen_logo.jpg");
|
|
|
70 |
|
|
|
71 |
// Umrechnung von Inch zu Pixel
|
|
|
72 |
$wPix = (25.4 * (int)$width) / 96;
|
|
|
73 |
$hPix = (25.4 * (int)$height) / 96;
|
|
|
74 |
|
|
|
75 |
$leftPos = 110 - $wPix;
|
|
|
76 |
$midPos = $wPix * 2.6 - $width / 2;
|
|
|
77 |
$rightPos = 210 - $wPix;
|
|
|
78 |
|
|
|
79 |
$abscissa = $rightPos;
|
|
|
80 |
$ordinate = 0;
|
|
|
81 |
|
|
|
82 |
$transparency = str_replace("%", "", $shop->get_option('wpsg_rechnungen_logo_transparency'));
|
|
|
83 |
if($transparency !== "100") $transparency = str_replace(array("0", "00"), "", $transparency);
|
|
|
84 |
|
|
|
85 |
$alpha = 1;
|
|
|
86 |
if(!is_null($transparency) && $transparency !== "100") $alpha = "0.$transparency";
|
|
|
87 |
if(!is_null($transparency) && $transparency === "100") $alpha = $transparency;
|
|
|
88 |
|
|
|
89 |
$logo_pos = $shop->get_option('wpsg_rechnungen_logo_position');
|
|
|
90 |
|
|
|
91 |
if(isset($logo_pos) && $logo_pos === "left") { $abscissa = $leftPos; $ordinate = 20; }
|
|
|
92 |
if(isset($logo_pos) && $logo_pos === "center") { $abscissa = $midPos; $ordinate = 20; }
|
|
|
93 |
if(isset($logo_pos) && $logo_pos === "right") { $abscissa = $rightPos; }
|
|
|
94 |
|
|
|
95 |
$pdf->SetAlpha($alpha);
|
|
|
96 |
$pdf->image($shop->callMod('wpsg_mod_rechnungen', 'getFilePath', array(''))."wpsg_rechnungen_logo.jpg", $abscissa, $ordinate, $wPix, $hPix);
|
|
|
97 |
$pdf->SetAlpha(1);
|
|
|
98 |
|
|
|
99 |
}
|
|
|
100 |
|
|
|
101 |
// Absenderadresszeile (Wird in der Konfiguration hinterlegt)
|
|
|
102 |
$pdf->SetFont('Arial', '', 6);
|
|
|
103 |
$pdf->Text($absender_left, $absender_top, $shop->replaceUniversalPlatzhalter(__($shop->get_option("wpsg_rechnungen_adresszeile"), 'wpsg'), $data['id']));
|
|
|
104 |
|
|
|
105 |
if (wpsg_getStr($shop->view['kunde']['kuerzel']) != "") $shop->view['kunde']['kuerzel'] = $shop->view['kunde']['kuerzel'].'-';
|
|
|
106 |
|
|
|
107 |
// Adresse des Kunden
|
|
|
108 |
$pdf->SetFont('Arial', '', 12);
|
|
|
109 |
$pdf->Text($adress_left, $adress_top, $shop->view['kunde']['firma']);
|
|
|
110 |
$pdf->Text($adress_left, $adress_top + 5, $shop->view['kunde']['vname'].' '.$shop->view['kunde']['name']);
|
|
|
111 |
$pdf->Text($adress_left, $adress_top + 10, $shop->view['kunde']['strasse'].' '.wpsg_getStr($shop->view['kunde']['nr']));
|
|
|
112 |
$pdf->Text($adress_left, $adress_top + 15, $shop->view['kunde']['plz'].' '.$shop->view['kunde']['ort']);
|
8074 |
karl |
113 |
if ($shop->get_option("wpsg_mod_rechnungen_hideCountry") == '0') {
|
8068 |
karl |
114 |
$pdf->Text($adress_left, $adress_top + 20, strtoupper($shop->view['oOrder']->getInvoiceCountryName()));
|
8074 |
karl |
115 |
}
|
|
|
116 |
|
8068 |
karl |
117 |
// Rechnungsdaten
|
|
|
118 |
$pdf->SetFont('Arial', 'B', 16);
|
|
|
119 |
$pdf->Text($rdata_left, $rdata_top, __('Rechnung', 'wpsg'));
|
|
|
120 |
$pdf->SetFont('Arial', 'B', 9);
|
|
|
121 |
$pdf->Text($rdata_left, $rdata_top + 6, $shop->view['rnr']);
|
|
|
122 |
$pdf->SetFont('Arial', '', 9);
|
|
|
123 |
|
|
|
124 |
// Fälligkeitsdatum
|
|
|
125 |
if (isset($shop->view['faelligkeitdatum']))
|
|
|
126 |
{
|
|
|
127 |
|
|
|
128 |
$pdf->Text($rdata_left + 35, $rdata_top, __("Fällig am", "wpsg"));
|
|
|
129 |
$pdf->Text($rdata_left + 35, $rdata_top + 6, $shop->view['faelligkeitdatum']);
|
|
|
130 |
|
|
|
131 |
}
|
|
|
132 |
|
|
|
133 |
// Kunden-Nr
|
|
|
134 |
$pdf->Text($rdata_left + 55, $rdata_top, __("Kunden-Nr", "wpsg"));
|
|
|
135 |
$pdf->Text($rdata_left + 55, $rdata_top + 6, (($shop->view['kunde']['knr'] != '')?$shop->view['kunde']['knr']:$shop->view['kunde']['id']));
|
|
|
136 |
|
|
|
137 |
// Datum
|
8083 |
karl |
138 |
$pdf->Text($rdata_left + 75, $rdata_top, __("Rechnungsdatum", "wpsg"));
|
8068 |
karl |
139 |
$pdf->Text($rdata_left + 75, $rdata_top + 6, $shop->view['rDatum']);
|
|
|
140 |
|
|
|
141 |
// InnerEu Hinweistext
|
8069 |
daniel |
142 |
if ($shop->view['oOrder']->isInnerEu()) {
|
8068 |
karl |
143 |
|
|
|
144 |
$pdf->SetFont('Arial', '', 9);
|
|
|
145 |
$pdf->Text($adress_left, $rdata_top + 11.5, __("Innergemeinschaftliche Lieferung.", "wpsg"));
|
|
|
146 |
|
8083 |
karl |
147 |
$offset += 11.5;
|
|
|
148 |
|
8068 |
karl |
149 |
}
|
|
|
150 |
|
|
|
151 |
// Benutzerdefinierte Felder
|
|
|
152 |
$arTexte = $shop->callMod('wpsg_mod_rechnungen', 'getRechnungstexte', array($data['id']));
|
|
|
153 |
|
|
|
154 |
foreach ((array)$arTexte as $text)
|
|
|
155 |
{
|
|
|
156 |
|
|
|
157 |
if (isset($text['aktiv']) && $text['aktiv'] == 1)
|
|
|
158 |
{
|
|
|
159 |
|
|
|
160 |
$pdf->SetFont('Arial', 'B', ((intval($text['fontsize']) > 0)?intval($text['fontsize']):10));
|
|
|
161 |
$pdf->wpsg_SetTextColor($text['color']);
|
|
|
162 |
$pdf->wpsg_MultiCell($text['x'], $text['y'], 5, $text['text']);
|
|
|
163 |
$pdf->wpsg_SetTextColor("#000000");
|
|
|
164 |
|
|
|
165 |
}
|
|
|
166 |
|
|
|
167 |
}
|
|
|
168 |
|
|
|
169 |
}
|
|
|
170 |
|
|
|
171 |
}
|
|
|
172 |
|
|
|
173 |
$pdf = new wpsg_fpdf();
|
8075 |
karl |
174 |
$pdf->SetAutoPageBreak(false, 5);
|
8068 |
karl |
175 |
AddRechnungPage($this, $pdf);
|
|
|
176 |
|
8069 |
daniel |
177 |
$checkPageBreak = function($shop, $offset, $lines) use ($pdf, $prod_top) {
|
|
|
178 |
|
|
|
179 |
if ($prod_top + $offset + ($lines * 5) > 290) {
|
|
|
180 |
|
|
|
181 |
AddRechnungPage($this, $pdf);
|
|
|
182 |
|
|
|
183 |
return 0;
|
|
|
184 |
|
|
|
185 |
} else return $offset;
|
|
|
186 |
|
|
|
187 |
};
|
|
|
188 |
|
8068 |
karl |
189 |
$rhead_count = 1;
|
|
|
190 |
$sum_multi_offset = 0;
|
|
|
191 |
$orders = $this->view['multi_data']['orders'];
|
8083 |
karl |
192 |
|
8082 |
karl |
193 |
// noMwSt
|
8083 |
karl |
194 |
$head_data = array_values($this->view['multi_data']['order_data'])[0];
|
8130 |
karl |
195 |
if ( ($head_data['oCalculation']->getTaxMode() === \wpsg\wpsg_calculation::TAXMODE_B2B) && ($head_data['oOrder']->isInnerEu()) ) {
|
8083 |
karl |
196 |
$bNoTax = true;
|
|
|
197 |
} else {
|
|
|
198 |
$bNoTax = false;
|
|
|
199 |
}
|
8069 |
daniel |
200 |
|
|
|
201 |
$bTaxCol = false;
|
|
|
202 |
if ($this->get_option('wpsg_showMwstAlways') === '1') $bTaxCol = true;
|
|
|
203 |
else {
|
|
|
204 |
|
|
|
205 |
foreach ($this->view['multi_data']['order_data'] as $order_data) {
|
|
|
206 |
|
|
|
207 |
if (sizeof($order_data['arCalculation']['tax']) > 1) { $bTaxCol = true; break; }
|
|
|
208 |
|
|
|
209 |
}
|
|
|
210 |
|
|
|
211 |
}
|
|
|
212 |
|
8068 |
karl |
213 |
// FOREACH ORDER START
|
8069 |
daniel |
214 |
foreach ($this->view['multi_data']['order_data'] as $order_data) {
|
8068 |
karl |
215 |
|
8069 |
daniel |
216 |
/** @var wpsg_order $oOrder */
|
|
|
217 |
$oOrder = $order_data['oOrder'];
|
|
|
218 |
|
|
|
219 |
/** @var \wpsg\wpsg_calculation $arCalculation */
|
|
|
220 |
$arCalculation = $order_data['arCalculation'];
|
|
|
221 |
|
8068 |
karl |
222 |
// Sammelrechnung Zähler
|
|
|
223 |
$pdf->SetFont('Arial', 'B', 12);
|
|
|
224 |
$pdf->Text($rhead_left, $rhead_top + $sum_multi_offset, $rhead_count);
|
|
|
225 |
$pdf->Text($rhead_left + 6, $rhead_top + $sum_multi_offset, __("Bestellung", "wpsg"));
|
|
|
226 |
$rhead_count++;
|
|
|
227 |
$pdf->SetFont('Arial', '', 9);
|
|
|
228 |
|
8083 |
karl |
229 |
// Bestelltag anzeigen
|
|
|
230 |
$pdf->Text($rhead_left + 85, $rhead_top + $sum_multi_offset, __("Bestelldatum", "wpsg"));
|
|
|
231 |
$pdf->Text($rhead_left + 85, $rhead_top + $sum_multi_offset + 6, date("d.m.Y", strtotime($oOrder->cdate)));
|
|
|
232 |
|
8068 |
karl |
233 |
// Zahlungsbedingung anzeigen
|
8083 |
karl |
234 |
$pdf->Text($rhead_left + 115, $rhead_top + $sum_multi_offset, __("Zahlungsbedingungen", "wpsg"));
|
|
|
235 |
$pdf->Text($rhead_left + 115, $rhead_top + $sum_multi_offset + 6, $oOrder->getPaymentLabel());
|
8069 |
daniel |
236 |
|
8068 |
karl |
237 |
// Bestellnummer anzeigen
|
|
|
238 |
$pdf->Text($rhead_left + 155, $rhead_top + $sum_multi_offset, __("Best. Nr.", "wpsg"));
|
8069 |
daniel |
239 |
$pdf->Text($rhead_left + 155, $rhead_top + $sum_multi_offset + 6, $oOrder->getNr());
|
8068 |
karl |
240 |
|
|
|
241 |
$summe = 0;
|
|
|
242 |
|
|
|
243 |
$bKopf = false; $pnr = 1; $offset = 0; $count = 0;
|
|
|
244 |
|
8069 |
daniel |
245 |
foreach ($oOrder->getOrderProducts() as $oOrderProduct) {
|
8068 |
karl |
246 |
|
8069 |
daniel |
247 |
$product_id = $oOrderProduct->getProductId();
|
|
|
248 |
|
|
|
249 |
if (!$bKopf) {
|
8068 |
karl |
250 |
|
|
|
251 |
$pdf->SetFont('Arial', 'B', 9);
|
|
|
252 |
$pdf->setXY($prod_left, $prod_top + $sum_multi_offset);
|
|
|
253 |
$pdf->Cell(10, 8, __("Nr.", "wpsg"), 1, 0, 'C');
|
|
|
254 |
|
|
|
255 |
$pdf->setXY($prod_left + 10, $prod_top + $sum_multi_offset);
|
8069 |
daniel |
256 |
|
|
|
257 |
$pdf->Cell((($bTaxCol)?87:102), 8, "Name", 1, 0, 'L');
|
|
|
258 |
|
|
|
259 |
if ($bTaxCol) {
|
8068 |
karl |
260 |
|
|
|
261 |
$pdf->setXY($prod_left + 97, $prod_top + $sum_multi_offset);
|
|
|
262 |
$pdf->Cell(15, 8, __("MwSt.", "wpsg"), 1, 0, 'C');
|
|
|
263 |
|
|
|
264 |
}
|
|
|
265 |
|
|
|
266 |
$pdf->setXY($prod_left + 112, $prod_top + $sum_multi_offset);
|
|
|
267 |
$pdf->Cell(15, 8, __("Menge", "wpsg"), 1, 0, 'C');
|
|
|
268 |
|
|
|
269 |
$pdf->setXY($prod_left + 127, $prod_top + $sum_multi_offset);
|
|
|
270 |
$pdf->Cell(25, 8, __("Einzelpreis", "wpsg"), 1, 0, 'R');
|
|
|
271 |
|
|
|
272 |
$pdf->setXY($prod_left + 152, $prod_top + $sum_multi_offset);
|
|
|
273 |
$pdf->Cell(25, 8, __("Gesamtpreis", "wpsg"), 1, 0, 'R');
|
|
|
274 |
|
|
|
275 |
$offset = 8;
|
|
|
276 |
$bKopf = true;
|
|
|
277 |
|
|
|
278 |
}
|
|
|
279 |
|
|
|
280 |
$pdf->SetFont('Arial', '', 9);
|
|
|
281 |
$pdf->setXY($prod_left, $prod_top + $offset + $sum_multi_offset);
|
|
|
282 |
|
8069 |
daniel |
283 |
if ($this->get_option('wpsg_mod_rechnungen_anr') == '1') {
|
8068 |
karl |
284 |
|
8069 |
daniel |
285 |
$pdf->Cell(10, 8, $oOrderProduct->getProduct()->getProductNr(), 0, 0, 'C');
|
8068 |
karl |
286 |
|
8069 |
daniel |
287 |
} else {
|
8068 |
karl |
288 |
|
|
|
289 |
$pdf->Cell(10, 8, $pnr.".", 0, 0, 'C');
|
|
|
290 |
|
|
|
291 |
}
|
|
|
292 |
|
8083 |
karl |
293 |
if ($this->get_option('wpsg_rechnungen_pdetailname') == '1') {
|
8082 |
karl |
294 |
|
|
|
295 |
$produkt_text = $this->getProductName($product_id, true);
|
|
|
296 |
|
|
|
297 |
} else {
|
8083 |
karl |
298 |
|
8082 |
karl |
299 |
$produkt_text = $this->getProductName($product_id, false);
|
|
|
300 |
|
|
|
301 |
}
|
8083 |
karl |
302 |
|
8069 |
daniel |
303 |
$produktBeschreibung = trim(strip_tags($oOrderProduct->getProduct()->getShortDescription()));
|
8068 |
karl |
304 |
|
8069 |
daniel |
305 |
if ($this->isOtherLang()) {
|
8068 |
karl |
306 |
|
8069 |
daniel |
307 |
$trans_db = $this->db->fetchRow("SELECT * FROM `".WPSG_TBL_PRODUCTS."` WHERE `lang_parent` = '".wpsg_q($product_id)."' AND `lang_code` = '".wpsg_q($this->getCurrentLanguageCode())."'");
|
8068 |
karl |
308 |
|
8069 |
daniel |
309 |
if (is_array($trans_db) && sizeof($trans_db) > 0) {
|
8068 |
karl |
310 |
|
|
|
311 |
$produkt_text = $trans_db['name'];
|
|
|
312 |
$produktBeschreibung = trim(strip_tags($trans_db['beschreibung']));
|
|
|
313 |
|
|
|
314 |
}
|
|
|
315 |
|
|
|
316 |
}
|
|
|
317 |
|
|
|
318 |
$height = 0; // Höhe der Zeile für den Rahmen
|
|
|
319 |
|
|
|
320 |
$pdf->setXY($prod_left + 10, $prod_top + $offset + $sum_multi_offset);
|
|
|
321 |
|
|
|
322 |
// Produktvariablen
|
8069 |
daniel |
323 |
if ($this->hasMod('wpsg_mod_productvars') && $this->get_option("wpsg_mod_rechnungen_showpv") == "1") {
|
8068 |
karl |
324 |
|
8069 |
daniel |
325 |
$arPV = $this->callMod('wpsg_mod_productvars', 'getAllProductVarValues', array($oOrder->getId(), $oOrderProduct->getProductIndex()));
|
8068 |
karl |
326 |
|
8069 |
daniel |
327 |
if (wpsg_isSizedArray($arPV)) {
|
8068 |
karl |
328 |
|
8069 |
daniel |
329 |
foreach ($arPV as $pv) {
|
8068 |
karl |
330 |
|
8083 |
karl |
331 |
if ($pv['value'] != '') {
|
|
|
332 |
|
|
|
333 |
$produkt_text .= "\r\n".$pv['name'].': '.$pv['value'];
|
|
|
334 |
$height += 5;
|
8068 |
karl |
335 |
|
8083 |
karl |
336 |
}
|
|
|
337 |
|
8068 |
karl |
338 |
}
|
|
|
339 |
|
|
|
340 |
}
|
|
|
341 |
|
|
|
342 |
}
|
|
|
343 |
|
8069 |
daniel |
344 |
if ($this->get_option('wpsg_mod_rechnungen_anr') === '2') {
|
8068 |
karl |
345 |
|
8069 |
daniel |
346 |
$anr = $this->getProductAnr($oOrderProduct->getProductKey());
|
8068 |
karl |
347 |
$produkt_text .= "\r\n".wpsg_translate(__('Artikelnummer: #1#', 'wpsg'), $anr);
|
|
|
348 |
|
|
|
349 |
}
|
8069 |
daniel |
350 |
|
|
|
351 |
if ($bTaxCol) $produkt_text_cell_width = 87;
|
|
|
352 |
else $produkt_text_cell_width = 102;
|
8068 |
karl |
353 |
|
|
|
354 |
$produkt_text_width = $pdf->GetStringWidth($produkt_text);
|
|
|
355 |
|
|
|
356 |
$height += 5 * ceil($produkt_text_width / $produkt_text_cell_width) + 3;
|
|
|
357 |
|
|
|
358 |
$height_y = $pdf->getY();
|
|
|
359 |
$height = 2 + $pdf->wpsg_MultiCell($prod_left + 10, $prod_top + $offset + 1.5 + $sum_multi_offset, 5, $produkt_text, 0, 'L', 0, $produkt_text_cell_width);
|
8069 |
daniel |
360 |
|
|
|
361 |
if ($bTaxCol) {
|
8073 |
daniel |
362 |
|
|
|
363 |
$pdf->setXY($prod_left + 97, $prod_top + $offset + $sum_multi_offset);
|
|
|
364 |
$pdf->Cell(15, 8, (($bNoTax)?'0.00 %':wpsg_ff($arCalculation['tax'][$oOrderProduct->getTaxKey().'_'.$oOrder->getInvoiceCountry()->getId()]['tax_value'], '%')), 0, 0, 'C');
|
8068 |
karl |
365 |
|
|
|
366 |
}
|
|
|
367 |
|
|
|
368 |
$pdf->setXY($prod_left + 112, $prod_top + $offset + $sum_multi_offset);
|
8069 |
daniel |
369 |
$pdf->Cell(15, 8, $oOrderProduct->getAmount(), 0, 0, 'C');
|
8068 |
karl |
370 |
|
8069 |
daniel |
371 |
$preis = $oOrderProduct->getPrice(wpsg_ShopController::getShop()->getFrontendTaxview());
|
8068 |
karl |
372 |
|
|
|
373 |
$pdf->setXY($prod_left + 127, $prod_top + $offset + $sum_multi_offset);
|
|
|
374 |
$pdf->Cell(25, 8, wpsg_ff($preis, $this->get_option('wpsg_currency')), 0, 0, 'R');
|
|
|
375 |
|
|
|
376 |
$pdf->setXY($prod_left + 152, $prod_top + $offset + $sum_multi_offset);
|
8069 |
daniel |
377 |
$pdf->Cell(25, 8, wpsg_ff($oOrderProduct->getPriceSum(wpsg_ShopController::getShop()->getFrontendTaxview()), $this->get_option('wpsg_currency')), 0, 0, 'R');
|
8068 |
karl |
378 |
|
|
|
379 |
/**
|
|
|
380 |
* Produktbeschreibung anzeigen Ja/Nein
|
|
|
381 |
*/
|
|
|
382 |
$pBeschreibungHeight = 0;
|
8154 |
daniel |
383 |
if ($this->get_option("wpsg_rechnungen_pbeschreibung") == "1" && trim(strip_tags($oOrderProduct->getProduct()->getShortDescription())) != '') {
|
8068 |
karl |
384 |
|
|
|
385 |
$produktBeschreibung = nl2br($produktBeschreibung);
|
|
|
386 |
preg_match_all('/\<br \/\>/', $produktBeschreibung, $treffer);
|
|
|
387 |
$produktBeschreibung = strip_tags($produktBeschreibung);
|
|
|
388 |
|
|
|
389 |
$pBeschreibungWidth = $pdf->getStringWidth($produktBeschreibung);
|
|
|
390 |
$pBeschreibungHeight = 5 * (ceil($pBeschreibungWidth / $produkt_text_cell_width) + @sizeof($treffer[0]));
|
|
|
391 |
|
|
|
392 |
$pdf->SetFont('Arial', 'I', 9);
|
|
|
393 |
|
|
|
394 |
$cellY = $pdf->getY();
|
|
|
395 |
$pdf->wpsg_MultiCell($prod_left + 10, $prod_top + $height + $offset - 1 + $sum_multi_offset, 5, $produktBeschreibung, 0, 'L', 0, $produkt_text_cell_width);
|
|
|
396 |
$pBeschreibungHeight = $pdf->getY() - $cellY - $height + 1;
|
|
|
397 |
$pdf->SetFont('Arial', '', 9);
|
|
|
398 |
|
|
|
399 |
}
|
|
|
400 |
|
|
|
401 |
$height += $pBeschreibungHeight;
|
|
|
402 |
|
|
|
403 |
/**
|
|
|
404 |
* Produktattribute ?
|
|
|
405 |
*/
|
8069 |
daniel |
406 |
if ($this->get_option('wpsg_rechnungen_produktattribute') == '1') {
|
8068 |
karl |
407 |
|
8083 |
karl |
408 |
$attributeInfo = $this->callMod('wpsg_mod_produktattribute', 'getProductAttributeByProductId', array($this->getProduktId($oOrderProduct->getId())));
|
8068 |
karl |
409 |
|
8069 |
daniel |
410 |
foreach ($attributeInfo as $pa) {
|
8068 |
karl |
411 |
|
|
|
412 |
$pa_text = $pa['name'].': '.$pa['value'];
|
|
|
413 |
$height += $pdf->wpsg_MultiCell($prod_left + 10, $prod_top + $height + $offset - 0.5 + $sum_multi_offset, 5, $pa_text, 0, 'L', 0, $produkt_text_cell_width);
|
|
|
414 |
|
|
|
415 |
}
|
|
|
416 |
}
|
|
|
417 |
|
|
|
418 |
/**
|
|
|
419 |
* Variante ?
|
|
|
420 |
*/
|
8083 |
karl |
421 |
if (preg_match('/pv_(.*)/', $oOrderProduct->getProductKey())) {
|
8068 |
karl |
422 |
|
8083 |
karl |
423 |
$variInfo = $this->callMod('wpsg_mod_productvariants', 'getVariantenInfoArray', array($oOrderProduct->getProductKey()));
|
8068 |
karl |
424 |
|
|
|
425 |
$height += $pdf->wpsg_MultiCell($prod_left + 10, $prod_top + $height + $offset - 0.5 + $sum_multi_offset, 5, wpsg_translate(__('Variante: #1#', 'wpsg'), $variInfo['key']), 0, 'L', 0, $produkt_text_cell_width);
|
|
|
426 |
|
|
|
427 |
//$height += 5;
|
|
|
428 |
|
|
|
429 |
}
|
|
|
430 |
|
|
|
431 |
/**
|
|
|
432 |
* Lieferschein ?
|
|
|
433 |
*/
|
8069 |
daniel |
434 |
if ($this->hasMod('wpsg_mod_deliverynote')) {
|
8068 |
karl |
435 |
|
8069 |
daniel |
436 |
$arDN_order = $this->callMod('wpsg_mod_deliverynote', 'loadDeliveryNotesFromOrder', array($oOrder->getId()));
|
8068 |
karl |
437 |
|
8069 |
daniel |
438 |
if (sizeof($arDN_order) > 1) {
|
8068 |
karl |
439 |
|
8069 |
daniel |
440 |
$deliveryTimeProduct = $this->callMod('wpsg_mod_deliverynote', 'getProductDeliveryTime', array($oOrder->getId(), $oOrderProduct->getProductIndex()));
|
8068 |
karl |
441 |
|
8069 |
daniel |
442 |
if ($deliveryTimeProduct !== false) {
|
8068 |
karl |
443 |
|
|
|
444 |
$height += $pdf->wpsg_MultiCell($prod_left + 10, $prod_top + $height + $offset - 0.5 + $sum_multi_offset, 5, wpsg_translate(__('Lieferdatum: #1#', 'wpsg'), date('d.m.Y', $deliveryTimeProduct)), 0, 'L', 0, $produkt_text_cell_width);
|
|
|
445 |
|
|
|
446 |
}
|
|
|
447 |
|
|
|
448 |
}
|
|
|
449 |
|
|
|
450 |
}
|
|
|
451 |
|
|
|
452 |
// Jetzt die Rahmen zeichnen
|
|
|
453 |
$pdf->Rect($prod_left, $prod_top + $offset + $sum_multi_offset, 10, $height);
|
|
|
454 |
|
8069 |
daniel |
455 |
$pdf->Rect($prod_left + 10, $prod_top + $offset + $sum_multi_offset, (($bTaxCol == '1')?87:102), $height);
|
8068 |
karl |
456 |
|
8069 |
daniel |
457 |
if ($bTaxCol) {
|
8068 |
karl |
458 |
|
|
|
459 |
$pdf->Rect($prod_left + 97, $prod_top + $offset + $sum_multi_offset, 15, $height);
|
|
|
460 |
|
|
|
461 |
}
|
|
|
462 |
|
|
|
463 |
$pdf->Rect($prod_left + 112, $prod_top + $offset + $sum_multi_offset, 15, $height);
|
|
|
464 |
$pdf->Rect($prod_left + 127, $prod_top + $offset + $sum_multi_offset, 25, $height);
|
|
|
465 |
$pdf->Rect($prod_left + 152, $prod_top + $offset + $sum_multi_offset, 25, $height);
|
|
|
466 |
|
|
|
467 |
$offset += $height;
|
|
|
468 |
|
|
|
469 |
$pnr ++;
|
|
|
470 |
$count ++;
|
|
|
471 |
|
|
|
472 |
$summe += $p['price'] * $p['menge'];
|
|
|
473 |
|
8069 |
daniel |
474 |
if ($pdf->getY() > 220 || ($count >= $prod_break && sizeof($oOrder->getOrderProducts()) > ($pnr - 1))) {
|
8068 |
karl |
475 |
|
|
|
476 |
AddRechnungPage($this, $pdf);
|
|
|
477 |
$bKopf = false; $count = 0; $offset = 0;
|
|
|
478 |
|
|
|
479 |
}
|
|
|
480 |
|
|
|
481 |
} // produkte
|
8069 |
daniel |
482 |
|
8068 |
karl |
483 |
// Gutschein
|
8069 |
daniel |
484 |
if (wpsg_isSizedArray($arCalculation['voucher'])) {
|
8068 |
karl |
485 |
|
8069 |
daniel |
486 |
foreach ($arCalculation['voucher'] as $v) {
|
8068 |
karl |
487 |
|
|
|
488 |
$pdf->SetFont('Arial', '', 9);
|
|
|
489 |
$pdf->setXY($prod_left, $prod_top + $offset + $sum_multi_offset);
|
|
|
490 |
$pdf->Cell(10, 8, $pnr.'.', 1, 0, 'C'); $pnr ++;
|
|
|
491 |
|
|
|
492 |
$pdf->setXY($prod_left + 10, $prod_top + $offset + $sum_multi_offset);
|
8069 |
daniel |
493 |
$pdf->Cell( (($bTaxCol)?87:102), 8, wpsg_translate(__('Gutschein (#1#)', 'wpsg'), $v['code']), 1, 0, 'L');
|
8068 |
karl |
494 |
|
8069 |
daniel |
495 |
if ($bTaxCol) {
|
8068 |
karl |
496 |
|
|
|
497 |
$pdf->setXY($prod_left + 97, $prod_top + $offset + $sum_multi_offset);
|
8069 |
daniel |
498 |
$pdf->Cell(15, 8, __('anteilig', 'wpsg'), 1, 0, 'C');
|
8068 |
karl |
499 |
|
|
|
500 |
}
|
|
|
501 |
|
|
|
502 |
$pdf->setXY($prod_left + 112, $prod_top + $offset + $sum_multi_offset);
|
|
|
503 |
$pdf->Cell(15, 8, '1', 1, 0, 'C');
|
|
|
504 |
|
|
|
505 |
$gs_value_einzel = wpsg_ff($v[$taxdisplay.'_single'], $this->get_option('wpsg_currency'));
|
|
|
506 |
$gs_value_gesamt = wpsg_ff($v[$taxdisplay], $this->get_option('wpsg_currency'));
|
|
|
507 |
|
|
|
508 |
$pdf->setXY($prod_left + 127, $prod_top + $offset + $sum_multi_offset);
|
|
|
509 |
$pdf->Cell(25, 8, $gs_value_einzel, 1, 0, 'R');
|
|
|
510 |
|
|
|
511 |
$pdf->setXY($prod_left + 152, $prod_top + $offset + $sum_multi_offset);
|
|
|
512 |
$pdf->Cell(25, 8, $gs_value_gesamt, 1, 0, 'R');
|
|
|
513 |
|
|
|
514 |
$offset += 8;
|
|
|
515 |
|
|
|
516 |
}
|
|
|
517 |
|
|
|
518 |
}
|
|
|
519 |
|
|
|
520 |
// Versandkosten
|
8069 |
daniel |
521 |
$cost_shipping = ((wpsg_ShopController::getShop()->getFrontendTaxview() === WPSG_BRUTTO)?$arCalculation['sum']['shipping_brutto']:$arCalculation['sum']['shipping_netto']);
|
|
|
522 |
|
|
|
523 |
if ($arCalculation['sum']['shipping_brutto'] > 0) {
|
8068 |
karl |
524 |
|
|
|
525 |
$pdf->SetFont('Arial', '', 9);
|
|
|
526 |
$pdf->setXY($prod_left, $prod_top + $offset + $sum_multi_offset);
|
|
|
527 |
$pdf->Cell(10, 8, $pnr.'.', 1, 0, 'C'); $pnr ++;
|
|
|
528 |
|
|
|
529 |
$pdf->setXY($prod_left + 10, $prod_top + $offset + $sum_multi_offset);
|
8069 |
daniel |
530 |
$pdf->Cell( (($bTaxCol)?87:102), 8, wpsg_translate(__('Versandkosten "#1#"', 'wpsg'), $oOrder->getShippingLabel()), 1, 0, 'L');
|
8068 |
karl |
531 |
|
8069 |
daniel |
532 |
if ($bTaxCol) {
|
|
|
533 |
|
|
|
534 |
if ($bNoTax) {
|
8068 |
karl |
535 |
|
8088 |
karl |
536 |
$mwst = wpsg_ff(0.00, '%');
|
8068 |
karl |
537 |
|
8069 |
daniel |
538 |
} else {
|
8068 |
karl |
539 |
|
8069 |
daniel |
540 |
if ($arCalculation['shipping'][0]['tax_key'] === '0') {
|
8068 |
karl |
541 |
|
|
|
542 |
$mwst = _('anteilig');
|
|
|
543 |
|
|
|
544 |
} else {
|
|
|
545 |
|
8069 |
daniel |
546 |
$mwst = wpsg_ff($arCalculation['shipping'][0]['tax'], '%');
|
|
|
547 |
$mwst = wpsg_ff($arCalculation['tax'][$arCalculation['shipping'][0]['tax_key']]['tax_value'], '%');
|
8068 |
karl |
548 |
|
|
|
549 |
}
|
|
|
550 |
|
|
|
551 |
}
|
8069 |
daniel |
552 |
|
8068 |
karl |
553 |
$pdf->setXY($prod_left + 97, $prod_top + $offset + $sum_multi_offset);
|
|
|
554 |
$pdf->Cell(15, 8, $mwst, 1, 0, 'C');
|
|
|
555 |
|
|
|
556 |
}
|
|
|
557 |
|
|
|
558 |
$pdf->setXY($prod_left + 112, $prod_top + $offset + $sum_multi_offset);
|
|
|
559 |
$pdf->Cell(15, 8, '1', 1, 0, 'C');
|
|
|
560 |
|
|
|
561 |
$pdf->setXY($prod_left + 127, $prod_top + $offset + $sum_multi_offset);
|
8069 |
daniel |
562 |
$pdf->Cell(25, 8, wpsg_ff($arCalculation['sum']['shipping_brutto'], $this->get_option('wpsg_currency')), 1, 0, 'R');
|
8068 |
karl |
563 |
|
|
|
564 |
$pdf->setXY($prod_left + 152, $prod_top + $offset + $sum_multi_offset);
|
8069 |
daniel |
565 |
$pdf->Cell(25, 8, wpsg_ff($arCalculation['sum']['shipping_brutto'], $this->get_option('wpsg_currency')), 1, 0, 'R');
|
8068 |
karl |
566 |
|
|
|
567 |
$offset += 8;
|
|
|
568 |
|
|
|
569 |
}
|
|
|
570 |
|
|
|
571 |
// Zahlungskosten
|
8069 |
daniel |
572 |
$cost_payment = ((wpsg_ShopController::getShop()->getFrontendTaxview() === WPSG_BRUTTO)?$arCalculation['sum']['payment_brutto']:$arCalculation['sum']['payment_netto']);
|
|
|
573 |
|
|
|
574 |
if ($cost_payment > 0) {
|
8068 |
karl |
575 |
|
|
|
576 |
$pdf->SetFont('Arial', '', 9);
|
|
|
577 |
$pdf->setXY($prod_left, $prod_top + $offset + $sum_multi_offset);
|
|
|
578 |
$pdf->Cell(10, 8, $pnr.'.', 1, 0, 'C'); $pnr ++;
|
|
|
579 |
|
|
|
580 |
$pdf->setXY($prod_left + 10, $prod_top + $offset + $sum_multi_offset);
|
8069 |
daniel |
581 |
$pdf->Cell( (($bTaxCol)?87:102), 8, $oOrder->getPaymentLabel(), 1, 0, 'L');
|
8068 |
karl |
582 |
|
8069 |
daniel |
583 |
if ($bTaxCol) {
|
8068 |
karl |
584 |
|
8069 |
daniel |
585 |
if ($bNoTax) {
|
|
|
586 |
|
8088 |
karl |
587 |
$mwst = wpsg_ff(0.00, '%');
|
8069 |
daniel |
588 |
|
|
|
589 |
} else {
|
8068 |
karl |
590 |
|
8069 |
daniel |
591 |
if ($arCalculation['payment'][0]['tax_key'] === '0') {
|
8068 |
karl |
592 |
|
|
|
593 |
$mwst = _('anteilig');
|
|
|
594 |
|
|
|
595 |
} else {
|
|
|
596 |
|
8069 |
daniel |
597 |
$mwst = wpsg_ff($arCalculation['payment'][0]['tax'], '%');
|
|
|
598 |
$mwst = wpsg_ff($arCalculation['tax'][$arCalculation['payment'][0]['tax_key']]['tax_value'], '%');
|
8068 |
karl |
599 |
|
|
|
600 |
}
|
|
|
601 |
|
|
|
602 |
}
|
|
|
603 |
|
|
|
604 |
$pdf->setXY($prod_left + 97, $prod_top + $offset + $sum_multi_offset);
|
|
|
605 |
$pdf->Cell(15, 8, $mwst, 1, 0, 'C');
|
|
|
606 |
|
|
|
607 |
}
|
|
|
608 |
|
|
|
609 |
$pdf->setXY($prod_left + 112, $prod_top + $offset + $sum_multi_offset);
|
|
|
610 |
$pdf->Cell(15, 8, '1', 1, 0, 'C');
|
|
|
611 |
|
|
|
612 |
$pdf->setXY($prod_left + 127, $prod_top + $offset + $sum_multi_offset);
|
8069 |
daniel |
613 |
$pdf->Cell(25, 8, wpsg_ff($cost_payment, $this->get_option('wpsg_currency')), 1, 0, 'R');
|
8068 |
karl |
614 |
|
|
|
615 |
$pdf->setXY($prod_left + 152, $prod_top + $offset + $sum_multi_offset);
|
8069 |
daniel |
616 |
$pdf->Cell(25, 8, wpsg_ff($cost_payment, $this->get_option('wpsg_currency')), 1, 0, 'R');
|
8068 |
karl |
617 |
|
|
|
618 |
$offset += 8;
|
|
|
619 |
|
|
|
620 |
}
|
|
|
621 |
|
8069 |
daniel |
622 |
// Rabatt
|
|
|
623 |
if ($arCalculation['sum']['discount_brutto'] < 0) {
|
|
|
624 |
|
|
|
625 |
$pdf->SetFont('Arial', '', 9);
|
|
|
626 |
$pdf->setXY($prod_left, $prod_top + $offset + $sum_multi_offset);
|
|
|
627 |
$pdf->Cell(10, 8, $pnr.'.', 1, 0, 'C'); $pnr ++;
|
|
|
628 |
|
|
|
629 |
$pdf->setXY($prod_left + 10, $prod_top + $offset + $sum_multi_offset);
|
|
|
630 |
$pdf->Cell( (($bTaxCol)?87:102), 8, _('Rabatt'), 1, 0, 'L');
|
|
|
631 |
|
|
|
632 |
$pdf->setXY($prod_left + 97, $prod_top + $offset + $sum_multi_offset);
|
8072 |
daniel |
633 |
$pdf->Cell(15, 8, _('anteilig'), 1, 0, 'C');
|
8069 |
daniel |
634 |
|
|
|
635 |
$pdf->setXY($prod_left + 112, $prod_top + $offset + $sum_multi_offset);
|
|
|
636 |
$pdf->Cell(15, 8, '1', 1, 0, 'C');
|
|
|
637 |
|
|
|
638 |
$pdf->setXY($prod_left + 127, $prod_top + $offset + $sum_multi_offset);
|
|
|
639 |
$pdf->Cell(25, 8, wpsg_ff($arCalculation['sum']['discount_brutto'], $this->get_option('wpsg_currency')), 1, 0, 'R');
|
|
|
640 |
|
|
|
641 |
$pdf->setXY($prod_left + 152, $prod_top + $offset + $sum_multi_offset);
|
|
|
642 |
$pdf->Cell(25, 8, wpsg_ff($arCalculation['sum']['discount_brutto'], $this->get_option('wpsg_currency')), 1, 0, 'R');
|
|
|
643 |
|
|
|
644 |
$offset += 8;
|
|
|
645 |
|
|
|
646 |
}
|
|
|
647 |
|
8072 |
daniel |
648 |
// Wertgutschein
|
|
|
649 |
foreach ($arCalculation['coupon'] as $c) {
|
|
|
650 |
|
|
|
651 |
$pdf->SetFont('Arial', '', 9);
|
|
|
652 |
$pdf->setXY($prod_left, $prod_top + $offset + $sum_multi_offset);
|
|
|
653 |
$pdf->Cell(10, 8, $pnr.'.', 1, 0, 'C'); $pnr ++;
|
|
|
654 |
|
|
|
655 |
$pdf->setXY($prod_left + 10, $prod_top + $offset + $sum_multi_offset);
|
|
|
656 |
$pdf->Cell( (($bTaxCol)?87:102), 8, _('Wertgutschein').' ('.$c['code'].')', 1, 0, 'L');
|
|
|
657 |
|
|
|
658 |
$pdf->setXY($prod_left + 97, $prod_top + $offset + $sum_multi_offset);
|
|
|
659 |
$pdf->Cell(15, 8, _('anteilig'), 1, 0, 'C');
|
|
|
660 |
|
|
|
661 |
$pdf->setXY($prod_left + 112, $prod_top + $offset + $sum_multi_offset);
|
|
|
662 |
$pdf->Cell(15, 8, $c['amount'], 1, 0, 'C');
|
|
|
663 |
|
|
|
664 |
$pdf->setXY($prod_left + 127, $prod_top + $offset + $sum_multi_offset);
|
|
|
665 |
$pdf->Cell(25, 8, wpsg_ff($c[$taxdisplay.'_single'], $this->get_option('wpsg_currency')), 1, 0, 'R');
|
|
|
666 |
|
|
|
667 |
$pdf->setXY($prod_left + 152, $prod_top + $offset + $sum_multi_offset);
|
|
|
668 |
$pdf->Cell(25, 8, wpsg_ff($c[$taxdisplay], $this->get_option('wpsg_currency')), 1, 0, 'R');
|
|
|
669 |
|
|
|
670 |
$offset += 8;
|
|
|
671 |
|
|
|
672 |
}
|
|
|
673 |
|
8068 |
karl |
674 |
// Gebühr
|
8069 |
daniel |
675 |
if (wpsg_tf(wpsg_getStr($this->view['storno_fee'])) > 0) {
|
8068 |
karl |
676 |
|
|
|
677 |
$pdf->SetFont('Arial', '', 9);
|
|
|
678 |
$pdf->setXY($prod_left, $prod_top + $offset + $sum_multi_offset);
|
|
|
679 |
$pdf->Cell(10, 8, $pnr.'.', 1, 0, 'C'); $pnr ++;
|
|
|
680 |
|
|
|
681 |
$label = __('Bearbeitungsgebühr', 'wpsg');
|
|
|
682 |
|
|
|
683 |
if (strpos($this->view['storno_fee'], '%') !== false) $label .= ' ('.wpsg_ff($this->view['storno_fee'], '%').')';
|
|
|
684 |
|
|
|
685 |
$pdf->setXY($prod_left + 10, $prod_top + $offset + $sum_multi_offset);
|
8069 |
daniel |
686 |
$pdf->Cell( (($bTaxCol)?87:102), 8, $label, 1, 0, 'L');
|
8068 |
karl |
687 |
|
8069 |
daniel |
688 |
if ($bTaxCol) {
|
8068 |
karl |
689 |
|
8069 |
daniel |
690 |
if ($bNoTax) {
|
|
|
691 |
|
8088 |
karl |
692 |
$mwst = wpsg_ff(0.00, '%');
|
8069 |
daniel |
693 |
|
|
|
694 |
} else {
|
8068 |
karl |
695 |
|
|
|
696 |
$mwst = wpsg_ff($this->view['storno_fee_tax_value'], '%');
|
|
|
697 |
|
|
|
698 |
}
|
|
|
699 |
|
|
|
700 |
$pdf->setXY($prod_left + 97, $prod_top + $offset + $sum_multi_offset);
|
|
|
701 |
$pdf->Cell(15, 8, $mwst, 1, 0, 'C');
|
|
|
702 |
|
|
|
703 |
}
|
|
|
704 |
|
|
|
705 |
$pdf->setXY($prod_left + 112, $prod_top + $offset + $sum_multi_offset);
|
|
|
706 |
$pdf->Cell(15, 8, '1', 1, 0, 'C');
|
|
|
707 |
|
|
|
708 |
$pdf->setXY($prod_left + 127, $prod_top + $offset + $sum_multi_offset);
|
|
|
709 |
$pdf->Cell(25, 8, '-'.wpsg_ff($this->view['storno_fee_value'], $this->get_option('wpsg_currency')), 1, 0, 'R');
|
|
|
710 |
|
|
|
711 |
$pdf->setXY($prod_left + 152, $prod_top + $offset + $sum_multi_offset);
|
|
|
712 |
$pdf->Cell(25, 8, '-'.wpsg_ff($this->view['storno_fee_value'], $this->get_option('wpsg_currency')), 1, 0, 'R');
|
|
|
713 |
|
|
|
714 |
$offset += 8;
|
|
|
715 |
|
|
|
716 |
}
|
8072 |
daniel |
717 |
|
8068 |
karl |
718 |
// Bestellbetrag einer einzelnen Bestellung
|
8069 |
daniel |
719 |
if ($bNoTax) {
|
|
|
720 |
|
8068 |
karl |
721 |
$pdf->Text($prod_left + 115, $prod_top + $offset + $sum_multi_offset + 6, __("Bestellbetrag (NETTO):", "wpsg"));
|
|
|
722 |
$pdf->setXY($prod_left + 140, $prod_top + $offset + $sum_multi_offset + 1);
|
8072 |
daniel |
723 |
$pdf->Cell(37, 8, wpsg_ff($arCalculation['sum']['topay_netto'], $this->get_option('wpsg_currency')), 0, 0, 'R');
|
8069 |
daniel |
724 |
|
|
|
725 |
} else {
|
|
|
726 |
|
8068 |
karl |
727 |
$pdf->Text($prod_left + 115, $prod_top + $offset + $sum_multi_offset + 6, __("Bestellbetrag (BRUTTO):", "wpsg"));
|
|
|
728 |
$pdf->setXY($prod_left + 140, $prod_top + $offset + $sum_multi_offset + 1);
|
8072 |
daniel |
729 |
$pdf->Cell(37, 8, wpsg_ff($arCalculation['sum']['topay_brutto'], $this->get_option('wpsg_currency')), 0, 0, 'R');
|
8069 |
daniel |
730 |
|
8068 |
karl |
731 |
}
|
|
|
732 |
|
|
|
733 |
$sum_multi_offset += ($offset + 30);
|
8069 |
daniel |
734 |
|
8068 |
karl |
735 |
} // FOREACH ORDER END
|
8069 |
daniel |
736 |
|
|
|
737 |
$arCalculation = $this->view['arCalculationSum'];
|
8068 |
karl |
738 |
|
8069 |
daniel |
739 |
$offset = $sum_multi_offset - 30;
|
|
|
740 |
|
8068 |
karl |
741 |
$pdf->SetFont('Arial', '', 9);
|
|
|
742 |
|
8069 |
daniel |
743 |
if ($this->view['kunde']['ustidnr'] != "") {
|
|
|
744 |
|
|
|
745 |
$offset += 13;
|
|
|
746 |
|
8068 |
karl |
747 |
$pdf->Text($prod_left, $prod_top + $offset, __("Ihre Umsatzsteuer-Identifikationsnummer:", "wpsg"));
|
|
|
748 |
$pdf->setXY($prod_left + 140, $prod_top + $offset - 5);
|
|
|
749 |
$pdf->Cell(37, 8, $this->view['kunde']['ustidnr'], 0, 0, 'R');
|
8069 |
daniel |
750 |
|
8068 |
karl |
751 |
}
|
|
|
752 |
|
|
|
753 |
$offset += 10;
|
|
|
754 |
|
8069 |
daniel |
755 |
$offset = $checkPageBreak($this, $offset, 6);
|
|
|
756 |
|
|
|
757 |
if ($this->get_option('wpsg_kleinunternehmer')) {
|
|
|
758 |
|
8068 |
karl |
759 |
$pdf->Text($prod_left, $prod_top + $offset + 10, __("Es ergibt sich folgender Gesamtbetrag", "wpsg").':');
|
|
|
760 |
$pdf->Text($prod_left + 80, $prod_top + $offset, __("Summe", "wpsg"));
|
|
|
761 |
$pdf->setXY($prod_left + 140, $prod_top + $offset - 5);
|
8071 |
daniel |
762 |
$pdf->Cell(37, 8, wpsg_ff($arCalculation['sum']['brutto'], $this->get_option('wpsg_currency')), 0, 0, 'R');
|
8069 |
daniel |
763 |
|
8068 |
karl |
764 |
$offset += 5;
|
|
|
765 |
|
8069 |
daniel |
766 |
} else {
|
8068 |
karl |
767 |
|
8069 |
daniel |
768 |
if ($bNoTax) {
|
8068 |
karl |
769 |
|
|
|
770 |
$pdf->Text($prod_left, $prod_top + $offset + 10, __("Es ergibt sich folgender Gesamtbetrag", "wpsg").':');
|
8083 |
karl |
771 |
$pdf->Text($prod_left + 80, $prod_top + $offset + 10, __("BRUTTOBETRAG GESAMT", "wpsg"));
|
8068 |
karl |
772 |
$pdf->setXY($prod_left + 140, $prod_top + $offset + 10 - 5);
|
8069 |
daniel |
773 |
$pdf->Cell(37, 8, wpsg_ff($arCalculation['sum']['brutto'], $this->get_option('wpsg_currency')), 0, 0, 'R');
|
8068 |
karl |
774 |
$offset += 5;
|
|
|
775 |
|
8083 |
karl |
776 |
$pdf->Text($prod_left + 80, $prod_top + $offset + 10, __("MwSt. GESAMT", "wpsg"));
|
8068 |
karl |
777 |
$pdf->setXY($prod_left + 140, $prod_top + $offset + 10 - 5);
|
|
|
778 |
$pdf->Cell(37, 8, wpsg_ff(0, $this->get_option('wpsg_currency')), 0, 0, 'R');
|
|
|
779 |
|
8069 |
daniel |
780 |
} else {
|
8068 |
karl |
781 |
|
|
|
782 |
$pdf->Text($prod_left, $prod_top + $offset + 10, __("Der Gesamtbetrag setzt sich wie folgt zusammen", "wpsg"));
|
|
|
783 |
|
|
|
784 |
$pdf->Text($prod_left + 80, $prod_top + $offset + 10, __("NETTOBETRAG GESAMT", "wpsg"));
|
|
|
785 |
$pdf->setXY($prod_left + 140, $prod_top + $offset + 10 - 5);
|
8069 |
daniel |
786 |
$pdf->Cell(37, 8, wpsg_ff($arCalculation['sum']['netto'], $this->get_option('wpsg_currency')), 0, 0, 'R');
|
8068 |
karl |
787 |
|
8069 |
daniel |
788 |
if (sizeof($arCalculation['tax']) > 1) {
|
8068 |
karl |
789 |
|
|
|
790 |
$offset += 5;
|
|
|
791 |
$pdf->Text($prod_left + 80, $prod_top + $offset + 10, __("MwSt. GESAMT", "wpsg"));
|
|
|
792 |
$pdf->setXY($prod_left + 140, $prod_top + $offset + 10 - 5);
|
8069 |
daniel |
793 |
$pdf->Cell(37, 8, wpsg_ff($arCalculation['sum']['tax'], $this->get_option('wpsg_currency')), 0, 0, 'R');
|
8068 |
karl |
794 |
|
|
|
795 |
}
|
|
|
796 |
|
|
|
797 |
}
|
|
|
798 |
|
|
|
799 |
}
|
|
|
800 |
|
|
|
801 |
// Wertgutschein
|
|
|
802 |
if ($arCalculation['sum']['topay_brutto'] !== $arCalculation['sum']['brutto']) {
|
|
|
803 |
|
|
|
804 |
$offset += 5;
|
|
|
805 |
$pdf->Text($prod_left + 80, $prod_top + $offset + 10, __("Bruttobetrag GESAMT", "wpsg"));
|
|
|
806 |
$pdf->setXY($prod_left + 140, $prod_top + $offset + 10 - 5);
|
|
|
807 |
|
|
|
808 |
$pdf->setFont('Arial', '', '9');
|
8069 |
daniel |
809 |
$pdf->Cell(37, 8, wpsg_ff($arCalculation['sum']['brutto'], $this->get_option('wpsg_currency')), 0, 0, 'R');
|
8068 |
karl |
810 |
$pdf->setFont('Arial', '', '9');
|
|
|
811 |
|
8071 |
daniel |
812 |
foreach ($this->view['multi_data']['order_data'] as $order_data) {
|
|
|
813 |
|
|
|
814 |
$arCalculationOrder = $order_data['arCalculation'];
|
8068 |
karl |
815 |
|
8071 |
daniel |
816 |
foreach ($arCalculationOrder['coupon'] as $c) {
|
8068 |
karl |
817 |
|
|
|
818 |
$offset += 5;
|
|
|
819 |
$pdf->Text($prod_left + 80, $prod_top + $offset + 10, __('Wertgutschein', 'wpsg').' '.((wpsg_isSizedString($c['code']))?'('.$c['code'].')':''));
|
|
|
820 |
$pdf->setXY($prod_left + 140, $prod_top + $offset + 10 - 5);
|
|
|
821 |
|
|
|
822 |
$pdf->setFont('Arial', '', '9');
|
|
|
823 |
$pdf->Cell(37, 8, wpsg_ff($c[$taxdisplay], $this->get_option('wpsg_currency')), 0, 0, 'R');
|
|
|
824 |
$pdf->setFont('Arial', '', '9');
|
|
|
825 |
|
|
|
826 |
}
|
|
|
827 |
|
|
|
828 |
}
|
|
|
829 |
|
|
|
830 |
$offset += 5;
|
|
|
831 |
$pdf->setFont('Arial', 'B', '9');
|
|
|
832 |
$pdf->Text($prod_left + 80, $prod_top + $offset + 10, __("ZU ZAHLEN", "wpsg"));
|
|
|
833 |
$pdf->setXY($prod_left + 140, $prod_top + $offset + 10 - 5);
|
|
|
834 |
|
|
|
835 |
/* Endbetrag wird fett ausgegeben */
|
|
|
836 |
$pdf->setFont('Arial', 'B', '9');
|
8069 |
daniel |
837 |
$pdf->Cell(37, 8, wpsg_ff($arCalculation['sum']['topay_brutto'], $this->get_option('wpsg_currency')), 0, 0, 'R');
|
8068 |
karl |
838 |
$pdf->setFont('Arial', '', '9');
|
|
|
839 |
|
|
|
840 |
} else {
|
|
|
841 |
|
|
|
842 |
$offset += 5;
|
|
|
843 |
$pdf->Text($prod_left + 80, $prod_top + $offset + 10, __("GESAMTSUMME", "wpsg"));
|
|
|
844 |
$pdf->setXY($prod_left + 140, $prod_top + $offset + 10 - 5);
|
|
|
845 |
/* Endbetrag wird fett ausgegeben */
|
|
|
846 |
$pdf->setFont('Arial', 'B', '9');
|
8069 |
daniel |
847 |
$pdf->Cell(37, 8, wpsg_ff($arCalculation['sum']['topay_brutto'], $this->get_option('wpsg_currency')), 0, 0, 'R');
|
8068 |
karl |
848 |
$pdf->setFont('Arial', '', '9');
|
|
|
849 |
|
|
|
850 |
}
|
|
|
851 |
|
|
|
852 |
if ($this->get_option('wpsg_kleinunternehmer') == '1')
|
|
|
853 |
{
|
|
|
854 |
|
|
|
855 |
$pdf->wpsg_MultiCell($prod_left - 1, $prod_top + $offset + 15, 5, $this->get_option('wpsg_kleinunternehmer_text'));
|
|
|
856 |
$offset += 15;
|
|
|
857 |
|
|
|
858 |
}
|
|
|
859 |
|
|
|
860 |
if ($this->hasMod('wpsg_mod_deliverynote'))
|
|
|
861 |
{
|
|
|
862 |
|
|
|
863 |
$arDN_order = $this->callMod('wpsg_mod_deliverynote', 'loadDeliveryNotesFromOrder', array($data['id']));
|
|
|
864 |
$delivery_date = $this->callMod('wpsg_mod_deliverynote', 'getDeliveryTime', array($data['id']));
|
|
|
865 |
|
|
|
866 |
// Wenn es ein Gesamtlieferdatum gibt und nur einen Lieferschein, dann unter der Bestellung anzeigen
|
|
|
867 |
if ($delivery_date !== false && sizeof($arDN_order) == 1)
|
|
|
868 |
{
|
|
|
869 |
|
|
|
870 |
$offset += 10;
|
|
|
871 |
|
|
|
872 |
$pdf->wpsg_MultiCell($prod_left, $prod_top + $offset + 10, 5, wpsg_translate(__('Lieferung: #1#', 'wpsg'), date('d.m.Y', $delivery_date)));
|
|
|
873 |
|
|
|
874 |
$offset += 5;
|
|
|
875 |
|
|
|
876 |
}
|
|
|
877 |
|
|
|
878 |
}
|
|
|
879 |
|
|
|
880 |
$offset += 5;
|
|
|
881 |
|
|
|
882 |
if ($this->view['fussText'] != "")
|
|
|
883 |
{
|
|
|
884 |
|
|
|
885 |
//$pdf->wpsg_MultiCell($prod_left - 1, $prod_top + $offset, 5, utf8_encode($this->view['fussText']));
|
|
|
886 |
$pdf->wpsg_MultiCell($prod_left - 1, $prod_top + $offset + 10, 5, $this->view['fussText']);
|
|
|
887 |
$pdf->SetFont('Arial', 'B', 9);
|
|
|
888 |
$offset += 10;
|
|
|
889 |
|
|
|
890 |
}
|
|
|
891 |
|
|
|
892 |
$shipping_adress = false;
|
|
|
893 |
|
|
|
894 |
$offset += 5;
|
|
|
895 |
|
|
|
896 |
$filename = $this->view['filename'].".pdf";
|
8069 |
daniel |
897 |
|
|
|
898 |
if ($this->view['preview']) {
|
8068 |
karl |
899 |
|
8069 |
daniel |
900 |
//$pdf->Output($this->callMod('wpsg_mod_rechnungen', 'getFilePath', array('multi')).$filename, 'F');
|
|
|
901 |
$pdf->Output();
|
8068 |
karl |
902 |
|
8069 |
daniel |
903 |
exit;
|
8068 |
karl |
904 |
|
|
|
905 |
} else {
|
|
|
906 |
|
8071 |
daniel |
907 |
$pdf->Output($this->view['file_path'], 'F');
|
8068 |
karl |
908 |
|
|
|
909 |
}
|
8069 |
daniel |
910 |
|