Adding TDS percentage calculation at View Payment Request.
This commit is contained in:
parent
4eecaf0509
commit
c52fb2c999
@ -65,6 +65,20 @@ const ActionPaymentRequest = ({ requestId }) => {
|
|||||||
defaultValues: defaultPRActionValues,
|
defaultValues: defaultPRActionValues,
|
||||||
});
|
});
|
||||||
|
|
||||||
|
const baseAmount = watch("baseAmount") || 0;
|
||||||
|
const taxAmount = watch("taxAmount") || 0;
|
||||||
|
const tdsPercentage = watch("tdsPercentage") || 0;
|
||||||
|
|
||||||
|
const grossAmount = baseAmount + taxAmount;
|
||||||
|
|
||||||
|
const tdsAmount = useMemo(() => (baseAmount * tdsPercentage) / 100, [
|
||||||
|
baseAmount,
|
||||||
|
tdsPercentage,
|
||||||
|
]);
|
||||||
|
|
||||||
|
const netPayable = useMemo(() => grossAmount - tdsAmount, [grossAmount, tdsAmount]);
|
||||||
|
|
||||||
|
|
||||||
const userPermissions = useSelector(
|
const userPermissions = useSelector(
|
||||||
(state) => state?.globalVariables?.loginUser?.featurePermissions || []
|
(state) => state?.globalVariables?.loginUser?.featurePermissions || []
|
||||||
);
|
);
|
||||||
@ -354,21 +368,7 @@ const ActionPaymentRequest = ({ requestId }) => {
|
|||||||
projectId={null}
|
projectId={null}
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
<div className="col-12 col-md-6 text-start mb-1">
|
|
||||||
<Label className="form-label">TDS Percentage</Label>
|
|
||||||
<input
|
|
||||||
type="number"
|
|
||||||
className="form-control form-control-sm"
|
|
||||||
{...register("tdsPercentage", { valueAsNumber: true })}
|
|
||||||
min="0"
|
|
||||||
step="any"
|
|
||||||
/>
|
|
||||||
{errors.tdsPercentage && (
|
|
||||||
<small className="danger-text">
|
|
||||||
{errors.tdsPercentage.message}
|
|
||||||
</small>
|
|
||||||
)}
|
|
||||||
</div>
|
|
||||||
<div className="col-12 col-md-6 text-start mb-1">
|
<div className="col-12 col-md-6 text-start mb-1">
|
||||||
<Label className="form-label" required>
|
<Label className="form-label" required>
|
||||||
Base Amount
|
Base Amount
|
||||||
@ -388,7 +388,7 @@ const ActionPaymentRequest = ({ requestId }) => {
|
|||||||
</div>
|
</div>
|
||||||
<div className="col-12 col-md-6 text-start mb-1">
|
<div className="col-12 col-md-6 text-start mb-1">
|
||||||
<Label className="form-label" required>
|
<Label className="form-label" required>
|
||||||
Tax Amount
|
Tax / GST Amount
|
||||||
</Label>
|
</Label>
|
||||||
<input
|
<input
|
||||||
type="number"
|
type="number"
|
||||||
@ -403,7 +403,33 @@ const ActionPaymentRequest = ({ requestId }) => {
|
|||||||
</small>
|
</small>
|
||||||
)}
|
)}
|
||||||
</div>
|
</div>
|
||||||
|
<div className="col-12 col-md-6 text-start mb-1">
|
||||||
|
<Label className="form-label">TDS %</Label>
|
||||||
|
<input
|
||||||
|
type="number"
|
||||||
|
className="form-control form-control-sm"
|
||||||
|
{...register("tdsPercentage", { valueAsNumber: true })}
|
||||||
|
min="0"
|
||||||
|
step="any"
|
||||||
|
/>
|
||||||
|
{errors.tdsPercentage && (
|
||||||
|
<small className="danger-text">{errors.tdsPercentage.message}</small>
|
||||||
|
)}
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<div className="col-12 col-md-6 d-flex align-items-center gap-4 mb-1 mt-3">
|
||||||
|
<div>
|
||||||
|
<span className="fw-semibold">TDS Amount: </span>
|
||||||
|
<span className="bg-label-success">{tdsAmount.toFixed(2)}</span>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div>
|
||||||
|
<span className="fw-semibold">Net Payable: </span>
|
||||||
|
<span className="bg-label-primary">{netPayable.toFixed(2)}</span>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
)}
|
)}
|
||||||
</>
|
</>
|
||||||
)}
|
)}
|
||||||
|
|||||||
@ -129,6 +129,8 @@ const ViewPaymentRequest = ({ requestId }) => {
|
|||||||
[EXPENSE_STATUS.review_pending]: "Payment Request - Review & Validation",
|
[EXPENSE_STATUS.review_pending]: "Payment Request - Review & Validation",
|
||||||
[EXPENSE_STATUS.approve_pending]: "Payment Request - Approval",
|
[EXPENSE_STATUS.approve_pending]: "Payment Request - Approval",
|
||||||
[EXPENSE_STATUS.payment_pending]: "Payment Request - Processing & Disbursement",
|
[EXPENSE_STATUS.payment_pending]: "Payment Request - Processing & Disbursement",
|
||||||
|
[EXPENSE_STATUS.payment_processed]: "Payment Request - Bills & Tax Invoices Upload",
|
||||||
|
[EXPENSE_STATUS.payment_done]: "Payment Request - Reconciliation & Confirmation",
|
||||||
};
|
};
|
||||||
|
|
||||||
return (
|
return (
|
||||||
|
|||||||
@ -164,6 +164,7 @@ export const EXPENSE_STATUS = {
|
|||||||
payment_pending: "f18c5cfd-7815-4341-8da2-2c2d65778e27",
|
payment_pending: "f18c5cfd-7815-4341-8da2-2c2d65778e27",
|
||||||
approve_pending: "4068007f-c92f-4f37-a907-bc15fe57d4d8",
|
approve_pending: "4068007f-c92f-4f37-a907-bc15fe57d4d8",
|
||||||
payment_processed: "61578360-3a49-4c34-8604-7b35a3787b95",
|
payment_processed: "61578360-3a49-4c34-8604-7b35a3787b95",
|
||||||
|
payment_done: "b8586f67-dc19-49c3-b4af-224149efe1d3",
|
||||||
}
|
}
|
||||||
|
|
||||||
export const UUID_REGEX =
|
export const UUID_REGEX =
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user