diff options
| author | Daniel Schmitzer <noreply@maennchen1.de> | 2023-01-30 06:06:46 +0000 |
|---|---|---|
| committer | Daniel Schmitzer <noreply@maennchen1.de> | 2023-01-30 06:06:46 +0000 |
| commit | 512c9c7dad71f3f36969ea13ef45b49106412c5b (patch) | |
| tree | 92c18d05cb55ab09f1c6590ee37a19ec9c975b95 /views | |
| parent | f962f206bfd5fce78003385b1917291acb1c8da3 (diff) | |
- Feature: Suche nach Rechnungen in Bestellverwaltung durch Datenbankänderung angepasst
git-svn-id: https://[internal]/wordpress/plugins/wpsg4@8214 0d5edaf7-2b12-4e95-93f4-047927463d4b
Diffstat (limited to 'views')
| -rw-r--r-- | views/mods/mod_kundenverwaltung/order.phtml | 28 | ||||
| -rw-r--r-- | views/mods/mod_rechnungen/accounting_pdf.phtml | 33 | ||||
| -rw-r--r-- | views/mods/mod_rechnungen/invoice_pdf.phtml | 39 | ||||
| -rw-r--r-- | views/mods/mod_rechnungen/multi_invoice_pdf.phtml | 43 | ||||
| -rwxr-xr-x | views/mods/mod_rechnungen/order_view_orderdata_after.phtml | 6 | ||||
| -rw-r--r-- | views/order/view_general.phtml | 7 |
6 files changed, 80 insertions, 76 deletions
diff --git a/views/mods/mod_kundenverwaltung/order.phtml b/views/mods/mod_kundenverwaltung/order.phtml index 5b3bc9a..d47b4d2 100644 --- a/views/mods/mod_kundenverwaltung/order.phtml +++ b/views/mods/mod_kundenverwaltung/order.phtml @@ -22,14 +22,26 @@ <div class="wpsg_inner wpsg_order_<?php echo $order['id']; ?>">
<strong><?php echo __('Bestellstatus', 'wpsg'); ?>:</strong>
<?php echo $this->arStatus[$order['status']]; ?>
- <?php if ($this->hasMod('wpsg_mod_rechnungen')) { ?>
-
- <?php if ($r = $this->callMod('wpsg_mod_rechnungen', 'getOrderInvoice', array($order['id']))) { ?>
- <a href="<?php echo $this->callMod('wpsg_mod_rechnungen', 'getFrontendLink', array($r['id'])); ?>"><?php echo wpsg_translate(__('Rechnung #1#', 'wpsg'), $r['rnr']); ?></a>
- <?php } else if ($r = $this->callMod('wpsg_mod_rechnungen', 'getOrderCredit', array($order['id']))) { ?>
- <a href="<?php echo $this->callMod('wpsg_mod_rechnungen', 'getFrontendLink', array($r['id'])); ?>"><?php echo wpsg_translate(__('Rechnungskorrektur #1#', 'wpsg'), $r['gnr']); ?></a>
- <?php } ?>
-
+ <?php if ($this->hasMod('wpsg_mod_rechnungen')) {
+
+ $arInvoice = \wpsg\wpsg_invoice::findByOrderId(intval($order['id']));
+
+ ?>
+
+ <?php foreach ($arInvoice as $oInvoice) { ?>
+
+ <?php if ($oInvoice->isInvoice()) { ?>
+
+ <a href="<?php echo $this->callMod('wpsg_mod_rechnungen', 'getFrontendLink', [$oInvoice->getId()]); ?>"><?php echo wpsg_translate(__('Rechnung #1#', 'wpsg'), $oInvoice->getNr()); ?></a>
+
+ <?php } else if ($oInvoice->isStorno()) { ?>
+
+ <a href="<?php echo $this->callMod('wpsg_mod_rechnungen', 'getFrontendLink', [$oInvoice->getId()]); ?>"><?php echo wpsg_translate(__('Rechnungskorrektur #1#', 'wpsg'), $oInvoice->getNr()); ?></a>
+
+ <?php } ?>
+
+ <?php } ?>
+
<?php } ?>
<br />
<strong><?php echo __('Rechnungsbetrag', 'wpsg'); ?>:</strong> <?php echo wpsg_ff($order['price_gesamt'], $this->get_option('wpsg_currency')); ?><br />
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 = '<?php - + window.setTimeout(function() { location.href = '<?php + echo wpsg_admin_url('Order', 'view', ['edit_id' => $oOrder->getId()]); ?>'; }, 1000); diff --git a/views/order/view_general.phtml b/views/order/view_general.phtml index 28d3018..c2a1bd7 100644 --- a/views/order/view_general.phtml +++ b/views/order/view_general.phtml @@ -34,8 +34,11 @@ <?php echo wpsg_drawForm_Select('status', __('Neuer Status', 'wpsg'), $this->arStatus, $this->view['data']['status']); ?>
<?php echo wpsg_drawForm_Checkbox('sendMail', __('Kunden informieren', 'wpsg'), 0); ?>
- <?php if ($this->hasMod('wpsg_mod_rechnungen')) { $db_invoice = $this->callMod('wpsg_mod_rechnungen', 'getOrderInvoice', [$this->view['oOrder']->id]); ?>
- <?php if (wpsg_isSizedInt($db_invoice['id'])) { ?>
+ <?php if ($this->hasMod('wpsg_mod_rechnungen')) {
+
+ $arInvoice = \wpsg\wpsg_invoice::findByOrderId($this->view['oOrder']->id);
+
+ if (sizeof($arInvoice) > 0) { ?>
<script>
jQuery('#sendMail').on('click', function() {
|
