daily sales/receipts report: fix customer class and date selection, #24853
authorMark Wells <mark@freeside.biz>
Thu, 17 Oct 2013 21:33:46 +0000 (14:33 -0700)
committerMark Wells <mark@freeside.biz>
Thu, 17 Oct 2013 21:33:46 +0000 (14:33 -0700)
FS/FS/Report/Table/Daily.pm
httemplate/elements/tr-input-beginning_ending.html
httemplate/graph/report_money_time_daily.html

index 6087b0d..570fefe 100644 (file)
@@ -27,6 +27,7 @@ FS::Report::Table::Daily - Tables of report data, indexed daily
     'end_day'     => 27,
     #opt
     'agentnum'    => 54
+    'cust_classnum' => [ 1,2,4 ],
     'params'      => [ [ 'paramsfor', 'item_one' ], [ 'item', 'two' ] ], # ...
     'remove_empty' => 1, #collapse empty rows, default 0
     'item_labels' => [ ], #useful with remove_empty
@@ -54,6 +55,8 @@ sub data {
   my $emonth = $self->{'end_month'};
   my $eyear = $self->{'end_year'};
   my $agentnum = $self->{'agentnum'};
+  my $cust_classnum = $self->{'cust_classnum'} || [];
+  $cust_classnum = [ $cust_classnum ] if !ref($cust_classnum);
 
   my %data;
 
@@ -83,6 +86,7 @@ sub data {
     for ( $i = 0; $i < scalar(@items); $i++ ) {
          my $item = $items[$i];
          my @param = $self->{'params'} ? @{ $self->{'params'}[$col] }: ();
+          push @param, 'cust_classnum' => $cust_classnum if @$cust_classnum;
          my $value = $self->$item($speriod, $eperiod, $agentnum, @param);
          push @{$data{data}->[$col++]}, $value;
     }
index ffc9038..91f55eb 100644 (file)
@@ -7,7 +7,7 @@
 
 <TR>
   <TD ALIGN="right">From date: </TD>
-  <TD><INPUT TYPE="text" NAME="<% $opt{prefix} %>beginning" ID="<% $opt{prefix} %>beginning_text" VALUE="<% $from %>" SIZE=<%$size%> MAXLENGTH=<%$maxlength%>> <IMG SRC="<%$fsurl%>images/calendar.png" ID="<% $opt{prefix} %>beginning_button" STYLE="cursor: pointer" TITLE="Select date"><IMG SRC="<%$fsurl%>images/calendar-disabled.png" ID="<% $opt{prefix} %>beginning_disabled" STYLE="display:none"><BR><i>m/d/y<% $time_hint %></i></TD>
+  <TD><INPUT TYPE="text" NAME="<% $opt{prefix} %>beginning" ID="<% $opt{prefix} %>beginning_text" VALUE="<% time2str($date_format, $from) %>" SIZE=<%$size%> MAXLENGTH=<%$maxlength%>> <IMG SRC="<%$fsurl%>images/calendar.png" ID="<% $opt{prefix} %>beginning_button" STYLE="cursor: pointer" TITLE="Select date"><IMG SRC="<%$fsurl%>images/calendar-disabled.png" ID="<% $opt{prefix} %>beginning_disabled" STYLE="display:none"><BR><i>m/d/y<% $time_hint %></i></TD>
 <SCRIPT TYPE="text/javascript">
   Calendar.setup({
     inputField: "<% $opt{prefix} %>beginning_text",
@@ -26,7 +26,7 @@
 % }
 
   <TD ALIGN="right">To date: </TD>
-  <TD><INPUT TYPE="text" NAME="<% $opt{prefix} %>ending" ID="<% $opt{prefix} %>ending_text" VALUE="<% $to %>" SIZE=<%$size%> MAXLENGTH=<%$maxlength%>> <IMG SRC="<%$fsurl%>images/calendar.png" ID="<% $opt{prefix} %>ending_button" STYLE="cursor: pointer" TITLE="Select date"><IMG SRC="<%$fsurl%>images/calendar-disabled.png" ID="<% $opt{prefix} %>ending_disabled" STYLE="display:none"><BR><i>m/d/y<% $time_hint %></i></TD>
+  <TD><INPUT TYPE="text" NAME="<% $opt{prefix} %>ending" ID="<% $opt{prefix} %>ending_text" VALUE="<% time2str($date_format, $to) %>" SIZE=<%$size%> MAXLENGTH=<%$maxlength%>> <IMG SRC="<%$fsurl%>images/calendar.png" ID="<% $opt{prefix} %>ending_button" STYLE="cursor: pointer" TITLE="Select date"><IMG SRC="<%$fsurl%>images/calendar-disabled.png" ID="<% $opt{prefix} %>ending_disabled" STYLE="display:none"><BR><i>m/d/y<% $time_hint %></i></TD>
 <SCRIPT TYPE="text/javascript">
   Calendar.setup({
     inputField: "<% $opt{prefix} %>ending_text",
index a436d08..e80f586 100644 (file)
@@ -4,12 +4,11 @@
 
 <TABLE>
 
-<% include( '/elements/tr-input-beginning_ending.html',
+<& /elements/tr-input-beginning_ending.html,
                 'datesrequired' => 1,
-                'from' => time2str('%m/%d/%Y',$from),
-                'to' => time2str('%m/%d/%Y',time),
-            ) 
-%>
+                'from' => $from,
+                'to' => time,
+&>
 
 <% include('/elements/tr-select-agent.html',
              'label'         => 'For agent: ',