[Gnucash-changes] Apply David Reiser's patch for Quicken(tm) cheques with stub.

Derek Atkins warlord at cvs.gnucash.org
Fri Jul 2 22:11:53 EDT 2004


Log Message:
-----------
Apply David Reiser's patch for Quicken(tm) cheques with stub.

	* src/gnome/dialog-print-check.c:
	* src/gnome/glade/print.glade:
	* src/scm/printing/print-check.scm:
	  Apply David Reiser's patch for Quicken(tm) cheques with stub.

Modified Files:
--------------
    gnucash:
        ChangeLog
    gnucash/src/gnome:
        dialog-print-check.c
    gnucash/src/gnome/glade:
        print.glade
    gnucash/src/scm/printing:
        print-check.scm

Revision Data
-------------
Index: ChangeLog
===================================================================
RCS file: /home/cvs/cvsroot/gnucash/ChangeLog,v
retrieving revision 1.1821
retrieving revision 1.1822
diff -LChangeLog -LChangeLog -u -r1.1821 -r1.1822
--- ChangeLog
+++ ChangeLog
@@ -1,3 +1,10 @@
+2004-07-02  Derek Atkins  <derek at ihtfp.com>
+
+	* src/gnome/dialog-print-check.c:
+	* src/gnome/glade/print.glade:
+	* src/scm/printing/print-check.scm:
+	  Apply David Reiser's patch for Quicken(tm) cheques with stub.
+
 2004-06-30  Christian Stimming  <stimming at tuhh.de>
 
 	* src/report/report-gnome/window-report.c: Add toolbar element for
Index: dialog-print-check.c
===================================================================
RCS file: /home/cvs/cvsroot/gnucash/src/gnome/dialog-print-check.c,v
retrieving revision 1.18
retrieving revision 1.19
diff -Lsrc/gnome/dialog-print-check.c -Lsrc/gnome/dialog-print-check.c -u -r1.18 -r1.19
--- src/gnome/dialog-print-check.c
+++ src/gnome/dialog-print-check.c
@@ -179,7 +179,7 @@
   int        sel_option;
   double     multip = 72.0;
 
-  char       * formats[]   = { "quicken", "deluxe", "custom" };
+  char       * formats[]   = { "quicken", "deluxe", "wallet", "custom" };
   char       * positions[] = { "top", "middle", "bottom", "custom" };
 
   sel_option = gnc_option_menu_get_active(pcd->format_picker);
Index: print.glade
===================================================================
RCS file: /home/cvs/cvsroot/gnucash/src/gnome/glade/print.glade,v
retrieving revision 1.8
retrieving revision 1.9
diff -Lsrc/gnome/glade/print.glade -Lsrc/gnome/glade/print.glade -u -r1.8 -r1.9
--- src/gnome/glade/print.glade
+++ src/gnome/glade/print.glade
@@ -183,6 +183,7 @@
 	  <can_focus>True</can_focus>
 	  <items>Quicken/QuickBooks (tm) US-Letter
 Deluxe(tm) Personal Checks US-Letter
+Quicken(tm) Wallet Checks w/ side stub
 Custom
 </items>
 	  <initial_choice>0</initial_choice>
Index: print-check.scm
===================================================================
RCS file: /home/cvs/cvsroot/gnucash/src/scm/printing/print-check.scm,v
retrieving revision 1.14
retrieving revision 1.15
diff -Lsrc/scm/printing/print-check.scm -Lsrc/scm/printing/print-check.scm -u -r1.14 -r1.15
--- src/scm/printing/print-check.scm
+++ src/scm/printing/print-check.scm
@@ -3,6 +3,8 @@
 ;;;  print a check from a transaction. 
 ;;;
 ;;;  Copyright 2000 Bill Gribble <grib at billgribble.com>
+;;;  June 2004 - D. Reiser - added capability to print wallet checks
+;;;                          with left-side stubs
 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 
 (use-modules (gnucash printing number-to-words))
@@ -67,19 +69,33 @@
 		(memo . (100.0 73.0))
 		(rotate . 90.0)
 		(translate . (232.0 300.0))
