Index: openacs-4/packages/invoices/invoices.info =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/invoices/invoices.info,v diff -u -r1.5 -r1.6 --- openacs-4/packages/invoices/invoices.info 15 Sep 2005 14:39:45 -0000 1.5 +++ openacs-4/packages/invoices/invoices.info 16 Sep 2005 21:54:53 -0000 1.6 @@ -7,15 +7,15 @@ f t - + Timo Hentschel Invoices package that will collect costs to invoice items in invoices and store data about received payment. 2005-06-06 Cognovis Collect costs to invoice items and invoices, store payment information. 0 - + Index: openacs-4/packages/invoices/tcl/offer-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/invoices/tcl/offer-procs.tcl,v diff -u -r1.3 -r1.4 --- openacs-4/packages/invoices/tcl/offer-procs.tcl 6 Sep 2005 22:59:05 -0000 1.3 +++ openacs-4/packages/invoices/tcl/offer-procs.tcl 16 Sep 2005 21:53:29 -0000 1.4 @@ -275,3 +275,32 @@ return $mail_text } + + +ad_proc -public iv::offer::billed_p { + -offer_id:required +} { + @creation-date 2005-09-16 + + Returns 1 if the offer has been fully billed, 0 otherwise. This procedure is cached +} { + return [util_memoize [list iv::offer::billed_p_not_cached -offer_id $offer_id] 1] +} + +ad_proc -public iv::offer::billed_p_not_cached { + -offer_id:required +} { + @creation-date 2005-09-16 + + Returns 1 if the offer has been fully billed, 0 otherwise +} { + set offer_items_count [db_string get_items_count { } -default 0] + + set billed_items [db_string get_billed_items_count { } -default 0] + + if { [string equal $offer_items_count $billed_items] && [exists_and_not_null offer_id] } { + return 1 + } else { + return 0 + } +} \ No newline at end of file