[freeside-commits] freeside/httemplate/search report_prepaid_income.cgi, 1.11, 1.12 report_prepaid_income.html, 1.6, 1.7

Ivan,,, ivan at wavetail.420.am
Sun May 3 19:01:45 PDT 2009


Update of /home/cvs/cvsroot/freeside/httemplate/search
In directory wavetail.420.am:/tmp/cvs-serv14656

Modified Files:
	report_prepaid_income.cgi report_prepaid_income.html 
Log Message:
agent-virt prepaid income report, RT#5311

Index: report_prepaid_income.cgi
===================================================================
RCS file: /home/cvs/cvsroot/freeside/httemplate/search/report_prepaid_income.cgi,v
retrieving revision 1.11
retrieving revision 1.12
diff -u -d -r1.11 -r1.12
--- report_prepaid_income.cgi	30 Aug 2008 21:34:45 -0000	1.11
+++ report_prepaid_income.cgi	4 May 2009 02:01:43 -0000	1.12
@@ -38,22 +38,46 @@
 $now =~ /^(\d+)$/ or die "unparsable date?";
 $now = $1;
 
+my @where = ();
+
+if ( $cgi->param('agentnum') =~ /^(\d+)$/ ) {
+  my $agentnum = $1;
+  push @where, "agentnum = $agentnum";
+}
+
+#here is the agent virtualization
+push @where, $FS::CurrentUser::CurrentUser->agentnums_sql;
+
+my $where = join(' AND ', @where);
+$where = "AND $where" if $where;
+
 my( $total, $total_legacy ) = ( 0, 0 );
 
 my @cust_bill_pkg =
   grep { $_->cust_pkg && $_->cust_pkg->part_pkg->freq !~ /^([01]|\d+[dw])$/ }
-    qsearch( 'cust_bill_pkg', {
-                                'recur' => { op=>'!=', value=>0 },
-                                'edate' => { op=>'>', value=>$now },
-                              }, );
+    qsearch({
+      'select'    => 'cust_bill_pkg.*',
+      'table'     => 'cust_bill_pkg',
+      'addl_from' => ' LEFT JOIN cust_bill USING ( invnum  ) '.
+                     ' LEFT JOIN cust_main USING ( custnum ) ',
+      'hashref'   => {
+                       'recur' => { op=>'!=', value=>0    },
+                       'edate' => { op=>'>',  value=>$now },
+                     },
+      'extra_sql' => $where,
+    });
 
 my @cust_pkg = 
   grep { $_->part_pkg->recur != 0
          && $_->part_pkg->freq !~ /^([01]|\d+[dw])$/
        }
-    qsearch ( 'cust_pkg', {
-                            'bill' => { op=>'>', value=>$now }
-                          } );
+    qsearch({
+      'select'    => 'cust_pkg.*',
+      'table'     => 'cust_pkg',
+      'addl_from' => ' LEFT JOIN cust_main USING ( custnum ) ',
+      'hashref'   => { 'bill' => { op=>'>', value=>$now } },
+      'extra_sql' => $where,
+    });
 
 foreach my $cust_bill_pkg ( @cust_bill_pkg) { 
   my $period = $cust_bill_pkg->edate - $cust_bill_pkg->sdate;

Index: report_prepaid_income.html
===================================================================
RCS file: /home/cvs/cvsroot/freeside/httemplate/search/report_prepaid_income.html,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -d -r1.6 -r1.7
--- report_prepaid_income.html	3 Feb 2007 11:36:30 -0000	1.6
+++ report_prepaid_income.html	4 May 2009 02:01:43 -0000	1.7
@@ -1,28 +1,46 @@
-<% include('/elements/header.html', 'Prepaid Income (Unearned Revenue) Report',
-  '',
-  '',
-  '<LINK REL="stylesheet" TYPE="text/css" HREF="../elements/calendar-win2k-2.css" TITLE="win2k-2">
-  <SCRIPT TYPE="text/javascript" SRC="../elements/calendar_stripped.js"></SCRIPT>
-  <SCRIPT TYPE="text/javascript" SRC="../elements/calendar-en.js"></SCRIPT>
-  <SCRIPT TYPE="text/javascript" SRC="../elements/calendar-setup.js"></SCRIPT>
-  '
-) %>
+<% include('/elements/header.html','Prepaid Income (Unearned Revenue) Report')%>
+
+<% include('/elements/init_calendar.html') %>
+
+<FORM ACTION="report_prepaid_income.cgi" METHOD="GET">
+
+<TABLE BGCOLOR="#cccccc" CELLSPACING=0>
+
+  <TR>
+    <TH BGCOLOR="#e8e8e8" COLSPAN=2 ALIGN="left">
+      <FONT SIZE="+1">Search options</FONT>
+    </TH>
+  </TR>
+
+  <TR>
+    <TD>As of </TD>
+    <TD>
+      <INPUT TYPE="text" NAME="date" ID="date_text" VALUE="now">
+      <IMG SRC="../images/calendar.png" ID="date_button" STYLE="cursor: pointer" TITLE="Select date">
+    </TD>
+  </TR>
+  <TR>
+    <TD>
+    </TD>
+    <TD><FONT SIZE="-1"><i>m/d/y</i></FONT></TD>
+  </TR>
+
+  <TR>
+    <TD COLSPAN=2>&nbsp;</TD>
+  </TR>
+
+  <% include( '/elements/tr-select-agent.html', 'disable_empty'=>0 ) %>
+
+  <TR>
+    <TD COLSPAN=2>&nbsp;</TD>
+  </TR>
+
+  <TR>
+    <TD COLSPAN=2 ALIGN="center"><INPUT TYPE="submit" VALUE="Generate report"></TD>
+  </TR>
+
+</TABLE>
 
-    <FORM ACTION="report_prepaid_income.cgi" METHOD="GET">
-    <TABLE>
-      <TR>
-        <TD>Prepaid income (unearned revenue) as of </TD>
-        <TD>
-          <INPUT TYPE="text" NAME="date" ID="date_text" VALUE="now">
-          <IMG SRC="../images/calendar.png" ID="date_button" STYLE="cursor: pointer" TITLE="Select date">
-        </TD>
-      </TR>
-      <TR>
-        <TD>
-        </TD>
-        <TD><i>m/d/y</i></TD>
-      </TR>
-    </TABLE>
 <SCRIPT TYPE="text/javascript">
   Calendar.setup({
     inputField: "date_text",
@@ -32,7 +50,7 @@
   });
 </SCRIPT>
 
-<INPUT TYPE="submit" VALUE="Generate report">
+</FORM>
 
 <% include('/elements/footer.html') %>
 <%init>



More information about the freeside-commits mailing list