Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

dBase IV Printing

Status
Not open for further replies.

Chief0

Programmer
Jul 27, 2007
3
CA
Im tryin to print to a Laserjet 1200 from my XP machine. When printing out reports, the words on the page are cut off about half way through and are printed on the next page. Ive looked around and cant find where i can manually input printer control codes, and i've tried every driver that came with dbase. Any ideas?
 
Chief0,

What is the lines per page set to on this printer. I have a bunch of 4SI's and I have to have the right font & the right lines per page setup to have my stuff print correctly.
Is their a font test or sample page test that will list the current settings and how they print.

I have printer control codes ejmmbedded within my reports to handle landscape/portrait, 10/12/16.6 pitch etc. If you don't have the users guide go online and grab a copy. You should be able to control the printer thru those codes. My 4SI's have the ability to change font and most of the configurable items thru an interface, most the newer printers use the codes only, so you have to embed them into your code.

Jim C.


 
Jim,

Thanks for the useful tips, but I have no way to print a test page. You have confirmed my suspicions that the codes should be in the report. It would seem that every report does print slighty different. The problem is, I did not develope this database so i dont konw which files is actually the report. Ive edited .FRG, .PRG and the driver files themselves .PR2. The closest i found was the PRG where it had the listings to the menu im used to seeing in DBase but i cant see where i should input the code or if this should be the file im supposed to be editing.
 
This is the chunk of code im looking in the PRG file.

procedure FUND_YTD

LINE1 = "BRIDGE STREET UNITED CHURCH"
LINE2 = "Fund Totals - Year to date"
LINE5 = "Prepare printer then press ANY KEY to begin printing..."
PRNTYR = year(date())-1
@ 3, 2 clear to 21,77
@ 5,(80-len(LINE2))/2 say LINE2
@ 7,26 say "Enter year to print... " get PRNTYR picture "9999"
read
IF PRNTYR<year(date())
LINE3 = "as at December 31, "+str(PRNTYR,4)
ELSE

LINE3 = "as at "+cmonth(date())+" "+str(day(date()),2)+", "+str(year(date()),4)

ENDIF
@ 9,(80-len(LINE5))/2 say LINE5
set console off
wait
IF lastkey()=27
@10, 2 clear to 10,77
return
ENDIF
@ 9, 2 clear to 9,77
@ 9,30 say "Printing - please wait..."
set device to print
set print on
?chr(027)+chr(069)
@ 3,(80-len(LINE1))/2 say LINE1
@ 4,(80-len(LINE2))/2 say LINE2
@ 6,(80-len(LINE3))/2 say LINE3
row=10
select 5
set filter to FUND_NAME<>"CURRENT"
go top
DO while .not. eof()
FUND=FUND_NAME
select 4
sum amount for FUND_NAME=FUND .and. year(DATE_CONT)=PRNTYR to TOTFUND
@row, 5 say FUND
@row,25 say TOTFUND picture "999,999.99"
select 5
IF .not. eof()
skip
FUND=FUND_NAME
select 4
sum amount for FUND_NAME=FUND .and. year(DATE_CONT)=PRNTYR to TOTFUND
@row,40 say FUND
@row,60 say TOTFUND picture "999,999.99"
select 5
IF .not. eof()
skip
row = row+2
loop
ELSE
exit
ENDIF
ENDIF
ENDDO
row = row+2
select 4
sum amount for FUND_NAME="CURRENT" .and. year(DATE_CONT)=PRNTYR to TOTCURR
@row, 5 say "CURRENT: $"
@row,25 say TOTCURR picture "999,999.99"
sum amount for year(DATE_CONT)=PRNTYR to ALLTOT
@row,40 say "GRAND TOTAL: $"
@row,60 say ALLTOT picture "999,999.99"
eject
set print off
set device to screen
set console on
@ 3, 2 clear to 21,77
select 4
set filter to
go top
select 1
go top
* end procedure FUND_YTD
 
Chief0,

Normally I would put the control codes right after the set print on line. At that point the program has engaged the printer and it is ready to receive input. Just remember to set the codes back just before you set print off. The prg listed is printing out the YTD totals. The CHR(027) + CHR(069)is the PCL 5 reset command, to reset the printer. Also normally I would use ??, instead of ?, so as not to waste a line on the control codes. This isn't very efficient code, as the SUM command forces the program to scroll the dbf each time it is executed! May not make any difference today, the machines or so muck quicker than they were 15 years ago.


Jim C.

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top