syntax error fixed

This commit is contained in:
Andreas Knuth 2026-02-26 18:06:43 -06:00
parent 8f68ed02c5
commit d47d52b3d1
1 changed files with 2 additions and 2 deletions

View File

@ -1307,7 +1307,7 @@ app.get('/api/invoices/:id/pdf', async (req, res) => {
try {
// KORRIGIERT: Abfrage von line1-4
const invoiceResult = await pool.query(`
SELECT i.*, c.name as customer_name, c.line1, c.line2, c.line3, c.line4, c.city, c.state, c.zip_code, c.account_number
SELECT i.*, c.name as customer_name, c.line1, c.line2, c.line3, c.line4, c.city, c.state, c.zip_code, c.account_number,
COALESCE((SELECT SUM(pi.amount) FROM payment_invoices pi WHERE pi.invoice_id = i.id), 0) as amount_paid
FROM invoices i
LEFT JOIN customers c ON i.customer_id = c.id
@ -1550,7 +1550,7 @@ app.get('/api/invoices/:id/html', async (req, res) => {
try {
// KORREKTUR: Line 1-4 abfragen
const invoiceResult = await pool.query(`
SELECT i.*, c.name as customer_name, c.line1, c.line2, c.line3, c.line4, c.city, c.state, c.zip_code, c.account_number
SELECT i.*, c.name as customer_name, c.line1, c.line2, c.line3, c.line4, c.city, c.state, c.zip_code, c.account_number,
COALESCE((SELECT SUM(pi.amount) FROM payment_invoices pi WHERE pi.invoice_id = i.id), 0) as amount_paid
FROM invoices i
LEFT JOIN customers c ON i.customer_id = c.id