This commit is contained in:
2026-05-29 11:42:01 -05:00
parent 17be918883
commit c59bdb154d
3 changed files with 25 additions and 25 deletions

View File

@@ -50,17 +50,17 @@ function buildPaymentLinkHtml(invoice) {
// GET all invoices
router.get('/', async (req, res) => {
try {
const { has_parts_or_subscription, empty_cost_only } = req.query;
const { has_parts, empty_cost_only } = req.query;
let whereClauses = [];
if (has_parts_or_subscription === 'true') {
if (has_parts === 'true') {
const costCondition = empty_cost_only === 'true'
? `AND (ii.unit_cost IS NULL OR ii.unit_cost = '')`
: '';
whereClauses.push(`EXISTS (
SELECT 1 FROM invoice_items ii
WHERE ii.invoice_id = i.id
AND (ii.qbo_item_id = '9' OR ii.qbo_item_id = '115')
AND ii.qbo_item_id = '9'
${costCondition}
)`);
}