Index: openacs-4/packages/invoices/lib/report-first-order.adp
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/invoices/lib/report-first-order.adp,v
diff -u -r1.1 -r1.2
--- openacs-4/packages/invoices/lib/report-first-order.adp 10 Apr 2006 15:58:36 -0000 1.1
+++ openacs-4/packages/invoices/lib/report-first-order.adp 13 Apr 2006 12:13:12 -0000 1.2
@@ -1,4 +1 @@
-@date_filter;noquote@
-
-
Index: openacs-4/packages/invoices/lib/report-first-order.tcl
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/invoices/lib/report-first-order.tcl,v
diff -u -r1.1 -r1.2
--- openacs-4/packages/invoices/lib/report-first-order.tcl 10 Apr 2006 15:58:36 -0000 1.1
+++ openacs-4/packages/invoices/lib/report-first-order.tcl 13 Apr 2006 12:13:13 -0000 1.2
@@ -1,5 +1,5 @@
set optional_param_list [list]
-set optional_unset_list [list category_f]
+set optional_unset_list [list]
foreach optional_unset $optional_unset_list {
if {[info exists $optional_unset]} {
@@ -16,34 +16,19 @@
}
-# 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 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(ao.creation_date, 'YYYY') = :year"
+set start_date_sql ""
+if { $start_date != "YYYY-MM-DD" } {
+ # Get all customer invoices starting with start_date
+ set start_date_sql "ao.creation_date > to_timestamp(:start_date, 'YYYY-MM-DD')"
}
-if { [exists_and_not_null month] } {
- # We get the projects for this specific month
- append extra_query " and to_char(ao.creation_date, 'MM') = :month"
+set end_date_sql ""
+if { $end_date != "YYYY-MM-DD" } {
+ # Get all customer invoices up to and including end_date
+ set end_date_sql "ao.creation_date < to_timestamp(:end_date, 'YYYY-MM-DD') + interval '1 day'"
}
-if { [exists_and_not_null day] } {
- # We get the projects for this specific day
- append extra_query " and to_char(ao.creation_date, 'DD') = :day"
-}
-
template::list::create \
-name reports \
-multirow reports \
@@ -83,6 +68,13 @@
orderby {o.amount_total}
default_direction desc
}
+ } -filters {
+ start_date {
+ where_clause $start_date_sql
+ }
+ end_date {
+ where_clause $end_date_sql
+ }
}
Index: openacs-4/packages/invoices/lib/report-first-order.xql
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/invoices/lib/report-first-order.xql,v
diff -u -r1.1 -r1.2
--- openacs-4/packages/invoices/lib/report-first-order.xql 10 Apr 2006 15:58:36 -0000 1.1
+++ openacs-4/packages/invoices/lib/report-first-order.xql 13 Apr 2006 12:13:13 -0000 1.2
@@ -17,7 +17,7 @@
and o.offer_id = i.latest_revision
and o.organization_id = sub.organization_id
and o.offer_id = sub.offer_id
- $extra_query
+ [template::list::filter_where_clauses -and -name "reports"]
[template::list::orderby_clause -name reports -orderby]
Index: openacs-4/packages/invoices/www/offer-first-reports.adp
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/invoices/www/offer-first-reports.adp,v
diff -u -r1.1 -r1.2
--- openacs-4/packages/invoices/www/offer-first-reports.adp 10 Apr 2006 15:58:36 -0000 1.1
+++ openacs-4/packages/invoices/www/offer-first-reports.adp 13 Apr 2006 12:13:12 -0000 1.2
@@ -3,12 +3,30 @@
@context;noquote@
+
+
+
+
+ |
+
Index: openacs-4/packages/invoices/www/offer-first-reports.tcl
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/invoices/www/offer-first-reports.tcl,v
diff -u -r1.1 -r1.2
--- openacs-4/packages/invoices/www/offer-first-reports.tcl 10 Apr 2006 15:58:36 -0000 1.1
+++ openacs-4/packages/invoices/www/offer-first-reports.tcl 13 Apr 2006 12:13:12 -0000 1.2
@@ -4,16 +4,22 @@
@author Timo Hentschel (timo@timohentschel.de)
} {
- {year ""}
- {month ""}
- {day ""}
+ {start_date "YYYY-MM-DD"}
+ {end_date "YYYY-MM-DD"}
{orderby ""}
- {last_years "5"}
}
set page_title "[_ invoices.First_Order_Reports]"
set context [list $page_title]
set base_url [ad_conn url]
+set current_url [ad_conn url]
+set clear_link [export_vars -base $current_url {page orderby organization_id}]
+set export_vars [export_vars -form {page orderby organization_id}]
+set clear_p 1
+if {$start_date == "YYYY-MM-DD" && $end_date == "YYYY-MM-DD"} {
+ set clear_p 0
+}
+
ad_return_template