default.php 8.26 KB
Newer Older
Reinhold Kainhofer's avatar
Reinhold Kainhofer committed
1
2
3
4
5
6
<?php
if( !defined( '_JEXEC' ) ) die( 'Direct Access to '.basename(__FILE__).' is not allowed.' );

/**
*
* @package VirtueMart
7
8
9
* @subpackage EU Recapitulative Statement
* @copyright Copyright (C) 2015 Open Tools, Reinhold Kainhofer.
* @license http://www.gnu.org/copyleft/gpl.html GNU/GPL, see LICENSE.txt
Reinhold Kainhofer's avatar
Reinhold Kainhofer committed
10
11
12
13
14
* VirtueMart is free software. This version may have been modified pursuant
* to the GNU General Public License, and as distributed it includes or
* is derivative of works licensed under the GNU General Public License or
* other free or open source software licenses.
*
15
* http://www.open-tools.net
Reinhold Kainhofer's avatar
Reinhold Kainhofer committed
16
17
18
19
20
*/

AdminUIHelper::startAdminArea($this);

JHtml::_('behavior.framework', true);
21
22
23
24
if (!class_exists('CurrencyDisplay'))
    require(VMPATH_ADMIN . DS . 'helpers' . DS . 'currencydisplay.php');
$myCurrencyDisplay = CurrencyDisplay::getInstance();

25
26
27
$totalOrders = 0;
$totalRevenue = 0;
$totalTax = 0;
28

Reinhold Kainhofer's avatar
Reinhold Kainhofer committed
29
?>
30

Reinhold Kainhofer's avatar
Reinhold Kainhofer committed
31
<form action="index.php" method="post" name="adminForm" id="adminForm">
32
33
	<?php echo $this->addStandardHiddenToForm(); ?>

Reinhold Kainhofer's avatar
Reinhold Kainhofer committed
34
35
    <div id="header">
        <h2><?php echo vmText::sprintf('VMEXT_EU_RECAP_VIEW_TITLE_DATE', vmJsApi::date( $this->from_period, 'LC',true) , vmJsApi::date( $this->until_period, 'LC',true) ); ?></h2>
36
        <p><?php echo vmText::_('VMEXT_EU_RECAP_VIEW_EXPLANATION'); ?> </p>
Reinhold Kainhofer's avatar
Reinhold Kainhofer committed
37
        <div id="filterbox">
38
39
40
            <table width="100%">
                <tr width="100%">
                    <td align="left">
41
						<div style="float: left">
42
43
44
45
46
47
						<?php 
						echo vmText::_('VMEXT_EU_RECAP_LIST_PERIOD');
						if ($this->frequency<12) {
							echo $this->period_lists['month_list']; 
						} 
						echo $this->period_lists['year_list'];
Reinhold Kainhofer's avatar
Reinhold Kainhofer committed
48
49
50
51

                        if(VmConfig::get('multix','none')!='none'){
                            $vendorId = vRequest::getInt('virtuemart_vendor_id',1);
                            echo ShopFunctions::renderVendorList($vendorId,false);
52
                        } ?><br>
53
                        <label><input type="checkbox" <?php if ($this->include_taxed_orders) { ?>checked <?php } ?> name="include_taxed_orders" value="true" style="vertical-align: top; position: relative; bottom: 1px;" onchange="this.form.submit();">&nbsp;<?php echo vmText::_('VMEXT_EU_RECAP_INCLUDE_TAXED'); ?></label>
54
55
                        </div>
                        <span><button class="btn btn-small" name="Go" onclick="this.form.task.value=''; this.form.submit();"><?php echo vmText::_('COM_VIRTUEMART_GO'); ?></button></span>
56
                    </td>
57
58
                    <td align="right" style="vertical-align: top">
						<div style="float: right"><?php echo $this->export_format_list; ?>
59
                        <button class="btn btn-small" name="format" value="raw"  style="vertical-align: top;"><?php echo vmText::_('VMEXT_EU_RECAP_EXPORT'); ?>
60
                        </button></div>
Reinhold Kainhofer's avatar
Reinhold Kainhofer committed
61
62
63
64
65
                    </td>
                </tr>
            </table>
        </div>
        <div id="resultscounter">
66
            <?php if ($this->pagination) echo $this->pagination->getResultsCounter();?>
Reinhold Kainhofer's avatar
Reinhold Kainhofer committed
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
        </div>
    </div>

    <div id="editcell">
	    <table class="adminlist table table-striped" cellspacing="0" cellpadding="0">
            <thead>
                <tr>
                    <th>
                        <?php echo $this->sort('`vatid`', 'VMEXT_EU_RECAP_VATID'); ?>
                    </th>
                    <th>
                        <?php echo $this->sort('`countrycode`', 'VMEXT_EU_RECAP_COUNTRYCODE') ; ?>
                    </th>
                    <th>
                        <?php echo $this->sort('`company`', 'VMEXT_EU_RECAP_COMPANY') ; ?>
                    </th>
                    <th>
                        <?php echo $this->sort('`last_name`', 'VMEXT_EU_RECAP_NAME') ; ?>
                    </th>
                    <th>
                        <?php echo $this->sort('`order_ids`', 'VMEXT_EU_RECAP_ORDERS') ; ?>
                    </th>
                    <th>
                        <?php echo $this->sort('`sum_order_total`', 'VMEXT_EU_RECAP_ORDERTOTALS') ; ?>
                    </th>
