From e96b183e33afb4038b2e39868f32ebf94a59ba83 Mon Sep 17 00:00:00 2001 From: Daniel Schmitzer Date: Wed, 31 Jul 2019 18:54:21 +0000 Subject: - Gutschein/Coupon - Task #681 git-svn-id: https://[internal]/wordpress/plugins/wpsg4@7490 0d5edaf7-2b12-4e95-93f4-047927463d4b --- views/mods/mod_rechnungen/accounting_pdf.phtml | 133 +++++++++++++++++------- views/mods/mod_rechnungen/invoice_pdf.phtml | 136 ++++++++++++++++++------- 2 files changed, 198 insertions(+), 71 deletions(-) (limited to 'views/mods/mod_rechnungen') diff --git a/views/mods/mod_rechnungen/accounting_pdf.phtml b/views/mods/mod_rechnungen/accounting_pdf.phtml index d7a3d81..f21d95e 100644 --- a/views/mods/mod_rechnungen/accounting_pdf.phtml +++ b/views/mods/mod_rechnungen/accounting_pdf.phtml @@ -29,6 +29,11 @@ // Anzahl an Produkten pro Seite $prod_break = $this->get_option('wpsg_rechnungen_pdfperpage'); + $arCalculation = $this->view['basket']['arCalculation']; + + if ($this->getFrontendTaxView() === WPSG_NETTO) $taxdisplay = 'netto'; + else $taxdisplay = 'brutto'; + // Damit die Steuer bei der Kleinunternehmerregelung nicht angezeigt wird leer ich den Array sicherheitshalber if ($this->get_option('wpsg_kleinunternehmer') == '1') { @@ -429,6 +434,7 @@ } // produkte // Gutschein + /* if ((isset($this->view['basket']['gs'])) && ($this->view['basket']['gs_value'] > 0)) { @@ -452,23 +458,6 @@ $pdf->setXY($prod_left + 112, $prod_top + $offset); $pdf->Cell(15, 8, '1', 1, 0, 'C'); - /* - if ($this->view['basket']['gs']['calc'] == 'w') - { - - $gs_value_einzel = '-'.wpsg_ff($this->view['basket']['gs']['value'], $this->get_option('wpsg_currency')); - $gs_value_gesamt = '-'.wpsg_ff($this->view['basket']['gs']['value'], $this->get_option('wpsg_currency')); - - } - else if ($this->view['basket']['gs']['calc'] == 'p') - { - - $gs_value_einzel = '-'.wpsg_ff($this->view['basket']['gs']['value'], '%'); - $gs_value_gesamt = '-'.wpsg_ff($this->view['basket']['sum']['gs'], $this->get_option('wpsg_currency')); - - } - */ - $gs_value_einzel = '-'.wpsg_ff($this->view['basket']['sum']['gs'], $this->get_option('wpsg_currency')); $gs_value_gesamt = '-'.wpsg_ff($this->view['basket']['sum']['gs'], $this->get_option('wpsg_currency')); @@ -481,6 +470,45 @@ $offset += 8; } + */ + if (wpsg_isSizedArray($this->view['basket']['arCalculation']['voucher'])) { + + foreach ($this->view['basket']['arCalculation']['voucher'] as $v) { + + $pdf->SetFont('Arial', '', 9); + $pdf->setXY($prod_left, $prod_top + $offset); + $pdf->Cell(10, 8, $pnr.'.', 1, 0, 'C'); $pnr ++; + + $pdf->setXY($prod_left + 10, $prod_top + $offset); + $pdf->Cell( ((sizeof($this->view['basket']['mwst']) >= 1 || $this->get_option('wpsg_showMwstAlways') == '1')?87:102), 8, wpsg_translate(__('Gutschein (#1#)', 'wpsg'), $v['code']), 1, 0, 'L'); + + if (sizeof($this->view['basket']['mwst']) >= 1 || $this->get_option('wpsg_showMwstAlways') == '1') + { + + $mwst = __('anteilig', 'wpsg'); + + $pdf->setXY($prod_left + 97, $prod_top + $offset); + $pdf->Cell(15, 8, $mwst, 1, 0, 'C'); + + } + + $pdf->setXY($prod_left + 112, $prod_top + $offset); + $pdf->Cell(15, 8, '1', 1, 0, 'C'); + + $gs_value_einzel = wpsg_ff($v[$taxdisplay.'_single'], $this->get_option('wpsg_currency')); + $gs_value_gesamt = wpsg_ff($v[$taxdisplay], $this->get_option('wpsg_currency')); + + $pdf->setXY($prod_left + 127, $prod_top + $offset); + $pdf->Cell(25, 8, $gs_value_einzel, 1, 0, 'R'); + + $pdf->setXY($prod_left + 152, $prod_top + $offset); + $pdf->Cell(25, 8, $gs_value_gesamt, 1, 0, 'R'); + + $offset += 8; + + } + + } // Versandkosten if ($this->view['basket']['sum']['preis_shipping'] != '' && $this->view['basket']['sum']['preis_shipping'] != 0) @@ -727,7 +755,7 @@ { $pdf->Text($prod_left, $prod_top + $offset, __("Es ergibt sich folgender Gesamtbetrag", "wpsg").':'); - $pdf->Text($prod_left + 100, $prod_top + $offset, __("Summe", "wpsg")); + $pdf->Text($prod_left + 80, $prod_top + $offset, __("Summe", "wpsg")); $pdf->setXY($prod_left + 140, $prod_top + $offset - 5); $pdf->Cell(37, 8, wpsg_ff($this->view['basket']['sum']['preis_gesamt_brutto'] + $this->view['basket']['sum']['preis_rabatt'], $this->get_option('wpsg_currency')), 0, 0, 'R'); $offset += 5; @@ -740,12 +768,12 @@ { $pdf->Text($prod_left, $prod_top + $offset, __("Es ergibt sich folgender Gesamtbetrag", "wpsg").':'); - $pdf->Text($prod_left + 100, $prod_top + $offset, __("BRUTTOBETRAG", "wpsg")); + $pdf->Text($prod_left + 80, $prod_top + $offset, __("BRUTTOBETRAG", "wpsg")); $pdf->setXY($prod_left + 140, $prod_top + $offset - 5); $pdf->Cell(37, 8, wpsg_ff($this->view['basket']['sum']['preis_gesamt_netto'], $this->get_option('wpsg_currency')), 0, 0, 'R'); $offset += 5; - $pdf->Text($prod_left + 100, $prod_top + $offset, __("MwSt. GESAMT", "wpsg")); + $pdf->Text($prod_left + 80, $prod_top + $offset, __("MwSt. GESAMT", "wpsg")); $pdf->setXY($prod_left + 140, $prod_top + $offset - 5); $pdf->Cell(37, 8, wpsg_ff(0, $this->get_option('wpsg_currency')), 0, 0, 'R'); @@ -755,7 +783,7 @@ $pdf->Text($prod_left, $prod_top + $offset, __("Der Gesamtbetrag setzt sich wie folgt zusammen", "wpsg")); - $pdf->Text($prod_left + 100, $prod_top + $offset, __("NETTOBETRAG", "wpsg")); + $pdf->Text($prod_left + 80, $prod_top + $offset, __("NETTOBETRAG", "wpsg")); $pdf->setXY($prod_left + 140, $prod_top + $offset - 5); $pdf->Cell(37, 8, wpsg_ff($this->view['basket']['sum']['preis_gesamt_netto'], $this->get_option('wpsg_currency')), 0, 0, 'R'); @@ -766,7 +794,7 @@ { $offset += 5; - $pdf->Text($prod_left + 100, $prod_top + $offset, __("MwSt. ", "wpsg").wpsg_ff($mw['value'], '%')); + $pdf->Text($prod_left + 80, $prod_top + $offset, __("MwSt. ", "wpsg").wpsg_ff($mw['value'], '%')); $pdf->setXY($prod_left + 140, $prod_top + $offset - 5); $pdf->Cell(37, 8, wpsg_ff($mw['sum'], $this->get_option('wpsg_currency')), 0, 0, 'R'); @@ -778,7 +806,7 @@ { $offset += 5; - $pdf->Text($prod_left + 100, $prod_top + $offset, __("MwSt. GESAMT", "wpsg")); + $pdf->Text($prod_left + 80, $prod_top + $offset, __("MwSt. GESAMT", "wpsg")); $pdf->setXY($prod_left + 140, $prod_top + $offset - 5); $pdf->Cell(37, 8, wpsg_ff($this->view['basket']['sum']['preis_gesamt_brutto'] - $this->view['basket']['sum']['preis_gesamt_netto'], $this->get_option('wpsg_currency')), 0, 0, 'R'); @@ -794,23 +822,60 @@ $offset += 5; - $pdf->Text($prod_left + 100, $prod_top + $offset, __("Rabatt", "wpsg")); + $pdf->Text($prod_left + 80, $prod_top + $offset, __("Rabatt", "wpsg")); $pdf->setXY($prod_left + 140, $prod_top + $offset - 5); $pdf->Cell(37, 8, '-'.wpsg_ff($this->view['basket']['sum']['preis_rabatt'], $this->get_option('wpsg_currency')), 0, 0, 'R'); } - - $offset += 5; - $pdf->Text($prod_left + 100, $prod_top + $offset, __("SUMME", "wpsg")); - $pdf->setXY($prod_left + 140, $prod_top + $offset - 5); - /* Endbetrag wird fett ausgegeben */ - $pdf->setFont('Arial', 'B', '9'); - $pdf->Cell(37, 8, wpsg_ff($this->view['basket']['sum']['preis_gesamt_brutto'], $this->get_option('wpsg_currency')), 0, 0, 'R'); - $pdf->setFont('Arial', '', '9'); + // Wertgutschein + if ($arCalculation['sum']['topay_brutto'] !== $arCalculation['sum']['brutto']) { + + $offset += 5; + $pdf->Text($prod_left + 80, $prod_top + $offset, __("Bruttobetrag", "wpsg")); + $pdf->setXY($prod_left + 140, $prod_top + $offset - 5); + + $pdf->setFont('Arial', '', '9'); + $pdf->Cell(37, 8, wpsg_ff($this->view['basket']['sum']['preis_gesamt_brutto'], $this->get_option('wpsg_currency')), 0, 0, 'R'); + $pdf->setFont('Arial', '', '9'); + + foreach ($arCalculation['coupon'] as $c) { + + $offset += 5; + $pdf->Text($prod_left + 80, $prod_top + $offset, __('Wertgutschein', 'wpsg').' '.((wpsg_isSizedString($c['code']))?'('.$c['code'].')':'')); + $pdf->setXY($prod_left + 140, $prod_top + $offset - 5); + + $pdf->setFont('Arial', '', '9'); + $pdf->Cell(37, 8, wpsg_ff($c[$taxdisplay], $this->get_option('wpsg_currency')), 0, 0, 'R'); + $pdf->setFont('Arial', '', '9'); + + } + + $offset += 5; + $pdf->setFont('Arial', 'B', '9'); + $pdf->Text($prod_left + 80, $prod_top + $offset, __("SUMME", "wpsg")); + $pdf->setXY($prod_left + 140, $prod_top + $offset - 5); + + /* Endbetrag wird fett ausgegeben */ + $pdf->setFont('Arial', 'B', '9'); + $pdf->Cell(37, 8, wpsg_ff($arCalculation['sum']['topay_brutto'], $this->get_option('wpsg_currency')), 0, 0, 'R'); + $pdf->setFont('Arial', '', '9'); + + } else { + + $offset += 5; + $pdf->Text($prod_left + 100, $prod_top + $offset, __("SUMME", "wpsg")); + $pdf->setXY($prod_left + 140, $prod_top + $offset - 5); - /* Endbetrag wird normal ausgegeben */ - //$pdf->Cell(37, 8, wpsg_ff($this->view['basket']['sum']['preis_gesamt_brutto'], $this->get_option('wpsg_currency')), 0, 0, 'R'); + /* Endbetrag wird fett ausgegeben */ + $pdf->setFont('Arial', 'B', '9'); + $pdf->Cell(37, 8, wpsg_ff($this->view['basket']['sum']['preis_gesamt_brutto'], $this->get_option('wpsg_currency')), 0, 0, 'R'); + $pdf->setFont('Arial', '', '9'); + + /* Endbetrag wird normal ausgegeben */ + //$pdf->Cell(37, 8, wpsg_ff($this->view['basket']['sum']['preis_gesamt_brutto'], $this->get_option('wpsg_currency')), 0, 0, 'R'); + + } if ($this->get_option('wpsg_kleinunternehmer') == '1') { diff --git a/views/mods/mod_rechnungen/invoice_pdf.phtml b/views/mods/mod_rechnungen/invoice_pdf.phtml index 7d9c543..9b4fb37 100644 --- a/views/mods/mod_rechnungen/invoice_pdf.phtml +++ b/views/mods/mod_rechnungen/invoice_pdf.phtml @@ -30,6 +30,11 @@ // Anzahl an Produkten pro Seite $prod_break = $this->get_option('wpsg_rechnungen_pdfperpage'); + $arCalculation = $this->view['basket']['arCalculation']; + + if ($this->getFrontendTaxView() === WPSG_NETTO) $taxdisplay = 'netto'; + else $taxdisplay = 'brutto'; + // Damit die Steuer bei der Kleinunternehmerregelung nicht angezeigt wird leer ich den Array sicherheitshalber if ($this->get_option('wpsg_kleinunternehmer') == '1') { @@ -443,6 +448,7 @@ } // produkte // Gutschein + /* if ((isset($this->view['basket']['gs'])) && abs($this->view['basket']['gs_value']) > 0) { @@ -465,24 +471,7 @@ $pdf->setXY($prod_left + 112, $prod_top + $offset); $pdf->Cell(15, 8, '1', 1, 0, 'C'); - - /* - if ($this->view['basket']['gs']['calc'] == 'w') - { - - $gs_value_einzel = '-'.wpsg_ff($this->view['basket']['gs']['value'], $this->get_option('wpsg_currency')); - $gs_value_gesamt = '-'.wpsg_ff($this->view['basket']['gs']['value'], $this->get_option('wpsg_currency')); - - } - else if ($this->view['basket']['gs']['calc'] == 'p') - { - - $gs_value_einzel = '-'.wpsg_ff($this->view['basket']['gs']['value'], '%'); - $gs_value_gesamt = '-'.wpsg_ff($this->view['basket']['sum']['gs'], $this->get_option('wpsg_currency')); - - } - */ - + $gs_value_einzel = '-'.wpsg_ff($this->view['basket']['sum']['gs'], $this->get_option('wpsg_currency')); $gs_value_gesamt = '-'.wpsg_ff($this->view['basket']['sum']['gs'], $this->get_option('wpsg_currency')); @@ -495,7 +484,46 @@ $offset += 8; } - + */ + if (wpsg_isSizedArray($this->view['basket']['arCalculation']['voucher'])) { + + foreach ($this->view['basket']['arCalculation']['voucher'] as $v) { + + $pdf->SetFont('Arial', '', 9); + $pdf->setXY($prod_left, $prod_top + $offset); + $pdf->Cell(10, 8, $pnr.'.', 1, 0, 'C'); $pnr ++; + + $pdf->setXY($prod_left + 10, $prod_top + $offset); + $pdf->Cell( ((sizeof($this->view['basket']['mwst']) >= 1 || $this->get_option('wpsg_showMwstAlways') == '1')?87:102), 8, wpsg_translate(__('Gutschein (#1#)', 'wpsg'), $v['code']), 1, 0, 'L'); + + if (sizeof($this->view['basket']['mwst']) >= 1 || $this->get_option('wpsg_showMwstAlways') == '1') + { + + $mwst = __('anteilig', 'wpsg'); + + $pdf->setXY($prod_left + 97, $prod_top + $offset); + $pdf->Cell(15, 8, $mwst, 1, 0, 'C'); + + } + + $pdf->setXY($prod_left + 112, $prod_top + $offset); + $pdf->Cell(15, 8, '1', 1, 0, 'C'); + + $gs_value_einzel = wpsg_ff($v[$taxdisplay.'_single'], $this->get_option('wpsg_currency')); + $gs_value_gesamt = wpsg_ff($v[$taxdisplay], $this->get_option('wpsg_currency')); + + $pdf->setXY($prod_left + 127, $prod_top + $offset); + $pdf->Cell(25, 8, $gs_value_einzel, 1, 0, 'R'); + + $pdf->setXY($prod_left + 152, $prod_top + $offset); + $pdf->Cell(25, 8, $gs_value_gesamt, 1, 0, 'R'); + + $offset += 8; + + } + + } + // Versandkosten if ($this->view['basket']['sum']['preis_shipping'] != '' && $this->view['basket']['sum']['preis_shipping'] != 0) { @@ -741,7 +769,7 @@ { $pdf->Text($prod_left, $prod_top + $offset, __("Es ergibt sich folgender Gesamtbetrag", "wpsg").':'); - $pdf->Text($prod_left + 100, $prod_top + $offset, __("Summe", "wpsg")); + $pdf->Text($prod_left + 80, $prod_top + $offset, __("Summe", "wpsg")); $pdf->setXY($prod_left + 140, $prod_top + $offset - 5); $pdf->Cell(37, 8, wpsg_ff($this->view['basket']['sum']['preis_gesamt_brutto'] + $this->view['basket']['sum']['preis_rabatt'], $this->get_option('wpsg_currency')), 0, 0, 'R'); $offset += 5; @@ -754,12 +782,12 @@ { $pdf->Text($prod_left, $prod_top + $offset, __("Es ergibt sich folgender Gesamtbetrag", "wpsg").':'); - $pdf->Text($prod_left + 100, $prod_top + $offset, __("BRUTTOBETRAG", "wpsg")); + $pdf->Text($prod_left + 80, $prod_top + $offset, __("BRUTTOBETRAG", "wpsg")); $pdf->setXY($prod_left + 140, $prod_top + $offset - 5); $pdf->Cell(37, 8, wpsg_ff($this->view['basket']['sum']['preis_gesamt_netto'] + $this->view['basket']['sum']['preis_rabatt'], $this->get_option('wpsg_currency')), 0, 0, 'R'); $offset += 5; - $pdf->Text($prod_left + 100, $prod_top + $offset, __("MwSt. GESAMT", "wpsg")); + $pdf->Text($prod_left + 80, $prod_top + $offset, __("MwSt. GESAMT", "wpsg")); $pdf->setXY($prod_left + 140, $prod_top + $offset - 5); $pdf->Cell(37, 8, wpsg_ff(0, $this->get_option('wpsg_currency')), 0, 0, 'R'); @@ -769,7 +797,7 @@ $pdf->Text($prod_left, $prod_top + $offset, __("Der Gesamtbetrag setzt sich wie folgt zusammen", "wpsg")); - $pdf->Text($prod_left + 100, $prod_top + $offset, __("NETTOBETRAG", "wpsg")); + $pdf->Text($prod_left + 80, $prod_top + $offset, __("NETTOBETRAG", "wpsg")); $pdf->setXY($prod_left + 140, $prod_top + $offset - 5); $pdf->Cell(37, 8, wpsg_ff($this->view['basket']['sum']['preis_gesamt_netto'] + $this->view['basket']['sum']['preis_rabatt'], $this->get_option('wpsg_currency')), 0, 0, 'R'); @@ -780,7 +808,7 @@ { $offset += 5; - $pdf->Text($prod_left + 100, $prod_top + $offset, __("MwSt. ", "wpsg").wpsg_ff($mw['value'], '%')); + $pdf->Text($prod_left + 80, $prod_top + $offset, __("MwSt. ", "wpsg").wpsg_ff($mw['value'], '%')); $pdf->setXY($prod_left + 140, $prod_top + $offset - 5); $pdf->Cell(37, 8, wpsg_ff($mw['sum'], $this->get_option('wpsg_currency')), 0, 0, 'R'); @@ -792,7 +820,7 @@ { $offset += 5; - $pdf->Text($prod_left + 100, $prod_top + $offset, __("MwSt. GESAMT", "wpsg")); + $pdf->Text($prod_left + 80, $prod_top + $offset, __("MwSt. GESAMT", "wpsg")); $pdf->setXY($prod_left + 140, $prod_top + $offset - 5); $pdf->Cell(37, 8, wpsg_ff($this->view['basket']['sum']['preis_gesamt_brutto'] - $this->view['basket']['sum']['preis_gesamt_netto'], $this->get_option('wpsg_currency')), 0, 0, 'R'); @@ -808,23 +836,57 @@ $offset += 5; - $pdf->Text($prod_left + 100, $prod_top + $offset, __("Rabatt", "wpsg")); + $pdf->Text($prod_left + 80, $prod_top + $offset, __("Rabatt", "wpsg")); $pdf->setXY($prod_left + 140, $prod_top + $offset - 5); $pdf->Cell(37, 8, '-'.wpsg_ff($this->view['basket']['sum']['preis_rabatt'], $this->get_option('wpsg_currency')), 0, 0, 'R'); } + + // Wertgutschein + if ($arCalculation['sum']['topay_brutto'] !== $arCalculation['sum']['brutto']) { + + $offset += 5; + $pdf->Text($prod_left + 80, $prod_top + $offset, __("Bruttobetrag", "wpsg")); + $pdf->setXY($prod_left + 140, $prod_top + $offset - 5); + + $pdf->setFont('Arial', '', '9'); + $pdf->Cell(37, 8, wpsg_ff($this->view['basket']['sum']['preis_gesamt_brutto'], $this->get_option('wpsg_currency')), 0, 0, 'R'); + $pdf->setFont('Arial', '', '9'); + + foreach ($arCalculation['coupon'] as $c) { + + $offset += 5; + $pdf->Text($prod_left + 80, $prod_top + $offset, __('Wertgutschein', 'wpsg').' '.((wpsg_isSizedString($c['code']))?'('.$c['code'].')':'')); + $pdf->setXY($prod_left + 140, $prod_top + $offset - 5); + + $pdf->setFont('Arial', '', '9'); + $pdf->Cell(37, 8, wpsg_ff($c[$taxdisplay], $this->get_option('wpsg_currency')), 0, 0, 'R'); + $pdf->setFont('Arial', '', '9'); + + } + + $offset += 5; + $pdf->setFont('Arial', 'B', '9'); + $pdf->Text($prod_left + 80, $prod_top + $offset, __("ZU ZAHLEN", "wpsg")); + $pdf->setXY($prod_left + 140, $prod_top + $offset - 5); + + /* Endbetrag wird fett ausgegeben */ + $pdf->setFont('Arial', 'B', '9'); + $pdf->Cell(37, 8, wpsg_ff($arCalculation['sum']['topay_brutto'], $this->get_option('wpsg_currency')), 0, 0, 'R'); + $pdf->setFont('Arial', '', '9'); + + } else { - $offset += 5; - $pdf->Text($prod_left + 100, $prod_top + $offset, __("SUMME", "wpsg")); - $pdf->setXY($prod_left + 140, $prod_top + $offset - 5); - - /* Endbetrag wird fett ausgegeben */ - $pdf->setFont('Arial', 'B', '9'); - $pdf->Cell(37, 8, wpsg_ff($this->view['basket']['sum']['preis_gesamt_brutto'], $this->get_option('wpsg_currency')), 0, 0, 'R'); - $pdf->setFont('Arial', '', '9'); - - /* Endbetrag wird normal ausgegeben */ - //$pdf->Cell(37, 8, wpsg_ff($this->view['basket']['sum']['preis_gesamt_brutto'], $this->get_option('wpsg_currency')), 0, 0, 'R'); + $offset += 5; + $pdf->Text($prod_left + 80, $prod_top + $offset, __("SUMME", "wpsg")); + $pdf->setXY($prod_left + 140, $prod_top + $offset - 5); + + /* Endbetrag wird fett ausgegeben */ + $pdf->setFont('Arial', 'B', '9'); + $pdf->Cell(37, 8, wpsg_ff($this->view['basket']['sum']['preis_gesamt_brutto'], $this->get_option('wpsg_currency')), 0, 0, 'R'); + $pdf->setFont('Arial', '', '9'); + + } if ($this->get_option('wpsg_kleinunternehmer') == '1') { -- cgit v1.2.3