Filter bills display to show only billedToTenant bills
Updated all components to respect the billedToTenant flag: - LocationCard: Filter bills display and monthlyExpense calculation - ViewLocationCard: Filter bills display and monthlyExpense calculation - HomePage: Update monthlyExpense calculations for month grouping - printActions: Filter barcode print data to only include tenant bills All filtering uses (bill.billedToTenant ?? true) for backward compatibility with existing bills that don't have this property set. This ensures users only see and calculate expenses for bills that are the tenant's responsibility. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
@@ -49,7 +49,7 @@ export const HomePage:FC<HomePageProps> = async ({ searchParams }) => {
|
||||
[key]: {
|
||||
yearMonth: location.yearMonth,
|
||||
locations: [...locationsInMonth.locations, location],
|
||||
monthlyExpense: locationsInMonth.monthlyExpense + location.bills.reduce((acc, bill) => bill.paid ? acc + (bill.payedAmount ?? 0) : acc, 0)
|
||||
monthlyExpense: locationsInMonth.monthlyExpense + location.bills.reduce((acc, bill) => (bill.paid && (bill.billedToTenant ?? true)) ? acc + (bill.payedAmount ?? 0) : acc, 0)
|
||||
}
|
||||
})
|
||||
}
|
||||
@@ -59,7 +59,7 @@ export const HomePage:FC<HomePageProps> = async ({ searchParams }) => {
|
||||
[key]: {
|
||||
yearMonth: location.yearMonth,
|
||||
locations: [location],
|
||||
monthlyExpense: location.bills.reduce((acc, bill) => bill.paid ? acc + (bill.payedAmount ?? 0) : acc, 0)
|
||||
monthlyExpense: location.bills.reduce((acc, bill) => (bill.paid && (bill.billedToTenant ?? true)) ? acc + (bill.payedAmount ?? 0) : acc, 0)
|
||||
}
|
||||
});
|
||||
}, {} as {[key:string]:{
|
||||
|
||||
Reference in New Issue
Block a user