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