| @@ -14,8 +14,9 @@ | ||
| 14 | 14 | |
| 15 | 15 | <?php |
| 16 | 16 | |
| 17 | 17 | use FluentCart\Framework\Support\Arr; |
| 18 | +use FluentCart\App\Modules\Tax\TaxModule; | |
| 18 | 19 | use FluentCart\App\Services\Renderer\Receipt\TaxSummaryHelper; |
| 19 | 20 | $allOrderItems = $order->order_items ? $order->order_items->toArray() : []; |
| 20 | 21 | $orderItems = array_filter($allOrderItems, function ($item) { |
| 21 | 22 | return !in_array($item['payment_type'] ?? '', ['signup_fee', 'fee']); |
| @@ -26,8 +27,9 @@ | ||
| 26 | 27 | $transaction = $order->getLatestTransaction(); |
| 27 | 28 | $isRefund = $is_refund ?? false; |
| 28 | 29 | $isReversed = $order->isReverseChargeTaxOrder(); |
| 29 | 30 | $rcMode = $order->getOrderRcMode(); |
| 31 | + $fctEmailDisplayMode = ($order instanceof \FluentCart\App\Models\Order) ? TaxSummaryHelper::getTaxDisplayMode() : 'itemized'; | |
| 30 | 32 | |
| 31 | 33 | ?> |
| 32 | 34 | |
| 33 | 35 | <table role="presentation" style="border-spacing:0;padding: 0; width: 100%;border: none"> |
| @@ -74,9 +76,9 @@ | ||
| 74 | 76 | <?php |
| 75 | 77 | $otherInfo = is_array($item['other_info'] ?? null) ? $item['other_info'] : []; |
| 76 | 78 | $packageInfo = Arr::get($item, 'package_info', ''); |
| 77 | 79 | if (!$packageInfo && Arr::get($otherInfo, 'package_name')) { |
| 78 | - $packageInfo = \FluentCart\App\Services\Renderer\ProductCardRender::buildPackageInfoFromOtherInfo($otherInfo); | |
| 80 | + $packageInfo = \FluentCart\App\Services\Renderer\PackageDescriptionRenderer::buildPackageInfoFromOtherInfo($otherInfo); | |
| 79 | 81 | } |
| 80 | 82 | if ($packageInfo): |
| 81 | 83 | ?> |
| 82 | 84 | <p style="font-size:12px;color:rgb(107,114,128);line-height:18px;margin: 5px 0 0 0;"> |
| @@ -94,9 +96,9 @@ | ||
| 94 | 96 | |
| 95 | 97 | <?php |
| 96 | 98 | $itemRates = TaxSummaryHelper::getItemTaxRates($item); |
| 97 | 99 | ?> |
| 98 | - <?php if (!empty($itemRates)): ?> | |
| 100 | + <?php if ($fctEmailDisplayMode !== 'simplified' && !empty($itemRates)): ?> | |
| 99 | 101 | <tr> |
| 100 | 102 | <td colspan="3" style="padding: 0 16px 8px;"> |
| 101 | 103 | <table width="100%" style="border-spacing:0;border-collapse:collapse;"> |
| 102 | 104 | <?php foreach ($itemRates as $rate): |
| @@ -128,9 +130,9 @@ | ||
| 128 | 130 | <?php endforeach; ?> |
| 129 | 131 | </table> |
| 130 | 132 | </td> |
| 131 | 133 | </tr> |
| 132 | - <?php elseif (!empty($item['tax_amount'])): ?> | |
| 134 | + <?php elseif ($fctEmailDisplayMode !== 'simplified' && !empty($item['tax_amount'])): ?> | |
| 133 | 135 | <?php |
| 134 | 136 | $itemIsInclusive = TaxSummaryHelper::isPrimaryTaxInclusive($order); |
| 135 | 137 | $reversedAmountStyle = ($isReversed && (!$itemIsInclusive || $rcMode === 'dynamic')) ? 'text-decoration:line-through;opacity:0.6;' : ''; |
| 136 | 138 | $pillBg = $itemIsInclusive ? '#EAF3DE' : '#FAEEDA'; |
| @@ -190,9 +192,9 @@ | ||
| 190 | 192 | } |
| 191 | 193 | } |
| 192 | 194 | $sfRates = $sfSibling ? TaxSummaryHelper::getItemTaxRates($sfSibling) : []; |
| 193 | 195 | ?> |
| 194 | - <?php if (!empty($sfRates)): ?> | |
| 196 | + <?php if ($fctEmailDisplayMode !== 'simplified' && !empty($sfRates)): ?> | |
| 195 | 197 | <tr> |
| 196 | 198 | <td colspan="3" style="padding: 0 16px 8px;"> |
| 197 | 199 | <table width="100%" style="border-spacing:0;border-collapse:collapse;"> |
| 198 | 200 | <?php foreach ($sfRates as $sfRate): |
| @@ -233,9 +235,9 @@ | ||
| 233 | 235 | $sfOtherInfo = is_array($item['other_info'] ?? null) ? $item['other_info'] : []; |
| 234 | 236 | $sfTax = (int) Arr::get($sfOtherInfo, 'signup_fee_tax', 0); |
| 235 | 237 | } |
| 236 | 238 | ?> |
| 237 | - <?php if ($sfTax > 0): ?> | |
| 239 | + <?php if ($fctEmailDisplayMode !== 'simplified' && $sfTax > 0): ?> | |
| 238 | 240 | <?php |
| 239 | 241 | $sfIsInclusive = TaxSummaryHelper::isPrimaryTaxInclusive($order); |
| 240 | 242 | $reversedAmountStyle = ($isReversed && (!$sfIsInclusive || $rcMode === 'dynamic')) ? 'text-decoration:line-through;opacity:0.6;' : ''; |
| 241 | 243 | $sfFallbackBg = $sfIsInclusive ? '#EAF3DE' : '#FAEEDA'; |
| @@ -304,8 +306,9 @@ | ||
| 304 | 306 | $emailRcShippingAdj = (int) \FluentCart\Framework\Support\Arr::get($emailTaxSummaryEarly, 'rcShippingAdjustment', 0); |
| 305 | 307 | ?> |
| 306 | 308 | <?php if ($order->shipping_total > 0): |
| 307 | 309 | $emailDisplayShipping = max(0, (int) $order->shipping_total - $emailRcShippingAdj); |
| 310 | + $emailShippingMethodTitle = (string) \FluentCart\Framework\Support\Arr::get($order->config, 'shipping_method_title', ''); | |
| 308 | 311 | ?> |
| 309 | 312 | <tr style="width:100%"> |
| 310 | 313 | <td style="width:70%"> |
| 311 | 314 | <p style="font-size:14px;color:rgb(55,65,81);line-height:24px;margin: 0;"> |
| @@ -310,8 +313,13 @@ | ||
| 310 | 313 | <td style="width:70%"> |
| 311 | 314 | <p style="font-size:14px;color:rgb(55,65,81);line-height:24px;margin: 0;"> |
| 312 | 315 | <?php echo esc_html__('Shipping', 'fluent-cart'); ?> |
| 313 | 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; ?> | |
| 314 | 322 | </td> |
| 315 | 323 | <td style="width:30%;text-align:right"> |
| 316 | 324 | <p style="font-size:14px;color:rgb(55,65,81);margin:0;line-height:24px;"> |
| 317 | 325 | <?php echo esc_html(\FluentCart\App\Helpers\Helper::toDecimal($emailDisplayShipping)); ?> |
| @@ -403,8 +411,23 @@ | ||
| 403 | 411 | <td style="background-color:rgb(249,250,251);padding:16px;border-radius:8px;"> |
| 404 | 412 | <table role="presentation" width="100%" |
| 405 | 413 | style="width:100%;border-spacing:0;border-collapse:collapse;border:none;"> |
| 406 | 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'): ?> | |
| 407 | 430 | <tr style="width:100%"> |
| 408 | 431 | <td colspan="2" style="padding:0 0 4px;"> |
| 409 | 432 | <p style="font-size:10px; font-weight:600; text-transform:uppercase; |
| 410 | 433 | letter-spacing:0.06em; color:#94a3b8; margin:0;"> |
| @@ -415,44 +438,17 @@ | ||
| 415 | 438 | <?php endif; ?> |
| 416 | 439 | </p> |
| 417 | 440 | </td> |
| 418 | 441 | </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): ?> | |
| 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)): ?> | |
| 428 | 450 | <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 | 451 | <td colspan="2" style="padding:0 0 4px;"> |
| 456 | 452 | <table style="width:100%;border-collapse:collapse;border-spacing:0;table-layout:fixed;"> |
| 457 | 453 | <tbody> |
| 458 | 454 | <tr> |
| @@ -484,11 +480,25 @@ | ||
| 484 | 480 | </tbody> |
| 485 | 481 | </table> |
| 486 | 482 | </td> |
| 487 | 483 | </tr> |
| 484 | + <?php if ($emailTaxSummary['isReverseCharge']): ?> | |
| 488 | 485 | <tr style="width:100%"> |
| 489 | 486 | <td style="width:70%"> |
| 490 | 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;"> | |
| 491 | 501 | <?php echo esc_html__('Total tax', 'fluent-cart'); ?> |
| 492 | 502 | </p> |
| 493 | 503 | </td> |
| 494 | 504 | <td style="width:30%; text-align:right"> |
| @@ -524,8 +534,36 @@ | ||
| 524 | 534 | </p> |
| 525 | 535 | </td> |
| 526 | 536 | </tr> |
| 527 | 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> | |
| 528 | 566 | <?php else: ?> |
| 529 | 567 | <?php |
| 530 | 568 | $emailFeeRowsList = Arr::get($emailTaxSummary, 'feeTaxLineRows', []); |
| 531 | 569 | $emailTaxRateLines = Arr::get($emailTaxSummary, 'taxRateLines', []); |
| @@ -665,8 +703,9 @@ | ||
| 665 | 703 | </td> |
| 666 | 704 | </tr> |
| 667 | 705 | <?php endif; ?> |
| 668 | 706 | <?php endif; ?> |
| 707 | + <?php endif; ?> | |
| 669 | 708 | </tbody> |
| 670 | 709 | </table> |
| 671 | 710 | </td> |
| 672 | 711 | </tr> |
| @@ -741,9 +780,9 @@ | ||
| 741 | 780 | </table> |
| 742 | 781 | <?php |
| 743 | 782 | if($order->isReverseChargeTaxOrder()): ?> |
| 744 | 783 | <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'); ?> | |
| 784 | + <?php echo '*' . esc_html(TaxModule::getReverseChargeNoticeText()); ?> | |
| 746 | 785 | </div> |
| 747 | 786 | |
| 748 | 787 | <?php endif ?> |
| 749 | 788 | </td> |