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