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 -N -r1.2 -r1.3 --- openacs-4/packages/invoices/lib/report-year.tcl 7 Sep 2005 18:28:24 -0000 1.2 +++ openacs-4/packages/invoices/lib/report-year.tcl 13 Sep 2005 20:56:48 -0000 1.3 @@ -6,10 +6,6 @@ set orderby "" } -if {![info exists page_size]} { - set page_size 25 -} - if {![info exists package_id]} { set package_id [ad_conn package_id] } @@ -25,10 +21,19 @@ } set extra_query "" -if { [empty_string_p $organization_id] } { - set exrta_query "and iv.organization_id = $organization_id" +if { ![empty_string_p $organization_id] } { + set extra_query "and iv.organization_id = $organization_id" } +if { ![empty_string_p $month] } { + append extra_query " and to_char(iv.due_date, 'MM') = :month" +} + +if { ![empty_string_p $day] } { + append extra_query " and to_char(iv.due_date, 'DD') = :day" +} + +#ad_return_complaint 1 "$extra_query $day" foreach unset_param {new_clients_p account_manager_p} { if {[info exists $unset_param]} { if {[empty_string_p [set $unset_param]]} { @@ -37,40 +42,19 @@ } } -ad_form -name aggregate -form { - {organization_id:text(hidden) - {value $organization_id} - } - {last_years:text(text),optional - {label "[_ invoices.last_years]:"} - {value $last_years} - {html {size 2}} - {help_text { [_ invoices.aggregate_iv_from] }} - } -} - set extra_url "" # Filter to show only resulst for clients in less than 1 year if {[exists_and_not_null new_clients_p] } { append extra_url "&new_clients_p=$new_clients_p" - ad_form -extend -name aggregate -form { - {new_clients_p:text(hidden) - {value $new_clients_p} - } - } } set new_clients_where_clause "o.creation_date > now() - '1 year' :: interval" -# Account Manager Filter if {[exists_and_not_null account_manager_p] } { append extra_url "&account_manager_p=$account_manager_p" - ad_form -extend -name aggregate -form { - {account_manager_p:text(hidden) - {value $account_manager_p} - } - } } +append extra_url "&day=$day&month=$month&last_years=$last_years" + # Calculating from_year to use in the query # according of the number of years in last_years set act_date [dt_sysdate] @@ -102,6 +86,12 @@ } last_years { } + day { + } + year { + } + month { + } new_clients_p { label "[_ invoices.New_clients]" values {{"[_ invoices.New]" 1}} @@ -119,12 +109,6 @@ layout table row $row_list } - csv { - label "[_ invoices.CSV]" - output csv - page_size 0 - row $row_list - } } db_multirow -extend { iv_count iv_total_amount } iv_years iv_invoice_years " " {