taqua accountcode billing, part 1 of 2, RT12181
authorlevinse <levinse>
Wed, 27 Apr 2011 05:22:22 +0000 (05:22 +0000)
committerlevinse <levinse>
Wed, 27 Apr 2011 05:22:22 +0000 (05:22 +0000)
FS/FS/Conf.pm
FS/FS/Schema.pm
FS/FS/cust_bill.pm
FS/FS/cust_bill_pkg.pm
FS/FS/cust_bill_pkg_detail.pm
FS/FS/part_pkg/voip_cdr.pm
FS/FS/part_pkg/voip_inbound.pm
httemplate/edit/cust_main/billing.html
httemplate/view/cust_main/billing.html

index 61cba34..331645e 100644 (file)
@@ -2908,6 +2908,13 @@ and customer address. Include units.',
   },
 
   {
+    'key'         => 'voip-cust_accountcode_cdr',
+    'section'     => 'telephony',
+    'description' => 'Enable the per-customer option for CDR breakdown by accountcode.',
+    'type'        => 'checkbox',
+  },
+
+  {
     'key'         => 'voip-cust_cdr_spools',
     'section'     => 'telephony',
     'description' => 'Enable the per-customer option for individual CDR spools.',
index 983edec..cc0f21f 100644 (file)
@@ -691,6 +691,7 @@ sub tables_hashref {
         'classnum', 'int', 'NULL', '', '', '',
         'duration', 'int', 'NULL', '',  0, '',
         'phonenum', 'varchar', 'NULL', 15, '', '',
+        'accountcode', 'varchar',  'NULL',      20, '', '',
         'regionname', 'varchar', 'NULL', $char_d, '', '',
         'detail',  'varchar', '', 255, '', '', 
       ],
index 3fbf03b..ba5ca24 100644 (file)
@@ -2829,6 +2829,9 @@ sub print_generic {
       push @{$late_sections}, @$phone_sections;
       push @detail_items, @$phone_lines;
     }
+    if ($conf->exists('voip-cust_accountcode_cdr') && $cust_main->accountcode_cdr) {
+        # XXX: do something not unlike _items_svc_phone_sections, except generate only one section
+    }
   }else{
     push @sections, { 'description' => '', 'subtotal' => '' };
   }
@@ -4700,7 +4703,6 @@ sub _items_cust_bill_pkg {
                 ext_description => \@d,
               };
             }
-
           }
 
         } # recurring or usage with recurring charge
index 791999c..37c4a27 100644 (file)
@@ -153,8 +153,9 @@ sub insert {
         'amount'     => (ref($detail) ? $detail->[2] : '' ),
         'classnum'   => (ref($detail) ? $detail->[3] : '' ),
         'phonenum'   => (ref($detail) ? $detail->[4] : '' ),
-        'duration'   => (ref($detail) ? $detail->[5] : '' ),
-        'regionname' => (ref($detail) ? $detail->[6] : '' ),
+        'accountcode' => (ref($detail) ? $detail->[5] : '' ),
+        'duration'   => (ref($detail) ? $detail->[6] : '' ),
+        'regionname' => (ref($detail) ? $detail->[7] : '' ),
       };
       $error = $cust_bill_pkg_detail->insert;
       if ( $error ) {
index 7badaa3..9ac164c 100644 (file)
@@ -55,6 +55,8 @@ inherits from FS::Record.  The following fields are currently supported:
 
 =item phonenum -
 
+=item accountcode - accountcode
+
 =item detail - detail description
 
 =back
@@ -137,6 +139,7 @@ sub check {
     || $self->ut_enum('format', [ '', 'C' ] )
     || $self->ut_numbern('duration')
     || $self->ut_textn('regionname')
+    || $self->ut_textn('accountcode')
     || $self->ut_text('detail')
     || $self->ut_foreign_keyn('classnum', 'usage_class', 'classnum')
     || $self->$phonenum_check_method('phonenum')
index 2e165cd..5ebe9dd 100644 (file)
@@ -741,6 +741,7 @@ sub calc_usage {
                 $charge,
                 $classnum,
                 $phonenum,
+                $cdr->accountcode,
                 $seconds,
                 $regionname,
               ];
@@ -752,6 +753,7 @@ sub calc_usage {
                 $charge,
                 $classnum,
                 $phonenum,
+                $cdr->accountcode,
                 $seconds,
                 $regionname,
               ];
index e3e6faa..d9938c7 100644 (file)
@@ -270,6 +270,7 @@ sub calc_usage {
           $charge,
           $cdr->calltypenum, #classnum
           $self->phonenum,
+          $cdr->accountcode,
           $seconds,
           '', #regionname, not set for inbound calls
         ];
index 2301a0b..884d770 100644 (file)
         %>
       </TD>
     </TR>
+
+% if ( $conf->exists('voip-cust_accountcode_cdr') ) { 
+       <TR>
+        <TD COLSPAN="2">
+            <INPUT TYPE="checkbox" 
+                   NAME="accountcode_cdr" 
+                   VALUE="Y" 
+                   <% $cust_main->accountcode_cdr eq "Y" ? 'CHECKED' : '' %>
+            > Breakdown CDRs by accountcode</TD>
+       </TR>
+% } else { 
+       <INPUT TYPE="hidden" NAME="accountcode_cdr" VALUE="<% $cust_main->accountcode_cdr %>">
+% }
+
     <TR>
       <TD ALIGN="right" WIDTH="200">Credit limit </TD>
       <TD WIDTH="408">
index efff3ed..c770833 100644 (file)
@@ -238,6 +238,13 @@ Billing information
   </TR>
 % } 
 
+% if ( $conf->exists('voip-cust_accountcode_cdr') ) { 
+   <TR>
+     <TD ALIGN="right">Breakdown CDRs by accountcode</TD>
+     <TD BGCOLOR="#ffffff"><% $cust_main->accountcode_cdr ? 'yes' : 'no' %></TD>
+   </TR>
+% }
+
 % if ( $conf->exists('voip-cust_email_csv_cdr') ) { 
   <TR>
     <TD ALIGN="right">Email&nbsp;CDRs&nbsp;as&nbsp;CSV</TD>