r17763 - gnucash/trunk/src/report/report-system - clean up a really ugly piece of scheme code

Andrew Sackville-West andrewsw at cvs.gnucash.org
Mon Dec 8 17:57:23 EST 2008


Author: andrewsw
Date: 2008-12-08 17:57:23 -0500 (Mon, 08 Dec 2008)
New Revision: 17763
Trac: http://svn.gnucash.org/trac/changeset/17763

Modified:
   gnucash/trunk/src/report/report-system/html-acct-table.scm
Log:
clean up a really ugly piece of scheme code

Modified: gnucash/trunk/src/report/report-system/html-acct-table.scm
===================================================================
--- gnucash/trunk/src/report/report-system/html-acct-table.scm	2008-12-08 08:38:32 UTC (rev 17762)
+++ gnucash/trunk/src/report/report-system/html-acct-table.scm	2008-12-08 22:57:23 UTC (rev 17763)
@@ -650,7 +650,7 @@
 		   account start-date end-date #f)
 		  (gnc:account-get-comm-balance-at-date
 		   account end-date #f)))
-	     (closing (lambda(a)
+	     (closing (lambda(a) 
 			(gnc:account-get-trans-type-balance-interval
 			 (list account) closing-pattern
 			 start-date end-date)
@@ -663,24 +663,27 @@
 			  )
 			)
 	     )
-	;; what the heck is this? how about (case balance-mode blah)...
-	(or (and (equal? balance-mode 'post-closing) post-closing-bal)
-	    (and (equal? balance-mode 'pre-closing)
-		 (let* ((closing-amt (closing account))
-			)
-		   (post-closing-bal 'minusmerge closing-amt #f)
-		   post-closing-bal)
+
+	(cond
+	 ((equal? balance-mode 'post-closing)
+	  post-closing-bal)
+
+	 ((equal? balance-mode 'pre-closing)
+	  (let* ((closing-amt (closing account))
 		 )
-	    (and (equal? balance-mode 'pre-adjusting)
-		 (let* ((closing-amt (closing account))
-			(adjusting-amt (adjusting account))
-			)
-		   (post-closing-bal 'minusmerge closing-amt #f)
-		   (post-closing-bal 'minusmerge adjusting-amt #f)
-		   post-closing-bal)
-		 )
-	    ;; error if we get here.
-	    )
+	    (post-closing-bal 'minusmerge closing-amt #f))
+	  post-closing-bal)
+
+	 ((equal? balance-mode 'pre-adjusting)
+	  (let* ((closing-amt (closing account))
+		 (adjusting-amt (adjusting account))
+		 ))
+	  (post-closing-bal 'minusmerge closing-amt #f)
+	  (post-closing-bal 'minusmerge adjusting-amt #f)
+	  post-closing-bal)
+	 (else (begin (display "you fail it")
+		      (newline))))
+
 	)
       )
 



More information about the gnucash-changes mailing list