Index: openacs-4/packages/invoices/lib/report-day-postgresql.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/invoices/lib/report-day-postgresql.xql,v diff -u -r1.2 -r1.3 --- openacs-4/packages/invoices/lib/report-day-postgresql.xql 7 Sep 2005 16:51:55 -0000 1.2 +++ openacs-4/packages/invoices/lib/report-day-postgresql.xql 7 Sep 2005 18:28:24 -0000 1.3 @@ -20,8 +20,8 @@ and to_char(due_date, 'MM') = :month and r.revision_id = i.latest_revision and iv.invoice_id = r.revision_id - and iv.organization_id = :organization_id and iv.recipient_id = o.object_id + $extra_query [template::list::filter_where_clauses -and -name iv_days] [template::list::orderby_clause -name iv_days -orderby] @@ -36,7 +36,7 @@ where to_char(due_date, 'MM') = :month and to_char(due_date, 'YYYY') = :year - and organization_id = :organization_id + $extra_query Index: openacs-4/packages/invoices/lib/report-day.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/invoices/lib/report-day.tcl,v diff -u -r1.2 -r1.3 --- openacs-4/packages/invoices/lib/report-day.tcl 7 Sep 2005 16:51:55 -0000 1.2 +++ openacs-4/packages/invoices/lib/report-day.tcl 7 Sep 2005 18:28:24 -0000 1.3 @@ -32,6 +32,11 @@ } } +set extra_query "" +if { [empty_string_p $organization_id] } { + set exrta_query "and iv.organization_id = $organization_id" +} + set actions [list "[_ invoices.back_to_year]" \ [export_vars -base invoice-reports {organization_id year new_clients_p account_manager_p}]] Index: openacs-4/packages/invoices/lib/report-month-postgresql.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/invoices/lib/report-month-postgresql.xql,v diff -u -r1.1 -r1.2 --- openacs-4/packages/invoices/lib/report-month-postgresql.xql 6 Sep 2005 23:00:14 -0000 1.1 +++ openacs-4/packages/invoices/lib/report-month-postgresql.xql 7 Sep 2005 18:28:24 -0000 1.2 @@ -10,8 +10,8 @@ acs_objects o where to_char(iv.due_date, 'YYYY') = :year - and iv.organization_id = :organization_id and iv.recipient_id = o.object_id + $extra_query [template::list::filter_where_clauses -and -name iv_months] @@ -25,7 +25,7 @@ where to_char(due_date, 'YYYY') = :year and to_char(due_date, 'MM') = :iv_month - and organization_id = :organization_id + $extra_query @@ -38,6 +38,7 @@ where to_char(due_date, 'YYYY') = :year and to_char(due_date, 'MM') = :iv_month + $extra_query Index: openacs-4/packages/invoices/lib/report-month.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/invoices/lib/report-month.tcl,v diff -u -r1.1 -r1.2 --- openacs-4/packages/invoices/lib/report-month.tcl 6 Sep 2005 23:00:14 -0000 1.1 +++ openacs-4/packages/invoices/lib/report-month.tcl 7 Sep 2005 18:28:24 -0000 1.2 @@ -32,6 +32,11 @@ } } +set extra_query "" +if { [empty_string_p $organization_id] } { + set exrta_query "and iv.organization_id = $organization_id" +} + set actions [list "[_ invoices.back_to_years]" \ [export_vars -base invoice-reports {organization_id new_clients_p account_manager_p}]] @@ -103,7 +108,7 @@ } else { set short_month [template::util::date::monthName $iv_month short] } - set iv_total_amount [db_string get_iv_total_amount { }] - set iv_count [db_string get_iv_count { }] + set iv_total_amount [db_string get_iv_total_amount " "] + set iv_count [db_string get_iv_count " "] } Index: openacs-4/packages/invoices/lib/report-year-postgresql.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/invoices/lib/report-year-postgresql.xql,v diff -u -r1.1 -r1.2 --- openacs-4/packages/invoices/lib/report-year-postgresql.xql 6 Sep 2005 23:00:14 -0000 1.1 +++ openacs-4/packages/invoices/lib/report-year-postgresql.xql 7 Sep 2005 18:28:24 -0000 1.2 @@ -10,8 +10,8 @@ acs_objects o where iv.due_date > now() - '$last_years years' :: interval - and iv.organization_id = :organization_id and iv.recipient_id = o.object_id + $extra_query [template::list::filter_where_clauses -and -name iv_years] @@ -24,7 +24,7 @@ iv_invoices where to_char(due_date, 'YYYY') = :iv_year - and organization_id = :organization_id + $extra_query @@ -36,7 +36,7 @@ iv_invoices where to_char(due_date, 'YYYY') = :iv_year - and organization_id = :organization_id + $extra_query Index: openacs-4/packages/invoices/lib/report-year.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/invoices/lib/report-year.tcl,v diff -u -r1.1 -r1.2 --- openacs-4/packages/invoices/lib/report-year.tcl 6 Sep 2005 23:00:14 -0000 1.1 +++ openacs-4/packages/invoices/lib/report-year.tcl 7 Sep 2005 18:28:24 -0000 1.2 @@ -18,12 +18,17 @@ set base_url [apm_package_url_from_id $package_id] } -foreach optional_param {row_list} { +foreach optional_param {row_list organization_id} { if {![info exists $optional_param]} { set $optional_param {} } } +set extra_query "" +if { [empty_string_p $organization_id] } { + set exrta_query "and iv.organization_id = $organization_id" +} + foreach unset_param {new_clients_p account_manager_p} { if {[info exists $unset_param]} { if {[empty_string_p [set $unset_param]]} { @@ -123,6 +128,6 @@ } db_multirow -extend { iv_count iv_total_amount } iv_years iv_invoice_years " " { - set iv_count [db_string get_iv_count { }] - set iv_total_amount [db_string get_iv_total_amount { }] + set iv_count [db_string get_iv_count " "] + set iv_total_amount [db_string get_iv_total_amount " "] } \ No newline at end of file