From 839f478572b46639e5f96a09f3fa29cdc0a63f80 Mon Sep 17 00:00:00 2001 From: miker Date: Tue, 27 Dec 2005 19:09:03 +0000 Subject: [PATCH] trimming the widgets git-svn-id: svn://svn.open-ils.org/ILS/trunk@2533 dcc99617-32d9-48b4-a31d-7c20da2025e4 --- Open-ILS/src/reporter/widgets.example.xml | 72 ++++++++++++++++++----- 1 file changed, 58 insertions(+), 14 deletions(-) diff --git a/Open-ILS/src/reporter/widgets.example.xml b/Open-ILS/src/reporter/widgets.example.xml index fccc7170be..c17df24bab 100644 --- a/Open-ILS/src/reporter/widgets.example.xml +++ b/Open-ILS/src/reporter/widgets.example.xml @@ -49,11 +49,31 @@ + + + + + + + + This widget allows the user to pick an arbitrary time range + on which to report. + + + $full_col = "DATE_TRUNC('month', $full_col)"; + $where_clause = + "( $full_col = DATE_TRUNC('month', NOW() - CAST( ? || ' month' AS INTERVAL )) ". + " OR $full_col = DATE_TRUNC('month', NOW() - CAST( ? || ' month' AS INTERVAL )) )"; + push @$bind_list, $$val{target}, $$val{target} + $$val{compare}; + + + + + @@ -69,7 +90,7 @@ to report. - $full_col = "DATE_TRUNC($full_col, 'day')"; + $full_col = "DATE_TRUNC('day', $full_col)"; $where_clause = "$full_col = CAST(? AS DATE)"; push @$bind_list, sprintf('%d/%02d/%02d', @$val{qw/year month day/}); @@ -82,9 +103,10 @@ on which to report. - $full_col = "EXTRACT('week' FROM $full_col)"; - $where_clause = "$full_col = ?"; - push @$bind_list, $val; + $where_clause = + "( EXTRACT('year' FROM $full_col) = ? ". + " AND EXTRACT('week' FROM $full_col) = ? )"; + push @$bind_list, $$val{year}, $$val{week}; @@ -96,9 +118,9 @@ $where_clause = - "EXTRACT('year' FROM $full_col) = ? ". - "AND EXTRACT('week' FROM $full_col) ". - "BETWEEN ? AND ?"; + "( EXTRACT('year' FROM $full_col) = ? ". + " AND EXTRACT('week' FROM $full_col) ". + "BETWEEN ? AND ? )"; push @$bind_list, $$val{year}, $$val{start}, $$val{end}; @@ -111,8 +133,8 @@ $where_clause = - "EXTRACT('year' FROM $full_col) = ? ". - "AND EXTRACT('month' FROM $full_col) = ?"; + "( EXTRACT('year' FROM $full_col) = ? ". + " AND EXTRACT('month' FROM $full_col) = ? )"; push @$bind_list, $$val{'start-year'}, $$val{'start-month'}; @@ -125,7 +147,7 @@ $where_clause = - "DATE_TRUNC($full_col, 'month') ". + "DATE_TRUNC('month', $full_col) ". "BETWEEN CAST(? AS DATE) AND CAST(? AS DATE)"; push @$bind_list, sprintf('%d/%02d/01', @$val{qw/start-year start-month/}), @@ -133,6 +155,7 @@ + @@ -184,6 +208,12 @@ This widget allows the user to pick a date relative to the report runtime on which to report. + + $where_clause = + "DATE_TRUNC('day', $full_col) = ". + "DATE_TRUNC('day', NOW()) - CAST(? || ' day' AS INTERVAL); + push @$bind_list, $val; + @@ -192,6 +222,12 @@ This widget allows the user to pick a week (sun-sat) relative to the report runtime on which to report. + + $where_clause = + "( DATE_TRUNC('week', $full_col) = ". + " DATE_TRUNC('week', NOW() - CAST(? || ' weeks' AS INTERVAL) ) "; + push @$bind_list, $val; + @@ -202,12 +238,13 @@ $where_clause = - "DATE_TRUNC($full_col, 'month') = ". - "DATE_TRUNC(now(), 'month') - CAST(? || ' months' AS INTERVAL); + "DATE_TRUNC('month', $full_col) = ". + "DATE_TRUNC('month', NOW()) - CAST(? || ' months' AS INTERVAL); push @$bind_list, $val; + + This widget allows the user to pick a year relative to the report runtime on which to report. + + $where_clause = + "DATE_TRUNC('year', $full_col) = ". + "DATE_TRUNC('year', NOW()) - CAST(? || ' years' AS INTERVAL); + push @$bind_list, $val; + -- 2.43.2