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

SF.net SVN: ledger-smb:[4263] branches/1.3



Revision: 4263
          http://ledger-smb.svn.sourceforge.net/ledger-smb/?rev=4263&view=rev
Author:   einhverfr
Date:     2012-01-16 23:32:37 +0000 (Mon, 16 Jan 2012)
Log Message:
-----------
Change to RPM spec file for dependency issues and packaging changes

Modified Paths:
--------------
    branches/1.3/dists/rpm/ledgersmb.spec
    branches/1.3/sql/modules/Payment.sql

Modified: branches/1.3/dists/rpm/ledgersmb.spec
===================================================================
--- branches/1.3/dists/rpm/ledgersmb.spec	2012-01-13 07:16:07 UTC (rev 4262)
+++ branches/1.3/dists/rpm/ledgersmb.spec	2012-01-16 23:32:37 UTC (rev 4263)
@@ -17,7 +17,7 @@
 Requires: perl-File-MimeInfo, perl-IO-stringy
 Requires: perl-MIME-Lite, perl-Class-Std >= 0.0.8
 Requires: perl-Locale-Maketext-Lexicon >= 0.62
-Requires: perl-IO-String perl-Config-Std >= 0.007
+Requires: perl-IO-String 
 Requires: perl-Math-BigInt-GMP
 Requires: perl-Log-Log4perl perl-DateTime
 Requires: perl-Config-Std
@@ -68,7 +68,7 @@
 chmod 0644 $(find . -type f)
 chmod 0755 $(find . -type d)
 chmod +x *.pl
-chmod -x pos.conf.pl custom.pl # FIXME: Config???
+chmod -x custom.pl # FIXME: Config???
 chmod +x utils/*/*.pl utils/devel/find-use utils/pos/pos-hardware-client-startup-script
 
 

Modified: branches/1.3/sql/modules/Payment.sql
===================================================================
--- branches/1.3/sql/modules/Payment.sql	2012-01-13 07:16:07 UTC (rev 4262)
+++ branches/1.3/sql/modules/Payment.sql	2012-01-16 23:32:37 UTC (rev 4263)
@@ -81,21 +81,13 @@
 		JOIN company cp ON (cp.entity_id = e.id)
 			WHERE ec.entity_class = in_account_class
                         AND CASE WHEN in_account_class = 1 THEN
-	           		ec.id IN (SELECT entity_credit_account
-                                            FROM ap
-                                            JOIN acc_trans ac ON ap.id = ac.trans_id
-                                            JOIN account_link al ON acc.chart_id = al.account_id
-                                           WHERE al.description = 'AP'
-                                           GROUP BY entity_credit_account
-                                           HAVING SUM(ac.amount) <> 0)
+	           		ec.id IN (SELECT entity_credit_account FROM ap 
+	           			WHERE amount <> paid
+		   			GROUP BY entity_credit_account)
 		    	       WHEN in_account_class = 2 THEN
-		   		ec.id IN (SELECT entity_credit_account
-                                            FROM ar
-                                            JOIN acc_trans ac ON ar.id = ac.trans_id
-                                            JOIN account_link al ON acc.chart_id = al.account_id
-                                           WHERE al.description = 'AR'
-                                           GROUP BY entity_credit_account
-                                           HAVING SUM(ac.amount) <> 0)
+		   		ec.id IN (SELECT entity_credit_account FROM ar
+		   			WHERE amount <> paid
+		   			GROUP BY entity_credit_account)
 		   	  END
 	LOOP
 		RETURN NEXT out_entity;
@@ -126,6 +118,14 @@
 
 COMMENT ON FUNCTION payment_get_all_accounts(int) IS
 $$ This function takes a single argument (1 for vendor, 2 for customer as 
+	LOOP
+		RETURN NEXT out_entity;
+	END LOOP;
+END;
+$$ LANGUAGE PLPGSQL;
+
+COMMENT ON FUNCTION payment_get_all_accounts(int) IS
+$$ This function takes a single argument (1 for vendor, 2 for customer as 
 always) and returns all entities with accounts of the appropriate type. $$;
 
 DROP TYPE IF EXISTS payment_invoice CASCADE;
@@ -395,16 +395,7 @@
 		   WHERE (a.batch_id = in_batch_id
 		          OR (a.invoice_class = in_account_class
 		             AND a.approved
-			 AND (c.business_id = 
-				coalesce(in_business_id, c.business_id)
-				OR in_business_id is null)
-		         AND ((a.transdate >= COALESCE(in_date_from, a.transdate)
-		               AND a.transdate <= COALESCE(in_date_to, a.transdate)))
-		         AND c.entity_class = in_account_class
-		         AND a.curr = in_currency
-		         AND a.entity_credit_account = c.id
-			 AND p.due <> 0
-                         --### short term: ignore fractional differences
+		         AND a.amount <> a.paid 
 			 AND NOT a.on_hold
 		         AND EXISTS (select trans_id FROM acc_trans
 		                      WHERE trans_id = a.id AND
@@ -510,6 +501,15 @@
 			source)
 		SELECT id, 
 		case when $E$ || quote_literal(in_account_class) || $E$ = 1
+				quote_literal(in_transactions[out_count][2])
+				|| $E$)$E$;
+	END LOOP;
+	EXECUTE $E$ 
+		INSERT INTO acc_trans 
+			(trans_id, chart_id, amount, approved, voucher_id, transdate, 
+			source)
+		SELECT id, 
+		case when $E$ || quote_literal(in_account_class) || $E$ = 1
 			THEN $E$ || t_cash_id || $E$
 			WHEN $E$ || quote_literal(in_account_class) || $E$ = 2 
 			THEN $E$ || t_ar_ap_id || $E$
@@ -1290,6 +1290,30 @@
             
       LOOP
            RETURN NEXT out_overpayment;
+    		WHERE available <> 0 AND in_account_class = payment_class
+        LOOP
+                RETURN NEXT out_entity;
+        END LOOP;
+ END;
+$$ LANGUAGE PLPGSQL;
+
+CREATE OR REPLACE FUNCTION payment_get_unused_overpayment(
+in_account_class int, in_entity_credit_id int, in_chart_id int)
+returns SETOF overpayments AS
+$$
+DECLARE out_overpayment overpayments%ROWTYPE;
+BEGIN
+      FOR out_overpayment IN
+              SELECT DISTINCT * 
+              FROM overpayments
+              WHERE payment_class  = in_account_class 
+              AND entity_credit_id = in_entity_credit_id 
+              AND available <> 0
+              AND (in_chart_id IS NULL OR chart_id = in_chart_id )
+              ORDER BY payment_date
+            
+      LOOP
+           RETURN NEXT out_overpayment;
       END LOOP;
 END;
 $$ LANGUAGE PLPGSQL;

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