Added invoice amount to /invoices endpoint

This commit is contained in:
Aswin B. S 2025-07-08 14:15:43 +05:30
parent 9fb76e7277
commit fa7791e203

View File

@ -186,8 +186,13 @@ WHERE LOWER(line_item_product_code) = LOWER('%productCode%')
export const invoices = `select DISTINCT
bill_invoice_id as invoiceId,
year, month
FROM ${process.env.ATHENA_CU_TABLE}`;
year, month,
SUM(line_item_unblended_cost) AS totalUnblendedCost,
SUM(line_item_blended_cost) AS totalBlendedCost
FROM ${process.env.ATHENA_CU_TABLE}
WHERE bill_invoice_id IS NOT NULL
GROUP BY bill_invoice_id, year, month
ORDER BY year DESC, month DESC;`
export const invoiceById = `select DISTINCT
bill_invoice_id as invoiceId,
@ -217,7 +222,7 @@ FROM ${process.env.ATHENA_CU_TABLE}
WHERE bill_invoice_id = '%invoiceId%'
AND LOWER(line_item_product_code) = LOWER('%productCode%');`;
export const invoiceByProductCodeUsage = `
export const invoiceByProductCodeUsage = `
SELECT DISTINCT
bill_invoice_id as invoiceId,
year, month,