Index: openacs-4/packages/invoices/invoices.info =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/invoices/invoices.info,v diff -u -r1.13 -r1.14 --- openacs-4/packages/invoices/invoices.info 7 Nov 2005 23:10:50 -0000 1.13 +++ openacs-4/packages/invoices/invoices.info 9 Nov 2005 19:28:54 -0000 1.14 @@ -7,18 +7,18 @@ f t - + Timo Hentschel Invoices package that will collect costs to invoice items in invoices and store data about received payment. - 2005-11-07 + 2005-11-09 Cognovis Collect costs to invoice items and invoices, store payment information. 0 - + - + Index: openacs-4/packages/invoices/catalog/invoices.en_US.ISO-8859-1.xml =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/invoices/catalog/invoices.en_US.ISO-8859-1.xml,v diff -u -r1.15 -r1.16 --- openacs-4/packages/invoices/catalog/invoices.en_US.ISO-8859-1.xml 7 Nov 2005 23:10:51 -0000 1.15 +++ openacs-4/packages/invoices/catalog/invoices.en_US.ISO-8859-1.xml 9 Nov 2005 19:28:54 -0000 1.16 @@ -1,5 +1,5 @@ - + Accepted on Add offer project @@ -341,6 +341,7 @@ Credit Offer Accepted Offer + Total Total amount h Unmounted Index: openacs-4/packages/invoices/lib/offer-items-list.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/invoices/lib/offer-items-list.tcl,v diff -u -r1.4 -r1.5 --- openacs-4/packages/invoices/lib/offer-items-list.tcl 7 Nov 2005 23:10:51 -0000 1.4 +++ openacs-4/packages/invoices/lib/offer-items-list.tcl 9 Nov 2005 19:28:55 -0000 1.5 @@ -130,11 +130,13 @@ } if { [exists_and_not_null category_id] } { - if { [string equal $c_id $category_id] } { - append aggregate_amount "
  • $c_name:" - append aggregate_amount "$total_amount" - append aggregate_amount "" - } + foreach cat_id $category_id { + if { [string equal $c_id $cat_id] } { + append aggregate_amount "
  • $c_name:" + append aggregate_amount "$total_amount" + append aggregate_amount "" + } + } } else { append aggregate_amount "
  • $c_name:" append aggregate_amount "$total_amount" @@ -160,11 +162,17 @@ creation_date [list label "[_ invoices.Creation_Date]"] \ month [list label ""] +set cat_where_clause "" +if { [exists_and_not_null category_id] } { + set cat_where_clause "com.category_id in ([template::util::tcl_to_sql_list $category_id])" +} + set filters [list \ category_id { label "[_ invoices.Category]" values $categories_filter - where_clause { com.category_id = :category_id } + type multival + where_clause { $cat_where_clause } } \ filter_package_id { where_clause { oi.object_package_id = :filter_package_id } Index: openacs-4/packages/invoices/lib/report-invoice-items-portlet.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/invoices/lib/report-invoice-items-portlet.adp,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/invoices/lib/report-invoice-items-portlet.adp 9 Nov 2005 19:29:27 -0000 1.1 @@ -0,0 +1,24 @@ + +@portlet_title;noquote@ + + + + + +
    + + + + +
    + +
    +
    \ No newline at end of file Index: openacs-4/packages/invoices/lib/report-invoice-items-portlet.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/invoices/lib/report-invoice-items-portlet.tcl,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/invoices/lib/report-invoice-items-portlet.tcl 9 Nov 2005 19:29:27 -0000 1.1 @@ -0,0 +1,10 @@ +set required_param_list [list portlet_title base_url] + +foreach required_param $required_param_list { + if {![info exists $required_param]} { + return -code error "$required_param is a required parameter." + } +} + +set portlet_layout [parameter::get -parameter "DefaultPortletLayout"] + Index: openacs-4/packages/invoices/lib/report-invoice-items.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/invoices/lib/report-invoice-items.adp,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/invoices/lib/report-invoice-items.adp 9 Nov 2005 19:29:27 -0000 1.1 @@ -0,0 +1,15 @@ +@date_filter;noquote@ +

    + + + + +
    + +
    +
      +
    • #invoices.Total#: @final_amount@ +
    +
    +
    + Index: openacs-4/packages/invoices/lib/report-invoice-items.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/invoices/lib/report-invoice-items.tcl,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/invoices/lib/report-invoice-items.tcl 9 Nov 2005 19:29:27 -0000 1.1 @@ -0,0 +1,115 @@ +set optional_param_list [list] +set optional_unset_list [list category_f] + +foreach optional_unset $optional_unset_list { + if {[info exists $optional_unset]} { + if {[empty_string_p [set $optional_unset]]} { + unset $optional_unset + } + } +} + +foreach optional_param $optional_param_list { + if {![info exists $optional_param]} { + set $optional_param {} + } +} + + +# Procedure that manages the date filter +set date_filter [iv::invoice::year_month_day_filter \ + -base $base_url \ + -year $year \ + -month $month \ + -day $day \ + -last_years $last_years \ + -extra_vars ""] + +set category_where_clause "" +#if { [exists_and_not_null category_f] } { +# set category_f [split $category_f ","] +# append category_where_clause "category in ([template::util::tcl_to_sql_list $category_f])" +#} + +set return_url [ad_return_url] +set extra_query "" + +if { [exists_and_not_null year] } { + # We get the projects for this year + append extra_query " and to_char(ii.creation_date, 'YYYY') = :year" +} + +if { [exists_and_not_null month] } { + # We get the projects for this specific month + append extra_query " and to_char(ii.creation_date, 'MM') = :month" +} + +if { [exists_and_not_null day] } { + # We get the projects for this specific day + append extra_query " and to_char(ii.creation_date, 'DD') = :day" +} + +template::list::create \ + -name reports \ + -multirow reports \ + -filters { + year {} + month {} + day {} + } -elements { + title { + label "[_ invoices.iv_invoice_item_Title]:" + display_template { + + @reports.title@ + + + (@reports.iv_items@) + + + (@reports.iv_items@) + + + + (@reports.iv_items@) + + + + @reports.title@ + + } + } + creation_date { + label "[_ invoices.Creation_Date]:" + } + amount_total { + label "[_ invoices.Amount_total]" + } + } + + + +template::multirow create reports iv_items title creation_date amount_total + +set iv_items [db_list_of_lists get_iv_items { }] + +if { [exists_and_not_null year] && [exists_and_not_null month] && [exists_and_not_null day] || $show_p} { + # We get only the projects that match the exact date + foreach item $iv_items { + set iv_item_id [lindex $item 0] + set title [lindex $item 1] + set creation_date [lindex $item 2] + set iv_item_total [lindex $item 3] + set final_amount [db_string get_final_amount {} -default 0] + + template::multirow append reports $iv_item_id $title $creation_date $iv_item_total + } +} else { + # We accumulate the amount_total and the number of iv_invoice_items + set iv_items_count [llength $iv_items] + set amount [db_string get_final_amount {} -default 0] + if { $iv_items_count > 0 } { + template::multirow append reports $iv_items_count "[_ invoices.Invoice_Items]" "- - - - - - - - - - -" $amount + } +} + Index: openacs-4/packages/invoices/lib/report-invoice-items.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/invoices/lib/report-invoice-items.xql,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/invoices/lib/report-invoice-items.xql 9 Nov 2005 19:29:27 -0000 1.1 @@ -0,0 +1,40 @@ + + + + + + select + ii.iv_item_id, + ii.title as item_title, + to_char(ii.creation_date, 'YYYY-MM-DD') as creation_date, + ii.amount_total + from + iv_invoice_itemsx ii, + iv_invoicesx iv, + cr_items i + where + iv.item_id = i.item_id + and ii.invoice_id = iv.invoice_id + and ii.invoice_id = i.latest_revision + $extra_query + [template::list::filter_where_clauses -and -name "reports"] + + + + + + select + sum(ii.amount_total) + from + iv_invoice_itemsx ii, + iv_invoicesx iv, + cr_items i + where + iv.item_id = i.item_id + and ii.invoice_id = iv.invoice_id + and ii.invoice_id = i.latest_revision + $extra_query + + + + \ No newline at end of file Index: openacs-4/packages/invoices/www/invoice-items-reports.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/invoices/www/invoice-items-reports.adp,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/invoices/www/invoice-items-reports.adp 9 Nov 2005 19:29:27 -0000 1.1 @@ -0,0 +1,15 @@ + +@page_title;noquote@ +@context;noquote@ + + + Index: openacs-4/packages/invoices/www/invoice-items-reports.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/invoices/www/invoice-items-reports.tcl,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/invoices/www/invoice-items-reports.tcl 9 Nov 2005 19:29:27 -0000 1.1 @@ -0,0 +1,17 @@ +ad_page_contract { + +} { + {year ""} + {month ""} + {day ""} + {last_years "5"} + {show_p "f"} + {category_f:multiple ""} +} + +set page_title "[_ invoices.Invoice_Items_Reports]" +set context [list $page_title] + +set base_url [ad_conn url] + +set elements [list] \ No newline at end of file Index: openacs-4/packages/invoices/www/offer-items.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/invoices/www/offer-items.tcl,v diff -u -r1.3 -r1.4 --- openacs-4/packages/invoices/www/offer-items.tcl 7 Nov 2005 23:10:51 -0000 1.3 +++ openacs-4/packages/invoices/www/offer-items.tcl 9 Nov 2005 19:28:55 -0000 1.4 @@ -8,7 +8,7 @@ } { {page "1"} {offer_items_orderby ""} - {category_id ""} + {category_id:multiple ""} {filter_package_id ""} {customer_id ""} {date_range_start ""}