<?php
/**
* @copyright Copyright (C) 2009-2015 Adrien Baborier - All rights reserved.
* @license http://www.gnu.org/licenses/gpl-3.0.html GNU/GPL
*/
defined('_JEXEC') or die('Restricted access');
?>
<style type="text/css">
<!--
.invoicetitle{ text-align:center;font-size:30px; padding-top:40px;padding-bottom:40px}
legend { padding:5px 10px; background-color:#5471B5;color:white;font-weight:bold;border-color:#ccc}
fieldset { padding:10px; border-color:#ccc;}
div.date{text-align:right;color:#333;}
.storeaddress{
color:#333;
}
.addresses{padding-top:50px;}
.addresses td{padding-left:50px;}
.addresses fieldset {float:left;}
table.products{margin:auto;margin-top:60px;width:580px;border-collapse:collapse}
.price{text-align:center;}
.products td, .products th{border:1px solid #ccc;padding:7px 4px;}
.products th{background-color:#5471B5;color:white;}
td.newarea{text-align:right;padding-right:20px;}
tr.total{font-weight:bold;}
.products tr.limitation td{background-color:#ccc;padding:1px 0px;}
.hikashop_order_custom_fields_fieldset{margin-top : 20px;}
.footer{font-size:10px;color:#aaa;text-align:center;}
-->
</style>
<page style="font-size: 12px" backtop="14mm" backbottom="14mm" backleft="10mm" backright="10mm">
<page_footer>
<div class="footer">
<?php echo str_replace(array("\r\n","\n","\r"),array('<br/>','<br/>','<br/>'),$this->params->get('footer')); ?>
</div>
</page_footer>
<div align=right>
<img src="http://www.schermbeschermers.com/images/hogekwaliteit.png"/>
</div>
<div class="storeaddress">
<?php
$store = str_replace(array("\r\n","\n","\r"),array('<br/>','<br/>','<br/>'),$config->get('store_address',''));
if(JText::_($store)!=$store){
$store = JText::_($store);
}
echo $store;
?>
</div>
<?php if(empty($order->order_invoice_number)){
$order->order_invoice_number = $order->order_number;
}
if(empty($order->order_invoice_created)){
$order->order_invoice_created = $order->order_created;
}
$number = ' n째 ';
if(JText::_('INVOICE_NUMBER') != 'INVOICE_NUMBER'){
$number = JText::_('INVOICE_NUMBER');
}
?>
<div class="invoicetitle"><?php echo JText::_('INVOICE').$number.$order->order_invoice_number; ?></div>
<div class="date"><?php echo JText::_('DATE').': '.hikashop_getDate($order->order_invoice_created,'%d %B %Y');?></div>
<table class="addresses">
<tr>
<?php
$addresses = array('billing_address','shipping_address');
foreach($addresses as $oneAddress){
if(empty($order->$oneAddress)) continue;
if ($oneAddress=='shipping_address' && empty($pluginsShipping)) continue; ?>
<td valign="top">
<fieldset>
<legend><?php echo JText::_('HIKASHOP_'.strtoupper($oneAddress)); ?></legend>
<?php
$override = false;
if(!empty($order->order_shipping_id) && $oneAddress=='shipping_address' && method_exists($currentShipping, 'getShippingAddress')) {
$override = $currentShipping->getShippingAddress($order->order_shipping_id);
}
if($override !== false ) {
echo $override;
} else {
$addressClass = hikashop_get('class.address');
if($app->isAdmin()){
$view = 'order';
}else{
$view = 'address';
}
echo $addressClass->displayAddress($order->fields,$order->$oneAddress,$view);
}
?>
</fieldset>
</td>
<?php } ?>
</tr>
</table>
<table class="products">
<tr class="products_title">
<th style="width:300px">
<?php echo JText::_('PRODUCT'); ?>
</th>
<th style="width:100px" class="price">
<?php echo JText::_('UNIT_PRICE'); ?>
</th>
<th style="width:80px" class="price">
<?php echo JText::_('PRODUCT_QUANTITY'); ?>
</th>
<th style="width:100px" class="price">
<?php echo JText::_('PRICE'); ?>
</th>
</tr>
<?php
if(hikashop_level(2)){
$fieldsClass = hikashop_get('class.field');
$null = null;
$itemFields = $fieldsClass->getFields('frontcomp',$null,'item');
}
$group = $config->get('group_options',0);
foreach($order->products as $product){
if($group && $product->order_product_option_parent_id) continue;
?>
<tr>
<td>
<?php echo implode('<br/>',$this->str_split_unicode(strip_tags($product->order_product_name),50));
if($group){
$display_item_price=false;
foreach($order->products as $j => $optionElement){
if($optionElement->order_product_option_parent_id != $product->order_product_id) continue;
if($optionElement->order_product_price>0){
$display_item_price = true;
}
}
if($display_item_price){
if($config->get('price_with_tax')){
echo ' '.$currencyHelper->format($product->order_product_price+$product->order_product_tax,$order->order_currency_id);
}else{
echo ' '.$currencyHelper->format($product->order_product_price,$order->order_currency_id);
}
}
}
if(!empty($fields['item'])){
foreach($fields['item'] as $field){
$namekey = $field->field_namekey;
if(empty($product->$namekey)) continue;
echo '<p>'.$fieldsClass->getFieldName($field).': '.$fieldsClass->show($field,$product->$namekey).'</p>';
}
}
if($group){
foreach($order->products as $j => $optionElement){
if($optionElement->order_product_option_parent_id != $product->order_product_id) continue;
$product->order_product_price +=$optionElement->order_product_price;
$product->order_product_tax +=$optionElement->order_product_tax;
$product->order_product_total_price+=$optionElement->order_product_total_price;
$product->order_product_total_price_no_vat+=$optionElement->order_product_total_price_no_vat;
?><br/><?php
echo $optionElement->order_product_name;
if($optionElement->order_product_price>0){
if($config->get('price_with_tax')){
echo ' ( + '.$currencyHelper->format($optionElement->order_product_price+$optionElement->order_product_tax,$order->order_currency_id).' )';
}else{
echo ' ( + '.$currencyHelper->format($optionElement->order_product_price,$order->order_currency_id).' )';
}
}
}
}
if ($config->get('show_code')) {
echo '<br/>'.$product->order_product_code;
} ?>
</td>
<td class="price">
<?php
if($config->get('price_with_tax')){
echo $currencyHelper->format($product->order_product_price+$product->order_product_tax,$order->order_currency_id);
}else{
echo $currencyHelper->format($product->order_product_price,$order->order_currency_id);
} ?>
</td>
<td class="price">
<?php echo $product->order_product_quantity;?>
</td>
<td class="price">
<?php
if($config->get('price_with_tax')){
echo $currencyHelper->format($product->order_product_total_price,$order->order_currency_id);
}else{
echo $currencyHelper->format($product->order_product_total_price_no_vat,$order->order_currency_id);
} ?>
</td>
</tr>
<?php
}
?>
<tr class="limitation"><td colspan="4"></td></tr>
<tr>
<td colspan="3" class="newarea">
<?php echo JText::_( 'SUBTOTAL' ); ?>
</td>
<td class="price">
<?php
if($config->get('price_with_tax')){
echo $currencyHelper->format($order->order_subtotal,$order->order_currency_id);
}else{
echo $currencyHelper->format($order->order_subtotal_no_vat,$order->order_currency_id);
} ?>
</td>
</tr>
<?php $taxes = round($order->order_subtotal - $order->order_subtotal_no_vat - $order->order_discount_tax + $order->order_shipping_tax + $order->order_payment_tax, $currencyHelper->getRounding($order->order_currency_id,true));
if(!empty($order->order_discount_code)){ ?>
<tr>
<td colspan="3" class="newarea">
<?php echo JText::_( 'HIKASHOP_COUPON' ); ?>
</td>
<td class="price">
<?php
if($config->get('price_with_tax')){
echo $currencyHelper->format($order->order_discount_price*-1,$order->order_currency_id);
}else{
echo $currencyHelper->format(($order->order_discount_price-@$order->order_discount_tax)*-1,$order->order_currency_id);
}
?>
</td>
</tr>
<?php }
if(!empty($order->order_shipping_method)){ ?>
<tr>
<td colspan="3" class="newarea">
<?php echo JText::_( 'SHIPPING' ); ?>
</td>
<td class="price" >
<?php
if($config->get('price_with_tax')){
echo $currencyHelper->format($order->order_shipping_price,$order->order_currency_id);
}else{
echo $currencyHelper->format($order->order_shipping_price-@$order->order_shipping_tax,$order->order_currency_id);
} ?>
</td>
</tr>
<?php }
if(!empty($order->additional)) {
$exclude_additionnal = explode(',', $config->get('order_additional_hide', ''));
foreach($order->additional as $additional) {
if(in_array(@$additional->name, $exclude_additionnal)) continue;
echo '<tr><td colspan="3" class="newarea">'. JText::_($additional->order_product_name).'</td><td class="price">';
if(!empty($additional->order_product_price) || empty($additionaltionnal->order_product_options)) {
if($config->get('price_with_tax')){
echo $currencyHelper->format($additional->order_product_price+@$additional->order_product_tax, $order->order_currency_id);
}else{
echo $currencyHelper->format($additional->order_product_price, $order->order_currency_id);
}
} else {
echo $additional->order_product_options;
}
echo '</td></tr>';
}
}
if(!empty($order->order_payment_method) && $order->order_payment_price != 0){ ?>
<tr>
<td colspan="3" class="newarea">
<?php echo JText::_( 'HIKASHOP_PAYMENT' ); ?>
</td>
<td class="price"><?php
if($config->get('price_with_tax')) {
echo $currencyHelper->format($order->order_payment_price, $order->order_currency_id);
} else {
echo $currencyHelper->format($order->order_payment_price - @$order->order_payment_tax, $order->order_currency_id);
}
?></td>
</tr>
<?php }
if($taxes > 0){
if($config->get('detailed_tax_display') && !empty($order->order_tax_info)){
foreach($order->order_tax_info as $tax){ ?>
<tr>
<td colspan="3" class="newarea">
<?php echo $tax->tax_namekey; ?>
</td>
<td class="price">
<?php echo $currencyHelper->format($tax->tax_amount,$order->order_currency_id); ?>
</td>
</tr>
<?php
}
}else{ ?>
<tr>
<td colspan="3" class="newarea">
<?php echo JText::_( 'VAT' ); ?>
</td>
<td class="price">
<?php echo $currencyHelper->format($taxes,$order->order_currency_id); ?>
</td>
</tr>
<?php }
} ?>
<tr class="total">
<td colspan="3" class="newarea">
<?php echo JText::_( 'HIKASHOP_TOTAL' ); ?>
</td>
<td class="price" >
<?php echo $currencyHelper->format($order->order_full_price,$order->order_currency_id); ?>
</td>
</tr>
</table>
<p>
<?php
if (!empty($pluginsShipping)){
echo JText::_('HIKASHOP_SHIPPING_METHOD').' : ';
if(is_string($order->order_shipping_method)) {
if(strpos($order->order_shipping_id, '-') !== false)
echo $shippingClass->getShippingName($order->order_shipping_method, $order->order_shipping_id);
else
echo $pluginsShipping->getName($order->order_shipping_method, $order->order_shipping_id);
}else{
echo implode(', ', $this->order->order_shipping_method);
}
echo '<br/>';
}
if(!empty($pluginsPayment))
echo JText::_('HIKASHOP_PAYMENT_METHOD').' : '.$pluginsPayment->getName($order->order_payment_method, $order->order_payment_id).'<br/>';
$paymentClass = hikashop_get('class.payment');
$payment = $paymentClass->get($order->order_payment_id);
echo $payment->payment_params->information;
?>
</p>
<br/>
<?php if(hikashop_level(2) && !empty($fields['order'])){?>
<fieldset class="hikashop_order_custom_fields_fieldset">
<legend><?php echo JText::_('ADDITIONAL_INFORMATION'); ?></legend>
<table class="hikashop_order_custom_fields_table adminlist" cellpadding="1" width="100%">
<?php foreach($fields['order'] as $fieldName => $oneExtraField) {
if(!@$oneExtraField->field_frontcomp || empty($order->$fieldName)) continue;
?>
<tr class="hikashop_order_custom_field_<?php echo $fieldName;?>_line">
<td class="key">
<?php echo $fieldsClass->getFieldName($oneExtraField);?>
</td>
<td>
<?php echo $fieldsClass->show($oneExtraField,$order->$fieldName); ?>
</td>
</tr>
<?php } ?>
</table>
</fieldset>
<br/>
<?php } ?>
</page>