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

SF.net SVN: ledger-smb:[6553] trunk



Revision: 6553
          http://sourceforge.net/p/ledger-smb/code/6553
Author:   einhverfr
Date:     2014-01-20 03:54:44 +0000 (Mon, 20 Jan 2014)
Log Message:
-----------
Added setting to bypass credit limit calculation and display.  Useful for larger data sets

Modified Paths:
--------------
    trunk/LedgerSMB/AA.pm
    trunk/bin/aa.pl
    trunk/bin/ir.pl
    trunk/bin/is.pl
    trunk/bin/oe.pl

Modified: trunk/LedgerSMB/AA.pm
===================================================================
--- trunk/LedgerSMB/AA.pm	2014-01-20 02:40:18 UTC (rev 6552)
+++ trunk/LedgerSMB/AA.pm	2014-01-20 03:54:44 UTC (rev 6553)
@@ -32,6 +32,7 @@
 use Log::Log4perl;
 use LedgerSMB::File;
 use Math::BigFloat;
+use LedgerSMB::Setting;
 
 my $logger = Log::Log4perl->get_logger("AA");
 
@@ -898,11 +899,12 @@
     my $arap = ( $form->{vc} eq 'customer' ) ? 'ar' : 'ap';
     my $ARAP = uc $arap;
 
