[BR_forum] NWP printing conversion

Discussion about printing issues and techniques.

Moderators: Susan Smith, admin, Gabriel

Post Reply
George Tisdale

[BR_forum] NWP printing conversion

Post by George Tisdale »

Thought I’d share a recent experience.

I needed to print a general ledger yesterday, a program that I wrote about 5 years ago. The logic of the report was fine, but the presentation was ugly, partly because I had written it to feed into Ryan Faircloth’s PDFgenerator library which required plain text. Using 4.2 I no longer needed that generator and therefore the plain text.

Getting rid of the FORM statements and using FNPRINTNWP$ I was able to change fonts, align columns of numbers, bold parts of lines easily. Bu suing variables for V and H (vertical and horizontal positions) I could reformat the report easily with a few lines at the beginning of the program.

I had a problems part way through because I was trying to test for page length in lines per page, but my V parameter is in INCHES. As soon as I realized my error and changed PPG to 9.5 from 60 all worked swimmingly.

For example
00062 LET PPG=9.5 ! Inches per page !:
LET H0=0 : LET H1=.25 : LET H2=.50 : LET H3=.75 !:
LET COL1=6.5 : LET COL2=7.5
Set the horizontal positioning

71010 PRTDTL: ! Print Detail Records
71020 ! ----------------------------------
71030 IF NOT PAGE THEN GOSUB PRTTTL
71051 IF NOT ROUND(DTRAMT,2)=0 THEN
71052 PRINT #PDFFILE: FNPRINTNWP$(V,H:=H3,"L",DJRNNR$&"-"&DFPE$) !:
PRINT #PDFFILE: FNPRINTNWP$(V,H:=H+0.75,"L",DSOURCE$) !:
PRINT #PDFFILE: FNPRINTNWP$(V,H:=H+.25,"L",DREGNR$) !:
PRINT #PDFFILE: FNPRINTNWP$(V,H:=H+0.75,"L",DATE$(DAYS(DINVDT,"yymmdd"),"mm-dd-yy"))
71053 PRINT #PDFFILE: FNPRINTNWP$(V,H:=H+0.5,"L",DREFNR$) !:
PRINT #PDFFILE: FNPRINTNWP$(V,H:=H+0.4,"L",DJOBNR$) !:
PRINT #PDFFILE: FNPRINTNWP$(V,H:=H+0.3,"L",DDESCR$)
71054 END IF
71061 IF ROUND(DTRAMT,2)>0 THEN LET H=COL1 !:
PRINT #PDFFILE: FNPRINTNWP$(V,H,"R",CNVRT$(MASK$,DTRAMT))
71071 IF ROUND(DTRAMT,2)<0 THEN LET H=COL2 !:
PRINT #PDFFILE: FNPRINTNWP$(V,H,"R",CNVRT$(MASK$,-DTRAMT))
71080 IF V>PPG THEN GOSUB PRTNWPG ELSE LET V+=1/6 : PRINT V
71130 GOSUB ADDSUM
71900 RETURN
Printed the detail line items

73010 PRTHDR: ! Print Header Information
73020 ! -------------------------------------
73030 FRM_HDR: FORM C 6,X 5,C 30
73041 LET H=H0 : PRINT #PDFFILE: FNPRINTNWP$(V,H,"L",ACCNR$,"[MEDIUM]")
73042 LET H+=.6: PRINT #PDFFILE: FNPRINTNWP$(V,H,"L",ACCNM$(1:50))&"[SMALL]"
73043 LET V+=1/6
73050 RETURN
73100 PRTHDR_1: !
73121 LET H=H2 : PRINT #PDFFILE: FNPRINTNWP$(V,H,"L",DCUSNR$)
73122 LET H+=0.5 : PRINT #PDFFILE: FNPRINTNWP$(V,H,"L",DCUSNM$)
73125 LET V+=1/6
73900 RETURN
Prints the header section for each account

