diff --git a/routes/billing.js b/routes/billing.js index 57275b9..998440f 100644 --- a/routes/billing.js +++ b/routes/billing.js @@ -216,6 +216,12 @@ router.get('/export/csv', requireAdmin, async (req, res) => { ORDER BY m.last_name ASC `, [period]); + // Alle offenen Rechnungen dieser Periode als bezahlt markieren + await db.query( + "UPDATE invoices SET status='paid', paid_at=NOW() WHERE period=? AND status='open'", + [period] + ); + res.setHeader('Content-Type', 'text/csv; charset=utf-8'); res.setHeader('Content-Disposition', `attachment; filename="SEPA_${period}.csv"`);