diff options
| -rw-r--r-- | views/mods/mod_rechnungen/invoice_pdf.phtml | 1 | ||||
| -rwxr-xr-x | views/mods/mod_rechnungen/order_view_orderdata_after.phtml | 107 | ||||
| -rw-r--r-- | views/mods/mod_rechnungen/order_view_row.phtml | 8 |
3 files changed, 98 insertions, 18 deletions
diff --git a/views/mods/mod_rechnungen/invoice_pdf.phtml b/views/mods/mod_rechnungen/invoice_pdf.phtml index 0b6d5fd..ffbba40 100644 --- a/views/mods/mod_rechnungen/invoice_pdf.phtml +++ b/views/mods/mod_rechnungen/invoice_pdf.phtml @@ -313,7 +313,6 @@ if (sizeof($this->view['basket']['mwst']) >= 1 || $this->get_option('wpsg_showMwstAlways') == '1') {
-
$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');
diff --git a/views/mods/mod_rechnungen/order_view_orderdata_after.phtml b/views/mods/mod_rechnungen/order_view_orderdata_after.phtml index d8daed2..f8b4b5e 100755 --- a/views/mods/mod_rechnungen/order_view_orderdata_after.phtml +++ b/views/mods/mod_rechnungen/order_view_orderdata_after.phtml @@ -156,11 +156,7 @@ <span style="display:flex; justify-content:flex-end; gap:0.5rem; grid-column:1/span 3;"> <input class="button" style="" id="invoice_wpsg_rechnungen_preview" name="wpsg_rechnungen_preview" type="submit" value="Vorschau"> - <input class="button" style="" id="invoice_wpsg_rechnungen_submit" onclick="window.setTimeout(function() { location.href = '<?php - - echo wpsg_admin_url('Order', 'view', ['edit_id' => $oOrder->getId()]); - - ?>'; }, 1000);" name="wpsg_rechnungen_write" type="submit" value="Rechnung schreiben"> + <input class="button" style="" id="invoice_wpsg_rechnungen_submit" onclick="" name="wpsg_rechnungen_write" type="submit" value="Rechnung schreiben"> </span> @@ -182,8 +178,52 @@ }; let el_invoice_wpsg_rechnungen_preview = document.getElementById('invoice_wpsg_rechnungen_preview'); - let el_invoice_wpsg_rechnungen_submit = document.getElementById('el_invoice_wpsg_rechnungen_submit'); + let el_invoice_wpsg_rechnungen_submit = document.getElementById('invoice_wpsg_rechnungen_submit'); + function check_invoice_amount(event) { + + let ok = false; + + for (let el_checkbox of document.getElementsByClassName('wpsg_check_amount')) { + + if (el_checkbox.checked) { + + if (parseInt(el_checkbox.nextElementSibling.value) > 0) { + + ok = true; break; + + } + + } + + } + + if (ok) { + + if (event.target.getAttribute("id") === 'invoice_wpsg_rechnungen_submit') { + + window.setTimeout(function() { location.href = '<?php + + echo wpsg_admin_url('Order', 'view', ['edit_id' => $oOrder->getId()]); + + ?>'; }, 1000); + + } + + } else { + + alert('<?php echo __('Bitte mindestens ein Produkt auswählen!', 'wpsg'); ?>'); + + event.stopPropagation(); + event.preventDefault(); + + } + + } + + el_invoice_wpsg_rechnungen_preview.addEventListener('click', check_invoice_amount); + el_invoice_wpsg_rechnungen_submit.addEventListener('click', check_invoice_amount); + </script> </form> @@ -256,11 +296,7 @@ <span style="display:flex; justify-content:flex-end; gap:0.5rem; grid-column:1/span 3;"> <input class="button" style="" id="invoice_wpsg_storno_preview" name="wpsg_storno_preview" type="submit" value="Vorschau"> - <input class="button" style="" id="invoice_wpsg_storno_submit" onclick="window.setTimeout(function() { location.href = '<?php - - echo wpsg_admin_url('Order', 'view', ['edit_id' => $oOrder->getId()]); - - ?>'; }, 1000);" name="wpsg_storno_write" type="submit" value="Rechnungskorrektur schreiben"> + <input class="button" style="" id="invoice_wpsg_storno_submit" onclick="" name="wpsg_storno_write" type="submit" value="Rechnungskorrektur schreiben"> </span> @@ -270,7 +306,51 @@ let el_invoice_wpsg_storno_preview = document.getElementById('invoice_wpsg_storno_preview'); let el_invoice_wpsg_storno_submit = document.getElementById('invoice_wpsg_storno_submit'); - + + function check_invoice_amount(event) { + + let ok = false; + + for (let el_checkbox of document.getElementsByClassName('wpsg_check_amount')) { + + if (el_checkbox.checked) { + + if (parseInt(el_checkbox.nextElementSibling.value) > 0) { + + ok = true; break; + + } + + } + + } + + if (ok) { + + if (event.target.getAttribute("id") === 'invoice_wpsg_storno_submit') { + + window.setTimeout(function() { location.href = '<?php + + echo wpsg_admin_url('Order', 'view', ['edit_id' => $oOrder->getId()]); + + ?>'; }, 1000); + + } + + } else { + + alert('<?php echo __('Bitte mindestens ein Produkt auswählen!', 'wpsg'); ?>'); + + event.stopPropagation(); + event.preventDefault(); + + } + + } + + el_invoice_wpsg_storno_preview.addEventListener('click', check_invoice_amount); + el_invoice_wpsg_storno_submit.addEventListener('click', check_invoice_amount); + </script> </form> @@ -304,7 +384,8 @@ label[for="invoice_shippay"] .link_invoice, label[for="storno_shippay"] .link_invoice { padding:0; } - .wpsg_mod_rechnungen_row { display:block; width:100%; padding:5px; } + .wpsg_mod_rechnungen_row { display:block; width:100%; } + .wpsg_mod_rechnungen_row > div { padding:5px; } .wpsg_mod_rechnungen_row .invoice_wrap:not(:only-child) { margin-top:0.5rem; } .wpsg_mod_rechnungen_row .invoice_wrap > a:first-child { padding-left:0; } diff --git a/views/mods/mod_rechnungen/order_view_row.phtml b/views/mods/mod_rechnungen/order_view_row.phtml index 97e2667..f6a2064 100644 --- a/views/mods/mod_rechnungen/order_view_row.phtml +++ b/views/mods/mod_rechnungen/order_view_row.phtml @@ -36,8 +36,8 @@ <div style="display:flex; flex-direction:row; gap:0.5rem; font-weight:normal; align-items:center;">
<span><?php echo __('Menge'); ?></span>
- <input form="invoice_form" type="hidden" name="invoice_products[<?php echo $p['order_product_id']; ?>][set]" value="0" />
- <input checked="checked" form="invoice_form" type="checkbox" class="wpsg_mod_deliverynote_product" name="invoice_products[<?php echo $p['order_product_id']; ?>][set]" value="1" style="margin:0;" />
+ <input form="invoice_form" type="hidden" name="invoice_products[<?php echo $p['order_product_id']; ?>][set]" value="0" class="" />
+ <input checked="checked" form="invoice_form" type="checkbox" class="wpsg_mod_deliverynote_product wpsg_check_amount" name="invoice_products[<?php echo $p['order_product_id']; ?>][set]" value="1" style="margin:0;" />
<input form="invoice_form" name="invoice_products[<?php echo $p['order_product_id']; ?>][amount]" type="number" max="<?php echo $invoice_amount; ?>" min="1" value="<?php echo min($invoice_amount, $p['amount']); ?>" style="padding:0; font-size:14px; line-height:22px; min-height:initial; height:22px; width:50px; text-indent:5px; border:1px solid black; margin:0;" />
@@ -63,8 +63,8 @@ <div style="display:flex; flex-direction:row; gap:0.5rem; font-weight:normal; align-items:center;">
<span><?php echo __('Menge'); ?></span>
- <input form="storno_form" type="hidden" name="storno_products[<?php echo $p['order_product_id']; ?>][set]" value="0" />
- <input form="storno_form" type="checkbox" class="wpsg_mod_deliverynote_product" name="storno_products[<?php echo $p['order_product_id']; ?>][set]" value="1" style="margin:0;" />
+ <input form="storno_form" type="hidden" name="storno_products[<?php echo $p['order_product_id']; ?>][set]" value="0" class="" />
+ <input form="storno_form" type="checkbox" class="wpsg_mod_deliverynote_product wpsg_check_amount" name="storno_products[<?php echo $p['order_product_id']; ?>][set]" value="1" style="margin:0;" />
<input form="storno_form" oninput="event.target.previousElementSibling.checked = true;" onchange="event.target.previousElementSibling.checked = true;" name="storno_products[<?php echo $p['order_product_id']; ?>][amount]" type="number" max="<?php echo $storno_amount; ?>" min="1" value="<?php echo min($storno_amount, $p['amount']); ?>" style="padding:0; font-size:14px; line-height:22px; min-height:initial; height:22px; width:50px; text-indent:5px; border:1px solid black; margin:0;" />
|
