Merge pull request #1125 from sumitwebkul/gli-2058
Fixed: Invoice data is not correct when multiple invoices created in an order from back-office
This commit is contained in:
@@ -602,13 +602,19 @@ class OrderCore extends ObjectModel
|
||||
$is_booking = null,
|
||||
$product_service_type = null,
|
||||
$product_auto_add = null,
|
||||
$product_price_addition_type = null
|
||||
$product_price_addition_type = null,
|
||||
$ids_order_detail = []
|
||||
) {
|
||||
$sql = 'SELECT *
|
||||
FROM `'._DB_PREFIX_.'order_detail` od
|
||||
LEFT JOIN `'._DB_PREFIX_.'product` p ON (p.id_product = od.product_id)
|
||||
LEFT JOIN `'._DB_PREFIX_.'product_shop` ps ON (ps.id_product = p.id_product AND ps.id_shop = od.id_shop)
|
||||
WHERE od.`id_order` = '.(int)$this->id;
|
||||
|
||||
if ($ids_order_detail) {
|
||||
$sql .= ' AND od.`id_order_detail` IN ('.implode(',', $ids_order_detail).')';
|
||||
}
|
||||
|
||||
if ($is_booking !== null) {
|
||||
$sql .= ' AND od.`is_booking_product` = '. (int)$is_booking;
|
||||
if (!$is_booking && $product_service_type !== null) {
|
||||
@@ -1091,11 +1097,12 @@ class OrderCore extends ObjectModel
|
||||
$bookingProducts = null,
|
||||
$product_service_type = null,
|
||||
$product_auto_add = null,
|
||||
$product_price_addition_type = null
|
||||
$product_price_addition_type = null,
|
||||
$ids_order_detail = []
|
||||
) {
|
||||
// update
|
||||
if (!$products) {
|
||||
$products = $this->getProductsDetail($bookingProducts, $product_service_type, $product_auto_add, $product_price_addition_type);
|
||||
$products = $this->getProductsDetail($bookingProducts, $product_service_type, $product_auto_add, $product_price_addition_type, $ids_order_detail);
|
||||
}
|
||||
|
||||
$return = 0;
|
||||
@@ -1116,11 +1123,12 @@ class OrderCore extends ObjectModel
|
||||
$bookingProducts = null,
|
||||
$product_service_type = null,
|
||||
$product_auto_add = null,
|
||||
$product_price_addition_type = null
|
||||
$product_price_addition_type = null,
|
||||
$ids_order_detail = []
|
||||
) {
|
||||
/* Retro-compatibility (now set directly on the validateOrder() method) */
|
||||
if (!$products) {
|
||||
$products = $this->getProductsDetail($bookingProducts, $product_service_type, $product_auto_add, $product_price_addition_type);
|
||||
$products = $this->getProductsDetail($bookingProducts, $product_service_type, $product_auto_add, $product_price_addition_type, $ids_order_detail);
|
||||
}
|
||||
|
||||
$return = 0;
|
||||
|
||||
@@ -413,7 +413,7 @@ class OrderInvoiceCore extends ObjectModel
|
||||
// - 'total_price_tax_excl'
|
||||
// - 'total_amount'
|
||||
$breakdown = array();
|
||||
$order_detail = $order->getOrderDetailList();
|
||||
$order_detail = $this->getProducts();
|
||||
$order_detail = array_filter($order_detail, function($v) {
|
||||
return ($v['is_booking_product']
|
||||
|| ($v['product_auto_add']
|
||||
@@ -482,7 +482,7 @@ class OrderInvoiceCore extends ObjectModel
|
||||
// - 'total_price_tax_excl'
|
||||
// - 'total_amount'
|
||||
$breakdown = array();
|
||||
$order_detail = $order->getOrderDetailList();
|
||||
$order_detail = $this->getProducts();
|
||||
$order_detail = array_filter($order_detail, function($v) {
|
||||
return (!$v['is_booking_product'] && !$v['product_auto_add'] && $v['product_service_type'] == Product::SERVICE_PRODUCT_WITH_ROOMTYPE);
|
||||
});
|
||||
@@ -546,7 +546,7 @@ class OrderInvoiceCore extends ObjectModel
|
||||
// - 'total_price_tax_excl'
|
||||
// - 'total_amount'
|
||||
$breakdown = array();
|
||||
$order_detail = $order->getOrderDetailList();
|
||||
$order_detail = $this->getProducts();
|
||||
$order_detail = array_filter($order_detail, function($v) {
|
||||
return (!$v['is_booking_product']
|
||||
&& $v['product_auto_add']
|
||||
@@ -616,7 +616,7 @@ class OrderInvoiceCore extends ObjectModel
|
||||
// - 'total_price_tax_excl'
|
||||
// - 'total_amount'
|
||||
$breakdown = array();
|
||||
$order_detail = $order->getOrderDetailList();
|
||||
$order_detail = $this->getProducts();
|
||||
$order_detail = array_filter($order_detail, function($v) {
|
||||
return (!$v['is_booking_product'] && $v['product_service_type'] == Product::SERVICE_PRODUCT_WITHOUT_ROOMTYPE);
|
||||
});
|
||||
@@ -674,8 +674,10 @@ class OrderInvoiceCore extends ObjectModel
|
||||
$order = $this->getOrder();
|
||||
}
|
||||
$breakdown = array();
|
||||
$order_details = $this->getProducts();
|
||||
$objBookingDemand = new HotelBookingDemands();
|
||||
$details = $objBookingDemand->getExtraDemandsTaxesDetails($order->id);
|
||||
$order_details = array_column($order_details, 'id_order_detail');
|
||||
$details = $objBookingDemand->getExtraDemandsTaxesDetails($order->id, $order_details);
|
||||
if (!$this->useOneAfterAnotherTaxComputationMethod()) {
|
||||
$grouped_details = array();
|
||||
foreach ($details as $row) {
|
||||
@@ -1013,7 +1015,7 @@ class OrderInvoiceCore extends ObjectModel
|
||||
$payments = OrderPaymentDetail::getByInvoiceId($this->id);
|
||||
foreach ($payments as $payment) {
|
||||
/** @var OrderPayment $payment */
|
||||
$amount += $payment['amount'];
|
||||
$amount += ($payment['amount'] / $payment['conversion_rate']);
|
||||
}
|
||||
Cache::store($cache_id, $amount);
|
||||
return $amount;
|
||||
|
||||
@@ -349,9 +349,9 @@ class HTMLTemplateInvoiceCore extends HTMLTemplate
|
||||
if ($type_value)
|
||||
if (isset($customer->id)) {
|
||||
$cart_obj = new Cart($this->order->id_cart);
|
||||
$order_bk_data = $obj_htl_bk_dtl->getOnlyOrderBookingData($this->order->id, $cart_obj->id_guest, $type_value['product_id'], $customer->id);
|
||||
$order_bk_data = $obj_htl_bk_dtl->getOnlyOrderBookingData($this->order->id, $cart_obj->id_guest, $type_value['product_id'], $customer->id, $type_value['id_order_detail']);
|
||||
} else {
|
||||
$order_bk_data = $obj_htl_bk_dtl->getOnlyOrderBookingData($this->order->id, $customer->id_guest, $type_value['product_id']);
|
||||
$order_bk_data = $obj_htl_bk_dtl->getOnlyOrderBookingData($this->order->id, $customer->id_guest, $type_value['product_id'], 0, $type_value['id_order_detail']);
|
||||
}
|
||||
|
||||
$cart_htl_data[$type_key]['id_product'] = $type_value['product_id'];
|
||||
@@ -387,7 +387,8 @@ class HTMLTemplateInvoiceCore extends HTMLTemplate
|
||||
$data_v['date_to'],
|
||||
0,
|
||||
1,
|
||||
0
|
||||
0,
|
||||
$type_value['id_order_detail']
|
||||
);
|
||||
$cart_htl_data[$type_key]['date_diff'][$date_join]['extra_demands_price_ti'] = $objBookingDemand->getRoomTypeBookingExtraDemands(
|
||||
$order_obj->id,
|
||||
@@ -397,7 +398,8 @@ class HTMLTemplateInvoiceCore extends HTMLTemplate
|
||||
$data_v['date_to'],
|
||||
0,
|
||||
1,
|
||||
1
|
||||
1,
|
||||
$type_value['id_order_detail']
|
||||
);
|
||||
$cart_htl_data[$type_key]['date_diff'][$date_join]['additional_services_price_auto_add_ti'] = $objRoomTypeServiceProductOrderDetail->getroomTypeServiceProducts(
|
||||
$order_obj->id,
|
||||
@@ -457,7 +459,8 @@ class HTMLTemplateInvoiceCore extends HTMLTemplate
|
||||
$data_v['date_to'],
|
||||
0,
|
||||
1,
|
||||
0
|
||||
0,
|
||||
$type_value['id_order_detail']
|
||||
);
|
||||
$cart_htl_data[$type_key]['date_diff'][$date_join]['extra_demands_price_ti'] = $objBookingDemand->getRoomTypeBookingExtraDemands(
|
||||
$order_obj->id,
|
||||
@@ -467,7 +470,8 @@ class HTMLTemplateInvoiceCore extends HTMLTemplate
|
||||
$data_v['date_to'],
|
||||
0,
|
||||
1,
|
||||
1
|
||||
1,
|
||||
$type_value['id_order_detail']
|
||||
);
|
||||
$cart_htl_data[$type_key]['date_diff'][$date_join]['additional_services'] = $objRoomTypeServiceProductOrderDetail->getroomTypeServiceProducts(
|
||||
$order_obj->id,
|
||||
@@ -610,14 +614,25 @@ class HTMLTemplateInvoiceCore extends HTMLTemplate
|
||||
$footer['total_extra_demands_te'] = $totalDemandsPriceTE;
|
||||
}
|
||||
}
|
||||
$footer['room_price_tax_excl'] = $this->order->getTotalProductsWithoutTaxes(false, true) + $this->order->getTotalProductsWithoutTaxes(false, false, Product::SERVICE_PRODUCT_WITH_ROOMTYPE, 1, Product::PRICE_ADDITION_TYPE_WITH_ROOM);
|
||||
$footer['room_price_tax_incl'] = $this->order->getTotalProductsWithTaxes(false, true) + $this->order->getTotalProductsWithoutTaxes(false, false, Product::SERVICE_PRODUCT_WITH_ROOMTYPE, 1, Product::PRICE_ADDITION_TYPE_WITH_ROOM);
|
||||
// $footer['service_products_price_tax_excl'] = $this->order->getTotalProductsWithoutTaxes(false, false, Product::SERVICE_PRODUCT_WITHOUT_ROOMTYPE);
|
||||
// $footer['service_products_price_tax_incl'] = $this->order->getTotalProductsWithTaxes(false, false, Product::SERVICE_PRODUCT_WITHOUT_ROOMTYPE);
|
||||
$footer['additional_service_price_tax_excl'] = $this->order->getTotalProductsWithoutTaxes(false, false, Product::SERVICE_PRODUCT_WITH_ROOMTYPE, 0) + $totalDemandsPriceTE;
|
||||
$footer['additional_service_price_tax_incl'] = $this->order->getTotalProductsWithTaxes(false, false, Product::SERVICE_PRODUCT_WITH_ROOMTYPE, 0) + $totalDemandsPriceTI;
|
||||
$footer['total_convenience_fee_te'] = $this->order->getTotalProductsWithoutTaxes(false, false, Product::SERVICE_PRODUCT_WITH_ROOMTYPE, 1, Product::PRICE_ADDITION_TYPE_INDEPENDENT);
|
||||
$footer['total_convenience_fee_ti'] = $this->order->getTotalProductsWithTaxes(false, false, Product::SERVICE_PRODUCT_WITH_ROOMTYPE, 1, Product::PRICE_ADDITION_TYPE_INDEPENDENT);
|
||||
|
||||
$footer['room_price_tax_excl'] = 0;
|
||||
$footer['room_price_tax_incl'] = 0;
|
||||
$footer['additional_service_price_tax_excl'] = 0;
|
||||
$footer['additional_service_price_tax_incl'] =0;
|
||||
$footer['total_convenience_fee_te'] = 0;
|
||||
$footer['total_convenience_fee_ti'] = 0;
|
||||
if ($idsOrderDetail = array_column($order_details, 'id_order_detail')) {
|
||||
$footer['room_price_tax_excl'] = $this->order->getTotalProductsWithoutTaxes(false, true, null, null, null, $idsOrderDetail) + $this->order->getTotalProductsWithoutTaxes(false, false, Product::SERVICE_PRODUCT_WITH_ROOMTYPE, 1, Product::PRICE_ADDITION_TYPE_WITH_ROOM, $idsOrderDetail);
|
||||
$footer['room_price_tax_incl'] = $this->order->getTotalProductsWithTaxes(false, true, null, null, null, $idsOrderDetail) + $this->order->getTotalProductsWithoutTaxes(false, false, Product::SERVICE_PRODUCT_WITH_ROOMTYPE, 1, Product::PRICE_ADDITION_TYPE_WITH_ROOM, $idsOrderDetail);
|
||||
// $footer['service_products_price_tax_excl'] = $this->order->getTotalProductsWithoutTaxes(false, false, Product::SERVICE_PRODUCT_WITHOUT_ROOMTYPE);
|
||||
// $footer['service_products_price_tax_incl'] = $this->order->getTotalProductsWithTaxes(false, false, Product::SERVICE_PRODUCT_WITHOUT_ROOMTYPE);
|
||||
$footer['additional_service_price_tax_excl'] = $this->order->getTotalProductsWithoutTaxes(false, false, Product::SERVICE_PRODUCT_WITH_ROOMTYPE, 0, null, $idsOrderDetail) + $totalDemandsPriceTE;
|
||||
$footer['additional_service_price_tax_incl'] = $this->order->getTotalProductsWithTaxes(false, false, Product::SERVICE_PRODUCT_WITH_ROOMTYPE, 0, null, $idsOrderDetail) + $totalDemandsPriceTI;
|
||||
$footer['total_convenience_fee_te'] = $this->order->getTotalProductsWithoutTaxes(false, false, Product::SERVICE_PRODUCT_WITH_ROOMTYPE, 1, Product::PRICE_ADDITION_TYPE_INDEPENDENT, $idsOrderDetail);
|
||||
$footer['total_convenience_fee_ti'] = $this->order->getTotalProductsWithTaxes(false, false, Product::SERVICE_PRODUCT_WITH_ROOMTYPE, 1, Product::PRICE_ADDITION_TYPE_INDEPENDENT, $idsOrderDetail);
|
||||
}
|
||||
$footer['total_paid_real'] = $this->order_invoice->getTotalPaid();
|
||||
|
||||
$data = array(
|
||||
'cart_htl_data' => $cart_htl_data,
|
||||
'service_product_data' => $service_product_data,
|
||||
@@ -737,6 +752,7 @@ class HTMLTemplateInvoiceCore extends HTMLTemplate
|
||||
'ecotax_tax' => $this->order_invoice->getEcoTaxTaxesBreakdown(),
|
||||
'wrapping_tax' => $this->order_invoice->getWrappingTaxesBreakdown(),
|
||||
);
|
||||
|
||||
foreach ($breakdowns as $type => $bd) {
|
||||
if (empty($bd)) {
|
||||
unset($breakdowns[$type]);
|
||||
|
||||
@@ -6268,6 +6268,14 @@ class AdminOrdersControllerCore extends AdminController
|
||||
$res &= $objOrderDetail->update();
|
||||
}
|
||||
|
||||
if ($objOrderDetail->id_order_invoice != 0) {
|
||||
// values changes as values are calculated
|
||||
$objOrderInvoice = new OrderInvoice($objOrderDetail->id_order_invoice);
|
||||
$objOrderInvoice->total_paid_tax_excl -= $priceTaxExcl;
|
||||
$objOrderInvoice->total_paid_tax_incl -= $priceTaxIncl;
|
||||
$res &= $objOrderInvoice->update();
|
||||
}
|
||||
|
||||
$order->total_paid_tax_excl -= $priceTaxExcl;
|
||||
$order->total_paid_tax_incl -= $priceTaxIncl;
|
||||
$order->total_paid -= $priceTaxIncl;
|
||||
@@ -6300,6 +6308,9 @@ class AdminOrdersControllerCore extends AdminController
|
||||
// valiadate services being added
|
||||
if (Validate::isLoadedObject($objHotelBookingDetail = new HotelBookingDetail($idBookingDetail))) {
|
||||
$objOrder = new Order($objHotelBookingDetail->id_order);
|
||||
$objOrderDetail = new OrderDetail($objHotelBookingDetail->id_order_detail);
|
||||
$objOrderInvoice = new OrderInvoice($objOrderDetail->id_order_invoice);
|
||||
|
||||
// set context currency So that we can get prices in the order currency
|
||||
$this->context->currency = new Currency($objOrder->id_currency);
|
||||
|
||||
@@ -6481,7 +6492,7 @@ class AdminOrdersControllerCore extends AdminController
|
||||
}
|
||||
|
||||
$order_detail = new OrderDetail();
|
||||
$order_detail->createList($order, $cart, $order->getCurrentOrderState(), $productList, (isset($order_invoice) ? $order_invoice->id : 0), true);
|
||||
$order_detail->createList($order, $cart, $order->getCurrentOrderState(), $productList, (isset($objOrderInvoice) ? $objOrderInvoice->id : 0), true);
|
||||
|
||||
$objRoomTypeServiceProductOrderDetail = new RoomTypeServiceProductOrderDetail();
|
||||
$objRoomTypeServiceProductOrderDetail->id_product = $product['id_product'];
|
||||
@@ -6505,16 +6516,18 @@ class AdminOrdersControllerCore extends AdminController
|
||||
$order->total_paid_tax_excl += Tools::ps_round((float)($totalPriceChangeTaxExcl), 2);
|
||||
$order->total_paid_tax_incl += Tools::ps_round((float)($totalPriceChangeTaxIncl), 2);
|
||||
|
||||
if (isset($order_invoice) && Validate::isLoadedObject($order_invoice)) {
|
||||
$order->total_shipping = $order_invoice->total_shipping_tax_incl;
|
||||
$order->total_shipping_tax_incl = $order_invoice->total_shipping_tax_incl;
|
||||
$order->total_shipping_tax_excl = $order_invoice->total_shipping_tax_excl;
|
||||
// update invoice total
|
||||
if (isset($objOrderInvoice) && Validate::isLoadedObject($objOrderInvoice)) {
|
||||
$objOrderInvoice->total_paid_tax_excl += Tools::ps_round((float)($totalPriceChangeTaxExcl), 2);
|
||||
$objOrderInvoice->total_paid_tax_incl += Tools::ps_round((float)($totalPriceChangeTaxIncl), 2);
|
||||
$objOrderInvoice->save();
|
||||
}
|
||||
|
||||
// discount
|
||||
$order->total_discounts += (float)abs($cart->getOrderTotal(true, Cart::ONLY_DISCOUNTS));
|
||||
$order->total_discounts_tax_excl += (float)abs($cart->getOrderTotal(false, Cart::ONLY_DISCOUNTS));
|
||||
$order->total_discounts_tax_incl += (float)abs($cart->getOrderTotal(true, Cart::ONLY_DISCOUNTS));
|
||||
|
||||
// Save changes of order
|
||||
$order->update();
|
||||
if (Validate::isLoadedObject($specific_price)) {
|
||||
@@ -6713,8 +6726,9 @@ class AdminOrdersControllerCore extends AdminController
|
||||
$order_invoice = new OrderInvoice($order_detail->id_order_invoice);
|
||||
$order_invoice->total_paid_tax_excl += $priceDiffTaxExcl;
|
||||
$order_invoice->total_paid_tax_incl += $priceDiffTaxIncl;
|
||||
$res &= $order_invoice->update();
|
||||
$order_invoice->update();
|
||||
}
|
||||
|
||||
$order = new Order($objBookingDetail->id_order);
|
||||
$order->total_paid_tax_excl += $priceDiffTaxExcl;
|
||||
$order->total_paid_tax_incl += $priceDiffTaxIncl;
|
||||
|
||||
@@ -74,7 +74,8 @@ class HotelBookingDemands extends ObjectModel
|
||||
$dateTo = 0,
|
||||
$groupByRoom = 1,
|
||||
$getTotalPrice = 0,
|
||||
$useTax = 1
|
||||
$useTax = 1,
|
||||
$idOrderDetail = 0
|
||||
) {
|
||||
$moduleObj = Module::getInstanceByName('hotelreservationsystem');
|
||||
$context = Context::getContext();
|
||||
@@ -91,6 +92,10 @@ class HotelBookingDemands extends ObjectModel
|
||||
WHERE hd.`id_htl_booking` IN
|
||||
(SELECT `id` FROM `'._DB_PREFIX_.'htl_booking_detail`
|
||||
WHERE `id_order`='.(int) $idOrder;
|
||||
|
||||
if ($idOrderDetail) {
|
||||
$sql .= ' AND `id_order_detail`='.(int)$idOrderDetail;
|
||||
}
|
||||
if ($idProduct) {
|
||||
$sql .= ' AND `id_product`='.(int)$idProduct;
|
||||
}
|
||||
@@ -247,16 +252,21 @@ class HotelBookingDemands extends ObjectModel
|
||||
|| Configuration::get('PS_INVOICE_TAXES_BREAKDOWN');
|
||||
}
|
||||
|
||||
public function getExtraDemandsTaxesDetails($idOrder)
|
||||
public function getExtraDemandsTaxesDetails($idOrder, $idsOrderDetail = [])
|
||||
{
|
||||
$taxDetails = Db::getInstance()->executeS(
|
||||
'SELECT hb.`id` as id_htl_booking, hbd.`unit_price_tax_excl`, hbd.`total_price_tax_excl`, hb.`id_order_detail`, hdt.*, t.* FROM '._DB_PREFIX_.'orders o '.
|
||||
'INNER JOIN '._DB_PREFIX_.'htl_booking_detail hb ON hb.id_order = o.id_order '.
|
||||
'INNER JOIN '._DB_PREFIX_.'htl_booking_demands hbd ON hbd.id_htl_booking = hb.id '.
|
||||
'INNER JOIN '._DB_PREFIX_.'htl_booking_demands_tax hdt ON hbd.id_booking_demand = hdt.id_booking_demand '.
|
||||
'INNER JOIN '._DB_PREFIX_.'tax t ON t.id_tax = hdt.id_tax '.
|
||||
'WHERE o.id_order = '.(int)$idOrder
|
||||
);
|
||||
$sql = 'SELECT hb.`id` as id_htl_booking, hbd.`unit_price_tax_excl`, hbd.`total_price_tax_excl`, hb.`id_order_detail`, hdt.*, t.* FROM '._DB_PREFIX_.'orders o '.
|
||||
'INNER JOIN '._DB_PREFIX_.'htl_booking_detail hb ON hb.id_order = o.id_order '.
|
||||
'INNER JOIN '._DB_PREFIX_.'htl_booking_demands hbd ON hbd.id_htl_booking = hb.id '.
|
||||
'INNER JOIN '._DB_PREFIX_.'htl_booking_demands_tax hdt ON hbd.id_booking_demand = hdt.id_booking_demand '.
|
||||
'INNER JOIN '._DB_PREFIX_.'tax t ON t.id_tax = hdt.id_tax '.
|
||||
'WHERE o.id_order = '.(int)$idOrder;
|
||||
|
||||
if ($idsOrderDetail) {
|
||||
$sql .= ' AND hb.`id_order_detail` IN ('.implode(',', $idsOrderDetail).')';
|
||||
}
|
||||
|
||||
$taxDetails = Db::getInstance()->executeS($sql);
|
||||
|
||||
if ($taxDetails) {
|
||||
foreach ($taxDetails as &$detail) {
|
||||
$priceTaxExcl = $detail['unit_price_tax_excl'];
|
||||
|
||||
@@ -2545,13 +2545,17 @@ class HotelBookingDetail extends ObjectModel
|
||||
* @param int $id_customer [description]
|
||||
* @return [type] [description]
|
||||
*/
|
||||
public function getOnlyOrderBookingData($id_order, $id_guest, $id_product, $id_customer = 0)
|
||||
public function getOnlyOrderBookingData($id_order, $id_guest, $id_product, $id_customer = 0, $id_order_detail = 0)
|
||||
{
|
||||
$sql = 'SELECT hbd.*, od.`unit_price_tax_incl`, od.`unit_price_tax_excl`, od.`reduction_amount_tax_excl`,
|
||||
od.`reduction_amount_tax_incl` FROM `'._DB_PREFIX_.'htl_booking_detail` hbd
|
||||
INNER JOIN `'._DB_PREFIX_.'order_detail` od ON (od.`id_order_detail` = hbd.`id_order_detail`)
|
||||
WHERE hbd.`id_order` = '.(int)$id_order.' AND hbd.`id_product` = '.(int)$id_product;
|
||||
|
||||
if ($id_order_detail) {
|
||||
$sql .= ' AND hbd.`id_order_detail` = '.(int)$id_order_detail;
|
||||
}
|
||||
|
||||
if ($id_customer) {
|
||||
$sql .= ' AND hbd.`id_customer` = '.(int)$id_customer;
|
||||
}
|
||||
|
||||
@@ -68,7 +68,8 @@ class RoomTypeServiceProductOrderDetail extends ObjectModel
|
||||
$getTotalPrice = 0,
|
||||
$useTax = null,
|
||||
$autoAddToCart = 0,
|
||||
$priceAdditionType = null
|
||||
$priceAdditionType = null,
|
||||
$idOrderDetail = 0
|
||||
) {
|
||||
|
||||
if ($useTax === null) {
|
||||
@@ -85,6 +86,10 @@ class RoomTypeServiceProductOrderDetail extends ObjectModel
|
||||
$sql .= ' LEFT JOIN `'._DB_PREFIX_.'order_detail` od ON(od.`id_order_detail` = rsod.`id_order_detail`)';
|
||||
$sql .= ' WHERE rsod.`id_order` = '.(int)$idOrder;
|
||||
|
||||
if ($idOrderDetail) {
|
||||
$sql .= ' AND rsod.`id_order_detail` = '.(int)$idOrderDetail;
|
||||
}
|
||||
|
||||
if (!is_null($autoAddToCart)) {
|
||||
$sql .= ' AND od.`product_auto_add` = '. (int)$autoAddToCart;
|
||||
if ($autoAddToCart == 1 && !is_null($priceAdditionType)) {
|
||||
|
||||
@@ -138,7 +138,7 @@
|
||||
{l s='Due Amount' pdf='true'}
|
||||
</td>
|
||||
<td class="white">
|
||||
{displayPrice currency=$order->id_currency price=($order->total_paid - $order->total_paid_real)}
|
||||
{displayPrice currency=$order->id_currency price=($footer.total_paid_tax_incl - $footer.total_paid_real)}
|
||||
</td>
|
||||
</tr>
|
||||
{/if}
|
||||
|
||||
Reference in New Issue
Block a user