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