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