1093 |
daniel |
1 |
<?php
|
|
|
2 |
|
|
|
3 |
/**
|
|
|
4 |
* Template für die PDF Rechnung
|
|
|
5 |
*/
|
|
|
6 |
|
1228 |
daniel |
7 |
require_once dirname(__FILE__).'/../../../lib/fpdf/fpdf.php';
|
|
|
8 |
require_once dirname(__FILE__).'/../../../lib/fpdf/fpdi.php';
|
|
|
9 |
require_once dirname(__FILE__).'/../../../mods/mod_rechnungen/wpsg_fpdf.class.php';
|
1165 |
daniel |
10 |
|
1094 |
daniel |
11 |
global $absender_left, $absender_top, $adress_left, $adress_top, $rdata_left, $rdata_top;
|
1165 |
daniel |
12 |
|
1093 |
daniel |
13 |
// Positionierung der Absenderadresszeile
|
|
|
14 |
$absender_left = 25;
|
|
|
15 |
$absender_top = 50;
|
|
|
16 |
|
|
|
17 |
// Positionierung der Zieladress
|
|
|
18 |
$adress_left = 25;
|
|
|
19 |
$adress_top = 55;
|
|
|
20 |
|
|
|
21 |
// Positionierund des Rechnungskopfes
|
|
|
22 |
$rdata_left = 25;
|
|
|
23 |
$rdata_top = 90;
|
|
|
24 |
|
|
|
25 |
// Positionierung der Produktdaten
|
|
|
26 |
$prod_left = 25;
|
|
|
27 |
$prod_top = 105;
|
|
|
28 |
|
|
|
29 |
// Anzahl an Produkten pro Seite
|
|
|
30 |
$prod_break = 15;
|
1242 |
david |
31 |
|
1228 |
daniel |
32 |
if (!function_exists('AddRechnungPage'))
|
1093 |
daniel |
33 |
{
|
|
|
34 |
|
1228 |
daniel |
35 |
function AddRechnungPage($shop, $pdf)
|
1093 |
daniel |
36 |
{
|
|
|
37 |
|
1228 |
daniel |
38 |
global $absender_left, $absender_top, $adress_left, $adress_top, $rdata_left, $rdata_top;
|
1093 |
daniel |
39 |
|
1228 |
daniel |
40 |
$pdf->AddPage();
|
1093 |
daniel |
41 |
|
1228 |
daniel |
42 |
if (file_exists($shop->callMod('wpsg_mod_rechnungen', getFilePath, array(''))."wpsg_rechnungen_bp.pdf"))
|
|
|
43 |
{
|
|
|
44 |
|
|
|
45 |
$pagecount = $pdf->setSourceFile($shop->callMod('wpsg_mod_rechnungen', getFilePath, array(''))."wpsg_rechnungen_bp.pdf");
|
|
|
46 |
$tplidx = $pdf->importPage(1, '/MediaBox');
|
|
|
47 |
$pdf->useTemplate($tplidx, 0, 0, 210);
|
|
|
48 |
|
|
|
49 |
}
|
|
|
50 |
if (file_exists($shop->callMod('wpsg_mod_rechnungen', getFilePath, array(''))."wpsg_rechnungen_bp.jpg"))
|
|
|
51 |
{
|
|
|
52 |
$pdf->image($shop->callMod('wpsg_mod_rechnungen', getFilePath, array(''))."wpsg_rechnungen_bp.jpg", 0, 0, 210, 297, 'jpg');
|
|
|
53 |
}
|
1093 |
daniel |
54 |
|
|
|
55 |
|
1228 |
daniel |
56 |
if (file_exists($shop->callMod('wpsg_mod_rechnungen', getFilePath, array(''))."wpsg_rechnungen_logo.jpg"))
|
|
|
57 |
{
|
|
|
58 |
|
|
|
59 |
list($width, $height, $type, $attr) = getimagesize($shop->callMod('wpsg_mod_rechnungen', getFilePath, array(''))."wpsg_rechnungen_logo.jpg");
|
|
|
60 |
|
|
|
61 |
//wpsg_debug($width.":".$height);
|
|
|
62 |
|
|
|
63 |
$wPix = (25.4 * $width) / 96;
|
|
|
64 |
$hPix = (25.4 * $height) / 96;
|
|
|
65 |
|
|
|
66 |
$pdf->image($shop->callMod('wpsg_mod_rechnungen', getFilePath, array(''))."wpsg_rechnungen_logo.jpg", 210 - $wPix, 0, $wPix, $hPix);
|
|
|
67 |
|
|
|
68 |
}
|
1093 |
daniel |
69 |
|
1228 |
daniel |
70 |
// Absenderadresszeile (Wird in der Konfiguration hinterlegt)
|
|
|
71 |
$pdf->SetFont('Arial', '', 6);
|
|
|
72 |
$pdf->Text($absender_left, $absender_top, $shop->get_option("wpsg_rechnungen_adresszeile"));
|
1093 |
daniel |
73 |
|
1228 |
daniel |
74 |
if ($shop->view['kunde']['kuerzel'] != "") $shop->view['kunde']['kuerzel'] = $shop->view['kunde']['kuerzel'].'-';
|
1093 |
daniel |
75 |
|
1228 |
daniel |
76 |
// Adresse des Kunden
|
|
|
77 |
$pdf->SetFont('Arial', '', 12);
|
|
|
78 |
$pdf->Text($adress_left, $adress_top, $shop->view['kunde']['firma']);
|
|
|
79 |
$pdf->Text($adress_left, $adress_top + 5, $shop->view['kunde']['vname'].' '.$shop->view['kunde']['name']);
|
|
|
80 |
$pdf->Text($adress_left, $adress_top + 10, $shop->view['kunde']['strasse'].' '.$shop->view['kunde']['hausnr']);
|
|
|
81 |
$pdf->Text($adress_left, $adress_top + 15, ((isset($shop->view['kunde']['land']['kuerzel']))?$shop->view['kunde']['land']['kuerzel'].'-':'').$shop->view['kunde']['plz'].' '.$shop->view['kunde']['ort']);
|
1094 |
daniel |
82 |
|
1228 |
daniel |
83 |
// Wenn Gutschrift und Option aktiviert dann die Rechnungsnummer hinter die Gutschriftsnummer
|
|
|
84 |
if ($shop->get_option("wpsg_mod_rechnungen_showgutschriftrechnung") == "1" && $bGutschrift)
|
|
|
85 |
{
|
|
|
86 |
|
|
|
87 |
$shop->view['rnr'] .= ' ('.__("RNr.", "wpsg").' '.$shop->view['last_nr'].')';
|
|
|
88 |
|
|
|
89 |
}
|
1093 |
daniel |
90 |
|
1228 |
daniel |
91 |
// Rechnungsdaten
|
|
|
92 |
$pdf->SetFont('Arial', 'B', 16);
|
|
|
93 |
$pdf->Text($rdata_left, $rdata_top, $shop->view['title']);
|
|
|
94 |
$pdf->SetFont('Arial', 'B', 9);
|
|
|
95 |
$pdf->Text($rdata_left, $rdata_top + 6, $shop->view['rnr']);
|
|
|
96 |
$pdf->SetFont('Arial', '', 9);
|
|
|
97 |
|
|
|
98 |
if (isset($shop->view['faelligkeitdatum']))
|
|
|
99 |
{
|
|
|
100 |
|
|
|
101 |
$pdf->Text($rdata_left + 35, $rdata_top, __("Fällig am", "wpsg"));
|
|
|
102 |
$pdf->Text($rdata_left + 35, $rdata_top + 6, $shop->view['faelligkeitdatum']);
|
1093 |
daniel |
103 |
|
1228 |
daniel |
104 |
}
|
|
|
105 |
if (isset($shop->view['payment']))
|
|
|
106 |
{
|
1093 |
daniel |
107 |
|
1228 |
daniel |
108 |
$pdf->Text($rdata_left + 55, $rdata_top, __("Zahlungsbedingungen", "wpsg"));
|
|
|
109 |
$pdf->Text($rdata_left + 55, $rdata_top + 6, $shop->view['payment']);
|
|
|
110 |
|
|
|
111 |
}
|
1093 |
daniel |
112 |
|
1228 |
daniel |
113 |
$pdf->Text($rdata_left + 100, $rdata_top, __("Kunden-Nr", "wpsg"));
|
|
|
114 |
$pdf->Text($rdata_left + 100, $rdata_top + 6, (($shop->view['kunde']['knr'] != '')?$shop->view['kunde']['knr']:$shop->view['kunde']['id']));
|
1093 |
daniel |
115 |
|
1228 |
daniel |
116 |
$pdf->Text($rdata_left + 125, $rdata_top, __("Best. Nr.", "wpsg"));
|
|
|
117 |
$pdf->Text($rdata_left + 125, $rdata_top + 6, ((trim($shop->view['data']['onr']) != '')?$shop->view['data']['onr']:$shop->view['data']['id']));
|
|
|
118 |
|
|
|
119 |
$pdf->Text($rdata_left + 145, $rdata_top, __("Datum", "wpsg"));
|
|
|
120 |
$pdf->Text($rdata_left + 145, $rdata_top + 6, $shop->view['rDatum']);
|
|
|
121 |
|
|
|
122 |
if ($shop->view['basket']['noMwSt'] == '1')
|
1093 |
daniel |
123 |
{
|
|
|
124 |
|
1228 |
daniel |
125 |
$pdf->SetFont('Arial', '', 9);
|
|
|
126 |
$pdf->Text($adress_left, $rdata_top + 11.5, __("Innergemeinschaftliche Lieferung.", "wpsg"));
|
1093 |
daniel |
127 |
|
|
|
128 |
}
|
|
|
129 |
|
1228 |
daniel |
130 |
// Benutzerdefinierte Felder
|
|
|
131 |
$arTexte = $shop->get_option("wpsg_mod_rechnungen_texte");
|
|
|
132 |
|
|
|
133 |
foreach ((array)$arTexte as $text)
|
|
|
134 |
{
|
|
|
135 |
|
|
|
136 |
if (isset($text['aktiv']) && $text['aktiv'] == 1)
|
|
|
137 |
{
|
|
|
138 |
|
|
|
139 |
$pdf->SetFont('Arial', 'B', ((intval($text['fontsize']) > 0)?intval($text['fontsize']):10));
|
|
|
140 |
$pdf->SetTextColor($text['color']);
|
|
|
141 |
$pdf->MultiCell($text['x'], $text['y'], 5, utf8_encode($text['text']));
|
|
|
142 |
$pdf->SetTextColor("#000000");
|
|
|
143 |
|
|
|
144 |
}
|
|
|
145 |
|
|
|
146 |
}
|
|
|
147 |
|
1093 |
daniel |
148 |
}
|
|
|
149 |
|
|
|
150 |
}
|
1242 |
david |
151 |
//wpsg_debug($this->view); die();
|
1093 |
daniel |
152 |
$pdf = new wpsg_fpdf();
|
|
|
153 |
$pdf->SetAutoPageBreak(true, 5);
|
|
|
154 |
AddRechnungPage($this, $pdf);
|
|
|
155 |
|
|
|
156 |
$summe = 0;
|
|
|
157 |
|
|
|
158 |
$bKopf = false; $pnr = 1; $offset = 0; $count = 0;
|
|
|
159 |
foreach ($this->view['basket']['produkte'] as $p)
|
|
|
160 |
{
|
|
|
161 |
|
|
|
162 |
if (!$bKopf)
|
|
|
163 |
{
|
|
|
164 |
|
|
|
165 |
$pdf->SetFont('Arial', 'B', 9);
|
|
|
166 |
$pdf->setXY($prod_left, $prod_top);
|
|
|
167 |
$pdf->Cell(10, 8, __("Nr.", "wpsg"), 1, 0, 'C');
|
|
|
168 |
|
|
|
169 |
$pdf->setXY($prod_left + 10, $prod_top);
|
1157 |
daniel |
170 |
$pdf->Cell( ((sizeof($this->view['basket']['mwst']) >= 1 || $this->get_option('wpsg_showMwstAlways') == '1')?87:102), 8, "Name", 1, 0, 'L');
|
1093 |
daniel |
171 |
|
1157 |
daniel |
172 |
if (sizeof($this->view['basket']['mwst']) >= 1 || $this->get_option('wpsg_showMwstAlways') == '1')
|
1093 |
daniel |
173 |
{
|
|
|
174 |
|
|
|
175 |
$pdf->setXY($prod_left + 97, $prod_top);
|
|
|
176 |
$pdf->Cell(15, 8, __("MwSt.", "wpsg"), 1, 0, 'R');
|
|
|
177 |
|
|
|
178 |
}
|
|
|
179 |
|
|
|
180 |
$pdf->setXY($prod_left + 112, $prod_top);
|
|
|
181 |
$pdf->Cell(15, 8, __("Menge", "wpsg"), 1, 0, 'C');
|
|
|
182 |
|
|
|
183 |
$pdf->setXY($prod_left + 127, $prod_top);
|
|
|
184 |
$pdf->Cell(25, 8, __("Einzelpreis", "wpsg"), 1, 0, 'R');
|
|
|
185 |
|
|
|
186 |
$pdf->setXY($prod_left + 152, $prod_top);
|
|
|
187 |
$pdf->Cell(25, 8, __("Gesamtpreis", "wpsg"), 1, 0, 'R');
|
|
|
188 |
|
|
|
189 |
$offset = 8;
|
|
|
190 |
$bKopf = true;
|
|
|
191 |
|
|
|
192 |
}
|
|
|
193 |
|
|
|
194 |
$pdf->SetFont('Arial', '', 9);
|
|
|
195 |
$pdf->setXY($prod_left, $prod_top + $offset);
|
|
|
196 |
$pdf->Cell(10, 8, $pnr.".", 0, 0, 'C');
|
|
|
197 |
|
|
|
198 |
$produkt_text = $p['name'];
|
|
|
199 |
$produktBeschreibung = trim(strip_tags($p['beschreibung']));
|
|
|
200 |
|
|
|
201 |
if ($this->isOtherLang())
|
|
|
202 |
{
|
|
|
203 |
|
|
|
204 |
/*
|
|
|
205 |
* TODO: Übersetzung
|
|
|
206 |
$trans_db = $this->controller->db->fetchRow("SELECT * FROM `".$this->controller->tbl_pr."` WHERE `lang_parent` = '".wpsg_q($p['produkt_id'])."' AND `lang_locale` = '".wpsg_q(get_locale())."'");
|
|
|
207 |
if (is_array($trans_db) && sizeof($trans_db) > 0)
|
|
|
208 |
{
|
|
|
209 |
|
|
|
210 |
$produkt_text = $trans_db['name'];
|
|
|
211 |
$produktBeschreibung = trim(strip_tags($p['beschreibung']));
|
|
|
212 |
|
|
|
213 |
}
|
|
|
214 |
*/
|
|
|
215 |
|
|
|
216 |
}
|
|
|
217 |
|
|
|
218 |
$height = 0; // Höhe der Zeile für den Rahmen
|
|
|
219 |
|
|
|
220 |
$pdf->setXY($prod_left + 10, $prod_top + $offset);
|
|
|
221 |
|
|
|
222 |
// Produktvariablen
|
|
|
223 |
// TODO:Produktvariablen in Rechnung
|
|
|
224 |
/*
|
|
|
225 |
if (array_key_exists("mod_produktvars", $this->controller->mods) && get_option("wpsg_mod_rechnungen_showpv") == "1")
|
|
|
226 |
{
|
|
|
227 |
|
|
|
228 |
if (array_key_exists("mod_produktvars", $this->controller->mods))
|
|
|
229 |
{
|
|
|
230 |
|
|
|
231 |
$pvars = @unserialize($this->order['pvars']);
|
|
|
232 |
if (!is_array($pvars)) $pvars = array();
|
|
|
233 |
|
|
|
234 |
if (array_key_exists($p['produkt_id'], $pvars))
|
|
|
235 |
{
|
|
|
236 |
|
|
|
237 |
foreach ($pvars[$p['produkt_id']] as $pvars_id => $pvars_value)
|
|
|
238 |
{
|
|
|
239 |
|
|
|
240 |
$pvars_name = $this->controller->mods['mod_produktvars']->getNameFromID($pvars_id);
|
|
|
241 |
|
|
|
242 |
$produkt_text .= "\r\n".$pvars_name.": ".$pvars_value;
|
|
|
243 |
$height += 5;
|
|
|
244 |
|
|
|
245 |
}
|
|
|
246 |
|
|
|
247 |
}
|
|
|
248 |
|
|
|
249 |
}
|
|
|
250 |
|
|
|
251 |
}
|
|
|
252 |
*/
|
|
|
253 |
|
|
|
254 |
$produkt_text_width = $pdf->GetStringWidth($produkt_text);
|
1125 |
daniel |
255 |
$produkt_text_cell_width = (($this->arMwSt == "-1")?87:102);
|
1093 |
daniel |
256 |
|
|
|
257 |
$height = 5 * ceil($produkt_text_width / $produkt_text_cell_width) + 3;
|
|
|
258 |
|
|
|
259 |
$pdf->MultiCell($prod_left + 10, $prod_top + $offset + 1.5, 5, utf8_encode($produkt_text), 0, 'L', 0, $produkt_text_cell_width);
|
|
|
260 |
//$pdf->Cell((($this->arMwSt == "-1")?102:87), 8, $produkt_text, 0, 0, 'L');
|
|
|
261 |
|
1157 |
daniel |
262 |
if (sizeof($this->view['basket']['mwst']) >= 1 || $this->get_option('wpsg_showMwstAlways') == '1')
|
1093 |
daniel |
263 |
{
|
|
|
264 |
|
|
|
265 |
$pdf->setXY($prod_left + 97, $prod_top + $offset);
|
1165 |
daniel |
266 |
$pdf->Cell(15, 8, (($this->view['basket']['noMwSt'] == '1')?'0.00 %':wpsg_ff($p['mwst_value'], '%')), 0, 0, 'R');
|
1093 |
daniel |
267 |
|
|
|
268 |
}
|
|
|
269 |
|
|
|
270 |
$pdf->setXY($prod_left + 112, $prod_top + $offset);
|
|
|
271 |
$pdf->Cell(15, 8, $p['menge'], 0, 0, 'C');
|
|
|
272 |
|
1170 |
daniel |
273 |
// Preis eines Produktes
|
|
|
274 |
if ($this->view['basket']['noMwSt'] == '1')
|
1093 |
daniel |
275 |
{
|
1170 |
daniel |
276 |
|
|
|
277 |
// Innergemeinschaftliche Lieferung, hier Netto Preis
|
|
|
278 |
$preis = $p['preis_netto'];
|
|
|
279 |
|
1093 |
daniel |
280 |
}
|
|
|
281 |
else
|
|
|
282 |
{
|
1170 |
daniel |
283 |
|
|
|
284 |
if ($this->get_option('wpsg_preisangaben_frontend') == WPSG_BRUTTO || $this->get_option('wpsg_kleinunternehmer') == '1')
|
|
|
285 |
{
|
|
|
286 |
$preis = $p['preis_brutto'];
|
|
|
287 |
}
|
|
|
288 |
else
|
|
|
289 |
{
|
|
|
290 |
$preis = $p['preis_netto'];
|
|
|
291 |
}
|
|
|
292 |
|
1093 |
daniel |
293 |
}
|
|
|
294 |
|
|
|
295 |
$pdf->setXY($prod_left + 127, $prod_top + $offset);
|
|
|
296 |
$pdf->Cell(25, 8, wpsg_ff($preis, $this->get_option('wpsg_currency')), 0, 0, 'R');
|
|
|
297 |
|
|
|
298 |
$pdf->setXY($prod_left + 152, $prod_top + $offset);
|
|
|
299 |
$pdf->Cell(25, 8, wpsg_ff($preis * $p['menge'], $this->get_option('wpsg_currency')), 0, 0, 'R');
|
|
|
300 |
|
|
|
301 |
/**
|
|
|
302 |
* Produktbeschreibung anzeigen Ja/Nein
|
|
|
303 |
*/
|
|
|
304 |
$pBeschreibungHeight = 0;
|
|
|
305 |
if ($this->get_option("wpsg_rechnungen_pbeschreibung") == "1" && trim(strip_tags($p['beschreibung'])) != '')
|
|
|
306 |
{
|
|
|
307 |
|
1237 |
daniel |
308 |
$produktBeschreibung = nl2br($produktBeschreibung);
|
|
|
309 |
preg_match_all('/\<br \/\>/', $produktBeschreibung, $treffer);
|
|
|
310 |
$produktBeschreibung = strip_tags($produktBeschreibung);
|
|
|
311 |
|
1093 |
daniel |
312 |
$pBeschreibungWidth = $pdf->getStringWidth($produktBeschreibung);
|
1237 |
daniel |
313 |
$pBeschreibungHeight = 5 * (ceil($pBeschreibungWidth / $produkt_text_cell_width) + @sizeof($treffer[0]));
|
1093 |
daniel |
314 |
|
|
|
315 |
$pdf->SetFont('Arial', 'I', 9);
|
|
|
316 |
$pdf->MultiCell($prod_left + 10, $prod_top + $height + $offset - 1.5, 5, utf8_encode($produktBeschreibung), 0, 'L', 0, $produkt_text_cell_width);
|
|
|
317 |
$pdf->SetFont('Arial', '', 9);
|
|
|
318 |
|
|
|
319 |
}
|
|
|
320 |
|
|
|
321 |
$height += $pBeschreibungHeight;
|
1125 |
daniel |
322 |
|
|
|
323 |
/**
|
|
|
324 |
* Variante ?
|
|
|
325 |
*/
|
|
|
326 |
if (preg_match('/vp_(.*)/', $p['id']))
|
|
|
327 |
{
|
|
|
328 |
|
|
|
329 |
$variInfo = $this->callMod('wpsg_mod_varianten', 'getVariantenInfoArray', array($p['id']));
|
|
|
330 |
|
|
|
331 |
$pdf->MultiCell($prod_left + 10, $prod_top + $height + $offset - 1.5, 5, utf8_encode(wpsg_translate(__('Variante: #1#', 'wpsg'), $variInfo['key'])), 0, 'L', 0, $produkt_text_cell_width);
|
|
|
332 |
|
|
|
333 |
$height += 5;
|
|
|
334 |
|
|
|
335 |
}
|
1093 |
daniel |
336 |
|
|
|
337 |
// Jetzt die Rahmen zeichnen
|
|
|
338 |
$pdf->Rect($prod_left, $prod_top + $offset, 10, $height);
|
|
|
339 |
|
1157 |
daniel |
340 |
$pdf->Rect($prod_left + 10, $prod_top + $offset, ((sizeof($this->view['basket']['mwst']) >= 1 || $this->get_option('wpsg_showMwstAlways') == '1')?87:102), $height);
|
1093 |
daniel |
341 |
|
1157 |
daniel |
342 |
if (sizeof($this->view['basket']['mwst']) >= 1 || $this->get_option('wpsg_showMwstAlways') == '1')
|
1093 |
daniel |
343 |
{
|
|
|
344 |
|
|
|
345 |
$pdf->Rect($prod_left + 97, $prod_top + $offset, 15, $height);
|
|
|
346 |
|
|
|
347 |
}
|
|
|
348 |
|
|
|
349 |
$pdf->Rect($prod_left + 112, $prod_top + $offset, 15, $height);
|
|
|
350 |
$pdf->Rect($prod_left + 127, $prod_top + $offset, 25, $height);
|
|
|
351 |
$pdf->Rect($prod_left + 152, $prod_top + $offset, 25, $height);
|
|
|
352 |
|
|
|
353 |
$offset += $height;
|
|
|
354 |
|
|
|
355 |
$pnr ++;
|
|
|
356 |
$count ++;
|
|
|
357 |
|
|
|
358 |
$summe += $p['price'] * $p['menge'];
|
|
|
359 |
|
|
|
360 |
if ($count >= $prod_break && sizeof($this->view['basket']['produkte']) > ($pnr - 1))
|
|
|
361 |
{
|
|
|
362 |
|
|
|
363 |
AddRechnungPage($this, $pdf);
|
|
|
364 |
$bKopf = false; $offset = 0; $count = 0;
|
|
|
365 |
|
|
|
366 |
}
|
|
|
367 |
|
1094 |
daniel |
368 |
} // produkte
|
|
|
369 |
|
|
|
370 |
// Versandkosten
|
1160 |
daniel |
371 |
if ($this->view['basket']['sum']['preis_shipping'] != '' && $this->view['basket']['sum']['preis_shipping'] > 0)
|
1094 |
daniel |
372 |
{
|
|
|
373 |
|
|
|
374 |
$pdf->SetFont('Arial', '', 9);
|
|
|
375 |
$pdf->setXY($prod_left, $prod_top + $offset);
|
|
|
376 |
$pdf->Cell(10, 8, $pnr.'.', 1, 0, 'C'); $pnr ++;
|
|
|
377 |
|
|
|
378 |
$pdf->setXY($prod_left + 10, $prod_top + $offset);
|
1416 |
daniel |
379 |
$pdf->Cell( ((sizeof($this->view['basket']['mwst']) >= 1 || $this->get_option('wpsg_showMwstAlways') == '1')?87:102), 8, wpsg_translate(__('Versandkosten "#1#"', 'wpsg'), $this->arShipping[$this->view['data']['type_shipping']]['name']), 1, 0, 'L');
|
1094 |
daniel |
380 |
|
1157 |
daniel |
381 |
if (sizeof($this->view['basket']['mwst']) >= 1 || $this->get_option('wpsg_showMwstAlways') == '1')
|
1094 |
daniel |
382 |
{
|
|
|
383 |
|
1165 |
daniel |
384 |
if ($this->arShipping[$this->view['data']['type_shipping']]['mwst_null'] == '1' && $this->view['basket']['noMwSt'] == '1')
|
|
|
385 |
{
|
1416 |
daniel |
386 |
|
1165 |
daniel |
387 |
$mwst = 0;
|
1416 |
daniel |
388 |
|
1165 |
daniel |
389 |
}
|
|
|
390 |
else
|
|
|
391 |
{
|
1416 |
daniel |
392 |
|
|
|
393 |
if ($this->arShipping[$this->view['data']['type_shipping']]['mwst'] == '0')
|
|
|
394 |
{
|
|
|
395 |
|
|
|
396 |
$mwst = __('Anteilig', 'wpsg');
|
|
|
397 |
|
|
|
398 |
}
|
|
|
399 |
else
|
|
|
400 |
{
|
|
|
401 |
|
|
|
402 |
$mwst = wpsg_ff($this->arShipping[$this->view['data']['type_shipping']]['mwst_value'], '%');
|
|
|
403 |
|
|
|
404 |
}
|
|
|
405 |
|
1165 |
daniel |
406 |
}
|
|
|
407 |
|
1094 |
daniel |
408 |
$pdf->setXY($prod_left + 97, $prod_top + $offset);
|
1416 |
daniel |
409 |
$pdf->Cell(15, 8, $mwst, 1, 0, 'R');
|
1094 |
daniel |
410 |
|
|
|
411 |
}
|
|
|
412 |
|
|
|
413 |
$pdf->setXY($prod_left + 112, $prod_top + $offset);
|
|
|
414 |
$pdf->Cell(15, 8, '1', 1, 0, 'C');
|
|
|
415 |
|
|
|
416 |
$pdf->setXY($prod_left + 127, $prod_top + $offset);
|
|
|
417 |
$pdf->Cell(25, 8, wpsg_ff($this->view['basket']['sum']['preis_shipping_netto'], $this->get_option('wpsg_currency')), 1, 0, 'R');
|
|
|
418 |
|
|
|
419 |
$pdf->setXY($prod_left + 152, $prod_top + $offset);
|
|
|
420 |
$pdf->Cell(25, 8, wpsg_ff($this->view['basket']['sum']['preis_shipping_netto'], $this->get_option('wpsg_currency')), 1, 0, 'R');
|
|
|
421 |
|
|
|
422 |
$offset += 8;
|
|
|
423 |
|
1093 |
daniel |
424 |
}
|
1094 |
daniel |
425 |
|
|
|
426 |
// Zahlungskosten
|
1160 |
daniel |
427 |
if ($this->view['basket']['sum']['preis_payment'] != '' && $this->view['basket']['sum']['preis_payment'] > 0)
|
1094 |
daniel |
428 |
{
|
|
|
429 |
|
|
|
430 |
$pdf->SetFont('Arial', '', 9);
|
|
|
431 |
$pdf->setXY($prod_left, $prod_top + $offset);
|
|
|
432 |
$pdf->Cell(10, 8, $pnr.'.', 1, 0, 'C'); $pnr ++;
|
|
|
433 |
|
|
|
434 |
$pdf->setXY($prod_left + 10, $prod_top + $offset);
|
1157 |
daniel |
435 |
$pdf->Cell( ((sizeof($this->view['basket']['mwst']) >= 1 || $this->get_option('wpsg_showMwstAlways') == '1')?87:102), 8, $this->arPayment[$this->view['data']['type_payment']]['name'], 1, 0, 'L');
|
1094 |
daniel |
436 |
|
1157 |
daniel |
437 |
if (sizeof($this->view['basket']['mwst']) >= 1 || $this->get_option('wpsg_showMwstAlways') == '1')
|
1094 |
daniel |
438 |
{
|
|
|
439 |
|
1165 |
daniel |
440 |
if ($this->arPayment[$this->view['data']['type_payment']]['mwst_null'] == '1' && $this->view['basket']['noMwSt'] == '1')
|
|
|
441 |
{
|
|
|
442 |
$mwst = 0;
|
|
|
443 |
}
|
|
|
444 |
else
|
|
|
445 |
{
|
|
|
446 |
$mwst = $this->arPayment[$this->view['data']['type_payment']]['mwst_value'];
|
|
|
447 |
}
|
|
|
448 |
|
1094 |
daniel |
449 |
$pdf->setXY($prod_left + 97, $prod_top + $offset);
|
1165 |
daniel |
450 |
$pdf->Cell(15, 8, wpsg_ff($mwst, '%'), 1, 0, 'R');
|
1094 |
daniel |
451 |
|
|
|
452 |
}
|
|
|
453 |
|
|
|
454 |
$pdf->setXY($prod_left + 112, $prod_top + $offset);
|
|
|
455 |
$pdf->Cell(15, 8, '1', 1, 0, 'C');
|
|
|
456 |
|
|
|
457 |
$pdf->setXY($prod_left + 127, $prod_top + $offset);
|
|
|
458 |
$pdf->Cell(25, 8, wpsg_ff($this->view['basket']['sum']['preis_payment'], $this->get_option('wpsg_currency')), 1, 0, 'R');
|
|
|
459 |
|
|
|
460 |
$pdf->setXY($prod_left + 152, $prod_top + $offset);
|
|
|
461 |
$pdf->Cell(25, 8, wpsg_ff($this->view['basket']['sum']['preis_payment'], $this->get_option('wpsg_currency')), 1, 0, 'R');
|
|
|
462 |
|
|
|
463 |
$offset += 8;
|
|
|
464 |
|
|
|
465 |
}
|
1093 |
daniel |
466 |
|
|
|
467 |
$pdf->SetFont('Arial', '', 9);
|
|
|
468 |
|
|
|
469 |
if ($this->view['kunde']['ustidnr'] != "")
|
|
|
470 |
{
|
|
|
471 |
$offset += 10;
|
|
|
472 |
$pdf->Text($prod_left, $prod_top + $offset, __("Ihre Umsatzsteuer-Identifikationsnummer:", "wpsg"));
|
|
|
473 |
$pdf->setXY($prod_left + 140, $prod_top + $offset - 5);
|
|
|
474 |
$pdf->Cell(37, 8, $this->view['kunde']['ustidnr'], 0, 0, 'R');
|
|
|
475 |
}
|
|
|
476 |
|
|
|
477 |
$offset += 10;
|
1628 |
david |
478 |
if ($this->view['basket']['noMwSt'] == '1')
|
1093 |
daniel |
479 |
{
|
|
|
480 |
|
|
|
481 |
$pdf->Text($prod_left, $prod_top + $offset, __("Es ergibt sich folgender Gesamtbetrag", "wpsg").':');
|
|
|
482 |
$pdf->Text($prod_left + 100, $prod_top + $offset, __("BRUTTOBETRAG", "wpsg"));
|
|
|
483 |
$pdf->setXY($prod_left + 140, $prod_top + $offset - 5);
|
1165 |
daniel |
484 |
$pdf->Cell(37, 8, wpsg_ff($this->view['basket']['sum']['preis_gesamt_netto'], $this->get_option('wpsg_currency')), 0, 0, 'R');
|
|
|
485 |
$offset += 5;
|
1093 |
daniel |
486 |
|
1168 |
daniel |
487 |
$pdf->Text($prod_left + 100, $prod_top + $offset, __("MwSt. GESAMT", "wpsg"));
|
|
|
488 |
$pdf->setXY($prod_left + 140, $prod_top + $offset - 5);
|
|
|
489 |
$pdf->Cell(37, 8, wpsg_ff(0, $this->get_option('wpsg_currency')), 0, 0, 'R');
|
1330 |
daniel |
490 |
|
1093 |
daniel |
491 |
}
|
1628 |
david |
492 |
elseif (!$this->get_option('wpsg_kleinunternehmer'))
|
1093 |
daniel |
493 |
{
|
1125 |
daniel |
494 |
|
1093 |
daniel |
495 |
$pdf->Text($prod_left, $prod_top + $offset, __("Der Gesamtbetrag setzt sich wie folgt zusammen", "wpsg"));
|
|
|
496 |
|
1125 |
daniel |
497 |
$pdf->Text($prod_left + 100, $prod_top + $offset, __("NETTOBETRAG", "wpsg"));
|
|
|
498 |
$pdf->setXY($prod_left + 140, $prod_top + $offset - 5);
|
|
|
499 |
$pdf->Cell(37, 8, wpsg_ff($this->view['basket']['sum']['preis_netto'] + $this->view['basket']['sum']['preis_payment'] + $this->view['basket']['sum']['preis_shipping_netto'], $this->get_option('wpsg_currency')), 0, 0, 'R');
|
1093 |
daniel |
500 |
|
1163 |
daniel |
501 |
if (sizeof($this->view['basket']['mwst']) > 1)
|
1093 |
daniel |
502 |
{
|
|
|
503 |
|
|
|
504 |
foreach ($this->view['basket']['mwst'] as $mw)
|
|
|
505 |
{
|
|
|
506 |
|
|
|
507 |
$offset += 5;
|
|
|
508 |
$pdf->Text($prod_left + 100, $prod_top + $offset, __("MwSt. ", "wpsg").$mw['value'].'%');
|
|
|
509 |
$pdf->setXY($prod_left + 140, $prod_top + $offset - 5);
|
|
|
510 |
$pdf->Cell(37, 8, wpsg_ff($mw['sum'], $this->get_option('wpsg_currency')), 0, 0, 'R');
|
|
|
511 |
|
|
|
512 |
}
|
|
|
513 |
|
|
|
514 |
}
|
|
|
515 |
|
|
|
516 |
$offset += 5;
|
|
|
517 |
$pdf->Text($prod_left + 100, $prod_top + $offset, __("MwSt. GESAMT", "wpsg"));
|
|
|
518 |
$pdf->setXY($prod_left + 140, $prod_top + $offset - 5);
|
|
|
519 |
$pdf->Cell(37, 8, wpsg_ff($this->view['basket']['sum']['mwst'], $this->get_option('wpsg_currency')), 0, 0, 'R');
|
|
|
520 |
|
|
|
521 |
}
|
1628 |
david |
522 |
else
|
|
|
523 |
{
|
|
|
524 |
|
|
|
525 |
$pdf->Text($prod_left, $prod_top + $offset, __("Es ergibt sich folgender Gesamtbetrag", "wpsg").':');
|
|
|
526 |
$pdf->Text($prod_left + 100, $prod_top + $offset, __("BRUTTOBETRAG", "wpsg"));
|
|
|
527 |
$pdf->setXY($prod_left + 140, $prod_top + $offset - 5);
|
|
|
528 |
$pdf->Cell(37, 8, wpsg_ff($this->view['basket']['sum']['preis_brutto'], $this->get_option('wpsg_currency')), 0, 0, 'R');
|
|
|
529 |
$offset += 5;
|
|
|
530 |
|
|
|
531 |
}
|
1327 |
daniel |
532 |
|
|
|
533 |
// Rabatt
|
|
|
534 |
if ($this->view['basket']['sum']['preis_rabatt'] > 0)
|
|
|
535 |
{
|
|
|
536 |
|
|
|
537 |
$offset += 5;
|
|
|
538 |
|
|
|
539 |
$pdf->Text($prod_left + 100, $prod_top + $offset, __("Rabatt", "wpsg"));
|
|
|
540 |
$pdf->setXY($prod_left + 140, $prod_top + $offset - 5);
|
|
|
541 |
$pdf->Cell(37, 8, wpsg_ff($this->view['basket']['sum']['preis_rabatt'], $this->get_option('wpsg_currency')), 0, 0, 'R');
|
|
|
542 |
|
|
|
543 |
}
|
1330 |
daniel |
544 |
|
|
|
545 |
$offset += 5;
|
|
|
546 |
$pdf->Text($prod_left + 100, $prod_top + $offset, __("SUMME", "wpsg"));
|
|
|
547 |
$pdf->setXY($prod_left + 140, $prod_top + $offset - 5);
|
|
|
548 |
$pdf->Cell(37, 8, wpsg_ff($this->view['basket']['sum']['preis_gesamt_brutto'], $this->get_option('wpsg_currency')), 0, 0, 'R');
|
1093 |
daniel |
549 |
|
|
|
550 |
if ($this->get_option('wpsg_kleinunternehmer') == '1')
|
|
|
551 |
{
|
|
|
552 |
|
|
|
553 |
$pdf->MultiCell($prod_left - 1, $prod_top + $offset + 5, 5, utf8_encode(__('Alle angegebenen Preise sind Endpreise zzgl. Liefer-/Versandkosten. Aufgrund des Kleinunternehmerstatus gemäß § 19 UStG erhebe ich keine Umsatzsteuer und weise diese daher auch nicht aus.', 'wpsg')));
|
|
|
554 |
$offset += 15;
|
|
|
555 |
|
|
|
556 |
}
|
|
|
557 |
|
|
|
558 |
$offset += 5;
|
|
|
559 |
|
|
|
560 |
if ($this->view['fussText'] != "")
|
|
|
561 |
{
|
|
|
562 |
|
|
|
563 |
$pdf->MultiCell($prod_left - 1, $prod_top + $offset, 5, utf8_encode($this->view['fussText']));
|
|
|
564 |
$pdf->SetFont('Arial', 'B', 9);
|
|
|
565 |
$offset += 10;
|
|
|
566 |
|
|
|
567 |
}
|
1242 |
david |
568 |
|
1093 |
daniel |
569 |
$shipping_adress = false;
|
1610 |
david |
570 |
|
|
|
571 |
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'])))
|
1093 |
daniel |
572 |
{
|
|
|
573 |
|
|
|
574 |
$pdf->setFont('Arial', 'B', 9);
|
|
|
575 |
$pdf->Text($prod_left, $prod_top + $offset, __("Lieferanschrift", "wpsg").":");
|
|
|
576 |
$offset += 5;
|
|
|
577 |
|
|
|
578 |
$pdf->setFont('Arial', '', 9);
|
|
|
579 |
|
|
|
580 |
$shipping_adress = "";
|
1242 |
david |
581 |
if ($this->view['data']['shipping_firma'] != "")
|
1093 |
daniel |
582 |
{
|
1242 |
david |
583 |
$shipping_adress .= $this->view['data']['shipping_firma']."\r\n";
|
1093 |
daniel |
584 |
}
|
1242 |
david |
585 |
$shipping_adress .= $this->view['data']['shipping_vname'].' '.$this->view['data']['shipping_name']."\r\n";
|
|
|
586 |
$shipping_adress .= $this->view['data']['shipping_strasse']."\r\n";
|
|
|
587 |
$shipping_adress .= $this->view['data']['shipping_land']['kuerzel'].'-';
|
1093 |
daniel |
588 |
|
1242 |
david |
589 |
$shipping_adress .= $this->view['data']['shipping_plz'].' '.$this->view['data']['shipping_ort'];
|
1093 |
daniel |
590 |
|
|
|
591 |
$start = $pdf->getY();
|
|
|
592 |
$pdf->MultiCell($prod_left - 1, $prod_top + $offset, 5, utf8_encode($shipping_adress), 0, 'L', 0, 100);
|
|
|
593 |
$offset += $pdf->getY() - $start;
|
1242 |
david |
594 |
|
1093 |
daniel |
595 |
$shipping_adress = true;
|
|
|
596 |
|
|
|
597 |
}
|
1242 |
david |
598 |
|
1093 |
daniel |
599 |
|
|
|
600 |
$offset += 5;
|
|
|
601 |
|
|
|
602 |
// Bestellvariablen
|
|
|
603 |
// TODO: Bestellvariablen in Rechnung
|
|
|
604 |
/*
|
|
|
605 |
if (array_key_exists("mod_bestellvars", $this->controller->mods) && get_option("wpsg_mod_rechnungen_showov") == "1")
|
|
|
606 |
{
|
|
|
607 |
|
|
|
608 |
$bvars = @unserialize($this->order['bvars']);
|
|
|
609 |
if (!is_array($bvars)) $bvars = array();
|
|
|
610 |
|
|
|
611 |
$strBVars = "";
|
|
|
612 |
foreach ($bvars as $bvars_id => $bvars_value)
|
|
|
613 |
{
|
|
|
614 |
|
|
|
615 |
$bvars = $this->controller->db->fetchRow("SELECT * FROM `".wpsg_q($this->controller->tbl_ov)."` WHERE `id` = '".wpsg_q($bvars_id)."'");
|
|
|
616 |
|
|
|
617 |
if ($bvars['typ'] == "1") // Auswahl
|
|
|
618 |
{
|
|
|
619 |
if ($bvars_value <= 0) $bvars_value = __("Keine Angabe", "wpsg");
|
|
|
620 |
}
|
|
|
621 |
else if ($bvars['typ'] == "2") // Texteingabe
|
|
|
622 |
{
|
|
|
623 |
if (trim($bvars_value) == "") $bvars_value = __("Keine Angabe", "wpsg");
|
|
|
624 |
}
|
|
|
625 |
else if ($bvars['typ'] == "3") // Checkbox
|
|
|
626 |
{
|
|
|
627 |
if ($bvars_value <= 0) $bvars_value = __("Keine Angabe", "wpsg");
|
|
|
628 |
}
|
|
|
629 |
|
|
|
630 |
$bvars_name = $this->controller->mods['mod_bestellvars']->getNameFromId($bvars_id);
|
|
|
631 |
$strBVars .= "\r\n".$bvars_name.": ".$bvars_value;
|
|
|
632 |
|
|
|
633 |
}
|
|
|
634 |
|
|
|
635 |
$pdf->SetFont('Arial', 'B', 9);
|
|
|
636 |
$pdf->Text($prod_left, $prod_top + $offset, __("Angaben während der Bestellung", "wpsg").":");
|
|
|
637 |
$pdf->SetFont('Arial', '', 9);
|
|
|
638 |
$pdf->MultiCell($prod_left - 1, $prod_top + $offset, 5, utf8_encode($strBVars));
|
|
|
639 |
|
|
|
640 |
}
|
|
|
641 |
*/
|
|
|
642 |
|
|
|
643 |
if (!file_exists($this->callMod('wpsg_mod_rechnungen', 'getFilePath', array($this->view['data']['id']))))
|
|
|
644 |
{
|
|
|
645 |
|
|
|
646 |
mkdir($this->callMod('wpsg_mod_rechnungen', 'getFilePath', array($this->view['data']['id'])), 0777, true);
|
|
|
647 |
|
|
|
648 |
}
|
|
|
649 |
|
1125 |
daniel |
650 |
$filename = $this->view['filename'].".pdf";
|
1093 |
daniel |
651 |
|
|
|
652 |
if ($this->view['preview'])
|
|
|
653 |
{
|
|
|
654 |
$pdf->Output($filename, 'I');
|
|
|
655 |
}
|
|
|
656 |
else
|
|
|
657 |
{
|
|
|
658 |
|
|
|
659 |
$pdf->Output($this->callMod('wpsg_mod_rechnungen', 'getFilePath', array($this->view['data']['id'])).$filename, 'F');
|
1228 |
daniel |
660 |
|
|
|
661 |
if ($this->view['output'] === true) $pdf->Output($filename, 'I');
|
1093 |
daniel |
662 |
|
|
|
663 |
}
|
|
|
664 |
|
|
|
665 |
?>
|