compile function print_help()
begin condition
pre:
post:
end condition
Equ Note$ to 11
$insert logical
$insert msg_equates
$insert popup_equates
$insert appnote_equates
declare function set_printer, get_printer, msg, fieldcount, Printer_Select
declare subroutine rlist
$insert oiprint_equates
$insert rlist_equates
*
equ Windows$  to 1
equ Titles$   to 2
equ PrintIt$  to 3
equ BmpCnt$   to 4
equ Width$    to 5
equ Height$   to 6
equ BmpDos$   to 7
equ FootOvr$  to 8
equ BmpPath$  to 9

PrintConfigRec = xlate( 'CONFIG', 'PRINT_HELP_CONFIG', '', 'X' )
*Windows = PrintConfigRec<Windows$>
Titles  = PrintConfigRec<Titles$>
*PrintIt = PrintConfigRec<PrintIt$>
BmpPath = PrintConfigRec<BmpPath$>:'\'
*BmpCnt  = PrintConfigRec<BmpCnt$>
*Width   = PrintConfigRec<Width$>
*Height  = PrintConfigRec<Height$> 
*BmpDos  = PrintConfigRec<BmpDos$>
*FootOvr = PrintConfigRec<FootOvr$> 
* Sort by Titles
Tarray = ''
Parray = ''
Tcnt = fieldcount( Titles, @vm )
for i = 1 to Tcnt
    ThisTitle = Titles<1,i>
    locate ThisTitle in Tarray by 'AL' using @vm setting Tpos else
         Tarray = insert( Tarray, 1, Tpos, 0, ThisTitle )
         Parray = insert( Parray, 1, Tpos, 0, i )   
    end
next i
Windows = ''; Titles = ''; PrintIt = ''; BmpCnt = ''; Height = ''; Width = ''
BmpDos = ''; FootOvr = ''
for i = 1 to Tcnt
    Windows<1,i> = PrintConfigRec<Windows$,Parray<1,i>>
    Titles<1,i>  = PrintConfigRec<Titles$,Parray<1,i>>
    PrintIt<1,i> = PrintConfigRec<PrintIt$,Parray<1,i>>
    BmpCnt<1,i>  = PrintConfigRec<BmpCnt$,Parray<1,i>>
    Width<1,i>   = PrintConfigRec<Width$,Parray<1,i>>
    Height<1,i>  = PrintConfigRec<Height$,Parray<1,i>> 
    BmpDos<1,i>  = PrintConfigRec<BmpDos$,Parray<1,i>>
    FootOvr<1,i> = PrintConfigRec<FootOvr$,Parray<1,i>> 
next i
* temp code
*Windows = field( Windows, @vm, 36, 999 )
*Titles = field( Titles, @vm, 36, 999 )
*PrintIt = field( PrintIt, @vm, 36, 999 )
*BmpCnt = field( BmpCnt, @vm, 36, 999 )
*Width = field( Width, @vm, 36, 999 )
*Height = field( Height, @vm, 36, 999 )
*BmpDos = field( BmpDos, @vm, 36, 999 )
*FootOvr = field( FootOvr, @vm, 36, 999 )
* end temp code
if Windows else
    return 0
end
*debug
* printer initialization
PrintName = 'LSL System Manual':@fm:'Printing...'
Size = 8.5:@fm:11.0

PrintPath = Printer_Select('',1)	;* Get default printer path
Stat = set_printer( 'INIT', '', '', .75:@fm:1:@fm:.75:@fm:.75, 0,'',PrintPath )

if stat < 0 then goto FatalExit

* margins
*Margin = .75:@fm:1:@fm:.75:@fm:0.75
*convert ',' to @fm in Margin
*Stat = set_printer( 'MARGIN', Margin )
*if stat < 0 then goto FatalExit

* HeaderFont
Font = 'Times New Roman,18,T,1'
convert ',' to @fm in Font
Stat = set_printer( 'FONTHEADFOOT', Font )
if stat < 0 then goto FatalExit

* Font
Font<2> = '14'
Spacing = ''
Stat = set_printer( 'FONT', Font, Spacing )
if stat < 0 then goto FatalExit

* Header
Header = "LSL System Manual":fmt( '', 'L#60'):"Page 'P'"
*Header = "LSL System Manual":fmt( '', 'L#60'):"Page 241"
ColPos = 1.5
ColHead = ''
Stat = set_printer( 'HEADER', Header, ColPos, ColHead )
if stat < 0 then goto FatalExit

Wcnt = fieldcount( Windows, @vm )
PrintedOne = false$
for i = 1 to Wcnt
    if PrintIt<1,i> = 'Yes' then
	    if PrintedOne then
	        Stat = set_printer( 'PAGEBREAK' )
	        if Stat < 0 then goto FatalExit
	    end
	    PrintedOne  = true$   
	    ThisWindow  = Windows<1,i>
	    ThisBmpCnt  = BmpCnt<1,i>
	    ThisWidth   = Width<1,i>
	    ThisHeight  = Height<1,i> 
	    ThisBmpDos  = BmpDos<1,i>
	    ThisFootOvr = FootOvr<1,i> 
	    Ypos = get_printer( 'POS' )
	    if stat < 0 then goto FatalExit
	    ThisTitle  = Titles<1,i>
	    *Margin = '0.50,1,0.75,0.75'
	    *convert ',' to @fm in Margin
	    *Stat = set_printer( 'MARGIN', Margin )
	    *if stat < 0 then goto FatalExit
