start of settlement CDR processing, RT#5495
[freeside.git] / httemplate / view / cust_main / billing.html
index e02c048..049461d 100644 (file)
@@ -216,6 +216,13 @@ Billing information
   </TR>
 % } 
 
+% if ( $show_term || $cust_main->cdr_termination_percentage ) {
+  <TR>
+    <TD ALIGN="right">CDR termination settlement</TD>
+    <TD BGCOLOR="#ffffff"><% $cust_main->cdr_termination_percentage %><% $cust_main->cdr_termination_percentage =~ /\d/ ? '%' : '' %></TD>
+  </TR>
+% }
+
 </TABLE></TD></TR></TABLE>
 <%once>
 
@@ -230,4 +237,10 @@ my @invoicing_list = $cust_main->invoicing_list;
 my $conf = new FS::Conf;
 my $money_char = $conf->config('money_char') || '$';
 
+#false laziness w/edit/cust_main/billing.html
+my $term_sql = "SELECT COUNT(*) FROM cust_pkg LEFT JOIN part_pkg USING ( pkgpart ) WHERE custnum = ? AND plan = 'cdr_termination' LIMIT 1";
+my $term_sth = dbh->prepare($term_sql)  or die dbh->errstr;
+$term_sth->execute($cust_main->custnum) or die $term_sth->errstr;
+my $show_term = $term_sth->fetchrow_arrayref->[0];
+
 </%init>