74000 ! -------------------------------------
74010 PRTTTL: ! Print Page Titles
74020 ! -------------------------------------
74030 IF PAGE>0 THEN PRINT #PDFFILE: NEWPAGE
74040 LET PAGE=PAGE+1
74051 LET V=0 !:
LET H=H0 : PRINT #PDFFILE: FNPRINTNWP$(V,H,"L","Date: "&DATE$("MM-DD-CCYY"))
74052 LET H=4 : PRINT #PDFFILE: FNPRINTNWP$(V,H,"C",COMNM$,"[MEDIUM][BOLD]")&"[SMALL][/BOLD]"
74056 LET V+=1/6 !:
LET H=H0 : PRINT #PDFFILE: FNPRINTNWP$(V,H,"L","Time: "&TIME$)
74058 LET H=COL2 : PRINT #PDFFILE: FNPRINTNWP$(V,H,"R","Page "&CNVRT$("N 4",PAGE))
74060 PRINT FIELDS MSGFLDON$: "Printing Page "&STR$(PAGE)
74070 LET V+=2/6
74200 RETURN
Prints the page titles for each page

Notice that on line 74052 I Bold a title in MEDIUM sized font and then immediately change it to small and not-bold by appending substitutions to the function

Certain sections like sums and beginning and ending balances were done by using functions as follow:

80000 DEF FNBEGINNING(V,AMTS)
80004 DIM MASK$*20
80005 LET MASK$="PIC(ZZZ,ZZZ,ZZ#.##)"
80010 LET H=.5 : PRINT #PDFFILE: FNPRINTNWP$(V,H,"L","Beginning balance","[BOLD]")&"[/BOLD]"
80020 IF AMTS<0 THEN !:
LET H=COL2 : PRINT #PDFFILE: FNPRINTNWP$(V,H,"R",CNVRT$(MASK$,-AMTS)) !:
ELSE !:
LET H=COL1 : PRINT #PDFFILE: FNPRINTNWP$(V,H,"R",CNVRT$(MASK$,AMTS))
80030 LET FNBEGINNING=V+1/6
80040 END DEF
Printed the beginning balance

80050 DEF FNENDING(V,AMTS)
80060 LET H=H1 : PRINT #PDFFILE: FNPRINTNWP$(V,H,"L","Ending balance","[BOLD]")
80070 IF AMTS<0 THEN !:
LET H=COL2 : PRINT #PDFFILE: FNPRINTNWP$(V,H,"R",CNVRT$(MASK$,-AMTS))&"[/BOLD]" !:
ELSE !:
LET H=COL1 : PRINT #PDFFILE: FNPRINTNWP$(V,H,"R",CNVRT$(MASK$,AMTS))&"[/BOLD]"
80080 LET FNENDING=V+2/6
80090 END DEF
Printed the ending balance

80100 DEF FNSUMS(V,DSUM,CSUM)
80110 LET H=COL1-.9 : LET FNPRINTBOX(PDFFILE,V,H,.01,.9,100)
80120 LET H=COL2-.9 : LET FNPRINTBOX(PDFFILE,V,H,.01,.9,100)
80130 LET V+=1/6
80140 LET H=COL1 : PRINT #PDFFILE: FNPRINTNWP$(V,H,"R",CNVRT$(MASK$,DSUM))
80150 LET H=COL2 : PRINT #PDFFILE: FNPRINTNWP$(V,H,"R",CNVRT$(MASK$,CSUM))
80160 LET FNSUMS=V+2/6
80170 END DEF
Printed the sums for the debits and credits for each account for the period printed including underlines.
Hope this is helpful to you.

George L. Tisdale, CPA
Tisdale CPA
75 Junction Square Drive
Concord, MA 01742
(978) 369-5585
IRS Circular 230 Notice: "To ensure compliance with requirements imposed by the IRS, we inform you that any U.S. tax advice contained in this communication (including any attachments) is not intended or written to be used, and cannot be used, for the purpose of (i) avoiding penalties under the Internal Revenue Code or (ii) promoting, marketing or recommending to another party any transaction or matter addressed herein."
This electronic message transmission contains information which is intended only for the use of the individual or entity to which it is addressed and may contain information that is privileged, confidential and exempt from disclosure under applicable law. If the reader of this message is not the intended recipient, you are hereby notified that any dissemination or distribution of this communication to other than the intended recipient is strictly prohibited. If you have received this communication in error, please notify us immediately by calling (978) 369-5585 or by electronic mail (gtisdale@tisdalecpa.com) Thank you.
Attachments
SecureZIP_Attachments.ZIP
(74.51 KiB) Downloaded 487 times
Susan Smith
Posts: 717
Joined: Sun Aug 10, 2008 4:24 am
Location: Southern California

