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

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



Revision: 2539
          http://ledger-smb.svn.sourceforge.net/ledger-smb/?rev=2539&view=rev
Author:   einhverfr
Date:     2009-03-31 19:23:31 +0000 (Tue, 31 Mar 2009)

Log Message:
-----------
Corrections to handling automatic matches

Modified Paths:
--------------
    trunk/LedgerSMB/DBObject/Reconciliation.pm
    trunk/UI/reconciliation/report.html
    trunk/scripts/recon.pl
    trunk/sql/modules/Reconciliation.sql

Modified: trunk/LedgerSMB/DBObject/Reconciliation.pm
===================================================================
--- trunk/LedgerSMB/DBObject/Reconciliation.pm	2009-03-27 16:16:02 UTC (rev 2538)
+++ trunk/LedgerSMB/DBObject/Reconciliation.pm	2009-03-31 19:23:31 UTC (rev 2539)
@@ -345,7 +345,7 @@
 
 
     for my $line (@{$self->{report_lines}}){
-        if ($self->{"cleared_$line->{id}"} or $line->{cleared}){
+        if ($line->{cleared}){
             $our_balance += $line->{our_balance};
             $self->{cleared_total} += $line->{our_balance};
 	}elsif ((($self->{their_balance} != '0')

Modified: trunk/UI/reconciliation/report.html
===================================================================
--- trunk/UI/reconciliation/report.html	2009-03-27 16:16:02 UTC (rev 2538)
+++ trunk/UI/reconciliation/report.html	2009-03-31 19:23:31 UTC (rev 2539)
@@ -75,11 +75,8 @@
 	</tr>
 	
 	<?lsmb FOREACH row = report_lines ?>
-			<?lsmb IF (row.our_balance == row.their_balance AND 
-				row.our_balance != zero_string) or
-				row.cleared or ${"cleared_$row.id"}
-				-?>
-				<?lsmb row.cleared = 'checked' ?>
+			<?lsmb IF (row.cleared) -?>
+				<?lsmb row.cleared = 'checked' -?>
 				<?lsmb ELSE ?> <?lsmb row.cleared = undef -?> 
 				<?lsmb END -?>
 	<?lsmb IF row.cleared == 'checked' ?>

Modified: trunk/scripts/recon.pl
===================================================================
--- trunk/scripts/recon.pl	2009-03-27 16:16:02 UTC (rev 2538)
+++ trunk/scripts/recon.pl	2009-03-31 19:23:31 UTC (rev 2539)
@@ -380,10 +380,7 @@
                $l->{our_debits} = $l->{our_balance};
             }
 
-            if ($l->{our_balance} != 0 and 
-                $l->{our_balance} == $l->{their_balance} or
-                defined $recon->{"cleared_$l->{id}"} or $l->{cleared}
-            ){
+            if ($l->{cleared}){
                  $recon->{total_cleared_credits}->badd($l->{our_credits});
                  $recon->{total_cleared_debits}->badd($l->{our_debits});
             } else {

Modified: trunk/sql/modules/Reconciliation.sql
===================================================================
--- trunk/sql/modules/Reconciliation.sql	2009-03-27 16:16:02 UTC (rev 2538)
+++ trunk/sql/modules/Reconciliation.sql	2009-03-31 19:23:31 UTC (rev 2539)
@@ -235,7 +235,8 @@
 				in_type);
 		ELSIF in_count = 1 THEN
 			UPDATE cr_report_line
-			SET their_balance = in_amount, clear_time = in_date
+			SET their_balance = in_amount, clear_time = in_date,
+				cleared = true
 			WHERE t_scn = scn AND report_id = in_report_id
 				AND their_balance = 0;
 		ELSE 
@@ -251,14 +252,16 @@
 				UPDATE cr_report_line
                                 SET their_balance = in_amount, 
 					clear_time = in_date,
-					trans_type = in_type
+					trans_type = in_type,
+					cleared = true
                                 WHERE id = lid;
 
 			ELSIF in_count = 1 THEN -- EXECT MATCH
 				UPDATE cr_report_line
 				SET their_balance = in_amount, 
 					trans_type = in_type,
-					clear_time = in_date
+					clear_time = in_date,
+					cleared = true
 				WHERE t_scn = scn AND report_id = in_report_id
                                 	AND our_value = in_amount 
 					AND their_balance = 0;
@@ -271,6 +274,7 @@
 				UPDATE cr_report_line
                                 SET their_balance = in_amount,
 					trans_type = in_type,
+					cleared = true,
 					clear_time = in_date
                                 WHERE id = lid;
 				
@@ -280,7 +284,7 @@
 		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 in_scn NOT LIKE t_prefix || '%';
+			and scn NOT LIKE t_prefix || '%';
 
 		IF in_count = 0 THEN -- no match
 			INSERT INTO cr_report_line
@@ -292,7 +296,8 @@
 		ELSIF in_count = 1 THEN -- perfect match
 			UPDATE cr_report_line SET their_balance = in_amount,
 					trans_type = in_type,
-					clear_time = in_date
+					clear_time = in_date,
+					cleared = true
 			WHERE report_id = in_report_id AND our_balance = in_amount
                         	AND their_balance = 0 and
 				in_scn NOT LIKE t_prefix || '%';
@@ -300,12 +305,13 @@
 			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 || '%'
+				AND scn NOT LIKE t_prefix || '%'
 			LIMIT 1;
 
 			UPDATE cr_report_line SET their_balance = in_amount,
 					trans_type = in_type,
-					clear_time = in_date
+					clear_time = in_date,
+					cleared = true
 			WHERE id = lid;
 			
 		END IF;


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