| @@ -14,8 +14,10 @@ | ||
| 14 | 14 | |
| 15 | 15 | <?php |
| 16 | 16 | |
| 17 | 17 | use FluentCart\Framework\Support\Arr; |
| 18 | +use FluentCart\App\Modules\Tax\TaxModule; | |
| 19 | +use FluentCart\App\Services\Renderer\Receipt\TaxSummaryHelper; | |
| 18 | 20 | $allOrderItems = $order->order_items ? $order->order_items->toArray() : []; |
| 19 | 21 | $orderItems = array_filter($allOrderItems, function ($item) { |
| 20 | 22 | return !in_array($item['payment_type'] ?? '', ['signup_fee', 'fee']); |
| 21 | 23 | }); |
| @@ -23,8 +25,12 @@ | ||
| 23 | 25 | return ($item['payment_type'] ?? '') === 'fee'; |
| 24 | 26 | }); |
| 25 | 27 | $transaction = $order->getLatestTransaction(); |
| 26 | 28 | $isRefund = $is_refund ?? false; |
| 29 | + $isReversed = $order->isReverseChargeTaxOrder(); | |
| 30 | + $rcMode = $order->getOrderRcMode(); | |
| 31 | + $fctEmailDisplayMode = ($order instanceof \FluentCart\App\Models\Order) ? TaxSummaryHelper::getTaxDisplayMode() : 'itemized'; | |
| 32 | + | |
| 27 | 33 | ?> |
| 28 | 34 | |
| 29 | 35 | <table role="presentation" style="border-spacing:0;padding: 0; width: 100%;border: none"> |
| 30 | 36 | <thead> |
| @@ -55,9 +61,9 @@ | ||
| 55 | 61 | <span style="font-size:12px;font-weight:400;color:rgb(75,85,99)">x <?php echo esc_html($item['quantity']); ?></span> |
| 56 | 62 | <?php endif; ?> |
| 57 | 63 | |
| 58 | 64 | <p style="margin: 0; font-size: 14px; color: #758195; font-weight: 400; line-height: 15px;"> |
| 59 | - - <?php echo esc_html($item['title']); ?> | |
| 65 | + - <?php echo esc_html(!empty($item['variation_display_title']) ? $item['variation_display_title'] : $item['title']); ?> | |
| 60 | 66 | </p> |
| 61 | 67 | |
| 62 | 68 | <?php if ($item['payment_type'] === 'subscription' && !empty($item['payment_info'])): ?> |
| 63 | 69 | <p style="font-size:12px;color:rgb(75,85,99);line-height:20px;margin: 3px 0 0 0;"> |
| @@ -63,8 +69,23 @@ | ||
| 63 | 69 | <p style="font-size:12px;color:rgb(75,85,99);line-height:20px;margin: 3px 0 0 0;"> |
| 64 | 70 | <?php echo wp_kses_post($item['payment_info']) ?> |
| 65 | 71 | </p> |
| 66 | 72 | <?php endif; ?> |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + <?php | |
| 77 | + $otherInfo = is_array($item['other_info'] ?? null) ? $item['other_info'] : []; | |
| 78 | + $packageInfo = Arr::get($item, 'package_info', ''); | |
| 79 | + if (!$packageInfo && Arr::get($otherInfo, 'package_name')) { | |
| 80 | + $packageInfo = \FluentCart\App\Services\Renderer\PackageDescriptionRenderer::buildPackageInfoFromOtherInfo($otherInfo); | |
| 81 | + } | |
| 82 | + if ($packageInfo): | |
| 83 | + ?> | |
| 84 | + <p style="font-size:12px;color:rgb(107,114,128);line-height:18px;margin: 5px 0 0 0;"> | |
| 85 | + <?php echo esc_html($packageInfo); ?> | |
| 86 | + </p> | |
| 87 | + <?php endif; ?> | |
| 67 | 88 | </p> |
| 68 | 89 | </td> |
| 69 | 90 | <td style="padding-right: 16px;text-align:right"> |
| 70 | 91 | <p style="font-size:14px;font-weight:700;color:rgb(17,24,39);margin:0;line-height:24px;"> |
| @@ -71,18 +92,198 @@ | ||
| 71 | 92 | <?php echo esc_html($item['formatted_total']); ?> |
| 72 | 93 | </p> |
| 73 | 94 | </td> |
| 74 | 95 | </tr> |
| 96 | + | |
| 97 | + <?php | |
| 98 | + $itemRates = TaxSummaryHelper::getItemTaxRates($item); | |
| 99 | + ?> | |
| 100 | + <?php if ($fctEmailDisplayMode !== 'simplified' && !empty($itemRates)): ?> | |
| 101 | + <tr> | |
| 102 | + <td colspan="3" style="padding: 0 16px 8px;"> | |
| 103 | + <table width="100%" style="border-spacing:0;border-collapse:collapse;"> | |
| 104 | + <?php foreach ($itemRates as $rate): | |
| 105 | + $pillBg = $rate['inclusive'] ? '#EAF3DE' : '#FAEEDA'; | |
| 106 | + $pillColor = $rate['inclusive'] ? '#3B6D11' : '#854F0B'; | |
| 107 | + $rateIsInclusive = !empty($rate['inclusive']); | |
| 108 | + $reversedAmountStyle = ($isReversed && (!$rateIsInclusive || $rcMode === 'dynamic')) ? 'text-decoration:line-through;opacity:0.6;' : ''; | |
| 109 | + ?> | |
| 110 | + <tr> | |
| 111 | + <td style="padding: 2px 0;"> | |
| 112 | + <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); ?>;"> | |
| 113 | + <?php | |
| 114 | + /* translators: %1$s: tax label e.g. "VAT", %2$s: rate percentage e.g. "20" or "7.5" */ | |
| 115 | + echo esc_html(sprintf(__('%1$s (%2$s%%)', 'fluent-cart'), $rate['label'], rtrim(rtrim(number_format((float) $rate['rate_percent'], 3, '.', ''), '0'), '.'))); | |
| 116 | + ?> | |
| 117 | + </span> | |
| 118 | + </td> | |
| 119 | + <td style="text-align:right;padding: 2px 0;"> | |
| 120 | + <span style="font-size:11px;font-weight:500;color:<?php echo esc_attr($pillColor); ?>;<?php echo esc_attr($reversedAmountStyle); ?>"> | |
| 121 | + <?php if ($rate['inclusive']): ?> | |
| 122 | + <?php /* translators: %1$s: formatted tax amount e.g. "$3.92" */ ?> | |
| 123 | + <?php echo esc_html(sprintf(__('incl. %1$s', 'fluent-cart'), \FluentCart\App\Helpers\Helper::toDecimal($rate['tax_amount']))); ?> | |
| 124 | + <?php else: ?> | |
| 125 | + + <?php echo esc_html(\FluentCart\App\Helpers\Helper::toDecimal($rate['tax_amount'])); ?> | |
| 126 | + <?php endif; ?> | |
| 127 | + </span> | |
| 128 | + </td> | |
| 129 | + </tr> | |
| 130 | + <?php endforeach; ?> | |
| 131 | + </table> | |
| 132 | + </td> | |
| 133 | + </tr> | |
| 134 | + <?php elseif ($fctEmailDisplayMode !== 'simplified' && !empty($item['tax_amount'])): ?> | |
| 135 | + <?php | |
| 136 | + $itemIsInclusive = TaxSummaryHelper::isPrimaryTaxInclusive($order); | |
| 137 | + $reversedAmountStyle = ($isReversed && (!$itemIsInclusive || $rcMode === 'dynamic')) ? 'text-decoration:line-through;opacity:0.6;' : ''; | |
| 138 | + $pillBg = $itemIsInclusive ? '#EAF3DE' : '#FAEEDA'; | |
| 139 | + $pillColor = $itemIsInclusive ? '#3B6D11' : '#854F0B'; | |
| 140 | + $pillLabel = $itemIsInclusive ? esc_html__('Tax (incl.)', 'fluent-cart') : esc_html__('Tax (excl.)', 'fluent-cart'); | |
| 141 | + ?> | |
| 142 | + <tr> | |
| 143 | + <td colspan="3" style="padding: 0 16px 8px;"> | |
| 144 | + <table width="100%" style="border-spacing:0;border-collapse:collapse;"> | |
| 145 | + <tr> | |
| 146 | + <td style="padding: 2px 0;"> | |
| 147 | + <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); ?>;"> | |
| 148 | + <?php echo $pillLabel; ?> | |
| 149 | + </span> | |
| 150 | + </td> | |
| 151 | + <td style="text-align:right;padding: 2px 0;"> | |
| 152 | + <span style="font-size:11px;font-weight:500;color:<?php echo esc_attr($pillColor); ?>;<?php echo esc_attr($reversedAmountStyle); ?>"> | |
| 153 | + <?php if ($itemIsInclusive): ?> | |
| 154 | + <?php /* translators: %1$s: formatted tax amount e.g. "$3.92" */ ?> | |
| 155 | + <?php echo esc_html(sprintf(__('incl. %1$s', 'fluent-cart'), \FluentCart\App\Helpers\Helper::toDecimal((int) $item['tax_amount']))); ?> | |
| 156 | + <?php else: ?> | |
| 157 | + + <?php echo esc_html(\FluentCart\App\Helpers\Helper::toDecimal((int) $item['tax_amount'])); ?> | |
| 158 | + <?php endif; ?> | |
| 159 | + </span> | |
| 160 | + </td> | |
| 161 | + </tr> | |
| 162 | + </table> | |
| 163 | + </td> | |
| 164 | + </tr> | |
| 165 | + <?php endif; ?> | |
| 166 | + | |
| 167 | + <?php if (!empty($item['setup_info'])): ?> | |
| 168 | + <tr> | |
| 169 | + <td colspan="3" style="padding: 0 16px 2px;"> | |
| 170 | + <p style="font-size:12px;color:rgb(75,85,99);line-height:20px;margin: 3px 0 0 0;"> | |
| 171 | + <?php echo wp_kses_post($item['setup_info']); ?> | |
| 172 | + </p> | |
| 173 | + </td> | |
| 174 | + </tr> | |
| 175 | + <?php endif; ?> | |
| 176 | + | |
| 177 | + <?php if (($item['payment_type'] ?? '') === 'subscription'): ?> | |
| 178 | + <?php | |
| 179 | + $sfSibling = null; | |
| 180 | + foreach ($allOrderItems as $sfCandidate) { | |
| 181 | + if (($sfCandidate['payment_type'] ?? '') !== 'signup_fee') { | |
| 182 | + continue; | |
| 183 | + } | |
| 184 | + $parentId = isset($sfCandidate['line_meta']['parent_item_id']) ? (int) $sfCandidate['line_meta']['parent_item_id'] : 0; | |
| 185 | + if ($parentId && $parentId === (int) $item['id']) { | |
| 186 | + $sfSibling = $sfCandidate; | |
| 187 | + break; | |
| 188 | + } | |
| 189 | + if (!$parentId && $sfCandidate['object_id'] === $item['object_id']) { | |
| 190 | + $sfSibling = $sfCandidate; | |
| 191 | + break; | |
| 192 | + } | |
| 193 | + } | |
| 194 | + $sfRates = $sfSibling ? TaxSummaryHelper::getItemTaxRates($sfSibling) : []; | |
| 195 | + ?> | |
| 196 | + <?php if ($fctEmailDisplayMode !== 'simplified' && !empty($sfRates)): ?> | |
| 197 | + <tr> | |
| 198 | + <td colspan="3" style="padding: 0 16px 8px;"> | |
| 199 | + <table width="100%" style="border-spacing:0;border-collapse:collapse;"> | |
| 200 | + <?php foreach ($sfRates as $sfRate): | |
| 201 | + $sfBg = $sfRate['inclusive'] ? '#EAF3DE' : '#FAEEDA'; | |
| 202 | + $sfColor = $sfRate['inclusive'] ? '#3B6D11' : '#854F0B'; | |
| 203 | + $sfRateIsInclusive = !empty($sfRate['inclusive']); | |
| 204 | + $reversedAmountStyle = ($isReversed && (!$sfRateIsInclusive || $rcMode === 'dynamic')) ? 'text-decoration:line-through;opacity:0.6;' : ''; | |
| 205 | + ?> | |
| 206 | + <tr> | |
| 207 | + <td style="padding: 2px 0;"> | |
| 208 | + <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); ?>;"> | |
| 209 | + <?php | |
| 210 | + /* translators: %1$s: tax label e.g. "VAT", %2$s: rate percentage e.g. "20" or "7.5" */ | |
| 211 | + echo esc_html(sprintf(__('Setup Fee — %1$s (%2$s%%)', 'fluent-cart'), $sfRate['label'], rtrim(rtrim(number_format((float) $sfRate['rate_percent'], 3, '.', ''), '0'), '.'))); | |
| 212 | + ?> | |
| 213 | + </span> | |
| 214 | + </td> | |
| 215 | + <td style="text-align:right;padding: 2px 0;"> | |
| 216 | + <span style="font-size:11px;font-weight:500;color:<?php echo esc_attr($sfColor); ?>;<?php echo esc_attr($reversedAmountStyle); ?>"> | |
| 217 | + <?php if ($sfRate['inclusive']): ?> | |
| 218 | + <?php /* translators: %1$s: formatted tax amount e.g. "$3.92" */ ?> | |
| 219 | + <?php echo esc_html(sprintf(__('incl. %1$s', 'fluent-cart'), \FluentCart\App\Helpers\Helper::toDecimal($sfRate['tax_amount']))); ?> | |
| 220 | + <?php else: ?> | |
| 221 | + + <?php echo esc_html(\FluentCart\App\Helpers\Helper::toDecimal($sfRate['tax_amount'])); ?> | |
| 222 | + <?php endif; ?> | |
| 223 | + </span> | |
| 224 | + </td> | |
| 225 | + </tr> | |
| 226 | + <?php endforeach; ?> | |
| 227 | + </table> | |
| 228 | + </td> | |
| 229 | + </tr> | |
| 230 | + <?php else: ?> | |
| 231 | + <?php | |
| 232 | + if ($sfSibling) { | |
| 233 | + $sfTax = (int) ($sfSibling['tax_amount'] ?? 0); | |
| 234 | + } else { | |
| 235 | + $sfOtherInfo = is_array($item['other_info'] ?? null) ? $item['other_info'] : []; | |
| 236 | + $sfTax = (int) Arr::get($sfOtherInfo, 'signup_fee_tax', 0); | |
| 237 | + } | |
| 238 | + ?> | |
| 239 | + <?php if ($fctEmailDisplayMode !== 'simplified' && $sfTax > 0): ?> | |
| 240 | + <?php | |
| 241 | + $sfIsInclusive = TaxSummaryHelper::isPrimaryTaxInclusive($order); | |
| 242 | + $reversedAmountStyle = ($isReversed && (!$sfIsInclusive || $rcMode === 'dynamic')) ? 'text-decoration:line-through;opacity:0.6;' : ''; | |
| 243 | + $sfFallbackBg = $sfIsInclusive ? '#EAF3DE' : '#FAEEDA'; | |
| 244 | + $sfFallbackColor = $sfIsInclusive ? '#3B6D11' : '#854F0B'; | |
| 245 | + ?> | |
| 246 | + <tr> | |
| 247 | + <td colspan="3" style="padding: 0 16px 8px;"> | |
| 248 | + <table width="100%" style="border-spacing:0;border-collapse:collapse;"> | |
| 249 | + <tr> | |
| 250 | + <td style="padding: 2px 0;"> | |
| 251 | + <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); ?>;"> | |
| 252 | + <?php echo esc_html__('Setup Fee Tax', 'fluent-cart'); ?> | |
| 253 | + </span> | |
| 254 | + </td> | |
| 255 | + <td style="text-align:right;padding: 2px 0;"> | |
| 256 | + <span style="font-size:11px;font-weight:500;color:<?php echo esc_attr($sfFallbackColor); ?>;<?php echo esc_attr($reversedAmountStyle); ?>"> | |
| 257 | + <?php if ($sfIsInclusive): ?> | |
| 258 | + <?php /* translators: %1$s: formatted tax amount e.g. "$3.92" */ ?> | |
| 259 | + <?php echo esc_html(sprintf(__('incl. %1$s', 'fluent-cart'), \FluentCart\App\Helpers\Helper::toDecimal($sfTax))); ?> | |
| 260 | + <?php else: ?> | |
| 261 | + + <?php echo esc_html(\FluentCart\App\Helpers\Helper::toDecimal($sfTax)); ?> | |
| 262 | + <?php endif; ?> | |
| 263 | + </span> | |
| 264 | + </td> | |
| 265 | + </tr> | |
| 266 | + </table> | |
| 267 | + </td> | |
| 268 | + </tr> | |
| 269 | + <?php endif; ?> | |
| 270 | + <?php endif; ?> | |
| 271 | + <?php endif; ?> | |
| 75 | 272 | <?php endforeach; ?> |
| 76 | 273 | </tbody> |
| 77 | 274 | </table> |
| 78 | -<table style="border-spacing:0;padding: 0; width: 100%;border: none;"> | |
| 275 | +<table style="border-spacing:0;padding: 0; width: 100%;border: none;margin-top:8px;"> | |
| 79 | 276 | <tr> |
| 277 | + <td colspan="2" style="border-top:1px solid #e5e7eb;padding-top:12px;font-size:0;line-height:0;"> </td> | |
| 278 | + </tr> | |
| 279 | + <tr> | |
| 80 | 280 | <td style="width: 50%;"></td> |
| 81 | 281 | <td style="width: 100%;"> |
| 82 | - <table role="presentation" | |
| 83 | - style="background-color:rgb(249,250,251);padding:16px;border-radius:8px;margin: 0; width: 100%;border: none;"> | |
| 282 | + <table role="presentation" width="400" | |
| 283 | + style="margin: 0 0 0 auto; width: 400px; max-width: 100%; border: none;"> | |
| 84 | 284 | <tbody> |
| 285 | + <!-- Zone A: plain subtotal / shipping / fees / discount --> | |
| 85 | 286 | <?php if ($order->subtotal != $order->total_amount): ?> |
| 86 | 287 | <tr style="width:100%"> |
| 87 | 288 | <td style="width:70%"> |
| 88 | 289 | <p style="font-size:14px;color:rgb(55,65,81);line-height:24px;margin: 0;"> |
| @@ -96,80 +297,426 @@ | ||
| 96 | 297 | </td> |
| 97 | 298 | </tr> |
| 98 | 299 | <?php endif; ?> |
| 99 | 300 | |
| 100 | - <?php if ($order->shipping_total > 0): ?> | |
| 301 | + <?php | |
| 302 | + // Compute summary early so rcShippingAdjustment is available for the shipping row. | |
| 303 | + $emailTaxSummaryEarly = ($order instanceof \FluentCart\App\Models\Order) | |
| 304 | + ? TaxSummaryHelper::computeTaxSummary($order) | |
| 305 | + : ['shouldRender' => false, 'rcShippingAdjustment' => 0, 'rcTotalAdjustment' => 0]; | |
| 306 | + $emailRcShippingAdj = (int) \FluentCart\Framework\Support\Arr::get($emailTaxSummaryEarly, 'rcShippingAdjustment', 0); | |
| 307 | + ?> | |
| 308 | + <?php if ($order->shipping_total > 0): | |
| 309 | + $emailDisplayShipping = max(0, (int) $order->shipping_total - $emailRcShippingAdj); | |
| 310 | + $emailShippingMethodTitle = (string) \FluentCart\Framework\Support\Arr::get($order->config, 'shipping_method_title', ''); | |
| 311 | + ?> | |
| 101 | 312 | <tr style="width:100%"> |
| 102 | 313 | <td style="width:70%"> |
| 103 | 314 | <p style="font-size:14px;color:rgb(55,65,81);line-height:24px;margin: 0;"> |
| 104 | 315 | <?php echo esc_html__('Shipping', 'fluent-cart'); ?> |
| 105 | 316 | </p> |
| 317 | + <?php if ($emailShippingMethodTitle): ?> | |
| 318 | + <p style="font-size:12px;color:rgb(107,114,128);line-height:18px;margin:0;"> | |
| 319 | + <?php echo esc_html($emailShippingMethodTitle); ?> | |
| 320 | + </p> | |
| 321 | + <?php endif; ?> | |
| 106 | 322 | </td> |
| 107 | 323 | <td style="width:30%;text-align:right"> |
| 108 | 324 | <p style="font-size:14px;color:rgb(55,65,81);margin:0;line-height:24px;"> |
| 109 | - <?php echo esc_html(\FluentCart\App\Helpers\Helper::toDecimal($order->shipping_total)); ?> | |
| 325 | + <?php echo esc_html(\FluentCart\App\Helpers\Helper::toDecimal($emailDisplayShipping)); ?> | |
| 110 | 326 | </p> |
| 111 | 327 | </td> |
| 112 | 328 | </tr> |
| 113 | 329 | <?php endif; ?> |
| 114 | - <?php if ($order->shipping_tax > 0): ?> | |
| 330 | + <?php foreach ($feeItems as $feeItem): ?> | |
| 115 | 331 | <tr style="width:100%"> |
| 116 | 332 | <td style="width:70%"> |
| 117 | 333 | <p style="font-size:14px;color:rgb(55,65,81);line-height:24px;margin: 0;"> |
| 118 | - <?php echo esc_html__('Shipping Tax', 'fluent-cart'); ?> | |
| 119 | - <?php echo esc_html($order->tax_behavior == 2 ? __('(Included)', 'fluent-cart') : __('(Excluded)', 'fluent-cart')); ?> | |
| 334 | + <?php echo esc_html($feeItem['title']); ?> | |
| 120 | 335 | </p> |
| 121 | 336 | </td> |
| 122 | 337 | <td style="width:30%;text-align:right"> |
| 123 | 338 | <p style="font-size:14px;color:rgb(55,65,81);margin:0;line-height:24px;"> |
| 124 | - <?php echo esc_html(\FluentCart\App\Helpers\Helper::toDecimal($order->shipping_tax)); ?> | |
| 339 | + <?php echo esc_html(\FluentCart\App\Helpers\Helper::toDecimal($feeItem['subtotal'])); ?> | |
| 125 | 340 | </p> |
| 126 | 341 | </td> |
| 127 | 342 | </tr> |
| 128 | - <?php endif; ?> | |
| 129 | - <?php foreach ($feeItems as $feeItem): ?> | |
| 343 | + <?php endforeach; ?> | |
| 344 | + <?php | |
| 345 | + $prorateCredit = (int) \FluentCart\Framework\Support\Arr::get($order->config, 'prorate_credit', 0); | |
| 346 | + $upgradeDiscount = $order->manual_discount_total - $prorateCredit; | |
| 347 | + // When the prorate credit IS the whole discount, label the row directly | |
| 348 | + // instead of showing "Discount" with a single redundant breakdown row. | |
| 349 | + $onlyProrateCredit = $prorateCredit > 0 && $upgradeDiscount <= 0 && $order->coupon_discount_total <= 0; | |
| 350 | + ?> | |
| 351 | + <?php if ($order->manual_discount_total + $order->coupon_discount_total > 0): ?> | |
| 130 | 352 | <tr style="width:100%"> |
| 131 | 353 | <td style="width:70%"> |
| 132 | 354 | <p style="font-size:14px;color:rgb(55,65,81);line-height:24px;margin: 0;"> |
| 133 | - <?php echo esc_html($feeItem['title']); ?> | |
| 355 | + <?php echo $onlyProrateCredit ? esc_html__('Prorate Credit', 'fluent-cart') : esc_html__('Discount', 'fluent-cart'); ?> | |
| 134 | 356 | </p> |
| 135 | 357 | </td> |
| 136 | 358 | <td style="width:30%;text-align:right"> |
| 137 | - <p style="font-size:14px;color:rgb(55,65,81);margin:0;line-height:24px;"> | |
| 138 | - <?php echo esc_html(\FluentCart\App\Helpers\Helper::toDecimal($feeItem['subtotal'])); ?> | |
| 359 | + <p style="font-size:14px;color:rgb(55,65,81);line-height:24px;margin: 0;"> | |
| 360 | + - <?php echo esc_html(\FluentCart\App\Helpers\Helper::toDecimal($order->manual_discount_total + $order->coupon_discount_total)); ?> | |
| 139 | 361 | </p> |
| 140 | 362 | </td> |
| 141 | 363 | </tr> |
| 142 | - <?php endforeach; ?> | |
| 143 | - <?php if ($order->manual_discount_total + $order->coupon_discount_total > 0): ?> | |
| 364 | + <?php if ($prorateCredit > 0 && $upgradeDiscount > 0): ?> | |
| 365 | + <tr style="width:100%"> | |
| 366 | + <td style="width:70%;padding-left:12px;"> | |
| 367 | + <p style="font-size:12px;color:rgb(107,114,128);line-height:20px;margin: 0;"> | |
| 368 | + <?php echo esc_html__('Upgrade Discount', 'fluent-cart'); ?> | |
| 369 | + </p> | |
| 370 | + </td> | |
| 371 | + <td style="width:30%;text-align:right"> | |
| 372 | + <p style="font-size:12px;color:rgb(107,114,128);margin:0;line-height:20px;"> | |
| 373 | + <?php echo esc_html(\FluentCart\App\Helpers\Helper::toDecimal($upgradeDiscount)); ?> | |
| 374 | + </p> | |
| 375 | + </td> | |
| 376 | + </tr> | |
| 377 | + <?php endif; ?> | |
| 378 | + <?php if ($prorateCredit > 0 && !$onlyProrateCredit): ?> | |
| 379 | + <tr style="width:100%"> | |
| 380 | + <td style="width:70%;padding-left:12px;"> | |
| 381 | + <p style="font-size:12px;color:rgb(107,114,128);line-height:20px;margin: 0;"> | |
| 382 | + <?php echo esc_html__('Prorate Credit', 'fluent-cart'); ?> | |
| 383 | + </p> | |
| 384 | + </td> | |
| 385 | + <td style="width:30%;text-align:right"> | |
| 386 | + <p style="font-size:12px;color:rgb(107,114,128);margin:0;line-height:20px;"> | |
| 387 | + <?php echo esc_html(\FluentCart\App\Helpers\Helper::toDecimal($prorateCredit)); ?> | |
| 388 | + </p> | |
| 389 | + </td> | |
| 390 | + </tr> | |
| 391 | + <?php endif; ?> | |
| 392 | + <?php endif; ?> | |
| 393 | + | |
| 394 | + <?php | |
| 395 | + $emailTaxSummary = isset($emailTaxSummaryEarly) ? $emailTaxSummaryEarly : (($order instanceof \FluentCart\App\Models\Order) | |
| 396 | + ? TaxSummaryHelper::computeTaxSummary($order) | |
| 397 | + : ['shouldRender' => false]); | |
| 398 | + if ($emailTaxSummary['shouldRender']): | |
| 399 | + $emailFoldedRateLines = Arr::get($emailTaxSummary, 'foldedRateLines', []); | |
| 400 | + $emailIncludedInPrices = (int) Arr::get($emailTaxSummary, 'includedInPrices', 0); | |
| 401 | + $emailPayableTax = (int) Arr::get($emailTaxSummary, 'payableTax', 0); | |
| 402 | + $emailTotalOrderTax = (int) Arr::get($emailTaxSummary, 'totalOrderTax', 0); | |
| 403 | + ?> | |
| 404 | + </tbody> | |
| 405 | + </table><!-- /Zone A --> | |
| 406 | + <!-- Zone B: tax breakdown inside its own grey box --> | |
| 407 | + <table role="presentation" align="right" width="400" | |
| 408 | + style="border-spacing:0;border-collapse:collapse;margin:12px 0 0 auto;width:400px;max-width:100%;border:none;"> | |
| 409 | + <tbody> | |
| 410 | + <tr> | |
| 411 | + <td style="background-color:rgb(249,250,251);padding:16px;border-radius:8px;"> | |
| 412 | + <table role="presentation" width="100%" | |
| 413 | + style="width:100%;border-spacing:0;border-collapse:collapse;border:none;"> | |
| 414 | + <tbody> | |
| 415 | + <?php if (($emailTaxSummary['displayMode'] ?? '') === 'simplified' && !empty($emailTaxSummary['simpleLine'])): ?> | |
| 144 | 416 | <tr style="width:100%"> |
| 145 | 417 | <td style="width:70%"> |
| 146 | - <p style="font-size:14px;color:rgb(55,65,81);line-height:24px;margin: 0;"> | |
| 147 | - <?php echo esc_html__('Discount', 'fluent-cart'); ?> | |
| 418 | + <p style="font-size:14px; font-weight:700; color:#1e293b; line-height:24px; margin:0;"> | |
| 419 | + <?php echo esc_html($emailTaxSummary['simpleLine']['label']); ?> | |
| 148 | 420 | </p> |
| 149 | 421 | </td> |
| 150 | - <td style="width:30%;text-align:right"> | |
| 151 | - <p style="font-size:14px;color:rgb(55,65,81);line-height:24px;margin: 0;"> | |
| 152 | - - <?php echo esc_html(\FluentCart\App\Helpers\Helper::toDecimal($order->manual_discount_total + $order->coupon_discount_total)); ?> | |
| 422 | + <td style="width:30%; text-align:right"> | |
| 423 | + <p style="font-size:14px; font-weight:700; color:#1e293b; margin:0; line-height:24px;"> | |
| 424 | + <?php echo esc_html($emailTaxSummary['simpleLine']['value']); ?> | |
| 153 | 425 | </p> |
| 154 | 426 | </td> |
| 155 | 427 | </tr> |
| 156 | 428 | <?php endif; ?> |
| 157 | - <?php if ($order->tax_total > 0): ?> | |
| 429 | + <?php if (($emailTaxSummary['displayMode'] ?? '') !== 'simplified'): ?> | |
| 430 | + <tr style="width:100%"> | |
| 431 | + <td colspan="2" style="padding:0 0 4px;"> | |
| 432 | + <p style="font-size:10px; font-weight:600; text-transform:uppercase; | |
| 433 | + letter-spacing:0.06em; color:#94a3b8; margin:0;"> | |
| 434 | + <?php if (!empty($emailFoldedRateLines)): ?> | |
| 435 | + <?php echo esc_html__('Tax breakdown by rate', 'fluent-cart'); ?> | |
| 436 | + <?php else: ?> | |
| 437 | + <?php echo esc_html__('TAX', 'fluent-cart'); ?> | |
| 438 | + <?php endif; ?> | |
| 439 | + </p> | |
| 440 | + </td> | |
| 441 | + </tr> | |
| 442 | + <?php | |
| 443 | + $rcReversedTotal = (int) Arr::get($emailTaxSummary, 'reversedTaxTotal', 0); | |
| 444 | + $rcReversedShipping = (int) Arr::get($emailTaxSummary, 'reversedShippingTax', 0); | |
| 445 | + $rcReversedValue = $rcReversedTotal > 0 | |
| 446 | + ? \FluentCart\App\Helpers\Helper::toDecimal($rcReversedTotal) | |
| 447 | + : __('Charge reversed', 'fluent-cart'); | |
| 448 | + ?> | |
| 449 | + <?php if (!empty($emailFoldedRateLines)): ?> | |
| 158 | 450 | <tr style="width:100%"> |
| 451 | + <td colspan="2" style="padding:0 0 4px;"> | |
| 452 | + <table style="width:100%;border-collapse:collapse;border-spacing:0;table-layout:fixed;"> | |
| 453 | + <tbody> | |
| 454 | + <tr> | |
| 455 | + <td style="width:58%;font-size:11px;text-transform:uppercase;color:rgb(107,114,128);font-weight:600;padding:2px 12px 2px 0;border:none;white-space:nowrap;"> | |
| 456 | + <?php echo esc_html__('Rate', 'fluent-cart'); ?> | |
| 457 | + </td> | |
| 458 | + <td style="width:24%;font-size:11px;text-transform:uppercase;color:rgb(107,114,128);font-weight:600;padding:2px 12px 2px 0;text-align:right;border:none;white-space:nowrap;"> | |
| 459 | + <?php echo esc_html__('Taxable base', 'fluent-cart'); ?> | |
| 460 | + </td> | |
| 461 | + <td style="width:18%;font-size:11px;text-transform:uppercase;color:rgb(107,114,128);font-weight:600;padding:2px 0 2px 0;text-align:right;border:none;white-space:nowrap;"> | |
| 462 | + <?php echo esc_html__('Tax', 'fluent-cart'); ?> | |
| 463 | + </td> | |
| 464 | + </tr> | |
| 465 | + <?php foreach ($emailFoldedRateLines as $emailFoldedLine): | |
| 466 | + $emailFoldedColor = !empty($emailFoldedLine['inclusive']) ? '#94a3b8' : '#1e293b'; | |
| 467 | + ?> | |
| 468 | + <tr> | |
| 469 | + <td style="width:58%;font-size:14px;line-height:20px;padding:3px 12px 3px 0;border:none;color:<?php echo esc_attr($emailFoldedColor); ?>;white-space:normal;word-break:break-word;overflow-wrap:break-word;vertical-align:top;"> | |
| 470 | + <?php echo esc_html($emailFoldedLine['label']); ?> | |
| 471 | + </td> | |
| 472 | + <td style="width:24%;font-size:13px;line-height:20px;padding:3px 12px 3px 0;text-align:right;border:none;color:#94a3b8;white-space:nowrap;vertical-align:top;"> | |
| 473 | + <?php echo esc_html(\FluentCart\App\Helpers\Helper::toDecimal($emailFoldedLine['base'])); ?> | |
| 474 | + </td> | |
| 475 | + <td style="width:18%;font-size:13px;line-height:20px;padding:3px 0 3px 0;text-align:right;border:none;color:<?php echo esc_attr($emailFoldedColor); ?>;white-space:nowrap;vertical-align:top;"> | |
| 476 | + <?php echo esc_html(\FluentCart\App\Helpers\Helper::toDecimal($emailFoldedLine['tax'])); ?> | |
| 477 | + </td> | |
| 478 | + </tr> | |
| 479 | + <?php endforeach; ?> | |
| 480 | + </tbody> | |
| 481 | + </table> | |
| 482 | + </td> | |
| 483 | + </tr> | |
| 484 | + <?php if ($emailTaxSummary['isReverseCharge']): ?> | |
| 485 | + <tr style="width:100%"> | |
| 159 | 486 | <td style="width:70%"> |
| 160 | - <p style="font-size:14px;color:rgb(55,65,81);line-height:24px;margin: 0;"> | |
| 161 | - <?php echo esc_html__('Tax', 'fluent-cart'); ?> | |
| 162 | - <?php echo esc_html($order->tax_behavior == 2 ? __('(Included)', 'fluent-cart') : __('(Excluded)', 'fluent-cart')); ?> | |
| 487 | + <p style="font-size:14px; font-weight:700; color:#1e293b; line-height:24px; margin:0; border-top:1px solid #e2e8f0; padding-top:4px;"> | |
| 488 | + <?php echo esc_html__('VAT reversed', 'fluent-cart'); ?> | |
| 163 | 489 | </p> |
| 164 | 490 | </td> |
| 165 | - <td style="width:30%;text-align:right"> | |
| 166 | - <p style="font-size:14px;color:rgb(55,65,81);margin:0;line-height:24px;"> | |
| 167 | - <?php echo esc_html(\FluentCart\App\Helpers\Helper::toDecimal($order->tax_total)); ?> | |
| 491 | + <td style="width:30%; text-align:right"> | |
| 492 | + <p style="font-size:14px; font-weight:700; color:#1e293b; margin:0; line-height:24px; border-top:1px solid #e2e8f0; padding-top:4px;"> | |
| 493 | + <?php echo esc_html($rcReversedValue); ?> | |
| 168 | 494 | </p> |
| 169 | 495 | </td> |
| 170 | 496 | </tr> |
| 497 | + <?php else: ?> | |
| 498 | + <tr style="width:100%"> | |
| 499 | + <td style="width:70%"> | |
| 500 | + <p style="font-size:14px; font-weight:700; color:#1e293b; line-height:24px; margin:0; border-top:1px solid #e2e8f0; padding-top:4px;"> | |
| 501 | + <?php echo esc_html__('Total tax', 'fluent-cart'); ?> | |
| 502 | + </p> | |
| 503 | + </td> | |
| 504 | + <td style="width:30%; text-align:right"> | |
| 505 | + <p style="font-size:14px; font-weight:700; color:#1e293b; margin:0; line-height:24px; border-top:1px solid #e2e8f0; padding-top:4px;"> | |
| 506 | + <?php echo esc_html(\FluentCart\App\Helpers\Helper::toDecimal($emailTotalOrderTax)); ?> | |
| 507 | + </p> | |
| 508 | + </td> | |
| 509 | + </tr> | |
| 510 | + <?php if ($emailIncludedInPrices > 0): ?> | |
| 511 | + <tr style="width:100%"> | |
| 512 | + <td style="width:70%"> | |
| 513 | + <p style="font-size:13px; color:#94a3b8; line-height:22px; margin:0;"> | |
| 514 | + <?php echo esc_html__('of which included in prices', 'fluent-cart'); ?> | |
| 515 | + </p> | |
| 516 | + </td> | |
| 517 | + <td style="width:30%; text-align:right"> | |
| 518 | + <p style="font-size:13px; color:#94a3b8; margin:0; line-height:22px;"> | |
| 519 | + <?php echo esc_html(\FluentCart\App\Helpers\Helper::toDecimal($emailIncludedInPrices)); ?> | |
| 520 | + </p> | |
| 521 | + </td> | |
| 522 | + </tr> | |
| 523 | + <?php endif; ?> | |
| 524 | + <?php if ($emailPayableTax > 0 && $emailIncludedInPrices > 0): ?> | |
| 525 | + <tr style="width:100%"> | |
| 526 | + <td style="width:70%;border-top:1px solid #e2e8f0;padding-top:6px;margin-top:6px;"> | |
| 527 | + <p style="font-size:14px; font-weight:700; color:#1e293b; line-height:24px; margin:0;"> | |
| 528 | + <?php echo esc_html__('Payable now (added)', 'fluent-cart'); ?> | |
| 529 | + </p> | |
| 530 | + </td> | |
| 531 | + <td style="width:30%; text-align:right;border-top:1px solid #e2e8f0;padding-top:6px;margin-top:6px;"> | |
| 532 | + <p style="font-size:14px; font-weight:700; color:#1e293b; margin:0; line-height:24px;"> | |
| 533 | + <?php echo esc_html(\FluentCart\App\Helpers\Helper::toDecimal($emailPayableTax)); ?> | |
| 534 | + </p> | |
| 535 | + </td> | |
| 536 | + </tr> | |
| 537 | + <?php endif; ?> | |
| 538 | + <?php endif; ?> | |
| 539 | + <?php elseif ($emailTaxSummary['isReverseCharge']): ?> | |
| 540 | + <?php if ($emailTaxSummary['showRcShippingRow'] && $rcReversedShipping > 0): ?> | |
| 541 | + <tr style="width:100%"> | |
| 542 | + <td style="width:70%"> | |
| 543 | + <p style="font-size:14px; color:#94a3b8; line-height:24px; margin:0;"> | |
| 544 | + <?php echo esc_html__('Added on shipping', 'fluent-cart'); ?> | |
| 545 | + </p> | |
| 546 | + </td> | |
| 547 | + <td style="width:30%; text-align:right"> | |
| 548 | + <p style="font-size:14px; color:#94a3b8; margin:0; line-height:24px;"> | |
| 549 | + <span style="text-decoration:line-through;opacity:0.6;"><?php echo esc_html(\FluentCart\App\Helpers\Helper::toDecimal($rcReversedShipping)); ?></span> | |
| 550 | + </p> | |
| 551 | + </td> | |
| 552 | + </tr> | |
| 553 | + <?php endif; ?> | |
| 554 | + <tr style="width:100%"> | |
| 555 | + <td style="width:70%"> | |
| 556 | + <p style="font-size:14px; font-weight:700; color:#1e293b; line-height:24px; margin:0;"> | |
| 557 | + <?php echo esc_html__('Tax reversed', 'fluent-cart'); ?> | |
| 558 | + </p> | |
| 559 | + </td> | |
| 560 | + <td style="width:30%; text-align:right"> | |
| 561 | + <p style="font-size:14px; font-weight:700; color:#1e293b; margin:0; line-height:24px;"> | |
| 562 | + <?php echo esc_html($rcReversedValue); ?> | |
| 563 | + </p> | |
| 564 | + </td> | |
| 565 | + </tr> | |
| 566 | + <?php else: ?> | |
| 567 | + <?php | |
| 568 | + $emailFeeRowsList = Arr::get($emailTaxSummary, 'feeTaxLineRows', []); | |
| 569 | + $emailTaxRateLines = Arr::get($emailTaxSummary, 'taxRateLines', []); | |
| 570 | + $emailShippingLines = Arr::get($emailTaxSummary, 'shippingTaxLines', []); | |
| 571 | + $productTaxRowCount = !empty($emailTaxRateLines) | |
| 572 | + ? count($emailTaxRateLines) | |
| 573 | + : (int) ($emailTaxSummary['inclusiveTax'] > 0) + (int) ($emailTaxSummary['exclusiveTax'] > 0); | |
| 574 | + $rowCount = $productTaxRowCount + count($emailFeeRowsList) + (int) ($emailTaxSummary['shippingTax'] > 0); | |
| 575 | + $shouldShowBreakdown = !empty($emailTaxRateLines) | |
| 576 | + || !empty($emailShippingLines) | |
| 577 | + || $rowCount >= 2 | |
| 578 | + || ($rowCount === 1 && !($emailTaxSummary['payableTax'] > 0 || $emailTaxSummary['inclusiveTax'] > 0 || (int) Arr::get($emailTaxSummary, 'inclusiveFeeTax', 0) > 0)); | |
| 579 | + ?> | |
| 580 | + <?php if (!empty($emailTaxRateLines) && $shouldShowBreakdown): ?> | |
| 581 | + <?php foreach ($emailTaxRateLines as $emailTaxRateLine): | |
| 582 | + $emailTaxRateColor = !empty($emailTaxRateLine['inclusive']) ? '#94a3b8' : '#1e293b'; | |
| 583 | + $emailTaxRateWeight = !empty($emailTaxRateLine['inclusive']) ? 'normal' : '600'; ?> | |
| 584 | + <tr style="width:100%"> | |
| 585 | + <td style="width:70%"> | |
| 586 | + <p style="font-size:14px; font-weight:<?php echo esc_attr($emailTaxRateWeight); ?>; color:<?php echo esc_attr($emailTaxRateColor); ?>; line-height:24px; margin:0;"> | |
| 587 | + <?php echo esc_html($emailTaxRateLine['label']); ?> | |
| 588 | + </p> | |
| 589 | + </td> | |
| 590 | + <td style="width:30%; text-align:right"> | |
| 591 | + <p style="font-size:14px; font-weight:<?php echo esc_attr($emailTaxRateWeight); ?>; color:<?php echo esc_attr($emailTaxRateColor); ?>; margin:0; line-height:24px;"> | |
| 592 | + <?php echo esc_html(\FluentCart\App\Helpers\Helper::toDecimal($emailTaxRateLine['order_tax'])); ?> | |
| 593 | + </p> | |
| 594 | + </td> | |
| 595 | + </tr> | |
| 596 | + <?php endforeach; ?> | |
| 597 | + <?php endif; ?> | |
| 598 | + <?php if (empty($emailTaxRateLines) && $emailTaxSummary['inclusiveTax'] > 0 && $shouldShowBreakdown): ?> | |
| 599 | + <tr style="width:100%"> | |
| 600 | + <td style="width:70%"> | |
| 601 | + <p style="font-size:14px; color:#94a3b8; line-height:24px; margin:0;"> | |
| 602 | + <?php echo esc_html__('Included in item prices', 'fluent-cart'); ?> | |
| 603 | + </p> | |
| 604 | + </td> | |
| 605 | + <td style="width:30%; text-align:right"> | |
| 606 | + <p style="font-size:14px; color:#94a3b8; margin:0; line-height:24px;"> | |
| 607 | + <?php echo esc_html(\FluentCart\App\Helpers\Helper::toDecimal($emailTaxSummary['inclusiveTax'])); ?> | |
| 608 | + </p> | |
| 609 | + </td> | |
| 610 | + </tr> | |
| 611 | + <?php endif; ?> | |
| 612 | + <?php if (empty($emailTaxRateLines) && $emailTaxSummary['exclusiveTax'] > 0 && $shouldShowBreakdown): ?> | |
| 613 | + <tr style="width:100%"> | |
| 614 | + <td style="width:70%"> | |
| 615 | + <p style="font-size:14px; font-weight:600; color:#1e293b; line-height:24px; margin:0;"> | |
| 616 | + <?php echo esc_html__('Added on products', 'fluent-cart'); ?> | |
| 617 | + </p> | |
| 618 | + </td> | |
| 619 | + <td style="width:30%; text-align:right"> | |
| 620 | + <p style="font-size:14px; font-weight:600; color:#1e293b; margin:0; line-height:24px;"> | |
| 621 | + <?php echo esc_html(\FluentCart\App\Helpers\Helper::toDecimal($emailTaxSummary['exclusiveTax'])); ?> | |
| 622 | + </p> | |
| 623 | + </td> | |
| 624 | + </tr> | |
| 625 | + <?php endif; ?> | |
| 626 | + <?php if ($shouldShowBreakdown) : ?> | |
| 627 | + <?php foreach ($emailFeeRowsList as $emailFeeRow): | |
| 628 | + $emailFeeColor = $emailFeeRow['inclusive'] ? '#94a3b8' : '#1e293b'; | |
| 629 | + $emailFeeWeight = $emailFeeRow['inclusive'] ? 'normal' : '600'; ?> | |
| 630 | + <tr style="width:100%"> | |
| 631 | + <td style="width:70%"> | |
| 632 | + <p style="font-size:14px; font-weight:<?php echo esc_attr($emailFeeWeight); ?>; color:<?php echo esc_attr($emailFeeColor); ?>; line-height:24px; margin:0;"> | |
| 633 | + <?php echo esc_html($emailFeeRow['display_label']); ?> | |
| 634 | + </p> | |
| 635 | + </td> | |
| 636 | + <td style="width:30%; text-align:right"> | |
| 637 | + <p style="font-size:14px; font-weight:<?php echo esc_attr($emailFeeWeight); ?>; color:<?php echo esc_attr($emailFeeColor); ?>; margin:0; line-height:24px;"> | |
| 638 | + <?php echo esc_html(\FluentCart\App\Helpers\Helper::toDecimal($emailFeeRow['tax_amount'])); ?> | |
| 639 | + </p> | |
| 640 | + </td> | |
| 641 | + </tr> | |
| 642 | + <?php endforeach; ?> | |
| 643 | + <?php endif; ?> | |
| 644 | + <?php if ($emailTaxSummary['shippingTax'] > 0 && $shouldShowBreakdown): | |
| 645 | + $isShippingInclusive = (bool) Arr::get($emailTaxSummary, 'isShippingInclusive', false); | |
| 646 | + $emailShippingColor = $isShippingInclusive ? '#94a3b8' : '#1e293b'; | |
| 647 | + $emailShippingWeight = $isShippingInclusive ? 'normal' : '600'; | |
| 648 | + if (!empty($emailShippingLines)): | |
| 649 | + foreach ($emailShippingLines as $shLine): ?> | |
| 650 | + <tr style="width:100%"> | |
| 651 | + <td style="width:70%"> | |
| 652 | + <p style="font-size:14px; font-weight:<?php echo esc_attr($emailShippingWeight); ?>; color:<?php echo esc_attr($emailShippingColor); ?>; line-height:24px; margin:0;"> | |
| 653 | + <?php echo esc_html($shLine['label']); ?> | |
| 654 | + </p> | |
| 655 | + </td> | |
| 656 | + <td style="width:30%; text-align:right"> | |
| 657 | + <p style="font-size:14px; font-weight:<?php echo esc_attr($emailShippingWeight); ?>; color:<?php echo esc_attr($emailShippingColor); ?>; margin:0; line-height:24px;"> | |
| 658 | + <?php echo esc_html(\FluentCart\App\Helpers\Helper::toDecimal($shLine['shipping_tax'])); ?> | |
| 659 | + </p> | |
| 660 | + </td> | |
| 661 | + </tr> | |
| 662 | + <?php endforeach; | |
| 663 | + else: ?> | |
| 664 | + <tr style="width:100%"> | |
| 665 | + <td style="width:70%"> | |
| 666 | + <p style="font-size:14px; font-weight:<?php echo esc_attr($emailShippingWeight); ?>; color:<?php echo esc_attr($emailShippingColor); ?>; line-height:24px; margin:0;"> | |
| 667 | + <?php echo esc_html($isShippingInclusive ? __('Included in shipping prices', 'fluent-cart') : __('Added on shipping', 'fluent-cart')); ?> | |
| 668 | + </p> | |
| 669 | + </td> | |
| 670 | + <td style="width:30%; text-align:right"> | |
| 671 | + <p style="font-size:14px; font-weight:<?php echo esc_attr($emailShippingWeight); ?>; color:<?php echo esc_attr($emailShippingColor); ?>; margin:0; line-height:24px;"> | |
| 672 | + <?php echo esc_html(\FluentCart\App\Helpers\Helper::toDecimal($emailTaxSummary['shippingTax'])); ?> | |
| 673 | + </p> | |
| 674 | + </td> | |
| 675 | + </tr> | |
| 676 | + <?php endif; ?> | |
| 677 | + <?php endif; ?> | |
| 678 | + <?php if ($emailTaxSummary['payableTax'] > 0): ?> | |
| 679 | + <tr style="width:100%"> | |
| 680 | + <td style="width:70%"> | |
| 681 | + <p style="font-size:14px; font-weight:700; color:#1e293b; line-height:24px; margin:0; border-top:1px solid #e2e8f0; padding-top:4px;"> | |
| 682 | + <?php echo esc_html__('Total payable tax', 'fluent-cart'); ?> | |
| 683 | + </p> | |
| 684 | + </td> | |
| 685 | + <td style="width:30%; text-align:right"> | |
| 686 | + <p style="font-size:14px; font-weight:700; color:#1e293b; margin:0; line-height:24px; border-top:1px solid #e2e8f0; padding-top:4px;"> | |
| 687 | + <?php echo esc_html(\FluentCart\App\Helpers\Helper::toDecimal($emailTaxSummary['payableTax'])); ?> | |
| 688 | + </p> | |
| 689 | + </td> | |
| 690 | + </tr> | |
| 691 | + <?php endif; ?> | |
| 692 | + <?php if ($emailTaxSummary['inclusiveTax'] > 0 || $emailTaxSummary['inclusiveFeeTax'] > 0): ?> | |
| 693 | + <tr style="width:100%"> | |
| 694 | + <td style="width:70%"> | |
| 695 | + <p style="font-size:14px; font-weight:normal; color:#94a3b8; line-height:24px; margin:0;"> | |
| 696 | + <?php echo esc_html__('Total tax in this order', 'fluent-cart'); ?> | |
| 697 | + </p> | |
| 698 | + </td> | |
| 699 | + <td style="width:30%; text-align:right"> | |
| 700 | + <p style="font-size:14px; font-weight:normal; color:#94a3b8; margin:0; line-height:24px;"> | |
| 701 | + <?php echo esc_html(\FluentCart\App\Helpers\Helper::toDecimal($emailTaxSummary['totalOrderTax'])); ?> | |
| 702 | + </p> | |
| 703 | + </td> | |
| 704 | + </tr> | |
| 705 | + <?php endif; ?> | |
| 171 | 706 | <?php endif; ?> |
| 707 | + <?php endif; ?> | |
| 708 | + </tbody> | |
| 709 | + </table> | |
| 710 | + </td> | |
| 711 | + </tr> | |
| 712 | + </tbody> | |
| 713 | + </table><!-- /Zone B: grey tax box --> | |
| 714 | + <table role="presentation" width="400" | |
| 715 | + style="margin:12px 0 0 auto; width: 400px; max-width: 100%; border: none;"> | |
| 716 | + <tbody> | |
| 717 | + <!-- Zone C: plain refund / total / payment --> | |
| 718 | + <?php endif; ?> | |
| 172 | 719 | |
| 173 | 720 | <?php if ($order->total_refund > 0 && $isRefund): ?> |
| 174 | 721 | <tr style="width:100%"> |
| 175 | 722 | <td style="width:70%"> |
| @@ -184,8 +731,12 @@ | ||
| 184 | 731 | </td> |
| 185 | 732 | </tr> |
| 186 | 733 | <?php endif; ?> |
| 187 | 734 | |
| 735 | + <?php | |
| 736 | + $emailDisplayTotal = max(0, (int) $order->total_amount - (int) $order->total_refund | |
| 737 | + - (int) \FluentCart\Framework\Support\Arr::get($emailTaxSummaryEarly ?? [], 'rcTotalAdjustment', 0)); | |
| 738 | + ?> | |
| 188 | 739 | <tr style="width:100%"> |
| 189 | 740 | <td style="width:70%"><p |
| 190 | 741 | style="font-size:16px;font-weight:700;color:rgb(17,24,39);line-height:24px;margin: 0;"> |
| 191 | 742 | <?php echo esc_html__('Total', 'fluent-cart'); ?> |
| @@ -192,9 +743,9 @@ | ||
| 192 | 743 | </p> |
| 193 | 744 | </td> |
| 194 | 745 | <td style="width:30%;text-align:right"> |
| 195 | 746 | <p style="font-size:14px;font-weight:700;color:rgb(17,24,39);line-height:24px;margin: 0;"> |
| 196 | - <?php echo esc_html(\FluentCart\Api\CurrencySettings::getFormattedPrice(($order->total_amount - $order->total_refund), null, false, true, true)); ?> | |
| 747 | + <?php echo esc_html(\FluentCart\Api\CurrencySettings::getFormattedPrice($emailDisplayTotal, null, false, true, true)); ?> | |
| 197 | 748 | </p> |
| 198 | 749 | </td> |
| 199 | 750 | </tr> |
| 200 | 751 | |
| @@ -227,13 +778,11 @@ | ||
| 227 | 778 | </tr> |
| 228 | 779 | </tbody> |
| 229 | 780 | </table> |
| 230 | 781 | <?php |
| 231 | - $orderTaxRates = $order->orderTaxRates->first(); | |
| 232 | - $taxtotal = $order->tax_total + $order->shipping_tax; | |
| 233 | - if(Arr::get($orderTaxRates->meta ?? [], 'vat_reverse.valid') && !$taxtotal): ?> | |
| 782 | + if($order->isReverseChargeTaxOrder()): ?> | |
| 234 | 783 | <div style="text-align: right; font-size: 14px; margin-top: 10px;"> |
| 235 | - <?php echo '*' . esc_html__('Tax to be paid on reverse charge basis', 'fluent-cart'); ?> | |
| 784 | + <?php echo '*' . esc_html(TaxModule::getReverseChargeNoticeText()); ?> | |
| 236 | 785 | </div> |
| 237 | 786 | |
| 238 | 787 | <?php endif ?> |
| 239 | 788 | </td> |
| @@ -238,7 +787,4 @@ | ||
| 238 | 787 | <?php endif ?> |
| 239 | 788 | </td> |
| 240 | 789 | </tr> |
| 241 | 790 | </table> |
| 242 | - | |
| 243 | - | |
| 244 | - | |