[BR_forum] NWP printing conversion

Post by Susan Smith »

Very nice George. And perfectly timed. Going to NWP for the client I'm working on is one of our current priorities.
-- Susan

George Tisdale wrote:
<![endif]--> <![endif]-->
Thought I’d share a recent experience.

I needed to print a general ledger yesterday, a program that I wrote about 5 years ago. The logic of the report was fine, but the presentation was ugly, partly because I had written it to feed into Ryan Faircloth’s PDFgenerator library which required plain text. Using 4.2 I no longer needed that generator and therefore the plain text.

Getting rid of the FORM statements and using FNPRINTNWP$ I was able to change fonts, align columns of numbers, bold parts of lines easily. Bu suing variables for V and H (vertical and horizontal positions) I could reformat the report easily with a few lines at the beginning of the program.

I had a problems part way through because I was trying to test for page length in lines per page, but my V parameter is in INCHES. As soon as I realized my error and changed PPG to 9.5 from 60 all worked swimmingly.

For example
00062 LET PPG=9.5 ! Inches per page !:
LET H0=0 : LET H1=.25 : LET H2=.50 : LET H3=.75 !:
LET COL1=6.5 : LET COL2=7.5
Set the horizontal positioning

71010 PRTDTL: ! Print Detail Records
71020 ! ----------------------------------
71030 IF NOT PAGE THEN GOSUB PRTTTL
71051 IF NOT ROUND(DTRAMT,2)=0 THEN
71052 PRINT #PDFFILE: FNPRINTNWP$(V,H:=H3,"L",DJRNNR$&"-"&DFPE$) !:
PRINT #PDFFILE: FNPRINTNWP$(V,H:=H+0.75,"L",DSOURCE$) !:
PRINT #PDFFILE: FNPRINTNWP$(V,H:=H+.25,"L",DREGNR$) !:
PRINT #PDFFILE: FNPRINTNWP$(V,H:=H+0.75,"L",DATE$(DAYS(DINVDT,"yymmdd"),"mm-dd-yy"))
71053 PRINT #PDFFILE: FNPRINTNWP$(V,H:=H+0.5,"L",DREFNR$) !:
PRINT #PDFFILE: FNPRINTNWP$(V,H:=H+0.4,"L",DJOBNR$) !:
PRINT #PDFFILE: FNPRINTNWP$(V,H:=H+0.3,"L",DDESCR$)
71054 END IF
71061 IF ROUND(DTRAMT,2)>0 THEN LET H=COL1 !:
PRINT #PDFFILE: FNPRINTNWP$(V,H,"R",CNVRT$(MASK$,DTRAMT))
71071 IF ROUND(DTRAMT,2)<0 THEN LET H=COL2 !:
PRINT #PDFFILE: FNPRINTNWP$(V,H,"R",CNVRT$(MASK$,-DTRAMT))
71080 IF V>PPG THEN GOSUB PRTNWPG ELSE LET V+=1/6 : PRINT V
71130 GOSUB ADDSUM
71900 RETURN
Printed the detail line items

73010 PRTHDR: ! Print Header Information
73020 ! -------------------------------------
73030 FRM_HDR: FORM C 6,X 5,C 30
73041 LET H=H0 : PRINT #PDFFILE: FNPRINTNWP$(V,H,"L",ACCNR$,"[MEDIUM]")
73042 LET H+=.6: PRINT #PDFFILE: FNPRINTNWP$(V,H,"L",ACCNM$(1:50))&"[SMALL]"
73043 LET V+=1/6
73050 RETURN
73100 PRTHDR_1: !
73121 LET H=H2 : PRINT #PDFFILE: FNPRINTNWP$(V,H,"L",DCUSNR$)
73122 LET H+=0.5 : PRINT #PDFFILE: FNPRINTNWP$(V,H,"L",DCUSNM$)
73125 LET V+=1/6
73900 RETURN
Prints the header section for each account

