Rev 8370 | Blame | Compare with Previous | Last modification | View Log | RSS feed
<?php
/**
* Template für die Rechnungsmodulansicht innerhalb der Bestellansicht
*/
use horstoeko\zugferd\ZugferdProfiles;
use wpsg\mod_invoice\eInvoice;
?>
<div id="wpsg_mod_rechnungen_order_view">
<?php echo wpsg_drawForm_AdminboxStart(__('Rechnungen', 'wpsg')); ?>
<?php if (sizeof($this->view['mod_rechnungen']['arRechnungen']) == 0 && sizeof($this->view['mod_rechnungen']['arRechnungen_storno']) == 0) { ?>
<p><?php echo __('Bisher keine Rechnungen geschrieben.', 'wpsg'); ?></p>
<?php } else { ?>
<div class="grid">
<?php foreach ($this->view['mod_rechnungen']['arRechnungen_gesamt'] as $r) {
$oInvoice = \wpsg\wpsg_invoice::getInstance($r['id']);
?>
<div>
<?php echo $oInvoice->getDate(true); ?>
</div>
<div>
<?php echo $oInvoice->getNr(true); ?>
</div>
<div>
<div id="e_invoice_app_<?php echo $oInvoice->getId(); ?>"></div>
<script type="module">
import { initEInvoiceApp } from '<?php echo wpsg_ShopController::getShop()->getRessourceURL('mods/mod_rechnungen/js/e_invoice_app.module.js'); ?>';
initEInvoiceApp(document.getElementById('e_invoice_app_<?php echo $oInvoice->getId(); ?>'), {
'invoice_id': <?php echo $oInvoice->getId(); ?>,
'template_url': '<?php echo wpsg_ShopController::getShop()->getRessourceURL('mods/mod_rechnungen/html/e_invoice_app.html'); ?>',
'default_profile': <?php echo intval(wpsg_ShopController::getShop()->get_option('wpsg_mod_rechnungen_einvoice')); ?>,
'arProfile': <?php echo json_encode([
100 + ZugferdProfiles::PROFILE_MINIMUM => ['label' => __('EN16931 Minimum', 'wpsg'), 'url' => eInvoice::buildUrl($oInvoice->getId(), ZugferdProfiles::PROFILE_MINIMUM)],
100 + ZugferdProfiles::PROFILE_BASIC => ['label' => __('EN16931 Basic', 'wpsg'), 'url' => eInvoice::buildUrl($oInvoice->getId(), ZugferdProfiles::PROFILE_BASIC)],
100 + ZugferdProfiles::PROFILE_BASICWL => ['label' => __('EN16931 Basic WL', 'wpsg'), 'url' => eInvoice::buildUrl($oInvoice->getId(), ZugferdProfiles::PROFILE_BASICWL)],
100 + ZugferdProfiles::PROFILE_EN16931 => ['label' => __('EN16931 Comfort', 'wpsg'), 'url' => eInvoice::buildUrl($oInvoice->getId(), ZugferdProfiles::PROFILE_EN16931)],
100 + ZugferdProfiles::PROFILE_EXTENDED => ['label' => __('EN16931 Extended', 'wpsg'), 'url' => eInvoice::buildUrl($oInvoice->getId(), ZugferdProfiles::PROFILE_EXTENDED)],
100 + ZugferdProfiles::PROFILE_XRECHNUNG => ['label' => __('EN16931 XRechnung 1', 'wpsg'), 'url' => eInvoice::buildUrl($oInvoice->getId(), ZugferdProfiles::PROFILE_XRECHNUNG)],
100 + ZugferdProfiles::PROFILE_XRECHNUNG_2 => ['label' => __('EN16931 XRechnung 2', 'wpsg'), 'url' => eInvoice::buildUrl($oInvoice->getId(), ZugferdProfiles::PROFILE_XRECHNUNG_2)],
100 + ZugferdProfiles::PROFILE_XRECHNUNG_2_1 => ['label' => __('EN16931 XRechnung 2.1', 'wpsg'), 'url' => eInvoice::buildUrl($oInvoice->getId(), ZugferdProfiles::PROFILE_XRECHNUNG_2_1)],
100 + ZugferdProfiles::PROFILE_XRECHNUNG_2_2 => ['label' => __('EN16931 XRechnung 2.2', 'wpsg'), 'url' => eInvoice::buildUrl($oInvoice->getId(), ZugferdProfiles::PROFILE_XRECHNUNG_2_2)],
100 + ZugferdProfiles::PROFILE_XRECHNUNG_2_3 => ['label' => __('EN16931 XRechnung 2.3', 'wpsg'), 'url' => eInvoice::buildUrl($oInvoice->getId(), ZugferdProfiles::PROFILE_XRECHNUNG_2_3)],
100 + ZugferdProfiles::PROFILE_XRECHNUNG_3 => ['label' => __('EN16931 XRechnung 3', 'wpsg'), 'url' => eInvoice::buildUrl($oInvoice->getId(), ZugferdProfiles::PROFILE_XRECHNUNG_3)]
]); ?>
});
</script>
</div>
<div style="text-align:right; white-space:nowrap;">
<?php /*
<a target="_blank" href="<?php
echo wp_nonce_url(WPSG_URL_WP.'wp-admin/admin.php?page=wpsg-Order&mod=wpsg_mod_rechnungen&noheader=1&action=ajax&edit_id='.$_REQUEST['edit_id'].'&r_id='.$r['id'].'&do=rebuildadmin', 'wpsg-mod_invoice-order_ajax-rebuildadmin-'.$_REQUEST['edit_id']);
?>" style="color:red;"><?php echo __('Neu erstellen', 'wpsg'); ?></a>
*/ ?>
<a target="_blank" onclick="if (!confirm('<?php echo __('Sind Sie sicher, dass Sie eine Kopie dieser Rechnung/Rechnungskorrektur erneut an den Kunden senden möchten?', 'wpsg'); ?>')) return false;" href="<?php
if ($r['o_id'] == '0') {
// Multirechnung
$r_o_ids = array_map('intval', explode(',', $r['o_ids']));
echo wp_nonce_url(WPSG_URL_WP.'wp-admin/admin.php?page=wpsg-Order&mod=wpsg_mod_rechnungen&noheader=1&action=ajax&edit_id='.$_REQUEST['edit_id'].'&r_id='.$r['id'].'&do=copy', 'wpsg-mod_invoice-order_ajax-copy-'.$_REQUEST['edit_id']);
} else {
// normale Rechnung
echo wp_nonce_url(WPSG_URL_WP.'wp-admin/admin.php?page=wpsg-Order&mod=wpsg_mod_rechnungen&noheader=1&action=ajax&edit_id='.$_REQUEST['edit_id'].'&r_id='.$r['id'].'&do=copy', 'wpsg-mod_invoice-order_ajax-copy-'.$_REQUEST['edit_id']);
}
?>"><?php echo ' '.__("Kopie senden", "wpsg"); ?></a>
</div>
<?php } ?>
</div>
<?php } ?>
<?php echo wpsg_drawForm_AdminboxEnd(); ?>
</div>
<style>
#wpsg_mod_rechnungen_order_view .grid { display:grid; width:100%; grid-template-columns:150px 1fr 250px 150px; row-gap:0.5rem; column-gap:1rem; align-items:center; }
.e_invoice_app { position:relative; user-select:none;
& > .handler { border:1px solid black; padding:0.25rem 0.5rem; white-space:nowrap; text-overflow:ellipsis; overflow:hidden; width:100%; cursor:pointer; background-color:white; position:relative;
&:after { width:0; height:0; border-top:5px solid transparent; border-bottom:5px solid transparent; border-left:5px solid #2c699e; content:' '; position:absolute; right:5px; top:50%; transform:translateY(-50%); transition:all 0.4s; }
}
& > .layer { position:absolute; max-height:0; overflow:hidden; width:100%; transition:all 0.4s; z-index:1;
& > .inner { border:1px solid black; padding:0.25rem 0.5rem; margin-top:-1px; display:flex; flex-direction:column; gap:0.25rem; background-color:white;
& > a:not(:last-child) { border-bottom:1px solid black; }
& > a.default { font-weight:bold; }
}
}
&.open {
& > .layer { max-height:500px; }
& > .handler:after { transform:translateY(-50%) rotate(90deg); }
}
}
</style>