-		(offset . 0.0)))
-    (quicken  . ((payee . (90.0 150.0))
+		(offset . 0.0)))                ;;declaration of offset preempts top/middle/bottom dialog choice
+	 (quicken  . ((payee . (90.0 150.0))
 		 (amount-words . (90.0 120.0))
 		 (amount-number . (500.0 150.0))
 		 (date . (500.0 185.0))
-		 (memo . (50.0 40.0))))
+		 (memo . (50.0 40.0))
+		 (top . 540.0)
+		 (middle . 288.0)
+		 (bottom . 36.0)))
+    (wallet . ((payee . (231.0 140.0))  ;;these coord. for placement above amount-word line
+                                        ;;use 202.0 94.0 for placement in address area
+		 (amount-words . (195.0 125.0))
+		 (amount-number . (518.0 137.0))
+		 (date . (504.0 151.0))
+		 (memo . (216.0 37.0))
+		 (date-stub . (36.0 151.0))
+		 (payee-stub . (28.0 126.0))
+		 (amount-stub . (50.0 90.0))
+		 (memo-stub . (28.0 65.0))
+		 (top . 588.0)
+		 (middle . 384.0)
+		 (bottom . 180.0)))
+	(custom . ((top . 540.0)  ;;set default perforation location for custom print layout
+	     (middle . 288.0)
+	     (bottom . 36.0))) 
     ))
 
-(define gnc:*stock-check-positions*
-  '((top . 540.0)
-    (middle . 288.0)
-    (bottom . 36.0)))
-
 (define (gnc:print-check format-info payee amount date memo)
     (let* ((int-part (inexact->exact (truncate amount)))
            (frac-part (inexact->exact 
@@ -88,7 +104,9 @@
            (ps (gnc:print-session-create #t))
            (format #f)
            (offset #f)
-           (date-string ""))
+           (date-string "")
+           (payee-stub-text "")
+           (memo-stub-text ""))
       (if (not (eq? (print-check-format:format format-info) 'custom))
           (begin 
             (set! format (assq (print-check-format:format format-info) 
@@ -104,7 +122,8 @@
           (begin 
             (set! offset 
                   (cdr (assq (print-check-format:position format-info)
-                             gnc:*stock-check-positions*)))
+                          (cdr (assq (print-check-format:format format-info)
+                             gnc:*stock-check-formats*)))))
             (if (pair? offset)
                 (set! offset (cdr offset))))
           (set! offset
@@ -155,6 +174,34 @@
                                   (+ offset (caddr memo-pos)))
         (gnc:print-session-text ps memo))
 
+      (if (eq? (print-check-format:format format-info) 'wallet)
+        (begin
+           (let ((memostub-pos (assq 'memo-stub format)))
+                (gnc:print-session-moveto ps (cadr memostub-pos) 
+                                  (+ offset (caddr memostub-pos)))
+             (if (< (string-length memo) 22)
+	            (set! memo-stub-text memo)
+	            (set! memo-stub-text (substring memo 0 20)))
+             (gnc:print-session-text ps memo-stub-text))
+        
+           (let ((datestub-pos (assq 'date-stub format)))
+              (gnc:print-session-moveto ps (cadr datestub-pos) 
+                                  (+ offset (caddr datestub-pos)))
+             (gnc:print-session-text ps date-string))
+        
+           (let ((payeestub-pos (assq 'payee-stub format)))
+                (gnc:print-session-moveto ps (cadr payeestub-pos) 
+                                  (+ offset (caddr payeestub-pos)))
+              (if (< (string-length payee) 22)
+	            (set! payee-stub-text payee)
+	            (set! payee-stub-text (substring payee 0 20)))
+             (gnc:print-session-text ps payee-stub-text))
+        
+           (let ((amountstub-pos (assq 'amount-stub format)))
+             (gnc:print-session-moveto ps (cadr amountstub-pos) 
+                                  (+ offset (caddr amountstub-pos)))
+             (gnc:print-session-text ps (printable-value amount 100)))))
+
       (gnc:print-session-done ps #t)
       (gnc:print-session-print ps)))
 


More information about the gnucash-changes mailing list