*this	    Font<2> = '17'
	    Font<6> = 1
	    Font<2> = 16
	    Spacing = ''
	    Stat = set_printer( 'FONT', Font, Spacing )
	    if stat < 0 then goto FatalExit
	    convert ';' to @fm in ThisFootOvr
	    for j = 1 to ThisBmpCnt 
	        FootOvrToUse = ThisFootOvr<j>
	        Tbmp = BmpPath:ThisBmpDos:j:'.BMP'
	        *void = msg( '', 'Width = ':ThisWidth:' Height = ':THisHeight )
            stat = set_printer( 'BMP', Tbmp, 0:@fm:.5:@fm:ThisWidth:@fm:ThisHeight, 0, 0 )
            *stat = set_printer( 'BMP', Tbmp, 0:@fm:Ypos:@fm:3:@fm:3, 0, 0 )            
          *** Print a bitmap at 1 inch from the top and 1 inch from the left side of the page.
          *** The left and top values are calculated from the margins.  The width and height of the
          *** bitmap will be 0.5 by 0.5 inches, and the bitmap will print on every page.
          *x = Set_Printer("BMP", "PRINTER.BMP", 0:@FM:-0.75:@FM:0.5:@FM:0.5, 0, 1)
	        if stat < 0 then goto FatalExit
	        Tfoot = ThisTitle
	        if FootOvrToUse then
	            Tfoot := ' ':FootOvrToUse
	        end else
	            if ThisBmpCnt > 1 then
	                Tfoot := ' Page ':j
	            end
	        end
            BamFont = 'Times New Roman,10,T,1'
            convert ',' to @fm in BamFont 
	        stat = set_printer( 'TEXTXY', Tfoot, .5:@fm:9, BamFont, 0 )
	        if stat < 0 then goto FatalExit
     	    stat = set_printer( 'PAGEBREAK' )
	        if stat < 0 then goto FatalExit
	    next j
  	    Stat = set_printer( 'TEXT', 'Help notes for the ':ThisTitle:' window' )
	    if Stat < 0 then goto FatalExit
	    *Margin = '0.75,1,0.75,0.75'
	    *convert ',' to @fm in Margin
	    *Stat = set_printer( 'MARGIN', Margin )
	    *if stat < 0 then goto FatalExit
	    if ThisWindow = 'QUOTE_SPEC_INFO' then
	        ThisWindow = 'QUOTE_SPEC' ;* made help notes quote_spec instead of
                                      * quote_spec_info dumb ass
	    end
	    if ThisWindow = 'QUOTE_SPEC_INFO2' then
	        ThisWindow = 'QUOTE_SPEC2'
	    end
	    if ThisWindow = 'ANNUAL_CONTRACTS' then
	        ThisWindow = 'AC'
	    end
	    if ThisWindow = 'ANNUAL_CONTRACTS_QUERY' then
	        ThisWindow = 'ACQ'
	    end
	    ValToSelect = quote( 'LSL2**':ThisWindow:'.]' )
		Stmt = 'SELECT SYSREPOSAPPNOTES ':ValToSelect:' BY @ID'
		rlist( Stmt, target_activelist$, '', '', '' )
		if @reccount then
		    Eof = false$
		    loop
		       readnext HelpId else Eof = true$
		     until Eof
		        HelpRec = xlate( 'SYSREPOSAPPNOTES', HelpId, '', 'X' )
		        NoteText = HelpRec<atext$>
		        Field    = HelpRec<atitle$>
		        Stat = set_printer( 'TEXT', '' )
		        if stat < 0 then goto FatalExit
	            Font<2> = '16'
	            Font<6> = 1
	            Spacing = ''
	            Stat = set_printer( 'FONT', Font, Spacing )
	            if stat < 0 then goto FatalExit	        
		        Stat = set_printer( 'TEXT', Field:':' )
	*this            Font<2> = '14'
	            Font<6> = 0
	            Font<4> = 0
	            Spacing = ''
	            Stat = set_printer( 'FONT', Font, Spacing )
	            if stat < 0 then goto FatalExit	        
		        *Margin = '2.25,1,0.75,0.75'
	            *convert ',' to @fm in Margin
	            *Stat = set_printer( 'MARGIN', Margin )
	            *if stat < 0 then goto FatalExit
	            swap @vm with @fm:fmt('', 'L#20') in NoteText
	            NoteText = fmt( '','L#20'):NoteText
		        *convert @vm to @fm in NoteText
		        Stat = set_printer( 'TEXT', NoteText )
		        if Stat < 0 then goto FatalExit
		        *Margin = '0.75,1,0.75,0.75'
	            *convert ',' to @fm in Margin
	            *Stat = set_printer( 'MARGIN', Margin )
	            *if stat < 0 then goto FatalExit
            	Font<4> = 1
            	Spacing = ''
	            Stat = set_printer( 'FONT', Font, Spacing )
		    repeat
		end
    end
*  IF PRINTEDONE THEN
*      I=WCNT
*  END
next i
Stat = set_printer( 'TERM' )
if Stat < 0 then goto FatalExit
return 0
*============================================================================*
FatalExit:
   *ErrorText = get_printer( 'ERRORTEXT' )
   Void = msg( '', Stat:' ':Tbmp )
   Stat = set_printer( 'TERM' )
*   Stat = msg( '', ErrorText )
return 0

*============================================================================*
