PluginProbe
FluentCart A New Era of eCommerce – Faster, Lighter, and Simpler / 1.6.6
FluentCart A New Era of eCommerce – Faster, Lighter, and Simpler v1.6.6
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.6.6, at app/Views/emails/parts/items_table.php

791 lines 49.5 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\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; ?>
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 $emailShippingMethodTitle = (string) \FluentCart\Framework\Support\Arr::get($order->config, 'shipping_method_title', '');
311 ?>
312 <tr style="width:100%">
313 <td style="width:70%">
314 <p style="font-size:14px;color:rgb(55,65,81);line-height:24px;margin: 0;">
315 <?php echo esc_html__('Shipping', 'fluent-cart'); ?>
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; ?>
322 </td>
323 <td style="width:30%;text-align:right">
324 <p style="font-size:14px;color:rgb(55,65,81);margin:0;line-height:24px;">
325 <?php echo esc_html(\FluentCart\App\Helpers\Helper::toDecimal($emailDisplayShipping)); ?>
326 </p>
327 </td>
328 </tr>
329 <?php endif; ?>
330 <?php foreach ($feeItems as $feeItem): ?>
331 <tr style="width:100%">
332 <td style="width:70%">
333 <p style="font-size:14px;color:rgb(55,65,81);line-height:24px;margin: 0;">
334 <?php echo esc_html($feeItem['title']); ?>
335 </p>
336 </td>
337 <td style="width:30%;text-align:right">
338 <p style="font-size:14px;color:rgb(55,65,81);margin:0;line-height:24px;">
339 <?php echo esc_html(\FluentCart\App\Helpers\Helper::toDecimal($feeItem['subtotal'])); ?>
340 </p>
341 </td>
342 </tr>
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): ?>
352 <tr style="width:100%">
353 <td style="width:70%">
354 <p style="font-size:14px;color:rgb(55,65,81);line-height:24px;margin: 0;">
355 <?php echo $onlyProrateCredit ? esc_html__('Prorate Credit', 'fluent-cart') : esc_html__('Discount', 'fluent-cart'); ?>
356 </p>
357 </td>
358 <td style="width:30%;text-align:right">
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)); ?>
361 </p>
362 </td>
363 </tr>
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'])): ?>
416 <tr style="width:100%">
417 <td style="width:70%">
418 <p style="font-size:14px; font-weight:700; color:#1e293b; line-height:24px; margin:0;">
419 <?php echo esc_html($emailTaxSummary['simpleLine']['label']); ?>
420 </p>
421 </td>
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']); ?>
425 </p>
426 </td>
427 </tr>
428 <?php endif; ?>
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)): ?>
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%">
486 <td style="width:70%">
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'); ?>
489 </p>
490 </td>
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); ?>
494 </p>
495 </td>
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; ?>
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; ?>
719
720 <?php if ($order->total_refund > 0 && $isRefund): ?>
721 <tr style="width:100%">
722 <td style="width:70%">
723 <p style="font-size:14px;color:rgb(55,65,81);line-height:24px;margin: 0;">
724 <?php echo esc_html__('Refund', 'fluent-cart'); ?>
725 </p>
726 </td>
727 <td style="width:30%;text-align:right">
728 <p style="font-size:14px;color:rgb(55,65,81);margin:0;line-height:24px;">
729 - <?php echo esc_html(\FluentCart\App\Helpers\Helper::toDecimal($order->total_refund)); ?>
730 </p>
731 </td>
732 </tr>
733 <?php endif; ?>
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 ?>
739 <tr style="width:100%">
740 <td style="width:70%"><p
741 style="font-size:16px;font-weight:700;color:rgb(17,24,39);line-height:24px;margin: 0;">
742 <?php echo esc_html__('Total', 'fluent-cart'); ?>
743 </p>
744 </td>
745 <td style="width:30%;text-align:right">
746 <p style="font-size:14px;font-weight:700;color:rgb(17,24,39);line-height:24px;margin: 0;">
747 <?php echo esc_html(\FluentCart\Api\CurrencySettings::getFormattedPrice($emailDisplayTotal, null, false, true, true)); ?>
748 </p>
749 </td>
750 </tr>
751
752 <?php if ($order->total_refund > 0 && !$isRefund): ?>
753 <tr style="width:100%">
754 <td style="width:70%">
755 <p style="font-size:14px;color:rgb(55,65,81);line-height:24px;margin: 0;">
756 <?php echo esc_html__('Refund', 'fluent-cart'); ?>
757 </p>
758 </td>
759 <td style="width:30%;text-align:right">
760 <p style="font-size:14px;color:rgb(55,65,81);margin:0;line-height:24px;">
761 - <?php echo esc_html(\FluentCart\App\Helpers\Helper::toDecimal($order->total_refund)); ?>
762 </p>
763 </td>
764 </tr>
765 <?php endif; ?>
766
767 <tr style="width:100%">
768 <td style="width:70%">
769 <p style="font-size:14px;color:rgb(55,65,81);line-height:24px;margin: 0;">
770 <?php echo esc_html__('Payment Method', 'fluent-cart'); ?>
771 </p>
772 </td>
773 <td style="width:30%;text-align:right">
774 <p style="text-transform:uppercase;font-size:13px;color:rgb(55,65,81);margin:0;line-height:24px;">
775 <?php echo esc_html($transaction ? $transaction->getPaymentMethodText() : ''); ?>
776 </p>
777 </td>
778 </tr>
779 </tbody>
780 </table>
781 <?php
782 if($order->isReverseChargeTaxOrder()): ?>
783 <div style="text-align: right; font-size: 14px; margin-top: 10px;">
784 <?php echo '*' . esc_html(TaxModule::getReverseChargeNoticeText()); ?>
785 </div>
786
787 <?php endif ?>
788 </td>
789 </tr>
790 </table>
791