From 4c5e60da2ba3ba8c2c3930b6d4eb036229c8404b Mon Sep 17 00:00:00 2001 From: karl Date: Wed, 9 Nov 2022 15:45:21 +0000 Subject: - Rechnungs PDF voll überarbeitet MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit git-svn-id: https://[internal]/wordpress/plugins/wpsg4@8144 0d5edaf7-2b12-4e95-93f4-047927463d4b --- views/mods/mod_rechnungen/invoice_pdf.phtml | 381 ++++++++++++++-------------- 1 file changed, 190 insertions(+), 191 deletions(-) (limited to 'views') diff --git a/views/mods/mod_rechnungen/invoice_pdf.phtml b/views/mods/mod_rechnungen/invoice_pdf.phtml index e7b4811..5a60c39 100644 --- a/views/mods/mod_rechnungen/invoice_pdf.phtml +++ b/views/mods/mod_rechnungen/invoice_pdf.phtml @@ -36,7 +36,7 @@ else $taxdisplay = 'brutto'; // Damit die Steuer bei der Kleinunternehmerregelung nicht angezeigt wird leer ich den Array sicherheitshalber - if ($this->get_option('wpsg_kleinunternehmer') == '1') + if ( ($this->get_option('wpsg_kleinunternehmer') == '1') || ($this->view['oCalculationOrder']->getTaxMode() === \wpsg\wpsg_calculation::TAXMODE_SMALLBUSINESS) ) { unset($this->view['basket']['mwst']); @@ -181,26 +181,37 @@ $pdf = new wpsg_fpdf(); $pdf->SetAutoPageBreak(true, 5); AddRechnungPage($this, $pdf); - + + if ( ( ($this->view['oCalculationOrder']->getTaxMode() === \wpsg\wpsg_calculation::TAXMODE_B2B) && ($this->view['oOrder']->isInnerEu()) ) + || ( $this->view['oCalculationOrder']->getTaxMode() === \wpsg\wpsg_calculation::TAXMODE_SMALLBUSINESS ) + ) { + $bNoTax = true; + } else { + $bNoTax = false; + } + + $bTaxCol = false; + if ($this->get_option('wpsg_showMwstAlways') === '1') $bTaxCol = true; + else if (!$bNoTax) $bTaxCol = true; + $summe = 0; - + $bKopf = false; $pnr = 1; $offset = 0; $count = 0; - foreach ($this->view['basket']['produkte'] as $p) + foreach ($this->view['basket']['arCalculation']['product'] as $p) { - + $product = wpsg_product::getInstance($p['product_id']); + if (!$bKopf) { - + $pdf->SetFont('Arial', 'B', 9); $pdf->setXY($prod_left, $prod_top); $pdf->Cell(10, 8, __("Nr.", "wpsg"), 1, 0, 'C'); $pdf->setXY($prod_left + 10, $prod_top); - if(is_array($this->view['basket']['mwst'])) { - $pdf->Cell( ((sizeof($this->view['basket']['mwst']) >= 1 || $this->get_option('wpsg_showMwstAlways') == '1')?87:102), 8, "Name", 1, 0, 'L'); - } + $pdf->Cell( (($bTaxCol)?87:102), 8, "Name", 1, 0, 'L'); - if (sizeof($this->view['basket']['mwst']) >= 1 || $this->get_option('wpsg_showMwstAlways') == '1') + if ($bTaxCol) { $pdf->setXY($prod_left + 97, $prod_top); @@ -228,7 +239,7 @@ if ($this->get_option('wpsg_mod_rechnungen_anr') == '1') { - $pdf->Cell(10, 8, $p['anr'], 0, 0, 'C'); + $pdf->Cell(10, 8, $product->getNr(), 0, 0, 'C'); } else @@ -240,20 +251,20 @@ if ($this->get_option('wpsg_rechnungen_pdetailname' == '1')) { - $produkt_text = $this->getProductName($this->getProduktID($p['id']), true); + $produkt_text = $this->getProductName($this->getProduktID($p['product_id']), true); } else { - $produkt_text = $this->getProductName($this->getProduktID($p['id']), false); + $produkt_text = $this->getProductName($this->getProduktID($p['product_id']), false); } - $produktBeschreibung = trim(strip_tags($p['beschreibung'])); + $produktBeschreibung = trim(strip_tags($product->getShortDescription())); if ($this->isOtherLang()) { - $trans_db = $this->db->fetchRow("SELECT * FROM `".WPSG_TBL_PRODUCTS."` WHERE `lang_parent` = '".wpsg_q($this->getProduktID($p['id']))."' AND `lang_code` = '".wpsg_q($this->getCurrentLanguageCode())."'"); + $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())."'"); if (is_array($trans_db) && sizeof($trans_db) > 0) { @@ -293,13 +304,13 @@ if ($this->get_option('wpsg_mod_rechnungen_anr') === '2') { - $anr = $this->getProductAnr($p['productkey']); + $anr = $this->getProductAnr($product->getProductKey()); $produkt_text .= "\r\n".wpsg_translate(__('Artikelnummer: #1#', 'wpsg'), $anr); } $produkt_text_cell_width = 102; - if (sizeof($this->view['basket']['mwst']) >= 1 || $this->get_option('wpsg_showMwstAlways') == '1') + if ($bTaxCol) { $produkt_text_cell_width = 87; } @@ -315,23 +326,23 @@ //$height += 3 + 5 + $pdf->getY() - $height_y; //$pdf->Cell((($this->arMwSt == "-1")?102:87), 8, $produkt_text, 0, 0, 'L'); - if (sizeof($this->view['basket']['mwst']) >= 1 || $this->get_option('wpsg_showMwstAlways') == '1') { + if ($bTaxCol) { $pdf->setXY($prod_left + 97, $prod_top + $offset); - $pdf->Cell(15, 8, (($this->view['basket']['noMwSt'] == '1')?'0.00 %':wpsg_ff($p['mwst_value'], '%')), 0, 0, 'C'); + $pdf->Cell(15, 8, (($bNoTax)?'0.00 %':wpsg_ff($this->view['basket']['arCalculation']['tax'][$p['tax_key']]['tax_value'], '%')), 0, 0, 'C'); // BUG } $pdf->setXY($prod_left + 112, $prod_top + $offset); - $pdf->Cell(15, 8, $p['menge'], 0, 0, 'C'); + $pdf->Cell(15, 8, $p['amount'], 0, 0, 'C'); - if (wpsg_ShopController::get_option('wpsg_preisangaben') == WPSG_NETTO) { + if ( ( wpsg_ShopController::get_option('wpsg_preisangaben') == WPSG_NETTO ) || $bNoTax ) { - $preis = $p['preis_netto']; + $preis = $p['netto']; } else { - $preis = $p['preis_brutto']; + $preis = $p['brutto']; } @@ -339,13 +350,13 @@ $pdf->Cell(25, 8, wpsg_ff($preis, $this->get_option('wpsg_currency')), 0, 0, 'R'); $pdf->setXY($prod_left + 152, $prod_top + $offset); - $pdf->Cell(25, 8, wpsg_ff($preis * $p['menge'], $this->get_option('wpsg_currency')), 0, 0, 'R'); + $pdf->Cell(25, 8, wpsg_ff($preis * $p['amount'], $this->get_option('wpsg_currency')), 0, 0, 'R'); /** * Produktbeschreibung anzeigen Ja/Nein */ $pBeschreibungHeight = 0; - if ($this->get_option("wpsg_rechnungen_pbeschreibung") == "1" && trim(strip_tags($p['beschreibung'])) != '') + if ($this->get_option("wpsg_rechnungen_pbeschreibung") == "1" && trim(strip_tags($product->getShortDescription())) != '') { $produktBeschreibung = nl2br($produktBeschreibung); @@ -372,7 +383,7 @@ if ($this->get_option('wpsg_rechnungen_produktattribute') == '1') { - $attributeInfo = $this->callMod('wpsg_mod_produktattribute', 'getProductAttributeByProductId', array($this->getProduktId($p['id']))); + $attributeInfo = $this->callMod('wpsg_mod_produktattribute', 'getProductAttributeByProductId', array($this->getProduktId($p['product_id']))); foreach ($attributeInfo as $pa) { @@ -386,10 +397,10 @@ /** * Variante ? */ - if (preg_match('/pv_(.*)/', $p['productkey'])) + if (preg_match('/pv_(.*)/', $p['product_key'])) { - $variInfo = $this->callMod('wpsg_mod_productvariants', 'getVariantenInfoArray', array($p['productkey'])); + $variInfo = $this->callMod('wpsg_mod_productvariants', 'getVariantenInfoArray', array($p['product_key'])); $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); @@ -421,9 +432,9 @@ // Jetzt die Rahmen zeichnen $pdf->Rect($prod_left, $prod_top + $offset, 10, $height); - $pdf->Rect($prod_left + 10, $prod_top + $offset, ((sizeof($this->view['basket']['mwst']) >= 1 || $this->get_option('wpsg_showMwstAlways') == '1')?87:102), $height); + $pdf->Rect($prod_left + 10, $prod_top + $offset, (($bTaxCol)?87:102), $height); - if (sizeof($this->view['basket']['mwst']) >= 1 || $this->get_option('wpsg_showMwstAlways') == '1') + if ($bTaxCol) { $pdf->Rect($prod_left + 97, $prod_top + $offset, 15, $height); @@ -439,9 +450,15 @@ $pnr ++; $count ++; - $summe += $p['price'] * $p['menge']; + if ($bNoTax) { + $price = $p['netto']; + } else { + $price = $p['brutto']; + } + + $summe += $price * $p['amount']; - if ($pdf->getY() > 220 || ($count >= $prod_break && sizeof($this->view['basket']['produkte']) > ($pnr - 1))) + if ($pdf->getY() > 220 || ($count >= $prod_break && sizeof($this->view['basket']['arCalculation']['product']) > ($pnr - 1))) { AddRechnungPage($this, $pdf); @@ -451,56 +468,18 @@ } // produkte - // Gutschein - /* - if ((isset($this->view['basket']['gs'])) && abs($this->view['basket']['gs_value']) > 0) - { - - $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'), $this->view['basket']['gs']['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($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')); - - $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; - - } - */ 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'); + $pdf->Cell( (($bTaxCol)?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') + if ($bTaxCol) { $mwst = __('anteilig', 'wpsg'); @@ -528,8 +507,18 @@ } + if ($bNoTax) { + + $shipping_cost = $this->view['basket']['arCalculation']['sum']['shipping_netto']; + + } else { + + $shipping_cost = $this->view['basket']['arCalculation']['sum']['shipping_brutto']; + + } + // Versandkosten - if ($this->view['basket']['sum']['preis_shipping'] != '' && $this->view['basket']['sum']['preis_shipping'] != 0) + if ( ($shipping_cost != '') && ($shipping_cost != 0) ) { $pdf->SetFont('Arial', '', 9); @@ -537,26 +526,24 @@ $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(__('Versandkosten "#1#"', 'wpsg'), $this->view['oOrder']->getShippingLabel()), 1, 0, 'L'); + $pdf->Cell( (($bTaxCol)?87:102), 8, wpsg_translate(__('Versandkosten "#1#"', 'wpsg'), $this->view['oOrder']->getShippingLabel()), 1, 0, 'L'); - if (sizeof($this->view['basket']['mwst']) >= 1 || $this->get_option('wpsg_showMwstAlways') == '1') + if ($bTaxCol) { - - if ($this->arShipping[$this->view['data']['type_shipping']]['mwst_null'] == '1' && $this->view['basket']['noMwSt'] == '1') - { - - $mwst = 0; - - } - else + + if ($this->arShipping[$this->view['data']['type_shipping']]['mwst_null'] == '1' && $bNoTax) { + + $mwst = wpsg_ff(0.00, '%'); + + } else { if ($this->view['basket']['arCalculation']['shipping'][0]['tax_key'] === '0') { - + $mwst = _('anteilig'); } else { - + $mwst = wpsg_ff($this->view['basket']['arCalculation']['shipping'][0]['tax'], '%'); $mwst = wpsg_ff($this->view['basket']['arCalculation']['tax'][$this->view['basket']['arCalculation']['shipping'][0]['tax_key']]['tax_value'], '%'); @@ -573,58 +560,28 @@ $pdf->Cell(15, 8, '1', 1, 0, 'C'); $pdf->setXY($prod_left + 127, $prod_top + $offset); - $pdf->Cell(25, 8, wpsg_ff($this->view['basket']['sum']['preis_shipping'], $this->get_option('wpsg_currency')), 1, 0, 'R'); + $pdf->Cell(25, 8, wpsg_ff($shipping_cost, $this->get_option('wpsg_currency')), 1, 0, 'R'); $pdf->setXY($prod_left + 152, $prod_top + $offset); - $pdf->Cell(25, 8, wpsg_ff($this->view['basket']['sum']['preis_shipping'], $this->get_option('wpsg_currency')), 1, 0, 'R'); - - $offset += 8; - - // Zusammengesetzte Versandarten darstellen - /* - if (wpsg_isSizedArray($this->view['basket']['shipping']['methods'])) { - - foreach ($this->view['basket']['shipping']['methods'] as $shipping) { - - $pdf->SetFont('Arial', '', 9); - $pdf->setXY($prod_left, $prod_top + $offset); - $pdf->Cell(10, 8, '', 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, $this->getShippingName($shipping), 1, 0, 'L'); - - if (sizeof($this->view['basket']['mwst']) >= 1 || $this->get_option('wpsg_showMwstAlways') == '1') - { - - if ($this->view['basket']['shipping'][$shipping]['tax_rata'] == 1) { $mwst = __('Anteilig', 'wpsg'); } - else { $mwst = wpsg_ff($this->view['basket']['shipping'][$shipping]['mwst'], '%'); } - - $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'); - - $pdf->setXY($prod_left + 127, $prod_top + $offset); - $pdf->Cell(25, 8, wpsg_ff($this->view['basket']['shipping'][$shipping]['preis_shipping_brutto'], $this->get_option('wpsg_currency')), 1, 0, 'R'); - - $pdf->setXY($prod_left + 152, $prod_top + $offset); - $pdf->Cell(25, 8, wpsg_ff($this->view['basket']['shipping'][$shipping]['preis_shipping_brutto'], $this->get_option('wpsg_currency')), 1, 0, 'R'); - - $offset += 8; - - } - - } - */ + $pdf->Cell(25, 8, wpsg_ff($shipping_cost, $this->get_option('wpsg_currency')), 1, 0, 'R'); + $offset += 8; } + + + if ($bNoTax) { + + $payment_cost = $this->view['basket']['arCalculation']['sum']['payment_netto']; + + } else { + + $payment_cost = $this->view['basket']['arCalculation']['sum']['payment_brutto']; + + } // Zahlungskosten - if ($this->view['basket']['sum']['preis_payment'] != '' && $this->view['basket']['sum']['preis_payment'] != 0) + if ( ($payment_cost != '') && ($payment_cost != 0) ) { $pdf->SetFont('Arial', '', 9); @@ -632,31 +589,31 @@ $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, $this->arPayment[$this->view['data']['type_payment']]['name'], 1, 0, 'L'); + $pdf->Cell( (($bTaxCol)?87:102), 8, $this->arPayment[$this->view['data']['type_payment']]['name'], 1, 0, 'L'); - if (sizeof($this->view['basket']['mwst']) >= 1 || $this->get_option('wpsg_showMwstAlways') == '1') + if ($bTaxCol) { - if ($this->arPayment[$this->view['data']['type_payment']]['mwst_null'] == '1' && $this->view['basket']['noMwSt'] == '1') - { - $mwst = 0; - } - else + if ($this->arPayment[$this->view['data']['type_payment']]['mwst_null'] == '1' && $bNoTax) { + + $mwst = wpsg_ff(0.00, '%'); + + } else { if ($this->view['basket']['arCalculation']['payment'][0]['tax_key'] === '0') { - + $mwst = _('anteilig'); - + } else { - + $mwst = wpsg_ff($this->view['basket']['arCalculation']['payment'][0]['tax'], '%'); $mwst = wpsg_ff($this->view['basket']['arCalculation']['tax'][$this->view['basket']['arCalculation']['payment'][0]['tax_key']]['tax_value'], '%'); - + } } - + $pdf->setXY($prod_left + 97, $prod_top + $offset); $pdf->Cell(15, 8, $mwst, 1, 0, 'C'); @@ -666,10 +623,10 @@ $pdf->Cell(15, 8, '1', 1, 0, 'C'); $pdf->setXY($prod_left + 127, $prod_top + $offset); - $pdf->Cell(25, 8, wpsg_ff($this->view['basket']['sum']['preis_payment'], $this->get_option('wpsg_currency')), 1, 0, 'R'); + $pdf->Cell(25, 8, wpsg_ff($payment_cost, $this->get_option('wpsg_currency')), 1, 0, 'R'); $pdf->setXY($prod_left + 152, $prod_top + $offset); - $pdf->Cell(25, 8, wpsg_ff($this->view['basket']['sum']['preis_payment'], $this->get_option('wpsg_currency')), 1, 0, 'R'); + $pdf->Cell(25, 8, wpsg_ff($payment_cost, $this->get_option('wpsg_currency')), 1, 0, 'R'); $offset += 8; @@ -688,21 +645,18 @@ if (strpos($this->view['storno_fee'], '%') !== false) $label .= ' ('.wpsg_ff($this->view['storno_fee'], '%').')'; $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, $label, 1, 0, 'L'); + $pdf->Cell( (($bTaxCol)?87:102), 8, $label, 1, 0, 'L'); - if (sizeof($this->view['basket']['mwst']) >= 1 || $this->get_option('wpsg_showMwstAlways') == '1') + if ($bTaxCol) { - if ($this->view['basket']['noMwSt'] == '1') + if ($bNoTax) { - $mwst = 0; + $mwst = wpsg_ff(0.00, '%'); } else { - - $mwst = wpsg_ff($this->view['storno_fee_tax_value'], '%'); - } $pdf->setXY($prod_left + 97, $prod_top + $offset); @@ -734,92 +688,137 @@ } $offset += 10; - if ($this->get_option('wpsg_kleinunternehmer')) + if ( $this->get_option('wpsg_kleinunternehmer') || ($this->view['oCalculationOrder']->getTaxMode() === \wpsg\wpsg_calculation::TAXMODE_SMALLBUSINESS) ) { $pdf->Text($prod_left, $prod_top + $offset, __("Es ergibt sich folgender Gesamtbetrag", "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'); + $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'); $offset += 5; - } - else - { + } else { - if ($this->view['basket']['noMwSt'] == '1') + if ($bNoTax) { $pdf->Text($prod_left, $prod_top + $offset, __("Es ergibt sich folgender Gesamtbetrag", "wpsg").':'); - $pdf->Text($prod_left + 80, $prod_top + $offset, __("BRUTTOBETRAG", "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_netto'] + $this->view['basket']['sum']['preis_rabatt'], $this->get_option('wpsg_currency')), 0, 0, 'R'); - $offset += 5; + $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'); + + if ( !(($this->view['oOrder']->isInnerEu()) && ($this->view['oCalculationOrder']->getTaxMode() === \wpsg\wpsg_calculation::TAXMODE_B2B)) ) { + + if (sizeof($this->view['basket']['arCalculation']['tax']) >= 1) + { + + $mw_count = 0; + foreach ($this->view['basket']['arCalculation']['tax'] as $mw) + { + + if ($mw['tax_value'] > 0) { + + $offset += 5; + $pdf->Text($prod_left + 80, $prod_top + $offset, __("MwSt. ", "wpsg").wpsg_ff($mw['tax_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'); + + $mw_count++; + + } + + } + + } + + if ($mw_count >= 2) + { + + $offset += 5; + $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']['arCalculation']['sum']['brutto'] - $this->view['basket']['arCalculation']['sum']['netto'], $this->get_option('wpsg_currency')), 0, 0, 'R'); + + } - $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'); + } else $offset += 5; - } - else - { + } else { - $pdf->Text($prod_left, $prod_top + $offset, __("Der Gesamtbetrag setzt sich wie folgt zusammen", "wpsg")); + $pdf->Text($prod_left, $prod_top + $offset, __("Der Gesamtbetrag setzt sich wie folgt zusammen:", "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'); + $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'); - if (sizeof($this->view['basket']['mwst']) >= 1) + if (sizeof($this->view['basket']['arCalculation']['tax']) >= 1) { - - foreach ($this->view['basket']['mwst'] as $mw) + + $mw_count = 0; + + foreach ($this->view['basket']['arCalculation']['tax'] as $mw) { + + if ($mw['tax_value'] > 0) { + + $offset += 5; + $pdf->Text($prod_left + 80, $prod_top + $offset, __("MwSt. ", "wpsg").wpsg_ff($mw['tax_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'); - $offset += 5; - $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'); - + $mw_count++; + + } + } } - if (sizeof($this->view['basket']['mwst']) > 1) + if ($mw_count >= 2) { $offset += 5; $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'); + $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'); } } } + + if ($bNoTax) { + + $discount_value = $this->view['basket']['arCalculation']['sum']['discount_netto']; + + } else { + + $discount_value = $this->view['basket']['arCalculation']['sum']['discount_brutto']; + + } // Rabatt - if ($this->view['basket']['sum']['preis_rabatt'] > 0) + if ($discount_value > 0) { $offset += 5; $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'); + $pdf->Cell(37, 8, '-'.wpsg_ff($discount_value, $this->get_option('wpsg_currency')), 0, 0, 'R'); } - + // Wertgutschein - if ($arCalculation['sum']['topay_brutto'] !== $arCalculation['sum']['brutto']) { + if ( $arCalculation['sum']['topay_brutto'] != $arCalculation['sum']['brutto'] ) { $offset += 5; - $pdf->Text($prod_left + 80, $prod_top + $offset, __("Bruttobetrag", "wpsg")); + $pdf->Text($prod_left + 80, $prod_top + $offset, __("SUMME", "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->Cell(37, 8, wpsg_ff($this->view['basket']['arCalculation']['sum']['brutto'], $this->get_option('wpsg_currency')), 0, 0, 'R'); $pdf->setFont('Arial', '', '9'); foreach ($arCalculation['coupon'] as $c) { @@ -846,18 +845,18 @@ } else { - $offset += 5; - $pdf->Text($prod_left + 80, $prod_top + $offset, __("SUMME", "wpsg")); + if (!$bNoTax) $offset += 5; + $pdf->setFont('Arial', 'B', '9'); + $pdf->Text($prod_left + 80, $prod_top + $offset, __("GESAMTSUMME", "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->Cell(37, 8, wpsg_ff($arCalculation['sum']['topay_brutto'], $this->get_option('wpsg_currency')), 0, 0, 'R'); $pdf->setFont('Arial', '', '9'); } - if ($this->get_option('wpsg_kleinunternehmer') == '1') + if (($this->get_option('wpsg_kleinunternehmer') == '1') || ($this->view['oCalculationOrder']->getTaxMode() === \wpsg\wpsg_calculation::TAXMODE_SMALLBUSINESS) ) { $pdf->wpsg_MultiCell($prod_left - 1, $prod_top + $offset + 5, 5, $this->get_option('wpsg_kleinunternehmer_text')); @@ -914,7 +913,7 @@ } $shipping_adress .= $this->view['data']['shipping_vname'].' '.$this->view['data']['shipping_name']."\r\n"; $shipping_adress .= $this->view['data']['shipping_strasse'].' '.$this->view['data']['shipping_nr']."\r\n"; - //$shipping_adress .= $this->view['data']['shipping_land']['kuerzel'].'-'; + // $shipping_adress .= $this->view['data']['shipping_land']['kuerzel'].'-'; $shipping_adress .= $this->view['data']['shipping_plz'].' '.$this->view['data']['shipping_ort']."\r\n"; $shipping_adress .= $this->view['data']['shipping_land']['name']; -- cgit v1.2.3