| 1 |
<?php if ( ! defined( 'ABSPATH' ) ) exit; ?> |
| 2 |
<?php |
| 3 |
/** |
| 4 |
* @var \FluentCart\App\Models\Order $order |
| 5 |
* @var $cart_image |
| 6 |
* @var $item_count |
| 7 |
*/ |
| 8 |
?> |
| 9 |
<?php if (isset($heading)): ?> |
| 10 |
<p style="font-size:16px;font-weight:500;color:rgb(44,62,80);line-height:24px;margin: 0 0 16px;"> |
| 11 |
<?php echo esc_html($heading); ?> |
| 12 |
</p> |
| 13 |
<?php endif; ?> |
| 14 |
|
| 15 |
<?php |
| 16 |
|
| 17 |
use FluentCart\Framework\Support\Arr; |
| 18 |
use FluentCart\App\Services\Renderer\Receipt\TaxSummaryHelper; |
| 19 |
$allOrderItems = $order->order_items ? $order->order_items->toArray() : []; |
| 20 |
$orderItems = array_filter($allOrderItems, function ($item) { |
| 21 |
return !in_array($item['payment_type'] ?? '', ['signup_fee', 'fee']); |
| 22 |
}); |
| 23 |
$feeItems = array_filter($allOrderItems, function ($item) { |
| 24 |
return ($item['payment_type'] ?? '') === 'fee'; |
| 25 |
}); |
| 26 |
$transaction = $order->getLatestTransaction(); |
| 27 |
$isRefund = $is_refund ?? false; |
| 28 |
$isReversed = $order->isReverseChargeTaxOrder(); |
| 29 |
$rcMode = $order->getOrderRcMode(); |
| 30 |
|
| 31 |
?> |
| 32 |
|
| 33 |
<table role="presentation" style="border-spacing:0;padding: 0; width: 100%;border: none"> |
| 34 |
<thead> |
| 35 |
<tr> |
| 36 |
<th style="background-color:rgb(249,250,251); padding-left: 16px"> |
| 37 |
<p style="font-size:12px;font-weight:600;color:rgb(55,65,81);text-transform:uppercase;line-height:24px;margin: 0;text-align: left"> |
| 38 |
<?php echo esc_html__('Item', 'fluent-cart'); ?> |
| 39 |
</p> |
| 40 |
</th> |
| 41 |
|
| 42 |
<th style="background-color:rgb(249,250,251); width: 50px"></th> |
| 43 |
|
| 44 |
<th style="background-color:rgb(249,250,251); padding-right: 16px; width: 200px;"> |
| 45 |
<p style="font-size:12px;font-weight:600;color:rgb(55,65,81);text-transform:uppercase;line-height:24px;margin: 0;text-align: right"> |
| 46 |
<?php echo esc_html__('Total', 'fluent-cart'); ?> |
| 47 |
</p> |
| 48 |
</th> |
| 49 |
</tr> |
| 50 |
</thead> |
| 51 |
<tbody style="width:100%"> |
| 52 |
<?php foreach ($orderItems as $item): ?> |
| 53 |
<tr> |
| 54 |
<td style="padding-left: 16px;padding-top: 8px;padding-bottom: 8px;" colspan="2"> |
| 55 |
<p style="font-size: 15px; color: #2F3448; font-weight: 500; overflow: hidden; line-height: 18px; margin-top: 0; margin-bottom: 5px;"> |
| 56 |
|
| 57 |
<?php echo esc_html($item['post_title']); ?> |
| 58 |
<?php if ($item['quantity'] > 1): ?> |
| 59 |
<span style="font-size:12px;font-weight:400;color:rgb(75,85,99)">x <?php echo esc_html($item['quantity']); ?></span> |
| 60 |
<?php endif; ?> |
| 61 |
|
| 62 |
<p style="margin: 0; font-size: 14px; color: #758195; font-weight: 400; line-height: 15px;"> |
| 63 |
- <?php echo esc_html(!empty($item['variation_display_title']) ? $item['variation_display_title'] : $item['title']); ?> |
| 64 |
</p> |
| 65 |
|
| 66 |
<?php if ($item['payment_type'] === 'subscription' && !empty($item['payment_info'])): ?> |
| 67 |
<p style="font-size:12px;color:rgb(75,85,99);line-height:20px;margin: 3px 0 0 0;"> |
| 68 |
<?php echo wp_kses_post($item['payment_info']) ?> |
| 69 |
</p> |
| 70 |
<?php endif; ?> |
| 71 |
|
| 72 |
|
| 73 |
|
| 74 |
<?php |
| 75 |
$otherInfo = is_array($item['other_info'] ?? null) ? $item['other_info'] : []; |
| 76 |
$packageInfo = Arr::get($item, 'package_info', ''); |
| 77 |
if (!$packageInfo && Arr::get($otherInfo, 'package_name')) { |
| 78 |
$packageInfo = \FluentCart\App\Services\Renderer\ProductCardRender::buildPackageInfoFromOtherInfo($otherInfo); |
| 79 |
} |
| 80 |
if ($packageInfo): |
| 81 |
?> |
| 82 |
<p style="font-size:12px;color:rgb(107,114,128);line-height:18px;margin: 5px 0 0 0;"> |
| 83 |
<?php echo esc_html($packageInfo); ?> |
| 84 |
</p> |
| 85 |
<?php endif; ?> |
| 86 |
</p> |
| 87 |
</td> |
| 88 |
<td style="padding-right: 16px;text-align:right"> |
| 89 |
<p style="font-size:14px;font-weight:700;color:rgb(17,24,39);margin:0;line-height:24px;"> |
| 90 |
<?php echo esc_html($item['formatted_total']); ?> |
| 91 |
</p> |
| 92 |
</td> |
| 93 |
</tr> |
| 94 |
|
| 95 |
<?php |
| 96 |
$itemRates = TaxSummaryHelper::getItemTaxRates($item); |
| 97 |
?> |
| 98 |
<?php if (!empty($itemRates)): ?> |
| 99 |
<tr> |
| 100 |
<td colspan="3" style="padding: 0 16px 8px;"> |
| 101 |
<table width="100%" style="border-spacing:0;border-collapse:collapse;"> |
| 102 |
<?php foreach ($itemRates as $rate): |
| 103 |
$pillBg = $rate['inclusive'] ? '#EAF3DE' : '#FAEEDA'; |
| 104 |
$pillColor = $rate['inclusive'] ? '#3B6D11' : '#854F0B'; |
| 105 |
$rateIsInclusive = !empty($rate['inclusive']); |
| 106 |
$reversedAmountStyle = ($isReversed && (!$rateIsInclusive || $rcMode === 'dynamic')) ? 'text-decoration:line-through;opacity:0.6;' : ''; |
| 107 |
?> |
| 108 |
<tr> |
| 109 |
<td style="padding: 2px 0;"> |
| 110 |
<span style="display:inline-block;padding:2px 7px;border-radius:4px;font-size:11px;background:<?php echo esc_attr($pillBg); ?>;color:<?php echo esc_attr($pillColor); ?>;"> |
| 111 |
<?php |
| 112 |
/* translators: %1$s: tax label e.g. "VAT", %2$s: rate percentage e.g. "20" or "7.5" */ |
| 113 |
echo esc_html(sprintf(__('%1$s (%2$s%%)', 'fluent-cart'), $rate['label'], rtrim(rtrim(number_format((float) $rate['rate_percent'], 3, '.', ''), '0'), '.'))); |
| 114 |
?> |
| 115 |
</span> |
| 116 |
</td> |
| 117 |
<td style="text-align:right;padding: 2px 0;"> |
| 118 |
<span style="font-size:11px;font-weight:500;color:<?php echo esc_attr($pillColor); ?>;<?php echo esc_attr($reversedAmountStyle); ?>"> |
| 119 |
<?php if ($rate['inclusive']): ?> |
| 120 |
<?php /* translators: %1$s: formatted tax amount e.g. "$3.92" */ ?> |
| 121 |
<?php echo esc_html(sprintf(__('incl. %1$s', 'fluent-cart'), \FluentCart\App\Helpers\Helper::toDecimal($rate['tax_amount']))); ?> |
| 122 |
<?php else: ?> |
| 123 |
+ <?php echo esc_html(\FluentCart\App\Helpers\Helper::toDecimal($rate['tax_amount'])); ?> |
| 124 |
<?php endif; ?> |
| 125 |
</span> |
| 126 |
</td> |
| 127 |
</tr> |
| 128 |
<?php endforeach; ?> |
| 129 |
</table> |
| 130 |
</td> |
| 131 |
</tr> |
| 132 |
<?php elseif (!empty($item['tax_amount'])): ?> |
| 133 |
<?php |
| 134 |
$itemIsInclusive = TaxSummaryHelper::isPrimaryTaxInclusive($order); |
| 135 |
$reversedAmountStyle = ($isReversed && (!$itemIsInclusive || $rcMode === 'dynamic')) ? 'text-decoration:line-through;opacity:0.6;' : ''; |
| 136 |
$pillBg = $itemIsInclusive ? '#EAF3DE' : '#FAEEDA'; |
| 137 |
$pillColor = $itemIsInclusive ? '#3B6D11' : '#854F0B'; |
| 138 |
$pillLabel = $itemIsInclusive ? esc_html__('Tax (incl.)', 'fluent-cart') : esc_html__('Tax (excl.)', 'fluent-cart'); |
| 139 |
?> |
| 140 |
<tr> |
| 141 |
<td colspan="3" style="padding: 0 16px 8px;"> |
| 142 |
<table width="100%" style="border-spacing:0;border-collapse:collapse;"> |
| 143 |
<tr> |
| 144 |
<td style="padding: 2px 0;"> |
| 145 |
<span style="display:inline-block;padding:2px 7px;border-radius:4px;font-size:11px;background:<?php echo esc_attr($pillBg); ?>;color:<?php echo esc_attr($pillColor); ?>;"> |
| 146 |
<?php echo $pillLabel; ?> |
| 147 |
</span> |
| 148 |
</td> |
| 149 |
<td style="text-align:right;padding: 2px 0;"> |
| 150 |
<span style="font-size:11px;font-weight:500;color:<?php echo esc_attr($pillColor); ?>;<?php echo esc_attr($reversedAmountStyle); ?>"> |
| 151 |
<?php if ($itemIsInclusive): ?> |
| 152 |
<?php /* translators: %1$s: formatted tax amount e.g. "$3.92" */ ?> |
| 153 |
<?php echo esc_html(sprintf(__('incl. %1$s', 'fluent-cart'), \FluentCart\App\Helpers\Helper::toDecimal((int) $item['tax_amount']))); ?> |
| 154 |
<?php else: ?> |
| 155 |
+ <?php echo esc_html(\FluentCart\App\Helpers\Helper::toDecimal((int) $item['tax_amount'])); ?> |
| 156 |
<?php endif; ?> |
| 157 |
</span> |
| 158 |
</td> |
| 159 |
</tr> |
| 160 |
</table> |
| 161 |
</td> |
| 162 |
</tr> |
| 163 |
<?php endif; ?> |
| 164 |
|
| 165 |
<?php if (!empty($item['setup_info'])): ?> |
| 166 |
<tr> |
| 167 |
<td colspan="3" style="padding: 0 16px 2px;"> |
| 168 |
<p style="font-size:12px;color:rgb(75,85,99);line-height:20px;margin: 3px 0 0 0;"> |
| 169 |
<?php echo wp_kses_post($item['setup_info']); ?> |
| 170 |
</p> |
| 171 |
</td> |
| 172 |
</tr> |
| 173 |
<?php endif; ?> |
| 174 |
|
| 175 |
<?php if (($item['payment_type'] ?? '') === 'subscription'): ?> |
| 176 |
<?php |
| 177 |
$sfSibling = null; |
| 178 |
foreach ($allOrderItems as $sfCandidate) { |
| 179 |
if (($sfCandidate['payment_type'] ?? '') !== 'signup_fee') { |
| 180 |
continue; |
| 181 |
} |
| 182 |
$parentId = isset($sfCandidate['line_meta']['parent_item_id']) ? (int) $sfCandidate['line_meta']['parent_item_id'] : 0; |
| 183 |
if ($parentId && $parentId === (int) $item['id']) { |
| 184 |
$sfSibling = $sfCandidate; |
| 185 |
break; |
| 186 |
} |
| 187 |
if (!$parentId && $sfCandidate['object_id'] === $item['object_id']) { |
| 188 |
$sfSibling = $sfCandidate; |
| 189 |
break; |
| 190 |
} |
| 191 |
} |
| 192 |
$sfRates = $sfSibling ? TaxSummaryHelper::getItemTaxRates($sfSibling) : []; |
| 193 |
?> |
| 194 |
<?php if (!empty($sfRates)): ?> |
| 195 |
<tr> |
| 196 |
<td colspan="3" style="padding: 0 16px 8px;"> |
| 197 |
<table width="100%" style="border-spacing:0;border-collapse:collapse;"> |
| 198 |
<?php foreach ($sfRates as $sfRate): |
| 199 |
$sfBg = $sfRate['inclusive'] ? '#EAF3DE' : '#FAEEDA'; |
| 200 |
$sfColor = $sfRate['inclusive'] ? '#3B6D11' : '#854F0B'; |
| 201 |
$sfRateIsInclusive = !empty($sfRate['inclusive']); |
| 202 |
$reversedAmountStyle = ($isReversed && (!$sfRateIsInclusive || $rcMode === 'dynamic')) ? 'text-decoration:line-through;opacity:0.6;' : ''; |
| 203 |
?> |
| 204 |
<tr> |
| 205 |
<td style="padding: 2px 0;"> |
| 206 |
<span style="display:inline-block;padding:2px 7px;border-radius:4px;font-size:11px;background:<?php echo esc_attr($sfBg); ?>;color:<?php echo esc_attr($sfColor); ?>;"> |
| 207 |
<?php |
| 208 |
/* translators: %1$s: tax label e.g. "VAT", %2$s: rate percentage e.g. "20" or "7.5" */ |
| 209 |
echo esc_html(sprintf(__('Setup Fee — %1$s (%2$s%%)', 'fluent-cart'), $sfRate['label'], rtrim(rtrim(number_format((float) $sfRate['rate_percent'], 3, '.', ''), '0'), '.'))); |
| 210 |
?> |
| 211 |
</span> |
| 212 |
</td> |
| 213 |
<td style="text-align:right;padding: 2px 0;"> |
| 214 |
<span style="font-size:11px;font-weight:500;color:<?php echo esc_attr($sfColor); ?>;<?php echo esc_attr($reversedAmountStyle); ?>"> |
| 215 |
<?php if ($sfRate['inclusive']): ?> |
| 216 |
<?php /* translators: %1$s: formatted tax amount e.g. "$3.92" */ ?> |
| 217 |
<?php echo esc_html(sprintf(__('incl. %1$s', 'fluent-cart'), \FluentCart\App\Helpers\Helper::toDecimal($sfRate['tax_amount']))); ?> |
| 218 |
<?php else: ?> |
| 219 |
+ <?php echo esc_html(\FluentCart\App\Helpers\Helper::toDecimal($sfRate['tax_amount'])); ?> |
| 220 |
<?php endif; ?> |
| 221 |
</span> |
| 222 |
</td> |
| 223 |
</tr> |
| 224 |
<?php endforeach; ?> |
| 225 |
</table> |
| 226 |
</td> |
| 227 |
</tr> |
| 228 |
<?php else: ?> |
| 229 |
<?php |
| 230 |
if ($sfSibling) { |
| 231 |
$sfTax = (int) ($sfSibling['tax_amount'] ?? 0); |
| 232 |
} else { |
| 233 |
$sfOtherInfo = is_array($item['other_info'] ?? null) ? $item['other_info'] : []; |
| 234 |
$sfTax = (int) Arr::get($sfOtherInfo, 'signup_fee_tax', 0); |
| 235 |
} |
| 236 |
?> |
| 237 |
<?php if ($sfTax > 0): ?> |
| 238 |
<?php |
| 239 |
$sfIsInclusive = TaxSummaryHelper::isPrimaryTaxInclusive($order); |
| 240 |
$reversedAmountStyle = ($isReversed && (!$sfIsInclusive || $rcMode === 'dynamic')) ? 'text-decoration:line-through;opacity:0.6;' : ''; |
| 241 |
$sfFallbackBg = $sfIsInclusive ? '#EAF3DE' : '#FAEEDA'; |
| 242 |
$sfFallbackColor = $sfIsInclusive ? '#3B6D11' : '#854F0B'; |
| 243 |
?> |
| 244 |
<tr> |
| 245 |
<td colspan="3" style="padding: 0 16px 8px;"> |
| 246 |
<table width="100%" style="border-spacing:0;border-collapse:collapse;"> |
| 247 |
<tr> |
| 248 |
<td style="padding: 2px 0;"> |
| 249 |
<span style="display:inline-block;padding:2px 7px;border-radius:4px;font-size:11px;background:<?php echo esc_attr($sfFallbackBg); ?>;color:<?php echo esc_attr($sfFallbackColor); ?>;"> |
| 250 |
<?php echo esc_html__('Setup Fee Tax', 'fluent-cart'); ?> |
| 251 |
</span> |
| 252 |
</td> |
| 253 |
<td style="text-align:right;padding: 2px 0;"> |
| 254 |
<span style="font-size:11px;font-weight:500;color:<?php echo esc_attr($sfFallbackColor); ?>;<?php echo esc_attr($reversedAmountStyle); ?>"> |
| 255 |
<?php if ($sfIsInclusive): ?> |
| 256 |
<?php /* translators: %1$s: formatted tax amount e.g. "$3.92" */ ?> |
| 257 |
<?php echo esc_html(sprintf(__('incl. %1$s', 'fluent-cart'), \FluentCart\App\Helpers\Helper::toDecimal($sfTax))); ?> |
| 258 |
<?php else: ?> |
| 259 |
+ <?php echo esc_html(\FluentCart\App\Helpers\Helper::toDecimal($sfTax)); ?> |
| 260 |
<?php endif; ?> |
| 261 |
</span> |
| 262 |
</td> |
| 263 |
</tr> |
| 264 |
</table> |
| 265 |
</td> |
| 266 |
</tr> |
| 267 |
<?php endif; ?> |
| 268 |
<?php endif; ?> |
| 269 |
<?php endif; ?> |
| 270 |
<?php endforeach; ?> |
| 271 |
</tbody> |
| 272 |
</table> |
| 273 |
<table style="border-spacing:0;padding: 0; width: 100%;border: none;"> |
| 274 |
<tr> |
| 275 |
<td style="width: 50%;"></td> |
| 276 |
<td style="width: 100%;"> |
| 277 |
<table role="presentation" |
| 278 |
style="background-color:rgb(249,250,251);padding:16px;border-radius:8px;margin: 0; width: 100%;border: none;"> |
| 279 |
<tbody> |
| 280 |
<?php if ($order->subtotal != $order->total_amount): ?> |
| 281 |
<tr style="width:100%"> |
| 282 |
<td style="width:70%"> |
| 283 |
<p style="font-size:14px;color:rgb(55,65,81);line-height:24px;margin: 0;"> |
| 284 |
<?php echo esc_html__('Subtotal', 'fluent-cart'); ?> |
| 285 |
</p> |
| 286 |
</td> |
| 287 |
<td style="width:30%;text-align:right"> |
| 288 |
<p style="font-size:14px;color:rgb(55,65,81);margin:0;line-height:24px;"> |
| 289 |
<?php echo esc_html(\FluentCart\App\Helpers\Helper::toDecimal($order->subtotal)); ?> |
| 290 |
</p> |
| 291 |
</td> |
| 292 |
</tr> |
| 293 |
<?php endif; ?> |
| 294 |
|
| 295 |
<?php |
| 296 |
// Compute summary early so rcShippingAdjustment is available for the shipping row. |
| 297 |
$emailTaxSummaryEarly = ($order instanceof \FluentCart\App\Models\Order) |
| 298 |
? TaxSummaryHelper::computeTaxSummary($order) |
| 299 |
: ['shouldRender' => false, 'rcShippingAdjustment' => 0, 'rcTotalAdjustment' => 0]; |
| 300 |
$emailRcShippingAdj = (int) \FluentCart\Framework\Support\Arr::get($emailTaxSummaryEarly, 'rcShippingAdjustment', 0); |
| 301 |
?> |
| 302 |
<?php if ($order->shipping_total > 0): |
| 303 |
$emailDisplayShipping = max(0, (int) $order->shipping_total - $emailRcShippingAdj); |
| 304 |
?> |
| 305 |
<tr style="width:100%"> |
| 306 |
<td style="width:70%"> |
| 307 |
<p style="font-size:14px;color:rgb(55,65,81);line-height:24px;margin: 0;"> |
| 308 |
<?php echo esc_html__('Shipping', 'fluent-cart'); ?> |
| 309 |
</p> |
| 310 |
</td> |
| 311 |
<td style="width:30%;text-align:right"> |
| 312 |
<p style="font-size:14px;color:rgb(55,65,81);margin:0;line-height:24px;"> |
| 313 |
<?php echo esc_html(\FluentCart\App\Helpers\Helper::toDecimal($emailDisplayShipping)); ?> |
| 314 |
</p> |
| 315 |
</td> |
| 316 |
</tr> |
| 317 |
<?php endif; ?> |
| 318 |
<?php foreach ($feeItems as $feeItem): ?> |
| 319 |
<tr style="width:100%"> |
| 320 |
<td style="width:70%"> |
| 321 |
<p style="font-size:14px;color:rgb(55,65,81);line-height:24px;margin: 0;"> |
| 322 |
<?php echo esc_html($feeItem['title']); ?> |
| 323 |
</p> |
| 324 |
</td> |
| 325 |
<td style="width:30%;text-align:right"> |
| 326 |
<p style="font-size:14px;color:rgb(55,65,81);margin:0;line-height:24px;"> |
| 327 |
<?php echo esc_html(\FluentCart\App\Helpers\Helper::toDecimal($feeItem['subtotal'])); ?> |
| 328 |
</p> |
| 329 |
</td> |
| 330 |
</tr> |
| 331 |
<?php endforeach; ?> |
| 332 |
<?php |
| 333 |
$prorateCredit = (int) \FluentCart\Framework\Support\Arr::get($order->config, 'prorate_credit', 0); |
| 334 |
$upgradeDiscount = $order->manual_discount_total - $prorateCredit; |
| 335 |
// When the prorate credit IS the whole discount, label the row directly |
| 336 |
// instead of showing "Discount" with a single redundant breakdown row. |
| 337 |
$onlyProrateCredit = $prorateCredit > 0 && $upgradeDiscount <= 0 && $order->coupon_discount_total <= 0; |
| 338 |
?> |
| 339 |
<?php if ($order->manual_discount_total + $order->coupon_discount_total > 0): ?> |
| 340 |
<tr style="width:100%"> |
| 341 |
<td style="width:70%"> |
| 342 |
<p style="font-size:14px;color:rgb(55,65,81);line-height:24px;margin: 0;"> |
| 343 |
<?php echo $onlyProrateCredit ? esc_html__('Prorate Credit', 'fluent-cart') : esc_html__('Discount', 'fluent-cart'); ?> |
| 344 |
</p> |
| 345 |
</td> |
| 346 |
<td style="width:30%;text-align:right"> |
| 347 |
<p style="font-size:14px;color:rgb(55,65,81);line-height:24px;margin: 0;"> |
| 348 |
- <?php echo esc_html(\FluentCart\App\Helpers\Helper::toDecimal($order->manual_discount_total + $order->coupon_discount_total)); ?> |
| 349 |
</p> |
| 350 |
</td> |
| 351 |
</tr> |
| 352 |
<?php if ($prorateCredit > 0 && $upgradeDiscount > 0): ?> |
| 353 |
<tr style="width:100%"> |
| 354 |
<td style="width:70%;padding-left:12px;"> |
| 355 |
<p style="font-size:12px;color:rgb(107,114,128);line-height:20px;margin: 0;"> |
| 356 |
<?php echo esc_html__('Upgrade Discount', 'fluent-cart'); ?> |
| 357 |
</p> |
| 358 |
</td> |
| 359 |
<td style="width:30%;text-align:right"> |
| 360 |
<p style="font-size:12px;color:rgb(107,114,128);margin:0;line-height:20px;"> |
| 361 |
<?php echo esc_html(\FluentCart\App\Helpers\Helper::toDecimal($upgradeDiscount)); ?> |
| 362 |
</p> |
| 363 |
</td> |
| 364 |
</tr> |
| 365 |
<?php endif; ?> |
| 366 |
<?php if ($prorateCredit > 0 && !$onlyProrateCredit): ?> |
| 367 |
<tr style="width:100%"> |
| 368 |
<td style="width:70%;padding-left:12px;"> |
| 369 |
<p style="font-size:12px;color:rgb(107,114,128);line-height:20px;margin: 0;"> |
| 370 |
<?php echo esc_html__('Prorate Credit', 'fluent-cart'); ?> |
| 371 |
</p> |
| 372 |
</td> |
| 373 |
<td style="width:30%;text-align:right"> |
| 374 |
<p style="font-size:12px;color:rgb(107,114,128);margin:0;line-height:20px;"> |
| 375 |
<?php echo esc_html(\FluentCart\App\Helpers\Helper::toDecimal($prorateCredit)); ?> |
| 376 |
</p> |
| 377 |
</td> |
| 378 |
</tr> |
| 379 |
<?php endif; ?> |
| 380 |
<?php endif; ?> |
| 381 |
|
| 382 |
<?php |
| 383 |
$emailTaxSummary = isset($emailTaxSummaryEarly) ? $emailTaxSummaryEarly : (($order instanceof \FluentCart\App\Models\Order) |
| 384 |
? TaxSummaryHelper::computeTaxSummary($order) |
| 385 |
: ['shouldRender' => false]); |
| 386 |
if ($emailTaxSummary['shouldRender']): |
| 387 |
?> |
| 388 |
<tr style="width:100%"> |
| 389 |
<td colspan="2" style="padding:12px 0 4px;"> |
| 390 |
<p style="font-size:10px; font-weight:600; text-transform:uppercase; |
| 391 |
letter-spacing:0.06em; color:#94a3b8; margin:0;"> |
| 392 |
<?php echo esc_html__('TAX', 'fluent-cart'); ?> |
| 393 |
</p> |
| 394 |
</td> |
| 395 |
</tr> |
| 396 |
<?php if ($emailTaxSummary['isReverseCharge']): ?> |
| 397 |
<?php |
| 398 |
$rcReversedTotal = (int) Arr::get($emailTaxSummary, 'reversedTaxTotal', 0); |
| 399 |
$rcReversedShipping = (int) Arr::get($emailTaxSummary, 'reversedShippingTax', 0); |
| 400 |
$rcReversedValue = $rcReversedTotal > 0 |
| 401 |
? \FluentCart\App\Helpers\Helper::toDecimal($rcReversedTotal) |
| 402 |
: __('Charge reversed', 'fluent-cart'); |
| 403 |
?> |
| 404 |
<?php if ($emailTaxSummary['showRcShippingRow'] && $rcReversedShipping > 0): ?> |
| 405 |
<tr style="width:100%"> |
| 406 |
<td style="width:70%"> |
| 407 |
<p style="font-size:14px; color:#94a3b8; line-height:24px; margin:0;"> |
| 408 |
<?php echo esc_html__('Added on shipping', 'fluent-cart'); ?> |
| 409 |
</p> |
| 410 |
</td> |
| 411 |
<td style="width:30%; text-align:right"> |
| 412 |
<p style="font-size:14px; color:#94a3b8; margin:0; line-height:24px;"> |
| 413 |
<span style="text-decoration:line-through;opacity:0.6;"><?php echo esc_html(\FluentCart\App\Helpers\Helper::toDecimal($rcReversedShipping)); ?></span> |
| 414 |
</p> |
| 415 |
</td> |
| 416 |
</tr> |
| 417 |
<?php endif; ?> |
| 418 |
<tr style="width:100%"> |
| 419 |
<td style="width:70%"> |
| 420 |
<p style="font-size:14px; font-weight:700; color:#1e293b; line-height:24px; margin:0;"> |
| 421 |
<?php echo esc_html__('Tax reversed', 'fluent-cart'); ?> |
| 422 |
</p> |
| 423 |
</td> |
| 424 |
<td style="width:30%; text-align:right"> |
| 425 |
<p style="font-size:14px; font-weight:700; color:#1e293b; margin:0; line-height:24px;"> |
| 426 |
<?php echo esc_html($rcReversedValue); ?> |
| 427 |
</p> |
| 428 |
</td> |
| 429 |
</tr> |
| 430 |
<?php else: ?> |
| 431 |
<?php |
| 432 |
$emailFeeRowsList = Arr::get($emailTaxSummary, 'feeTaxLineRows', []); |
| 433 |
$rowCount = (int) ($emailTaxSummary['inclusiveTax'] > 0) + (int) ($emailTaxSummary['exclusiveTax'] > 0) + count($emailFeeRowsList) + (int) ($emailTaxSummary['shippingTax'] > 0); |
| 434 |
$shouldShowBreakdown = $rowCount >= 2 || ($rowCount === 1 && !($emailTaxSummary['payableTax'] > 0 || $emailTaxSummary['inclusiveTax'] > 0 || (int) Arr::get($emailTaxSummary, 'inclusiveFeeTax', 0) > 0)); |
| 435 |
?> |
| 436 |
<?php if ($emailTaxSummary['inclusiveTax'] > 0 && $shouldShowBreakdown): ?> |
| 437 |
<tr style="width:100%"> |
| 438 |
<td style="width:70%"> |
| 439 |
<p style="font-size:14px; color:#94a3b8; line-height:24px; margin:0;"> |
| 440 |
<?php echo esc_html__('Included in item prices', 'fluent-cart'); ?> |
| 441 |
</p> |
| 442 |
</td> |
| 443 |
<td style="width:30%; text-align:right"> |
| 444 |
<p style="font-size:14px; color:#94a3b8; margin:0; line-height:24px;"> |
| 445 |
<?php echo esc_html(\FluentCart\App\Helpers\Helper::toDecimal($emailTaxSummary['inclusiveTax'])); ?> |
| 446 |
</p> |
| 447 |
</td> |
| 448 |
</tr> |
| 449 |
<?php endif; ?> |
| 450 |
<?php if ($emailTaxSummary['exclusiveTax'] > 0 && $shouldShowBreakdown): ?> |
| 451 |
<tr style="width:100%"> |
| 452 |
<td style="width:70%"> |
| 453 |
<p style="font-size:14px; font-weight:600; color:#1e293b; line-height:24px; margin:0;"> |
| 454 |
<?php echo esc_html__('Added on products', 'fluent-cart'); ?> |
| 455 |
</p> |
| 456 |
</td> |
| 457 |
<td style="width:30%; text-align:right"> |
| 458 |
<p style="font-size:14px; font-weight:600; color:#1e293b; margin:0; line-height:24px;"> |
| 459 |
<?php echo esc_html(\FluentCart\App\Helpers\Helper::toDecimal($emailTaxSummary['exclusiveTax'])); ?> |
| 460 |
</p> |
| 461 |
</td> |
| 462 |
</tr> |
| 463 |
<?php endif; ?> |
| 464 |
<?php if ($shouldShowBreakdown) : ?> |
| 465 |
<?php foreach ($emailFeeRowsList as $emailFeeRow): |
| 466 |
$emailFeeColor = $emailFeeRow['inclusive'] ? '#94a3b8' : '#1e293b'; |
| 467 |
$emailFeeWeight = $emailFeeRow['inclusive'] ? 'normal' : '600'; ?> |
| 468 |
<tr style="width:100%"> |
| 469 |
<td style="width:70%"> |
| 470 |
<p style="font-size:14px; font-weight:<?php echo esc_attr($emailFeeWeight); ?>; color:<?php echo esc_attr($emailFeeColor); ?>; line-height:24px; margin:0;"> |
| 471 |
<?php echo esc_html($emailFeeRow['display_label']); ?> |
| 472 |
</p> |
| 473 |
</td> |
| 474 |
<td style="width:30%; text-align:right"> |
| 475 |
<p style="font-size:14px; font-weight:<?php echo esc_attr($emailFeeWeight); ?>; color:<?php echo esc_attr($emailFeeColor); ?>; margin:0; line-height:24px;"> |
| 476 |
<?php echo esc_html(\FluentCart\App\Helpers\Helper::toDecimal($emailFeeRow['tax_amount'])); ?> |
| 477 |
</p> |
| 478 |
</td> |
| 479 |
</tr> |
| 480 |
<?php endforeach; ?> |
| 481 |
<?php endif; ?> |
| 482 |
<?php if ($emailTaxSummary['shippingTax'] > 0 && $shouldShowBreakdown): |
| 483 |
$isShippingInclusive = (bool) Arr::get($emailTaxSummary, 'isShippingInclusive', false); |
| 484 |
$emailShippingLines = Arr::get($emailTaxSummary, 'shippingTaxLines', []); |
| 485 |
$emailShippingColor = $isShippingInclusive ? '#94a3b8' : '#1e293b'; |
| 486 |
$emailShippingWeight = $isShippingInclusive ? 'normal' : '600'; |
| 487 |
if (!empty($emailShippingLines)): |
| 488 |
foreach ($emailShippingLines as $shLine): ?> |
| 489 |
<tr style="width:100%"> |
| 490 |
<td style="width:70%"> |
| 491 |
<p style="font-size:14px; font-weight:<?php echo esc_attr($emailShippingWeight); ?>; color:<?php echo esc_attr($emailShippingColor); ?>; line-height:24px; margin:0;"> |
| 492 |
<?php echo esc_html($shLine['label']); ?> |
| 493 |
</p> |
| 494 |
</td> |
| 495 |
<td style="width:30%; text-align:right"> |
| 496 |
<p style="font-size:14px; font-weight:<?php echo esc_attr($emailShippingWeight); ?>; color:<?php echo esc_attr($emailShippingColor); ?>; margin:0; line-height:24px;"> |
| 497 |
<?php echo esc_html(\FluentCart\App\Helpers\Helper::toDecimal($shLine['shipping_tax'])); ?> |
| 498 |
</p> |
| 499 |
</td> |
| 500 |
</tr> |
| 501 |
<?php endforeach; |
| 502 |
else: ?> |
| 503 |
<tr style="width:100%"> |
| 504 |
<td style="width:70%"> |
| 505 |
<p style="font-size:14px; font-weight:<?php echo esc_attr($emailShippingWeight); ?>; color:<?php echo esc_attr($emailShippingColor); ?>; line-height:24px; margin:0;"> |
| 506 |
<?php echo esc_html($isShippingInclusive ? __('Included in shipping prices', 'fluent-cart') : __('Added on shipping', 'fluent-cart')); ?> |
| 507 |
</p> |
| 508 |
</td> |
| 509 |
<td style="width:30%; text-align:right"> |
| 510 |
<p style="font-size:14px; font-weight:<?php echo esc_attr($emailShippingWeight); ?>; color:<?php echo esc_attr($emailShippingColor); ?>; margin:0; line-height:24px;"> |
| 511 |
<?php echo esc_html(\FluentCart\App\Helpers\Helper::toDecimal($emailTaxSummary['shippingTax'])); ?> |
| 512 |
</p> |
| 513 |
</td> |
| 514 |
</tr> |
| 515 |
<?php endif; ?> |
| 516 |
<?php endif; ?> |
| 517 |
<?php if ($emailTaxSummary['payableTax'] > 0): ?> |
| 518 |
<tr style="width:100%"> |
| 519 |
<td style="width:70%"> |
| 520 |
<p style="font-size:14px; font-weight:700; color:#1e293b; line-height:24px; margin:0; border-top:1px solid #e2e8f0; padding-top:4px;"> |
| 521 |
<?php echo esc_html__('Total payable tax', 'fluent-cart'); ?> |
| 522 |
</p> |
| 523 |
</td> |
| 524 |
<td style="width:30%; text-align:right"> |
| 525 |
<p style="font-size:14px; font-weight:700; color:#1e293b; margin:0; line-height:24px; border-top:1px solid #e2e8f0; padding-top:4px;"> |
| 526 |
<?php echo esc_html(\FluentCart\App\Helpers\Helper::toDecimal($emailTaxSummary['payableTax'])); ?> |
| 527 |
</p> |
| 528 |
</td> |
| 529 |
</tr> |
| 530 |
<?php endif; ?> |
| 531 |
<?php if ($emailTaxSummary['inclusiveTax'] > 0 || $emailTaxSummary['inclusiveFeeTax'] > 0): ?> |
| 532 |
<tr style="width:100%"> |
| 533 |
<td style="width:70%"> |
| 534 |
<p style="font-size:14px; font-weight:normal; color:#94a3b8; line-height:24px; margin:0;"> |
| 535 |
<?php echo esc_html__('Total tax in this order', 'fluent-cart'); ?> |
| 536 |
</p> |
| 537 |
</td> |
| 538 |
<td style="width:30%; text-align:right"> |
| 539 |
<p style="font-size:14px; font-weight:normal; color:#94a3b8; margin:0; line-height:24px;"> |
| 540 |
<?php echo esc_html(\FluentCart\App\Helpers\Helper::toDecimal($emailTaxSummary['totalOrderTax'])); ?> |
| 541 |
</p> |
| 542 |
</td> |
| 543 |
</tr> |
| 544 |
<?php endif; ?> |
| 545 |
<?php endif; ?> |
| 546 |
<?php endif; ?> |
| 547 |
|
| 548 |
<?php if ($order->total_refund > 0 && $isRefund): ?> |
| 549 |
<tr style="width:100%"> |
| 550 |
<td style="width:70%"> |
| 551 |
<p style="font-size:14px;color:rgb(55,65,81);line-height:24px;margin: 0;"> |
| 552 |
<?php echo esc_html__('Refund', 'fluent-cart'); ?> |
| 553 |
</p> |
| 554 |
</td> |
| 555 |
<td style="width:30%;text-align:right"> |
| 556 |
<p style="font-size:14px;color:rgb(55,65,81);margin:0;line-height:24px;"> |
| 557 |
- <?php echo esc_html(\FluentCart\App\Helpers\Helper::toDecimal($order->total_refund)); ?> |
| 558 |
</p> |
| 559 |
</td> |
| 560 |
</tr> |
| 561 |
<?php endif; ?> |
| 562 |
|
| 563 |
<?php |
| 564 |
$emailDisplayTotal = max(0, (int) $order->total_amount - (int) $order->total_refund |
| 565 |
- (int) \FluentCart\Framework\Support\Arr::get($emailTaxSummaryEarly ?? [], 'rcTotalAdjustment', 0)); |
| 566 |
?> |
| 567 |
<tr style="width:100%"> |
| 568 |
<td style="width:70%"><p |
| 569 |
style="font-size:16px;font-weight:700;color:rgb(17,24,39);line-height:24px;margin: 0;"> |
| 570 |
<?php echo esc_html__('Total', 'fluent-cart'); ?> |
| 571 |
</p> |
| 572 |
</td> |
| 573 |
<td style="width:30%;text-align:right"> |
| 574 |
<p style="font-size:14px;font-weight:700;color:rgb(17,24,39);line-height:24px;margin: 0;"> |
| 575 |
<?php echo esc_html(\FluentCart\Api\CurrencySettings::getFormattedPrice($emailDisplayTotal, null, false, true, true)); ?> |
| 576 |
</p> |
| 577 |
</td> |
| 578 |
</tr> |
| 579 |
|
| 580 |
<?php if ($order->total_refund > 0 && !$isRefund): ?> |
| 581 |
<tr style="width:100%"> |
| 582 |
<td style="width:70%"> |
| 583 |
<p style="font-size:14px;color:rgb(55,65,81);line-height:24px;margin: 0;"> |
| 584 |
<?php echo esc_html__('Refund', 'fluent-cart'); ?> |
| 585 |
</p> |
| 586 |
</td> |
| 587 |
<td style="width:30%;text-align:right"> |
| 588 |
<p style="font-size:14px;color:rgb(55,65,81);margin:0;line-height:24px;"> |
| 589 |
- <?php echo esc_html(\FluentCart\App\Helpers\Helper::toDecimal($order->total_refund)); ?> |
| 590 |
</p> |
| 591 |
</td> |
| 592 |
</tr> |
| 593 |
<?php endif; ?> |
| 594 |
|
| 595 |
<tr style="width:100%"> |
| 596 |
<td style="width:70%"> |
| 597 |
<p style="font-size:14px;color:rgb(55,65,81);line-height:24px;margin: 0;"> |
| 598 |
<?php echo esc_html__('Payment Method', 'fluent-cart'); ?> |
| 599 |
</p> |
| 600 |
</td> |
| 601 |
<td style="width:30%;text-align:right"> |
| 602 |
<p style="text-transform:uppercase;font-size:13px;color:rgb(55,65,81);margin:0;line-height:24px;"> |
| 603 |
<?php echo esc_html($transaction ? $transaction->getPaymentMethodText() : ''); ?> |
| 604 |
</p> |
| 605 |
</td> |
| 606 |
</tr> |
| 607 |
</tbody> |
| 608 |
</table> |
| 609 |
<?php |
| 610 |
if($order->isReverseChargeTaxOrder()): ?> |
| 611 |
<div style="text-align: right; font-size: 14px; margin-top: 10px;"> |
| 612 |
<?php echo '*' . esc_html__('Tax to be paid on reverse charge basis', 'fluent-cart'); ?> |
| 613 |
</div> |
| 614 |
|
| 615 |
<?php endif ?> |
| 616 |
</td> |
| 617 |
</tr> |
| 618 |
</table> |
| 619 |
|
| 620 |
|