[freeside-commits] freeside/FS/FS cust_bill.pm,1.212,1.213

Jeff Finucane,420,, jeff at wavetail.420.am
Thu Jun 19 22:47:36 PDT 2008


Update of /home/cvs/cvsroot/freeside/FS/FS
In directory wavetail.420.am:/tmp/cvs-serv9145

Modified Files:
	cust_bill.pm 
Log Message:
extra values for invoices

Index: cust_bill.pm
===================================================================
RCS file: /home/cvs/cvsroot/freeside/FS/FS/cust_bill.pm,v
retrieving revision 1.212
retrieving revision 1.213
diff -u -d -r1.212 -r1.213
--- cust_bill.pm	19 Jun 2008 03:18:17 -0000	1.212
+++ cust_bill.pm	20 Jun 2008 05:47:33 -0000	1.213
@@ -1847,6 +1847,8 @@
     'conf_dir'        => "$FS::UID::conf_dir/conf.$FS::UID::datasrc",
     'page'            => 1,
     'total_pages'     => 1,
+    'current_charges' => sprintf("%.2f", $self->charged),
+    'duedate'         => $self->due_date2str('%m/%d/%Y'), #date_format?
     'ship_enable'     => $conf->exists('invoice-ship_address'),
     'unitprices'      => $conf->exists('invoice-unitprice'),
   );
@@ -1895,7 +1897,8 @@
 #  my( $cr_total, @cr_cust_credit ) = $self->cust_credit; #credits
   #my $balance_due = $self->owed + $pr_total - $cr_total;
   my $balance_due = $self->owed + $pr_total;
-  $invoice_data{'balance'} = $balance_due;
+  $invoice_data{'previous_balance'} = sprintf("%.2f", $pr_total);
+  $invoice_data{'balance'} = sprintf("%.2f", $balance_due);
 
   #do variable substitution in notes, footer, smallfooter
   foreach my $include (qw( notes footer smallfooter coupon )) {
@@ -2119,6 +2122,7 @@
       unshift @total_items, $total;
     }
   }
+  $invoice_data{'taxtotal'} = sprintf('%.2f', $taxtotal);
   
   push @buf,['','-----------'];
   push @buf,[( $conf->exists('disable_previous_balance') 
@@ -2164,10 +2168,11 @@
     #foreach my $thing ( sort { $a->_date <=> $b->_date } $self->_items_credits, $self->_items_payments
   
     # credits
+    my $credittotal = 0;
     foreach my $credit ( $self->_items_credits ) {
       my $total;
       $total->{'total_item'} = &$escape_function($credit->{'description'});
-      #$credittotal
+      $credittotal += $credit->{'amount'};
       $total->{'total_amount'} = '-'. $other_money_char. $credit->{'amount'};
       $adjusttotal += $credit->{'amount'};
       if ( $multisection ) {
@@ -2185,6 +2190,7 @@
         push @total_items, $total;
       }
     }
+    $invoice_data{'credittotal'} = sprintf('%.2f', $credittotal);
   
     # credits (again)
     foreach ( $self->cust_credited ) {
@@ -2201,10 +2207,11 @@
     }
 
     # payments
+    my $paymenttotal = 0;
     foreach my $payment ( $self->_items_payments ) {
       my $total = {};
       $total->{'total_item'} = &$escape_function($payment->{'description'});
-      #$paymenttotal
+      $paymenttotal += $payment->{'amount'};
       $total->{'total_amount'} = '-'. $other_money_char. $payment->{'amount'};
       $adjusttotal += $payment->{'amount'};
       if ( $multisection ) {
@@ -2225,6 +2232,7 @@
                    $money_char. sprintf("%10.2f", $payment->{'amount'}),
                  ];
     }
+    $invoice_data{'paymenttotal'} = sprintf('%.2f', $paymenttotal);
   
     if ( $multisection ) {
       $adjust_section->{'subtotal'} = $other_money_char.
@@ -2486,6 +2494,16 @@
   $msg;
 }
 
+sub balance_due_date {
+  my $self = shift;
+  my $duedate = '';
+  if (    $conf->exists('invoice_default_terms') 
+       && $conf->config('invoice_default_terms')=~ /^\s*Net\s*(\d+)\s*$/ ) {
+    $duedate = time2str("%m/%d/%Y", $self->_date + ($1*86400) );
+  }
+  $duedate;
+}
+
 =item invnum_date_pretty
 
 Returns a string with the invoice number and date, for example:



More information about the freeside-commits mailing list