summaryrefslogtreecommitdiff
path: root/views/mods/mod_rechnungen/order_view.phtml
blob: 84a2ed35d9267daa5e6d50150f923c35d95d061d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
<?php

	/**
	 * Template für die Rechnungsmodulansicht innerhalb der Bestellansicht
	 * @version 4.6.1
	 */
	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_EN16931 => ['label' => __('EN16931 Comfort (empfohlen)', 'wpsg'), 'url' => eInvoice::buildUrl($oInvoice->getId(), ZugferdProfiles::PROFILE_EN16931)],
									100 + ZugferdProfiles::PROFILE_BASIC => ['label' => __('EN16931 Basic', 'wpsg'), 'url' => eInvoice::buildUrl($oInvoice->getId(), ZugferdProfiles::PROFILE_BASIC)],
									100 + ZugferdProfiles::PROFILE_EXTENDED => ['label' => __('EN16931 Extended', 'wpsg'), 'url' => eInvoice::buildUrl($oInvoice->getId(), ZugferdProfiles::PROFILE_EXTENDED)],
									100 + ZugferdProfiles::PROFILE_XRECHNUNG_3 => ['label' => __('XRechnung 3 (für öffentliche Auftraggeber)', 'wpsg'), 'url' => eInvoice::buildUrl($oInvoice->getId(), ZugferdProfiles::PROFILE_XRECHNUNG_3)],
									100 + ZugferdProfiles::PROFILE_XRECHNUNG_2_3 => ['label' => __('XRechnung 2.3', 'wpsg'), 'url' => eInvoice::buildUrl($oInvoice->getId(), ZugferdProfiles::PROFILE_XRECHNUNG_2_3)],
									100 + ZugferdProfiles::PROFILE_XRECHNUNG_2_2 => ['label' => __('XRechnung 2.2', 'wpsg'), 'url' => eInvoice::buildUrl($oInvoice->getId(), ZugferdProfiles::PROFILE_XRECHNUNG_2_2)],
									100 + ZugferdProfiles::PROFILE_XRECHNUNG_2_1 => ['label' => __('XRechnung 2.1', 'wpsg'), 'url' => eInvoice::buildUrl($oInvoice->getId(), ZugferdProfiles::PROFILE_XRECHNUNG_2_1)],
									100 + ZugferdProfiles::PROFILE_XRECHNUNG_2 => ['label' => __('XRechnung 2', 'wpsg'), 'url' => eInvoice::buildUrl($oInvoice->getId(), ZugferdProfiles::PROFILE_XRECHNUNG_2)],
									100 + ZugferdProfiles::PROFILE_XRECHNUNG => ['label' => __('XRechnung 1', 'wpsg'), 'url' => eInvoice::buildUrl($oInvoice->getId(), ZugferdProfiles::PROFILE_XRECHNUNG)],
									100 + ZugferdProfiles::PROFILE_MINIMUM => ['label' => __('ZUGFeRD Minimum (keine gültige E-Rechnung)', 'wpsg'), 'url' => eInvoice::buildUrl($oInvoice->getId(), ZugferdProfiles::PROFILE_MINIMUM)],
									100 + ZugferdProfiles::PROFILE_BASICWL => ['label' => __('ZUGFeRD Basic WL (keine gültige E-Rechnung)', 'wpsg'), 'url' => eInvoice::buildUrl($oInvoice->getId(), ZugferdProfiles::PROFILE_BASICWL)]
								]); ?>
							});
						
						</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 ' &nbsp;'.__("Kopie senden", "wpsg"); ?></a>&nbsp; 
                        
                    </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>