Your IP : 216.73.216.50


Current Path : /proc/1908984/root/proc/1908984/root/tmp/
Upload File :
Current File : //proc/1908984/root/proc/1908984/root/tmp/phpZTMLmt

<?php
/**
*
* Order detail view
*
* @package	VirtueMart
* @subpackage Orders
* @author Oscar van Eijk, Valerie Isaksen
* @link http://www.virtuemart.net
* @copyright Copyright (c) 2004 - 2010 VirtueMart Team. All rights reserved.
* @license http://www.gnu.org/copyleft/gpl.html GNU/GPL, see LICENSE.php
* 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.
* @version $Id: details.php 8832 2015-04-15 16:05:49Z Milbo $
*/

// Check to ensure this file is included in Joomla!
defined('_JEXEC') or die('Restricted access');
vmJsApi::css('vmpanels');

if (empty($this->orderdetails) ) {
	echo '<div class="vm-wrap">';
	echo shopFunctionsF::getLoginForm(false,$this->trackingByOrderPass);
	echo '</div>';
	return true;
}
if($this->print){
$doc = JFactory::getDocument();
$doc->addStyleDeclaration('
	.table > tbody > tr > td{
		padding: 5px;
	}

	table .table > tbody > tr > td, table .table > tbody > tr > th{
		border: none;
	}
');
?>
<div style="width: 21cm;font-size: 14px !important">
	<div class="clearfix">
		<div class="vm-orders-vendor-image" style="width:50%; float:left">
			<img src="<?php  echo JURI::root() . $this-> vendor->images[0]->file_url ?>">
		</div>
		<div class="vm-store-name" style="width:50%; float:left">
			<p>
			<?php  echo $this->vendor->vendor_store_name; ?>
			<br>
			<?php  echo $this->vendor->vendor_name .' - '.$this->vendor->vendor_phone ?>
			</p>
		</div>
	</div>
	<h1 class="page-header" style="font-size:20px"><?php echo vmText::_('COM_VIRTUEMART_ACC_ORDER_INFO'); ?></h1>
	<div class="spaceStyle vm-orders-order print small">
	<?php
	echo $this->loadTemplate('order');
	?>
	</div>
	<div class="spaceStyle vm-orders-items print small">
	<?php
	echo $this->loadTemplate('items');
	?>
	</div>
	<?php
	echo VirtuemartViewInvoice::replaceVendorFields($this->vendor->vendor_letter_footer_html, $this->vendor); ?>
	<hr>
</div>
<script>
jQuery(window).load(function(){
	javascript:print();
});
</script>

<?php
} else {
?>

<div class="vm-wrap">
	<div class="vm-orders-information">
		<h1 class="page-header"><?php echo vmText::_('COM_VIRTUEMART_ACC_ORDER_INFO'); ?></h1>
		<div class="row">
			<div class="col-md-6">
				<?php
				/* Print view URL */
				$this->orderdetails['details']['BT']->invoiceNumber = VmModel::getModel('orders')->getInvoiceNumber($this->orderdetails['details']['BT']->virtuemart_order_id);
				echo shopFunctionsF::getInvoiceDownloadButton($this->orderdetails['details']['BT']) ?>
				<a class='btn btn-default btn-sm hasTooltip' title="<?php echo vmText::_('COM_VIRTUEMART_PRINT') ?>" href="javascript:void window.open('<?php echo $this->details_url ?>', 'win2', 'status=no,toolbar=no,scrollbars=yes,titlebar=no,menubar=no,resizable=yes,width=640,height=480,directories=no,location=no');">
					<span class="glyphicon glyphicon-print"></span>
				</a>
			</div>
			<div class="col-md-6 text-right">
				<?php if($this->order_list_link){ ?>
				<a class="btn btn-primary btn-sm" href="<?php echo $this->order_list_link ?>" rel="nofollow">
					<span class="glyphicon glyphicon-th-list"></span> <?php echo vmText::_('COM_VIRTUEMART_ORDERS_VIEW_DEFAULT_TITLE'); ?>
				</a>
				<?php }?>
			</div>
		</div>
		<hr>
		<div class="vm-orders-order small">
		<?php
		echo $this->loadTemplate('order');
		?>
		</div>
		<div class="spaceStyle vm-orders-items small">
		<?php

		$tabarray = array();
		$tabarray['items'] = 'COM_VIRTUEMART_ORDER_ITEM';
		$tabarray['history'] = 'COM_VIRTUEMART_ORDER_HISTORY';
		shopFunctionsF::buildTabs ( $this, $tabarray);

		?>
		</div>
	</div>
</div>
<?php
}
<?php
/**
*
* Order items view
*
* @package	VirtueMart
* @subpackage Orders
* @author Oscar van Eijk, Valerie Isaksen
* @link http://www.virtuemart.net
* @copyright Copyright (c) 2004 - 2010 VirtueMart Team. All rights reserved.
* @license http://www.gnu.org/copyleft/gpl.html GNU/GPL, see LICENSE.php
* 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.
* @version $Id: details_items.php 8310 2014-09-21 17:51:47Z Milbo $
*/

// Check to ensure this file is included in Joomla!
defined('_JEXEC') or die('Restricted access');

if($this->format == 'pdf'){
	$widthTable = '100';
	$widthTitle = '27';
} else {
	$widthTable = '100';
	$widthTitle = '49';
}

?>
<table class="table table-bordered" width="<?php echo $widthTable ?>%">
	<tr align="left" class="sectiontableheader">
		<th align="left"><?php echo vmText::_('COM_VIRTUEMART_ORDER_PRINT_SKU') ?></th>
		<th align="left" colspan="2" width="<?php echo $widthTitle ?>%" ><?php echo vmText::_('COM_VIRTUEMART_PRODUCT_NAME_TITLE') ?></th>
		<th align="center"><?php echo vmText::_('COM_VIRTUEMART_ORDER_PRINT_PRODUCT_STATUS') ?></th>
		<th align="right"><?php echo vmText::_('COM_VIRTUEMART_ORDER_PRINT_PRICE') ?></th>
		<th align="left"><?php echo vmText::_('COM_VIRTUEMART_ORDER_PRINT_QTY') ?></th>
		<?php if ( VmConfig::get('show_tax')) { ?>
		<th align="right"><?php echo vmText::_('COM_VIRTUEMART_ORDER_PRINT_PRODUCT_TAX') ?></th>
		<?php } ?>
		<th align="right"><?php echo vmText::_('COM_VIRTUEMART_ORDER_PRINT_SUBTOTAL_DISCOUNT_AMOUNT') ?></th>
		<th align="right"><?php echo vmText::_('COM_VIRTUEMART_ORDER_PRINT_TOTAL') ?></th>
	</tr>
	<?php
	foreach($this->orderdetails['items'] as $item) {
		$qtt = $item->product_quantity ;
		$_link = JRoute::_('index.php?option=com_virtuemart&view=productdetails&virtuemart_category_id=' . $item->virtuemart_category_id . '&virtuemart_product_id=' . $item->virtuemart_product_id, FALSE);
	?>
	<tr valign="top">
		<td align="left">
			<?php echo $item->order_item_sku; ?>
		</td>
		<td align="left" colspan="2">
			<div><a href="<?php echo $_link; ?>"><?php echo $item->order_item_name; ?></a></div>
			<?php
				$product_attribute = VirtueMartModelCustomfields::CustomsFieldOrderDisplay($item,'FE');
				echo $product_attribute;
			?>
		</td>
		<td align="center">
			<?php echo $this->orderstatuses[$item->order_status]; ?>
		</td>
		<td align="right" class="priceCol">
			<?php
			$item->product_discountedPriceWithoutTax = (float) $item->product_discountedPriceWithoutTax;
			if (!empty($item->product_priceWithoutTax) && $item->product_discountedPriceWithoutTax != $item->product_priceWithoutTax) {
				echo '<span class="line-through">'.$this->currency->priceDisplay($item->product_item_price, $this->user_currency_id) .'</span><br />';
				echo '<span >'.$this->currency->priceDisplay($item->product_discountedPriceWithoutTax, $this->user_currency_id) .'</span><br />';
			} else {
				echo '<span >'.$this->currency->priceDisplay($item->product_item_price, $this->user_currency_id) .'</span><br />';
			}
			?>
		</td>
		<td align="right">
			<?php echo $qtt; ?>
		</td>
		<?php if ( VmConfig::get('show_tax')) { ?>
		<td align="right" class="priceCol"><?php echo "<span  class='priceColor2'>".$this->currency->priceDisplay($item->product_tax ,$this->user_currency_id, $qtt)."</span>" ?></td>
		<?php } ?>
		<td align="right" class="priceCol">
			<?php echo  $this->currency->priceDisplay( $item->product_subtotal_discount ,$this->user_currency_id);  //No quantity is already stored with it ?>
		</td>
		<td align="right" class="priceCol">
			<?php
			$item->product_basePriceWithTax = (float) $item->product_basePriceWithTax;
			$class = '';
			if(!empty($item->product_basePriceWithTax) && $item->product_basePriceWithTax != $item->product_final_price ) {
				echo '<span class="line-through" >'.$this->currency->priceDisplay($item->product_basePriceWithTax,$this->user_currency_id,$qtt) .'</span><br />' ;
			}
			elseif (empty($item->product_basePriceWithTax) && $item->product_item_price != $item->product_final_price) {
				echo '<span class="line-through">' . $this->currency->priceDisplay($item->product_item_price,$this->user_currency_id,$qtt) . '</span><br />';
			}
			echo $this->currency->priceDisplay(  $item->product_subtotal_with_tax ,$this->user_currency_id); //No quantity or you must use product_final_price ?>
		</td>
	</tr>
	<?php
		}
	?>
	<tr class="sectiontableentry1">
		<td colspan="6" align="right"><?php echo vmText::_('COM_VIRTUEMART_ORDER_PRINT_PRODUCT_PRICES_TOTAL'); ?></td>
		<?php if ( VmConfig::get('show_tax')) { ?>
		<td align="right" class="priceCol"><?php echo "<span  class='priceColor2'>".$this->currency->priceDisplay($this->orderdetails['details']['BT']->order_tax,$this->user_currency_id)."</span>" ?></td>
		<?php } ?>
		<td align="right" class="priceCol"><?php echo "<span  class='priceColor2'>".$this->currency->priceDisplay($this->orderdetails['details']['BT']->order_discountAmount,$this->user_currency_id)."</span>" ?></td>
		<td align="right" class="priceCol"><?php echo $this->currency->priceDisplay($this->orderdetails['details']['BT']->order_salesPrice,$this->user_currency_id) ?></td>
	</tr>
	<?php
	if ($this->orderdetails['details']['BT']->coupon_discount <> 0.00) {
		$coupon_code=$this->orderdetails['details']['BT']->coupon_code?' ('.$this->orderdetails['details']['BT']->coupon_code.')':'';
	?>
	<tr>
		<td align="right" class="pricePad" colspan="6"><?php echo vmText::_('COM_VIRTUEMART_COUPON_DISCOUNT').$coupon_code ?></td>
		<?php if ( VmConfig::get('show_tax')) { ?>
		<td align="right">&nbsp;</td>
		<?php } ?>
		<td align="right">&nbsp;</td>
		<td align="right" class="priceCol"><?php echo $this->currency->priceDisplay($this->orderdetails['details']['BT']->coupon_discount,$this->user_currency_id); ?></td>
	</tr>
	<?php }

	foreach($this->orderdetails['calc_rules'] as $rule){
		if ($rule->calc_kind== 'DBTaxRulesBill') {
	?>
	<tr>
		<td colspan="6" align="right" class="pricePad"><?php echo $rule->calc_rule_name ?></td>
		<?php if ( VmConfig::get('show_tax')) { ?>
		<td align="right"></td>
		<?php } ?>
		<td align="right" class="priceCol"> <?php echo $this->currency->priceDisplay($rule->calc_amount,$this->user_currency_id); ?></td>
		<td align="right" class="priceCol"><?php echo $this->currency->priceDisplay($rule->calc_amount,$this->user_currency_id); ?></td>
	</tr>
	<?php
	} elseif ($rule->calc_kind == 'taxRulesBill') { ?>
	<tr>
		<td colspan="6" align="right" class="pricePad"><?php echo $rule->calc_rule_name ?></td>
		<?php if ( VmConfig::get('show_tax')) { ?>
		<td align="right" class="priceCol"><?php echo $this->currency->priceDisplay($rule->calc_amount,$this->user_currency_id); ?></td>
		<?php } ?>
		<td align="right"></td>
		<td align="right" class="priceCol"><?php echo $this->currency->priceDisplay($rule->calc_amount,$this->user_currency_id); ?></td>
	</tr>
	<?php
	} elseif ($rule->calc_kind == 'DATaxRulesBill') { ?>
	<tr>
		<td colspan="6" align="right" class="pricePad"><?php echo $rule->calc_rule_name ?></td>
		<?php if ( VmConfig::get('show_tax')) { ?>
		<td align="right"></td>
		<?php } ?>
		<td align="right" class="priceCol"><?php echo $this->currency->priceDisplay($rule->calc_amount,$this->user_currency_id); ?></td>
		<td align="right" class="priceCol"><?php echo $this->currency->priceDisplay($rule->calc_amount,$this->user_currency_id);  ?></td>
	</tr>
	<?php
		}
	}
	?>
	<tr>
		<td align="right" class="pricePad" colspan="6"><?php echo vmText::_('COM_VIRTUEMART_ORDER_PRINT_SHIPPING') ?></td>
		<?php if ( VmConfig::get('show_tax')) { ?>
		<td align="right" class="priceCol"><?php echo "<span  class='priceColor2'>".$this->currency->priceDisplay($this->orderdetails['details']['BT']->order_shipment_tax, $this->user_currency_id)."</span>" ?></td>
		<?php } ?>
		<td align="right">&nbsp;</td>
		<td align="right" class="priceCol"><?php echo $this->currency->priceDisplay($this->orderdetails['details']['BT']->order_shipment+ $this->orderdetails['details']['BT']->order_shipment_tax, $this->user_currency_id); ?></td>
	</tr>
	<tr>
		<td align="right" class="pricePad" colspan="6"><?php echo vmText::_('COM_VIRTUEMART_ORDER_PRINT_PAYMENT') ?></td>
		<?php if ( VmConfig::get('show_tax')) { ?>
		<td align="right" class="priceCol"><?php echo "<span  class='priceColor2'>".$this->currency->priceDisplay($this->orderdetails['details']['BT']->order_payment_tax, $this->user_currency_id)."</span>" ?></td>
		<?php } ?>
		<td align="right">&nbsp;</td>
		<td align="right" class="priceCol"><?php echo $this->currency->priceDisplay($this->orderdetails['details']['BT']->order_payment+ $this->orderdetails['details']['BT']->order_payment_tax, $this->user_currency_id); ?></td>
	</tr>
	<tr>
		<td align="right" class="pricePad" colspan="6"><strong><?php echo vmText::_('COM_VIRTUEMART_ORDER_PRINT_TOTAL') ?></strong></td>
		<?php if ( VmConfig::get('show_tax')) {  ?>
		<td align="right" class="priceCol"><span class='priceColor'><?php echo $this->currency->priceDisplay($this->orderdetails['details']['BT']->order_billTaxAmount, $this->user_currency_id); ?></span></td>
		<?php } ?>
		<td align="right" class="priceCol"><span class='priceColor'><?php echo $this->currency->priceDisplay($this->orderdetails['details']['BT']->order_billDiscountAmount, $this->user_currency_id); ?></span></td>
		<td align="right" class="priceCol"><strong><?php echo $this->currency->priceDisplay($this->orderdetails['details']['BT']->order_total, $this->user_currency_id); ?></strong></td>
	</tr>
	<tr style="border-top-style:double">
		<td align="left" colspan="3" style="padding-right: 5px;"><strong><?php echo vmText::_('COM_VM_ORDER_BALANCE') ?></strong></td>
		<?php
		$this->orderbt = $this->orderdetails['details']['BT'];
		$tp = '';
		$detail=false;
		if (empty($this->orderbt->paid) ) {
			$t = vmText::_('COM_VM_ORDER_UNPAID');
		} else if($this->orderbt->paid == $this->orderbt->toPay){
			$t =  vmText::_('COM_VM_ORDER_PAID');
		} else if($this->orderbt->paid < $this->orderbt->toPay){
		$t =  vmText::sprintf('COM_VM_ORDER_PARTIAL_PAID',$this->orderbt->paid);
		$detail=true;
		} else {
			$t =  vmText::sprintf('COM_VM_ORDER_CREDIT_BALANCE',$this->orderbt->paid);
			$detail=true;
		}
		$trOpen = true;
		$colspan = '5';
		if(empty($this->toRefund) and !$detail){
			echo '<td align="left" colspan="3" style="padding-right: 5px;">'.$t.'</td>';
			//echo '<td><input class="orderEdit" type="text" size="8" name="item_id[paid]" value="'.$this->orderbt->paid.'"/></td>';
			echo '</tr>';
			$trOpen = false;
		}

		if(!empty($this->toRefund)){
			echo '<td colspan="5">'.vmText::_('COM_VM_ORDER_PRODUCTS_TO_REFUND').'</td>';
			if($trOpen) {
				echo '</tr>';
				$trOpen = false;
			}
			foreach ($this->toRefund as $index => $item) {
				$tmpl = "refund-tmpl-" . $index;
				echo '<tr id="'.$tmpl.'" class="order-item">';
				echo '<td colspan="3"></td>';
				echo '<td colspan="2">'.$item->order_item_name.'</td>';
				echo '<td colspan="1">'.$item->order_item_sku.'</td>';
				echo '<td style="text-align: right;" colspan="1">'.$this->currency->priceDisplay($item->product_tax).'</td>';
				echo '<td colspan="1"></td>';
				echo '<td style="text-align: right;" colspan="1">'.$this->currency->priceDisplay($item->product_subtotal_with_tax).'</td>';
				echo '</tr>';
				$this->orderbt->order_total -= $item->product_subtotal_with_tax;
				$colspan = '5';
			}
		} else {
			$colspan = '2';
		}

		if(!empty($this->toRefund) or $detail){

			if($this->orderbt->paid < $this->orderbt->toPay){

				if (empty($this->orderbt->paid)){
					$t =  vmText::_('COM_VM_ORDER_UNPAID');
				} else {
					$t =  vmText::_('COM_VM_ORDER_PARTIAL_PAID');
				}
				$l = vmText::_('COM_VM_ORDER_OUTSTANDING_AMOUNT');

			} else {
				$t =  vmText::_('COM_VM_ORDER_PAID');
				$l = vmText::_('COM_VM_ORDER_BALANCE');
			}

			$tp .= '';
			if($this->orderbt->toPay!=$this->orderbt->order_total){
				if(!$trOpen){
					$tp .= '<tr>';
					$trOpen= true;
				}
				$tp .= '<td colspan="'.$colspan.'"></td>';
				$tp .= '<td style="text-align: right;" colspan="3" style="padding-right: 5px;">'.vmText::_('COM_VM_ORDER_NEW_TOTAL').'</td>';
				$tp .= '<td style="text-align: right;">'.$this->currency->priceDisplay($this->orderbt->toPay).'</td>';

				if($trOpen) {
					$tp .= '</tr>';
					$trOpen = false;
				}
			}

			if(!$trOpen){
				$tp .= '<tr>';
				$trOpen= true;
			}
			$tp .= '<td colspan="'.$colspan.'"></td>';
			$tp .= '<td style="text-align: right;" colspan="3" style="padding-right: 5px;">'.$t.'</td>';
			$tp .= '<td style="text-align: right;" >'.$this->currency->priceDisplay($this->orderbt->paid).'</td>';
			$tp .= '</tr>';

			$tp .= '<tr>';
			$tp .= '<td colspan="5"></td>';
			$tp .= '<td style="text-align: right;" colspan="3" style="padding-right: 5px;">'.$l.'</td>';
			$tp .= '<td style="text-align: right;" >'.$this->currency->priceDisplay(abs($this->orderbt->order_total - $this->orderbt->paid) ).'</td>';
			echo $tp;
		}
		if($trOpen) {
			echo '</tr>';
			$trOpen = false;
		}
		?>
</table><?php
/**
 *
 * Order detail view
 *
 * @package	VirtueMart
 * @subpackage Orders
 * @author Oscar van Eijk, Valerie Isaksen
 * @link http://www.virtuemart.net
 * @copyright Copyright (c) 2004 - 2010 VirtueMart Team. All rights reserved.
 * @license http://www.gnu.org/copyleft/gpl.html GNU/GPL, see LICENSE.php
 * 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.
 * @version $Id: details_order.php 7499 2013-12-18 15:11:51Z Milbo $
 */
// Check to ensure this file is included in Joomla!
defined('_JEXEC') or die('Restricted access');

?>
<table class="table" width="100%">
	<tr>
		<td class="orders-key bold"><?php echo vmText::_('COM_VIRTUEMART_ORDER_PRINT_PO_NUMBER') ?></td>
		<td align="left"><?php echo $this->orderdetails['details']['BT']->order_number; ?></td>
	</tr>
	<tr>
		<td class="bold"><?php echo vmText::_('COM_VIRTUEMART_ORDER_PRINT_PO_DATE') ?></td>
		<td align="left"><?php echo vmJsApi::date($this->orderdetails['details']['BT']->order_created, 'LC4', true); ?></td>
	</tr>
	<tr>
		<td class="bold"><?php echo vmText::_('COM_VIRTUEMART_ORDER_PRINT_PO_STATUS') ?></td>
		<td align="left"><?php echo $this->orderstatuses[$this->orderdetails['details']['BT']->order_status]; ?></td>
	</tr>
	<tr>
		<td class="bold"><?php echo vmText::_('COM_VIRTUEMART_LAST_UPDATED') ?></td>
		<td align="left"><?php echo vmJsApi::date($this->orderdetails['details']['BT']->order_modified, 'LC4', true); ?></td>
	</tr>
	<tr>
		<td class="bold"><?php echo vmText::_('COM_VIRTUEMART_ORDER_PRINT_SHIPMENT_LBL') ?></td>
		<td align="left">
		<?php
		echo $this->shipment_name;
		?>
		</td>
	</tr>
	<tr>
		<td class="bold"><?php echo vmText::_('COM_VIRTUEMART_ORDER_PRINT_PAYMENT_LBL') ?></td>
		<td align="left"><?php echo $this->payment_name; ?></td>
	</tr>
	<tr>
		<td class="bold"><?php echo vmText::_('COM_VIRTUEMART_ORDER_PRINT_CUSTOMER_NOTE') ?></td>
		<td valign="top" align="left" width="50%"><?php echo $this->orderdetails['details']['BT']->customer_note; ?></td>
	</tr>
	<tr>
		<td class="orders-key bold"><?php echo vmText::_('COM_VIRTUEMART_ORDER_PRINT_TOTAL') ?></td>
		<td align="left"><?php echo $this->currency->priceDisplay($this->orderdetails['details']['BT']->order_total, $this->user_currency_id); ?></td>
	</tr>
	<tr>
		<td colspan="2">&nbsp;</td>
	</tr>
	<tr>
		<td valign="top">
			<table class="table table bordered table-striped">
				<tr>
					<th colspan="2">
					<?php echo vmText::_('COM_VIRTUEMART_ORDER_PRINT_BILL_TO_LBL') ?>
					</th>
				</tr>
				<?php
				foreach ($this->userfields['fields'] as $field) {
					if (!empty($field['value'])) {
						echo '<tr>';
						echo '<td class="key">' . $field['title'] . '</td>';
						echo '<td>' . $field['value'] . '</td>';
						echo '</tr>';
					}
				}
				?>
			</table>
		</td>
		<td valign="top" >
			<table class="table table bordered table-striped">
				<tr>
					<th colspan="2">
					<?php echo vmText::_('COM_VIRTUEMART_ORDER_PRINT_SHIP_TO_LBL') ?>
					</th>
				</tr>
				<?php
				if(!empty($this->orderdetails['details']['has_ST'])){
					foreach ($this->shipmentfields['fields'] as $field) {
						if (!empty($field['value'])) {
							echo '<tr>';
							echo '<td class="key">' . $field['title'] . '</td>';
							echo '<td>' . $field['value'] . '</td>';
							echo '</tr>';
						}
					}
				}
				?>
			</table>
		</td>
	</tr>
</table><?php
/**
*
* Orderlist
* NOTE: This is a copy of the edit_orderlist template from the user-view (which in turn is a slighly
*       modified copy from the backend)
*
* @package	VirtueMart
* @subpackage Orders
* @author Oscar van Eijk
* @link http://www.virtuemart.net
* @copyright Copyright (c) 2004 - 2010 VirtueMart Team. All rights reserved.
* @license http://www.gnu.org/copyleft/gpl.html GNU/GPL, see LICENSE.php
* 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.
* @version $Id: list.php 8832 2015-04-15 16:05:49Z Milbo $
*/

// Check to ensure this file is included in Joomla!
defined('_JEXEC') or die('Restricted access');

/*$ajaxUpdate = '';
if(VmConfig::get ('ajax_order', TRUE)){
  $ajaxUpdate = 'data-dynamic-update="1"';
}*/

?>
<div class="vm-wrap">
	<div class="vm-orders-list">
		<h1 class="page-header"><?php echo vmText::_('COM_VIRTUEMART_ORDERS_VIEW_DEFAULT_TITLE'); ?></h1>
		<?php
		if (count($this->orderlist) == 0) {
			 //echo vmText::_('COM_VIRTUEMART_ACC_NO_ORDER');
			echo shopFunctionsF::getLoginForm(false,$this->trackingByOrderPass);
		} else {
		?>
		<div id="editcell">
			<table class="adminlist table table-bordered">
				<thead>
					<tr>
						<th>
						<?php echo vmText::_('COM_VIRTUEMART_ORDER_LIST_ORDER_NUMBER'); ?>
						</th>
						<th>
						<?php echo vmText::_('COM_VIRTUEMART_ORDER_LIST_CDATE'); ?>
						</th>
						<!--th>
						<?php //echo vmText::_('COM_VIRTUEMART_ORDER_LIST_MDATE'); ?>
						</th -->
						<th>
						<?php echo vmText::_('COM_VIRTUEMART_ORDER_LIST_STATUS'); ?>
						</th>
						<th>
						<?php echo vmText::_('COM_VIRTUEMART_ORDER_LIST_TOTAL'); ?>
						</th>
					</tr>
				</thead>
			<?php
				$k = 0;
				foreach ($this->orderlist as $row) {
					$editlink = JRoute::_('index.php?option=com_virtuemart&view=orders&layout=details&order_number=' . $row->order_number, FALSE);
					?>
					<tr class="<?php echo "row$k"; ?>">
						<td align="left">
							<a href="<?php echo $editlink; ?>" rel="nofollow" <?php //echo $ajaxUpdate?> ><?php echo $row->order_number; ?></a>
							<?php echo shopFunctionsF::getInvoiceDownloadButton($row) ?>
						</td>
						<td align="left">
							<?php echo vmJsApi::date($row->created_on,'LC4',true); ?>
						</td>
						<!--td align="left">
							<?php //echo vmJsApi::date($row->modified_on,'LC3',true); ?>
						</td -->
						<td align="left">
							<?php echo shopFunctionsF::getOrderStatusName($row->order_status); ?>
						</td>
						<td align="left" class="priceCol">
							<?php echo $row->currency->priceDisplay($row->order_total, $row->currency); ?>
						</td>
					</tr>
			<?php
					$k = 1 - $k;
				}
			?>
			</table>
		</div>
		<?php } ?>
	</div>

</div><?php
/**
*
* Order detail view
*
* @package	VirtueMart
* @subpackage Orders
* @author Oscar van Eijk, Valerie Isaksen
* @link https://virtuemart.net
* @copyright Copyright (c) 2004 - 2018 VirtueMart Team. All rights reserved.
* @license http://www.gnu.org/copyleft/gpl.html GNU/GPL, see LICENSE.php
* 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.
* @version $Id: details.php 10649 2022-05-05 14:29:44Z Milbo $
*/

// Check to ensure this file is included in Joomla!
defined('_JEXEC') or die('Restricted access');
vmJsApi::css('vmpanels');

if (empty($this->orderdetails) ) {
	echo '<div class="vm-wrap">';
	echo shopFunctionsF::getLoginForm(false,$this->trackingByOrderPass);
	echo '</div>';
	return true;
}
if($this->print){
	?>

		<body onload="javascript:print();">
		<div class="vm-orders-vendor-image"><img src="<?php  echo JURI::root() . $this-> vendor->images[0]->file_url ?>"></div>
		<h2><?php  echo $this->vendor->vendor_store_name; ?></h2>
		<?php  echo $this->vendor->vendor_name .' - '.$this->vendor->vendor_phone ?>
		<h1><?php echo vmText::_('COM_VIRTUEMART_ACC_ORDER_INFO'); ?></h1>
		<div class="spaceStyle vm-orders-order print">
		<?php
		echo $this->loadTemplate('order');
		?>
		</div>

		<div class="spaceStyle vm-orders-items print">
		<?php
		echo $this->loadTemplate('items');
		?>
		</div>
		<?php
		echo VirtuemartViewInvoice::replaceVendorFields($this->vendor->vendor_letter_footer_html, $this->vendor); ?>
		</body>
		<?php
} else {

	?>
<div class="vm-wrap">
	<div class="vm-orders-information">
	<h1><?php echo vmText::_('COM_VIRTUEMART_ACC_ORDER_INFO'); ?>

	<?php

	/* Print view URL */
	$details_link = "<a href=\"javascript:void window.open('$this->details_url', 'win2', 'status=no,toolbar=no,scrollbars=yes,titlebar=no,menubar=no,resizable=yes,width=640,height=480,directories=no,location=no');\"  >";
	//$details_link .= '<span class="hasTip print_32" title="' . vmText::_('COM_VIRTUEMART_PRINT') . '">&nbsp;</span></a>';
	$button = 'system/printButton.png';
	$details_link .= JHtml::_('image',$button, vmText::_('COM_VIRTUEMART_PRINT'), NULL, true);
	$details_link  .=  '</a>';
	echo $details_link;
	$this->orderdetails['details']['BT']->invoiceNumber = VmModel::getModel('orders')->getInvoiceNumber($this->orderdetails['details']['BT']->virtuemart_order_id);
	echo shopFunctionsF::getInvoiceDownloadButton($this->orderdetails['details']['BT']) ?>
	</h1>
<?php if($this->order_list_link){ ?>
	<div class='spaceStyle'>
	    <div class="floatright">
		<a href="<?php echo $this->order_list_link ?>" rel="nofollow"><?php echo vmText::_('COM_VIRTUEMART_ORDERS_VIEW_DEFAULT_TITLE'); ?></a>
	    </div>
	    <div class="clear"></div>
	</div>
<?php }?>
	<div class="spaceStyle vm-orders-order">
	<?php
	echo $this->loadTemplate('order');
	?>
	</div>

	<div class="spaceStyle vm-orders-items">
	<?php

	$tabarray = array();

	$tabarray['items'] = 'COM_VIRTUEMART_ORDER_ITEM';
	$tabarray['history'] = 'COM_VIRTUEMART_ORDER_HISTORY';

	shopFunctionsF::buildTabs ( $this, $tabarray); ?>
	</div>
	<br clear="all"/><br/>
	</div>
</div>	
	<?php
}

?>






<?xml version="1.0" encoding="utf-8"?>
<metadata>
	<layout title="VM_ORDERS_LIST" hidden="true">
		<message><![CDATA[VM_PRICELIST_DESC]]></message>
	</layout>
</metadata>
<?php
/**
*
* Order history view
*
* @package	VirtueMart
* @subpackage Orders
* @author Oscar van Eijk
* @link https://virtuemart.net
* @copyright Copyright (c) 2004 - 2010 VirtueMart Team. All rights reserved.
* @license http://www.gnu.org/copyleft/gpl.html GNU/GPL, see LICENSE.php
* 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.
* @version $Id: details_history.php 10649 2022-05-05 14:29:44Z Milbo $
*/

// Check to ensure this file is included in Joomla!
defined('_JEXEC') or die('Restricted access');
?>

<table width="100%" cellspacing="2" cellpadding="4" border="0">
	<tr align="left" class="sectiontableheader">
		<th align="left" ><?php echo vmText::_('COM_VIRTUEMART_DATE') ?></th>
		<th align="left" ><?php echo vmText::_('COM_VIRTUEMART_ORDER_PRINT_PO_STATUS') ?></th>
		<th align="left" ><?php echo vmText::_('COM_VIRTUEMART_ORDER_COMMENT') ?></th>
	</tr>
<?php
	foreach($this->orderdetails['history'] as $_hist) {
		if (!$_hist->customer_notified) {
			continue;
		}
?>
		<tr valign="top">
			<td align="left">
				<?php echo vmJsApi::date($_hist->created_on,'LC2',true); ?>
			</td>
			<td align="left" >
				<?php echo $this->orderstatuses[$_hist->order_status_code]; ?>
			</td>
			<td align="left" >
				<?php echo $_hist->comments; ?>
			</td>
		</tr>
<?php
	}
?>
</table>
<?php
/**
*
* Order items view
*
* @package	VirtueMart
* @subpackage Orders
* @author Oscar van Eijk, Valerie Isaksen
* @link https://virtuemart.net
* @copyright Copyright (c) 2004 - 2010 VirtueMart Team. All rights reserved.
* @license http://www.gnu.org/copyleft/gpl.html GNU/GPL, see LICENSE.php
* 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.
* @version $Id: details_items.php 10649 2022-05-05 14:29:44Z Milbo $
*/

// Check to ensure this file is included in Joomla!
defined('_JEXEC') or die('Restricted access');

if($this->format == 'pdf'){
	$widthTable = '100';
	$widthTitle = '27';
} else {
	$widthTable = '100';
	$widthTitle = '30';
}
?>

<table width="<?php echo $widthTable ?>%" cellspacing="0" cellpadding="0" border="0">
	<tr style="text-align: left;" class="sectiontableheader">
		<th style="text-align: left;" width="10%"><?php echo vmText::_('COM_VIRTUEMART_ORDER_PRINT_SKU') ?></th>
		<th style="text-align: left;" colspan="2" width="<?php echo $widthTitle ?>%" ><?php echo vmText::_('COM_VIRTUEMART_PRODUCT_NAME_TITLE') ?></th>
		<th style="text-align: center;" width="10%"><?php echo vmText::_('COM_VIRTUEMART_ORDER_PRINT_PRODUCT_STATUS') ?></th>
		<th style="text-align: right;" width="10%" ><?php echo vmText::_('COM_VIRTUEMART_ORDER_PRINT_PRICE') ?></th>
		<th style="text-align: right;" width="6%"><?php echo vmText::_('COM_VIRTUEMART_ORDER_PRINT_QTY') ?></th>
		<?php if ( VmConfig::get('show_tax')) { ?>
		<th style="text-align: right;" width="11%" ><?php echo vmText::_('COM_VIRTUEMART_ORDER_PRINT_PRODUCT_TAX') ?></th>
		  <?php } ?>
		<th style="text-align: right;" width="11%"><?php echo vmText::_('COM_VIRTUEMART_ORDER_PRINT_SUBTOTAL_DISCOUNT_AMOUNT') ?></th>
		<th style="text-align: right;" width="12%"><?php echo vmText::_('COM_VIRTUEMART_ORDER_PRINT_TOTAL') ?></th>
	</tr>
<?php
foreach($this->orderdetails['items'] as $item) {
	$qtt = $item->product_quantity ;
	$_link = JRoute::_('index.php?option=com_virtuemart&view=productdetails&virtuemart_category_id=' . $item->virtuemart_category_id . '&virtuemart_product_id=' . $item->virtuemart_product_id, FALSE);
?>
	<tr style="vertical-align: top;">
		<td style="text-align: left;">
			<?php echo $item->order_item_sku; ?>
		</td>
		<td style="text-align: left;" colspan="2" >
			<div><a href="<?php echo $_link; ?>"><?php echo $item->order_item_name; ?></a></div>
			<?php
				$product_attribute = VirtueMartModelCustomfields::CustomsFieldOrderDisplay($item,'FE');
				echo $product_attribute;
			?>
		</td>
		<td style="text-align: center;">
			<?php echo $this->orderstatuses[$item->order_status]; ?>
		</td>
		<td style="text-align: right;" class="priceCol" >
			<?php
			$item->product_discountedPriceWithoutTax = (float) $item->product_discountedPriceWithoutTax;
			if (!empty($item->product_priceWithoutTax) && $item->product_discountedPriceWithoutTax != $item->product_priceWithoutTax) {
				echo '<span class="line-through">'.$this->currency->priceDisplay($item->product_item_price, $this->user_currency_id) .'</span><br />';
				echo '<span >'.$this->currency->priceDisplay($item->product_discountedPriceWithoutTax, $this->user_currency_id) .'</span><br />';
			} else {
				echo '<span >'.$this->currency->priceDisplay($item->product_item_price, $this->user_currency_id) .'</span><br />';
			}
			?>
		</td>
		<td style="text-align: right;" >
			<?php echo $qtt; ?>
		</td>
		<?php if ( VmConfig::get('show_tax')) { ?>
		<td style="text-align: right;" class="priceCol"><?php echo "<span  class='priceColor2'>".$this->currency->priceDisplay($item->product_tax ,$this->user_currency_id, $qtt)."</span>" ?></td>
		<?php } ?>
		<td style="text-align: right;" class="priceCol" >
			<?php echo  $this->currency->priceDisplay( $item->product_subtotal_discount ,$this->user_currency_id);  //No quantity is already stored with it ?>
		</td>
		<td style="text-align: right;"  class="priceCol">
			<?php
			$item->product_basePriceWithTax = (float) $item->product_basePriceWithTax;
			$class = '';
			if(!empty($item->product_basePriceWithTax) && $item->product_basePriceWithTax != $item->product_final_price ) {
				echo '<span class="line-through" >'.$this->currency->priceDisplay($item->product_basePriceWithTax,$this->user_currency_id,$qtt) .'</span><br />' ;
			}
			elseif (empty($item->product_basePriceWithTax) && $item->product_item_price != $item->product_final_price) {
				echo '<span class="line-through">' . $this->currency->priceDisplay($item->product_item_price,$this->user_currency_id,$qtt) . '</span><br />';
			}
			echo $this->currency->priceDisplay(  $item->product_subtotal_with_tax ,$this->user_currency_id); //No quantity or you must use product_final_price ?>
		</td>
	</tr>
<?php } ?>

	<tr class="sectiontableentry1">
		<td colspan="6" style="text-align: right;"><?php echo vmText::_('COM_VIRTUEMART_ORDER_PRINT_PRODUCT_PRICES_TOTAL'); ?></td>
		<?php if ( VmConfig::get('show_tax')) { ?>
		<td style="text-align: right;"><?php echo "<span  class='priceColor2'>".$this->currency->priceDisplay($this->orderdetails['details']['BT']->order_tax,$this->user_currency_id)."</span>" ?></td>
		<?php } ?>
		<td style="text-align: right;"><?php echo "<span  class='priceColor2'>".$this->currency->priceDisplay($this->orderdetails['details']['BT']->order_discountAmount,$this->user_currency_id)."</span>" ?></td>
		<td style="text-align: right;"><?php echo $this->currency->priceDisplay($this->orderdetails['details']['BT']->order_salesPrice,$this->user_currency_id) ?></td>
	</tr>

<?php
if ($this->orderdetails['details']['BT']->coupon_discount <> 0.00) {
	$coupon_code=$this->orderdetails['details']['BT']->coupon_code?' ('.$this->orderdetails['details']['BT']->coupon_code.')':'';
?>
	<tr>
		<td style="text-align: right;" class="pricePad" colspan="6"><?php echo vmText::_('COM_VIRTUEMART_COUPON_DISCOUNT').$coupon_code ?></td>
		<?php if ( VmConfig::get('show_tax')) { ?>
		<td style="text-align: right;">&nbsp;</td>
		<?php } ?>
		<td style="text-align: right;">&nbsp;</td>
		<td style="text-align: right;"><?php echo $this->currency->priceDisplay($this->orderdetails['details']['BT']->coupon_discount,$this->user_currency_id); ?></td>
	</tr>
<?php } ?>

<?php
foreach($this->orderdetails['calc_rules'] as $rule){
	if ($rule->calc_kind== 'DBTaxRulesBill') { ?>
	<tr>
		<td colspan="6"  style="text-align: right;" class="pricePad"><?php echo $rule->calc_rule_name ?> </td>
		<?php if ( VmConfig::get('show_tax')) { ?>
		<td style="text-align: right;">&nbsp;</td>
		<?php } ?>
		<td style="text-align: right;"><?php echo  $this->currency->priceDisplay($rule->calc_amount,$this->user_currency_id);  ?> </td>
		<td style="text-align: right;"><?php echo  $this->currency->priceDisplay($rule->calc_amount,$this->user_currency_id);  ?> </td>
	</tr>
	<?php
	} elseif ($rule->calc_kind == 'taxRulesBill') { ?>
	<tr>
		<td colspan="6"  style="text-align: right;" class="pricePad"><?php echo $rule->calc_rule_name ?> </td>
		<?php if ( VmConfig::get('show_tax')) { ?>
		<td style="text-align: right;"><?php echo $this->currency->priceDisplay($rule->calc_amount,$this->user_currency_id); ?> </td>
		 <?php } ?>
		<td style="text-align: right;">&nbsp;</td>
		<td style="text-align: right;"><?php echo $this->currency->priceDisplay($rule->calc_amount,$this->user_currency_id); ?> </td>
	</tr>
	<?php
	} elseif ($rule->calc_kind == 'DATaxRulesBill') { ?>
	<tr>
		<td colspan="6" style="text-align: right;" class="pricePad"><?php echo $rule->calc_rule_name ?> </td>
		<?php if ( VmConfig::get('show_tax')) { ?>
		<td style="text-align: right;">&nbsp;</td>
		 <?php } ?>
		<td style="text-align: right;"><?php  echo   $this->currency->priceDisplay($rule->calc_amount,$this->user_currency_id);  ?> </td>
		<td style="text-align: right;"><?php echo $this->currency->priceDisplay($rule->calc_amount,$this->user_currency_id);  ?> </td>
	</tr>
	<?php
	}
} ?>

	<tr>
		<td style="text-align: right;" class="pricePad" colspan="6"><?php echo vmText::_('COM_VIRTUEMART_ORDER_PRINT_SHIPPING') ?></td>
		<?php if ( VmConfig::get('show_tax')) { ?>
		<td style="text-align: right;"><?php echo "<span  class='priceColor2'>".$this->currency->priceDisplay($this->orderdetails['details']['BT']->order_shipment_tax, $this->user_currency_id)."</span>" ?></td>
		<?php } ?>
		<td style="text-align: right;">&nbsp;</td>
		<td style="text-align: right;"><?php echo $this->currency->priceDisplay($this->orderdetails['details']['BT']->order_shipment+ $this->orderdetails['details']['BT']->order_shipment_tax, $this->user_currency_id); ?></td>
	</tr>

	<tr>
		<td style="text-align: right;" class="pricePad" colspan="6"><?php echo vmText::_('COM_VIRTUEMART_ORDER_PRINT_PAYMENT') ?></td>
		<?php if ( VmConfig::get('show_tax')) { ?>
		<td style="text-align: right;"><?php echo "<span  class='priceColor2'>".$this->currency->priceDisplay($this->orderdetails['details']['BT']->order_payment_tax, $this->user_currency_id)."</span>" ?></td>
		<?php } ?>
		<td style="text-align: right;">&nbsp;</td>
		<td style="text-align: right;"><?php echo $this->currency->priceDisplay($this->orderdetails['details']['BT']->order_payment+ $this->orderdetails['details']['BT']->order_payment_tax, $this->user_currency_id); ?></td>
	</tr>

	<tr>
		<td style="text-align: right;" class="pricePad" colspan="6"><strong><?php echo vmText::_('COM_VIRTUEMART_ORDER_PRINT_TOTAL') ?></strong></td>
		<?php if ( VmConfig::get('show_tax')) {  ?>
		<td style="text-align: right;"><span  class='priceColor2'><?php echo $this->currency->priceDisplay($this->orderdetails['details']['BT']->order_billTaxAmount, $this->user_currency_id); ?></span></td>
		<?php } ?>
		<td style="text-align: right;"><span  class='priceColor2'><?php echo $this->currency->priceDisplay($this->orderdetails['details']['BT']->order_billDiscountAmount, $this->user_currency_id); ?></span></td>
		<td style="text-align: right;"><strong><?php echo $this->currency->priceDisplay($this->orderdetails['details']['BT']->order_total, $this->user_currency_id); ?></strong></td>
	</tr>

        <tr style="border-top-style:double">
            <td align="left" colspan="3" style="padding-right: 5px;"><strong><?php echo vmText::_('COM_VM_ORDER_BALANCE') ?></strong></td>

        <?php
		$this->orderbt = $this->orderdetails['details']['BT'];
        $tp = '';
        $detail=false;
        if (empty($this->orderbt->paid) ) {
            $t = vmText::_('COM_VM_ORDER_UNPAID');
        } else if($this->orderbt->paid == $this->orderbt->toPay){
            $t =  vmText::_('COM_VM_ORDER_PAID');
        } else if($this->orderbt->paid < $this->orderbt->toPay){
            $t =  vmText::sprintf('COM_VM_ORDER_PARTIAL_PAID',$this->orderbt->paid);
            $detail=true;
        } else {
            $t =  vmText::sprintf('COM_VM_ORDER_CREDIT_BALANCE',$this->orderbt->paid);
            $detail=true;
        }
        $trOpen = true;
        $colspan = '5';
        if(empty($this->toRefund) and !$detail){
            echo '<td align="left" colspan="3" style="padding-right: 5px;">'.$t.'</td>';
            //echo '<td><input class="orderEdit" type="text" size="8" name="item_id[paid]" value="'.$this->orderbt->paid.'"/></td>';
            echo '</tr>';
            $trOpen = false;
        }

        if(!empty($this->toRefund)){
            echo '<td colspan="5">'.vmText::_('COM_VM_ORDER_PRODUCTS_TO_REFUND').'</td>';
            if($trOpen) {
                echo '</tr>';
                $trOpen = false;
            }
            foreach ($this->toRefund as $index => $item) {

                $tmpl = "refund-tmpl-" . $index;

                echo '<tr id="'.$tmpl.'" class="order-item">';
                echo '<td colspan="3"></td>';
                echo '<td colspan="2">'.$item->order_item_name.'</td>';
                echo '<td colspan="1">'.$item->order_item_sku.'</td>';
                echo '<td style="text-align: right;" colspan="1">'.$this->currency->priceDisplay($item->product_tax).'</td>';
                echo '<td colspan="1"></td>';
                echo '<td style="text-align: right;" colspan="1">'.$this->currency->priceDisplay($item->product_subtotal_with_tax).'</td>';
                echo '</tr>';
                $this->orderbt->order_total -= $item->product_subtotal_with_tax;
                $colspan = '5';
            }
        } else {
            $colspan = '2';
        }

        if(!empty($this->toRefund) or $detail){

            if($this->orderbt->paid < $this->orderbt->toPay){

                if (empty($this->orderbt->paid)){
                    $t =  vmText::_('COM_VM_ORDER_UNPAID');
                } else {
                    $t =  vmText::_('COM_VM_ORDER_PARTIAL_PAID');
                }
                $l = vmText::_('COM_VM_ORDER_OUTSTANDING_AMOUNT');

            } else {
                $t =  vmText::_('COM_VM_ORDER_PAID');
                $l = vmText::_('COM_VM_ORDER_BALANCE');
            }

            $tp .= '';
            if($this->orderbt->toPay!=$this->orderbt->order_total){
                if(!$trOpen){
                    $tp .= '<tr>';
                    $trOpen= true;
                }
                $tp .= '<td colspan="'.$colspan.'"></td>';
                $tp .= '<td style="text-align: right;" colspan="3" style="padding-right: 5px;">'.vmText::_('COM_VM_ORDER_NEW_TOTAL').'</td>';
                $tp .= '<td style="text-align: right;">'.$this->currency->priceDisplay($this->orderbt->toPay).'</td>';

                if($trOpen) {
                    $tp .= '</tr>';
                    $trOpen = false;
                }
            }

            if(!$trOpen){
                $tp .= '<tr>';
                $trOpen= true;
            }
            $tp .= '<td colspan="'.$colspan.'"></td>';
            $tp .= '<td style="text-align: right;" colspan="3" style="padding-right: 5px;">'.$t.'</td>';
            $tp .= '<td style="text-align: right;" >'.$this->currency->priceDisplay($this->orderbt->paid).'</td>';
            $tp .= '</tr>';

            $tp .= '<tr>';
            $tp .= '<td colspan="5"></td>';
            $tp .= '<td style="text-align: right;" colspan="3" style="padding-right: 5px;">'.$l.'</td>';
            $tp .= '<td style="text-align: right;" >'.$this->currency->priceDisplay(abs($this->orderbt->order_total - $this->orderbt->paid) ).'</td>';
            echo $tp;
        }
        if($trOpen) {
            echo '</tr>';
            $trOpen = false;
        }
        ?>
</table>
<?php
/**
 *
 * Order detail view
 *
 * @package	VirtueMart
 * @subpackage Orders
 * @author Oscar van Eijk, Valerie Isaksen
 * @link https://virtuemart.net
 * @copyright Copyright (c) 2004 - 2010 VirtueMart Team. All rights reserved.
 * @license http://www.gnu.org/copyleft/gpl.html GNU/GPL, see LICENSE.php
 * 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.
 * @version $Id: details_order.php 10649 2022-05-05 14:29:44Z Milbo $
 */
// Check to ensure this file is included in Joomla!
defined('_JEXEC') or die('Restricted access');

?>

<table width="100%" cellspacing="0" cellpadding="0" border="0">
    <tr>
        <td   class="orders-key"><?php echo vmText::_('COM_VIRTUEMART_ORDER_PRINT_PO_NUMBER') ?></td>
        <td class="orders-key" align="left">
			<?php echo $this->orderdetails['details']['BT']->order_number; ?>
        </td>
    </tr>
    <tr>
        <td class=""><?php echo vmText::_('COM_VIRTUEMART_ORDER_PRINT_PO_DATE') ?></td>
        <td align="left"><?php echo vmJsApi::date($this->orderdetails['details']['BT']->order_created, 'LC4', true); ?></td>
    </tr>
    <tr>
        <td class=""><?php echo vmText::_('COM_VIRTUEMART_ORDER_PRINT_PO_STATUS') ?></td>
        <td align="left"><?php echo $this->orderstatuses[$this->orderdetails['details']['BT']->order_status]; ?></td>
    </tr>
    <tr>
        <td class=""><?php echo vmText::_('COM_VIRTUEMART_LAST_UPDATED') ?></td>
        <td align="left"><?php echo vmJsApi::date($this->orderdetails['details']['BT']->order_modified, 'LC4', true); ?></td>
    </tr>
    <tr>
        <td class=""><?php echo vmText::_('COM_VIRTUEMART_ORDER_PRINT_SHIPMENT_LBL') ?></td>
        <td align="left"><?php
			echo $this->shipment_name;
			?></td>
    </tr>
    <tr>
        <td class=""><?php echo vmText::_('COM_VIRTUEMART_ORDER_PRINT_PAYMENT_LBL') ?></td>
        <td align="left"><?php echo $this->payment_name; ?>
        </td>
    </tr>

    <tr>
        <td><?php echo vmText::_('COM_VIRTUEMART_ORDER_PRINT_CUSTOMER_NOTE') ?></td>
        <td valign="top" align="left" width="50%"><?php echo $this->orderdetails['details']['BT']->customer_note; ?></td>
    </tr>

    <tr>
        <td class="orders-key"><?php echo vmText::_('COM_VIRTUEMART_ORDER_PRINT_TOTAL') ?></td>
        <td class="orders-key" align="left"><?php echo $this->currency->priceDisplay($this->orderdetails['details']['BT']->order_total, $this->user_currency_id); ?></td>
    </tr>

    <tr>
        <td colspan="2"> &nbsp;</td>
    </tr>
    <tr>
        <td valign="top"><strong>
				<?php echo vmText::_('COM_VIRTUEMART_ORDER_PRINT_BILL_TO_LBL') ?></strong> <br/>
            <table border="0"><?php
				foreach ($this->userfields['fields'] as $field) {
					if (!empty($field['value'])) {
						echo '<tr><td class="key">' . $field['title'] . '</td>'
						. '<td>' . $field['value'] . '</td></tr>';
					}
				}
				?></table>
        </td>
        <td valign="top" ><strong>
				<?php echo vmText::_('COM_VIRTUEMART_ORDER_PRINT_SHIP_TO_LBL') ?></strong><br/>
				<?php if(!empty($this->orderdetails['details']['has_ST'])){
					echo "<table border='0'>";
					foreach ($this->shipmentfields['fields'] as $field) {
						if (!empty($field['value'])) {
							echo '<tr><td class="key">' . $field['title'] . '</td>'
							. '<td>' . $field['value'] . '</td></tr>';
						}
					}
					echo "</table>";
				} else {
					echo "<br/>".vmText::_('COM_VM_ST_SAME_AS_BT');
				}

				?></table>
        </td>
    </tr>
</table>
<?php
defined('_JEXEC') or die('Restricted access');
/**
*
* Order detail view
*
* @package	VirtueMart
* @subpackage Orders
* @author Oscar van Eijk
* @link https://virtuemart.net
* @copyright Copyright (c) 2004 - 2010 VirtueMart Team. All rights reserved.
* @license http://www.gnu.org/copyleft/gpl.html GNU/GPL, see LICENSE.php
* 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.
* @version $Id: details.php 5314 2012-01-24 15:23:17Z Milbo $
*/
echo 'old layout used FE/orders/tmpl/details_pdf.php'  ;

<?php
/**
*
* Orderlist
* NOTE: This is a copy of the edit_orderlist template from the user-view (which in turn is a slighly
*       modified copy from the backend)
*
* @package	VirtueMart
* @subpackage Orders
* @author Oscar van Eijk, Andrew Hutson
* @link https://virtuemart.net
* @copyright Copyright (c) 2004 - 2016 VirtueMart Team. All rights reserved.
* @license http://www.gnu.org/copyleft/gpl.html GNU/GPL, see LICENSE.php
* 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.
* @version $Id: list.php 10833 2023-04-19 19:56:57Z Milbo $
*/

// Check to ensure this file is included in Joomla!
defined('_JEXEC') or die('Restricted access');

$ajaxUpdate = '';
if(VmConfig::get ('ajax_order', TRUE)){
	$ajaxUpdate = 'data-dynamic-update="1"';
}

?>
<div class="vm-wrap">
    <div class="vm-orders-information"></div>
	<div class="vm-orders-list">
<h1><?php echo vmText::_('COM_VIRTUEMART_ORDERS_VIEW_DEFAULT_TITLE'); ?></h1>
<?php
if (count($this->orderlist) == 0) {

	echo shopFunctionsF::getLoginForm(false,$this->trackingByOrderPass);
} else { ?>
<div id="editcell">
	<table class="adminlist" width="80%">
	<thead>
	<tr>
		<th>
			<?php echo vmText::_('COM_VIRTUEMART_ORDER_LIST_ORDER_NUMBER'); ?>
		</th>
		<th>
			<?php echo vmText::_('COM_VIRTUEMART_ORDER_LIST_CDATE'); ?>
		</th>
		<!--th>
			<?php //echo vmText::_('COM_VIRTUEMART_ORDER_LIST_MDATE'); ?>
		</th -->
		<th>
			<?php echo vmText::_('COM_VIRTUEMART_ORDER_LIST_STATUS'); ?>
		</th>
		<th>
			<?php echo vmText::_('COM_VIRTUEMART_ORDER_LIST_TOTAL'); ?>
		</th>
	</tr>
	</thead>
	<?php
		$k = 0;
		foreach ($this->orderlist as $row) {
			$editlink = JRoute::_('index.php?option=com_virtuemart&view=orders&layout=details&order_number=' . $row->order_number, FALSE);
			?>
			<tr class="<?php echo "row$k"; ?>">
				<td align="left">
					<a href="<?php echo $editlink; ?>" rel="nofollow" <?php echo $ajaxUpdate?> ><?php echo $row->order_number; ?></a>
					<?php echo shopFunctionsF::getInvoiceDownloadButton($row) ?>
				</td>
				<td align="left">
					<?php echo vmJsApi::date($row->created_on,'LC4',true); ?>
				</td>
				<!--td align="left">
					<?php //echo vmJsApi::date($row->modified_on,'LC3',true); ?>
				</td -->
				<td align="left">
					<?php echo shopFunctionsF::getOrderStatusName($row->order_status); ?>
				</td>
				<td align="left">
					<?php echo $row->currency->priceDisplay($row->order_total, $row->currency); ?>
				</td>
			</tr>
	<?php
			$k = 1 - $k;
		}
	?>
	</table>
</div>
<?php } ?>
	</div>

</div>
<?php
if(VmConfig::get ('ajax_order', TRUE)){
	vmJsApi::addJScript( 'vmtabs' );
    vmJsApi::jDynUpdate('.vm-orders-information');
}
?>
<?xml version="1.0" encoding="utf-8"?>
<metadata>
    <layout title="COM_VIRTUEMART_ORDERS_VIEW_DEFAULT_TITLE">
        <message><![CDATA[COM_VIRTUEMART_ORDERS_VIEW_DEFAULT_DESC]]></message>
    </layout>
    <state>
        <name>COM_VIRTUEMART_ORDERS_VIEW_DEFAULT_TITLE</name>
        <description><![CDATA[COM_VIRTUEMART_ORDERS_VIEW_DEFAULT_DESC]]></description>
    </state>
</metadata>
<?php
/**
 *
 * Handle the orders view
 *
 * @package	VirtueMart
 * @subpackage Orders
 * @author Oscar van Eijk, Max Milbers
 * @link https://virtuemart.net
 * @copyright Copyright (c) 2004 - 2018 VirtueMart Team. All rights reserved.
 * @license http://www.gnu.org/copyleft/gpl.html GNU/GPL, see LICENSE.php
 * 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.
 * @version $Id: view.html.php 10649 2022-05-05 14:29:44Z Milbo $
 */

// Check to ensure this file is included in Joomla!
defined('_JEXEC') or die('Restricted access');

/**
 * Handle the orders view
 */
class VirtuemartViewOrders extends VmView {

	public function display($tpl = null)
	{

		$mainframe = JFactory::getApplication();
		$pathway = $mainframe->getPathway();
		$task = vRequest::getCmd('task', 'list');

		$layoutName = vRequest::getCmd('layout', 'list');

		$this->setLayout($layoutName);

		$_currentUser = JFactory::getUser();
		$document = JFactory::getDocument();

		if(!empty($tpl)){
			$format = $tpl;
		} else {
			$format = vRequest::getCmd('format', 'html');
		}
		$this->assignRef('format', $format);

		if($format=='pdf'){
			$document->setTitle( vmText::_('COM_VIRTUEMART_INVOICE') );

			//PDF needs more RAM than usual
			VmConfig::ensureMemoryLimit(96);

		} else {
		    if ($layoutName == 'details') {
			$document->setTitle( vmText::_('COM_VIRTUEMART_ACC_ORDER_INFO') );
			$pathway->additem(vmText::_('COM_VIRTUEMART_ACC_ORDER_INFO'));
		    } else {
			$document->setTitle( vmText::_('COM_VIRTUEMART_ORDERS_VIEW_DEFAULT_TITLE') );
			$pathway->additem(vmText::_('COM_VIRTUEMART_ORDERS_VIEW_DEFAULT_TITLE'));
		    }
		}

		$orderModel = VmModel::getModel('orders');

		$this->order_list_link = JRoute::_('index.php?option=com_virtuemart&view=orders&layout=list', FALSE);


		$ordertracking = VmConfig::get('ordertracking','guests');
		$this->trackingByOrderPass = false; //(VmConfig::get( 'orderGuestLink', 0 ) or !VmConfig::get('oncheckout_only_registered',0)) ;
		if($ordertracking == 'guests' or $ordertracking == 'guestlink'){
			$this->trackingByOrderPass = true;
		}

		if ($layoutName == 'details') {

			$orderPass = vRequest::getString( 'order_pass', false );
			if($_currentUser->guest and (!$this->trackingByOrderPass or !$orderPass)){
				vmInfo('COM_VIRTUEMART_ORDER_CONNECT_FORM');
				$orderDetails = false;
				parent::display($tpl);
				return true;
			} else {
				$orderDetails = $orderModel ->getMyOrderDetails();
				if(!$orderDetails or empty($orderDetails['details'])){
					$layoutName = 'list';
					$this->setLayout($layoutName);
					if($orderDetails) {
						$this->trackingByOrderPass = false;
					} else {
						vmInfo('COM_VIRTUEMART_ORDER_NOTFOUND');
						//return;
					}
				}
			}


		}

		if ($layoutName == 'details') {

			$userFieldsModel = VmModel::getModel('userfields');
			$_userFields = $userFieldsModel->getUserFields(
				 'account'
			, array('captcha' => true, 'delimiters' => true) // Ignore these types
			, array('delimiter_userinfo','user_is_vendor' ,'username','password', 'password2', 'agreed', 'address_type') // Skips
			);



			$this->userfields = $userFieldsModel->getUserFieldsFilled(
			$_userFields
			,$orderDetails['details']['BT']
			);
			$_userFields = $userFieldsModel->getUserFields(
				 'shipment'
			, array() // Default switches
			, array('delimiter_userinfo', 'username', 'email', 'password', 'password2', 'agreed', 'address_type') // Skips
			);

			$this->shipmentfields = $userFieldsModel->getUserFieldsFilled(
			$_userFields
			,$orderDetails['details']['ST']
			);

			$this->shipment_name='';

			vDispatcher::importVMPlugins('vmshipment');
			$returnValues = vDispatcher::trigger('plgVmOnShowOrderFEShipment',array(  $orderDetails['details']['BT']->virtuemart_order_id, $orderDetails['details']['BT']->virtuemart_shipmentmethod_id, &$this->shipment_name));

			$this->payment_name='';

			vDispatcher::importVMPlugins('vmpayment');
			$returnValues = vDispatcher::trigger('plgVmOnShowOrderFEPayment',array( $orderDetails['details']['BT']->virtuemart_order_id, $orderDetails['details']['BT']->virtuemart_paymentmethod_id,  &$this->payment_name));

			if($format=='pdf'){
				$invoiceNumberDate = array();
				if(empty($orderDetails['details']['BT']->invoice_locked)) $return = $orderModel->createInvoiceNumber($orderDetails['details']['BT'], $invoiceNumberDate );
				if(empty($invoiceNumberDate)){
					$invoiceNumberDate[0] = 'no invoice number accessible';
					$invoiceNumberDate[1] = 'no invoice date accessible';
				}
				$this->assignRef('invoiceNumber', $invoiceNumberDate[0]);
				$this->assignRef('invoiceDate', $invoiceNumberDate[1]);
			}

			$this->assignRef('orderdetails', $orderDetails);

			if($_currentUser->guest){
				$details_url = juri::root().'index.php?option=com_virtuemart&view=orders&layout=details&tmpl=component&order_pass=' . vRequest::getString('order_pass',false) .'&order_number='.vRequest::getString('order_number',false);
			} else {
				$details_url = juri::root().'index.php?option=com_virtuemart&view=orders&layout=details&tmpl=component&virtuemart_order_id=' . $this->orderdetails['details']['BT']->virtuemart_order_id;
			}
			$this->assignRef('details_url', $details_url);

			$tmpl = vRequest::getCmd('tmpl');
			$dyn = vRequest::getCmd('dynamic');
			$this->print = false;
			if($tmpl and !$dyn){
				$this->print = true;
			}
			$this->prepareVendor();


			$emailCurrencyId = $orderDetails['details']['BT']->user_currency_id;
			$exchangeRate = FALSE;

			/*
			 * Deprecated trigger will be renamed or removed
			 */
			vDispatcher::importVMPlugins ('vmpayment');
			vDispatcher::trigger ('plgVmgetEmailCurrency', array($orderDetails['details']['BT']->virtuemart_paymentmethod_id, $orderDetails['details']['BT']->virtuemart_order_id, &$emailCurrencyId));

			$this->currency = CurrencyDisplay::getInstance ($emailCurrencyId, $orderDetails['details']['BT']->virtuemart_vendor_id);
			if ($emailCurrencyId) {
				$this->currency->exchangeRateShopper = $orderDetails['details']['BT']->user_currency_rate;
			}

			$this->user_currency_id = $emailCurrencyId;

			$os_trigger_refunds = VmConfig::get('os_trigger_refunds', array('R'));
			$this->toRefund = array();
			$orderDetails['details']['BT']->toPay = floatval($orderDetails['details']['BT']->order_total);
			foreach($orderDetails['items'] as $i => $_item) {
				$orderDetails['items'][$i]->linkedit = 'index.php?option=com_virtuemart&view=product&task=edit&virtuemart_product_id='.$_item->virtuemart_product_id;

				if(in_array($_item->order_status,$os_trigger_refunds)){
					$this->toRefund[] = $_item;
					$orderDetails['details']['BT']->toPay -= $this->currency->roundByPriceConfig($_item->product_subtotal_with_tax);
				}
			}
			$orderDetails['details']['BT']->toPay = $this->currency->roundByPriceConfig(($orderDetails['details']['BT']->toPay));

			$rulesSorted = shopFunctionsF::summarizeRulesForBill($orderDetails);
			$this->discountsBill = $rulesSorted['discountsBill'];
			$this->taxBill = $rulesSorted['taxBill'];


			if($l = VmConfig::get('layout_order_detail',false)){
				$this->setLayout( strtolower( $l ) );
			}
		} else { // 'list' -. default

			$this->useSSL = vmURI::useSSL();
			$this->useXHTML = false;
			if ($_currentUser->get('id') == 0) {
				// getOrdersList() returns all orders when no userID is set (admin function),
				// so explicetly define an empty array when not logged in.
				$this->orderlist = array();
			} else {
				$this->orderlist = $orderModel->getOrdersList($_currentUser->get('id'), TRUE);

				foreach ($this->orderlist as $k =>$order) {
					$vendorId = 1;
					$emailCurrencyId = $order->user_currency_id;
					$exchangeRate = FALSE;

					vDispatcher::importVMPlugins ('vmpayment');
					vDispatcher::trigger ('plgVmgetEmailCurrency', array($order->virtuemart_paymentmethod_id, $order->virtuemart_order_id, &$emailCurrencyId));
					
					$this->currency = CurrencyDisplay::getInstance ($emailCurrencyId, $vendorId);

					if ($ema