fix: improve print layout and exclude paid bills
- Force white background on print preview page regardless of color scheme - Exclude paid bills from print view - Add proper spacing for printed barcodes - Remove legacy barcodeImage support 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
This commit is contained in:
@@ -45,7 +45,8 @@ export const fetchBarcodeDataForPrint = withUser(async (user: AuthenticatedUser,
|
||||
bills: 1,
|
||||
barcodeImage: 1,
|
||||
hub3aText: 1,
|
||||
payedAmount: 1
|
||||
payedAmount: 1,
|
||||
paid: 1
|
||||
}
|
||||
})
|
||||
.toArray();
|
||||
@@ -55,11 +56,8 @@ export const fetchBarcodeDataForPrint = withUser(async (user: AuthenticatedUser,
|
||||
|
||||
for (const location of locations) {
|
||||
for (const bill of location.bills) {
|
||||
// Only include bills that have barcode images
|
||||
if ( ( bill.hub3aText && bill.hub3aText.trim() !== "") ||
|
||||
// LEGACY SUPPORT ... untill all bills have been migrated
|
||||
(bill.barcodeImage && bill.barcodeImage.trim() !== "")
|
||||
) {
|
||||
// Only include bills that have barcode images and are NOT PAID
|
||||
if ( ( bill.hub3aText && bill.hub3aText.trim() !== "" && !bill.paid) ) {
|
||||
printData.push({
|
||||
locationName: location.name,
|
||||
billName: bill.name,
|
||||
|
||||
@@ -24,6 +24,12 @@ export const PrintPreview: React.FC<PrintPreviewProps> = ({ data, year, month, t
|
||||
return (
|
||||
<>
|
||||
{/* Print-specific CSS styles */}
|
||||
<style jsx global>{`
|
||||
html {
|
||||
background-color: white !important;
|
||||
color-scheme: light !important;
|
||||
}
|
||||
`}</style>
|
||||
<style jsx>{`
|
||||
@media print {
|
||||
@page {
|
||||
@@ -132,7 +138,7 @@ export const PrintPreview: React.FC<PrintPreviewProps> = ({ data, year, month, t
|
||||
<td className="border-2 border-gray-800 px-3 py-1.5 text-center">
|
||||
<div className="flex justify-center items-center">
|
||||
{
|
||||
item.hub3aText ? <Pdf417Barcode hub3aText={item.hub3aText} /> : null
|
||||
item.hub3aText ? <Pdf417Barcode hub3aText={item.hub3aText} className="print:m-[5em_auto]" /> : null
|
||||
}
|
||||
</div>
|
||||
</td>
|
||||
|
||||
Reference in New Issue
Block a user