92
<?php if ($this->include_taxed_orders) { ?>
Reinhold Kainhofer's avatar
Reinhold Kainhofer committed
93
94
95
                    <th>
                        <?php echo $this->sort('`sum_order_tax`', 'VMEXT_EU_RECAP_ORDERTAXES') ; ?>
                    </th>
96
<?php } ?>
Reinhold Kainhofer's avatar
Reinhold Kainhofer committed
97
98
99
100
101
102
103
104
105
106
107
108
                </tr>
            </thead>
            <tbody>
                <?php
        $i = 0;
        foreach ($this->report as $r) {
            $userlink = JROUTE::_ ('index.php?option=com_virtuemart&view=user&task=edit&virtuemart_user_id[]=' . $r['virtuemart_user_id'], FALSE);
        ?>
                <tr class="row<?php echo $i;?>">
                    <td align="center">
                        <?php echo $r['vatid']; ?>
                    </td>
109
110
111
112
113
114
115
                    <?php 
                        $vatidcc = substr(trim($r['vatid']), 0, 2);
                        if ($vatidcc=="EL") $vatidcc="GR";
                        if ($vatidcc=="UK") $vatidcc="GB";
                        $countrymatch = ($vatidcc == $r['countrycode']);
                    ?>
                    <td align="center" <?php if (!$countrymatch) { echo "style=\"background: #FFBFBF;\""; }; ?>>
Reinhold Kainhofer's avatar
Reinhold Kainhofer committed
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
                        <?php echo $r['countrycode'];?>
                    </td>
                    <td align="left">
                        <?php 
                            if ($r['company']) { 
                                echo JHtml::_ ('link', JRoute::_ ($userlink, FALSE), $r['company'], array('title' => $r['company'])); 
                            } 
                        ?>
                    </td>
                    <td align="left">
                        <?php
                            $fullname = join(" ", array($r['first_name'], $r['last_name']));
                            if ($fullname) {
                                echo JHtml::_ ('link', JRoute::_ ($userlink, FALSE), $fullname, array('title' => $fullname));
                            } 
                        ?>
                    </td>
                    <td align="left">
                    <?php
                        $oids = explode(',', $r['order_ids']);
                        $onrs = explode(',', $r['order_numbers']);
                        $orders = array_combine($oids, $onrs);
                        $links = array();
                        foreach ($orders as $oid=>$onr) {
140
							$totalOrders += 1;
Reinhold Kainhofer's avatar
Reinhold Kainhofer committed
141
142
143
144
145
146
147
                            $orderlink = JROUTE::_ ('index.php?option=com_virtuemart&view=orders&task=edit&virtuemart_order_id=' . $oid, FALSE);
                            $links[] = JHtml::_ ('link', JRoute::_ ($orderlink, FALSE), $onr, array('title' => $onr));
                        }
                        echo join(", ", $links); 
                    ?>
                    </td>
                    <td align="right">
148
149
150
		                <?php 
							$totalRevenue += $r['sum_order_total'];
							echo $myCurrencyDisplay->priceDisplay($r['sum_order_total']); ?>
Reinhold Kainhofer's avatar
Reinhold Kainhofer committed
151
                    </td>
152
<?php if ($this->include_taxed_orders) { ?>
Reinhold Kainhofer's avatar
Reinhold Kainhofer committed
153
                    <td align="right">
154
155
156
		                <?php 
							$totalTax += $r['sum_order_tax'];
							echo $myCurrencyDisplay->priceDisplay($r['sum_order_tax']); ?>
Reinhold Kainhofer's avatar
Reinhold Kainhofer committed
157
                    </td>
158
<?php } ?>
Reinhold Kainhofer's avatar
Reinhold Kainhofer committed
159
160
161
162
163
164
165
                </tr>
                <?php
	    	$i = 1-$i;
	    }
	    ?>
            </tbody>
            <tfoot>
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
                <tr style="border-top: 2px solid;">
                    <th align="center"></th>
                    <th align="center" ></th>
                    <th align="left"><?php echo vmText::_('VMEXT_EU_RECAP_SUMMARY'); ?></th>
                    <th align="left"></th>
                    <th align="left"><?php echo vmText::sprintf('VMEXT_EU_RECAP_ORDERCOUNT', $totalOrders); ?></th>
                    <th align="right">
		                <?php echo $myCurrencyDisplay->priceDisplay($totalRevenue); ?>
                    </th>
<?php if ($this->include_taxed_orders) { ?>
                    <th align="right">
		                <?php echo $myCurrencyDisplay->priceDisplay($totalTax); ?>
                    </th>
<?php } ?>
                </tr>
             
Reinhold Kainhofer's avatar
Reinhold Kainhofer committed
182
183
                <tr>
                    <td colspan="10">
184
                        <?php if ($this->pagination) echo $this->pagination->getListFooter(); ?>
Reinhold Kainhofer's avatar
Reinhold Kainhofer committed
185
186
187
188
189
190
191
192
193
194
                    </td>
                </tr>
            </tfoot>
        </table>
    </div>

</form>

<?php AdminUIHelper::endAdminArea(); ?>