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

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



Revision: 3061
          http://ledger-smb.svn.sourceforge.net/ledger-smb/?rev=3061&view=rev
Author:   einhverfr
Date:     2010-09-14 16:29:35 +0000 (Tue, 14 Sep 2010)

Log Message:
-----------
Payment search differentiates payments by voucher_id now.

Modified Paths:
--------------
    trunk/scripts/payment.pl
    trunk/sql/modules/Payment.sql

Modified: trunk/scripts/payment.pl
===================================================================
--- trunk/scripts/payment.pl	2010-09-10 20:41:55 UTC (rev 3060)
+++ trunk/scripts/payment.pl	2010-09-14 16:29:35 UTC (rev 3061)
@@ -260,6 +260,7 @@
         $payment->{"credit_id_$rowcount"} = $line->{credit_id};
         $payment->{"date_paid_$rowcount"} = $line->{date_paid};
         $payment->{"source_$rowcount"} = $line->{source};
+        $payment->{"voucher_id_$rowcount"} = $line->{voucher_id};
         $classcount = ($classcount + 1) % 2;
         ++$rowcount;
     }
@@ -291,6 +292,7 @@
            $payment->{credit_id} = $payment->{"credit_id_$count"};
            $payment->{date_paid} = $payment->{"date_paid_$count"};
            $payment->{source} = $payment->{"source_$count"};
+           $payment->{voucher_id} = $payment->{"voucher_id_$count"};
            $payment->reverse;
         }
     }

Modified: trunk/sql/modules/Payment.sql
===================================================================
--- trunk/sql/modules/Payment.sql	2010-09-10 20:41:55 UTC (rev 3060)
+++ trunk/sql/modules/Payment.sql	2010-09-14 16:29:35 UTC (rev 3061)
@@ -995,6 +995,7 @@
         source text,
 	batch_control text,
 	batch_description text,
+        voucher_id int,
         date_paid date
 );
 
@@ -1012,7 +1013,7 @@
 			c.id, co.legal_name,
 			compound_array(ARRAY[ARRAY[ch.id::text, ch.accno, 
 				ch.description]]), a.source, 
-			b.control_code, b.description, a.transdate
+			b.control_code, b.description, a.voucher_id, a.transdate
 		FROM entity_credit_account c
 		JOIN ( select entity_credit_account, id
 			FROM ar WHERE in_account_class = 2
@@ -1032,7 +1033,8 @@
 			AND (a.transdate <= in_date_to OR in_date_to IS NULL)
 			AND (source = in_source OR in_source IS NULL)
 		GROUP BY c.meta_number, c.id, co.legal_name, a.transdate, 
-			a.source, a.memo, b.id, b.control_code, b.description
+			a.source, a.memo, b.id, b.control_code, b.description, 
+                        voucher_id
 		ORDER BY a.transdate, c.meta_number, a.source
 	LOOP
 		RETURN NEXT out_row;
@@ -1042,7 +1044,8 @@
 
 CREATE OR REPLACE FUNCTION payment__reverse
 (in_source text, in_date_paid date, in_credit_id int, in_cash_accno text, 
-	in_date_reversed date, in_account_class int, in_batch_id int)
+	in_date_reversed date, in_account_class int, in_batch_id int, 
+        in_voucher_id int)
 RETURNS INT 
 AS $$
 DECLARE
@@ -1070,6 +1073,8 @@
 			AND transdate = in_date_paid
 			AND in_credit_id = c.id
 			AND in_cash_accno = ch.accno
+                        and coalesce (in_voucher_id, 0) 
+                             = coalesce(voucher_id, 0)
 	LOOP
 		IF in_batch_id IS NOT NULL 
 			AND t_voucher_inserted IS NOT TRUE


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