summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorlevinse <levinse>2011-05-26 20:59:58 +0000
committerlevinse <levinse>2011-05-26 20:59:58 +0000
commita2d31d7aeeec3e0d08e7ebe30b191da94f96618e (patch)
tree4d1c7e0d29e78e31286d52f0458c4c42d68dc591
parente51b8aa7151f9993ee7265c69d2ca0e1c05e80fa (diff)
daily sales, credits, and receipts report
-rw-r--r--httemplate/elements/tr-input-beginning_ending.html13
-rw-r--r--httemplate/graph/report_money_time_daily.html9
2 files changed, 19 insertions, 3 deletions
diff --git a/httemplate/elements/tr-input-beginning_ending.html b/httemplate/elements/tr-input-beginning_ending.html
index 2aa597479..7481c9bb6 100644
--- a/httemplate/elements/tr-input-beginning_ending.html
+++ b/httemplate/elements/tr-input-beginning_ending.html
@@ -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="" 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="<% $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="" 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="<% $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",
@@ -38,12 +38,14 @@
</SCRIPT>
</TR>
+% unless ( $datesrequired ) {
<TR>
<TD></TD>
<TD COLSPAN=<% $opt{layout} =~ /^h/i ? 3 : 1 %>>
<FONT SIZE="-1">(leave one or both dates blank for an open-ended search)</FONT>
</TD>
</TR>
+% }
<%once>
@@ -57,6 +59,13 @@ my %opt = @_;
my $conf = new FS::Conf;
my $date_format = $conf->config('date_format') || '%m/%d/%Y';
+my $datesrequired = 0;
+$datesrequired = $opt{'datesrequired'} if $opt{'datesrequired'};
+
+my $from = '';
+$from = $opt{'from'} if $opt{'from'};
+my $to = '';
+$to = $opt{'to'} if $opt{'to'};
$opt{prefix} = '' unless defined $opt{prefix};
$opt{prefix} .= '_' if $opt{prefix};
diff --git a/httemplate/graph/report_money_time_daily.html b/httemplate/graph/report_money_time_daily.html
index 1e1b45d4e..8328199c7 100644
--- a/httemplate/graph/report_money_time_daily.html
+++ b/httemplate/graph/report_money_time_daily.html
@@ -4,7 +4,12 @@
<TABLE>
-<% include( '/elements/tr-input-beginning_ending.html' ) %>
+<% include( '/elements/tr-input-beginning_ending.html',
+ 'datesrequired' => 1,
+ 'from' => time2str('%m/%d/%Y',$from),
+ 'to' => time2str('%m/%d/%Y',time),
+ )
+%>
<% include('/elements/tr-select-agent.html',
'label' => 'For agent: ',
@@ -20,6 +25,8 @@
<% include('/elements/footer.html') %>
<%init>
+my $from = time - 30*86400;
+
die "access denied"
unless $FS::CurrentUser::CurrentUser->access_right('Financial reports');