From 512c9c7dad71f3f36969ea13ef45b49106412c5b Mon Sep 17 00:00:00 2001 From: Daniel Schmitzer Date: Mon, 30 Jan 2023 06:06:46 +0000 Subject: - Feature: Suche nach Rechnungen in Bestellverwaltung durch Datenbankänderung angepasst MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit git-svn-id: https://[internal]/wordpress/plugins/wpsg4@8214 0d5edaf7-2b12-4e95-93f4-047927463d4b --- views/mods/mod_rechnungen/accounting_pdf.phtml | 33 +++++++---------- views/mods/mod_rechnungen/invoice_pdf.phtml | 39 +++++++++----------- views/mods/mod_rechnungen/multi_invoice_pdf.phtml | 43 +++++++++++----------- .../order_view_orderdata_after.phtml | 6 +-- 4 files changed, 55 insertions(+), 66 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 7e7f97a..6b2c9e0 100644 --- a/views/mods/mod_rechnungen/accounting_pdf.phtml +++ b/views/mods/mod_rechnungen/accounting_pdf.phtml @@ -9,7 +9,10 @@ require_once WPSG_PATH_LIB.'wpsg_fpdf.class.php'; global $absender_left, $absender_top, $adress_left, $adress_top, $rdata_left, $rdata_top; - + + /** @var wpsg\wpsg_invoice|null $oInvoice */ + $oInvoice = $this->view['oInvoice']; + // Positionierung der Absenderadresszeile $absender_left = 25; $absender_top = 50; @@ -47,31 +50,31 @@ $pdf->AddPage(); - if (file_exists($shop->callMod('wpsg_mod_rechnungen', 'getFilePath', array(''))."wpsg_rechnungen_bp.pdf")) + if (file_exists($shop->callMod('wpsg_mod_rechnungen', 'getPaperPath', array())."wpsg_rechnungen_bp.pdf")) { - $pagecount = $pdf->setSourceFile($shop->callMod('wpsg_mod_rechnungen', 'getFilePath', array(''))."wpsg_rechnungen_bp.pdf"); + $pagecount = $pdf->setSourceFile($shop->callMod('wpsg_mod_rechnungen', 'getPaperPath', array())."wpsg_rechnungen_bp.pdf"); $tplidx = $pdf->importPage(1, '/MediaBox'); $pdf->useTemplate($tplidx, 0, 0, 210); } - if (file_exists($shop->callMod('wpsg_mod_rechnungen', 'getFilePath', array(''))."wpsg_rechnungen_bp.jpg")) + if (file_exists($shop->callMod('wpsg_mod_rechnungen', 'getPaperPath', array())."wpsg_rechnungen_bp.jpg")) { - $pdf->image($shop->callMod('wpsg_mod_rechnungen', 'getFilePath', array(''))."wpsg_rechnungen_bp.jpg", 0, 0, 210, 297, 'jpg'); + $pdf->image($shop->callMod('wpsg_mod_rechnungen', 'getPaperPath', array())."wpsg_rechnungen_bp.jpg", 0, 0, 210, 297, 'jpg'); } - if (file_exists($shop->callMod('wpsg_mod_rechnungen', 'getFilePath', array(''))."wpsg_rechnungen_logo.jpg")) + if (file_exists($shop->callMod('wpsg_mod_rechnungen', 'getPaperPath', array())."wpsg_rechnungen_logo.jpg")) { - list($width, $height, $type, $attr) = getimagesize($shop->callMod('wpsg_mod_rechnungen', 'getFilePath', array(''))."wpsg_rechnungen_logo.jpg"); + list($width, $height, $type, $attr) = getimagesize($shop->callMod('wpsg_mod_rechnungen', 'getPaperPath', array())."wpsg_rechnungen_logo.jpg"); //wpsg_debug($width.":".$height); $wPix = (25.4 * $width) / 96; $hPix = (25.4 * $height) / 96; - $pdf->image($shop->callMod('wpsg_mod_rechnungen', 'getFilePath', array(''))."wpsg_rechnungen_logo.jpg", 210 - $wPix, 0, $wPix, $hPix); + $pdf->image($shop->callMod('wpsg_mod_rechnungen', 'getPaperPath', array())."wpsg_rechnungen_logo.jpg", 210 - $wPix, 0, $wPix, $hPix); } @@ -887,30 +890,20 @@ $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'])))) - { - - mkdir($this->callMod('wpsg_mod_rechnungen', 'getFilePath', array($this->view['data']['id'])), 0777, true); - - } - + $this->callMods('wpsg_mod_rechnungen_pdf', array(&$pdf, &$this->view['data']['id'], &$this->view['preview'], &$this->view['invoice'])); $filename = $this->view['filename'].".pdf"; ob_end_clean(); - wpsg_debug($pdf->Output($filename, 'I')); - die(); - if ($this->view['preview']) { $pdf->Output($filename, 'I'); } else { - $pdf->Output($this->callMod('wpsg_mod_rechnungen', 'getFilePath', array($this->view['data']['id'])).$filename, 'F'); + $pdf->Output($oInvoice->getFilePath(), 'F'); // Hier wird der Dateiname an FPD übergeben. Er soll sich aus der Rechnungsnummer ergeben, auch wenn das Dokument über die ID gespeichert ist. $pdf->Output($this->view['filename_out'], 'I'); diff --git a/views/mods/mod_rechnungen/invoice_pdf.phtml b/views/mods/mod_rechnungen/invoice_pdf.phtml index c0b7836..5fe810b 100644 --- a/views/mods/mod_rechnungen/invoice_pdf.phtml +++ b/views/mods/mod_rechnungen/invoice_pdf.phtml @@ -9,7 +9,10 @@ require_once WPSG_PATH_LIB.'wpsg_fpdf.class.php'; global $absender_left, $absender_top, $adress_left, $adress_top, $rdata_left, $rdata_top; - + + /** @var \wpsg\wpsg_invoice|null $oInvoice */ + $oInvoice = $this->view['oInvoice']??null; + // Positionierung der Absenderadresszeile $absender_left = 25; $absender_top = 50; @@ -47,22 +50,22 @@ $pdf->AddPage(); - if (file_exists($shop->callMod('wpsg_mod_rechnungen', 'getFilePath', array(''))."wpsg_rechnungen_bp.pdf")) { + if (file_exists($shop->callMod('wpsg_mod_rechnungen', 'getPaperPath', array())."wpsg_rechnungen_bp.pdf")) { - $pdf->setSourceFile($shop->callMod('wpsg_mod_rechnungen', 'getFilePath', array(''))."wpsg_rechnungen_bp.pdf"); + $pdf->setSourceFile($shop->callMod('wpsg_mod_rechnungen', 'getPaperPath', array())."wpsg_rechnungen_bp.pdf"); $tplidx = $pdf->importPage(1, '/MediaBox'); $pdf->useTemplate($tplidx, 0, 0, 210); - } else if (file_exists($shop->callMod('wpsg_mod_rechnungen', 'getFilePath', array(''))."wpsg_rechnungen_bp.jpg")) { + } else if (file_exists($shop->callMod('wpsg_mod_rechnungen', 'getPaperPath', array())."wpsg_rechnungen_bp.jpg")) { - $pdf->image($shop->callMod('wpsg_mod_rechnungen', 'getFilePath', array(''))."wpsg_rechnungen_bp.jpg", 0, 0, 210, 297, 'jpg'); + $pdf->image($shop->callMod('wpsg_mod_rechnungen', 'getPaperPath', array())."wpsg_rechnungen_bp.jpg", 0, 0, 210, 297, 'jpg'); } - if (file_exists($shop->callMod('wpsg_mod_rechnungen', 'getFilePath', array(''))."wpsg_rechnungen_logo.jpg")) + if (file_exists($shop->callMod('wpsg_mod_rechnungen', 'getPaperPath', array())."wpsg_rechnungen_logo.jpg")) { - list($width, $height, $type, $attr) = getimagesize($shop->callMod('wpsg_mod_rechnungen', 'getFilePath', array(''))."wpsg_rechnungen_logo.jpg"); + list($width, $height, $type, $attr) = getimagesize($shop->callMod('wpsg_mod_rechnungen', 'getPaperPath', array())."wpsg_rechnungen_logo.jpg"); // Umrechnung von Inch zu Pixel $wPix = (25.4 * (int)$width) / 96; @@ -89,23 +92,23 @@ if(isset($logo_pos) && $logo_pos === "right") { $abscissa = $rightPos; } $pdf->SetAlpha($alpha); - $pdf->image($shop->callMod('wpsg_mod_rechnungen', 'getFilePath', array(''))."wpsg_rechnungen_logo.jpg", $abscissa, $ordinate, $wPix, $hPix); + $pdf->image($shop->callMod('wpsg_mod_rechnungen', 'getPaperPath', array())."wpsg_rechnungen_logo.jpg", $abscissa, $ordinate, $wPix, $hPix); $pdf->SetAlpha(1); } // Absenderadresszeile (Wird in der Konfiguration hinterlegt) $pdf->SetFont('Arial', '', 6); - $pdf->Text($absender_left, $absender_top, $shop->replaceUniversalPlatzhalter(__($shop->get_option("wpsg_rechnungen_adresszeile"), 'wpsg'), $shop->view['data']['id'])); + $pdf->Text($absender_left, $absender_top, $shop->replaceUniversalPlatzhalter(__($shop->get_option("wpsg_rechnungen_adresszeile"), 'wpsg'), $shop->view['data']['id']??0)); if (wpsg_getStr($shop->view['kunde']['kuerzel']) != "") $shop->view['kunde']['kuerzel'] = $shop->view['kunde']['kuerzel'].'-'; // Adresse des Kunden $pdf->SetFont('Arial', '', 12); - $pdf->Text($adress_left, $adress_top, $shop->view['kunde']['firma']); - $pdf->Text($adress_left, $adress_top + 5, $shop->view['kunde']['vname'].' '.$shop->view['kunde']['name']); - $pdf->Text($adress_left, $adress_top + 10, $shop->view['kunde']['strasse'].' '.wpsg_getStr($shop->view['kunde']['nr'])); - $pdf->Text($adress_left, $adress_top + 15, $shop->view['kunde']['plz'].' '.$shop->view['kunde']['ort']); + $pdf->Text($adress_left, $adress_top, $shop->view['kunde']['firma']??''); + $pdf->Text($adress_left, $adress_top + 5, ($shop->view['kunde']['vname']??'').' '.($shop->view['kunde']['name']??'')); + $pdf->Text($adress_left, $adress_top + 10, ($shop->view['kunde']['strasse']??'').' '.($shop->view['kunde']['nr']??'')); + $pdf->Text($adress_left, $adress_top + 15, ($shop->view['kunde']['plz']??'').' '.($shop->view['kunde']['ort']??'')); if ($shop->get_option("wpsg_mod_rechnungen_hideCountry") == '0') $pdf->Text($adress_left, $adress_top + 20, strtoupper($shop->view['oOrder']->getInvoiceCountryName())); @@ -900,13 +903,6 @@ } - if (!file_exists($this->callMod('wpsg_mod_rechnungen', 'getFilePath', array($this->view['data']['id'])))) - { - - mkdir($this->callMod('wpsg_mod_rechnungen', 'getFilePath', array($this->view['data']['id'])), 0777, true); - - } - $this->callMods('wpsg_mod_rechnungen_pdf', array(&$pdf, &$this->view['data']['id'], &$this->view['preview'], &$this->view['invoice'])); $filename = $this->view['filename'].".pdf"; @@ -919,11 +915,10 @@ } else { - $pdf->Output($this->callMod('wpsg_mod_rechnungen', 'getFilePath', array($this->view['data']['id'])).$filename, 'F'); + $pdf->Output($oInvoice->getFilePath(), 'F'); // Hier wird der Dateiname an FPD übergeben. Er soll sich aus der Rechnungsnummer ergeben, auch wenn das Dokument über die ID gespeichert ist. if ($this->view['output'] === true) $pdf->Output($this->view['filename_out'], 'I'); } -?> \ No newline at end of file diff --git a/views/mods/mod_rechnungen/multi_invoice_pdf.phtml b/views/mods/mod_rechnungen/multi_invoice_pdf.phtml index 0902fce..fcad732 100644 --- a/views/mods/mod_rechnungen/multi_invoice_pdf.phtml +++ b/views/mods/mod_rechnungen/multi_invoice_pdf.phtml @@ -9,7 +9,7 @@ require_once WPSG_PATH_LIB.'wpsg_fpdf.class.php'; - global $absender_left, $absender_top, $adress_left, $adress_top, $rdata_left, $rdata_top, $rhead_left, $rhead_top, $sum_multi_offset, $pdf; + global $absender_left, $absender_top, $adress_left, $adress_top, $rdata_left, $rdata_top, $rhead_left, $rhead_top, $sum_multi_offset, $pdf, $data; // Positionierung der Absenderadresszeile $absender_left = 25; @@ -33,11 +33,17 @@ // Anzahl an Produkten pro Seite $prod_break = $this->get_option('wpsg_rechnungen_pdfperpage'); - - $arCalculation = $this->view['basket']['arCalculation']; + + /* + $arCalculation = $this->view['basket']['arCalculation']; $data = $this->view['multi_data']['orders'][0]['data']; $sum = $this->view['multi_data']['orders'][0]['sum']; - + */ + + $arCalculation = array_values($this->view['multi_data']['order_data'])[0]['arCalculation']; + $data = $this->view['data']; + $sum = $arCalculation['sum']; + if ($this->getFrontendTaxView() === WPSG_NETTO) $taxdisplay = 'netto'; else $taxdisplay = 'brutto'; @@ -45,28 +51,28 @@ function AddRechnungPage($shop, $pdf) { - global $absender_left, $absender_top, $adress_left, $adress_top, $rdata_left, $rdata_top, $offset, $sum_multi_offset; + global $absender_left, $absender_top, $adress_left, $adress_top, $rdata_left, $rdata_top, $offset, $sum_multi_offset, $data; $pdf->AddPage(); $sum_multi_offset = 0; - if (file_exists($shop->callMod('wpsg_mod_rechnungen', 'getFilePath', array(''))."wpsg_rechnungen_bp.pdf")) { + if (file_exists($shop->callMod('wpsg_mod_rechnungen', 'getPaperPath', array())."wpsg_rechnungen_bp.pdf")) { - $pdf->setSourceFile($shop->callMod('wpsg_mod_rechnungen', 'getFilePath', array(''))."wpsg_rechnungen_bp.pdf"); + $pdf->setSourceFile($shop->callMod('wpsg_mod_rechnungen', 'getPaperPath', array())."wpsg_rechnungen_bp.pdf"); $tplidx = $pdf->importPage(1, '/MediaBox'); $pdf->useTemplate($tplidx, 0, 0, 210); - } else if (file_exists($shop->callMod('wpsg_mod_rechnungen', 'getFilePath', array(''))."wpsg_rechnungen_bp.jpg")) { + } else if (file_exists($shop->callMod('wpsg_mod_rechnungen', 'getPaperPath', array())."wpsg_rechnungen_bp.jpg")) { - $pdf->image($shop->callMod('wpsg_mod_rechnungen', 'getFilePath', array(''))."wpsg_rechnungen_bp.jpg", 0, 0, 210, 297, 'jpg'); + $pdf->image($shop->callMod('wpsg_mod_rechnungen', 'getPaperPath', array())."wpsg_rechnungen_bp.jpg", 0, 0, 210, 297, 'jpg'); } - if (file_exists($shop->callMod('wpsg_mod_rechnungen', 'getFilePath', array(''))."wpsg_rechnungen_logo.jpg")) + if (file_exists($shop->callMod('wpsg_mod_rechnungen', 'getPaperPath', array())."wpsg_rechnungen_logo.jpg")) { - list($width, $height, $type, $attr) = getimagesize($shop->callMod('wpsg_mod_rechnungen', 'getFilePath', array(''))."wpsg_rechnungen_logo.jpg"); + list($width, $height, $type, $attr) = getimagesize($shop->callMod('wpsg_mod_rechnungen', 'getPaperPath', array())."wpsg_rechnungen_logo.jpg"); // Umrechnung von Inch zu Pixel $wPix = (25.4 * (int)$width) / 96; @@ -93,12 +99,12 @@ if(isset($logo_pos) && $logo_pos === "right") { $abscissa = $rightPos; } $pdf->SetAlpha($alpha); - $pdf->image($shop->callMod('wpsg_mod_rechnungen', 'getFilePath', array(''))."wpsg_rechnungen_logo.jpg", $abscissa, $ordinate, $wPix, $hPix); + $pdf->image($shop->callMod('wpsg_mod_rechnungen', 'getPaperPath', array())."wpsg_rechnungen_logo.jpg", $abscissa, $ordinate, $wPix, $hPix); $pdf->SetAlpha(1); } - - // Absenderadresszeile (Wird in der Konfiguration hinterlegt) + + // Absenderadresszeile (Wird in der Konfiguration hinterlegt) $pdf->SetFont('Arial', '', 6); $pdf->Text($absender_left, $absender_top, $shop->replaceUniversalPlatzhalter(__($shop->get_option("wpsg_rechnungen_adresszeile"), 'wpsg'), $data['id'])); @@ -188,7 +194,7 @@ $rhead_count = 1; $sum_multi_offset = 0; - $orders = $this->view['multi_data']['orders']; + // $orders = $this->view['multi_data']['orders']; // noMwSt $head_data = array_values($this->view['multi_data']['order_data'])[0]; @@ -237,8 +243,6 @@ // Bestellnummer anzeigen $pdf->Text($rhead_left + 155, $rhead_top + $sum_multi_offset, __("Best. Nr.", "wpsg")); $pdf->Text($rhead_left + 155, $rhead_top + $sum_multi_offset + 6, $oOrder->getNr()); - - $summe = 0; $bKopf = false; $pnr = 1; $offset = 0; $count = 0; @@ -468,9 +472,7 @@ $pnr ++; $count ++; - - $summe += $p['price'] * $p['menge']; - + if ($pdf->getY() > 220 || ($count >= $prod_break && sizeof($oOrder->getOrderProducts()) > ($pnr - 1))) { AddRechnungPage($this, $pdf); @@ -897,7 +899,6 @@ if ($this->view['preview']) { - //$pdf->Output($this->callMod('wpsg_mod_rechnungen', 'getFilePath', array('multi')).$filename, 'F'); $pdf->Output(); exit; diff --git a/views/mods/mod_rechnungen/order_view_orderdata_after.phtml b/views/mods/mod_rechnungen/order_view_orderdata_after.phtml index 24cf97c..da518dc 100755 --- a/views/mods/mod_rechnungen/order_view_orderdata_after.phtml +++ b/views/mods/mod_rechnungen/order_view_orderdata_after.phtml @@ -202,11 +202,11 @@ } if (ok) { - + if (event.target.getAttribute("id") === 'invoice_wpsg_rechnungen_submit') { - window.setTimeout(function() { location.href = ' $oOrder->getId()]); ?>'; }, 1000); -- cgit v1.2.3