PluginProbe
FluentCart A New Era of eCommerce – Faster, Lighter, and Simpler / 1.7.0
FluentCart A New Era of eCommerce – Faster, Lighter, and Simpler v1.7.0
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
← All changes | app/Services/Renderer/Receipt/ReceiptRenderer.php +237 -153 1.4.2 → 1.7.0 View file →
@@ -8,8 +8,9 @@
8 8 use FluentCart\Api\StoreSettings;
9 9 use FluentCart\App\Helpers\AddressHelper;
10 10 use FluentCart\App\Modules\Tax\TaxModule;
11 11 use FluentCart\App\Services\DateTime\DateTime;
12 +use FluentCart\App\Services\DateTime\DateFormatter;
12 13
13 14 class ReceiptRenderer
14 15 {
15 16 protected $config = null;
@@ -23,8 +24,10 @@
23 24 protected $vat_tax_id = null;
24 25
25 26 protected $orderTz;
26 27
28 + private $fctTaxSummaryCache = [];
29 +
27 30 public function __construct($config = [])
28 31 {
29 32 $this->config = $config;
30 33
@@ -35,8 +38,20 @@
35 38
36 39 $this->orderTz = Arr::get($this->config, 'user_tz', 'UTC');
37 40 }
38 41
42 + private function getMemoizedTaxSummary($order)
43 + {
44 + if (!$order) {
45 + return TaxSummaryHelper::computeTaxSummary($order);
46 + }
47 + $id = (int) $order->id;
48 + if (!isset($this->fctTaxSummaryCache[$id])) {
49 + $this->fctTaxSummaryCache[$id] = TaxSummaryHelper::computeTaxSummary($order);
50 + }
51 + return $this->fctTaxSummaryCache[$id];
52 + }
53 +
39 54 public function wrapperStart()
40 55 {
41 56 ?>
42 57 <div
@@ -228,12 +243,14 @@
228 243 <?php echo esc_html__('Order At', 'fluent-cart'); ?>
229 244 </p>
230 245 <p style="white-space: nowrap; font-weight: bold; color: #000; text-align: right; margin: 0;font-size:14px;">
231 246 <?php
232 - $date = wp_date(
233 - get_option('date_format'),
247 + // Through DateFormatter so the store's format and timezone settings
248 + // reach this too; orderTz is only consulted on the Browser source.
249 + $date = DateFormatter::format(
234 250 DateTime::anyTimeToGmt($order->created_at)->getTimestamp(),
235 - new \DateTimeZone($this->orderTz)
251 + false,
252 + $this->orderTz
236 253 );
237 254 echo esc_html(Helper::translateNumber($date));
238 255 ?>
239 256 </p>
@@ -495,8 +512,9 @@
495 512 <?php
496 513 $orderItems = $order->order_items->toArray();
497 514 $isReversed = $order->isReverseChargeTaxOrder();
498 515 $rcMode = $order->getOrderRcMode();
516 + $fctReceiptTaxDisplayMode = TaxSummaryHelper::getTaxDisplayMode();
499 517
500 518 foreach ($orderItems as $item) :
501 519 if (($item['payment_type'] ?? '') === 'fee') {
502 520 continue;
@@ -508,15 +526,15 @@
508 526 <td style="font-size:15px;padding: 12px 8px;border: none;border-bottom: <?php echo esc_attr($itemBorder); ?>;print-color-adjust: exact;">
509 527 <?php echo esc_html($item['post_title']); ?>
510 528 <br>
511 529 <?php if (!empty($item['title'])) : ?>
512 - <small style="font-size: 13px;color: #758195;">- <?php echo esc_html($item['title']); ?></small>
530 + <small style="font-size: 13px;color: #758195;">- <?php echo esc_html(!empty($item['variation_display_title']) ? $item['variation_display_title'] : $item['title']); ?></small>
513 531 <br>
514 532 <?php endif; ?>
515 533 <?php if (!empty($item['payment_info'])) : ?>
516 534 <small style="font-size: 13px;color: #758195;"><?php echo esc_html($item['payment_info']); ?></small>
517 535 <?php endif; ?>
518 - <?php if (empty($itemRates) && !empty($item['tax_amount'])) : ?>
536 + <?php if ($fctReceiptTaxDisplayMode !== 'simplified' && empty($itemRates) && !empty($item['tax_amount'])) : ?>
519 537 <small style="font-size: 12px; color: #94a3b8; display:block; margin-top:2px;">
520 538 <?php
521 539 /* translators: %1$s: formatted tax amount */
522 540 echo esc_html(sprintf(__('Tax: %1$s', 'fluent-cart'), Helper::toDecimal((int) $item['tax_amount']))); ?>
@@ -538,9 +556,9 @@
538 556 <?php endif; ?>
539 557 <?php echo esc_html($item['formatted_total']); ?>
540 558 </td>
541 559 </tr>
542 - <?php if (!empty($itemRates)) : ?>
560 + <?php if ($fctReceiptTaxDisplayMode !== 'simplified' && !empty($itemRates)) : ?>
543 561 <tr>
544 562 <td colspan="4" style="padding:0 8px 8px 8px;border:none;border-bottom:1px solid #dee2e6;">
545 563 <?php echo $this->renderTaxRatePills($itemRates, $isReversed, $rcMode); ?>
546 564 </td>
@@ -647,17 +665,23 @@
647 665 return;
648 666 }
649 667 $displayShipping = (int) $order->shipping_total;
650 668 if ($order->isReverseChargeTaxOrder()) {
651 - $rcAdj = (int) Arr::get(\FluentCart\App\Services\Renderer\Receipt\TaxSummaryHelper::computeTaxSummary($order), 'rcShippingAdjustment', 0);
669 + $rcAdj = (int) Arr::get($this->getMemoizedTaxSummary($order), 'rcShippingAdjustment', 0);
652 670 if ($rcAdj > 0) {
653 671 $displayShipping = max(0, $displayShipping - $rcAdj);
654 672 }
655 673 }
674 + $shippingMethodTitle = (string) Arr::get($order->config, 'shipping_method_title', '');
656 675 ?>
657 676 <tr>
658 677 <td style="padding: 8px 20px 8px 0;text-align: right;border: none;">
659 678 <?php echo esc_html__('Shipping', 'fluent-cart'); ?>
679 + <?php if ($shippingMethodTitle): ?>
680 + <span style="display:block;font-size:12px;color:rgb(107,114,128);line-height:18px;">
681 + <?php echo esc_html($shippingMethodTitle); ?>
682 + </span>
683 + <?php endif; ?>
660 684 </td>
661 685 <td style="padding: 8px 8px 8px 0;width: 100px;text-align: right;border: none;">
662 686 <?php echo esc_html(\FluentCart\App\Helpers\Helper::toDecimal($displayShipping)); ?>
663 687 </td>
@@ -683,66 +707,8 @@
683 707 </tr>
684 708 <?php endforeach;
685 709 }
686 710
687 - public function renderTaxTotal()
688 - {
689 - $order = Arr::get($this->config, 'order', null);
690 -
691 - if ($order->isReverseChargeTaxOrder()): ?>
692 - <?php
693 - $rcReversedTotal = $order->getReversedTaxTotal();
694 - $rcChargeLabel = $rcReversedTotal > 0
695 - ? sprintf(
696 - /* translators: %1$s: formatted reversed tax amount */
697 - __('Tax reversed: %1$s', 'fluent-cart'),
698 - Helper::toDecimal($rcReversedTotal)
699 - )
700 - : __('Charge reversed', 'fluent-cart');
701 - ?>
702 - <tr>
703 - <td style="padding: 8px 20px 8px 0;text-align: right;border: none;">
704 - <?php echo esc_html__('Tax', 'fluent-cart'); ?>
705 - </td>
706 - <td style="padding: 8px 8px 8px 0;width: 100px;text-align: right;border: none;">
707 - <?php echo esc_html($rcChargeLabel); ?>
708 - </td>
709 - </tr>
710 - <?php elseif ($order->tax_total > 0): ?>
711 - <tr>
712 - <td style="padding: 8px 20px 8px 0;text-align: right;border: none;">
713 - <?php echo esc_html__('Tax', 'fluent-cart');
714 - echo esc_html(\FluentCart\App\Helpers\Helper::getOrderTaxLabel($order));
715 - ?>
716 - </td>
717 - <td style="padding: 8px 8px 8px 0;width: 100px;text-align: right;border: none;">
718 - <?php echo esc_html(\FluentCart\App\Helpers\Helper::toDecimal($order->tax_total)); ?>
719 - </td>
720 - </tr>
721 - <?php endif;
722 - }
723 -
724 - public function renderShippingTax()
725 - {
726 - $order = Arr::get($this->config, 'order', null);
727 -
728 - if ($order->shipping_tax <= 0) {
729 - return;
730 - }
731 - ?>
732 - <tr>
733 - <td style="padding: 8px 20px 8px 0;text-align: right;border: none;">
734 - <?php echo esc_html__('Shipping Tax', 'fluent-cart');
735 - echo esc_html(\FluentCart\App\Helpers\Helper::getOrderTaxLabel($order));
736 - ?>
737 - </td>
738 - <td style="padding: 8px 8px 8px 0;width: 100px;text-align: right;border: none;">
739 - <?php echo esc_html(\FluentCart\App\Helpers\Helper::toDecimal($order->shipping_tax)); ?>
740 - </td>
741 - </tr>
742 - <?php
743 - }
744 -
745 711 public function renderRefund()
746 712 {
747 713 $order = Arr::get($this->config, 'order', null);
748 714 if ($order->total_refund > 0): ?>
@@ -761,9 +727,9 @@
761 727 {
762 728 $order = Arr::get($this->config, 'order', null);
763 729 $displayTotal = (int) $order->total_amount - (int) $order->total_refund;
764 730 if ($order->isReverseChargeTaxOrder()) {
765 - $rcAdj = (int) Arr::get(\FluentCart\App\Services\Renderer\Receipt\TaxSummaryHelper::computeTaxSummary($order), 'rcTotalAdjustment', 0);
731 + $rcAdj = (int) Arr::get($this->getMemoizedTaxSummary($order), 'rcTotalAdjustment', 0);
766 732 if ($rcAdj > 0) {
767 733 $displayTotal = max(0, $displayTotal - $rcAdj);
768 734 }
769 735 }
@@ -799,9 +765,9 @@
799 765 $order = Arr::get($this->config, 'order', null);
800 766 if ($order->isReverseChargeTaxOrder()): ?>
801 767
802 768 <div style="text-align: right; font-size: 14px; margin-top: 10px;">
803 - <?php echo esc_html__('* Tax to be paid on reverse charge basis', 'fluent-cart'); ?>
769 + <?php echo '*' . esc_html(TaxModule::getReverseChargeNoticeText()); ?>
804 770 </div>
805 771
806 772 <?php endif;
807 773 }
@@ -846,12 +812,14 @@
846 812 <?php echo esc_html($transaction->getPaymentMethodText()); ?>
847 813 </td>
848 814 <td style="padding: 10px;border:none;border-bottom: 1px solid #dee2e6;text-align: center;">
849 815 <?php
850 - $date = wp_date(
851 - get_option('date_format'),
816 + // Same route as the Order At header above, or
817 + // one receipt renders two different formats.
818 + $date = DateFormatter::format(
852 819 DateTime::anyTimeToGmt($transaction->created_at)->getTimestamp(),
853 - new \DateTimeZone($this->orderTz)
820 + false,
821 + $this->orderTz
854 822 );
855 823 echo esc_html(Helper::translateNumber($date));
856 824 ?>
857 825 </td>
@@ -922,30 +890,122 @@
922 890
923 891 public function renderTaxSummaryBox()
924 892 {
925 893 $order = Arr::get($this->config, 'order', null);
926 - $summary = TaxSummaryHelper::computeTaxSummary($order);
894 + $summary = $this->getMemoizedTaxSummary($order);
927 895 if (!$summary['shouldRender']) {
928 896 return;
929 897 }
930 898 ?>
931 899 <tr>
932 - <td colspan="2" style="padding: 0 8px;">
900 + <td colspan="2" style="padding: 6px 8px;">
901 + <table width="100%" cellpadding="0" cellspacing="0" style="border:1px solid #e2e8f0; border-radius:6px; border-collapse:separate; background:#ffffff; -webkit-print-color-adjust:exact; print-color-adjust:exact;">
902 + <tr>
903 + <td style="padding:6px 8px 6px 0;">
933 904 <table width="100%" cellpadding="0" cellspacing="0" style="border:none;border-collapse:collapse;">
905 + <?php if (($summary['displayMode'] ?? '') === 'simplified' && !empty($summary['simpleLine'])): ?>
934 906 <tr>
935 - <td colspan="2" style="padding:6px 0 3px 0; font-size:10px; font-weight:600;
907 + <td style="padding:4px 0 3px 8px; font-size:11px; font-weight:600; color:#1e293b; text-align:left;">
908 + <?php echo esc_html($summary['simpleLine']['label']); ?>
909 + </td>
910 + <td style="padding:4px 0 3px; font-size:11px; font-weight:600; color:#1e293b; text-align:right;">
911 + <?php echo esc_html($summary['simpleLine']['value']); ?>
912 + </td>
913 + </tr>
914 + <?php endif; ?>
915 + <?php if (($summary['displayMode'] ?? '') !== 'simplified'): ?>
916 + <tr>
917 + <td colspan="2" style="padding:0 0 3px 0; font-size:10px; font-weight:600;
936 918 text-transform:uppercase; letter-spacing:0.06em; color:#64748b;">
937 - <?php echo esc_html__('TAX SUMMARY', 'fluent-cart'); ?>
919 + <?php if (!empty(Arr::get($summary, 'foldedRateLines', []))): ?>
920 + <?php echo esc_html__('Tax breakdown by rate', 'fluent-cart'); ?>
921 + <?php else: ?>
922 + <?php echo esc_html__('TAX SUMMARY', 'fluent-cart'); ?>
923 + <?php endif; ?>
938 924 </td>
939 925 </tr>
940 - <?php if ($summary['isReverseCharge']): ?>
941 - <?php
942 - $rcReversedTotal = (int) Arr::get($summary, 'reversedTaxTotal', 0);
943 - $rcReversedShipping = (int) Arr::get($summary, 'reversedShippingTax', 0);
944 - $rcReversedValue = $rcReversedTotal > 0
945 - ? Helper::toDecimal($rcReversedTotal)
946 - : __('Charge reversed', 'fluent-cart');
947 - ?>
926 + <?php
927 + $foldedRateLines = Arr::get($summary, 'foldedRateLines', []);
928 + $rcIsReverseCharge = !empty($summary['isReverseCharge']);
929 + $rcReversedTotal = (int) Arr::get($summary, 'reversedTaxTotal', 0);
930 + $rcReversedShipping = (int) Arr::get($summary, 'reversedShippingTax', 0);
931 + $rcReversedValue = $rcReversedTotal > 0
932 + ? Helper::toDecimal($rcReversedTotal)
933 + : __('Charge reversed', 'fluent-cart');
934 + $includedInPrices = (int) Arr::get($summary, 'includedInPrices', 0);
935 + ?>
936 + <?php if (!empty($foldedRateLines)): ?>
937 + <tr>
938 + <td colspan="2" style="padding:2px 0 0 0;">
939 + <table width="100%" cellpadding="0" cellspacing="0" style="border:none;border-collapse:collapse;table-layout:fixed;">
940 + <tr>
941 + <td style="width:58%;padding:3px 8px 3px 8px; font-size:10px; font-weight:600; text-transform:uppercase; letter-spacing:0.06em; color:#64748b; vertical-align:top;">
942 + <?php echo esc_html__('Rate', 'fluent-cart'); ?>
943 + </td>
944 + <td style="width:24%;padding:3px 8px 3px 0; font-size:10px; font-weight:600; text-transform:uppercase; letter-spacing:0.06em; color:#64748b; text-align:right; white-space:nowrap; vertical-align:top;">
945 + <?php echo esc_html__('Taxable base', 'fluent-cart'); ?>
946 + </td>
947 + <td style="width:18%;padding:3px 0 3px; font-size:10px; font-weight:600; text-transform:uppercase; letter-spacing:0.06em; color:#64748b; text-align:right; white-space:nowrap; vertical-align:top;">
948 + <?php echo esc_html__('Tax', 'fluent-cart'); ?>
949 + </td>
950 + </tr>
951 + <?php foreach ($foldedRateLines as $foldedRow):
952 + $foldedColor = !empty($foldedRow['inclusive']) ? '#94a3b8' : '#334155'; ?>
953 + <tr>
954 + <td style="width:58%;padding:3px 8px 3px 8px; font-size:11px; color:<?php echo esc_attr($foldedColor); ?>; text-align:left; white-space:normal; word-break:break-word; overflow-wrap:break-word; vertical-align:top;">
955 + <?php echo esc_html($foldedRow['label']); ?>
956 + </td>
957 + <td style="width:24%;padding:3px 8px 3px 0; font-size:11px; color:<?php echo esc_attr($foldedColor); ?>; text-align:right; white-space:nowrap; vertical-align:top;">
958 + <?php echo esc_html(Helper::toDecimal((int) $foldedRow['base'])); ?>
959 + </td>
960 + <td style="width:18%;padding:3px 0 3px; font-size:11px; color:<?php echo esc_attr($foldedColor); ?>; text-align:right; white-space:nowrap; vertical-align:top;">
961 + <?php echo esc_html(Helper::toDecimal((int) $foldedRow['tax'])); ?>
962 + </td>
963 + </tr>
964 + <?php endforeach; ?>
965 + </table>
966 + </td>
967 + </tr>
968 + <?php if ($rcIsReverseCharge): ?>
969 + <tr>
970 + <td style="padding:3px 0 4px 8px; font-size:11px; font-weight:600; color:#1e293b; text-align: left;">
971 + <?php echo esc_html__('VAT reversed', 'fluent-cart'); ?>
972 + </td>
973 + <td style="padding:3px 0 4px; font-size:11px; text-align:right; font-weight:600; color:#1e293b;">
974 + <?php echo esc_html($rcReversedValue); ?>
975 + </td>
976 + </tr>
977 + <?php else: ?>
978 + <tr>
979 + <td style="padding:4px 0 3px 8px; font-size:11px; font-weight:600; color:#1e293b; border-top:1px solid #e2e8f0; text-align:left;">
980 + <?php echo esc_html__('Total tax', 'fluent-cart'); ?>
981 + </td>
982 + <td style="padding:4px 0 3px; font-size:11px; font-weight:600; color:#1e293b; border-top:1px solid #e2e8f0; text-align:right;">
983 + <?php echo esc_html(Helper::toDecimal((int) $summary['totalOrderTax'])); ?>
984 + </td>
985 + </tr>
986 + <?php if ($includedInPrices > 0): ?>
987 + <tr>
988 + <td style="padding:3px 0 3px 8px; font-size:11px; color:#94a3b8; text-align:left;">
989 + <?php echo esc_html__('of which included in prices', 'fluent-cart'); ?>
990 + </td>
991 + <td style="padding:3px 0 3px; font-size:11px; color:#94a3b8; text-align:right;">
992 + <?php echo esc_html(Helper::toDecimal($includedInPrices)); ?>
993 + </td>
994 + </tr>
995 + <?php endif; ?>
996 + <?php if ($summary['payableTax'] > 0 && $includedInPrices > 0): ?>
997 + <tr>
998 + <td style="padding:3px 0 4px 8px; font-size:11px; color:#334155; text-align:left; border-top:1px solid #e2e8f0; padding-top:6px;">
999 + <?php echo esc_html__('Payable now (added)', 'fluent-cart'); ?>
1000 + </td>
1001 + <td style="padding:3px 0 4px; font-size:11px; color:#334155; text-align:right; border-top:1px solid #e2e8f0; padding-top:6px;">
1002 + <?php echo esc_html(Helper::toDecimal((int) $summary['payableTax'])); ?>
1003 + </td>
1004 + </tr>
1005 + <?php endif; ?>
1006 + <?php endif; ?>
1007 + <?php elseif ($rcIsReverseCharge): ?>
948 1008 <?php if ($summary['showRcShippingRow'] && $rcReversedShipping > 0): ?>
949 1009 <tr>
950 1010 <td style="padding:3px 0 3px 8px; font-size:11px; color:#94a3b8;">
951 1011 <?php echo esc_html__('Added on shipping', 'fluent-cart'); ?>
@@ -964,94 +1024,118 @@
964 1024 </td>
965 1025 </tr>
966 1026 <?php else: ?>
967 1027 <?php
968 - $rcFeeRows = Arr::get($summary, 'feeTaxLineRows', []);
969 - $rowCount = (int) ($summary['inclusiveTax'] > 0) + (int) ($summary['exclusiveTax'] > 0) + count($rcFeeRows) + (int) ($summary['shippingTax'] > 0);
970 - $shouldShowBreakdown = $rowCount >= 2 || ($rowCount === 1 && !($summary['payableTax'] > 0 || $summary['inclusiveTax'] > 0 || (int) Arr::get($summary, 'inclusiveFeeTax', 0) > 0));
1028 + $rcFeeRows = Arr::get($summary, 'feeTaxLineRows', []);
1029 + $taxRateLines = Arr::get($summary, 'taxRateLines', []);
1030 + $productTaxRowCount = !empty($taxRateLines)
1031 + ? count($taxRateLines)
1032 + : (int) ($summary['inclusiveTax'] > 0) + (int) ($summary['exclusiveTax'] > 0);
1033 + $rowCount = $productTaxRowCount + count($rcFeeRows) + (int) ($summary['shippingTax'] > 0);
1034 + $shippingTaxLines = Arr::get($summary, 'shippingTaxLines', []);
1035 + $shouldShowBreakdown = !empty($taxRateLines)
1036 + || !empty($shippingTaxLines)
1037 + || $rowCount >= 2
1038 + || ($rowCount === 1 && !($summary['payableTax'] > 0 || $summary['inclusiveTax'] > 0 || (int) Arr::get($summary, 'inclusiveFeeTax', 0) > 0));
971 1039 ?>
972 - <?php if ($summary['inclusiveTax'] > 0 && $shouldShowBreakdown): ?>
973 - <tr>
974 - <td style="padding:3px 0 3px 8px; font-size:11px; color:#94a3b8;">
975 - <?php echo esc_html__('Included in item prices', 'fluent-cart'); ?>
976 - </td>
977 - <td style="padding:3px 0 3px; font-size:11px; text-align:right; color:#94a3b8;">
978 - <?php echo esc_html(Helper::toDecimal($summary['inclusiveTax'])); ?>
979 - </td>
980 - </tr>
981 - <?php endif; ?>
982 - <?php if ($summary['exclusiveTax'] > 0 && $shouldShowBreakdown): ?>
983 - <tr>
984 - <td style="padding:3px 0 3px 8px; font-size:11px; color:#334155; text-align: left;">
985 - <?php echo esc_html__('Added on products', 'fluent-cart'); ?>
986 - </td>
987 - <td style="padding:3px 0 3px; font-size:11px; text-align:right; color:#334155;">
988 - <?php echo esc_html(Helper::toDecimal($summary['exclusiveTax'])); ?>
989 - </td>
990 - </tr>
991 - <?php endif; ?>
992 - <?php if ($shouldShowBreakdown) : ?>
993 - <?php foreach ($rcFeeRows as $feeRow) :
994 - $feeRowColor = $feeRow['inclusive'] ? '#94a3b8' : '#334155'; ?>
995 - <tr>
996 - <td style="padding:3px 0 3px 8px; font-size:11px; color:<?php echo esc_attr($feeRowColor); ?>; text-align: left;">
997 - <?php echo esc_html($feeRow['display_label']); ?>
998 - </td>
999 - <td style="padding:3px 0 3px; font-size:11px; text-align:right; color:<?php echo esc_attr($feeRowColor); ?>;">
1000 - <?php echo esc_html(Helper::toDecimal($feeRow['tax_amount'])); ?>
1001 - </td>
1002 - </tr>
1003 - <?php endforeach; ?>
1004 - <?php endif; ?>
1005 - <?php if ($summary['shippingTax'] > 0 && $shouldShowBreakdown):
1006 - $isShippingInclusive = (bool) Arr::get($summary, 'isShippingInclusive', false);
1007 - $shippingRowColor = $isShippingInclusive ? '#94a3b8' : '#334155';
1008 - $shippingTaxLines = Arr::get($summary, 'shippingTaxLines', []);
1009 - if (!empty($shippingTaxLines)):
1010 - foreach ($shippingTaxLines as $shLine): ?>
1040 + <?php if (!empty($taxRateLines) && $shouldShowBreakdown): ?>
1041 + <?php foreach ($taxRateLines as $taxLine):
1042 + $taxLineColor = !empty($taxLine['inclusive']) ? '#94a3b8' : '#334155'; ?>
1011 1043 <tr>
1012 - <td style="padding:3px 0 3px 8px; font-size:11px; color:<?php echo esc_attr($shippingRowColor); ?>;">
1013 - <?php echo esc_html($shLine['label']); ?>
1044 + <td style="padding:3px 0 3px 8px; font-size:11px; color:<?php echo esc_attr($taxLineColor); ?>; text-align: left;">
1045 + <?php echo esc_html($taxLine['label']); ?>
1014 1046 </td>
1015 - <td style="padding:3px 0 3px; font-size:11px; text-align:right; color:<?php echo esc_attr($shippingRowColor); ?>;">
1016 - <?php echo esc_html(Helper::toDecimal($shLine['shipping_tax'])); ?>
1047 + <td style="padding:3px 0 3px; font-size:11px; text-align:right; color:<?php echo esc_attr($taxLineColor); ?>;">
1048 + <?php echo esc_html(Helper::toDecimal($taxLine['order_tax'])); ?>
1017 1049 </td>
1018 1050 </tr>
1019 - <?php endforeach;
1020 - else: ?>
1051 + <?php endforeach; ?>
1052 + <?php endif; ?>
1053 + <?php if (empty($taxRateLines) && $summary['inclusiveTax'] > 0 && $shouldShowBreakdown): ?>
1021 1054 <tr>
1022 - <td style="padding:3px 0 3px 8px; font-size:11px; color:<?php echo esc_attr($shippingRowColor); ?>;">
1023 - <?php echo esc_html($isShippingInclusive ? __('Included in shipping prices', 'fluent-cart') : __('Added on shipping', 'fluent-cart')); ?>
1055 + <td style="padding:3px 0 3px 8px; font-size:11px; color:#94a3b8;">
1056 + <?php echo esc_html__('Included in item prices', 'fluent-cart'); ?>
1024 1057 </td>
1025 - <td style="padding:3px 0 3px; font-size:11px; text-align:right; color:<?php echo esc_attr($shippingRowColor); ?>;">
1026 - <?php echo esc_html(Helper::toDecimal($summary['shippingTax'])); ?>
1058 + <td style="padding:3px 0 3px; font-size:11px; text-align:right; color:#94a3b8;">
1059 + <?php echo esc_html(Helper::toDecimal($summary['inclusiveTax'])); ?>
1027 1060 </td>
1028 1061 </tr>
1029 1062 <?php endif; ?>
1030 - <?php endif; ?>
1031 - <?php if ($summary['payableTax'] > 0): ?>
1032 - <tr>
1033 - <td style="padding:4px 0 4px 8px; font-size:11px; font-weight:600; color:#1e293b;
1034 - border-top:1px solid #e2e8f0; text-align: left;">
1035 - <?php echo esc_html__('Total payable tax', 'fluent-cart'); ?>
1036 - </td>
1037 - <td style="padding:4px 0 4px; font-size:11px; text-align:right; font-weight:600; color:#1e293b;
1038 - border-top:1px solid #e2e8f0;">
1039 - <?php echo esc_html(Helper::toDecimal($summary['payableTax'])); ?>
1040 - </td>
1041 - </tr>
1042 - <?php endif; ?>
1043 - <?php if ($summary['inclusiveTax'] > 0 || $summary['inclusiveFeeTax'] > 0): ?>
1063 + <?php if (empty($taxRateLines) && $summary['exclusiveTax'] > 0 && $shouldShowBreakdown): ?>
1064 + <tr>
1065 + <td style="padding:3px 0 3px 8px; font-size:11px; color:#334155; text-align: left;">
1066 + <?php echo esc_html__('Added on products', 'fluent-cart'); ?>
1067 + </td>
1068 + <td style="padding:3px 0 3px; font-size:11px; text-align:right; color:#334155;">
1069 + <?php echo esc_html(Helper::toDecimal($summary['exclusiveTax'])); ?>
1070 + </td>
1071 + </tr>
1072 + <?php endif; ?>
1073 + <?php if ($shouldShowBreakdown) : ?>
1074 + <?php foreach ($rcFeeRows as $feeRow) :
1075 + $feeRowColor = $feeRow['inclusive'] ? '#94a3b8' : '#334155'; ?>
1076 + <tr>
1077 + <td style="padding:3px 0 3px 8px; font-size:11px; color:<?php echo esc_attr($feeRowColor); ?>; text-align: left;">
1078 + <?php echo esc_html($feeRow['display_label']); ?>
1079 + </td>
1080 + <td style="padding:3px 0 3px; font-size:11px; text-align:right; color:<?php echo esc_attr($feeRowColor); ?>;">
1081 + <?php echo esc_html(Helper::toDecimal($feeRow['tax_amount'])); ?>
1082 + </td>
1083 + </tr>
1084 + <?php endforeach; ?>
1085 + <?php endif; ?>
1086 + <?php if ($summary['shippingTax'] > 0 && $shouldShowBreakdown):
1087 + $isShippingInclusive = (bool) Arr::get($summary, 'isShippingInclusive', false);
1088 + $shippingRowColor = $isShippingInclusive ? '#94a3b8' : '#334155';
1089 + if (!empty($shippingTaxLines)):
1090 + foreach ($shippingTaxLines as $shLine): ?>
1091 + <tr>
1092 + <td style="padding:3px 0 3px 8px; font-size:11px; color:<?php echo esc_attr($shippingRowColor); ?>;">
1093 + <?php echo esc_html($shLine['label']); ?>
1094 + </td>
1095 + <td style="padding:3px 0 3px; font-size:11px; text-align:right; color:<?php echo esc_attr($shippingRowColor); ?>;">
1096 + <?php echo esc_html(Helper::toDecimal($shLine['shipping_tax'])); ?>
1097 + </td>
1098 + </tr>
1099 + <?php endforeach;
1100 + else: ?>
1101 + <tr>
1102 + <td style="padding:3px 0 3px 8px; font-size:11px; color:<?php echo esc_attr($shippingRowColor); ?>;">
1103 + <?php echo esc_html($isShippingInclusive ? __('Included in shipping prices', 'fluent-cart') : __('Added on shipping', 'fluent-cart')); ?>
1104 + </td>
1105 + <td style="padding:3px 0 3px; font-size:11px; text-align:right; color:<?php echo esc_attr($shippingRowColor); ?>;">
1106 + <?php echo esc_html(Helper::toDecimal($summary['shippingTax'])); ?>
1107 + </td>
1108 + </tr>
1109 + <?php endif; ?>
1110 + <?php endif; ?>
1111 + <?php if ($summary['payableTax'] > 0): ?>
1044 1112 <tr>
1045 - <td style="padding:3px 0 4px 8px; font-size:11px; color:#94a3b8;">
1046 - <?php echo esc_html__('Total tax in this order', 'fluent-cart'); ?>
1113 + <td style="padding:4px 0 4px 8px; font-size:11px; font-weight:600; color:#1e293b;
1114 + border-top:1px solid #e2e8f0; text-align: left;">
1115 + <?php echo esc_html__('Total payable tax', 'fluent-cart'); ?>
1047 1116 </td>
1048 - <td style="padding:3px 0 4px; font-size:11px; text-align:right; color:#94a3b8;">
1049 - <?php echo esc_html(Helper::toDecimal($summary['totalOrderTax'])); ?>
1117 + <td style="padding:4px 0 4px; font-size:11px; text-align:right; font-weight:600; color:#1e293b;
1118 + border-top:1px solid #e2e8f0;">
1119 + <?php echo esc_html(Helper::toDecimal($summary['payableTax'])); ?>
1050 1120 </td>
1051 1121 </tr>
1052 - <?php endif; ?>
1122 + <?php endif; ?>
1123 + <?php if ($summary['inclusiveTax'] > 0 || $summary['inclusiveFeeTax'] > 0): ?>
1124 + <tr>
1125 + <td style="padding:3px 0 4px 8px; font-size:11px; color:#94a3b8;">
1126 + <?php echo esc_html__('Total tax in this order', 'fluent-cart'); ?>
1127 + </td>
1128 + <td style="padding:3px 0 4px; font-size:11px; text-align:right; color:#94a3b8;">
1129 + <?php echo esc_html(Helper::toDecimal($summary['totalOrderTax'])); ?>
1130 + </td>
1131 + </tr>
1132 + <?php endif; ?>
1053 1133 <?php endif; ?>
1134 + <?php endif; ?>
1135 + </table>
1136 + </td>
1137 + </tr>
1054 1138 </table>
1055 1139 </td>
1056 1140 </tr>
1057 1141 <?php