[freeside-commits] freeside/httemplate/elements
select-month_year.html, 1.1, 1.2 tr-select-from_to.html, NONE,
1.1 tr-select-pkg_class.html, 1.1, 1.2 select-pkg_class.html,
1.1, 1.2 select-table.html, 1.1, 1.2
Ivan,,,
ivan at wavetail.420.am
Sun May 7 13:27:23 PDT 2006
Update of /home/cvs/cvsroot/freeside/httemplate/elements
In directory wavetail:/tmp/cvs-serv30449/httemplate/elements
Modified Files:
select-month_year.html tr-select-pkg_class.html
select-pkg_class.html select-table.html
Added Files:
tr-select-from_to.html
Log Message:
first pass at sales reports per agent and package class
Index: select-pkg_class.html
===================================================================
RCS file: /home/cvs/cvsroot/freeside/httemplate/elements/select-pkg_class.html,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -d -r1.1 -r1.2
--- select-pkg_class.html 22 Apr 2006 00:58:39 -0000 1.1
+++ select-pkg_class.html 7 May 2006 20:27:21 -0000 1.2
@@ -1,16 +1,17 @@
<%
my( $classnum, %opt ) = @_;
- my %select_opt = ();
- $select_opt{'records'} = $opt{'pkg_class'}
+ $opt{'records'} = delete $opt{'pkg_class'}
if $opt{'pkg_class'};
+ #warn "***** select-pkg-class: \n". Dumper(%opt);
+
%><%= include( '/elements/select-table.html',
'table' => 'pkg_class',
'name_col' => 'classname',
'value' => $classnum,
'empty_label' => '(none)',
#'hashref' => { 'disabled' => '' },
- #%select_opt,
+ %opt,
)
%>
Index: select-table.html
===================================================================
RCS file: /home/cvs/cvsroot/freeside/httemplate/elements/select-table.html,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -d -r1.1 -r1.2
--- select-table.html 22 Apr 2006 00:58:39 -0000 1.1
+++ select-table.html 7 May 2006 20:27:21 -0000 1.2
@@ -11,9 +11,12 @@
# 'empty_label' => '', #better specify it though, the default might change
# 'hashref' => {},
# 'records' => \@records, #instead of hashref
+ # 'pre_options' => [ 'value' => 'option' ], #before normal options
my( %opt ) = @_;
+ #warn "***** select-table: \n". Dumper(%opt);
+
my $key = dbdef->table($opt{'table'})->primary_key; #? $opt{'primary_key'} ||
my $name_col = $opt{'name_col'};
@@ -25,11 +28,17 @@
@records = qsearch( $opt{'table'}, ( $opt{'hashref'} || {} ) );
}
+ my @pre_options = $opt{'pre_options'} ? @{ $opt{'pre_options'} } : ();
+
%>
<SELECT NAME="<%= $key %>">
- <OPTION VALUE=""><%= $opt{'empty_label'} || 'all' %></OPTION>
+ <% while ( @pre_options ) { %>
+ <OPTION VALUE="<%= shift(@pre_options) %>"><%= shift(@pre_options) %>
+ <% } %>
+
+ <OPTION VALUE=""><%= $opt{'empty_label'} || 'all' %>
<% foreach my $record ( sort { $a->$name_col() cmp $b->$name_col() }
@records
Index: select-month_year.html
===================================================================
RCS file: /home/cvs/cvsroot/freeside/httemplate/elements/select-month_year.html,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -d -r1.1 -r1.2
--- select-month_year.html 24 Aug 2005 13:22:27 -0000 1.1
+++ select-month_year.html 7 May 2006 20:27:21 -0000 1.2
@@ -5,13 +5,22 @@
my $prefix = $opt{'prefix'} || '';
my $disabled = $opt{'disabled'} || '';
my $empty = $opt{'empty_option'} || '';
+ my $start_year = $opt{'start_year'};
+ my $end_year = $opt{'end_year'} || '2037';
+
+ my @mon;
+ if ( $opt{'show_month_abbr'} ) {
+ @mon = qw(Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec);
+ } else {
+ @mon = ( 1 .. 12 );
+ }
+
my $date = $opt{'selected_date'} || '';
$date = '' if $date eq '-';
#$date ||= '01-2000' unless $empty;
- my $start_year = $opt{'start_year'};
- my $end_year = $opt{'end_year'} || '2037';
- my( $mon, $year ) = (0, 0);
+ my $mon = $opt{'selected_mon'} || 0;
+ my $year = $opt{'selected_year'} || 0;
if ( $date ) {
if ( $date =~ /^(\d{4})-(\d{1,2})-\d{1,2}$/ ) { #PostgreSQL date format
( $mon, $year ) = ( $2, $1 );
@@ -34,8 +43,8 @@
<%= $empty ? '<OPTION VALUE="">' : '' %>
-<% for ( 1 .. 12 ) { %>
- <OPTION<%= $_ == $mon ? ' SELECTED' : '' %> VALUE="<%= $_ %>"><%= $_ %>
+<% foreach ( 1 .. 12 ) { %>
+ <OPTION<%= $_ == $mon ? ' SELECTED' : '' %> VALUE="<%= $_ %>"><%= $mon[$_-1] %>
<% } %>
</SELECT>/<SELECT NAME="<%= $prefix %>_year" SIZE="1" <%= $disabled%>>
Index: tr-select-pkg_class.html
===================================================================
RCS file: /home/cvs/cvsroot/freeside/httemplate/elements/tr-select-pkg_class.html,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -d -r1.1 -r1.2
--- tr-select-pkg_class.html 22 Apr 2006 00:58:39 -0000 1.1
+++ tr-select-pkg_class.html 7 May 2006 20:27:21 -0000 1.2
@@ -1,16 +1,12 @@
<%
my( $classnum, %opt ) = @_;
- my @pkg_class;
- if ( $opt{'pkg_class'} ) {
- @pkg_class = @{ $opt{'pkg_class'} };
- } else {
- @pkg_class = qsearch( 'pkg_class', {} ); # { disabled=>'' } );
- }
+ $opt{'pkg_class'} ||= [ qsearch( 'pkg_class', {} ) ]; # { disabled=>'' } )
+ #warn "***** tr-select-pkg-class: \n". Dumper(%opt);
%>
-<% if ( scalar(@pkg_class) == 0 ) { %>
+<% if ( scalar(@{ $opt{'pkg_class'} }) == 0 ) { %>
<INPUT TYPE="hidden" NAME="classnum" VALUE="">
@@ -19,10 +15,7 @@
<TR>
<TD ALIGN="right"><%= $opt{'label'} || 'Package class' %></TD>
<TD>
- <%= include( '/elements/select-pkg_class.html', $classnum,
- 'pkg_class' => \@pkg_class,
- )
- %>
+ <%= include( '/elements/select-pkg_class.html', $classnum, %opt ) %>
</TD>
</TR>
--- NEW FILE: tr-select-from_to.html ---
<%
#my ($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) = localtime(time);
my ($curmon,$curyear) = (localtime(time))[4,5];
#find first month
my $syear = 1899+$curyear;
my $smonth = $curmon+1;
#want 12 month by default, not 13
$smonth++;
if ( $smonth > 12 ) { $smonth-=12; $syear++ }
#find last month
my $eyear = 1900+$curyear;
my $emonth = $curmon+1;
my %hash = (
'show_month_abbr' => 1,
'start_year' => '1999',
'end_year' => '2012', #haha, well...
@_,
);
%>
<TR>
<TD ALIGN="right">From: </TD>
<TD>
<%= include('/elements/select-month_year.html',
'prefix' => 'start',
'selected_mon' => $smonth,
'selected_year' => $syear,
%hash,
)
%>
</TD>
</TR>
<TR>
<TD ALIGN="right">To: </TD>
<TD>
<%= include('/elements/select-month_year.html',
'prefix' => 'end',
'selected_mon' => $emonth,
'selected_year' => $eyear,
%hash,
)
%>
</TD>
</TR>
More information about the freeside-commits
mailing list