config = $config;
$this->is_first_time = Arr::get($this->config, 'is_first_time', false);
$this->order_operation = Arr::get($this->config, 'order_operation', false);
$this->settings = new StoreSettings();
$this->orderTz = Arr::get($this->config, 'user_tz', 'UTC');
}
private function getMemoizedTaxSummary($order)
{
if (!$order) {
return TaxSummaryHelper::computeTaxSummary($order);
}
$id = (int) $order->id;
if (!isset($this->fctTaxSummaryCache[$id])) {
$this->fctTaxSummaryCache[$id] = TaxSummaryHelper::computeTaxSummary($order);
}
return $this->fctTaxSummaryCache[$id];
}
public function wrapperStart()
{
?>
config, 'order', null);
if (!$order) {
return;
}
$this->vat_tax_id = $order->getCustomerTaxNumber();
$profilePage = $this->settings->getCustomerProfilePage();
$orderTaxRates = $order->getPrimaryOrderTaxRate();
?>
wrapperStart();
} ?>
renderHeader(); ?>
renderAddresses(); ?>
renderOrderItems(); ?>
renderTaxNote(); ?>
renderPaymentHistory(); ?>
wrapperEnd();
} ?>
is_first_time) {
do_action('fluent_cart/order/receipt_viewed', [
'order' => $order,
'order_operation' => $this->order_operation
]);
} ?>
config, 'order', null);
?>
settings->get('store_logo.url');
$storeName = $this->settings->get('store_name');
if (empty($imageLink)) {
echo esc_html($storeName);
} else {
echo "
";
}
?>
config, 'order', null);
$orderTaxRates = $order->getPrimaryOrderTaxRate();
$storeVatNumber = Arr::get($orderTaxRates->meta ?? [], 'store_vat_number', '');
$taxcountry = Arr::get($orderTaxRates->meta ?? [], 'tax_country', '');
if (!empty($storeVatNumber)): ?>
:
config, 'order', null);
?>
created_at)->getTimestamp(),
new \DateTimeZone($this->orderTz)
);
echo esc_html(Helper::translateNumber($date));
?>
config, 'order', null);
?>
invoice_no); ?>
config, 'order', null);
?>
fulfillment_type === 'physical') : ?>
renderStoreAddress(); ?>
fulfillment_type === 'digital') : ?>
renderStoreAddress(true); ?>
renderBillToAddress(); ?>
fulfillment_type === 'physical') : ?>
renderShipToAddress(); ?>
config, 'order', null);
?>
settings->get('store_name')); ?>
settings->get('store_name')); ?>
settings->getFormattedFullAddress()); ?>
getPrimaryOrderTaxRate();
$storeVatNumber = Arr::get($orderTaxRates->meta ?? [], 'store_vat_number', '');
$taxCountry = Arr::get($orderTaxRates->meta ?? [], 'tax_country', '');
if (!empty($storeVatNumber)): ?>
config, 'order', null);
$orderTaxRates = $order->getPrimaryOrderTaxRate();
?>
billing_address)) : ?>
billing_address->getAddressAsText()); ?>
customer->email); ?>
billing_address->meta ?? [], 'other_data.phone', '');
if ($phoneNumber !== ''):
?>
billing_address->meta ?? [], 'other_data.company_name', '');
if ($companyName === '') {
$companyName = $order->getCustomerTaxName();
}
if ($companyName !== ''):
?>
billing_address->meta ?? [], 'other_data.legal_registration_id', '');
if ($legalRegId === '') {
$legalRegId = Arr::get($order->getBusinessInfo(), 'legal_registration_id', '');
}
if ($legalRegId !== ''):
?>
getCustomerTaxNumber();
if ($vatNumber !== '') {
$vatLabel = __('VAT/Tax ID', 'fluent-cart');
echo esc_html($vatLabel) . ': ' . esc_html($vatNumber);
}
?>
getBusinessInfo(), 'reverse_charge_declaration', '');
if ($reverseChargeDeclaration !== ''):
?>
:
customer->full_name); ?>
customer->email); ?>
config, 'order', null);
?>
shipping_address)) : ?>
shipping_address->getAddressAsText()); ?>
shipping_address->meta ?? [], 'other_data.phone', '');
if ($phone !== ''):
?>
customer->full_name); ?>
customer->email); ?>
config, 'order', null);
if ($order->order_items) : ?>
renderOrderItemsTable(); ?>
renderOrderItemsFooter(); ?>
config, 'order', null);
if ($order->order_items) : ?>
|
|
|
|
|
order_items->toArray();
$isReversed = $order->isReverseChargeTaxOrder();
$rcMode = $order->getOrderRcMode();
$fctReceiptTaxDisplayMode = TaxSummaryHelper::getTaxDisplayMode();
foreach ($orderItems as $item) :
if (($item['payment_type'] ?? '') === 'fee') {
continue;
}
$itemRates = TaxSummaryHelper::getItemTaxRates($item);
$itemBorder = empty($itemRates) ? '1px solid #dee2e6' : 'none';
?>
-
|
|
|
0): ?>
|
|
renderTaxRatePills($itemRates, $isReversed, $rcMode); ?>
|
config, 'order', null);
?>
config, 'order', null);
if ($order->subtotal != ($order->total_amount - $order->total_refund) || $order->tax_total > 0): ?>
|
|
subtotal));
?>
|
config, 'order', null);
$prorateCredit = (int) \FluentCart\Framework\Support\Arr::get($order->config, 'prorate_credit', 0);
$upgradeDiscount = $order->manual_discount_total - $prorateCredit;
// When the prorate credit IS the whole discount, label the row directly
// instead of showing "Discount" with a single redundant breakdown row.
$onlyProrateCredit = $prorateCredit > 0 && $upgradeDiscount <= 0 && $order->coupon_discount_total <= 0;
if ($order->manual_discount_total + $order->coupon_discount_total > 0): ?>
|
|
- manual_discount_total + $order->coupon_discount_total)); ?>
|
0 && $upgradeDiscount > 0): ?>
|
|
|
0 && !$onlyProrateCredit): ?>
|
|
|
config, 'order', null);
if ($order->shipping_total <= 0) {
return;
}
$displayShipping = (int) $order->shipping_total;
if ($order->isReverseChargeTaxOrder()) {
$rcAdj = (int) Arr::get($this->getMemoizedTaxSummary($order), 'rcShippingAdjustment', 0);
if ($rcAdj > 0) {
$displayShipping = max(0, $displayShipping - $rcAdj);
}
}
$shippingMethodTitle = (string) Arr::get($order->config, 'shipping_method_title', '');
?>
|
|
|
config, 'order', null);
if (!$order || $order->fee_total <= 0) {
return;
}
$feeItems = $order->feeItems()->get();
foreach ($feeItems as $feeItem): ?>
|
title); ?>
|
subtotal)); ?>
|
config, 'order', null);
if ($order->total_refund > 0): ?>
|
|
- total_refund)); ?>
|
config, 'order', null);
$displayTotal = (int) $order->total_amount - (int) $order->total_refund;
if ($order->isReverseChargeTaxOrder()) {
$rcAdj = (int) Arr::get($this->getMemoizedTaxSummary($order), 'rcTotalAdjustment', 0);
if ($rcAdj > 0) {
$displayTotal = max(0, $displayTotal - $rcAdj);
}
}
?>
|
|
|
config, 'order', null);
?>
|
|
total_paid - $order->total_refund), null, false, true, true)); ?>
|
config, 'order', null);
if ($order->isReverseChargeTaxOrder()): ?>
config, 'order', null);
$transactions = $order->transactions;
if (!empty($transactions)) :
?>
|
|
|
|
transaction_type === 'refund') {
continue;
}
?>
|
getPaymentMethodText()); ?>
|
created_at)->getTimestamp(),
new \DateTimeZone($this->orderTz)
);
echo esc_html(Helper::translateNumber($date));
?>
|
total, null, false, true, true)); ?>
|
';
$html .= '';
$html .= '| ';
$html .= '' . esc_html($rate['label']) . ' (' . esc_html(number_format((float) $rate['rate_percent'], 0)) . '%)';
$html .= ' | ';
$html .= '';
$html .= '' . $amountDisplay . '';
$html .= ' | ';
$html .= '
';
$html .= '';
}
return $html;
}
public function renderTaxSummaryBox()
{
$order = Arr::get($this->config, 'order', null);
$summary = $this->getMemoizedTaxSummary($order);
if (!$summary['shouldRender']) {
return;
}
?>
|
|
|
|
|
0
? Helper::toDecimal($rcReversedTotal)
: __('Charge reversed', 'fluent-cart');
$includedInPrices = (int) Arr::get($summary, 'includedInPrices', 0);
?>
|
|
|
|
|
|
|
|
0): ?>
|
|
|
0 && $includedInPrices > 0): ?>
|
|
|
0): ?>
|
|
|
|
|
|
0) + (int) ($summary['exclusiveTax'] > 0);
$rowCount = $productTaxRowCount + count($rcFeeRows) + (int) ($summary['shippingTax'] > 0);
$shippingTaxLines = Arr::get($summary, 'shippingTaxLines', []);
$shouldShowBreakdown = !empty($taxRateLines)
|| !empty($shippingTaxLines)
|| $rowCount >= 2
|| ($rowCount === 1 && !($summary['payableTax'] > 0 || $summary['inclusiveTax'] > 0 || (int) Arr::get($summary, 'inclusiveFeeTax', 0) > 0));
?>
|
|
|
0 && $shouldShowBreakdown): ?>
|
|
|
0 && $shouldShowBreakdown): ?>
|
|
|
|
|
|
0 && $shouldShowBreakdown):
$isShippingInclusive = (bool) Arr::get($summary, 'isShippingInclusive', false);
$shippingRowColor = $isShippingInclusive ? '#94a3b8' : '#334155';
if (!empty($shippingTaxLines)):
foreach ($shippingTaxLines as $shLine): ?>
|
|
|
|
|
|
0): ?>
|
|
|
0 || $summary['inclusiveFeeTax'] > 0): ?>
|
|
|
|
|