PluginProbe
FluentCart A New Era of eCommerce – Faster, Lighter, and Simpler / 1.5.3
FluentCart A New Era of eCommerce – Faster, Lighter, and Simpler v1.5.3
1.6.6 1.6.5 1.6.4 1.6.3 1.6.2 1.6.1 1.6.0 1.5.4 1.5.5 1.5.3 1.5.2 1.5.1 1.5.0 1.4.2 1.4.1 1.4.0 1.3.28 1.3.27 1.3.26 1.3.25 1.3.23 1.3.22 1.3.21 1.3.20 1.3.19 All 49 releases
fluent-cart / app / Views / emails / parts / items_table.php

items_table.php in FluentCart A New Era of eCommerce – Faster, Lighter, and Simpler 1.5.3, at app/Views/emails/parts/items_table.php

785 lines 49.0 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
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\Modules\Tax\TaxModule;
19 use FluentCart\App\Services\Renderer\Receipt\TaxSummaryHelper;
20 $allOrderItems = $order->order_items ? $order->order_items->toArray() : [];
21 $orderItems = array_filter($allOrderItems, function ($item) {
22 return !in_array($item['payment_type'] ?? '', ['signup_fee', 'fee']);
23 });
24 $feeItems = array_filter($allOrderItems, function ($item) {
25 return ($item['payment_type'] ?? '') === 'fee';
26 });
27 $transaction = $order->getLatestTransaction();
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
33 ?>
34
35 <table role="presentation" style="border-spacing:0;padding: 0; width: 100%;border: none">
36 <thead>
37 <tr>
38 <th style="background-color:rgb(249,250,251); padding-left: 16px">
39 <p style="font-size:12px;font-weight:600;color:rgb(55,65,81);text-transform:uppercase;line-height:24px;margin: 0;text-align: left">
40 <?php echo esc_html__('Item', 'fluent-cart'); ?>
41 </p>
42 </th>
43
44 <th style="background-color:rgb(249,250,251); width: 50px"></th>
45
46 <th style="background-color:rgb(249,250,251); padding-right: 16px; width: 200px;">
47 <p style="font-size:12px;font-weight:600;color:rgb(55,65,81);text-transform:uppercase;line-height:24px;margin: 0;text-align: right">
48 <?php echo esc_html__('Total', 'fluent-cart'); ?>
49 </p>
50 </th>
51 </tr>
52 </thead>
53 <tbody style="width:100%">
54 <?php foreach ($orderItems as $item): ?>
55 <tr>
56 <td style="padding-left: 16px;padding-top: 8px;padding-bottom: 8px;" colspan="2">
57 <p style="font-size: 15px; color: #2F3448; font-weight: 500; overflow: hidden; line-height: 18px; margin-top: 0; margin-bottom: 5px;">
58
59 <?php echo esc_html($item['post_title']); ?>
60 <?php if ($item['quantity'] > 1): ?>
61 <span style="font-size:12px;font-weight:400;color:rgb(75,85,99)">x <?php echo esc_html($item['quantity']); ?></span>
62 <?php endif; ?>
63
64 <p style="margin: 0; font-size: 14px; color: #758195; font-weight: 400; line-height: 15px;">
65 - <?php echo esc_html(!empty($item['variation_display_title']) ? $item['variation_display_title'] : $item['title']); ?>
66 </p>
67
68 <?php if ($item['payment_type'] === 'subscription' && !empty($item['payment_info'])): ?>
69 <p style="font-size:12px;color:rgb(75,85,99);line-height:20px;margin: 3px 0 0 0;">
70 <?php echo wp_kses_post($item['payment_info']) ?>
71 </p>
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\ProductCardRender::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; ?>
88 </p>
89 </td>
90 <td style="padding-right: 16px;text-align:right">
91 <p style="font-size:14px;font-weight:700;color:rgb(17,24,39);margin:0;line-height:24px;">
92 <?php echo esc_html($item['formatted_total']); ?>
93 </p>
94 </td>
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; ?>
272 <?php endforeach; ?>
273 </tbody>
274 </table>
275 <table style="border-spacing:0;padding: 0; width: 100%;border: none;margin-top:8px;">
276 <tr>
277 <td colspan="2" style="border-top:1px solid #e5e7eb;padding-top:12px;font-size:0;line-height:0;">&nbsp;</td>
278 </tr>
279 <tr>
280 <td style="width: 50%;"></td>
281 <td style="width: 100%;">
282 <table role="presentation" width="400"
283 style="margin: 0 0 0 auto; width: 400px; max-width: 100%; border: none;">
284 <tbody>
285 <!-- Zone A: plain subtotal / shipping / fees / discount -->
286 <?php if ($order->subtotal != $order->total_amount): ?>
287 <tr style="width:100%">
288 <td style="width:70%">
289 <p style="font-size:14px;color:rgb(55,65,81);line-height:24px;margin: 0;">
290 <?php echo esc_html__('Subtotal', 'fluent-cart'); ?>
291 </p>
292 </td>
293 <td style="width:30%;text-align:right">
294 <p style="font-size:14px;color:rgb(55,65,81);margin:0;line-height:24px;">
295 <?php echo esc_html(\FluentCart\App\Helpers\Helper::toDecimal($order->subtotal)); ?>
296 </p>
297 </td>
298 </tr>
299 <?php endif; ?>
300
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 ?>
311 <tr style="width:100%">
312 <td style="width:70%">
313 <p style="font-size:14px;color:rgb(55,65,81);line-height:24px;margin: 0;">
314 <?php echo esc_html__('Shipping', 'fluent-cart'); ?>
315 </p>
316 </td>
317 <td style="width:30%;text-align:right">
318 <p style="font-size:14px;color:rgb(55,65,81);margin:0;line-height:24px;">
319 <?php echo esc_html(\FluentCart\App\Helpers\Helper::toDecimal($emailDisplayShipping)); ?>
320 </p>
321 </td>
322 </tr>
323 <?php endif; ?>
324 <?php foreach ($feeItems as $feeItem): ?>
325 <tr style="width:100%">
326 <td style="width:70%">
327 <p style="font-size:14px;color:rgb(55,65,81);line-height:24px;margin: 0;">
328 <?php echo esc_html($feeItem['title']); ?>
329 </p>
330 </td>
331 <td style="width:30%;text-align:right">
332 <p style="font-size:14px;color:rgb(55,65,81);margin:0;line-height:24px;">
333 <?php echo esc_html(\FluentCart\App\Helpers\Helper::toDecimal($feeItem['subtotal'])); ?>
334 </p>
335 </td>
336 </tr>
337 <?php endforeach; ?>
338 <?php
339 $prorateCredit = (int) \FluentCart\Framework\Support\Arr::get($order->config, 'prorate_credit', 0);
340 $upgradeDiscount = $order->manual_discount_total - $prorateCredit;
341 // When the prorate credit IS the whole discount, label the row directly
342 // instead of showing "Discount" with a single redundant breakdown row.
343 $onlyProrateCredit = $prorateCredit > 0 && $upgradeDiscount <= 0 && $order->coupon_discount_total <= 0;
344 ?>
345 <?php if ($order->manual_discount_total + $order->coupon_discount_total > 0): ?>
346 <tr style="width:100%">
347 <td style="width:70%">
348 <p style="font-size:14px;color:rgb(55,65,81);line-height:24px;margin: 0;">
349 <?php echo $onlyProrateCredit ? esc_html__('Prorate Credit', 'fluent-cart') : esc_html__('Discount', 'fluent-cart'); ?>
350 </p>
351 </td>
352 <td style="width:30%;text-align:right">
353 <p style="font-size:14px;color:rgb(55,65,81);line-height:24px;margin: 0;">
354 - <?php echo esc_html(\FluentCart\App\Helpers\Helper::toDecimal($order->manual_discount_total + $order->coupon_discount_total)); ?>
355 </p>
356 </td>
357 </tr>
358 <?php if ($prorateCredit > 0 && $upgradeDiscount > 0): ?>
359 <tr style="width:100%">
360 <td style="width:70%;padding-left:12px;">
361 <p style="font-size:12px;color:rgb(107,114,128);line-height:20px;margin: 0;">
362 <?php echo esc_html__('Upgrade Discount', 'fluent-cart'); ?>
363 </p>
364 </td>
365 <td style="width:30%;text-align:right">
366 <p style="font-size:12px;color:rgb(107,114,128);margin:0;line-height:20px;">
367 <?php echo esc_html(\FluentCart\App\Helpers\Helper::toDecimal($upgradeDiscount)); ?>
368 </p>
369 </td>
370 </tr>
371 <?php endif; ?>
372 <?php if ($prorateCredit > 0 && !$onlyProrateCredit): ?>
373 <tr style="width:100%">
374 <td style="width:70%;padding-left:12px;">
375 <p style="font-size:12px;color:rgb(107,114,128);line-height:20px;margin: 0;">
376 <?php echo esc_html__('Prorate Credit', 'fluent-cart'); ?>
377 </p>
378 </td>
379 <td style="width:30%;text-align:right">
380 <p style="font-size:12px;color:rgb(107,114,128);margin:0;line-height:20px;">
381 <?php echo esc_html(\FluentCart\App\Helpers\Helper::toDecimal($prorateCredit)); ?>
382 </p>
383 </td>
384 </tr>
385 <?php endif; ?>
386 <?php endif; ?>
387
388 <?php
389 $emailTaxSummary = isset($emailTaxSummaryEarly) ? $emailTaxSummaryEarly : (($order instanceof \FluentCart\App\Models\Order)
390 ? TaxSummaryHelper::computeTaxSummary($order)
391 : ['shouldRender' => false]);
392 if ($emailTaxSummary['shouldRender']):
393 $emailFoldedRateLines = Arr::get($emailTaxSummary, 'foldedRateLines', []);
394 $emailIncludedInPrices = (int) Arr::get($emailTaxSummary, 'includedInPrices', 0);
395 $emailPayableTax = (int) Arr::get($emailTaxSummary, 'payableTax', 0);
396 $emailTotalOrderTax = (int) Arr::get($emailTaxSummary, 'totalOrderTax', 0);
397 ?>
398 </tbody>
399 </table><!-- /Zone A -->
400 <!-- Zone B: tax breakdown inside its own grey box -->
401 <table role="presentation" align="right" width="400"
402 style="border-spacing:0;border-collapse:collapse;margin:12px 0 0 auto;width:400px;max-width:100%;border:none;">
403 <tbody>
404 <tr>
405 <td style="background-color:rgb(249,250,251);padding:16px;border-radius:8px;">
406 <table role="presentation" width="100%"
407 style="width:100%;border-spacing:0;border-collapse:collapse;border:none;">
408 <tbody>
409 <?php if (($emailTaxSummary['displayMode'] ?? '') === 'simplified' && !empty($emailTaxSummary['simpleLine'])): ?>
410 <tr style="width:100%">
411 <td style="width:70%">
412 <p style="font-size:14px; font-weight:700; color:#1e293b; line-height:24px; margin:0;">
413 <?php echo esc_html($emailTaxSummary['simpleLine']['label']); ?>
414 </p>
415 </td>
416 <td style="width:30%; text-align:right">
417 <p style="font-size:14px; font-weight:700; color:#1e293b; margin:0; line-height:24px;">
418 <?php echo esc_html($emailTaxSummary['simpleLine']['value']); ?>
419 </p>
420 </td>
421 </tr>
422 <?php endif; ?>
423 <?php if (($emailTaxSummary['displayMode'] ?? '') !== 'simplified'): ?>
424 <tr style="width:100%">
425 <td colspan="2" style="padding:0 0 4px;">
426 <p style="font-size:10px; font-weight:600; text-transform:uppercase;
427 letter-spacing:0.06em; color:#94a3b8; margin:0;">
428 <?php if (!empty($emailFoldedRateLines)): ?>
429 <?php echo esc_html__('Tax breakdown by rate', 'fluent-cart'); ?>
430 <?php else: ?>
431 <?php echo esc_html__('TAX', 'fluent-cart'); ?>
432 <?php endif; ?>
433 </p>
434 </td>
435 </tr>
436 <?php
437 $rcReversedTotal = (int) Arr::get($emailTaxSummary, 'reversedTaxTotal', 0);
438 $rcReversedShipping = (int) Arr::get($emailTaxSummary, 'reversedShippingTax', 0);
439 $rcReversedValue = $rcReversedTotal > 0
440 ? \FluentCart\App\Helpers\Helper::toDecimal($rcReversedTotal)
441 : __('Charge reversed', 'fluent-cart');
442 ?>
443 <?php if (!empty($emailFoldedRateLines)): ?>
444 <tr style="width:100%">
445 <td colspan="2" style="padding:0 0 4px;">
446 <table style="width:100%;border-collapse:collapse;border-spacing:0;table-layout:fixed;">
447 <tbody>
448 <tr>
449 <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;">
450 <?php echo esc_html__('Rate', 'fluent-cart'); ?>
451 </td>
452 <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;">
453 <?php echo esc_html__('Taxable base', 'fluent-cart'); ?>
454 </td>
455 <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;">
456 <?php echo esc_html__('Tax', 'fluent-cart'); ?>
457 </td>
458 </tr>
459 <?php foreach ($emailFoldedRateLines as $emailFoldedLine):
460 $emailFoldedColor = !empty($emailFoldedLine['inclusive']) ? '#94a3b8' : '#1e293b';
461 ?>
462 <tr>
463 <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;">
464 <?php echo esc_html($emailFoldedLine['label']); ?>
465 </td>
466 <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;">
467 <?php echo esc_html(\FluentCart\App\Helpers\Helper::toDecimal($emailFoldedLine['base'])); ?>
468 </td>
469 <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;">
470 <?php echo esc_html(\FluentCart\App\Helpers\Helper::toDecimal($emailFoldedLine['tax'])); ?>
471 </td>
472 </tr>
473 <?php endforeach; ?>
474 </tbody>
475 </table>
476 </td>
477 </tr>
478 <?php if ($emailTaxSummary['isReverseCharge']): ?>
479 <tr style="width:100%">
480 <td style="width:70%">
481 <p style="font-size:14px; font-weight:700; color:#1e293b; line-height:24px; margin:0; border-top:1px solid #e2e8f0; padding-top:4px;">
482 <?php echo esc_html__('VAT reversed', 'fluent-cart'); ?>
483 </p>
484 </td>
485 <td style="width:30%; text-align:right">
486 <p style="font-size:14px; font-weight:700; color:#1e293b; margin:0; line-height:24px; border-top:1px solid #e2e8f0; padding-top:4px;">
487 <?php echo esc_html($rcReversedValue); ?>
488 </p>
489 </td>
490 </tr>
491 <?php else: ?>
492 <tr style="width:100%">
493 <td style="width:70%">
494 <p style="font-size:14px; font-weight:700; color:#1e293b; line-height:24px; margin:0; border-top:1px solid #e2e8f0; padding-top:4px;">
495 <?php echo esc_html__('Total tax', 'fluent-cart'); ?>
496 </p>
497 </td>
498 <td style="width:30%; text-align:right">
499 <p style="font-size:14px; font-weight:700; color:#1e293b; margin:0; line-height:24px; border-top:1px solid #e2e8f0; padding-top:4px;">
500 <?php echo esc_html(\FluentCart\App\Helpers\Helper::toDecimal($emailTotalOrderTax)); ?>
501 </p>
502 </td>
503 </tr>
504 <?php if ($emailIncludedInPrices > 0): ?>
505 <tr style="width:100%">
506 <td style="width:70%">
507 <p style="font-size:13px; color:#94a3b8; line-height:22px; margin:0;">
508 <?php echo esc_html__('of which included in prices', 'fluent-cart'); ?>
509 </p>
510 </td>
511 <td style="width:30%; text-align:right">
512 <p style="font-size:13px; color:#94a3b8; margin:0; line-height:22px;">
513 <?php echo esc_html(\FluentCart\App\Helpers\Helper::toDecimal($emailIncludedInPrices)); ?>
514 </p>
515 </td>
516 </tr>
517 <?php endif; ?>
518 <?php if ($emailPayableTax > 0 && $emailIncludedInPrices > 0): ?>
519 <tr style="width:100%">
520 <td style="width:70%;border-top:1px solid #e2e8f0;padding-top:6px;margin-top:6px;">
521 <p style="font-size:14px; font-weight:700; color:#1e293b; line-height:24px; margin:0;">
522 <?php echo esc_html__('Payable now (added)', 'fluent-cart'); ?>
523 </p>
524 </td>
525 <td style="width:30%; text-align:right;border-top:1px solid #e2e8f0;padding-top:6px;margin-top:6px;">
526 <p style="font-size:14px; font-weight:700; color:#1e293b; margin:0; line-height:24px;">
527 <?php echo esc_html(\FluentCart\App\Helpers\Helper::toDecimal($emailPayableTax)); ?>
528 </p>
529 </td>
530 </tr>
531 <?php endif; ?>
532 <?php endif; ?>
533 <?php elseif ($emailTaxSummary['isReverseCharge']): ?>
534 <?php if ($emailTaxSummary['showRcShippingRow'] && $rcReversedShipping > 0): ?>
535 <tr style="width:100%">
536 <td style="width:70%">
537 <p style="font-size:14px; color:#94a3b8; line-height:24px; margin:0;">
538 <?php echo esc_html__('Added on shipping', 'fluent-cart'); ?>
539 </p>
540 </td>
541 <td style="width:30%; text-align:right">
542 <p style="font-size:14px; color:#94a3b8; margin:0; line-height:24px;">
543 <span style="text-decoration:line-through;opacity:0.6;"><?php echo esc_html(\FluentCart\App\Helpers\Helper::toDecimal($rcReversedShipping)); ?></span>
544 </p>
545 </td>
546 </tr>
547 <?php endif; ?>
548 <tr style="width:100%">
549 <td style="width:70%">
550 <p style="font-size:14px; font-weight:700; color:#1e293b; line-height:24px; margin:0;">
551 <?php echo esc_html__('Tax reversed', 'fluent-cart'); ?>
552 </p>
553 </td>
554 <td style="width:30%; text-align:right">
555 <p style="font-size:14px; font-weight:700; color:#1e293b; margin:0; line-height:24px;">
556 <?php echo esc_html($rcReversedValue); ?>
557 </p>
558 </td>
559 </tr>
560 <?php else: ?>
561 <?php
562 $emailFeeRowsList = Arr::get($emailTaxSummary, 'feeTaxLineRows', []);
563 $emailTaxRateLines = Arr::get($emailTaxSummary, 'taxRateLines', []);
564 $emailShippingLines = Arr::get($emailTaxSummary, 'shippingTaxLines', []);
565 $productTaxRowCount = !empty($emailTaxRateLines)
566 ? count($emailTaxRateLines)
567 : (int) ($emailTaxSummary['inclusiveTax'] > 0) + (int) ($emailTaxSummary['exclusiveTax'] > 0);
568 $rowCount = $productTaxRowCount + count($emailFeeRowsList) + (int) ($emailTaxSummary['shippingTax'] > 0);
569 $shouldShowBreakdown = !empty($emailTaxRateLines)
570 || !empty($emailShippingLines)
571 || $rowCount >= 2
572 || ($rowCount === 1 && !($emailTaxSummary['payableTax'] > 0 || $emailTaxSummary['inclusiveTax'] > 0 || (int) Arr::get($emailTaxSummary, 'inclusiveFeeTax', 0) > 0));
573 ?>
574 <?php if (!empty($emailTaxRateLines) && $shouldShowBreakdown): ?>
575 <?php foreach ($emailTaxRateLines as $emailTaxRateLine):
576 $emailTaxRateColor = !empty($emailTaxRateLine['inclusive']) ? '#94a3b8' : '#1e293b';
577 $emailTaxRateWeight = !empty($emailTaxRateLine['inclusive']) ? 'normal' : '600'; ?>
578 <tr style="width:100%">
579 <td style="width:70%">
580 <p style="font-size:14px; font-weight:<?php echo esc_attr($emailTaxRateWeight); ?>; color:<?php echo esc_attr($emailTaxRateColor); ?>; line-height:24px; margin:0;">
581 <?php echo esc_html($emailTaxRateLine['label']); ?>
582 </p>
583 </td>
584 <td style="width:30%; text-align:right">
585 <p style="font-size:14px; font-weight:<?php echo esc_attr($emailTaxRateWeight); ?>; color:<?php echo esc_attr($emailTaxRateColor); ?>; margin:0; line-height:24px;">
586 <?php echo esc_html(\FluentCart\App\Helpers\Helper::toDecimal($emailTaxRateLine['order_tax'])); ?>
587 </p>
588 </td>
589 </tr>
590 <?php endforeach; ?>
591 <?php endif; ?>
592 <?php if (empty($emailTaxRateLines) && $emailTaxSummary['inclusiveTax'] > 0 && $shouldShowBreakdown): ?>
593 <tr style="width:100%">
594 <td style="width:70%">
595 <p style="font-size:14px; color:#94a3b8; line-height:24px; margin:0;">
596 <?php echo esc_html__('Included in item prices', 'fluent-cart'); ?>
597 </p>
598 </td>
599 <td style="width:30%; text-align:right">
600 <p style="font-size:14px; color:#94a3b8; margin:0; line-height:24px;">
601 <?php echo esc_html(\FluentCart\App\Helpers\Helper::toDecimal($emailTaxSummary['inclusiveTax'])); ?>
602 </p>
603 </td>
604 </tr>
605 <?php endif; ?>
606 <?php if (empty($emailTaxRateLines) && $emailTaxSummary['exclusiveTax'] > 0 && $shouldShowBreakdown): ?>
607 <tr style="width:100%">
608 <td style="width:70%">
609 <p style="font-size:14px; font-weight:600; color:#1e293b; line-height:24px; margin:0;">
610 <?php echo esc_html__('Added on products', 'fluent-cart'); ?>
611 </p>
612 </td>
613 <td style="width:30%; text-align:right">
614 <p style="font-size:14px; font-weight:600; color:#1e293b; margin:0; line-height:24px;">
615 <?php echo esc_html(\FluentCart\App\Helpers\Helper::toDecimal($emailTaxSummary['exclusiveTax'])); ?>
616 </p>
617 </td>
618 </tr>
619 <?php endif; ?>
620 <?php if ($shouldShowBreakdown) : ?>
621 <?php foreach ($emailFeeRowsList as $emailFeeRow):
622 $emailFeeColor = $emailFeeRow['inclusive'] ? '#94a3b8' : '#1e293b';
623 $emailFeeWeight = $emailFeeRow['inclusive'] ? 'normal' : '600'; ?>
624 <tr style="width:100%">
625 <td style="width:70%">
626 <p style="font-size:14px; font-weight:<?php echo esc_attr($emailFeeWeight); ?>; color:<?php echo esc_attr($emailFeeColor); ?>; line-height:24px; margin:0;">
627 <?php echo esc_html($emailFeeRow['display_label']); ?>
628 </p>
629 </td>
630 <td style="width:30%; text-align:right">
631 <p style="font-size:14px; font-weight:<?php echo esc_attr($emailFeeWeight); ?>; color:<?php echo esc_attr($emailFeeColor); ?>; margin:0; line-height:24px;">
632 <?php echo esc_html(\FluentCart\App\Helpers\Helper::toDecimal($emailFeeRow['tax_amount'])); ?>
633 </p>
634 </td>
635 </tr>
636 <?php endforeach; ?>
637 <?php endif; ?>
638 <?php if ($emailTaxSummary['shippingTax'] > 0 && $shouldShowBreakdown):
639 $isShippingInclusive = (bool) Arr::get($emailTaxSummary, 'isShippingInclusive', false);
640 $emailShippingColor = $isShippingInclusive ? '#94a3b8' : '#1e293b';
641 $emailShippingWeight = $isShippingInclusive ? 'normal' : '600';
642 if (!empty($emailShippingLines)):
643 foreach ($emailShippingLines as $shLine): ?>
644 <tr style="width:100%">
645 <td style="width:70%">
646 <p style="font-size:14px; font-weight:<?php echo esc_attr($emailShippingWeight); ?>; color:<?php echo esc_attr($emailShippingColor); ?>; line-height:24px; margin:0;">
647 <?php echo esc_html($shLine['label']); ?>
648 </p>
649 </td>
650 <td style="width:30%; text-align:right">
651 <p style="font-size:14px; font-weight:<?php echo esc_attr($emailShippingWeight); ?>; color:<?php echo esc_attr($emailShippingColor); ?>; margin:0; line-height:24px;">
652 <?php echo esc_html(\FluentCart\App\Helpers\Helper::toDecimal($shLine['shipping_tax'])); ?>
653 </p>
654 </td>
655 </tr>
656 <?php endforeach;
657 else: ?>
658 <tr style="width:100%">
659 <td style="width:70%">
660 <p style="font-size:14px; font-weight:<?php echo esc_attr($emailShippingWeight); ?>; color:<?php echo esc_attr($emailShippingColor); ?>; line-height:24px; margin:0;">
661 <?php echo esc_html($isShippingInclusive ? __('Included in shipping prices', 'fluent-cart') : __('Added on shipping', 'fluent-cart')); ?>
662 </p>
663 </td>
664 <td style="width:30%; text-align:right">
665 <p style="font-size:14px; font-weight:<?php echo esc_attr($emailShippingWeight); ?>; color:<?php echo esc_attr($emailShippingColor); ?>; margin:0; line-height:24px;">
666 <?php echo esc_html(\FluentCart\App\Helpers\Helper::toDecimal($emailTaxSummary['shippingTax'])); ?>
667 </p>
668 </td>
669 </tr>
670 <?php endif; ?>
671 <?php endif; ?>
672 <?php if ($emailTaxSummary['payableTax'] > 0): ?>
673 <tr style="width:100%">
674 <td style="width:70%">
675 <p style="font-size:14px; font-weight:700; color:#1e293b; line-height:24px; margin:0; border-top:1px solid #e2e8f0; padding-top:4px;">
676 <?php echo esc_html__('Total payable tax', 'fluent-cart'); ?>
677 </p>
678 </td>
679 <td style="width:30%; text-align:right">
680 <p style="font-size:14px; font-weight:700; color:#1e293b; margin:0; line-height:24px; border-top:1px solid #e2e8f0; padding-top:4px;">
681 <?php echo esc_html(\FluentCart\App\Helpers\Helper::toDecimal($emailTaxSummary['payableTax'])); ?>
682 </p>
683 </td>
684 </tr>
685 <?php endif; ?>
686 <?php if ($emailTaxSummary['inclusiveTax'] > 0 || $emailTaxSummary['inclusiveFeeTax'] > 0): ?>
687 <tr style="width:100%">
688 <td style="width:70%">
689 <p style="font-size:14px; font-weight:normal; color:#94a3b8; line-height:24px; margin:0;">
690 <?php echo esc_html__('Total tax in this order', 'fluent-cart'); ?>
691 </p>
692 </td>
693 <td style="width:30%; text-align:right">
694 <p style="font-size:14px; font-weight:normal; color:#94a3b8; margin:0; line-height:24px;">
695 <?php echo esc_html(\FluentCart\App\Helpers\Helper::toDecimal($emailTaxSummary['totalOrderTax'])); ?>
696 </p>
697 </td>
698 </tr>
699 <?php endif; ?>
700 <?php endif; ?>
701 <?php endif; ?>
702 </tbody>
703 </table>
704 </td>
705 </tr>
706 </tbody>
707 </table><!-- /Zone B: grey tax box -->
708 <table role="presentation" width="400"
709 style="margin:12px 0 0 auto; width: 400px; max-width: 100%; border: none;">
710 <tbody>
711 <!-- Zone C: plain refund / total / payment -->
712 <?php endif; ?>
713
714 <?php if ($order->total_refund > 0 && $isRefund): ?>
715 <tr style="width:100%">
716 <td style="width:70%">
717 <p style="font-size:14px;color:rgb(55,65,81);line-height:24px;margin: 0;">
718 <?php echo esc_html__('Refund', 'fluent-cart'); ?>
719 </p>
720 </td>
721 <td style="width:30%;text-align:right">
722 <p style="font-size:14px;color:rgb(55,65,81);margin:0;line-height:24px;">
723 - <?php echo esc_html(\FluentCart\App\Helpers\Helper::toDecimal($order->total_refund)); ?>
724 </p>
725 </td>
726 </tr>
727 <?php endif; ?>
728
729 <?php
730 $emailDisplayTotal = max(0, (int) $order->total_amount - (int) $order->total_refund
731 - (int) \FluentCart\Framework\Support\Arr::get($emailTaxSummaryEarly ?? [], 'rcTotalAdjustment', 0));
732 ?>
733 <tr style="width:100%">
734 <td style="width:70%"><p
735 style="font-size:16px;font-weight:700;color:rgb(17,24,39);line-height:24px;margin: 0;">
736 <?php echo esc_html__('Total', 'fluent-cart'); ?>
737 </p>
738 </td>
739 <td style="width:30%;text-align:right">
740 <p style="font-size:14px;font-weight:700;color:rgb(17,24,39);line-height:24px;margin: 0;">
741 <?php echo esc_html(\FluentCart\Api\CurrencySettings::getFormattedPrice($emailDisplayTotal, null, false, true, true)); ?>
742 </p>
743 </td>
744 </tr>
745
746 <?php if ($order->total_refund > 0 && !$isRefund): ?>
747 <tr style="width:100%">
748 <td style="width:70%">
749 <p style="font-size:14px;color:rgb(55,65,81);line-height:24px;margin: 0;">
750 <?php echo esc_html__('Refund', 'fluent-cart'); ?>
751 </p>
752 </td>
753 <td style="width:30%;text-align:right">
754 <p style="font-size:14px;color:rgb(55,65,81);margin:0;line-height:24px;">
755 - <?php echo esc_html(\FluentCart\App\Helpers\Helper::toDecimal($order->total_refund)); ?>
756 </p>
757 </td>
758 </tr>
759 <?php endif; ?>
760
761 <tr style="width:100%">
762 <td style="width:70%">
763 <p style="font-size:14px;color:rgb(55,65,81);line-height:24px;margin: 0;">
764 <?php echo esc_html__('Payment Method', 'fluent-cart'); ?>
765 </p>
766 </td>
767 <td style="width:30%;text-align:right">
768 <p style="text-transform:uppercase;font-size:13px;color:rgb(55,65,81);margin:0;line-height:24px;">
769 <?php echo esc_html($transaction ? $transaction->getPaymentMethodText() : ''); ?>
770 </p>
771 </td>
772 </tr>
773 </tbody>
774 </table>
775 <?php
776 if($order->isReverseChargeTaxOrder()): ?>
777 <div style="text-align: right; font-size: 14px; margin-top: 10px;">
778 <?php echo '*' . esc_html(TaxModule::getReverseChargeNoticeText()); ?>
779 </div>
780
781 <?php endif ?>
782 </td>
783 </tr>
784 </table>
785