5972 |
daniel |
1 |
<?php
|
|
|
2 |
|
|
|
3 |
/**
|
|
|
4 |
* Template für die PDF Rechnungskorrektur
|
|
|
5 |
*/
|
7352 |
daniel |
6 |
|
|
|
7 |
require_once WPSG_PATH_LIB.'FPDF_1.81/fpdf.php';
|
|
|
8 |
require_once WPSG_PATH_LIB.'FPDI_2.2.0/autoload.php';
|
5972 |
daniel |
9 |
require_once WPSG_PATH_LIB.'wpsg_fpdf.class.php';
|
|
|
10 |
|
|
|
11 |
global $absender_left, $absender_top, $adress_left, $adress_top, $rdata_left, $rdata_top;
|
|
|
12 |
|
|
|
13 |
// Positionierung der Absenderadresszeile
|
|
|
14 |
$absender_left = 25;
|
|
|
15 |
$absender_top = 50;
|
|
|
16 |
|
|
|
17 |
// Positionierung der Zieladress
|
|
|
18 |
$adress_left = 25;
|
|
|
19 |
$adress_top = 55;
|
|
|
20 |
|
|
|
21 |
// Positionierung des Rechnungskopfes
|
|
|
22 |
$rdata_left = 25;
|
|
|
23 |
$rdata_top = 90;
|
|
|
24 |
|
|
|
25 |
// Positionierung der Produktdaten
|
|
|
26 |
$prod_left = 25;
|
|
|
27 |
$prod_top = 105;
|
|
|
28 |
|
|
|
29 |
// Anzahl an Produkten pro Seite
|
|
|
30 |
$prod_break = $this->get_option('wpsg_rechnungen_pdfperpage');
|
|
|
31 |
|
7490 |
daniel |
32 |
$arCalculation = $this->view['basket']['arCalculation'];
|
|
|
33 |
|
|
|
34 |
if ($this->getFrontendTaxView() === WPSG_NETTO) $taxdisplay = 'netto';
|
|
|
35 |
else $taxdisplay = 'brutto';
|
|
|
36 |
|
5972 |
daniel |
37 |
// Damit die Steuer bei der Kleinunternehmerregelung nicht angezeigt wird leer ich den Array sicherheitshalber
|
|
|
38 |
if ($this->get_option('wpsg_kleinunternehmer') == '1')
|
|
|
39 |
{
|
|
|
40 |
|
|
|
41 |
unset($this->view['basket']['mwst']);
|
|
|
42 |
|
|
|
43 |
}
|
|
|
44 |
|
|
|
45 |
if (!function_exists('AddRechnungPage'))
|
|
|
46 |
{
|
|
|
47 |
|
|
|
48 |
function AddRechnungPage($shop, $pdf)
|
|
|
49 |
{
|
|
|
50 |
|
|
|
51 |
global $absender_left, $absender_top, $adress_left, $adress_top, $rdata_left, $rdata_top;
|
|
|
52 |
|
|
|
53 |
$pdf->AddPage();
|
|
|
54 |
|
|
|
55 |
if (file_exists($shop->callMod('wpsg_mod_rechnungen', 'getFilePath', array(''))."wpsg_rechnungen_bp.pdf"))
|
|
|
56 |
{
|
|
|
57 |
|
|
|
58 |
$pagecount = $pdf->setSourceFile($shop->callMod('wpsg_mod_rechnungen', 'getFilePath', array(''))."wpsg_rechnungen_bp.pdf");
|
|
|
59 |
$tplidx = $pdf->importPage(1, '/MediaBox');
|
|
|
60 |
$pdf->useTemplate($tplidx, 0, 0, 210);
|
|
|
61 |
|
|
|
62 |
}
|
|
|
63 |
if (file_exists($shop->callMod('wpsg_mod_rechnungen', 'getFilePath', array(''))."wpsg_rechnungen_bp.jpg"))
|
|
|
64 |
{
|
|
|
65 |
$pdf->image($shop->callMod('wpsg_mod_rechnungen', 'getFilePath', array(''))."wpsg_rechnungen_bp.jpg", 0, 0, 210, 297, 'jpg');
|
|
|
66 |
}
|
|
|
67 |
|
|
|
68 |
|
|
|
69 |
if (file_exists($shop->callMod('wpsg_mod_rechnungen', 'getFilePath', array(''))."wpsg_rechnungen_logo.jpg"))
|
|
|
70 |
{
|
|
|
71 |
|
|
|
72 |
list($width, $height, $type, $attr) = getimagesize($shop->callMod('wpsg_mod_rechnungen', 'getFilePath', array(''))."wpsg_rechnungen_logo.jpg");
|
|
|
73 |
|
|
|
74 |
//wpsg_debug($width.":".$height);
|
|
|
75 |
|
|
|
76 |
$wPix = (25.4 * $width) / 96;
|
|
|
77 |
$hPix = (25.4 * $height) / 96;
|
|
|
78 |
|
|
|
79 |
$pdf->image($shop->callMod('wpsg_mod_rechnungen', 'getFilePath', array(''))."wpsg_rechnungen_logo.jpg", 210 - $wPix, 0, $wPix, $hPix);
|
|
|
80 |
|
|
|
81 |
}
|
|
|
82 |
|
|
|
83 |
// Absenderadresszeile (Wird in der Konfiguration hinterlegt)
|
|
|
84 |
$pdf->SetFont('Arial', '', 6);
|
|
|
85 |
$pdf->Text($absender_left, $absender_top, $shop->replaceUniversalPlatzhalter(__($shop->get_option("wpsg_rechnungen_adresszeile"), 'wpsg'), $shop->view['data']['id']));
|
|
|
86 |
|
|
|
87 |
if (wpsg_getStr($shop->view['kunde']['kuerzel']) != "") $shop->view['kunde']['kuerzel'] = $shop->view['kunde']['kuerzel'].'-';
|
|
|
88 |
|
|
|
89 |
// Adresse des Kunden
|
|
|
90 |
$pdf->SetFont('Arial', '', 12);
|
|
|
91 |
$pdf->Text($adress_left, $adress_top, $shop->view['kunde']['firma']);
|
|
|
92 |
$pdf->Text($adress_left, $adress_top + 5, $shop->view['kunde']['vname'].' '.$shop->view['kunde']['name']);
|
7247 |
daniel |
93 |
$pdf->Text($adress_left, $adress_top + 10, $shop->view['kunde']['strasse'].' '.wpsg_getStr($shop->view['kunde']['nr']));
|
5972 |
daniel |
94 |
$pdf->Text($adress_left, $adress_top + 15, $shop->view['kunde']['plz'].' '.$shop->view['kunde']['ort']);
|
|
|
95 |
|
8007 |
daniel |
96 |
if ($shop->get_option("wpsg_mod_rechnungen_hideCountry") == '0') $pdf->Text($adress_left, $adress_top + 20, strtoupper($shop->view['oOrder']->getInvoiceCountryName()));
|
|
|
97 |
|
5972 |
daniel |
98 |
// Rechnungsdaten
|
|
|
99 |
$pdf->SetFont('Arial', 'B', 16);
|
7676 |
daniel |
100 |
$pdf->Text($rdata_left, $rdata_top, __('Rechnungskorrektur', 'wpsg'));
|
5972 |
daniel |
101 |
$pdf->SetFont('Arial', 'B', 9);
|
|
|
102 |
$pdf->Text($rdata_left, $rdata_top + 6, $shop->view['rnr']);
|
|
|
103 |
$pdf->SetFont('Arial', '', 9);
|
|
|
104 |
|
|
|
105 |
if (isset($shop->view['faelligkeitdatum']))
|
|
|
106 |
{
|
|
|
107 |
|
|
|
108 |
$pdf->Text($rdata_left + 35, $rdata_top, __("Fällig am", "wpsg"));
|
|
|
109 |
$pdf->Text($rdata_left + 35, $rdata_top + 6, $shop->view['faelligkeitdatum']);
|
|
|
110 |
|
|
|
111 |
}
|
|
|
112 |
|
|
|
113 |
if (isset($shop->view['payment']))
|
|
|
114 |
{
|
|
|
115 |
|
|
|
116 |
$pdf->Text($rdata_left + 58, $rdata_top, __("Zahlungsbedingungen", "wpsg"));
|
|
|
117 |
$pdf->Text($rdata_left + 58, $rdata_top + 6, $shop->view['payment']);
|
|
|
118 |
|
|
|
119 |
}
|
|
|
120 |
|
|
|
121 |
$pdf->Text($rdata_left + 105, $rdata_top, __("Kunden-Nr", "wpsg"));
|
|
|
122 |
$pdf->Text($rdata_left + 105, $rdata_top + 6, (($shop->view['kunde']['knr'] != '')?$shop->view['kunde']['knr']:$shop->view['kunde']['id']));
|
|
|
123 |
|
|
|
124 |
$pdf->Text($rdata_left + 135, $rdata_top, __("Best. Nr.", "wpsg"));
|
|
|
125 |
$pdf->Text($rdata_left + 135, $rdata_top + 6, ((trim($shop->view['data']['onr']) != '')?$shop->view['data']['onr']:$shop->view['data']['id']));
|
|
|
126 |
|
|
|
127 |
$pdf->Text($rdata_left + 155, $rdata_top, __("Datum", "wpsg"));
|
|
|
128 |
$pdf->Text($rdata_left + 155, $rdata_top + 6, $shop->view['rDatum']);
|
|
|
129 |
|
|
|
130 |
if ($shop->view['oOrder']->isInnerEu())
|
|
|
131 |
{
|
7153 |
thomas |
132 |
|
|
|
133 |
$pdf->SetFont('Arial', '', 9);
|
|
|
134 |
$pdf->Text($adress_left, $rdata_top + 11.5, __("Innergemeinschaftliche Lieferung.", "wpsg"));
|
|
|
135 |
|
|
|
136 |
} else if (!$shop->view['oOrder']->isInnerEu() && $shop->view['oOrder']->getShippingCountryID() != $shop->getDefaultCountry(true)) {
|
|
|
137 |
|
|
|
138 |
// Nicht InnerEU und Nicht Inland
|
|
|
139 |
|
|
|
140 |
$pdf->SetFont('Arial', '', 9);
|
|
|
141 |
$pdf->Text($adress_left, $rdata_top + 11.5, __("Steuerfreie Ausfuhrlieferung.", "wpsg"));
|
|
|
142 |
|
5972 |
daniel |
143 |
}
|
7153 |
thomas |
144 |
|
5972 |
daniel |
145 |
// Benutzerdefinierte Felder
|
|
|
146 |
$arTexte = $shop->callMod('wpsg_mod_rechnungen', 'getRechnungstexte', array($shop->view['data']['id']));
|
|
|
147 |
|
|
|
148 |
foreach ((array)$arTexte as $text)
|
|
|
149 |
{
|
|
|
150 |
|
|
|
151 |
if (isset($text['aktiv']) && $text['aktiv'] == 1)
|
|
|
152 |
{
|
|
|
153 |
|
|
|
154 |
$pdf->SetFont('Arial', 'B', ((intval($text['fontsize']) > 0)?intval($text['fontsize']):10));
|
|
|
155 |
$pdf->wpsg_SetTextColor($text['color']);
|
|
|
156 |
$pdf->wpsg_MultiCell($text['x'], $text['y'], 5, $text['text']);
|
|
|
157 |
$pdf->wpsg_SetTextColor("#000000");
|
|
|
158 |
|
|
|
159 |
}
|
|
|
160 |
|
|
|
161 |
}
|
|
|
162 |
|
|
|
163 |
}
|
|
|
164 |
|
|
|
165 |
}
|
|
|
166 |
//wpsg_debug($this->view); die();
|
|
|
167 |
$pdf = new wpsg_fpdf();
|
|
|
168 |
$pdf->SetAutoPageBreak(true, 5);
|
|
|
169 |
AddRechnungPage($this, $pdf);
|
|
|
170 |
|
|
|
171 |
$summe = 0;
|
|
|
172 |
|
|
|
173 |
$bKopf = false; $pnr = 1; $offset = 0; $count = 0;
|
|
|
174 |
foreach ($this->view['basket']['produkte'] as $p)
|
|
|
175 |
{
|
|
|
176 |
|
|
|
177 |
if (!$bKopf)
|
|
|
178 |
{
|
|
|
179 |
|
|
|
180 |
$pdf->SetFont('Arial', 'B', 9);
|
|
|
181 |
$pdf->setXY($prod_left, $prod_top);
|
|
|
182 |
$pdf->Cell(10, 8, __("Nr.", "wpsg"), 1, 0, 'C');
|
|
|
183 |
|
|
|
184 |
$pdf->setXY($prod_left + 10, $prod_top);
|
|
|
185 |
$pdf->Cell( ((sizeof($this->view['basket']['mwst']) >= 1 || $this->get_option('wpsg_showMwstAlways') == '1')?87:102), 8, "Name", 1, 0, 'L');
|
|
|
186 |
|
|
|
187 |
if (sizeof($this->view['basket']['mwst']) >= 1 || $this->get_option('wpsg_showMwstAlways') == '1')
|
|
|
188 |
{
|
|
|
189 |
|
|
|
190 |
$pdf->setXY($prod_left + 97, $prod_top);
|
|
|
191 |
$pdf->Cell(15, 8, __("MwSt.", "wpsg"), 1, 0, 'C');
|
|
|
192 |
|
|
|
193 |
}
|
|
|
194 |
|
|
|
195 |
$pdf->setXY($prod_left + 112, $prod_top);
|
|
|
196 |
$pdf->Cell(15, 8, __("Menge", "wpsg"), 1, 0, 'C');
|
|
|
197 |
|
|
|
198 |
$pdf->setXY($prod_left + 127, $prod_top);
|
|
|
199 |
$pdf->Cell(25, 8, __("Einzelpreis", "wpsg"), 1, 0, 'R');
|
|
|
200 |
|
|
|
201 |
$pdf->setXY($prod_left + 152, $prod_top);
|
|
|
202 |
$pdf->Cell(25, 8, __("Gesamtpreis", "wpsg"), 1, 0, 'R');
|
|
|
203 |
|
|
|
204 |
$offset = 8;
|
|
|
205 |
$bKopf = true;
|
|
|
206 |
|
|
|
207 |
}
|
|
|
208 |
|
|
|
209 |
$pdf->SetFont('Arial', '', 9);
|
|
|
210 |
$pdf->setXY($prod_left, $prod_top + $offset);
|
|
|
211 |
|
6751 |
daniel |
212 |
if ($this->get_option('wpsg_mod_rechnungen_anr') == '1')
|
5972 |
daniel |
213 |
{
|
|
|
214 |
|
|
|
215 |
$pdf->Cell(10, 8, $p['anr'], 0, 0, 'C');
|
|
|
216 |
|
|
|
217 |
}
|
|
|
218 |
else
|
|
|
219 |
{
|
|
|
220 |
|
|
|
221 |
$pdf->Cell(10, 8, $pnr.".", 0, 0, 'C');
|
|
|
222 |
|
|
|
223 |
}
|
|
|
224 |
|
|
|
225 |
/* Wenn Detailname vorhanden, wird der Detailname auf Rechnung verwendet */
|
|
|
226 |
$produkt_text = $this->getProductName($this->getProduktID($p['id']), true);
|
|
|
227 |
|
|
|
228 |
/* Falls Detailname vorhanden, wird jetzt der Produktname verwendet */
|
|
|
229 |
/* $produkt_text = $this->getProductName($this->getProduktID($p['id']), false); */
|
|
|
230 |
|
|
|
231 |
$produktBeschreibung = trim(strip_tags($p['beschreibung']));
|
|
|
232 |
|
|
|
233 |
if ($this->isOtherLang())
|
|
|
234 |
{
|
|
|
235 |
|
|
|
236 |
$trans_db = $this->db->fetchRow("SELECT * FROM `".WPSG_TBL_PRODUCTS."` WHERE `lang_parent` = '".wpsg_q($this->getProduktID($p['id']))."' AND `lang_code` = '".wpsg_q($this->getCurrentLanguageCode())."'");
|
|
|
237 |
|
|
|
238 |
if (is_array($trans_db) && sizeof($trans_db) > 0)
|
|
|
239 |
{
|
|
|
240 |
|
|
|
241 |
$produkt_text = $trans_db['name'];
|
|
|
242 |
$produktBeschreibung = trim(strip_tags($trans_db['beschreibung']));
|
|
|
243 |
|
|
|
244 |
}
|
|
|
245 |
|
|
|
246 |
}
|
|
|
247 |
|
|
|
248 |
$height = 0; // Höhe der Zeile für den Rahmen
|
|
|
249 |
|
|
|
250 |
$pdf->setXY($prod_left + 10, $prod_top + $offset);
|
|
|
251 |
|
|
|
252 |
// Produktvariablen
|
|
|
253 |
if ($this->hasMod('wpsg_mod_productvars') && $this->get_option("wpsg_mod_rechnungen_showpv") == "1")
|
|
|
254 |
{
|
|
|
255 |
|
|
|
256 |
$arPV = $this->callMod('wpsg_mod_productvars', 'getAllProductVarValues', array($this->view['data']['id'], $p['product_index']));
|
|
|
257 |
|
|
|
258 |
if (wpsg_isSizedArray($arPV))
|
|
|
259 |
{
|
|
|
260 |
|
|
|
261 |
foreach ($arPV as $pv)
|
|
|
262 |
{
|
|
|
263 |
|
|
|
264 |
$produkt_text .= "\r\n".$pv['name'].': '.$pv['value'];
|
|
|
265 |
$height += 5;
|
|
|
266 |
|
|
|
267 |
}
|
|
|
268 |
|
|
|
269 |
}
|
|
|
270 |
|
|
|
271 |
}
|
|
|
272 |
|
6751 |
daniel |
273 |
if ($this->get_option('wpsg_mod_rechnungen_anr') === '2')
|
|
|
274 |
{
|
|
|
275 |
|
|
|
276 |
$anr = $this->getProductAnr($p['productkey']);
|
|
|
277 |
$produkt_text .= "\r\n".wpsg_translate(__('Artikelnummer: #1#', 'wpsg'), $anr);
|
|
|
278 |
|
|
|
279 |
}
|
|
|
280 |
|
5972 |
daniel |
281 |
$produkt_text_cell_width = 102;
|
|
|
282 |
if (sizeof($this->view['basket']['mwst']) >= 1 || $this->get_option('wpsg_showMwstAlways') == '1')
|
|
|
283 |
{
|
|
|
284 |
$produkt_text_cell_width = 87;
|
|
|
285 |
}
|
|
|
286 |
|
|
|
287 |
$produkt_text_width = $pdf->GetStringWidth($produkt_text);
|
|
|
288 |
//$produkt_text_cell_width = (($this->arMwSt == "-1")?87:102);
|
|
|
289 |
|
|
|
290 |
$height += 5 * ceil($produkt_text_width / $produkt_text_cell_width) + 3;
|
|
|
291 |
|
|
|
292 |
$height_y = $pdf->getY();
|
|
|
293 |
$height = 2 + $pdf->wpsg_MultiCell($prod_left + 10, $prod_top + $offset + 1.5, 5, $produkt_text, 0, 'L', 0, $produkt_text_cell_width);
|
|
|
294 |
|
|
|
295 |
//$height += 3 + 5 + $pdf->getY() - $height_y;
|
|
|
296 |
//$pdf->Cell((($this->arMwSt == "-1")?102:87), 8, $produkt_text, 0, 0, 'L');
|
|
|
297 |
|
|
|
298 |
if (sizeof($this->view['basket']['mwst']) >= 1 || $this->get_option('wpsg_showMwstAlways') == '1')
|
|
|
299 |
{
|
|
|
300 |
|
|
|
301 |
$pdf->setXY($prod_left + 97, $prod_top + $offset);
|
|
|
302 |
$pdf->Cell(15, 8, (($this->view['basket']['noMwSt'] == '1')?'0.00 %':wpsg_ff($p['mwst_value'], '%')), 0, 0, 'C');
|
|
|
303 |
|
|
|
304 |
}
|
|
|
305 |
|
|
|
306 |
$pdf->setXY($prod_left + 112, $prod_top + $offset);
|
|
|
307 |
$pdf->Cell(15, 8, $p['menge'], 0, 0, 'C');
|
|
|
308 |
|
|
|
309 |
if (wpsg_ShopController::get_option('wpsg_preisangaben') == WPSG_NETTO)
|
|
|
310 |
{
|
|
|
311 |
$preis = $p['preis_netto'];
|
|
|
312 |
|
|
|
313 |
//TODO
|
|
|
314 |
}
|
|
|
315 |
else
|
|
|
316 |
{
|
|
|
317 |
$preis = $p['preis_brutto'];
|
|
|
318 |
}
|
|
|
319 |
|
|
|
320 |
$pdf->setXY($prod_left + 127, $prod_top + $offset);
|
|
|
321 |
$pdf->Cell(25, 8, wpsg_ff($preis, $this->get_option('wpsg_currency')), 0, 0, 'R');
|
|
|
322 |
|
|
|
323 |
$pdf->setXY($prod_left + 152, $prod_top + $offset);
|
|
|
324 |
$pdf->Cell(25, 8, wpsg_ff($preis * $p['menge'], $this->get_option('wpsg_currency')), 0, 0, 'R');
|
|
|
325 |
|
|
|
326 |
/**
|
|
|
327 |
* Produktbeschreibung anzeigen Ja/Nein
|
|
|
328 |
*/
|
|
|
329 |
$pBeschreibungHeight = 0;
|
|
|
330 |
if ($this->get_option("wpsg_rechnungen_pbeschreibung") == "1" && trim(strip_tags($p['beschreibung'])) != '')
|
|
|
331 |
{
|
|
|
332 |
|
|
|
333 |
$produktBeschreibung = nl2br($produktBeschreibung);
|
|
|
334 |
preg_match_all('/\<br \/\>/', $produktBeschreibung, $treffer);
|
|
|
335 |
$produktBeschreibung = strip_tags($produktBeschreibung);
|
|
|
336 |
|
|
|
337 |
$pBeschreibungWidth = $pdf->getStringWidth($produktBeschreibung);
|
|
|
338 |
$pBeschreibungHeight = 5 * (ceil($pBeschreibungWidth / $produkt_text_cell_width) + @sizeof($treffer[0]));
|
|
|
339 |
|
|
|
340 |
$pdf->SetFont('Arial', 'I', 9);
|
|
|
341 |
|
|
|
342 |
$cellY = $pdf->getY();
|
|
|
343 |
$pdf->wpsg_MultiCell($prod_left + 10, $prod_top + $height + $offset - 1, 5, $produktBeschreibung, 0, 'L', 0, $produkt_text_cell_width);
|
|
|
344 |
$pBeschreibungHeight = $pdf->getY() - $cellY - $height + 1;
|
|
|
345 |
$pdf->SetFont('Arial', '', 9);
|
|
|
346 |
|
|
|
347 |
}
|
|
|
348 |
|
|
|
349 |
$height += $pBeschreibungHeight;
|
|
|
350 |
|
|
|
351 |
/**
|
|
|
352 |
* Produktattribute ?
|
|
|
353 |
*/
|
|
|
354 |
if ($this->get_option('wpsg_rechnungen_produktattribute') == '1')
|
|
|
355 |
{
|
|
|
356 |
|
|
|
357 |
$attributeInfo = $this->callMod('wpsg_mod_produktattribute', 'getProductAttributeByProductId', array($this->getProduktId($p['id'])));
|
|
|
358 |
|
|
|
359 |
foreach ($attributeInfo as $pa)
|
|
|
360 |
{
|
|
|
361 |
|
|
|
362 |
$pa_text = $pa['name'].': '.$pa['value'];
|
|
|
363 |
$height += $pdf->wpsg_MultiCell($prod_left + 10, $prod_top + $height + $offset - 0.5, 5, $pa_text, 0, 'L', 0, $produkt_text_cell_width);
|
|
|
364 |
|
|
|
365 |
}
|
|
|
366 |
}
|
|
|
367 |
|
|
|
368 |
/**
|
|
|
369 |
* Variante ?
|
|
|
370 |
*/
|
6165 |
hartmut |
371 |
if (preg_match('/pv_(.*)/', $p['productkey']))
|
5972 |
daniel |
372 |
{
|
|
|
373 |
|
6165 |
hartmut |
374 |
$variInfo = $this->callMod('wpsg_mod_productvariants', 'getVariantenInfoArray', array($p['productkey']));
|
5972 |
daniel |
375 |
|
|
|
376 |
$height += $pdf->wpsg_MultiCell($prod_left + 10, $prod_top + $height + $offset - 0.5, 5, wpsg_translate(__('Variante: #1#', 'wpsg'), $variInfo['key']), 0, 'L', 0, $produkt_text_cell_width);
|
|
|
377 |
|
|
|
378 |
//$height += 5;
|
|
|
379 |
|
|
|
380 |
}
|
|
|
381 |
|
|
|
382 |
if ($this->hasMod('wpsg_mod_deliverynote'))
|
|
|
383 |
{
|
|
|
384 |
|
|
|
385 |
$arDN_order = $this->callMod('wpsg_mod_deliverynote', 'loadDeliveryNotesFromOrder', array($this->view['data']['id']));
|
|
|
386 |
|
|
|
387 |
if (sizeof($arDN_order) > 1)
|
|
|
388 |
{
|
|
|
389 |
|
|
|
390 |
$deliveryTimeProduct = $this->callMod('wpsg_mod_deliverynote', 'getProductDeliveryTime', array($this->view['data']['id'], $p['product_index']));
|
|
|
391 |
|
|
|
392 |
if ($deliveryTimeProduct !== false)
|
|
|
393 |
{
|
|
|
394 |
|
|
|
395 |
$height += $pdf->wpsg_MultiCell($prod_left + 10, $prod_top + $height + $offset - 0.5, 5, wpsg_translate(__('Lieferdatum: #1#', 'wpsg'), date('d.m.Y', $deliveryTimeProduct)), 0, 'L', 0, $produkt_text_cell_width);
|
|
|
396 |
|
|
|
397 |
}
|
|
|
398 |
|
|
|
399 |
}
|
|
|
400 |
|
|
|
401 |
}
|
|
|
402 |
|
|
|
403 |
// Jetzt die Rahmen zeichnen
|
|
|
404 |
$pdf->Rect($prod_left, $prod_top + $offset, 10, $height);
|
|
|
405 |
|
|
|
406 |
$pdf->Rect($prod_left + 10, $prod_top + $offset, ((sizeof($this->view['basket']['mwst']) >= 1 || $this->get_option('wpsg_showMwstAlways') == '1')?87:102), $height);
|
|
|
407 |
|
|
|
408 |
if (sizeof($this->view['basket']['mwst']) >= 1 || $this->get_option('wpsg_showMwstAlways') == '1')
|
|
|
409 |
{
|
|
|
410 |
|
|
|
411 |
$pdf->Rect($prod_left + 97, $prod_top + $offset, 15, $height);
|
|
|
412 |
|
|
|
413 |
}
|
|
|
414 |
|
|
|
415 |
$pdf->Rect($prod_left + 112, $prod_top + $offset, 15, $height);
|
|
|
416 |
$pdf->Rect($prod_left + 127, $prod_top + $offset, 25, $height);
|
|
|
417 |
$pdf->Rect($prod_left + 152, $prod_top + $offset, 25, $height);
|
|
|
418 |
|
|
|
419 |
$offset += $height;
|
|
|
420 |
|
|
|
421 |
$pnr ++;
|
|
|
422 |
$count ++;
|
|
|
423 |
|
|
|
424 |
$summe += $p['price'] * $p['menge'];
|
|
|
425 |
|
|
|
426 |
if ($pdf->getY() > 220 || ($count >= $prod_break && sizeof($this->view['basket']['produkte']) > ($pnr - 1)))
|
|
|
427 |
{
|
|
|
428 |
|
|
|
429 |
AddRechnungPage($this, $pdf);
|
|
|
430 |
$bKopf = false; $offset = 0; $count = 0;
|
|
|
431 |
|
|
|
432 |
}
|
|
|
433 |
|
|
|
434 |
} // produkte
|
|
|
435 |
|
|
|
436 |
// Gutschein
|
7490 |
daniel |
437 |
/*
|
5972 |
daniel |
438 |
if ((isset($this->view['basket']['gs'])) && ($this->view['basket']['gs_value'] > 0))
|
|
|
439 |
{
|
|
|
440 |
|
|
|
441 |
$pdf->SetFont('Arial', '', 9);
|
|
|
442 |
$pdf->setXY($prod_left, $prod_top + $offset);
|
|
|
443 |
$pdf->Cell(10, 8, $pnr.'.', 1, 0, 'C'); $pnr ++;
|
|
|
444 |
|
|
|
445 |
$pdf->setXY($prod_left + 10, $prod_top + $offset);
|
|
|
446 |
$pdf->Cell( ((sizeof($this->view['basket']['mwst']) >= 1 || $this->get_option('wpsg_showMwstAlways') == '1')?87:102), 8, wpsg_translate(__('Gutschein (#1#)', 'wpsg'), $this->view['basket']['gs']['code']), 1, 0, 'L');
|
|
|
447 |
|
|
|
448 |
if (sizeof($this->view['basket']['mwst']) >= 1 || $this->get_option('wpsg_showMwstAlways') == '1')
|
|
|
449 |
{
|
|
|
450 |
|
|
|
451 |
$mwst = __('anteilig', 'wpsg');
|
|
|
452 |
|
|
|
453 |
$pdf->setXY($prod_left + 97, $prod_top + $offset);
|
|
|
454 |
$pdf->Cell(15, 8, $mwst, 1, 0, 'C');
|
|
|
455 |
|
|
|
456 |
}
|
|
|
457 |
|
|
|
458 |
$pdf->setXY($prod_left + 112, $prod_top + $offset);
|
|
|
459 |
$pdf->Cell(15, 8, '1', 1, 0, 'C');
|
|
|
460 |
|
|
|
461 |
$gs_value_einzel = '-'.wpsg_ff($this->view['basket']['sum']['gs'], $this->get_option('wpsg_currency'));
|
|
|
462 |
$gs_value_gesamt = '-'.wpsg_ff($this->view['basket']['sum']['gs'], $this->get_option('wpsg_currency'));
|
|
|
463 |
|
|
|
464 |
$pdf->setXY($prod_left + 127, $prod_top + $offset);
|
|
|
465 |
$pdf->Cell(25, 8, $gs_value_einzel, 1, 0, 'R');
|
|
|
466 |
|
|
|
467 |
$pdf->setXY($prod_left + 152, $prod_top + $offset);
|
|
|
468 |
$pdf->Cell(25, 8, $gs_value_gesamt, 1, 0, 'R');
|
|
|
469 |
|
|
|
470 |
$offset += 8;
|
|
|
471 |
|
|
|
472 |
}
|
7490 |
daniel |
473 |
*/
|
|
|
474 |
if (wpsg_isSizedArray($this->view['basket']['arCalculation']['voucher'])) {
|
|
|
475 |
|
|
|
476 |
foreach ($this->view['basket']['arCalculation']['voucher'] as $v) {
|
|
|
477 |
|
|
|
478 |
$pdf->SetFont('Arial', '', 9);
|
|
|
479 |
$pdf->setXY($prod_left, $prod_top + $offset);
|
|
|
480 |
$pdf->Cell(10, 8, $pnr.'.', 1, 0, 'C'); $pnr ++;
|
|
|
481 |
|
|
|
482 |
$pdf->setXY($prod_left + 10, $prod_top + $offset);
|
|
|
483 |
$pdf->Cell( ((sizeof($this->view['basket']['mwst']) >= 1 || $this->get_option('wpsg_showMwstAlways') == '1')?87:102), 8, wpsg_translate(__('Gutschein (#1#)', 'wpsg'), $v['code']), 1, 0, 'L');
|
|
|
484 |
|
|
|
485 |
if (sizeof($this->view['basket']['mwst']) >= 1 || $this->get_option('wpsg_showMwstAlways') == '1')
|
|
|
486 |
{
|
|
|
487 |
|
|
|
488 |
$mwst = __('anteilig', 'wpsg');
|
|
|
489 |
|
|
|
490 |
$pdf->setXY($prod_left + 97, $prod_top + $offset);
|
|
|
491 |
$pdf->Cell(15, 8, $mwst, 1, 0, 'C');
|
|
|
492 |
|
|
|
493 |
}
|
|
|
494 |
|
|
|
495 |
$pdf->setXY($prod_left + 112, $prod_top + $offset);
|
|
|
496 |
$pdf->Cell(15, 8, '1', 1, 0, 'C');
|
|
|
497 |
|
|
|
498 |
$gs_value_einzel = wpsg_ff($v[$taxdisplay.'_single'], $this->get_option('wpsg_currency'));
|
|
|
499 |
$gs_value_gesamt = wpsg_ff($v[$taxdisplay], $this->get_option('wpsg_currency'));
|
|
|
500 |
|
|
|
501 |
$pdf->setXY($prod_left + 127, $prod_top + $offset);
|
|
|
502 |
$pdf->Cell(25, 8, $gs_value_einzel, 1, 0, 'R');
|
|
|
503 |
|
|
|
504 |
$pdf->setXY($prod_left + 152, $prod_top + $offset);
|
|
|
505 |
$pdf->Cell(25, 8, $gs_value_gesamt, 1, 0, 'R');
|
|
|
506 |
|
|
|
507 |
$offset += 8;
|
|
|
508 |
|
|
|
509 |
}
|
|
|
510 |
|
|
|
511 |
}
|
5972 |
daniel |
512 |
|
|
|
513 |
// Versandkosten
|
|
|
514 |
if ($this->view['basket']['sum']['preis_shipping'] != '' && $this->view['basket']['sum']['preis_shipping'] != 0)
|
|
|
515 |
{
|
|
|
516 |
|
|
|
517 |
$pdf->SetFont('Arial', '', 9);
|
|
|
518 |
$pdf->setXY($prod_left, $prod_top + $offset);
|
|
|
519 |
$pdf->Cell(10, 8, $pnr.'.', 1, 0, 'C'); $pnr ++;
|
|
|
520 |
|
|
|
521 |
$pdf->setXY($prod_left + 10, $prod_top + $offset);
|
|
|
522 |
$pdf->Cell( ((sizeof($this->view['basket']['mwst']) >= 1 || $this->get_option('wpsg_showMwstAlways') == '1')?87:102), 8, wpsg_translate(__('Versandkosten "#1#"', 'wpsg'), $this->view['oOrder']->getShippingLabel()), 1, 0, 'L');
|
|
|
523 |
|
|
|
524 |
if (sizeof($this->view['basket']['mwst']) >= 1 || $this->get_option('wpsg_showMwstAlways') == '1')
|
|
|
525 |
{
|
|
|
526 |
|
|
|
527 |
if ($this->arShipping[$this->view['data']['type_shipping']]['mwst_null'] == '1' && $this->view['basket']['noMwSt'] == '1')
|
|
|
528 |
{
|
|
|
529 |
|
|
|
530 |
$mwst = 0;
|
|
|
531 |
|
|
|
532 |
}
|
|
|
533 |
else
|
|
|
534 |
{
|
7642 |
daniel |
535 |
|
|
|
536 |
if ($this->view['basket']['arCalculation']['shipping'][0]['tax_key'] === '0') {
|
5972 |
daniel |
537 |
|
7642 |
daniel |
538 |
$mwst = _('anteilig');
|
5972 |
daniel |
539 |
|
7642 |
daniel |
540 |
} else {
|
5972 |
daniel |
541 |
|
7642 |
daniel |
542 |
$mwst = wpsg_ff($this->view['basket']['arCalculation']['shipping'][0]['tax'], '%');
|
|
|
543 |
$mwst = wpsg_ff($this->view['basket']['arCalculation']['tax'][$this->view['basket']['arCalculation']['shipping'][0]['tax_key']]['tax_value'], '%');
|
5972 |
daniel |
544 |
|
|
|
545 |
}
|
7642 |
daniel |
546 |
|
5972 |
daniel |
547 |
}
|
|
|
548 |
|
|
|
549 |
$pdf->setXY($prod_left + 97, $prod_top + $offset);
|
|
|
550 |
$pdf->Cell(15, 8, $mwst, 1, 0, 'C');
|
|
|
551 |
|
|
|
552 |
}
|
|
|
553 |
|
|
|
554 |
$pdf->setXY($prod_left + 112, $prod_top + $offset);
|
|
|
555 |
$pdf->Cell(15, 8, '1', 1, 0, 'C');
|
|
|
556 |
|
|
|
557 |
$pdf->setXY($prod_left + 127, $prod_top + $offset);
|
|
|
558 |
$pdf->Cell(25, 8, wpsg_ff($this->view['basket']['sum']['preis_shipping'], $this->get_option('wpsg_currency')), 1, 0, 'R');
|
|
|
559 |
|
|
|
560 |
$pdf->setXY($prod_left + 152, $prod_top + $offset);
|
|
|
561 |
$pdf->Cell(25, 8, wpsg_ff($this->view['basket']['sum']['preis_shipping'], $this->get_option('wpsg_currency')), 1, 0, 'R');
|
|
|
562 |
|
|
|
563 |
$offset += 8;
|
|
|
564 |
|
|
|
565 |
// Zusammengesetzte Versandarten darstellen
|
|
|
566 |
/*
|
|
|
567 |
if (wpsg_isSizedArray($this->view['basket']['shipping']['methods'])) {
|
|
|
568 |
|
|
|
569 |
foreach ($this->view['basket']['shipping']['methods'] as $shipping) {
|
|
|
570 |
|
|
|
571 |
$pdf->SetFont('Arial', '', 9);
|
|
|
572 |
$pdf->setXY($prod_left, $prod_top + $offset);
|
|
|
573 |
$pdf->Cell(10, 8, '', 1, 0, 'C'); $pnr ++;
|
|
|
574 |
|
|
|
575 |
$pdf->setXY($prod_left + 10, $prod_top + $offset);
|
|
|
576 |
$pdf->Cell( ((sizeof($this->view['basket']['mwst']) >= 1 || $this->get_option('wpsg_showMwstAlways') == '1')?87:102), 8, $this->getShippingName($shipping), 1, 0, 'L');
|
|
|
577 |
|
|
|
578 |
if (sizeof($this->view['basket']['mwst']) >= 1 || $this->get_option('wpsg_showMwstAlways') == '1')
|
|
|
579 |
{
|
|
|
580 |
|
|
|
581 |
if ($this->view['basket']['shipping'][$shipping]['tax_rata'] == 1) { $mwst = __('Anteilig', 'wpsg'); }
|
|
|
582 |
else { $mwst = wpsg_ff($this->view['basket']['shipping'][$shipping]['mwst'], '%'); }
|
|
|
583 |
|
|
|
584 |
$pdf->setXY($prod_left + 97, $prod_top + $offset);
|
|
|
585 |
$pdf->Cell(15, 8, $mwst, 1, 0, 'C');
|
|
|
586 |
|
|
|
587 |
}
|
|
|
588 |
|
|
|
589 |
$pdf->setXY($prod_left + 112, $prod_top + $offset);
|
|
|
590 |
$pdf->Cell(15, 8, '1', 1, 0, 'C');
|
|
|
591 |
|
|
|
592 |
$pdf->setXY($prod_left + 127, $prod_top + $offset);
|
|
|
593 |
$pdf->Cell(25, 8, wpsg_ff($this->view['basket']['shipping'][$shipping]['preis_shipping_brutto'], $this->get_option('wpsg_currency')), 1, 0, 'R');
|
|
|
594 |
|
|
|
595 |
$pdf->setXY($prod_left + 152, $prod_top + $offset);
|
|
|
596 |
$pdf->Cell(25, 8, wpsg_ff($this->view['basket']['shipping'][$shipping]['preis_shipping_brutto'], $this->get_option('wpsg_currency')), 1, 0, 'R');
|
|
|
597 |
|
|
|
598 |
$offset += 8;
|
|
|
599 |
|
|
|
600 |
}
|
|
|
601 |
|
|
|
602 |
}
|
|
|
603 |
*/
|
|
|
604 |
|
|
|
605 |
|
|
|
606 |
}
|
|
|
607 |
|
|
|
608 |
// Zahlungskosten
|
|
|
609 |
if ($this->view['basket']['sum']['preis_payment'] != '' && $this->view['basket']['sum']['preis_payment'] != 0)
|
|
|
610 |
{
|
|
|
611 |
|
|
|
612 |
$pdf->SetFont('Arial', '', 9);
|
|
|
613 |
$pdf->setXY($prod_left, $prod_top + $offset);
|
|
|
614 |
$pdf->Cell(10, 8, $pnr.'.', 1, 0, 'C'); $pnr ++;
|
|
|
615 |
|
|
|
616 |
$pdf->setXY($prod_left + 10, $prod_top + $offset);
|
|
|
617 |
$pdf->Cell( ((sizeof($this->view['basket']['mwst']) >= 1 || $this->get_option('wpsg_showMwstAlways') == '1')?87:102), 8, $this->arPayment[$this->view['data']['type_payment']]['name'], 1, 0, 'L');
|
|
|
618 |
|
|
|
619 |
if (sizeof($this->view['basket']['mwst']) >= 1 || $this->get_option('wpsg_showMwstAlways') == '1')
|
|
|
620 |
{
|
|
|
621 |
|
|
|
622 |
if ($this->arPayment[$this->view['data']['type_payment']]['mwst_null'] == '1' && $this->view['basket']['noMwSt'] == '1')
|
|
|
623 |
{
|
|
|
624 |
$mwst = 0;
|
|
|
625 |
}
|
|
|
626 |
else
|
7642 |
daniel |
627 |
{
|
5972 |
daniel |
628 |
|
7642 |
daniel |
629 |
if ($this->view['basket']['arCalculation']['payment'][0]['tax_key'] === '0') {
|
5972 |
daniel |
630 |
|
7642 |
daniel |
631 |
$mwst = _('anteilig');
|
5972 |
daniel |
632 |
|
7642 |
daniel |
633 |
} else {
|
|
|
634 |
|
|
|
635 |
$mwst = wpsg_ff($this->view['basket']['arCalculation']['payment'][0]['tax'], '%');
|
|
|
636 |
$mwst = wpsg_ff($this->view['basket']['arCalculation']['tax'][$this->view['basket']['arCalculation']['payment'][0]['tax_key']]['tax_value'], '%');
|
|
|
637 |
|
5972 |
daniel |
638 |
}
|
|
|
639 |
|
|
|
640 |
}
|
|
|
641 |
|
|
|
642 |
$pdf->setXY($prod_left + 97, $prod_top + $offset);
|
|
|
643 |
$pdf->Cell(15, 8, $mwst, 1, 0, 'C');
|
|
|
644 |
|
|
|
645 |
}
|
|
|
646 |
|
|
|
647 |
$pdf->setXY($prod_left + 112, $prod_top + $offset);
|
|
|
648 |
$pdf->Cell(15, 8, '1', 1, 0, 'C');
|
|
|
649 |
|
|
|
650 |
$pdf->setXY($prod_left + 127, $prod_top + $offset);
|
|
|
651 |
$pdf->Cell(25, 8, wpsg_ff($this->view['basket']['sum']['preis_payment'], $this->get_option('wpsg_currency')), 1, 0, 'R');
|
|
|
652 |
|
|
|
653 |
$pdf->setXY($prod_left + 152, $prod_top + $offset);
|
|
|
654 |
$pdf->Cell(25, 8, wpsg_ff($this->view['basket']['sum']['preis_payment'], $this->get_option('wpsg_currency')), 1, 0, 'R');
|
|
|
655 |
|
|
|
656 |
$offset += 8;
|
|
|
657 |
|
|
|
658 |
}
|
|
|
659 |
|
|
|
660 |
// Gebühr
|
|
|
661 |
if (wpsg_tf(wpsg_getStr($this->view['storno_fee'])) > 0)
|
|
|
662 |
{
|
|
|
663 |
|
|
|
664 |
$pdf->SetFont('Arial', '', 9);
|
|
|
665 |
$pdf->setXY($prod_left, $prod_top + $offset);
|
|
|
666 |
$pdf->Cell(10, 8, $pnr.'.', 1, 0, 'C'); $pnr ++;
|
|
|
667 |
|
|
|
668 |
$label = __('Bearbeitungsgebühr', 'wpsg');
|
|
|
669 |
|
|
|
670 |
if (strpos($this->view['storno_fee'], '%') !== false) $label .= ' ('.wpsg_ff($this->view['storno_fee'], '%').')';
|
|
|
671 |
|
|
|
672 |
$pdf->setXY($prod_left + 10, $prod_top + $offset);
|
|
|
673 |
$pdf->Cell( ((sizeof($this->view['basket']['mwst']) >= 1 || $this->get_option('wpsg_showMwstAlways') == '1')?87:102), 8, $label, 1, 0, 'L');
|
|
|
674 |
|
|
|
675 |
if (sizeof($this->view['basket']['mwst']) >= 1 || $this->get_option('wpsg_showMwstAlways') == '1')
|
|
|
676 |
{
|
|
|
677 |
|
|
|
678 |
if ($this->view['basket']['noMwSt'] == '1')
|
|
|
679 |
{
|
|
|
680 |
$mwst = 0;
|
|
|
681 |
}
|
|
|
682 |
else
|
|
|
683 |
{
|
|
|
684 |
|
|
|
685 |
|
|
|
686 |
$mwst = wpsg_ff($this->view['storno_fee_tax_value'], '%');
|
|
|
687 |
|
|
|
688 |
}
|
|
|
689 |
|
|
|
690 |
$pdf->setXY($prod_left + 97, $prod_top + $offset);
|
|
|
691 |
$pdf->Cell(15, 8, $mwst, 1, 0, 'C');
|
|
|
692 |
|
|
|
693 |
}
|
|
|
694 |
|
|
|
695 |
$pdf->setXY($prod_left + 112, $prod_top + $offset);
|
|
|
696 |
$pdf->Cell(15, 8, '1', 1, 0, 'C');
|
|
|
697 |
|
|
|
698 |
$pdf->setXY($prod_left + 127, $prod_top + $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);
|
|
|
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 |
}
|
|
|
707 |
|
|
|
708 |
$pdf->SetFont('Arial', '', 9);
|
|
|
709 |
|
|
|
710 |
if ($this->view['kunde']['ustidnr'] != "")
|
|
|
711 |
{
|
|
|
712 |
$offset += 10;
|
|
|
713 |
$pdf->Text($prod_left, $prod_top + $offset, __("Ihre Umsatzsteuer-Identifikationsnummer:", "wpsg"));
|
|
|
714 |
$pdf->setXY($prod_left + 140, $prod_top + $offset - 5);
|
|
|
715 |
$pdf->Cell(37, 8, $this->view['kunde']['ustidnr'], 0, 0, 'R');
|
|
|
716 |
}
|
|
|
717 |
|
|
|
718 |
$offset += 10;
|
|
|
719 |
if ($this->get_option('wpsg_kleinunternehmer'))
|
|
|
720 |
{
|
|
|
721 |
|
|
|
722 |
$pdf->Text($prod_left, $prod_top + $offset, __("Es ergibt sich folgender Gesamtbetrag", "wpsg").':');
|
7490 |
daniel |
723 |
$pdf->Text($prod_left + 80, $prod_top + $offset, __("Summe", "wpsg"));
|
5972 |
daniel |
724 |
$pdf->setXY($prod_left + 140, $prod_top + $offset - 5);
|
|
|
725 |
$pdf->Cell(37, 8, wpsg_ff($this->view['basket']['sum']['preis_gesamt_brutto'] + $this->view['basket']['sum']['preis_rabatt'], $this->get_option('wpsg_currency')), 0, 0, 'R');
|
|
|
726 |
$offset += 5;
|
|
|
727 |
|
|
|
728 |
}
|
|
|
729 |
else
|
|
|
730 |
{
|
|
|
731 |
|
|
|
732 |
if ($this->view['basket']['noMwSt'] == '1')
|
|
|
733 |
{
|
|
|
734 |
|
|
|
735 |
$pdf->Text($prod_left, $prod_top + $offset, __("Es ergibt sich folgender Gesamtbetrag", "wpsg").':');
|
7490 |
daniel |
736 |
$pdf->Text($prod_left + 80, $prod_top + $offset, __("BRUTTOBETRAG", "wpsg"));
|
5972 |
daniel |
737 |
$pdf->setXY($prod_left + 140, $prod_top + $offset - 5);
|
|
|
738 |
$pdf->Cell(37, 8, wpsg_ff($this->view['basket']['sum']['preis_gesamt_netto'], $this->get_option('wpsg_currency')), 0, 0, 'R');
|
|
|
739 |
$offset += 5;
|
|
|
740 |
|
7490 |
daniel |
741 |
$pdf->Text($prod_left + 80, $prod_top + $offset, __("MwSt. GESAMT", "wpsg"));
|
5972 |
daniel |
742 |
$pdf->setXY($prod_left + 140, $prod_top + $offset - 5);
|
|
|
743 |
$pdf->Cell(37, 8, wpsg_ff(0, $this->get_option('wpsg_currency')), 0, 0, 'R');
|
|
|
744 |
|
|
|
745 |
}
|
|
|
746 |
else
|
|
|
747 |
{
|
|
|
748 |
|
|
|
749 |
$pdf->Text($prod_left, $prod_top + $offset, __("Der Gesamtbetrag setzt sich wie folgt zusammen", "wpsg"));
|
|
|
750 |
|
7490 |
daniel |
751 |
$pdf->Text($prod_left + 80, $prod_top + $offset, __("NETTOBETRAG", "wpsg"));
|
5972 |
daniel |
752 |
$pdf->setXY($prod_left + 140, $prod_top + $offset - 5);
|
|
|
753 |
$pdf->Cell(37, 8, wpsg_ff($this->view['basket']['sum']['preis_gesamt_netto'], $this->get_option('wpsg_currency')), 0, 0, 'R');
|
|
|
754 |
|
|
|
755 |
if (sizeof($this->view['basket']['mwst']) >= 1)
|
|
|
756 |
{
|
|
|
757 |
|
|
|
758 |
foreach ($this->view['basket']['mwst'] as $mw)
|
|
|
759 |
{
|
|
|
760 |
|
|
|
761 |
$offset += 5;
|
7490 |
daniel |
762 |
$pdf->Text($prod_left + 80, $prod_top + $offset, __("MwSt. ", "wpsg").wpsg_ff($mw['value'], '%'));
|
5972 |
daniel |
763 |
$pdf->setXY($prod_left + 140, $prod_top + $offset - 5);
|
|
|
764 |
$pdf->Cell(37, 8, wpsg_ff($mw['sum'], $this->get_option('wpsg_currency')), 0, 0, 'R');
|
|
|
765 |
|
|
|
766 |
}
|
|
|
767 |
|
|
|
768 |
}
|
|
|
769 |
|
|
|
770 |
if (sizeof($this->view['basket']['mwst']) > 1)
|
|
|
771 |
{
|
|
|
772 |
|
|
|
773 |
$offset += 5;
|
7490 |
daniel |
774 |
$pdf->Text($prod_left + 80, $prod_top + $offset, __("MwSt. GESAMT", "wpsg"));
|
5972 |
daniel |
775 |
$pdf->setXY($prod_left + 140, $prod_top + $offset - 5);
|
|
|
776 |
$pdf->Cell(37, 8, wpsg_ff($this->view['basket']['sum']['preis_gesamt_brutto'] - $this->view['basket']['sum']['preis_gesamt_netto'], $this->get_option('wpsg_currency')), 0, 0, 'R');
|
|
|
777 |
|
|
|
778 |
}
|
|
|
779 |
|
|
|
780 |
}
|
|
|
781 |
|
|
|
782 |
}
|
|
|
783 |
|
|
|
784 |
// Rabatt
|
|
|
785 |
if ($this->view['basket']['sum']['preis_rabatt'] > 0)
|
|
|
786 |
{
|
|
|
787 |
|
|
|
788 |
$offset += 5;
|
|
|
789 |
|
7490 |
daniel |
790 |
$pdf->Text($prod_left + 80, $prod_top + $offset, __("Rabatt", "wpsg"));
|
5972 |
daniel |
791 |
$pdf->setXY($prod_left + 140, $prod_top + $offset - 5);
|
|
|
792 |
$pdf->Cell(37, 8, '-'.wpsg_ff($this->view['basket']['sum']['preis_rabatt'], $this->get_option('wpsg_currency')), 0, 0, 'R');
|
|
|
793 |
|
|
|
794 |
}
|
7244 |
thomas |
795 |
|
7490 |
daniel |
796 |
// Wertgutschein
|
|
|
797 |
if ($arCalculation['sum']['topay_brutto'] !== $arCalculation['sum']['brutto']) {
|
|
|
798 |
|
|
|
799 |
$offset += 5;
|
|
|
800 |
$pdf->Text($prod_left + 80, $prod_top + $offset, __("Bruttobetrag", "wpsg"));
|
|
|
801 |
$pdf->setXY($prod_left + 140, $prod_top + $offset - 5);
|
|
|
802 |
|
|
|
803 |
$pdf->setFont('Arial', '', '9');
|
|
|
804 |
$pdf->Cell(37, 8, wpsg_ff($this->view['basket']['sum']['preis_gesamt_brutto'], $this->get_option('wpsg_currency')), 0, 0, 'R');
|
|
|
805 |
$pdf->setFont('Arial', '', '9');
|
|
|
806 |
|
|
|
807 |
foreach ($arCalculation['coupon'] as $c) {
|
|
|
808 |
|
|
|
809 |
$offset += 5;
|
|
|
810 |
$pdf->Text($prod_left + 80, $prod_top + $offset, __('Wertgutschein', 'wpsg').' '.((wpsg_isSizedString($c['code']))?'('.$c['code'].')':''));
|
|
|
811 |
$pdf->setXY($prod_left + 140, $prod_top + $offset - 5);
|
|
|
812 |
|
|
|
813 |
$pdf->setFont('Arial', '', '9');
|
|
|
814 |
$pdf->Cell(37, 8, wpsg_ff($c[$taxdisplay], $this->get_option('wpsg_currency')), 0, 0, 'R');
|
|
|
815 |
$pdf->setFont('Arial', '', '9');
|
|
|
816 |
|
|
|
817 |
}
|
|
|
818 |
|
|
|
819 |
$offset += 5;
|
|
|
820 |
$pdf->setFont('Arial', 'B', '9');
|
|
|
821 |
$pdf->Text($prod_left + 80, $prod_top + $offset, __("SUMME", "wpsg"));
|
|
|
822 |
$pdf->setXY($prod_left + 140, $prod_top + $offset - 5);
|
|
|
823 |
|
|
|
824 |
/* Endbetrag wird fett ausgegeben */
|
|
|
825 |
$pdf->setFont('Arial', 'B', '9');
|
|
|
826 |
$pdf->Cell(37, 8, wpsg_ff($arCalculation['sum']['topay_brutto'], $this->get_option('wpsg_currency')), 0, 0, 'R');
|
|
|
827 |
$pdf->setFont('Arial', '', '9');
|
|
|
828 |
|
|
|
829 |
} else {
|
7244 |
thomas |
830 |
|
7490 |
daniel |
831 |
$offset += 5;
|
8007 |
daniel |
832 |
$pdf->Text($prod_left + 80, $prod_top + $offset, __("SUMME", "wpsg"));
|
7490 |
daniel |
833 |
$pdf->setXY($prod_left + 140, $prod_top + $offset - 5);
|
7244 |
thomas |
834 |
|
7490 |
daniel |
835 |
/* Endbetrag wird fett ausgegeben */
|
|
|
836 |
$pdf->setFont('Arial', 'B', '9');
|
|
|
837 |
$pdf->Cell(37, 8, wpsg_ff($this->view['basket']['sum']['preis_gesamt_brutto'], $this->get_option('wpsg_currency')), 0, 0, 'R');
|
|
|
838 |
$pdf->setFont('Arial', '', '9');
|
|
|
839 |
|
|
|
840 |
/* Endbetrag wird normal ausgegeben */
|
|
|
841 |
//$pdf->Cell(37, 8, wpsg_ff($this->view['basket']['sum']['preis_gesamt_brutto'], $this->get_option('wpsg_currency')), 0, 0, 'R');
|
|
|
842 |
|
|
|
843 |
}
|
|
|
844 |
|
5972 |
daniel |
845 |
if ($this->get_option('wpsg_kleinunternehmer') == '1')
|
|
|
846 |
{
|
|
|
847 |
|
|
|
848 |
$pdf->wpsg_MultiCell($prod_left - 1, $prod_top + $offset + 5, 5, $this->get_option('wpsg_kleinunternehmer_text'));
|
|
|
849 |
$offset += 15;
|
|
|
850 |
|
|
|
851 |
}
|
|
|
852 |
|
|
|
853 |
if ($this->hasMod('wpsg_mod_deliverynote'))
|
|
|
854 |
{
|
|
|
855 |
|
|
|
856 |
$arDN_order = $this->callMod('wpsg_mod_deliverynote', 'loadDeliveryNotesFromOrder', array($this->view['data']['id']));
|
|
|
857 |
$delivery_date = $this->callMod('wpsg_mod_deliverynote', 'getDeliveryTime', array($this->view['data']['id']));
|
|
|
858 |
|
|
|
859 |
// Wenn es ein Gesamtlieferdatum gibt und nur einen Lieferschein, dann unter der Bestellung anzeigen
|
|
|
860 |
if ($delivery_date !== false && sizeof($arDN_order) == 1)
|
|
|
861 |
{
|
|
|
862 |
|
|
|
863 |
$offset += 10;
|
|
|
864 |
|
|
|
865 |
$pdf->wpsg_MultiCell($prod_left, $prod_top + $offset, 5, wpsg_translate(__('Lieferung: #1#', 'wpsg'), date('d.m.Y', $delivery_date)));
|
|
|
866 |
|
|
|
867 |
$offset += 5;
|
|
|
868 |
|
|
|
869 |
}
|
|
|
870 |
|
|
|
871 |
}
|
|
|
872 |
|
|
|
873 |
$offset += 5;
|
|
|
874 |
|
|
|
875 |
if ($this->view['fussText'] != "")
|
|
|
876 |
{
|
|
|
877 |
|
|
|
878 |
//$pdf->wpsg_MultiCell($prod_left - 1, $prod_top + $offset, 5, utf8_encode($this->view['fussText']));
|
|
|
879 |
$pdf->wpsg_MultiCell($prod_left - 1, $prod_top + $offset, 5, $this->view['fussText']);
|
|
|
880 |
$pdf->SetFont('Arial', 'B', 9);
|
|
|
881 |
$offset += 10;
|
|
|
882 |
|
|
|
883 |
}
|
|
|
884 |
|
|
|
885 |
$shipping_adress = false;
|
|
|
886 |
|
|
|
887 |
if ($this->hasMod('wpsg_mod_shippingadress') && $this->callMod('wpsg_mod_shippingadress', 'check_different_shippingadress', array('k_id' => $this->view['data']['k_id'], 'o_id' => $this->view['data']['id'])))
|
|
|
888 |
{
|
|
|
889 |
|
|
|
890 |
$pdf->setFont('Arial', 'B', 9);
|
|
|
891 |
$pdf->Text($prod_left, $prod_top + $offset, __("Lieferanschrift", "wpsg").":");
|
|
|
892 |
$offset += 5;
|
|
|
893 |
|
|
|
894 |
$pdf->setFont('Arial', '', 9);
|
|
|
895 |
|
|
|
896 |
$shipping_adress = "";
|
|
|
897 |
if ($this->view['data']['shipping_firma'] != "")
|
|
|
898 |
{
|
|
|
899 |
$shipping_adress .= $this->view['data']['shipping_firma']."\r\n";
|
|
|
900 |
}
|
|
|
901 |
$shipping_adress .= $this->view['data']['shipping_vname'].' '.$this->view['data']['shipping_name']."\r\n";
|
|
|
902 |
$shipping_adress .= $this->view['data']['shipping_strasse']."\r\n";
|
|
|
903 |
//$shipping_adress .= $this->view['data']['shipping_land']['kuerzel'].'-';
|
|
|
904 |
|
|
|
905 |
$shipping_adress .= $this->view['data']['shipping_plz'].' '.$this->view['data']['shipping_ort']."\r\n";
|
|
|
906 |
$shipping_adress .= $this->view['data']['shipping_land']['name'];
|
|
|
907 |
|
|
|
908 |
|
|
|
909 |
$start = $pdf->getY();
|
|
|
910 |
$pdf->wpsg_MultiCell($prod_left - 1, $prod_top + $offset, 5, $shipping_adress, 0, 'L', 0, 100);
|
|
|
911 |
$offset += $pdf->getY() - $start;
|
|
|
912 |
|
|
|
913 |
$shipping_adress = true;
|
|
|
914 |
|
|
|
915 |
}
|
|
|
916 |
|
|
|
917 |
|
|
|
918 |
$offset += 5;
|
|
|
919 |
|
|
|
920 |
// Bestellvariablen
|
|
|
921 |
if ($this->hasMod('wpsg_mod_ordervars') && $this->get_option('wpsg_mod_rechnungen_showov') == '1')
|
|
|
922 |
{
|
|
|
923 |
|
|
|
924 |
$bvars = @unserialize($this->view['data']['bvars']);
|
|
|
925 |
if (!is_array($bvars)) $bvars = array();
|
|
|
926 |
|
|
|
927 |
$strBVars = "";
|
|
|
928 |
foreach ($bvars as $bvars_id => $bvars_value)
|
|
|
929 |
{
|
|
|
930 |
|
|
|
931 |
$bvars = $this->db->fetchRow("SELECT * FROM `".wpsg_q(WPSG_TBL_ORDERVARS)."` WHERE `id` = '".wpsg_q($bvars_id)."' ORDER BY `pos` ASC, `id` ASC ");
|
|
|
932 |
|
|
|
933 |
if ($bvars['typ'] == "1") // Auswahl
|
|
|
934 |
{
|
|
|
935 |
if ($bvars_value <= 0) $bvars_value = __("Keine Angabe", "wpsg");
|
|
|
936 |
}
|
|
|
937 |
else if ($bvars['typ'] == "2") // Texteingabe
|
|
|
938 |
{
|
|
|
939 |
if (trim($bvars_value) == "") $bvars_value = __("Keine Angabe", "wpsg");
|
|
|
940 |
}
|
|
|
941 |
else if ($bvars['typ'] == "3") // Checkbox
|
|
|
942 |
{
|
|
|
943 |
if ($bvars_value <= 0) $bvars_value = __("Keine Angabe", "wpsg");
|
|
|
944 |
}
|
|
|
945 |
|
|
|
946 |
$bvars_name = $this->callMod('wpsg_mod_ordervars', 'getNameById', array($bvars_id));
|
|
|
947 |
$strBVars .= "\r\n".$bvars_name.": ".$bvars_value;
|
|
|
948 |
|
|
|
949 |
}
|
|
|
950 |
|
|
|
951 |
$pdf->SetFont('Arial', 'B', 9);
|
|
|
952 |
$pdf->Text($prod_left, $prod_top + $offset, __("Angaben während der Bestellung", "wpsg").":");
|
|
|
953 |
$pdf->SetFont('Arial', '', 9);
|
|
|
954 |
$pdf->wpsg_MultiCell($prod_left - 1, $prod_top + $offset, 5, $strBVars);
|
|
|
955 |
|
|
|
956 |
}
|
|
|
957 |
|
|
|
958 |
if (!file_exists($this->callMod('wpsg_mod_rechnungen', 'getFilePath', array($this->view['data']['id']))))
|
|
|
959 |
{
|
|
|
960 |
|
|
|
961 |
mkdir($this->callMod('wpsg_mod_rechnungen', 'getFilePath', array($this->view['data']['id'])), 0777, true);
|
|
|
962 |
|
|
|
963 |
}
|
|
|
964 |
|
|
|
965 |
$this->callMods('wpsg_mod_rechnungen_pdf', array(&$pdf, &$this->view['data']['id'], &$this->view['preview'], &$this->view['invoice']));
|
|
|
966 |
|
|
|
967 |
$filename = $this->view['filename'].".pdf";
|
6901 |
daniel |
968 |
|
|
|
969 |
ob_end_clean();
|
|
|
970 |
|
8007 |
daniel |
971 |
if ($this->view['preview']) {
|
6901 |
daniel |
972 |
|
5972 |
daniel |
973 |
$pdf->Output($filename, 'I');
|
6901 |
daniel |
974 |
|
8007 |
daniel |
975 |
} else {
|
5972 |
daniel |
976 |
|
|
|
977 |
$pdf->Output($this->callMod('wpsg_mod_rechnungen', 'getFilePath', array($this->view['data']['id'])).$filename, 'F');
|
|
|
978 |
|
|
|
979 |
// Hier wird der Dateiname an FPD übergeben. Er soll sich aus der Rechnungsnummer ergeben, auch wenn das Dokument über die ID gespeichert ist.
|
8007 |
daniel |
980 |
$pdf->Output($this->view['filename_out'], 'I');
|
5972 |
daniel |
981 |
|
|
|
982 |
}
|
|
|
983 |
|