From ddb82d97f794d59d846aa9b7c3d1dd1eff9cb9a9 Mon Sep 17 00:00:00 2001 From: trisusilo48 Date: Fri, 29 Nov 2024 16:31:58 +0700 Subject: ppn 12 persen --- src/lib/checkout/components/Checkout.jsx | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'src/lib') diff --git a/src/lib/checkout/components/Checkout.jsx b/src/lib/checkout/components/Checkout.jsx index 6fb5cdb4..4e182745 100644 --- a/src/lib/checkout/components/Checkout.jsx +++ b/src/lib/checkout/components/Checkout.jsx @@ -50,6 +50,7 @@ function convertToInternational(number) { } const Checkout = () => { + const PPN = process.env.NEXT_PUBLIC_PPN ? parseFloat(process.env.NEXT_PUBLIC_PPN) : 0; const router = useRouter(); const query = router.query.source ?? null; const qVoucher = router.query.voucher ?? null; @@ -1210,7 +1211,7 @@ const Checkout = () => {
{currencyFormat(cartCheckout?.subtotal)}
-
PPN 11%
+
PPN {((PPN - 1) * 100).toFixed(0)}%
{currencyFormat(cartCheckout?.tax)}
@@ -1514,7 +1515,7 @@ const Checkout = () => {
{currencyFormat(cartCheckout?.subtotal)}
-
PPN 11%
+
PPN {((PPN - 1) * 100).toFixed(0)}%
{currencyFormat(cartCheckout?.tax)}
-- cgit v1.2.3 From d20adeb6a5f6e153e2d1cfc8c8c77f4cceb743e8 Mon Sep 17 00:00:00 2001 From: trisusilo48 Date: Tue, 31 Dec 2024 09:53:27 +0700 Subject: ppn 12% --- src/lib/cart/components/Cart.jsx | 3 ++- src/lib/cart/components/CartOld.jsx | 3 ++- src/lib/cart/components/Cartheader.jsx | 3 ++- src/lib/checkout/components/Checkout.jsx | 1 - src/lib/checkout/components/CheckoutOld.jsx | 2 +- src/lib/checkout/email/FinishCheckoutEmail.jsx | 5 +++-- src/lib/invoice/components/Invoice.jsx | 5 +++-- src/lib/quotation/components/Quotation.jsx | 7 ++++--- src/lib/transaction/components/Transaction.jsx | 4 ++-- 9 files changed, 19 insertions(+), 14 deletions(-) (limited to 'src/lib') diff --git a/src/lib/cart/components/Cart.jsx b/src/lib/cart/components/Cart.jsx index c6aaa596..1e25d959 100644 --- a/src/lib/cart/components/Cart.jsx +++ b/src/lib/cart/components/Cart.jsx @@ -27,6 +27,7 @@ import CardProdcuctsList from '@/core/components/elements/Product/cartProductsLi // import cardProdcuctsList from '@/core/components/elements/Product/cartProductsList' const Cart = () => { + const PPN = process.env.NEXT_PUBLIC_PPN const router = useRouter() const [products, setProducts] = useState(null) const [isLoading, setIsLoading] = useState(true) @@ -97,7 +98,7 @@ const Cart = () => { if (product.canBuy == false) { toggleSelected(product.id) } - let priceBeforeTax = product.price.price / 1.11 + let priceBeforeTax = product.price.price / PPN calculateTotalPriceBeforeTax += priceBeforeTax * product.quantity calculateTotalTaxAmount += (product.price.price - priceBeforeTax) * product.quantity calculateTotalDiscountAmount += diff --git a/src/lib/cart/components/CartOld.jsx b/src/lib/cart/components/CartOld.jsx index 718541af..358efa49 100644 --- a/src/lib/cart/components/CartOld.jsx +++ b/src/lib/cart/components/CartOld.jsx @@ -20,6 +20,7 @@ import whatsappUrl from '@/core/utils/whatsappUrl' import useAuth from '@/core/hooks/useAuth' const Cart = () => { + const PPN = process.env.NEXT_PUBLIC_PPN const router = useRouter() const [products, setProducts] = useState(null) const auth = useAuth() @@ -67,7 +68,7 @@ const Cart = () => { }) if (!product.selected) continue - let priceBeforeTax = product.price.price / 1.11 + let priceBeforeTax = product.price.price / PPN calculateTotalPriceBeforeTax += priceBeforeTax * product.quantity calculateTotalTaxAmount += (product.price.price - priceBeforeTax) * product.quantity calculateTotalDiscountAmount += diff --git a/src/lib/cart/components/Cartheader.jsx b/src/lib/cart/components/Cartheader.jsx index 1c30bb13..6d4e2679 100644 --- a/src/lib/cart/components/Cartheader.jsx +++ b/src/lib/cart/components/Cartheader.jsx @@ -14,6 +14,7 @@ const { ShoppingCartIcon, PhotoIcon } = require('@heroicons/react/24/outline'); const { default: Link } = require('next/link'); const Cardheader = (cartCount) => { + const PPN = process.env.NEXT_PUBLIC_PPN const router = useRouter(); const [subTotal, setSubTotal] = useState(null); const [buttonLoading, SetButtonTerapkan] = useState(false); @@ -66,7 +67,7 @@ const Cardheader = (cartCount) => { for (const product of products) { if (product.quantity == '') continue; - let priceBeforeTax = product.price.price / 1.11; + let priceBeforeTax = product.price.price / PPN; calculateTotalPriceBeforeTax += priceBeforeTax * product.quantity; calculateTotalTaxAmount += (product.price.price - priceBeforeTax) * product.quantity; diff --git a/src/lib/checkout/components/Checkout.jsx b/src/lib/checkout/components/Checkout.jsx index 4e182745..e3b586f1 100644 --- a/src/lib/checkout/components/Checkout.jsx +++ b/src/lib/checkout/components/Checkout.jsx @@ -588,7 +588,6 @@ const Checkout = () => { setItemTnC(item); SetBottomPopupTnC(true); }; - // const taxTotal = (totalAmount - totalDiscountAmount - discountVoucher) * 0.11 const hasNoPrice = useMemo(() => { if (!products) return false; diff --git a/src/lib/checkout/components/CheckoutOld.jsx b/src/lib/checkout/components/CheckoutOld.jsx index 5b479a73..433c5672 100644 --- a/src/lib/checkout/components/CheckoutOld.jsx +++ b/src/lib/checkout/components/CheckoutOld.jsx @@ -239,7 +239,7 @@ const Checkout = () => { setIsLoading(false) window.location.href = payment.data.redirectUrl } - const taxTotal = (totalAmount - totalDiscountAmount) * 0.11 + const taxTotal = (totalAmount - totalDiscountAmount) * (PPN - 1) return ( <> diff --git a/src/lib/checkout/email/FinishCheckoutEmail.jsx b/src/lib/checkout/email/FinishCheckoutEmail.jsx index d19ba1ca..9a94587e 100644 --- a/src/lib/checkout/email/FinishCheckoutEmail.jsx +++ b/src/lib/checkout/email/FinishCheckoutEmail.jsx @@ -17,6 +17,7 @@ import { import FinishCheckout from '../components/FinishCheckout' const FinishCheckoutEmail = ({ transaction, payment, statusPayment }) => { + const PPN = process.env.NEXT_PUBLIC_PPN return ( @@ -206,9 +207,9 @@ const FinishCheckoutEmail = ({ transaction, payment, statusPayment }) => { - PPN 11% (Incl.) + PPN {((PPN - 1) * 100).toFixed(0)}% (Incl.) - {currencyFormat(transaction.subtotal * 0.11)} + {currencyFormat(transaction.subtotal * (PPN - 1))} diff --git a/src/lib/invoice/components/Invoice.jsx b/src/lib/invoice/components/Invoice.jsx index 81202b1c..15bfa746 100644 --- a/src/lib/invoice/components/Invoice.jsx +++ b/src/lib/invoice/components/Invoice.jsx @@ -13,6 +13,7 @@ import { createSlug } from '@/core/utils/slug' import { useEffect, useState } from 'react' const Invoice = ({ id }) => { + const PPN = process.env.NEXT_PUBLIC_PPN const { invoice } = useInvoice({ id }) const [totalAmount, setTotalAmount] = useState(0) @@ -255,8 +256,8 @@ const Invoice = ({ id }) => { {currencyFormat(invoice.data?.amountTotal)}
-
PPN 11% (Incl.)
-
{currencyFormat(totalAmount * 0.11)}
+
PPN {((PPN - 1) * 100).toFixed(0)}% (Incl.)
+
{currencyFormat(invoice.data?.amountTotal - totalAmount)}
diff --git a/src/lib/quotation/components/Quotation.jsx b/src/lib/quotation/components/Quotation.jsx index 5a2f63a5..2f4d6c46 100644 --- a/src/lib/quotation/components/Quotation.jsx +++ b/src/lib/quotation/components/Quotation.jsx @@ -37,6 +37,7 @@ const { checkoutApi } = require('@/lib/checkout/api/checkoutApi'); const { getProductsCheckout } = require('@/lib/checkout/api/checkoutApi'); const Quotation = () => { + const PPN = process.env.NEXT_PUBLIC_PPN ? parseFloat(process.env.NEXT_PUBLIC_PPN) : 0; const router = useRouter(); const auth = useAuth(); const query = router.query.source ?? null; @@ -307,7 +308,7 @@ const Quotation = () => { toast.error('Gagal melakukan transaksi, terjadi kesalahan internal'); }; - const taxTotal = (totalAmount - totalDiscountAmount) * 0.11; + const taxTotal = (totalAmount - totalDiscountAmount) * (PPN - 1); return ( <> @@ -425,7 +426,7 @@ const Quotation = () => {
{currencyFormat(cartCheckout?.subtotal)}
-
PPN 11%
+
PPN {((PPN - 1) * 100).toFixed(0)}%
{currencyFormat(cartCheckout?.tax)}
@@ -574,7 +575,7 @@ const Quotation = () => {
{currencyFormat(cartCheckout?.subtotal)}
-
PPN 11%
+
PPN {((PPN - 1) * 100).toFixed(0)}%
{currencyFormat(cartCheckout?.tax)}
diff --git a/src/lib/transaction/components/Transaction.jsx b/src/lib/transaction/components/Transaction.jsx index f5dc507a..273ea3f7 100644 --- a/src/lib/transaction/components/Transaction.jsx +++ b/src/lib/transaction/components/Transaction.jsx @@ -207,7 +207,7 @@ const Transaction = ({ id }) => {

{currencyFormat(transaction.data?.amountUntaxed)}

-

PPN 11%

+

PPN {((PPN - 1) * 100).toFixed(0)}%

{currencyFormat(transaction.data?.amountTax)}

@@ -975,7 +975,7 @@ const Transaction = ({ id }) => { {currencyFormat(transaction.data?.amountUntaxed)}
-
PPN 11%
+
PPN {((PPN - 1) * 100).toFixed(0)}%
{currencyFormat(transaction.data?.amountTax)}
-- cgit v1.2.3