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