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

SF.net SVN: ledger-smb:[6653] trunk/sql/modules/Reconciliation.sql



Revision: 6653
          http://sourceforge.net/p/ledger-smb/code/6653
Author:   einhverfr
Date:     2014-01-26 08:01:27 +0000 (Sun, 26 Jan 2014)
Log Message:
-----------
Fixing bug 940, reconciliation does not pick up on new adjustments.  These are now brought in as new line items so they can be selected together.  This could change in 1.5 or later as new workflows accommodated

Modified Paths:
--------------
    trunk/sql/modules/Reconciliation.sql

Modified: trunk/sql/modules/Reconciliation.sql
===================================================================
--- trunk/sql/modules/Reconciliation.sql	2014-01-26 07:56:20 UTC (rev 6652)
+++ trunk/sql/modules/Reconciliation.sql	2014-01-26 08:01:27 UTC (rev 6653)
@@ -431,6 +431,7 @@
 			AND ((rl.ledger_id = ac.entry_id 
 				AND ac.voucher_id IS NULL) 
 				OR (rl.voucher_id = ac.voucher_id)))
+                LEFT JOIN cr_report r ON r.id = in_report_id
                 LEFT JOIN exchangerate ex ON gl.transdate = ex.transdate
 		WHERE ac.cleared IS FALSE
 			AND ac.approved IS TRUE
@@ -441,13 +442,15 @@
                             OR (t_recon_fx is true 
                                 AND (gl.table <> 'gl' OR ac.fx_transaction
                                                       IS TRUE))) 
+                        AND (ac.entry_id > coalesce(r.max_ac_id, 0))
 		GROUP BY gl.ref, ac.source, ac.transdate,
 			ac.memo, ac.voucher_id, gl.table, 
                         case when gl.table = 'gl' then gl.id else 1 end
 		HAVING count(rl.id) = 0;
 
 		UPDATE cr_report set updated = now(),
-			their_total = coalesce(in_their_total, their_total)
+			their_total = coalesce(in_their_total, their_total),
+                        max_ac_id = (select max(entry_id) from acc_trans)
 		where id = in_report_id;
     RETURN in_report_id;
     END;

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