v4 style
[freeside.git] / httemplate / search / report_cdr.html
index 04cd417..4c16f74 100644 (file)
@@ -1,5 +1,13 @@
 <% include('/elements/header.html', 'Call Detail Record Search' ) %>
 
+<SCRIPT type="text/javascript">
+    function clearfield(which){
+        var f = document.getElementById(which);
+        if ( f == null) return;
+        f.value = '';
+    }
+</SCRIPT>
+
 <FORM ACTION="cdr.html" METHOD="GET">
 
 <TABLE BGCOLOR="#cccccc" CELLSPACING=0>
     <TD ALIGN="right">Status: </TD>
     <TD>
       <SELECT NAME="freesidestatus">
-        <OPTION VALUE="">(all)
-        <OPTION VALUE="NULL">unprocessed
-        <OPTION VALUE="done">processed
+        <OPTION VALUE="">(all)</OPTION>
+        <OPTION VALUE="NULL">unprocessed</OPTION>
+%# <OPTION VALUE="processing-tiered">processing</OPTION>
+        <OPTION VALUE="rated">prerated
+        <OPTION VALUE="no-charge">processed (included)</OPTION>
+        <OPTION VALUE="done">processed (billed)</OPTION>
+        <OPTION VALUE="skipped">skipped</OPTION>
+        <OPTION VALUE="failed">failed</OPTION>
       </SELECT>
     </TD>
   </TR>
 %   }
 % #}
 
+  <% include('/elements/tr-select-table.html',
+            field   => 'cdrtypenum',
+            label   => 'CDR Type',
+            table   => 'cdr_type',
+            name_col    => 'cdrtypename',
+            disable_empty   => 1,
+            pre_options => [    '',     'all', 
+                                'none', 'none' ] )
+  %>
+
   <% include ( '/elements/tr-input-beginning_ending.html' ) %>
 
   <TR>
   </TR>
 
   <TR>
-    <TD ALIGN="right">Last Application: </TD>
+    <TD ALIGN="right">Charged Party or Source #: </TD>
     <TD>
-      <INPUT TYPE="text" NAME="lastapp" VALUE="" >
+      <INPUT TYPE="text" NAME="charged_party_or_src" VALUE="<% join(',', @charged_party_or_src ) |h %>" >
     </TD>
   </TR>
 
   <TR>
-    <TD ALIGN="right">Freeside service #: </TD>
+    <TD ALIGN="right">Last Application: </TD>
     <TD>
-      <INPUT TYPE="text" NAME="svcnum" VALUE="<% join(',', @svcnum ) %>" >
+      <INPUT TYPE="text" NAME="lastapp" VALUE="" >
     </TD>
   </TR>
 
             )
   %>
 
+  <TR>
+    <TD ALIGN="right">Top</TD>
+    <TD><INPUT TYPE="TEXT" id="top_dst" NAME="top_dst" SIZE="7" onfocus="clearfield('top_src');"> destinations</TD>
+  </TR>
+  
+  <TR>
+    <TD ALIGN="right">Top</TD>
+    <TD><INPUT TYPE="TEXT" id="top_src" NAME="top_src" SIZE="7" onfocus="clearfield('top_dst');"> sources</TD>
+  </TR>
+  
+  <TR>
+    <TD ALIGN="right"></TD>
+    <TD><INPUT TYPE="TEXT" NAME="longest" SIZE="7"> longest calls</TD>
+  </TR>
+  
   <% include( '/elements/tr-select-cdrbatch.html' ) %>
 
   <TR>
   </TR>
 
   <TR>
+    <TD ALIGN="right">Acct Code (one per-line):</TD>
+    <TD><TEXTAREA NAME="accountcode"></TEXTAREA></TD>
+  </TR>
+
+  <TR>
     <TH CLASS="background" COLSPAN=2>&nbsp;</TH>
   </TR>
 
@@ -145,7 +188,21 @@ die "access denied"
   unless $FS::CurrentUser::CurrentUser->access_right('List rating data');
 
 my @fields = fields('cdr');
+push @fields, 'ratename';
+push @fields, map "cdr_termination.$_", qw( rated_price rated_seconds rated_minutes rated_granularity status svcnum );
+
 my $labels = FS::cdr->table_info->{'fields'};
+$labels->{ratename} = 'Rate plan';
+$labels->{'cdr_termination.rated_price'} = 'Termination rated price';
+$labels->{'cdr_termination.rated_seconds'} = 'Termination rated seconds';
+$labels->{'cdr_termination.rated_minutes'} = 'Termination rated minutes';
+$labels->{'cdr_termination.rated_granularity'} = 'Termination rated granularity';
+$labels->{'cdr_termination.status'} = 'Termination status';
+$labels->{'cdr_termination.svcnum'} = 'Termination service';
+
+my $conf = new FS::Conf;
+my $default_phone_countrycode =
+  $conf->config('default_phone_countrycode') || '1';
 
 #XXX config
 my @show_default = qw(
@@ -179,7 +236,7 @@ if ( $cgi->param('custnum') =~ /^(\d+)$/ ) {
   });
   die "Customer not found!" unless $cust_main;
 
-  #historical?
+  #historical packages?  It would help, it was still usage, it happened
   foreach my $cust_pkg ( $cust_main->ncancelled_pkgs ) {
 
     my @voip_pkgs =
@@ -204,7 +261,7 @@ if ( $cgi->param('custnum') =~ /^(\d+)$/ ) {
       my @numbers = map {
                           my $number = $_->phonenum;
                           $number = $_->countrycode. $number
-                            unless $_->countrycode eq '1';
+                           unless $_->countrycode eq $default_phone_countrycode;
                           $number;
                         }
                       @svc_phone;