-    $form->{creditremaining} = $form->{creditlimit};
-    # acc_trans.approved is only false in the case of batch payments which 
-    # have not yet been approved.  Unapproved transactions set approved on the
-    # ar or ap record level.  --CT
-    $query = qq|
+    if (LedgerSMB::Setting->get('show_creditlimit')){
+        $form->{creditremaining} = $form->{creditlimit};
+        # acc_trans.approved is only false in the case of batch payments which 
+        # have not yet been approved.  Unapproved transactions set approved on 
+        # the ar or ap record level.  --CT
+        $query = qq|
                 SELECT sum(used) FROM (
 		SELECT SUM(ac.amount) 
                        * CASE WHEN '$arap' = 'ar' THEN -1 ELSE 1 END as used
@@ -918,13 +920,14 @@
                  WHERE not closed and oe_class_id in (1, 2)
                        and entity_credit_account = ?) s|;
 
-    $sth = $dbh->prepare($query);
-    $sth->execute( $form->{"$form->{vc}_id"}, $form->{"$form->{vc}_id"})
-      || $form->dberror($query);
-    my ($credit_rem) = $sth->fetchrow_array;
-    ( $form->{creditremaining} ) -= Math::BigFloat->new($credit_rem);
+        $sth = $dbh->prepare($query);
+        $sth->execute( $form->{"$form->{vc}_id"}, $form->{"$form->{vc}_id"})
+           || $form->dberror($query);
+        my ($credit_rem) = $sth->fetchrow_array;
+        ( $form->{creditremaining} ) -= Math::BigFloat->new($credit_rem);
 
-    $sth->finish;
+        $sth->finish;
+    }
 
     # get shipto if we did not converted an order or invoice
     if ( !$form->{shipto} ) {

Modified: trunk/bin/aa.pl
===================================================================
--- trunk/bin/aa.pl	2014-01-20 02:40:18 UTC (rev 6552)
+++ trunk/bin/aa.pl	2014-01-20 03:54:44 UTC (rev 6553)
@@ -602,13 +602,19 @@
 	      <tr>
 		<td colspan=3>
 		  <table width=100%>
-		    <tr>
+		    <tr> |;
+    if (LedgerSMB::Setting ->get('show_creditlimit')){
+       print qq|
 		      <th align=left nowrap>| . $locale->text('Credit Limit') . qq|</th>
 		      <td>$form->{creditlimit}</td>
 		      <th align=left nowrap>| . $locale->text('Remaining') . qq|</th>
 		      <td class="plus$n">|
       . $form->format_amount( \%myconfig, $form->{creditremaining}, 0, "0" )
-      . qq|</td>
+      . qq|</td>|;
+    } else {
+       print qq|<td>&nbsp;</td>|;
+    }
+    print qq|
 		    </tr>
 		  </table>
 		</td>

Modified: trunk/bin/ir.pl
===================================================================
--- trunk/bin/ir.pl	2014-01-20 02:40:18 UTC (rev 6552)
+++ trunk/bin/ir.pl	2014-01-20 03:54:44 UTC (rev 6553)
@@ -493,7 +493,9 @@
 	        <td></td>
 		<td colspan=3>
 		  <table>
-		    <tr>
+		    <tr> |;
+      if (LedgerSMB::Setting->get('show_creditlimit')){
+          print qq|
 		      <th nowrap>| . $locale->text('Credit Limit') . qq|</th>
 		      <td>|
       . $form->format_amount( \%myconfig, $form->{creditlimit}, 0, "0" )
@@ -502,7 +504,9 @@
 		      <th nowrap>| . $locale->text('Remaining') . qq|</th>
 		      <td class="plus$n" nowrap>|
       . $form->format_amount( \%myconfig, $form->{creditremaining}, 0, "0" )
-      . qq|</td>
+      . qq|</td>|;
+      } else { print "<td>&nbsp;</td>" }
+          print qq|
 		    </tr>|;
 		if ($form->{entity_control_code}){
                     $form->hide_form(qw(entity_control_code meta_number));

Modified: trunk/bin/is.pl
===================================================================
--- trunk/bin/is.pl	2014-01-20 02:40:18 UTC (rev 6552)
+++ trunk/bin/is.pl	2014-01-20 03:54:44 UTC (rev 6553)
@@ -521,7 +521,9 @@
 		<td></td>
 		<td colspan=3>
 		  <table>
-		    <tr>
+		    <tr> |;
+      if (LedgerSMB::Setting->get('show_creditlimit')){
+          print qq|
 		      <th align=right nowrap>| . $locale->text('Credit Limit') . qq|</th>
 		      <td>|
       . $form->format_amount( \%myconfig, $form->{creditlimit}, 0, "0" )
@@ -530,7 +532,9 @@
 		      <th align=right nowrap>| . $locale->text('Remaining') . qq|</th>
 		      <td class="plus$n" nowrap>|
       . $form->format_amount( \%myconfig, $form->{creditremaining}, 0, "0" )
-      . qq|</td>
+      . qq|</td> |;
+     } else { print "<td>&nbsp;</td>"; }
+        print qq|
 		    </tr>|;
 		if ($form->{entity_control_code}){
                     $form->hide_form(qw(entity_control_code meta_number));

Modified: trunk/bin/oe.pl
===================================================================
--- trunk/bin/oe.pl	2014-01-20 02:40:18 UTC (rev 6552)
+++ trunk/bin/oe.pl	2014-01-20 03:54:44 UTC (rev 6553)
@@ -475,7 +475,7 @@
         $creditremaining = qq|
 	      <tr>
 		<td></td>
-		<td colspan=3>
+		<td>
 		  <table class="creditlimit">
 		    <tr>
 		      <th align=right nowrap>| . $locale->text('Credit Limit') . qq|</th>
@@ -487,8 +487,10 @@
 		      <td class="plus$n" nowrap>|
           . $form->format_amount( \%myconfig, $form->{creditremaining}, 0, "0" )
           . qq|</td>
-		    </tr>|;
-		if ($form->{entity_control_code}){
+	|;
+         $creditremaining = qq|<tr><td colspan="2"><table><tr>|
+             unless LedgerSMB::Setting->get('show_creditlimit');
+         if ($form->{entity_control_code}){
 			$creditremaining .= qq|
 	        <tr class="control-code-field">
 		<th align="right" nowrap>| . 
@@ -506,7 +508,7 @@
 		|;
 	       }
 	$creditremaining .= qq|
-		  </table>
+                 </table>
 		</td>
 	      </tr>
 |;
@@ -650,7 +652,7 @@
     print qq|
 <table width=100%>
   <tr class=listtop>
-    <th class=listtop>$form->{title}</th>
+    <th class=listtop colspan="5">$form->{title}</th>
   </tr>
   <tr height="5"></tr>
   <tr>

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


------------------------------------------------------------------------------
CenturyLink Cloud: The Leader in Enterprise Cloud Services.
Learn Why More Businesses Are Choosing CenturyLink Cloud For
Critical Workloads, Development Environments & Everything In Between.
Get a Quote or Start a Free Trial Today. 
http://pubads.g.doubleclick.net/gampad/clk?id=119420431&iu=/4140/ostg.clktrk
_______________________________________________
Ledger-smb-commits mailing list
..hidden..
https://lists.sourceforge.net/lists/listinfo/ledger-smb-commits