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