[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

SF.net SVN: ledger-smb:[5299] addons/1.3/report_framework/trunk



Revision: 5299
          http://ledger-smb.svn.sourceforge.net/ledger-smb/?rev=5299&view=rev
Author:   einhverfr
Date:     2012-12-03 10:14:16 +0000 (Mon, 03 Dec 2012)
Log Message:
-----------
Compatibility fixes to 1.3

Modified Paths:
--------------
    addons/1.3/report_framework/trunk/LedgerSMB/Report/PNL/ECA.pm
    addons/1.3/report_framework/trunk/LedgerSMB/Report/PNL.pm
    addons/1.3/report_framework/trunk/LedgerSMB/Report.pm

Removed Paths:
-------------
    addons/1.3/report_framework/trunk/patches/pnl_invoice.diff
    addons/1.3/report_framework/trunk/patches/pnl_product.diff

Modified: addons/1.3/report_framework/trunk/LedgerSMB/Report/PNL/ECA.pm
===================================================================
--- addons/1.3/report_framework/trunk/LedgerSMB/Report/PNL/ECA.pm	2012-12-03 10:10:32 UTC (rev 5298)
+++ addons/1.3/report_framework/trunk/LedgerSMB/Report/PNL/ECA.pm	2012-12-03 10:14:16 UTC (rev 5299)
@@ -43,7 +43,7 @@
 
 =cut
 
-has 'name' => (is => 'rw', isa =>'Str'); 
+has 'legal_name' => (is => 'rw', isa =>'Str'); 
 
 =item meta_number
 
@@ -84,7 +84,7 @@
 =cut
 
 sub header_lines {
-    return [{name => 'name',
+    return [{name => 'legal_name',
             text => LedgerSMB::Report::text('Name') },
             {name => 'meta_number',
             text => LedgerSMB::Report::text('Account Number')},

Modified: addons/1.3/report_framework/trunk/LedgerSMB/Report/PNL.pm
===================================================================
--- addons/1.3/report_framework/trunk/LedgerSMB/Report/PNL.pm	2012-12-03 10:10:32 UTC (rev 5298)
+++ addons/1.3/report_framework/trunk/LedgerSMB/Report/PNL.pm	2012-12-03 10:14:16 UTC (rev 5299)
@@ -112,8 +112,8 @@
         $data->{$r->{account_category}}->{$r->{account_number}} = {$label => $r};
         $data->{$r->{account_category}}->{$r->{account_number}}->{info} = $r;
     }
-    my $i_total = 0;
-    my $e_total = 0;
+    my $i_total = Math::BigFloat->new(0);
+    my $e_total = Math::BigFloat->new(0);
     my $total;
     for my $k (keys %{$data->{I}}){
        $i_total += $data->{I}->{$k}->{$label}->{amount}; 
@@ -121,9 +121,12 @@
     for my $k (keys %{$data->{E}}){
        $e_total += $data->{E}->{$k}->{$label}->{amount}; 
     }
-    $data->{totals}->{$label}->{I} = $i_total;
-    $data->{totals}->{$label}->{E} = $e_total;
-    $data->{totals}->{$label}->{total} = $i_total - $e_total;
+    $i_total->bfround($LedgerSMB::Sysconfig::decimal_places * -1);
+    $data->{totals}->{$label}->{I} = $i_total->bstr();
+    
+    $e_total->bfround($LedgerSMB::Sysconfig::decimal_places * -1);
+    $data->{totals}->{$label}->{E} = $e_total->bstr();
+    $data->{totals}->{$label}->{total} = ($i_total - $e_total)->bstr();
     $self->account_data($data);
 }
 

Modified: addons/1.3/report_framework/trunk/LedgerSMB/Report.pm
===================================================================
--- addons/1.3/report_framework/trunk/LedgerSMB/Report.pm	2012-12-03 10:10:32 UTC (rev 5298)
+++ addons/1.3/report_framework/trunk/LedgerSMB/Report.pm	2012-12-03 10:14:16 UTC (rev 5299)
@@ -42,6 +42,7 @@
 with 'LedgerSMB::DBObject_Moose', 'LedgerSMB::I18N';
 use LedgerSMB::Template;
 use LedgerSMB::App_State;
+use LedgerSMB::Sysconfig;
 
 =head1 PROPERTIES
 
@@ -185,6 +186,7 @@
 
     # Sorting and Subtotal logic
     my $url = LedgerSMB::App_State::get_url();
+    no warnings;
     if ($self->order_by eq $self->old_order_by){
         if (lc($self->order_dir) eq 'asc'){
             $self->order_dir('desc');
@@ -197,6 +199,7 @@
     $self->order_url(
         "$url&old_order_by=".$self->order_by."&order_dir=".$self->order_dir
     );
+    use warnings;
 
     my $rows = $self->rows;
     @$rows = sort {$a->{$self->order_by} cmp $b->{$self->order_by}} @$rows
@@ -228,6 +231,14 @@
    } 
     
     # Rendering
+    for my $r(@{$self->rows}){
+        for my $k (keys %$r){
+            if (eval { $r->{$k}->isa('Math::BigFloat')}){
+                $r->{$k}->bfround($LedgerSMB::Sysconfig::decimal_places * -1);
+                $r->{$k} = $r->{$k}->bstr;
+            }
+        }
+    }
 
     if (!defined $self->format){
         $self->format('html');

Deleted: addons/1.3/report_framework/trunk/patches/pnl_invoice.diff
===================================================================
--- addons/1.3/report_framework/trunk/patches/pnl_invoice.diff	2012-12-03 10:10:32 UTC (rev 5298)
+++ addons/1.3/report_framework/trunk/patches/pnl_invoice.diff	2012-12-03 10:14:16 UTC (rev 5299)
@@ -1,36 +0,0 @@
-Index: bin/aa.pl
-===================================================================
---- bin/aa.pl	(revision 5220)
-+++ bin/aa.pl	(working copy)
-@@ -1059,6 +1059,7 @@
-     }
-     if ($form->{id}){
-         print qq|
-+<a href="pnl.pl?action=generate_income_statement&pnl_type=invoice&id=$form->{id}">[| . $locale->text('Profit/Loss') . qq|]</a><br />
- <table width="100%">
- <tr class="listtop">
- <th colspan="4">| . $locale->text('Attached and Linked Files') . qq|</th>
-Index: bin/ir.pl
-===================================================================
---- bin/ir.pl	(revision 5220)
-+++ bin/ir.pl	(working copy)
-@@ -954,6 +954,7 @@
-     if ($form->{id}){
-         IR->get_files($form, $locale);
-         print qq|
-+<a href="pnl.pl?action=generate_income_statement&pnl_type=invoice&id=$form->{id}">[| . $locale->text('Profit/Loss') . qq|]</a><br />
- <table width="100%">
- <tr class="listtop">
- <th colspan="4">| . $locale->text('Attached and Linked Files') . qq|</th>
-Index: bin/is.pl
-===================================================================
---- bin/is.pl	(revision 5220)
-+++ bin/is.pl	(working copy)
-@@ -1040,6 +1040,7 @@
-     if ($form->{id}){
-         IS->get_files($form, $locale);
-         print qq|
-+<a href="pnl.pl?action=generate_income_statement&pnl_type=invoice&id=$form->{id}">[| . $locale->text('Profit/Loss') . qq|]</a><br />
- <table width="100%">
- <tr class="listtop">
- <th colspan="4">| . $locale->text('Attached and Linked Files') . qq|</th>

Deleted: addons/1.3/report_framework/trunk/patches/pnl_product.diff
===================================================================
--- addons/1.3/report_framework/trunk/patches/pnl_product.diff	2012-12-03 10:10:32 UTC (rev 5298)
+++ addons/1.3/report_framework/trunk/patches/pnl_product.diff	2012-12-03 10:14:16 UTC (rev 5299)
@@ -1,38 +0,0 @@
-Index: bin/ic.pl
-===================================================================
---- bin/ic.pl	(revision 5234)
-+++ bin/ic.pl	(working copy)
-@@ -955,8 +955,31 @@
-         qw(login path sessionid callback previousform isassemblyitem));
- 
-     print qq|
--</form>
--| . $form->close_status_div . qq|
-+</form> |;
-+    if ($form->{id}){
-+        print qq|<form action="pnl.pl" method="GET">
-+        <input type="hidden" name="id" value="$form->{id}">
-+        <input type="hidden" name="pnl_type" value="product">
-+        <table width="100%">
-+        <col width="20em"><col>
-+        <tr class="listtop"><th colspan=2>| . $locale->text('Profit/Loss') . qq|
-+                    </th>
-+        </tr>
-+        <tr><th>| . $locale->text('Date From') . qq|</th>
-+            <td><input type="text" size="12" name="date_from" class="date"></td>
-+        </tr><tr>
-+            <th>| . $locale->text('Date To') . qq|</th>
-+            <td><input type="text" size="12" name="date_to" class="date"></td>
-+        </tr><tr>
-+            <td><button type="submit" name="action" 
-+                        value="generate_income_statement" 
-+                        class="submit">| . $locale->text('Continue') .
-+                        qq|</button><td>
-+        </tr>
-+        </table>
-+        </form>|;
-+    } 
-+    print $form->close_status_div . qq|
- </body>
- </html>
- |;

This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.