Index: openacs-4/packages/invoices/www/invoice-ae.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/invoices/www/invoice-ae.xql,v diff -u -r1.4 -r1.5 --- openacs-4/packages/invoices/www/invoice-ae.xql 28 Sep 2005 17:19:12 -0000 1.4 +++ openacs-4/packages/invoices/www/invoice-ae.xql 11 Oct 2005 15:23:29 -0000 1.5 @@ -7,7 +7,7 @@ select t.organization_id, t.currency, t.paid_currency, t.vat_percent as cur_vat_percent, t.cancelled_p, t.invoice_id as invoice_rev_id, t.parent_invoice_id, - t.total_amount as cur_total_amount, + t.total_amount as cur_total_amount, t.status, t.amount_sum as cur_amount_sum from iv_invoices t, cr_items i where i.latest_revision = t.invoice_id @@ -75,7 +75,7 @@ - select cr.title, cr.description, ofi.offer_item_id, ofi.item_units, + select cr.title, cr.description, ofi.offer_item_id, ofi.item_units, ofi.offer_id, ofi.price_per_unit, ofi.item_nr, pi.item_id as project_id, pr.title as project_title, ofi.vat, ofi.rebate, m.category_id from iv_offer_items ofi, cr_items oi, cr_revisions cr, @@ -105,7 +105,7 @@ select ir.title, ir.description, ir.item_id as iv_item_id, - i.item_units, i.price_per_unit, i.item_nr, + i.item_units, i.price_per_unit, i.item_nr, ofi.offer_id, pi.item_id as project_id, pr.title as project_title, i.vat as old_vat, i.rebate, m.category_id, i.offer_item_id from cr_items oi, iv_offer_items ofi, iv_invoice_items i, @@ -175,4 +175,29 @@ + + + + select count(*) as unbilled_items + from iv_offers o, iv_offer_items ofi + where o.offer_id = :offer_id + and ofi.offer_id = o.offer_id + and not exists (select 1 + from iv_invoice_items ii + where ii.offer_item_id = ofi.offer_item_id) + group by o.offer_id + + + + + + + + update iv_offers + set status = :status + where offer_id = :offer_id + + + +