74000 ! -------------------------------------
74010 PRTTTL: ! Print Page Titles
74020 ! -------------------------------------
74030 IF PAGE>0 THEN PRINT #PDFFILE: NEWPAGE
74040 LET PAGE=PAGE+1
74051 LET V=0 !:
LET H=H0 : PRINT #PDFFILE: FNPRINTNWP$(V,H,"L","Date: "&DATE$("MM-DD-CCYY"))
74052 LET H=4 : PRINT #PDFFILE: FNPRINTNWP$(V,H,"C",COMNM$,"[MEDIUM][BOLD]")&"[SMALL][/BOLD]"
74056 LET V+=1/6 !:
LET H=H0 : PRINT #PDFFILE: FNPRINTNWP$(V,H,"L","Time: "&TIME$)
74058 LET H=COL2 : PRINT #PDFFILE: FNPRINTNWP$(V,H,"R","Page "&CNVRT$("N 4",PAGE))
74060 PRINT FIELDS MSGFLDON$: "Printing Page "&STR$(PAGE)
74070 LET V+=2/6
74200 RETURN
Prints the page titles for each page

Notice that on line 74052 I Bold a title in MEDIUM sized font and then immediately change it to small and not-bold by appending substitutions to the function

Certain sections like sums and beginning and ending balances were done by using functions as follow:

80000 DEF FNBEGINNING(V,AMTS)
80004 DIM MASK$*20
80005 LET MASK$="PIC(ZZZ,ZZZ,ZZ#.##)"
80010 LET H=.5 : PRINT #PDFFILE: FNPRINTNWP$(V,H,"L","Beginning balance","[BOLD]")&"[/BOLD]"
80020 IF AMTS<0 THEN !:
LET H=COL2 : PRINT #PDFFILE: FNPRINTNWP$(V,H,"R",CNVRT$(MASK$,-AMTS)) !:
ELSE !:
LET H=COL1 : PRINT #PDFFILE: FNPRINTNWP$(V,H,"R",CNVRT$(MASK$,AMTS))
80030 LET FNBEGINNING=V+1/6
80040 END DEF
Printed the beginning balance

80050 DEF FNENDING(V,AMTS)
80060 LET H=H1 : PRINT #PDFFILE: FNPRINTNWP$(V,H,"L","Ending balance","[BOLD]")
80070 IF AMTS<0 THEN !:
LET H=COL2 : PRINT #PDFFILE: FNPRINTNWP$(V,H,"R",CNVRT$(MASK$,-AMTS))&"[/BOLD]" !:
ELSE !:
LET H=COL1 : PRINT #PDFFILE: FNPRINTNWP$(V,H,"R",CNVRT$(MASK$,AMTS))&"[/BOLD]"
80080 LET FNENDING=V+2/6
80090 END DEF
Printed the ending balance

80100 DEF FNSUMS(V,DSUM,CSUM)
80110 LET H=COL1-.9 : LET FNPRINTBOX(PDFFILE,V,H,.01,.9,100)
80120 LET H=COL2-.9 : LET FNPRINTBOX(PDFFILE,V,H,.01,.9,100)
80130 LET V+=1/6
80140 LET H=COL1 : PRINT #PDFFILE: FNPRINTNWP$(V,H,"R",CNVRT$(MASK$,DSUM))
80150 LET H=COL2 : PRINT #PDFFILE: FNPRINTNWP$(V,H,"R",CNVRT$(MASK$,CSUM))
80160 LET FNSUMS=V+2/6
80170 END DEF
Printed the sums for the debits and credits for each account for the period printed including underlines.
Hope this is helpful to you.

George L. Tisdale, CPA
George Tisdale

[BR_forum] NWP printing conversion

Post by George Tisdale »

One detail that I left out of the former email is that for FNPRINTNWP to correctly position items (left justify, right justify, center) you need to have declared [BOXVERTICALS] once before invoking the function. I do it right after opening the print file.

PRINT #PRINTFILE:”[BOXVERTICALS]”

