Purchase Summary Bug fixed
This commit is contained in:
@@ -77,4 +77,8 @@ public class PurchaseOrder {
|
|||||||
public BigDecimal getPayables() {
|
public BigDecimal getPayables() {
|
||||||
return amount != null ? amount.subtract(paidTotal) : BigDecimal.ZERO;
|
return amount != null ? amount.subtract(paidTotal) : BigDecimal.ZERO;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public BigDecimal getBalance() {
|
||||||
|
return amount != null ? amount.subtract(paidTotal != null ? paidTotal : BigDecimal.ZERO) : BigDecimal.ZERO;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -62,11 +62,11 @@ const PurchaseSummary = () => {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const summaryStats = [
|
const summaryStats = [
|
||||||
{ title: "Total Purchases", value: `₹${data.totalAmount.toLocaleString()}`, icon: AlertCircle, color: "text-rose-500", bg: "bg-rose-50" },
|
{ title: "Total Purchases", value: `₹${(data?.totalAmount ?? 0).toLocaleString()}`, icon: AlertCircle, color: "text-rose-500", bg: "bg-rose-50" },
|
||||||
{ title: "Total Credits", value: `₹${data.balanceAmount.toLocaleString()}`, icon: AlertCircle, color: "text-amber-500", bg: "bg-amber-50" },
|
{ title: "Total Credits", value: `₹${(data?.balanceAmount ?? 0).toLocaleString()}`, icon: AlertCircle, color: "text-amber-500", bg: "bg-amber-50" },
|
||||||
{ title: "Credit Paid", value: `₹${data.paidAmount.toLocaleString()}`, icon: AlertCircle, color: "text-emerald-500", bg: "bg-emerald-50" },
|
{ title: "Credit Paid", value: `₹${(data?.paidAmount ?? 0).toLocaleString()}`, icon: AlertCircle, color: "text-emerald-500", bg: "bg-emerald-50" },
|
||||||
{ title: "Balance Credit", value: `₹${data.balanceAmount.toLocaleString()}`, icon: AlertCircle, color: "text-indigo-500", bg: "bg-indigo-50" },
|
{ title: "Balance Credit", value: `₹${(data?.balanceAmount ?? 0).toLocaleString()}`, icon: AlertCircle, color: "text-indigo-500", bg: "bg-indigo-50" },
|
||||||
{ title: "Bills to Pay", value: data.unpaidCount.toString(), icon: AlertCircle, color: "text-blue-500", bg: "bg-blue-50" }
|
{ title: "Bills to Pay", value: (data?.unpaidCount ?? 0).toString(), icon: AlertCircle, color: "text-blue-500", bg: "bg-blue-50" }
|
||||||
];
|
];
|
||||||
|
|
||||||
return (
|
return (
|
||||||
@@ -149,7 +149,7 @@ const PurchaseSummary = () => {
|
|||||||
</div>
|
</div>
|
||||||
<div className="h-[280px]">
|
<div className="h-[280px]">
|
||||||
<ResponsiveContainer width="100%" height="100%">
|
<ResponsiveContainer width="100%" height="100%">
|
||||||
<AreaChart data={data.trend}>
|
<AreaChart data={data?.trend}>
|
||||||
<defs>
|
<defs>
|
||||||
<linearGradient id="purchaseGradSum" x1="0" y1="0" x2="0" y2="1">
|
<linearGradient id="purchaseGradSum" x1="0" y1="0" x2="0" y2="1">
|
||||||
<stop offset="5%" stopColor="#f43f5e" stopOpacity={0.1}/>
|
<stop offset="5%" stopColor="#f43f5e" stopOpacity={0.1}/>
|
||||||
@@ -204,8 +204,8 @@ const PurchaseSummary = () => {
|
|||||||
{bill.status}
|
{bill.status}
|
||||||
</span>
|
</span>
|
||||||
</td>
|
</td>
|
||||||
<td className="px-6 py-5 text-right text-xs font-black text-rose-500">₹{bill.balance.toLocaleString()}</td>
|
<td className="px-6 py-5 text-right text-xs font-black text-rose-500">₹{(bill.balance ?? 0).toLocaleString()}</td>
|
||||||
<td className="px-6 py-5 text-right text-xs font-black text-[#0f4475]">₹{bill.amount.toLocaleString()}</td>
|
<td className="px-6 py-5 text-right text-xs font-black text-[#0f4475]">₹{(bill.amount ?? 0).toLocaleString()}</td>
|
||||||
</tr>
|
</tr>
|
||||||
))}
|
))}
|
||||||
</tbody>
|
</tbody>
|
||||||
|
|||||||
Reference in New Issue
Block a user