PluginProbe
FluentCart A New Era of eCommerce – Faster, Lighter, and Simpler / 1.5.2
FluentCart A New Era of eCommerce – Faster, Lighter, and Simpler v1.5.2
1.7.0 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 All 50 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.2, at app/Views/emails/parts/items_table.php

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