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

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



Revision: 2538
          http://ledger-smb.svn.sourceforge.net/ledger-smb/?rev=2538&view=rev
Author:   einhverfr
Date:     2009-03-27 16:16:02 +0000 (Fri, 27 Mar 2009)

Log Message:
-----------
Minor changes to file upload matching routines for reconciliation

Modified Paths:
--------------
    trunk/LedgerSMB/IS.pm
    trunk/LedgerSMB/Sysconfig.pm
    trunk/bin/is.pl
    trunk/scripts/recon.pl
    trunk/sql/modules/Reconciliation.sql

Modified: trunk/LedgerSMB/IS.pm
===================================================================
--- trunk/LedgerSMB/IS.pm	2009-03-26 16:16:58 UTC (rev 2537)
+++ trunk/LedgerSMB/IS.pm	2009-03-27 16:16:02 UTC (rev 2538)
@@ -1,4 +1,4 @@
-#=====================================================================
+#====================================================================
 # LedgerSMB
 # Small Medium Business Accounting software
 # http://www.ledgersmb.org/
@@ -913,6 +913,15 @@
       ? $exchangerate
       : $form->parse_amount( $myconfig, $form->{exchangerate} );
 
+     my $return_cid = 0;
+     if ($LedgerSMB::Sysconfig::return_accno and !$form->{void}){
+         my $rquery = "SELECT id FROM chart WHERE accno = ?";
+         my $sth = $dbh->prepare($rquery);
+         $sth->execute($LedgerSMB::Sysconfig::return_accno);
+         ($return_cid) = $sth->fetchrow_array();
+         $sth->finish;
+     }
+ 
     my $i;
     my $item;
     my $taxrate;
@@ -947,6 +956,11 @@
             for ( keys %$ref ) { $form->{"${_}_$i"} = $ref->{$_} }
             $pth->finish;
 
+            if ($form->{"qty_$i"} < 0 and $return_cid){
+                $form->{"income_accno_id_$i"} = $return_cid;
+            }
+
+ 
             # project
             if ( $form->{"projectnumber_$i"} ) {
                 ( $null, $project_id ) = split /--/,

Modified: trunk/LedgerSMB/Sysconfig.pm
===================================================================
--- trunk/LedgerSMB/Sysconfig.pm	2009-03-26 16:16:58 UTC (rev 2537)
+++ trunk/LedgerSMB/Sysconfig.pm	2009-03-27 16:16:02 UTC (rev 2538)
@@ -89,7 +89,8 @@
 # Root variables
 for $var (
     qw(pathsep logging check_max_invoices language auth latex
-    db_autoupdate force_username_case max_post_size decimal_places cookie_name)
+    db_autoupdate force_username_case max_post_size decimal_places cookie_name
+    return_accno)
   )
 {
     ${$var} = $config{''}{$var} if $config{''}{$var};

Modified: trunk/bin/is.pl
===================================================================
--- trunk/bin/is.pl	2009-03-26 16:16:58 UTC (rev 2537)
+++ trunk/bin/is.pl	2009-03-27 16:16:02 UTC (rev 2538)
@@ -518,6 +518,14 @@
 
 }
 
+sub void {
+    for (1 .. $form->{rowcount}){
+        $form->{"qty_$i"} *= -1;
+    }
+    $form->{void} = 1;
+    &post_as_new;
+}
+
 sub form_footer {
     _calc_taxes();
     $form->{invtotal} = $form->{invsubtotal};
@@ -773,6 +781,8 @@
               { ndx => 11, key => 'D', value => $locale->text('Delete') },
             'on_hold' =>
               { ndx => 12, key => 'O', value => $locale->text('On Hold') },
+             'void'  => 
+                { ndx => 12, key => 'V', value => $locale->text('Void') },
         );
 
         if ( $form->{id} ) {

Modified: trunk/scripts/recon.pl
===================================================================
--- trunk/scripts/recon.pl	2009-03-26 16:16:58 UTC (rev 2537)
+++ trunk/scripts/recon.pl	2009-03-27 16:16:02 UTC (rev 2538)
@@ -189,7 +189,6 @@
             };
         }
 	$recon->{_results} = ..hidden..;
-        $recon->debug({file => '/tmp/recon'});
         $recon->{title} = $request->{_locale}->text('Reconciliation Sets');
         my $template = LedgerSMB::Template->new( 
             user => $user, 

Modified: trunk/sql/modules/Reconciliation.sql
===================================================================
--- trunk/sql/modules/Reconciliation.sql	2009-03-26 16:16:58 UTC (rev 2537)
+++ trunk/sql/modules/Reconciliation.sql	2009-03-27 16:16:02 UTC (rev 2538)
@@ -279,7 +279,8 @@
 	ELSE -- scn IS NULL, check on amount instead
 		SELECT count(*) INTO in_count FROM cr_report_line
 		WHERE report_id = in_report_id AND our_balance = in_amount
-			AND their_balance = 0 and post_date = in_date;
+			AND their_balance = 0 and post_date = in_date
+			and in_scn NOT LIKE t_prefix || '%';
 
 		IF in_count = 0 THEN -- no match
 			INSERT INTO cr_report_line
@@ -293,11 +294,13 @@
 					trans_type = in_type,
 					clear_time = in_date
 			WHERE report_id = in_report_id AND our_balance = in_amount
-                        	AND their_balance = 0;
+                        	AND their_balance = 0 and
+				in_scn NOT LIKE t_prefix || '%';
 		ELSE -- more than one match
 			SELECT min(id) INTO lid FROM cr_report_line
 			WHERE report_id = in_report_id AND our_balance = in_amount
                         	AND their_balance = 0 and post_date = in_date
+				AND in_scn NOT LIKE t_prefix || '%'
 			LIMIT 1;
 
 			UPDATE cr_report_line SET their_balance = in_amount,


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