George L. Tisdale, CPA
Tisdale CPA
75 Junction Square Drive
Concord, MA 01742
(978) 369-5585
IRS Circular 230 Notice: "To ensure compliance with requirements imposed by the IRS, we inform you that any U.S. tax advice contained in this communication (including any attachments) is not intended or written to be used, and cannot be used, for the purpose of (i) avoiding penalties under the Internal Revenue Code or (ii) promoting, marketing or recommending to another party any transaction or matter addressed herein."
This electronic message transmission contains information which is intended only for the use of the individual or entity to which it is addressed and may contain information that is privileged, confidential and exempt from disclosure under applicable law. If the reader of this message is not the intended recipient, you are hereby notified that any dissemination or distribution of this communication to other than the intended recipient is strictly prohibited. If you have received this communication in error, please notify us immediately by calling (978) 369-5585 or by electronic mail (gtisdale@tisdalecpa.com) Thank you.


From: br_forum-bounces@ads.net [mailto:br_forum-bounces@ads.net] On Behalf Of Susan Smith
Sent: Sunday, May 10, 2009 9:18 PM
To: Business Rules Forum
Subject: Re: [BR_forum] NWP printing conversion



Very nice George. And perfectly timed. Going to NWP for the client I'm working on is one of our current priorities.
-- Susan

George Tisdale wrote:
Thought I’d share a recent experience.

I needed to print a general ledger yesterday, a program that I wrote about 5 years ago. The logic of the report was fine, but the presentation was ugly, partly because I had written it to feed into Ryan Faircloth’s PDFgenerator library which required plain text. Using 4.2 I no longer needed that generator and therefore the plain text.

Getting rid of the FORM statements and using FNPRINTNWP$ I was able to change fonts, align columns of numbers, bold parts of lines easily. Bu suing variables for V and H (vertical and horizontal positions) I could reformat the report easily with a few lines at the beginning of the program.

I had a problems part way through because I was trying to test for page length in lines per page, but my V parameter is in INCHES. As soon as I realized my error and changed PPG to 9.5 from 60 all worked swimmingly.

For example
00062 LET PPG=9.5 ! Inches per page !:
LET H0=0 : LET H1=.25 : LET H2=.50 : LET H3=.75 !:
LET COL1=6.5 : LET COL2=7.5
Set the horizontal positioning

71010 PRTDTL: ! Print Detail Records
71020 ! ----------------------------------
71030 IF NOT PAGE THEN GOSUB PRTTTL
71051 IF NOT ROUND(DTRAMT,2)=0 THEN
71052 PRINT #PDFFILE: FNPRINTNWP$(V,H:=H3,"L",DJRNNR$&"-"&DFPE$) !:
PRINT #PDFFILE: FNPRINTNWP$(V,H:=H+0.75,"L",DSOURCE$) !:
PRINT #PDFFILE: FNPRINTNWP$(V,H:=H+.25,"L",DREGNR$) !:
PRINT #PDFFILE: FNPRINTNWP$(V,H:=H+0.75,"L",DATE$(DAYS(DINVDT,"yymmdd"),"mm-dd-yy"))
71053 PRINT #PDFFILE: FNPRINTNWP$(V,H:=H+0.5,"L",DREFNR$) !:
PRINT #PDFFILE: FNPRINTNWP$(V,H:=H+0.4,"L",DJOBNR$) !:
PRINT #PDFFILE: FNPRINTNWP$(V,H:=H+0.3,"L",DDESCR$)
71054 END IF
71061 IF ROUND(DTRAMT,2)>0 THEN LET H=COL1 !:
PRINT #PDFFILE: FNPRINTNWP$(V,H,"R",CNVRT$(MASK$,DTRAMT))
71071 IF ROUND(DTRAMT,2)<0 THEN LET H=COL2 !:
PRINT #PDFFILE: FNPRINTNWP$(V,H,"R",CNVRT$(MASK$,-DTRAMT))
71080 IF V>PPG THEN GOSUB PRTNWPG ELSE LET V+=1/6 : PRINT V
71130 GOSUB ADDSUM
71900 RETURN
Printed the detail line items

