From c93a14153f45da61162a68dc5d7c11a7e06c4668 Mon Sep 17 00:00:00 2001 From: karl Date: Tue, 6 Dec 2022 13:31:38 +0000 Subject: - Rechnungstemplate komplett überarbeitet (invoice_pdf.phtml) - Bugfix: Sammelrechnungen können nun in der Bestellverwaltung gesucht werden MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit git-svn-id: https://[internal]/wordpress/plugins/wpsg4@8167 0d5edaf7-2b12-4e95-93f4-047927463d4b --- views/mods/mod_rechnungen/invoice_pdf.phtml | 237 +++++++++++++--------------- 1 file changed, 113 insertions(+), 124 deletions(-) (limited to 'views/mods/mod_rechnungen/invoice_pdf.phtml') diff --git a/views/mods/mod_rechnungen/invoice_pdf.phtml b/views/mods/mod_rechnungen/invoice_pdf.phtml index 5a60c39..9409e87 100644 --- a/views/mods/mod_rechnungen/invoice_pdf.phtml +++ b/views/mods/mod_rechnungen/invoice_pdf.phtml @@ -52,7 +52,7 @@ global $absender_left, $absender_top, $adress_left, $adress_top, $rdata_left, $rdata_top; $pdf->AddPage(); - + if (file_exists($shop->callMod('wpsg_mod_rechnungen', 'getFilePath', array(''))."wpsg_rechnungen_bp.pdf")) { $pdf->setSourceFile($shop->callMod('wpsg_mod_rechnungen', 'getFilePath', array(''))."wpsg_rechnungen_bp.pdf"); @@ -64,8 +64,7 @@ $pdf->image($shop->callMod('wpsg_mod_rechnungen', 'getFilePath', array(''))."wpsg_rechnungen_bp.jpg", 0, 0, 210, 297, 'jpg'); } - - + if (file_exists($shop->callMod('wpsg_mod_rechnungen', 'getFilePath', array(''))."wpsg_rechnungen_logo.jpg")) { @@ -127,7 +126,7 @@ { $pdf->Text($rdata_left + 35, $rdata_top, __("Fällig am", "wpsg")); - $pdf->Text($rdata_left + 35, $rdata_top + 6, $shop->view['faelligkeitdatum']); + $pdf->Text($rdata_left + 35, $rdata_top + 6, date("d.m.Y", strtotime($shop->view['faelligkeitdatum']))); } @@ -146,7 +145,7 @@ $pdf->Text($rdata_left + 135, $rdata_top + 6, ((trim($shop->view['data']['onr']) != '')?$shop->view['data']['onr']:$shop->view['data']['id'])); $pdf->Text($rdata_left + 155, $rdata_top, __("Datum", "wpsg")); - $pdf->Text($rdata_left + 155, $rdata_top + 6, $shop->view['rDatum']); + $pdf->Text($rdata_left + 155, $rdata_top + 6, date("d.m.Y", strtotime($shop->view['rDatum']))); if ($shop->view['oOrder']->isInnerEu()) { @@ -182,8 +181,8 @@ $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 ) + 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 { @@ -194,6 +193,21 @@ if ($this->get_option('wpsg_showMwstAlways') === '1') $bTaxCol = true; else if (!$bNoTax) $bTaxCol = true; + + if ($bNoTax) { + + $discount_value = $this->view['basket']['arCalculation']['sum']['discount_netto']; + $shipping_cost = $this->view['basket']['arCalculation']['sum']['shipping_netto']; + $payment_cost = $this->view['basket']['arCalculation']['sum']['payment_netto']; + + } else { + + $discount_value = $this->view['basket']['arCalculation']['sum']['discount_brutto']; + $shipping_cost = $this->view['basket']['arCalculation']['sum']['shipping_brutto']; + $payment_cost = $this->view['basket']['arCalculation']['sum']['payment_brutto']; + + } + $summe = 0; $bKopf = false; $pnr = 1; $offset = 0; $count = 0; @@ -280,12 +294,12 @@ $pdf->setXY($prod_left + 10, $prod_top + $offset); - // Produktvariablen + // Produktvariablen if ($this->hasMod('wpsg_mod_productvars') && $this->get_option("wpsg_mod_rechnungen_showpv") == "1") { - - $arPV = $this->callMod('wpsg_mod_productvars', 'getAllProductVarValues', array($this->view['data']['id'], $p['product_index'])); - + + $arPV = $this->callMod('wpsg_mod_productvars', 'getAllProductVarValues', array($this->view['data']['id'], $p['product_index'] - 1)); + if (wpsg_isSizedArray($arPV)) { @@ -327,7 +341,7 @@ //$pdf->Cell((($this->arMwSt == "-1")?102:87), 8, $produkt_text, 0, 0, 'L'); if ($bTaxCol) { - + $pdf->setXY($prod_left + 97, $prod_top + $offset); $pdf->Cell(15, 8, (($bNoTax)?'0.00 %':wpsg_ff($this->view['basket']['arCalculation']['tax'][$p['tax_key']]['tax_value'], '%')), 0, 0, 'C'); // BUG @@ -358,7 +372,7 @@ $pBeschreibungHeight = 0; if ($this->get_option("wpsg_rechnungen_pbeschreibung") == "1" && trim(strip_tags($product->getShortDescription())) != '') { - + $produktBeschreibung = nl2br($produktBeschreibung); preg_match_all('/\
/', $produktBeschreibung, $treffer); $produktBeschreibung = strip_tags($produktBeschreibung); @@ -388,6 +402,7 @@ foreach ($attributeInfo as $pa) { + if ($pa['value'] == "") $pa['value'] = "Keine Angabe"; $pa_text = $pa['name'].': '.$pa['value']; $height += $pdf->wpsg_MultiCell($prod_left + 10, $prod_top + $height + $offset - 0.5, 5, $pa_text, 0, 'L', 0, $produkt_text_cell_width); @@ -408,7 +423,7 @@ } - if ($this->hasMod('wpsg_mod_deliverynote')) + if ($this->hasMod('wpsg_mod_deliverynote') && ($this->get_option('wpsg_rechnungen_deliverynote') == '1')) { $arDN_order = $this->callMod('wpsg_mod_deliverynote', 'loadDeliveryNotesFromOrder', array($this->view['data']['id'])); @@ -506,16 +521,6 @@ } } - - if ($bNoTax) { - - $shipping_cost = $this->view['basket']['arCalculation']['sum']['shipping_netto']; - - } else { - - $shipping_cost = $this->view['basket']['arCalculation']['sum']['shipping_brutto']; - - } // Versandkosten if ( ($shipping_cost != '') && ($shipping_cost != 0) ) @@ -568,17 +573,6 @@ $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 ( ($payment_cost != '') && ($payment_cost != 0) ) @@ -687,7 +681,8 @@ $pdf->Cell(37, 8, $this->view['kunde']['ustidnr'], 0, 0, 'R'); } - $offset += 10; + $offset += 10; // Abstand zwischen Tabelle und Auswertung + if ( $this->get_option('wpsg_kleinunternehmer') || ($this->view['oCalculationOrder']->getTaxMode() === \wpsg\wpsg_calculation::TAXMODE_SMALLBUSINESS) ) { @@ -695,8 +690,8 @@ $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']['arCalculation']['sum']['brutto'] + $this->view['basket']['arCalculation']['sum']['discount_brutto'], $this->get_option('wpsg_currency')), 0, 0, 'R'); - $offset += 5; - + if ( !$bNoTax || ($arCalculation['sum']['topay_brutto'] != $arCalculation['sum']['brutto']) ) $offset += 5; + } else { if ($bNoTax) @@ -706,6 +701,8 @@ $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']['arCalculation']['sum']['brutto'] + $this->view['basket']['arCalculation']['sum']['discount_brutto'], $this->get_option('wpsg_currency')), 0, 0, 'R'); + //if ( !$bNoTax || ($arCalculation['sum']['topay_brutto'] != $arCalculation['sum']['brutto']) ) + $offset += 5; if ( !(($this->view['oOrder']->isInnerEu()) && ($this->view['oCalculationOrder']->getTaxMode() === \wpsg\wpsg_calculation::TAXMODE_B2B)) ) { @@ -716,7 +713,7 @@ foreach ($this->view['basket']['arCalculation']['tax'] as $mw) { - if ($mw['tax_value'] > 0) { + if ( $mw['tax_value'] > 0 && $mw['sum'] > 0 ) { $offset += 5; $pdf->Text($prod_left + 80, $prod_top + $offset, __("MwSt. ", "wpsg").wpsg_ff($mw['tax_value'], '%')); @@ -741,11 +738,11 @@ } - } else $offset += 5; - + } else if ( !($arCalculation['sum']['topay_brutto'] != $arCalculation['sum']['brutto']) ) $offset -= 5; + } 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); @@ -755,11 +752,10 @@ { $mw_count = 0; - foreach ($this->view['basket']['arCalculation']['tax'] as $mw) { - if ($mw['tax_value'] > 0) { + if ( $mw['tax_value'] > 0 && $mw['sum'] > 0) { $offset += 5; $pdf->Text($prod_left + 80, $prod_top + $offset, __("MwSt. ", "wpsg").wpsg_ff($mw['tax_value'], '%')); @@ -787,23 +783,12 @@ } } - - if ($bNoTax) { - - $discount_value = $this->view['basket']['arCalculation']['sum']['discount_netto']; - - } else { - - $discount_value = $this->view['basket']['arCalculation']['sum']['discount_brutto']; - - } // Rabatt 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($discount_value, $this->get_option('wpsg_currency')), 0, 0, 'R'); @@ -812,15 +797,19 @@ // Wertgutschein if ( $arCalculation['sum']['topay_brutto'] != $arCalculation['sum']['brutto'] ) { + + if (!$bNoTax) { - $offset += 5; - $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']['arCalculation']['sum']['brutto'], $this->get_option('wpsg_currency')), 0, 0, 'R'); - $pdf->setFont('Arial', '', '9'); + $offset += 5; + $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']['arCalculation']['sum']['brutto'], $this->get_option('wpsg_currency')), 0, 0, 'R'); + $pdf->setFont('Arial', '', '9'); + } else if (!($mw_count >= 2)) $offset -= 5; + foreach ($arCalculation['coupon'] as $c) { $offset += 5; @@ -845,7 +834,7 @@ } else { - if (!$bNoTax) $offset += 5; + $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); @@ -858,66 +847,67 @@ 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')); - $offset += 15; + + $offset += 3; + $pdf->setFont('Arial', '', '8'); + $pdf->wpsg_MultiCell($prod_left - 1, $prod_top + $offset, 5, '('.$this->get_option('wpsg_kleinunternehmer_text').')'); + $offset += 8; } + + $offset += 5; - if ($this->hasMod('wpsg_mod_deliverynote')) + if ($this->hasMod('wpsg_mod_deliverynote') && ($this->get_option('wpsg_rechnungen_deliverynote') == '1')) { $arDN_order = $this->callMod('wpsg_mod_deliverynote', 'loadDeliveryNotesFromOrder', array($this->view['data']['id'])); $delivery_date = $this->callMod('wpsg_mod_deliverynote', 'getDeliveryTime', array($this->view['data']['id'])); - + // Wenn es ein Gesamtlieferdatum gibt und nur einen Lieferschein, dann unter der Bestellung anzeigen if ($delivery_date !== false && sizeof($arDN_order) == 1) { - $offset += 10; - - $pdf->wpsg_MultiCell($prod_left, $prod_top + $offset, 5, wpsg_translate(__('Lieferung: #1#', 'wpsg'), date('d.m.Y', $delivery_date))); - - $offset += 5; + $pdf->setFont('Arial', 'B', '9'); + $pdf->wpsg_MultiCell($prod_left - 1, $prod_top + $offset, 5, __('Lieferung:', 'wpsg')); + $pdf->setFont('Arial', '', '9'); + $pdf->wpsg_MultiCell($prod_left + 16, $prod_top + $offset, 5, wpsg_translate(__('#1#', 'wpsg'), date('d.m.Y', $delivery_date))); + $offset += 8; } } - $offset += 5; - if ($this->view['fussText'] != "") { - //$pdf->wpsg_MultiCell($prod_left - 1, $prod_top + $offset, 5, utf8_encode($this->view['fussText'])); + $pdf->setFont('Arial', '', '9'); $pdf->wpsg_MultiCell($prod_left - 1, $prod_top + $offset, 5, $this->view['fussText']); - $pdf->SetFont('Arial', 'B', 9); - $offset += 10; + $offset += 8; } + $offset += 10; + $shipping_adress = false; - 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']))) { $pdf->setFont('Arial', 'B', 9); $pdf->Text($prod_left, $prod_top + $offset, __("Lieferanschrift", "wpsg").":"); - $offset += 5; + $offset += 2; $pdf->setFont('Arial', '', 9); - $shipping_adress = ""; - if ($this->view['data']['shipping_firma'] != "") - { - $shipping_adress .= $this->view['data']['shipping_firma']."\r\n"; - } - $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_plz'].' '.$this->view['data']['shipping_ort']."\r\n"; - $shipping_adress .= $this->view['data']['shipping_land']['name']; - + $shipping_adress = ""; + if ($this->view['data']['shipping_firma'] != "") + { + $shipping_adress .= $this->view['data']['shipping_firma']."\r\n"; + } + $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_plz'].' '.$this->view['data']['shipping_ort']."\r\n"; + $shipping_adress .= $this->view['data']['shipping_land']['name']; $start = $pdf->getY(); $pdf->wpsg_MultiCell($prod_left - 1, $prod_top + $offset, 5, $shipping_adress, 0, 'L', 0, 100); @@ -927,45 +917,44 @@ } - - $offset += 5; - // Bestellvariablen if ($this->hasMod('wpsg_mod_ordervars') && $this->get_option('wpsg_mod_rechnungen_showov') == '1') { + + $pdf->SetFont('Arial', 'B', 9); + $pdf->wpsg_MultiCell($prod_left - 1, $prod_top + $offset - 7, 5, __("Angaben während der Bestellung", "wpsg").":"); - $bvars = @unserialize($this->view['data']['bvars']); - if (!is_array($bvars)) $bvars = array(); - - $strBVars = ""; - foreach ($bvars as $bvars_id => $bvars_value) - { - - $bvars = $this->db->fetchRow("SELECT * FROM `".wpsg_q(WPSG_TBL_ORDERVARS)."` WHERE `id` = '".wpsg_q($bvars_id)."' ORDER BY `pos` ASC, `id` ASC "); + $pdf->SetFont('Arial', '', 9); + + $bvars = @unserialize($this->view['data']['bvars']); + if (!is_array($bvars)) $bvars = array(); - if ($bvars['typ'] == "1") // Auswahl - { - if ($bvars_value <= 0) $bvars_value = __("Keine Angabe", "wpsg"); - } - else if ($bvars['typ'] == "2") // Texteingabe - { - if (trim($bvars_value) == "") $bvars_value = __("Keine Angabe", "wpsg"); - } - else if ($bvars['typ'] == "3") // Checkbox + $strBVars = ""; + foreach ($bvars as $bvars_id => $bvars_value) { - if ($bvars_value <= 0) $bvars_value = __("Keine Angabe", "wpsg"); + + $bvars = $this->db->fetchRow("SELECT * FROM `".wpsg_q(WPSG_TBL_ORDERVARS)."` WHERE `id` = '".wpsg_q($bvars_id)."' ORDER BY `pos` ASC, `id` ASC "); + + if ($bvars['typ'] == "1") // Auswahl + { + if ($bvars_value <= 0) $bvars_value = __("Keine Angabe", "wpsg"); + } + else if ($bvars['typ'] == "2") // Texteingabe + { + if (trim($bvars_value) == "") $bvars_value = __("Keine Angabe", "wpsg"); + } + else if ($bvars['typ'] == "3") // Checkbox + { + if ($bvars_value <= 0) $bvars_value = __("Keine Angabe", "wpsg"); + } + + $bvars_name = $this->callMod('wpsg_mod_ordervars', 'getNameById', array($bvars_id)); + $strBVars .= "\r\n".$bvars_name.": ".$bvars_value; + } - - $bvars_name = $this->callMod('wpsg_mod_ordervars', 'getNameById', array($bvars_id)); - $strBVars .= "\r\n".$bvars_name.": ".$bvars_value; - - } - - $pdf->SetFont('Arial', 'B', 9); - $pdf->Text($prod_left, $prod_top + $offset, __("Angaben während der Bestellung", "wpsg").":"); - $pdf->SetFont('Arial', '', 9); - $pdf->wpsg_MultiCell($prod_left - 1, $prod_top + $offset, 5, $strBVars); + $pdf->wpsg_MultiCell($prod_left - 1, $prod_top + $offset - 6, 5, $strBVars); + } if (!file_exists($this->callMod('wpsg_mod_rechnungen', 'getFilePath', array($this->view['data']['id'])))) -- cgit v1.2.3