73010 PRTHDR: ! Print Header Information
73020 ! -------------------------------------
73030 FRM_HDR: FORM C 6,X 5,C 30
73041 LET H=H0 : PRINT #PDFFILE: FNPRINTNWP$(V,H,"L",ACCNR$,"[MEDIUM]")
73042 LET H+=.6: PRINT #PDFFILE: FNPRINTNWP$(V,H,"L",ACCNM$(1:50))&"[SMALL]"
73043 LET V+=1/6
73050 RETURN
73100 PRTHDR_1: !
73121 LET H=H2 : PRINT #PDFFILE: FNPRINTNWP$(V,H,"L",DCUSNR$)
73122 LET H+=0.5 : PRINT #PDFFILE: FNPRINTNWP$(V,H,"L",DCUSNM$)
73125 LET V+=1/6
73900 RETURN
Prints the header section for each account

74000 ! -------------------------------------
74010 PRTTTL: ! Print Page Titles
74020 ! -------------------------------------
74030 IF PAGE>0 THEN PRINT #PDFFILE: NEWPAGE
74040 LET PAGE=PAGE+1
74051 LET V=0 !:
LET H=H0 : PRINT #PDFFILE: FNPRINTNWP$(V,H,"L","Date: "&DATE$("MM-DD-CCYY"))
74052 LET H=4 : PRINT #PDFFILE: FNPRINTNWP$(V,H,"C",COMNM$,"[MEDIUM][BOLD]")&"[SMALL][/BOLD]"
74056 LET V+=1/6 !:
LET H=H0 : PRINT #PDFFILE: FNPRINTNWP$(V,H,"L","Time: "&TIME$)
74058 LET H=COL2 : PRINT #PDFFILE: FNPRINTNWP$(V,H,"R","Page "&CNVRT$("N 4",PAGE))
74060 PRINT FIELDS MSGFLDON$: "Printing Page "&STR$(PAGE)
74070 LET V+=2/6
74200 RETURN
Prints the page titles for each page

Notice that on line 74052 I Bold a title in MEDIUM sized font and then immediately change it to small and not-bold by appending substitutions to the function

Certain sections like sums and beginning and ending balances were done by using functions as follow:

80000 DEF FNBEGINNING(V,AMTS)
80004 DIM MASK$*20
80005 LET MASK$="PIC(ZZZ,ZZZ,ZZ#.##)"
80010 LET H=.5 : PRINT #PDFFILE: FNPRINTNWP$(V,H,"L","Beginning balance","[BOLD]")&"[/BOLD]"
80020 IF AMTS<0 THEN !:
LET H=COL2 : PRINT #PDFFILE: FNPRINTNWP$(V,H,"R",CNVRT$(MASK$,-AMTS)) !:
ELSE !:
LET H=COL1 : PRINT #PDFFILE: FNPRINTNWP$(V,H,"R",CNVRT$(MASK$,AMTS))
80030 LET FNBEGINNING=V+1/6
80040 END DEF
Printed the beginning balance

80050 DEF FNENDING(V,AMTS)
80060 LET H=H1 : PRINT #PDFFILE: FNPRINTNWP$(V,H,"L","Ending balance","[BOLD]")
80070 IF AMTS<0 THEN !:
LET H=COL2 : PRINT #PDFFILE: FNPRINTNWP$(V,H,"R",CNVRT$(MASK$,-AMTS))&"[/BOLD]" !:
ELSE !:
LET H=COL1 : PRINT #PDFFILE: FNPRINTNWP$(V,H,"R",CNVRT$(MASK$,AMTS))&"[/BOLD]"
80080 LET FNENDING=V+2/6
80090 END DEF
Printed the ending balance

80100 DEF FNSUMS(V,DSUM,CSUM)
80110 LET H=COL1-.9 : LET FNPRINTBOX(PDFFILE,V,H,.01,.9,100)
80120 LET H=COL2-.9 : LET FNPRINTBOX(PDFFILE,V,H,.01,.9,100)
80130 LET V+=1/6
80140 LET H=COL1 : PRINT #PDFFILE: FNPRINTNWP$(V,H,"R",CNVRT$(MASK$,DSUM))
80150 LET H=COL2 : PRINT #PDFFILE: FNPRINTNWP$(V,H,"R",CNVRT$(MASK$,CSUM))
80160 LET FNSUMS=V+2/6
80170 END DEF
Printed the sums for the debits and credits for each account for the period printed including underlines.
Hope this is helpful to you.

George L. Tisdale, CPA
Post Reply