#
# requires UnForm 4.1 or higher
#
###############################################################################
# osas60.rul  rule file for standard Open Systems Accounting Software modules #
# Based upon OSAS 6.1.1 demo data                                             #
###############################################################################
# This rule file is provided "AS IS", without warranty. #
# Under no circumstances will the publisher be liable   #
# for consequential damages resulting from the use or   #
# inability to use the contents.                        #
#########################################################
#

# Last modified 03/07/2002

# 12/14/01 -bcj
# 		tested with version 5.0
# 		handled "UNAUDITED" in balance sheet
# 		fixed bad box in plain pick slip
# 03/07/2002 - bcj
#	changed company constants for more informative information

# Adjust the following constants to correct files and info
# if you use the subst file then replace each constant 
# with subst info in rule sets below
const COMP_NAME="Company Name: Edit rule file"
const COMP_ADDR1="Address 1"
const COMP_ADDR2="Address 2"
const COMP_ADDR3="Address 3"
const COMP_PHONES="###-###-####  Fax: ###-###-####"
const COMP_EMAIL="E-Mail: xxxx@xxxxxxxxxxxxxxx.com"
const COMP_WEBSITE="Website: www.xxxxxxxxxxxxxxx.com"

# Since there is no difference between picking & packing slips 
#for 8.5x11 and laser forms,
# Set the following variables to the correct title if either form used.
const PICKPACK_LASER_TITLE="PICKING LIST"
const PICKPACK_8.5X11_TITLE="PICKING LIST"

# How many AP or PR check stubs are required.
const AP_NO_STUBS=1	# 1=vendor stub, 2=vendor stub and payor stub
const PR_NO_STUBS=1	# 1=employee stub, 2=employee stub and employer stub

#####################################
# in the following constants, a # in front of the constant will 
# effectively remove the command from
# all applicable rule sets, while no # will make the command active
# eg. The following would make signature active
#	const SIGNATURE_IMAGE="image"
# eg. The following would make signature inactive
#	const SIGNATURE_IMAGE="#image" 
#####################################

# Logos
const LOGO_IMAGE="#image"
const COMP_LOGO="logo.pcl"

# check signature on AP/PR checks,
const SIGNATURE_IMAGE="#image" 
const SIGNATURE=""

# MICR code on AP checks, 
const AP_MICR_ACCOUNTNO=":123456789:9999-1234<34>"
const AP_MICR="#micr"

# MICR code on PR checks, 
const PR_MICR_ACCOUNTNO=":987654321:1111-9876<34>"
const PR_MICR="#micr"

# for faster processing, place a # in front of the constants below
# eg. Change const SO_INV_CFONT="cfont" to const SO_INV_CFONT="#cfont"
# for more professional looking documents remove the #
# eg. Change const SO_INV_CFONT="#cfont" to const SO_INV_CFONT="cfont"
const AR_STMT_FONT="font"
const AR_STMT_CFONT="cfont"
const PO_FONT="font"
const PO_CFONT="cfont"
const SO_INV_FONT="font"
const SO_INV_CFONT="cfont"
const SO_PICKPACK_FONT="font"
const SO_PICKPACK_CFONT="cfont"

# date mask for detects - 10/17/2001
const DATEMASK="[0-1][0-9]/[0-3][0-9]/[0-9][0-9]"		# American dates
#const DATEMASK="[0-3][0-9]/[0-1][0-9]/[0-9][0-9]"		# Canadian dates

############################
# Module: Accounts Payable #
############################

[AP Detailed Aged Trial Balance]
# Tested OK with 6.1.1 9/21/01 - bcj
detect 0,2,"Detail Aged Trial Balance"
detect 10,5," "

const MAXCOLS=135
const MAXRCOLS=133
const MAXROWS=66
const LEFTCOL=.5
cols MAXCOLS
rows MAXROWS
pcopies 1

prepage {
	rptdate$=trim(get(1,1,10))
	x=pos("  Page "=text$[1])
	compname$=trim(get(20,1,x-1-20))
	pageno$=trim(get(x,1,20))
	time$=trim(get(1,2,8))
	title$="A/P "+trim(get(20,2,150))
	opt1$=trim(get(20,3,150))
	opt2$=trim(get(20,4,150))
	opt3$=trim(get(20,5,150))
}

# header
const HFONT=univers,9,bold
const LEFTCOL=.5
cerase LEFTCOL,1,MAXCOLS,5
cbox LEFTCOL,.1,MAXCOLS,5.5,3,20
text 2,1,{rptdate$},HFONT
text 2,2,{time$},HFONT
text 1,1,{pageno$},HFONT,right,cols=MAXRCOLS
text 1,1.25,{compname$},univers,15,bold,center,cols=MAXCOLS
text 1,2.5,{title$},univers,12,bold,center,cols=MAXCOLS
text 1,3.5,{opt1$},HFONT,center,cols=MAXCOLS
text 1,4.35,{opt2$},HFONT,center,cols=MAXCOLS
text 1,5.35,{opt3$},HFONT,center,cols=MAXCOLS

# body
const HFONT=univers,9,italic
const DFONT=cgtimes,9,bold
const TFONT=cgtimes,10,bold
cerase 1,8,MAXCOLS,8
cbox LEFTCOL,6.5,MAXCOLS,7.5,1,10
cfont 1,7,9,7,HFONT
cfont 11,7,13,7,HFONT,center
cfont 15,7,24,7,HFONT,center
cfont 29,7,41,7,HFONT,right
cfont 44,7,56,7,HFONT,right
cfont 59,7,71,7,HFONT,right
cfont 74,7,86,7,HFONT,right
cfont 89,7,101,7,HFONT,right
cfont 104,7,117,7,HFONT,right
cfont 119,7,131,7,HFONT,right

# vendor heading
move "~[A-Za-z0-9]@1,9,1,MAXROWS",53,0,52,1,30,0
move "~[A-Za-z0-9]@1,9,1,MAXROWS",38,0,14,1,15,0
font "~[A-Za-z0-9]@1,9,1,MAXROWS",0,0,37,1,DFONT
font "~[A-Za-z0-9]@1,9,1,MAXROWS",53,0,14,1,DFONT
font "~[A-Za-z0-9]@1,9,1,MAXROWS",68,0,67,1,DFONT,right

# vendor total line
erase "~VENDOR .* TOTAL@2,9,20,MAXROWS",0,-1,MAXCOLS,1
box "~VENDOR .* TOTAL@2,9,20,MAXROWS",28,-1,102,1,5
font "~VENDOR .* TOTAL@2,9,20,MAXROWS",0,0,20,1,DFONT
font "~VENDOR .* TOTAL@2,9,20,MAXROWS",28,0,12,1,DFONT,right
font "~VENDOR .* TOTAL@2,9,20,MAXROWS",43,0,12,1,DFONT,right
font "~VENDOR .* TOTAL@2,9,20,MAXROWS",58,0,12,1,DFONT,right
font "~VENDOR .* TOTAL@2,9,20,MAXROWS",73,0,12,1,DFONT,right
font "~VENDOR .* TOTAL@2,9,20,MAXROWS",89,0,12,1,DFONT,right
font "~VENDOR .* TOTAL@2,9,20,MAXROWS",104,0,12,1,DFONT,right
font "~VENDOR .* TOTAL@2,9,20,MAXROWS",119,0,12,1,DFONT,right

# Grand totals line
erase "GRAND TOTAL",0,-1,MAXCOLS,1
box "GRAND TOTAL",-1,-1,MAXCOLS,2,1,10
font "GRAND TOTAL",0,0,20,1,TFONT
font "GRAND TOTAL",28,0,12,1,TFONT,right
font "GRAND TOTAL",43,0,12,1,TFONT,right
font "GRAND TOTAL",58,0,12,1,TFONT,right
font "GRAND TOTAL",73,0,12,1,TFONT,right
font "GRAND TOTAL",89,0,12,1,TFONT,right
font "GRAND TOTAL",104,0,12,1,TFONT,right
font "GRAND TOTAL",119,0,12,1,TFONT,right
font "End of Report",0,0,13,1,DFONT

[AP Summary Aged Trial Balance]
# Tested OK with 6.1.1 9/21/01 - bcj
detect 0,2,"Summary Aged Trial Balance"
detect 1,5," "

const MAXCOLS=135
const MAXRCOLS=133
const MAXROWS=66
const LEFTCOL=.5
cols MAXCOLS
rows MAXROWS
pcopies 1

prepage {
	rptdate$=trim(get(1,1,10))
	x=pos("  Page "=text$[1])
	compname$=trim(get(20,1,x-1-20))
	pageno$=trim(get(x,1,20))
	time$=trim(get(1,2,8))
	title$="A/P "+trim(get(20,2,150))
	opt1$=trim(get(20,3,150))
	opt2$=trim(get(20,4,150))
	opt3$=trim(get(20,5,150))
}

# header
const HFONT=univers,9,bold
cerase LEFTCOL,1,MAXCOLS,5
cbox LEFTCOL,.1,MAXCOLS,5.5,3,20
text 2,1,{RPTDATE$},HFONT
text 1,1.25,{compname$},univers,15,bold,center,cols=MAXCOLS
text 1,2.5,{title$},univers,12,bold,center,cols=MAXCOLS
text 1,1,{pageno$},HFONT,right,cols=MAXRCOLS
text 2,2,{time$},HFONT
text 1,3.5,{opt1$},HFONT,center,cols=MAXCOLS
text 1,4.35,{opt2$},HFONT,center,cols=MAXCOLS
text 1,5.35,{opt3$},HFONT,center,cols=MAXCOLS

# body
const HFONT=univers,9,italic
const DFONT=cgtimes,9,bold
const TFONT=cgtimes,10,bold
cerase 1,8,MAXCOLS,8
cbox LEFTCOL,6.5,MAXCOLS,7.5,1,10
cfont 1,7,6,7,HFONT
cfont 9,7,20,7,HFONT,center
cfont 29,7,41,7,HFONT,right
cfont 44,7,56,7,HFONT,right
cfont 59,7,71,7,HFONT,right
cfont 74,7,86,7,HFONT,right
cfont 89,7,101,7,HFONT,right
cfont 104,7,117,7,HFONT,right
cfont 119,7,131,7,HFONT,right

# vendor heading
move "~[A-Za-z0-9]@1,9,1,MAXROWS",53,0,52,1,30,0
move "~[A-Za-z0-9]@1,9,1,MAXROWS",38,0,14,1,15,0
font "~[A-Za-z0-9]@1,9,1,MAXROWS",0,0,37,1,DFONT
font "~[A-Za-z0-9]@1,9,1,MAXROWS",53,0,14,1,DFONT
font "~[A-Za-z0-9]@1,9,1,MAXROWS",68,0,67,1,DFONT,right

# Grand totals line
erase "GRAND TOTAL",0,-1,MAXCOLS,1
box "GRAND TOTAL",-1,-1,MAXCOLS,2,1,10
font "GRAND TOTAL",0,0,20,1,HFONT,bold
font "GRAND TOTAL",28,0,12,1,TFONT,right
font "GRAND TOTAL",43,0,12,1,TFONT,right
font "GRAND TOTAL",58,0,12,1,TFONT,right
font "GRAND TOTAL",73,0,12,1,TFONT,right
font "GRAND TOTAL",89,0,12,1,TFONT,right
font "GRAND TOTAL",104,0,12,1,TFONT,right
font "GRAND TOTAL",119,0,12,1,TFONT,right
font "End of Report",0,0,13,1,TFONT

[AP Check - laser]
# Tested OK with 6.1.1 9/21/01 - bcj
# Assumes company name heading printed on stub
detect 43,8,"~ [0-9][0-9][0-9][0-9][0-9][0-9][0-9]"
detect 51,8,"~ DATEMASK.."
detect 0,21,"Vendor No."
const MAXCOLS=81
const MAXRCOLS=80
const MAXROWS=66
cols MAXCOLS
page MAXROWS
rows MAXROWS

const ONE_STUB_COPY=1
const TWO_STUB_COPY=2
pcopies 2

prepage {
	chkno$=trim(get(43,8,8))
# move stubs to new positions
	for i=60 to 43 step -1
		text$[i]=text$[i-2]
		text$[i-2]=""
	next i
	for i=39 to 22 step -1
		text$[i]=text$[i-1]
		text$[i-1]=""
	next i
	if AP_NO_STUBS=1 then for i=42 to 66; text$[i]="";next i

}

precopy {
	if copy=ONE_STUB_COPY and copy<>AP_NO_STUBS then skip=1
	if copy=TWO_STUB_COPY and copy<>AP_NO_STUBS then skip=1
}

# Check
const SHFONT=univers,10,shade 0
const DFONT=cgtimes,12,bold
const HFONT=univers,10,italic
cbox LEFTCOL,1,MAXCOLS,20,4,10
LOGO_IMAGE 1,1,10,5,COMP_LOGO
text 15,2.25,"COMP_NAME",univers,15,bold
text 15,3.35,"COMP_ADDR1",univers,12
text 15,4.35,"COMP_ADDR2",univers,12

cmove 44,8,MAXCOLS,8,44,7
cbox 43,5.5,MAXCOLS,6.5,1,100
cbox 43,6.5,MAXCOLS,7.5
cbox 51,5.5,62,7.5
text 44,6,"Check #",SHFONT
cfont 44,7,50,7,DFONT
text 52,6,"Date",SHFONT,center,cols=10
cfont 52,7,61,7,DFONT,center,cols=10
text 63,6,"Amount",SHFONT,right,cols=18
cfont 63,7,80,7,DFONT,right

cfont 5,9,75,9,DFONT,italic

text 2,13,"Pay",HFONT
text 2,14,"to the",HFONT
text 2,15,"Order",HFONT
text 2,16,"of",HFONT
cmove 7,11,47,14,9,13
cfont 9,13,50,16,DFONT

SIGNATURE_IMAGE 50,15,0,0,SIGNATURE
box 50,17.25,30,1,3
text 50,18,"Authorized Signature",HFONT,center,cols=30
AP_MICR 10,18.75,"AP_MICR_ACCOUNTNO",{chkno$}

# Top stub - vendor's
cbox LEFTCOL,21,MAXCOLS,21
cbox 24,21.5,75,22.35,1,10
cbox 24,22.35,75,24
cbox 35,21.5,35,24
cbox 67,21.5,67,24
cfont 25,22,34,22,HFONT
cfont 36,22,66,22,HFONT
cfont 68,22,MAXCOLS,22,HFONT
cfont 25,23,34,23,DFONT
cfont 36,23,66,23,DFONT
cfont 68,23,MAXCOLS,23,DFONT

cbox LEFTCOL,24,MAXCOLS,25.5,1,10
cbox LEFTCOL,25.5,MAXCOLS,37.5
cbox 13,24,13,37.5
cbox 24,24,24,37.5
cbox 36,24,36,37.5
cbox 50,24,50,37.5
cbox 65,24,65,37.5
cfont 1,25,12,25,HFONT,center
cfont 14,25,23,25,HFONT
cfont 25,25,35,25,HFONT
cfont 37,25,49,25,HFONT,right
cfont 51,25,64,25,HFONT,right
cfont 66,25,79,25,HFONT,right
cfont 1,26,12,37,DFONT,center
cfont 14,26,23,37,DFONT
cfont 25,26,35,37,DFONT
cfont 37,26,49,37,DFONT,right
cfont 51,26,64,37,DFONT,right
cfont 66,26,79,37,DFONT,right

cbox LEFTCOL,37.5,MAXCOLS,38.5,1,100
cbox LEFTCOL,38.5,MAXCOLS,40
cbox 13,37.5,13,40
cbox 36,37.5,36,40
cbox 50,37.5,50,40
cbox 65,37.5,65,40
cfont 1,38,12,38,SHFONT,center
cfont 14,38,23,38,SHFONT
cfont 37,38,49,38,SHFONT,right
cfont 51,38,64,38,SHFONT,right
cfont 66,38,79,38,SHFONT,right
cfont 1,39,12,39,DFONT,center
cfont 14,39,23,39,DFONT
cfont 37,39,49,39,DFONT,right
cfont 51,39,64,39,DFONT,right
cfont 66,39,79,39,DFONT,right
text 1,41,"Vendor's Copy",DFONT,right,cols=MAXRCOLS

# bottom stub - Payor's
if copy TWO_STUB_COPY
	cbox LEFTCOL,42,MAXCOLS,42
	cbox 24,42.5,75,43.35,1,10
	cbox 24,43.35,75,45
	cbox 35,42.5,35,45
	cbox 67,42.5,67,45
	cfont 25,43,34,43,HFONT
	cfont 36,43,66,43,HFONT
	cfont 68,43,MAXCOLS,43,HFONT
	cfont 25,44,34,44,DFONT
	cfont 36,44,66,44,DFONT
	cfont 68,44,MAXCOLS,44,DFONT

	cbox LEFTCOL,45,MAXCOLS,46.5,1,10
	cbox LEFTCOL,46.5,MAXCOLS,58.5
	cbox 13,45,13,58.5
	cbox 24,45,24,58.5
	cbox 36,45,36,58.5
	cbox 50,45,50,58.5
	cbox 65,45,65,58.5
	cfont 1,46,12,46,HFONT,center
	cfont 14,46,23,46,HFONT
	cfont 25,46,35,46,HFONT
	cfont 37,46,49,46,HFONT,right
	cfont 51,46,64,46,HFONT,right
	cfont 66,46,79,46,HFONT,right
	cfont 1,47,12,58,DFONT,center
	cfont 14,47,23,58,DFONT
	cfont 25,47,35,58,DFONT
	cfont 37,47,49,58,DFONT,right
	cfont 51,47,64,58,DFONT,right
	cfont 66,47,79,58,DFONT,right

	cbox LEFTCOL,58.5,MAXCOLS,59.5,1,100
	cbox LEFTCOL,59.5,MAXCOLS,61
	cbox 13,58.5,13,61
	cbox 36,58.5,36,61
	cbox 50,58.5,50,61
	cbox 65,58.5,65,61
	cfont 1,59,12,59,SHFONT,center
	cfont 14,59,23,59,SHFONT
	cfont 37,59,49,59,SHFONT,right
	cfont 51,59,64,59,SHFONT,right
	cfont 66,59,79,59,SHFONT,right
	cfont 1,60,12,60,DFONT,center
	cfont 14,60,23,60,DFONT
	cfont 37,60,49,60,DFONT,right
	cfont 51,60,64,60,DFONT,right
	cfont 66,60,79,60,DFONT,right
	text 1,65,"Payor's Copy",DFONT,right,cols=MAXRCOLS
endif

[AP Check - blank stub]
# Tested OK with 6.1.1 9/21/01 - bcj
# Assumes company name heading printed on stub
detect 43,8,"~ DATEMASK.."
detect 54,8,"~ [0-9][0-9][0-9][0-9][0-9][0-9][0-9]"
detect 0,22,"Vendor No."
const MAXCOLS=81
const MAXRCOLS=80
const MAXROWS=66
cols MAXCOLS
page 42
rows MAXROWS

const ONE_STUB_COPY=1
const TWO_STUB_COPY=2
pcopies 2

prepage {
	chkno$=trim(get(54,8,8))
}

precopy {
	if copy=ONE_STUB_COPY and copy<>AP_NO_STUBS then skip=1
	if copy=TWO_STUB_COPY and copy<>AP_NO_STUBS then skip=1
}

# Check
const SHFONT=univers,10,shade 0
const DFONT=cgtimes,12,bold
const HFONT=univers,10,italic
cbox LEFTCOL,1,MAXCOLS,20,4,10
LOGO_IMAGE 1,1,10,5,COMP_LOGO
text 15,2.25,"COMP_NAME",univers,15,bold
text 15,3.35,"COMP_ADDR1",univers,12
text 15,4.35,"COMP_ADDR2",univers,12

cmove 44,8,MAXCOLS,8,44,7
cbox 43,5.5,MAXCOLS,6.5,1,100
cbox 43,6.5,MAXCOLS,7.5
cbox 54,5.5,62,7.5
text 55,6,"Check #",SHFONT
cfont 55,7,61,7,DFONT
text 44,6,"Date",SHFONT,center,cols=10
cfont 44,7,53,7,DFONT,center,cols=10
text 63,6,"Amount",SHFONT,right,cols=18
cfont 63,7,80,7,DFONT,right

cfont 1,9,MAXCOLS,9,DFONT,italic

text 2,13,"Pay",HFONT
text 2,14,"to the",HFONT
text 2,15,"Order",HFONT
text 2,16,"of",HFONT
cmove 7,12,47,15,9,13
cfont 9,13,50,16,DFONT

SIGNATURE_IMAGE 50,15,0,0,SIGNATURE
box 50,17.25,30,1,3
text 50,18,"Authorized Signature",HFONT,center,cols=30
AP_MICR 10,18.75,"AP_MICR_ACCOUNTNO",{chkno$}

# Middle stub - vendor's
cbox LEFTCOL,21,MAXCOLS,21
cbox 24,21.5,75,22.35,1,10
cbox 24,22.35,75,24
cbox 35,21.5,35,24
cbox 67,21.5,67,24
cfont 25,22,34,22,HFONT
cfont 36,22,66,22,HFONT
cfont 68,22,MAXCOLS,22,HFONT
cfont 25,23,34,23,DFONT
cfont 36,23,66,23,DFONT
cfont 68,23,MAXCOLS,23,DFONT

cbox LEFTCOL,24,MAXCOLS,25.5,1,10
cbox LEFTCOL,25.5,MAXCOLS,37.5
cbox 13,24,13,37.5
cbox 24,24,24,37.5
cbox 36,24,36,37.5
cbox 50,24,50,37.5
cbox 65,24,65,37.5
cfont 1,25,12,25,HFONT,center
cfont 14,25,23,25,HFONT
cfont 25,25,35,25,HFONT
cfont 37,25,49,25,HFONT,right
cfont 51,25,64,25,HFONT,right
cfont 66,25,79,25,HFONT,right
cfont 1,26,12,37,DFONT,center
cfont 14,26,23,37,DFONT
cfont 25,26,35,37,DFONT
cfont 37,26,49,37,DFONT,right
cfont 51,26,64,37,DFONT,right
cfont 66,26,79,37,DFONT,right

cbox LEFTCOL,37.5,MAXCOLS,38.5,1,100
cbox LEFTCOL,38.5,MAXCOLS,40
cbox 13,37.5,13,40
cbox 36,37.5,36,40
cbox 50,37.5,50,40
cbox 65,37.5,65,40
cfont 1,38,12,38,SHFONT,center
cfont 14,38,23,38,SHFONT
cfont 37,38,49,38,SHFONT,right
cfont 51,38,64,38,SHFONT,right
cfont 66,38,79,38,SHFONT,right
cfont 1,39,12,39,DFONT,center
cfont 14,39,23,39,DFONT
cfont 37,39,49,39,DFONT,right
cfont 51,39,64,39,DFONT,right
cfont 66,39,79,39,DFONT,right
text 1,41,"Vendor's Copy",DFONT,right,cols=MAXRCOLS

# bottom stub - Payor's
if copy TWO_STUB_COPY
	cmove 1,22,MAXCOLS,41,1,43,1
	cbox LEFTCOL,42,MAXCOLS,42
	cbox 24,42.5,75,43.35,1,10
	cbox 24,43.35,75,45
	cbox 35,42.5,35,45
	cbox 67,42.5,67,45
	cfont 25,43,34,43,HFONT
	cfont 36,43,66,43,HFONT
	cfont 68,43,MAXCOLS,43,HFONT
	cfont 25,44,34,44,DFONT
	cfont 36,44,66,44,DFONT
	cfont 68,44,MAXCOLS,44,DFONT

	cbox LEFTCOL,45,MAXCOLS,46.5,1,10
	cbox LEFTCOL,46.5,MAXCOLS,58.5
	cbox 13,45,13,58.5
	cbox 24,45,24,58.5
	cbox 36,45,36,58.5
	cbox 50,45,50,58.5
	cbox 65,45,65,58.5
	cfont 1,46,12,46,HFONT,center
	cfont 14,46,23,46,HFONT
	cfont 25,46,35,46,HFONT
	cfont 37,46,49,46,HFONT,right
	cfont 51,46,64,46,HFONT,right
	cfont 66,46,79,46,HFONT,right
	cfont 1,47,12,58,DFONT,center
	cfont 14,47,23,58,DFONT
	cfont 25,47,35,58,DFONT
	cfont 37,47,49,58,DFONT,right
	cfont 51,47,64,58,DFONT,right
	cfont 66,47,79,58,DFONT,right

	cbox LEFTCOL,58.5,MAXCOLS,59.5,1,100
	cbox LEFTCOL,59.5,MAXCOLS,61
	cbox 13,58.5,13,61
	cbox 36,58.5,36,61
	cbox 50,58.5,50,61
	cbox 65,58.5,65,61
	cfont 1,59,12,59,SHFONT,center
	cfont 14,59,23,59,SHFONT
	cfont 37,59,49,59,SHFONT,right
	cfont 51,59,64,59,SHFONT,right
	cfont 66,59,79,59,SHFONT,right
	cfont 1,60,12,60,DFONT,center
	cfont 14,60,23,60,DFONT
	cfont 37,60,49,60,DFONT,right
	cfont 51,60,64,60,DFONT,right
	cfont 66,60,79,60,DFONT,right
	text 1,65,"Payor's Copy",DFONT,right,cols=MAXRCOLS
endif

[AP Check - preprinted]
# Tested OK with 6.1.1 9/21/01 - bcj
detect 43,8,"~ DATEMASK.."
detect 54,8,"~ [0-9][0-9][0-9][0-9][0-9][0-9][0-9]"
detect 40,23,"     "
const MAXCOLS=81
const MAXRCOLS=80
const MAXROWS=66
cols MAXCOLS
page 42
rows MAXROWS

const ONE_STUB_COPY=1
const TWO_STUB_COPY=2
pcopies 2

prepage {
	chkno$=trim(get(54,8,8))
}

precopy {
	if copy=ONE_STUB_COPY and copy<>AP_NO_STUBS then skip=1
	if copy=TWO_STUB_COPY and copy<>AP_NO_STUBS then skip=1
}

# Check
const SHFONT=univers,10,shade 0
const DFONT=cgtimes,12,bold
const HFONT=univers,10,italic
cbox LEFTCOL,1,MAXCOLS,20,4,10
LOGO_IMAGE 1,1,10,5,COMP_LOGO
text 15,2.25,"COMP_NAME",univers,15,bold
text 15,3.35,"COMP_ADDR1",univers,12
text 15,4.35,"COMP_ADDR2",univers,12

cmove 44,8,MAXCOLS,8,44,7
cbox 43,5.5,MAXCOLS,6.5,1,100
cbox 43,6.5,MAXCOLS,7.5
cbox 54,5.5,62,7.5
text 55,6,"Check #",SHFONT
cfont 55,7,61,7,DFONT
text 44,6,"Date",SHFONT,center,cols=10
cfont 44,7,53,7,DFONT,center,cols=10
text 63,6,"Amount",SHFONT,right,cols=18
cfont 63,7,80,7,DFONT,right

cfont 1,9,MAXCOLS,9,DFONT,italic

text 2,13,"Pay",HFONT
text 2,14,"to the",HFONT
text 2,15,"Order",HFONT
text 2,16,"of",HFONT
cmove 7,12,47,15,9,13
cfont 9,13,50,16,DFONT

SIGNATURE_IMAGE 50,15,0,0,SIGNATURE
box 50,17.25,30,1,3
text 50,18,"Authorized Signature",HFONT,center,cols=30
AP_MICR 10,18.75,"AP_MICR_ACCOUNTNO",{chkno$}

# Middle stub - vendor's
cbox LEFTCOL,21,MAXCOLS,21
cbox 33,21.5,MAXCOLS,22.35,1,10
cbox 33,22.35,MAXCOLS,24
cbox 47,21.5,47,24
text 34,22,"Vendor No.",HFONT
text 48,22,"Vendor Name",HFONT
cfont 34,23,46,23,DFONT
cfont 48,23,MAXCOLS,23,DFONT

cbox LEFTCOL,24,MAXCOLS,25.5,1,10
cbox LEFTCOL,25.5,MAXCOLS,37.5
cbox 14,24,14,37.5
cbox 26,24,26,37.5
cbox 39,24,39,37.5
cbox 57,24,57,37.5
text 1,25,"Trans. Date",HFONT,center,cols=13
text 15,25,"Reference",HFONT
text 27,25,"Gross Amount",HFONT,right,cols=12
text 40,25,"Deduction",HFONT,right,cols=17
text 58,25,"Net Amount",HFONT,right,cols=16
cfont 1,26,13,37,DFONT,center
cfont 15,26,25,37,DFONT
cfont 27,26,38,37,DFONT,right
cfont 40,26,56,37,DFONT,right
cfont 58,26,73,37,DFONT,right

cbox LEFTCOL,37.5,MAXCOLS,38.5,1,100
cbox LEFTCOL,38.5,MAXCOLS,40
cbox 14,37.5,14,40
cbox 26,37.5,26,40
cbox 39,37.5,39,40
cbox 57,37.5,57,40
text 1,38,"Check Date",SHFONT,center,cols=13
text 15,38,"Check No.",SHFONT
text 27,38,"Total Gross",SHFONT,right,cols=12
text 40,38,"Total Ded.",SHFONT,right,cols=17
text 58,38,"Check Amount",SHFONT,right,cols=16
cfont 1,39,13,39,DFONT,center
cfont 15,39,25,39,DFONT
cfont 27,39,38,39,DFONT,right
cfont 40,39,56,39,DFONT,right
cfont 58,39,73,39,DFONT,right
text 1,41,"Vendor's Copy",DFONT,right,cols=MAXRCOLS

# bottom stub - Payor's
if copy TWO_STUB_COPY
	cmove 1,22,MAXCOLS,41,1,43,1
	cbox LEFTCOL,42,MAXCOLS,42
	cbox 33,42.5,MAXCOLS,43.35,1,10
	cbox 33,43.35,MAXCOLS,45
	cbox 47,42.5,47,45
	text 34,43,"Vendor No.",HFONT
	text 48,43,"Vendor Name",HFONT
	cfont 34,44,46,44,DFONT
	cfont 48,44,MAXCOLS,44,DFONT

	cbox LEFTCOL,45,MAXCOLS,46.5,1,10
	cbox LEFTCOL,46.5,MAXCOLS,58.5
	cbox 14,45,14,58.5
	cbox 26,45,26,58.5
	cbox 39,45,39,58.5
	cbox 57,45,57,58.5
	text 1,46,"Trans. Date",HFONT,center,cols=13
	text 15,46,"Reference",HFONT
	text 27,46,"Gross Amount",HFONT,right,cols=12
	text 40,46,"Deduction",HFONT,right,cols=17
	text 58,46,"Net Amount",HFONT,right,cols=16
	cfont 1,47,13,58,DFONT,center
	cfont 15,47,25,58,DFONT
	cfont 27,47,38,58,DFONT,right
	cfont 40,47,56,58,DFONT,right
	cfont 58,47,73,58,DFONT,right

	cbox LEFTCOL,58.5,MAXCOLS,59.5,1,100
	cbox LEFTCOL,59.5,MAXCOLS,61
	cbox 14,58.5,14,61
	cbox 26,58.5,26,61
	cbox 39,58.5,39,61
	cbox 57,58.5,57,61
	text 1,59,"Check Date",SHFONT,center,cols=13
	text 15,59,"Check No.",SHFONT
	text 27,59,"Total Gross",SHFONT,right,cols=12
	text 40,59,"Total Ded.",SHFONT,right,cols=17
	text 58,59,"Check Amount",SHFONT,right,cols=16
	cfont 1,60,12,60,DFONT,center
	cfont 15,60,25,60,DFONT
	cfont 27,60,38,60,DFONT,right
	cfont 40,60,56,60,DFONT,right
	cfont 58,60,73,60,DFONT,right
	text 1,65,"Payor's Copy",DFONT,right,cols=MAXRCOLS
endif

###############################
# Module: Accounts Receivable #
###############################

[AR Detailed Aged Trial Balance]
# Tested OK with 6.1.1 9/21/01 - bcj
detect 0,2,"Detail Accounts Receivable Aged Trial Balance"

const MAXCOLS=132
const MAXRCOLS=131
const MAXROWS=66
const LEFTCOL=.5
cols MAXCOLS
rows MAXROWS
pcopies 1

prepage {
	rptdate$=trim(get(1,1,10))
	x=pos("  Page "=text$[1])
	compname$=trim(get(20,1,x-1-20))
	pageno$=trim(get(x,1,20))
	time$=trim(get(1,2,8))
	title$=trim(get(20,2,150))
	opt1$=trim(get(20,3,150))
	opt2$=trim(get(20,4,150))
}

# header
const HFONT=univers,9,bold
const LEFTCOL=.5
cerase LEFTCOL,1,MAXCOLS,4
cbox LEFTCOL,.2,MAXCOLS,4,3,20
text 2,1,{RPTDATE$},HFONT
text 1,1.25,{compname$},univers,15,bold,center,cols=MAXCOLS
text 1,2.5,{title$},univers,12,bold,center,cols=MAXCOLS
text 1,1,{pageno$},HFONT,right,cols=MAXRCOLS
text 2,2,{time$},HFONT
text 1,3.5,{opt1$},HFONT,center,cols=MAXCOLS
text 1,4.35,{opt2$},HFONT,center,cols=MAXCOLS

# body
const HFONT=univers,9,italic
const DFONT=cgtimes,9,bold
const TFONT=cgtimes,10,bold
cerase 1,7,MAXCOLS,7
cbox LEFTCOL,4.5,MAXCOLS,6.5,1,10
cfont 10,5,12,5,HFONT,center
cfont 1,6,9,6,HFONT
cfont 10,6,12,6,HFONT,center
cfont 14,6,21,6,HFONT,center
cfont 24,6,35,6,HFONT,right
cfont 40,6,51,6,HFONT,right
cfont 56,6,67,6,HFONT,right
cfont 72,6,83,6,HFONT,right
cfont 88,6,99,6,HFONT,right
cfont 104,6,115,6,HFONT,right
cfont 120,6,131,6,HFONT,right

# customer heading
move "~[0-9][0-9][0-9]-@40,8,50,MAXROWS",-5,0,35,1,10,0
font "~[0-9][0-9][0-9]-@50,8,60,MAXROWS",-55,0,37,1,DFONT
font "~[0-9][0-9][0-9]-@50,8,60,MAXROWS",-5,0,35,1,DFONT,center
font "~[0-9][0-9][0-9]-@50,8,60,MAXROWS",34,0,40,1,DFONT,right

# customer total line
erase "~Cust .* TOTAL@1,9,20,MAXROWS",0,-1,MAXCOLS,1
box "~Cust .* TOTAL@1,9,20,MAXROWS",21,-1,110,1,5
font "~Cust .* TOTAL@1,9,20,MAXROWS",0,0,20,1,DFONT
font "~Cust .* TOTAL@1,9,20,MAXROWS",23,0,12,1,DFONT,right
font "~Cust .* TOTAL@1,9,20,MAXROWS",39,0,12,1,DFONT,right
font "~Cust .* TOTAL@1,9,20,MAXROWS",55,0,12,1,DFONT,right
font "~Cust .* TOTAL@1,9,20,MAXROWS",71,0,12,1,DFONT,right
font "~Cust .* TOTAL@1,9,20,MAXROWS",87,0,12,1,DFONT,right
font "~Cust .* TOTAL@1,9,20,MAXROWS",103,0,12,1,DFONT,right
font "~Cust .* TOTAL@1,9,20,MAXROWS",119,0,12,1,DFONT,right

# Grand totals line
erase "GRAND TOTAL",0,-1,MAXCOLS,1
box "GRAND TOTAL",-1,-1,MAXCOLS,2,1,10
font "GRAND TOTAL",0,0,20,1,HFONT,bold
font "GRAND TOTAL",23,0,12,1,TFONT,right
font "GRAND TOTAL",39,0,12,1,TFONT,right
font "GRAND TOTAL",55,0,12,1,TFONT,right
font "GRAND TOTAL",71,0,12,1,TFONT,right
font "GRAND TOTAL",87,0,12,1,TFONT,right
font "GRAND TOTAL",103,0,12,1,TFONT,right
font "GRAND TOTAL",119,0,12,1,TFONT,right
font "End of Report",0,0,13,1,DFONT

[AR Summary Aged Trial Balance]
# Tested OK with 6.1.1 9/21/01 - bcj
detect 0,2,"Summary Accounts Receivable Aged Trial Balance"

const MAXCOLS=132
const MAXRCOLS=131
const MAXROWS=66
const LEFTCOL=.5
cols MAXCOLS
rows MAXROWS
pcopies 1

prepage {
	rptdate$=trim(get(1,1,10))
	x=pos("  Page "=text$[1])
	compname$=trim(get(20,1,x-1-20))
	pageno$=trim(get(x,1,20))
	time$=trim(get(1,2,8))
	title$=trim(get(20,2,150))
	opt1$=trim(get(20,3,150))
	opt2$=trim(get(20,4,150))
}

# header
const HFONT=univers,9,bold
const LEFTCOL=.5
cerase LEFTCOL,1,MAXCOLS,4
cbox LEFTCOL,.2,MAXCOLS,4,3,20
text 2,1,{RPTDATE$},HFONT
text 1,1.25,{compname$},univers,15,bold,center,cols=MAXCOLS
text 1,2.5,{title$},univers,12,bold,center,cols=MAXCOLS
text 1,1,{pageno$},HFONT,right,cols=MAXRCOLS
text 2,2,{time$},HFONT
text 1,3.5,{opt1$},HFONT,center,cols=MAXCOLS
text 1,4.35,{opt2$},HFONT,center,cols=MAXCOLS

# body
const HFONT=univers,9,italic
const DFONT=cgtimes,10,bold
cerase 1,7,MAXCOLS,7
cbox LEFTCOL,4.5,MAXCOLS,6.5,1,10
cfont 1,5,8,5,HFONT
cfont 24,5,26,5,HFONT,center
cfont 1,6,4,6,HFONT
cfont 10,6,14,6,HFONT,center
cfont 24,6,26,6,HFONT,center
cfont 29,6,32,6,HFONT
cfont 36,6,47,6,HFONT,right
cfont 50,6,61,6,HFONT,right
cfont 64,6,75,6,HFONT,right
cfont 78,6,99,6,HFONT,right
cfont 92,6,103,6,HFONT,right
cfont 106,6,117,6,HFONT,right
cfont 120,6,131,6,HFONT,right

# customer Name
font "~[0-9][0-9][0-9]-@10,8,20,MAXROWS",-14,1,40,1,DFONT

# customer total line
#bold "~[0-9][0-9][0-9]-@10,8,20,MAXROWS",-14,0,MAXCOLS,1

# Grand totals line
erase "GRAND TOTAL",0,-1,MAXCOLS,1
box "GRAND TOTAL",-1,-1,MAXCOLS,2,1,10
font "GRAND TOTAL",0,0,20,1,HFONT,bold
font "GRAND TOTAL",35,0,12,1,DFONT,right
font "GRAND TOTAL",49,0,12,1,DFONT,right
font "GRAND TOTAL",63,0,12,1,DFONT,right
font "GRAND TOTAL",77,0,12,1,DFONT,right
font "GRAND TOTAL",91,0,12,1,DFONT,right
font "GRAND TOTAL",105,0,12,1,DFONT,right
font "GRAND TOTAL",119,0,12,1,DFONT,right
font "End of Report",0,0,13,1,DFONT

[AR Statement totals]
# Tested OK with 6.1.1 9/21/01 - bcj
# added 9/21/01
detect 0,0,"TOTALS:"
detect 0,0,"NUMBER PRINTED"
detect 0,0,"FINANCE CHARGES"
const MAXCOLS=80
const MAXRCOLS=78
const LEFTCOL=.5
const MAXROWS=66
cols=MAXCOLS
rows=MAXROWS

pcopies 1

# form title area
cbox 26,3,55,5,3,20
text 30,4.25,"Statement Totals",univers,18,bold,center,cols=21

# totals
const HFONT=univers,12,italic
const DFONT=cgtimes,12,bold
font "TOTALS:",-2,0,38,1,HFONT,14,bold

font "TOTALS:",-1,2,50,1,HFONT

font "NUMBER PRINTED",0,0,14,1,HFONT
font "NUMBER PRINTED",16,0,6,1,DFONT,right

font "TOTAL DUE",0,0,9,1,HFONT,bold
font "TOTAL DUE",11,0,15,5,HFONT
font "TOTAL DUE",27,0,15,5,DFONT,right

font "PREVIOUS FINANCE CHARGES",0,0,24,1,HFONT
font "PREVIOUS FINANCE CHARGES",27,0,15,1,DFONT,right

font "NEW FINANCE CHARGES",0,0,24,1,HFONT
font "NEW FINANCE CHARGES",27,0,15,1,DFONT,right

font "TOTAL  ",0,0,24,1,HFONT,14,bold
font "TOTAL  ",27,0,15,1,DFONT,right,14


[AR Statement - 8.5x11]
# Tested OK with 6.1.1 9/21/01 - bcj
# 8.5x11 statement has bug on multiple statements - an extra line is
# added after the first page!!!  Therefore, the funky prepage logic.
# added e-mail and web site - 07/23/01
detect 0,7,"~ DATEMASK"
detect 0,13,"~\.[0-9][0-9]"

const MAXCOLS=80
const MAXRCOLS=78
const MAXROWS=66
const LEFTCOL=.5
cols MAXCOLS
page MAXROWS
rows MAXROWS

const CUSTOMER_COPY=1
const FILE_COPY=2
pcopies 2

prepage {
	page=page+1
	if page>1 then \
		for i=2 to MAXROWS; \
			text$[i-1]=text$[i]; text$[i]=""; \
		next i
	date$=trim(get(50,7,10))
	cust_code$=trim(get(61,7,7))
	pageno$=trim(get(69,7,4))
}

# Top section
const HFONT=univers,10,italic
const DFONT=cgtimes,10,bold
const SHADE=10
cerase 1,1,MAXCOLS,7
LOGO_IMAGE 1,1,10,6,COMP_LOGO
text 1,2.25,"STATEMENT",univers,18,bold,right,cols=MAXRCOLS
text 1,2.25,"COMP_NAME",univers,15,bold,center,cols=MAXRCOLS
text 1,3.35,"COMP_ADDR1",univers,12,center,cols=MAXRCOLS
text 1,4.35,"COMP_ADDR2",univers,12,center,cols=MAXRCOLS
text 1,5.35,"COMP_PHONES",univers,12,center,cols=MAXRCOLS
text 1,6.25,"COMP_EMAIL",univers,10,center,cols=MAXRCOLS
text 1,7.25,"COMP_WEBSITE",univers,10,center,cols=MAXRCOLS

# upper right block
cbox 60,4,MAXCOLS,6,1,10
cbox 60,6,MAXCOLS,8
cbox 68,4,68,8
cbox 74,4,74,8
text 61,5,"Date",HFONT,center,cols=7
text 61,7,{date$},DFONT,center,cols=7
text 69,5,"Account",HFONT
text 69,7,{cust_code$},DFONT
text 75,5,"Page",HFONT
text 75,7,{pageno$},DFONT

# address & balance info
cbox LEFTCOL,8,MAXCOLS,9.5,1,10
cbox LEFTCOL,9.5,MAXCOLS,20
text 1,9,"Customer",HFONT
cfont 1,10,49,19,DFONT
text 51,13,"Amount Due",HFONT,bold
cfont 70,13,79,13,DFONT,right
text 51,15,"Terms",HFONT
cfont 66,15,79,15,DFONT,right

# line item detail
cbox LEFTCOL,20,MAXCOLS,21.5,1,10
cbox LEFTCOL,21.5,MAXCOLS,51
cbox 12,20,12,51
cbox 23,20,23,51
cbox 27,20,27,51
cbox 38,20,38,51
cbox 51,20,51,51
cbox 64,20,64,51
text 1,21,"Invoice Date",HFONT,center,cols=12
text 14,21,"Invoice No",HFONT
text 24,21,"Type",HFONT
text 28,21,"Check No",HFONT
text 39,21,"Charges",HFONT,right,cols=12
text 52,21,"Credits",HFONT,right,cols=12
text 65,21,"Balance",HFONT,right,cols=15
AR_STMT_CFONT 1,20,11,50,DFONT,center
AR_STMT_CFONT 13,20,22,50,DFONT
AR_STMT_CFONT 24,20,26,50,DFONT,center
AR_STMT_CFONT 28,20,37,50,DFONT
AR_STMT_CFONT 39,20,50,50,DFONT,right
AR_STMT_CFONT 52,20,63,50,DFONT,right
AR_STMT_CFONT 65,20,79,50,DFONT,right

# Messages
cbox LEFTCOL,51,MAXCOLS,58
cfont 1,52,MAXCOLS,57,DFONT

# aging table
cbox LEFTCOL,58,MAXCOLS,59.5,1,10
cbox LEFTCOL,59.5,MAXCOLS,61
box 14,58,1,3
box 27,58,1,3
box 40,58,1,3
box 53,58,1,3
box 66,58,1,3
text 1,59,"Current",HFONT,right,cols=13
text 15,59,"31-60 Days",HFONT,right,cols=12
text 28,59,"61-90 Days",HFONT,right,cols=12
text 41,59,"Over 90 Days",HFONT,right,cols=12
text 54,59,"Finance Charge",HFONT,right,cols=12
text 67,59,"Amount Due",HFONT,bold,right,cols=13
cfont 1,60,13,60,DFONT,right
cfont 15,60,26,60,DFONT,right
cfont 28,60,39,60,DFONT,right
cfont 41,60,52,60,DFONT,right
cfont 54,60,65,60,DFONT,right
cfont 67,60,79,60,DFONT,right
if copy CUSTOMER_COPY
	text 1,65,"Customer Copy",univers,12,bold,center,cols=MAXCOLS
endif
if copy FILE_COPY
	text 1,65,"Accounting Copy",univers,12,bold,center,cols=MAXCOLS
endif

[AR Statement - laser]
# Tested OK with 6.1.1 9/21/01 - bcj
# added e-mail and web site - 07/23/01
detect 0,6,"~ DATEMASK  [A-Za-z0-9]"
detect 0,13,"~\.[0-9][0-9]"

const MAXCOLS=80
const MAXRCOLS=78
const MAXROWS=66
const LEFTCOL=.5
cols MAXCOLS
page MAXROWS
rows MAXROWS

const CUSTOMER_COPY=1
const FILE_COPY=2
pcopies 2

prepage {
	pageno$=trim(get(60,5,15))
	date$=trim(get(60,6,15))
	cust_code$=trim(get(60,7,15))
}

# Top section
const HFONT=univers,10,italic
const DFONT=cgtimes,10,bold
const SHADE=10
cerase 1,1,MAXCOLS,7
LOGO_IMAGE 1,1,10,6,COMP_LOGO
text 1,2.25,"STATEMENT",univers,18,bold,right,cols=MAXRCOLS
text 1,2.25,"COMP_NAME",univers,15,bold,center,cols=MAXRCOLS
text 1,3.35,"COMP_ADDR1",univers,12,center,cols=MAXRCOLS
text 1,4.35,"COMP_ADDR2",univers,12,center,cols=MAXRCOLS
text 1,5.35,"COMP_PHONES",univers,12,center,cols=MAXRCOLS
text 1,6.25,"COMP_EMAIL",univers,10,center,cols=MAXRCOLS
text 1,7.25,"COMP_WEBSITE",univers,10,center,cols=MAXRCOLS

# upper right block
cbox 60,4,MAXCOLS,6,1,10
cbox 60,6,MAXCOLS,8
cbox 68,4,68,8
cbox 74,4,74,8
text 61,5,"Date",HFONT,center,cols=7
text 61,7,{date$},DFONT,center,cols=7
text 69,5,"Account",HFONT
text 69,7,{cust_code$},DFONT
text 75,5,"Page",HFONT
text 75,7,{pageno$},DFONT

# address & balance info
cbox LEFTCOL,8,MAXCOLS,9.5,1,10
cbox LEFTCOL,9.5,MAXCOLS,19
text 1,9,"Customer",HFONT
cfont 1,10,49,18,DFONT
text 51,13,"Amount Due",HFONT,bold
cfont 70,13,79,13,DFONT,right
text 51,15,"Terms",HFONT
cfont 66,15,79,15,DFONT,right

# line item detail
cbox LEFTCOL,19,MAXCOLS,20.5,1,10
cbox LEFTCOL,20.5,MAXCOLS,53
cbox 11,19,11,53
cbox 24,19,24,53
cbox 28,19,28,53
cbox 41,19,41,53
cbox 54,19,54,53
cbox 67,19,67,53
text 1,20,"Invoice Date",HFONT,center,cols=10
text 12,20,"Invoice No",HFONT
text 25,20,"Type",HFONT
text 29,20,"Check No",HFONT
text 42,20,"Charges",HFONT,right,cols=12
text 55,20,"Credits",HFONT,right,cols=12
text 68,20,"Balance",HFONT,right,cols=12
AR_STMT_CFONT 1,21,10,52,DFONT,center
AR_STMT_CFONT 12,21,22,52,DFONT
AR_STMT_CFONT 25,21,27,52,DFONT,center
AR_STMT_CFONT 29,21,40,52,DFONT
AR_STMT_CFONT 42,21,53,52,DFONT,right
AR_STMT_CFONT 55,21,66,52,DFONT,right
AR_STMT_CFONT 68,21,79,52,DFONT,right

# Messages
cbox LEFTCOL,53,MAXCOLS,58
cfont 1,54,MAXCOLS,57,DFONT

# aging table
cbox LEFTCOL,58,MAXCOLS,59.5,1
cbox LEFTCOL,59.5,MAXCOLS,61,1,10
box 14,58,1,3
box 27,58,1,3
box 40,58,1,3
box 53,58,1,3
box 66,58,1,3
text 1,60,"Current",HFONT,right,cols=13
text 15,60,"31-60 Days",HFONT,right,cols=12
text 28,60,"61-90 Days",HFONT,right,cols=12
text 41,60,"Over 90 Days",HFONT,right,cols=12
text 54,60,"Finance Charge",HFONT,right,cols=12
text 67,60,"Amount Due",HFONT,bold,right,cols=13
cfont 1,59,13,60,DFONT,right
cfont 15,59,26,60,DFONT,right
cfont 28,59,39,60,DFONT,right
cfont 41,59,52,60,DFONT,right
cfont 54,59,65,60,DFONT,right
cfont 67,59,79,60,DFONT,right
if copy CUSTOMER_COPY
	text 1,65,"Customer Copy",univers,12,bold,center,cols=MAXCOLS
endif
if copy FILE_COPY
	text 1,65,"Accounting Copy",univers,12,bold,center,cols=MAXCOLS
endif

[AR Statement - std]
# Tested OK with 6.1.1 9/21/01 - bcj
# This format has "tearoff stub", replaced by remittance copy
# added e-mail and web site - 7/23/01
detect 60,6,"~DATEMASK"
detect 88,6,"~DATEMASK"

const MAXCOLS=80
const MAXRCOLS=78
const MAXROWS=66
const LEFTCOL=.5
cols MAXCOLS
page MAXROWS
rows MAXROWS

const CUSTOMER_COPY=1
const REMITTANCE_COPY=2
const FILE_COPY=3
pcopies 3

prepage {
	date$=trim(get(50,6,10))
	cust_code$=trim(get(47,6,7))
	pageno$=trim(get(60,1,7))
	x$=set(1,16,97,"")
	if trim(get(60,55,20))<>"" then \
		payby_date$="To avoid additional finance charges, pay by " \
				+trim(get(60,55,20))
	for i=MAXROWS to 6 step -1
		text$[i]=text$[i-5]
		text$[i-5]=""
	next i		
	remit$="Remittance Copy - Please return with payment"
}

# Top section
const HFONT=univers,10,italic
const DFONT=cgtimes,10,bold
const SHADE=10
cerase 1,1,100,11
LOGO_IMAGE 1,1,10,6,COMP_LOGO
text 1,2.25,"STATEMENT",univers,18,bold,right,cols=MAXRCOLS
text 1,2.25,"COMP_NAME",univers,15,bold,center,cols=MAXRCOLS
text 1,3.35,"COMP_ADDR1",univers,12,center,cols=MAXRCOLS
text 1,4.35,"COMP_ADDR2",univers,12,center,cols=MAXRCOLS
text 1,5.35,"COMP_PHONES",univers,12,center,cols=MAXRCOLS
text 1,6.25,"COMP_EMAIL",univers,10,center,cols=MAXRCOLS
text 1,7.25,"COMP_WEBSITE",univers,10,center,cols=MAXRCOLS

# upper right block
cbox 60,4,MAXCOLS,6,1,10
cbox 60,6,MAXCOLS,8
cbox 68,4,68,8
cbox 74,4,74,8
text 61,5,"Date",HFONT,center,cols=7
text 61,7,{date$},DFONT,center,cols=7
text 69,5,"Account",HFONT
text 69,7,{cust_code$},DFONT
text 75,5,"Page",HFONT
text 75,7,{pageno$},DFONT

# address & balance info
cerase 75,11,97,51
cbox LEFTCOL,8,MAXCOLS,9.5,1,10
cbox LEFTCOL,9.5,MAXCOLS,20
text 1,9,"Customer",HFONT
cfont 1,10,49,19,DFONT
text 65,14,"Terms",HFONT
cfont 47,14,79,14,DFONT,right

# line item detail
cbox LEFTCOL,20,MAXCOLS,21.5,1,10
cbox LEFTCOL,21.5,MAXCOLS,51
cbox 11,20,11,51
cbox 21,20,21,51
cbox 25,20,25,51
cbox 35,20,35,51
cbox 48,20,48,51
cbox 59,20,59,51
text 1,21,"Invoice Date",HFONT,center,cols=10
text 12,21,"Invoice No",HFONT
text 22,21,"Type",HFONT
text 26,21,"Check No",HFONT
text 36,21,"Charges",HFONT,right,cols=12
text 49,21,"Credits",HFONT,right,cols=10
text 60,21,"Balance",HFONT,right,cols=20
AR_STMT_CFONT 1,20,10,50,DFONT,center
AR_STMT_CFONT 12,20,20,50,DFONT
AR_STMT_CFONT 22,20,24,50,DFONT,center
AR_STMT_CFONT 26,20,34,50,DFONT
AR_STMT_CFONT 36,20,47,50,DFONT,right
AR_STMT_CFONT 49,20,58,50,DFONT,right
AR_STMT_CFONT 60,20,79,50,DFONT,right

# Messages
cbox LEFTCOL,51,MAXCOLS,57
cfont 1,52,MAXCOLS,56,DFONT

# aging table
cerase 75,58,97,58
cerase 1,59,97,MAXROWS
cbox LEFTCOL,57,MAXCOLS,58.5
cbox LEFTCOL,58.5,MAXCOLS,60,1,10
box 10.5,57,1,3
box 21.5,57,1,3
box 31.5,57,1,3
box 41.5,57,1,3
box 51.5,57,1,3
box 62.5,57,1,3
text 1,59,"Unpaid F/C",HFONT,right,cols=9
text 11,59,"Current",HFONT,right,cols=10
text 22,59,"31-60 Days",HFONT,right,cols=9
text 32,59,"61-90 Days",HFONT,right,cols=9
text 42,59,"Over 90 Days",HFONT,right,cols=9
text 52,59,"New F/C",HFONT,right,cols=10
text 63,59,"Amount Due",HFONT,bold,right,cols=17
cfont 1,58,9,58,DFONT,right
cfont 11,58,20,58,DFONT,right
cfont 22,58,30,58,DFONT,right
cfont 32,58,40,58,DFONT,right
cfont 42,58,50,58,DFONT,right
cfont 52,58,61,58,DFONT,right
cfont 63,58,79,58,DFONT,right
text 1,63,{payby_date$},HFONT
if copy CUSTOMER_COPY
	text 1,65,"Customer Copy",univers,12,bold,center,cols=MAXCOLS
endif
if copy REMITTANCE_COPY
	text 1,65,{remit$},univers,12,bold,center,cols=MAXCOLS
endif
if copy FILE_COPY
	text 1,65,"Accounting Copy",univers,12,bold,center,cols=MAXCOLS
endif

[AR Statement - plain]
# Tested OK with 6.1.1 9/21/01 - bcj
# 10/17/00 - modified to handle fonting of PO NUM detail lines
# added e-mail and web site - 07/23/01
detect 60,9,"~DATEMASK"

const MAXCOLS=80
const MAXRCOLS=78
const MAXROWS=66
const LEFTCOL=.5
cols MAXCOLS
page MAXROWS
rows MAXROWS

const CUSTOMER_COPY=1
const FILE_COPY=2
pcopies 2

prepage {
	if trim(get(1,3,40))<>"" then \
			comp_name$=trim(get(1,3,40)); \
			comp_addr1$=trim(get(1,4,40)); \
			comp_addr2$=trim(get(1,5,40)); \
			comp_phones$="" \
		else \
			comp_name$="COMP_NAME";\
			comp_addr1$="COMP_ADDR1";\
			comp_addr2$="COMP_ADDR2";\
			comp_phones$="COMP_PHONES"
	pageno$=trim(get(60,3,7))
	if trim(get(46,57,20))<>"" then \
		payby_date$="To avoid additional finance charges, pay by " \
				+trim(get(46,57,20))
	for i=MAXROWS to 4 step -1
		text$[i]=text$[i-3]
		text$[i-3]=""
	next i		
}

# Top section
const HFONT=univers,10,italic
const DFONT=cgtimes,10,bold
const SHADE=10
LOGO_IMAGE 1,1,10,6,COMP_LOGO
text 1,2.25,"STATEMENT",univers,18,bold,right,cols=MAXRCOLS
text 1,2.25,{comp_name$},univers,15,bold,center,cols=MAXRCOLS
text 1,3.35,{comp_addr1$},univers,12,center,cols=MAXRCOLS
text 1,4.35,{comp_addr2$},univers,12,center,cols=MAXRCOLS
text 1,5.35,{comp_phones$},univers,12,center,cols=MAXRCOLS
text 1,6.25,"COMP_EMAIL",univers,10,center,cols=MAXRCOLS
text 1,7.25,"COMP_WEBSITE",univers,10,center,cols=MAXRCOLS

# upper right block
cerase 1,1,MAXCOLS,9
cbox 44,9.5,MAXCOLS,11.5,1,10
cbox 44,11.5,MAXCOLS,13
cbox 58,9.5,58,13
cbox 71,9.5,71,13
cfont 45,11,57,11,HFONT,center
cfont 45,12,57,12,DFONT,center
cfont 59,10,70,11,HFONT,center
cfont 59,12,70,12,DFONT,center
text 72,11,"Page",HFONT
text 72,12,{pageno$},DFONT

# address & balance info
cbox LEFTCOL,8,MAXCOLS,9.5,1,10
cbox LEFTCOL,9.5,MAXCOLS,20
text 1,9,"Customer",HFONT
cfont 1,10,45,19,DFONT
cfont 47,15,51,15,HFONT
cfont 47,16,79,16,DFONT

# line item detail
cerase 1,18,MAXCOLS,18
cerase 1,20,MAXCOLS,20
cbox LEFTCOL,18,MAXCOLS,20,1,10
cbox LEFTCOL,20,MAXCOLS,51
cbox 11,18,11,51
cbox 20,18,20,51
cbox 26,18,26,51
cbox 35,18,35,51
cbox 48,18,48,51
cbox 59,18,59,51
AR_STMT_CFONT 1,19,10,19,HFONT,center
AR_STMT_CFONT 12,19,19,19,HFONT
AR_STMT_CFONT 21,19,25,19,HFONT,center
AR_STMT_CFONT 27,19,34,19,HFONT
AR_STMT_CFONT 36,19,47,19,HFONT,right
AR_STMT_CFONT 49,19,58,19,HFONT,right
AR_STMT_CFONT 60,19,71,19,HFONT,right
AR_STMT_FONT "~DATEMASK@1,19,10,50",-2,0,10,1,DFONT,center
AR_STMT_FONT "~DATEMASK@1,19,10,50",9,0,8,1,DFONT
AR_STMT_FONT "~DATEMASK@1,19,10,50",18,0,5,1,DFONT,center
AR_STMT_FONT "~DATEMASK@1,19,10,50",24,0,8,1,DFONT
AR_STMT_FONT "PO N@1,19",0,0,25,1,DFONT
AR_STMT_CFONT 36,21,47,50,DFONT,right
AR_STMT_CFONT 49,21,58,50,DFONT,right
AR_STMT_CFONT 60,21,71,50,DFONT,right

# Messages
cbox LEFTCOL,51,MAXCOLS,55
cfont 1,52,MAXCOLS,54,DFONT

# aging table
cerase 1,55,MAXCOLS,55
cerase 1,57,MAXCOLS,57
cerase 1,59,MAXCOLS,MAXROWS
cbox LEFTCOL,55,MAXCOLS,57,1,10
cbox LEFTCOL,57,MAXCOLS,59
box 10,55,1,4
box 21,55,1,4
box 31,55,1,4
box 41,55,1,4
box 51,55,1,4
box 60,55,1,4
cfont 1,56,9,56,HFONT,right
cfont 11,56,20,56,HFONT,right
cfont 22,56,30,56,HFONT,right
cfont 32,56,40,56,HFONT,right
cfont 42,56,50,56,HFONT,right
cfont 52,56,59,56,HFONT,right
cfont 61,56,79,56,HFONT,bold,right
cfont 1,58,9,58,DFONT,right
cfont 11,58,20,58,DFONT,right
cfont 22,58,30,58,DFONT,right
cfont 32,58,40,58,DFONT,right
cfont 42,58,50,58,DFONT,right
cfont 52,58,59,58,DFONT,right
cfont 61,58,79,58,DFONT,right
text 1,63,{payby_date$},HFONT
if copy CUSTOMER_COPY
	text 1,65,"Customer Copy",univers,12,bold,center,cols=MAXCOLS
endif
if copy FILE_COPY
	text 1,65,"Accounting Copy",univers,12,bold,center,cols=MAXCOLS
endif

###############################
# Module: Bank Reconciliation #
###############################

#############################
# Module: Bill of Materials #
#############################

##########################
# Module: Direct Deposit #
##########################

########################
# Module: Fixed Assets #
########################

##########################
# Module: General Ledger #
##########################

[GL Balance Sheet]
# Tested OK with 6.1.1 9/21/01 - bcj
# handled "UNAUDITED" - 12/14/01
detect 0,3,"BALANCE SHEET"

const MAXCOLS=80
const MAXRCOLS=78
const MAXROWS=66
const LEFTCOL=.5
cols MAXCOLS
rows MAXROWS
pcopies 1

prepage {
	rptdate$=trim(get(1,1,10))
	x=pos("  Page "=text$[1])
	compname$=trim(get(20,1,x-1-20))
	pageno$=trim(get(x,1,20))
	time$=trim(get(1,2,8))
	title$="G/L "+trim(get(10,3,60))
	period_date$=trim(get(20,4,40))
	hd1$="Budget"
	x=pos("LAST YEAR"=title$)
	if x then hd1$="Last Year"
}

# header
const HFONT=univers,9,bold
cerase LEFTCOL,1,MAXCOLS,4
cbox LEFTCOL,.1,MAXCOLS,4,3,20
text 2,1,{rptdate$},HFONT
text 1,1.25,{compname$},univers,15,bold,center,cols=MAXCOLS
text 1,2.5,{title$},univers,12,bold,center,cols=MAXCOLS
text 1,1,{pageno$},HFONT,right,cols=MAXRCOLS
text 2,2,{time$},HFONT
text 1,3.5,{period_date$},HFONT,center,cols=MAXCOLS

# body
const HFONT=univers,10,italic
const DFONT=cgtimes,10
const SFONT=cgtimes,11,bold
const TFONT=cgtimes,11,bold
cbox LEFTCOL,7.5,MAXCOLS,9,1,10
cerase 1,6,MAXCOLS,10
text 1,8,"GL Account",HFONT
text 15,8,"Description",HFONT
text 48,8,"Current Year",HFONT,right,cols=12
text 70,8,{hd1$},HFONT,right,cols=6
cfont 1,11,13,MAXROWS,DFONT
cfont 15,11,47,MAXROWS,DFONT
cfont 49,10,59,MAXROWS,DFONT,right
cfont 65,10,75,MAXROWS,DFONT,right
font ")",0,0,1,1,DFONT
font "~  ASSETS|  LIABILITIES AND EQUITY",0,0,25,1,TFONT
font "~  CURRENT ASSETS|  LONG TERM ASSETS|   OTHER ASSETS",0,0,25,1,SFONT
font "~  CURRENT LIABILITIES|  LONG TERM LIABILITIES",0,0,25,1,SFONT
font "~  LIABILITIES|  STOCKHOLDERS EQUITY",0,0,25,1,SFONT

# totals section
box "~ TOTAL ASSETS| TOTAL LIABILITIES",-1,-1,59,2,5,10
box "~ TOTAL STOCKHOLDERS EQUITY| TOTAL LIABILITIES & EQUITY",-1,-1,59,2,5,10
box "~ TOTAL .* ASSETS| TOTAL .* LIABILITIES",-1,-1,59,1,5
erase "TOTAL",0,-1,MAXCOLS,1
erase "TOTAL",0,1,MAXCOLS,1
font "~ TOTAL ASSETS| TOTAL LIABILITIES",0,0,28,1,TFONT
font "~ TOTAL ASSETS| TOTAL LIABILITIES",30,0,12,1,TFONT,right
font "~ TOTAL ASSETS| TOTAL LIABILITIES",46,0,12,1,TFONT,right
font "~ TOTAL STOCKHOLDERS EQUITY",0,0,28,1,TFONT
font "~ TOTAL LIABILITIES & EQUITY",0,0,28,1,TFONT
font "~ TOTAL STOCKHOLDERS EQUITY",30,0,12,1,TFONT,right
font "~ TOTAL LIABILITIES & EQUITY",30,0,12,1,TFONT,right
font "~ TOTAL STOCKHOLDERS EQUITY",46,0,12,1,TFONT,right
font "~ TOTAL LIABILITIES & EQUITY",46,0,12,1,TFONT,right
font "~ TOTAL .* ASSETS| TOTAL .* LIABILITIES",0,0,28,1,SFONT
font "~ TOTAL .* ASSETS| TOTAL .* LIABILITIES",30,0,12,1,SFONT,right
font "~ TOTAL .* ASSETS| TOTAL .* LIABILITIES",46,0,12,1,SFONT,right

# unaudited
font "UNAUDITED",0,0,9,1,TFONT

[GL Income Statement w Budget]
# Tested OK with 6.1.1 9/21/01 - bcj
# added new rule set below to handle last year comparison - 06/12/01
# corrected some line title issues - 06/12/01
# handled "UNAUDITED" - 06/12/01
detect 0,3,"INCOME STATEMENT WITH BUDGET COMPARISON"

const MAXCOLS=131
const MAXRCOLS=129
const MAXROWS=66
const LEFTCOL=.5
cols MAXCOLS
rows MAXROWS
pcopies 1

prepage {
	x=pos("  Page "=text$[1])
	compname$=trim(get(20,1,x-1-20))
	pageno$=trim(get(x,1,20))
	title$="G/L "+trim(get(20,3,90))
	period_date$=trim(get(20,4,90))
}

# header
const HFONT=univers,9,bold
cerase LEFTCOL,1,MAXCOLS,4
cbox LEFTCOL,.1,MAXCOLS,4,3,20
text 1,1.25,{compname$},univers,15,bold,center,cols=MAXCOLS
text 1,2.5,{title$},univers,12,bold,center,cols=MAXCOLS
text 1,1,{pageno$},HFONT,right,cols=MAXRCOLS
text 1,3.5,{period_date$},HFONT,center,cols=MAXCOLS

# body
const HFONT=univers,9,italic
const DFONT=cgtimes,9
const SFONT=cgtimes,9,bold
const TFONT=cgtimes,11,bold
const DESCFONT=cgtimes,7.5
cbox LEFTCOL,7.5,MAXCOLS,10,1,10
cerase 1,6,MAXCOLS,10
text 40,8,"C u r r e n t   P e r i o d",HFONT,center,cols=42
text 86,8,"Y e a r   -   to   -   Date",HFONT,center,cols=42
text 1,9,"Acnt#",HFONT
text 8,9,"Description",HFONT
text 43,9,"This Year",HFONT,right,cols=9
text 59,9,"%",HFONT
text 69,9,"Budget",HFONT,right,cols=6
text 82,9,"%",HFONT
text 89,9,"This Year",HFONT,right,cols=9
text 105,9,"%",HFONT
text 115,9,"Budget",HFONT,right,cols=6
text 128,9,"%",HFONT
font "~[0-9]@1,10,1,MAXROWS",0,0,6,1,DFONT
font "~[0-9]@1,10,1,MAXROWS",9,0,30,1,DESCFONT
cfont 41,11,51,MAXROWS,DFONT,right
cfont 54,11,59,MAXROWS,DFONT,right
cfont 64,11,74,MAXROWS,DFONT,right
cfont 77,11,82,MAXROWS,DFONT,right
cfont 87,11,97,MAXROWS,DFONT,right
cfont 100,11,105,MAXROWS,DFONT,right
cfont 110,11,120,MAXROWS,DFONT,right
cfont 123,11,128,MAXROWS,DFONT,right
font "~       REVENUE|       COST OF GOODS SOLD",7,0,20,1,SFONT
font "~       EXPENSES|       SELLING EXPENSES",7,0,20,1,SFONT
font "~       MANUFACTURING EXPENSES",7,0,30,1,SFONT
font "~       GENL & ADMIN EXPENSES",7,0,30,1,SFONT
font "~       OTHER INCOME AND EXPENSES",7,0,30,1,SFONT

# Totals section
box "----------@40,11,49,MAXROWS",0,0,90,1
erase "TOTAL",0,-1,MAXCOLS,1
erase "TOTAL",0,1,MAXCOLS,1
move "TOTAL@11,1,15,MAXROWS",0,0,27,1,-5,0
move "TOTAL@12,1,16,MAXROWS",0,0,27,1,-6,0
font "TOTAL@6,1,10,MAXROWS",0,0,30,1,SFONT
font "TOTAL@6,1,10,MAXROWS",35,0,11,1,SFONT,right
font "TOTAL@6,1,10,MAXROWS",48,0,6,1,SFONT,right
font "TOTAL@6,1,10,MAXROWS",58,0,11,1,SFONT,right
font "TOTAL@6,1,10,MAXROWS",71,0,6,1,SFONT,right
font "TOTAL@6,1,10,MAXROWS",81,0,11,1,SFONT,right
font "TOTAL@6,1,10,MAXROWS",94,0,6,1,SFONT,right
font "TOTAL@6,1,10,MAXROWS",104,0,11,1,SFONT,right
font "TOTAL@6,1,10,MAXROWS",117,0,6,1,SFONT,right

# Grand totals section
box "~GROSS PROFIT|PROFIT BEFORE TAXES|NET PROFIT",-1,-.75,120,1.25,5,10
font "~GROSS PROFIT|PROFIT BEFORE TAXES|NET PROFIT",0,0,20,1,TFONT
font "~GROSS PROFIT|PROFIT BEFORE TAXES|NET PROFIT",29,0,11,1,TFONT,right
font "~GROSS PROFIT|PROFIT BEFORE TAXES|NET PROFIT",42,0,6,1,TFONT,right
font "~GROSS PROFIT|PROFIT BEFORE TAXES|NET PROFIT",52,0,11,1,TFONT,right
font "~GROSS PROFIT|PROFIT BEFORE TAXES|NET PROFIT",65,0,6,1,TFONT,right
font "~GROSS PROFIT|PROFIT BEFORE TAXES|NET PROFIT",75,0,11,1,TFONT,right
font "~GROSS PROFIT|PROFIT BEFORE TAXES|NET PROFIT",88,0,6,1,TFONT,right
font "~GROSS PROFIT|PROFIT BEFORE TAXES|NET PROFIT",98,0,11,1,TFONT,right
font "~GROSS PROFIT|PROFIT BEFORE TAXES|NET PROFIT",111,0,6,1,TFONT,right

# unaudited
font "UNAUDITED",0,0,9,1,TFONT

[GL Income Statement - prev yr comp]
# Tested OK with 6.1.1 9/21/01 - bcj
# added - 06/12/01
detect 0,3,"INCOME STATEMENT WITH LAST YEAR COMPARISON"

const MAXCOLS=128
const MAXRCOLS=127
const MAXROWS=66
const LEFTCOL=.5
cols MAXCOLS
rows MAXROWS
pcopies 1

prepage {
	x=pos("  Page "=text$[1])
	compname$=trim(get(20,1,x-1-20))
	pageno$=trim(get(x,1,20))
	title$="G/L "+trim(get(20,3,90))
	period_date$=trim(get(20,4,90))
}

# header
const HFONT=univers,9,bold
cerase LEFTCOL,1,MAXCOLS,4
cbox LEFTCOL,.1,MAXCOLS,4,3,20
text 1,1.25,{compname$},univers,15,bold,center,cols=MAXCOLS
text 1,2.5,{title$},univers,12,bold,center,cols=MAXCOLS
text 1,1,{pageno$},HFONT,right,cols=MAXRCOLS
text 2,2,{time$},HFONT
text 1,3.5,{period_date$},HFONT,center,cols=MAXCOLS

# body
const HFONT=univers,9,italic
const DFONT=cgtimes,9
const SFONT=cgtimes,9,bold
const TFONT=cgtimes,11,bold
const DESCFONT=cgtimes,7.5
cbox LEFTCOL,7.5,MAXCOLS,10,1,10
cerase 1,6,MAXCOLS,10
text 37,8,"C u r r e n t   P e r i o d",HFONT,center,cols=44
text 83,8,"Y e a r   -   to   -   Date",HFONT,center,cols=44
text 1,9,"Acnt#",HFONT
text 8,9,"Description",HFONT
text 40,9,"This Year",HFONT,right,cols=9
text 54,9,"%",HFONT
text 62,9,"Last Year",HFONT,right,cols=9
text 78,9,"%",HFONT
text 86,9,"This Year",HFONT,right,cols=9
text 100,9,"%",HFONT
text 108,9,"Last Year",HFONT,right,cols=9
text 124,9,"%",HFONT
font "~[0-9]@1,10,1,MAXROWS",0,0,6,1,DFONT
font "~[0-9]@1,10,1,MAXROWS",7,0,30,1,DESCFONT
cfont 37,11,48,MAXROWS,DFONT,right
cfont 51,11,56,MAXROWS,DFONT,right
cfont 59,11,70,MAXROWS,DFONT,right
cfont 75,11,80,MAXROWS,DFONT,right
cfont 83,11,94,MAXROWS,DFONT,right
cfont 97,11,102,MAXROWS,DFONT,right
cfont 105,11,116,MAXROWS,DFONT,right
cfont 121,11,126,MAXROWS,DFONT,right
font "~     REVENUE|     COST OF GOODS SOLD",5,0,20,1,SFONT
font "~     EXPENSES|     SELLING EXPENSES",5,0,20,1,SFONT
font "~     MANUFACTURING EXPENSES",5,0,30,1,SFONT
font "~     GENL & ADMIN EXPENSES",5,0,30,1,SFONT
font "~     OTHER INCOME AND EXPENSES",5,0,30,1,SFONT

# Totals section
box "----------@40,11,49,MAXROWS",0,0,90,1
erase "TOTAL",0,-1,MAXCOLS,1
erase "TOTAL",0,1,MAXCOLS,1
move "TOTAL@9,1,13,MAXROWS",0,0,27,1,-3,0
move "TOTAL@10,1,14,MAXROWS",0,0,27,1,-4,0
font "TOTAL@6,1,10,MAXROWS",0,0,30,1,SFONT
font "TOTAL@6,1,10,MAXROWS",31,0,12,1,SFONT,right
font "TOTAL@6,1,10,MAXROWS",45,0,6,1,SFONT,right
font "TOTAL@6,1,10,MAXROWS",53,0,12,1,SFONT,right
font "TOTAL@6,1,10,MAXROWS",69,0,6,1,SFONT,right
font "TOTAL@6,1,10,MAXROWS",77,0,12,1,SFONT,right
font "TOTAL@6,1,10,MAXROWS",91,0,6,1,SFONT,right
font "TOTAL@6,1,10,MAXROWS",99,0,12,1,SFONT,right
font "TOTAL@6,1,10,MAXROWS",115,0,6,1,SFONT,right

# Grand totals section
box "~GROSS PROFIT|PROFIT BEFORE TAXES|NET PROFIT",-1,-.75,120,1.25,5,10
font "~GROSS PROFIT|PROFIT BEFORE TAXES|NET PROFIT",0,0,20,1,TFONT
font "~GROSS PROFIT|PROFIT BEFORE TAXES|NET PROFIT",27,0,12,1,TFONT,right
font "~GROSS PROFIT|PROFIT BEFORE TAXES|NET PROFIT",41,0,6,1,TFONT,right
font "~GROSS PROFIT|PROFIT BEFORE TAXES|NET PROFIT",49,0,12,1,TFONT,right
font "~GROSS PROFIT|PROFIT BEFORE TAXES|NET PROFIT",65,0,6,1,TFONT,right
font "~GROSS PROFIT|PROFIT BEFORE TAXES|NET PROFIT",73,0,12,1,TFONT,right
font "~GROSS PROFIT|PROFIT BEFORE TAXES|NET PROFIT",87,0,6,1,TFONT,right
font "~GROSS PROFIT|PROFIT BEFORE TAXES|NET PROFIT",95,0,12,1,TFONT,right
font "~GROSS PROFIT|PROFIT BEFORE TAXES|NET PROFIT",111,0,6,1,TFONT,right

# unaudited
font "UNAUDITED",0,0,9,1,TFONT

[GL Trial Balance]
# Tested OK with 6.1.1 9/21/01 - bcj
detect 0,3,"TRIAL BALANCE"
detect 1,8,"GL"

const MAXCOLS=135
const MAXRCOLS=133
const MAXROWS=66
const LEFTCOL=.5
cols MAXCOLS
rows MAXROWS
pcopies 1

prepage {
	rptdate$=trim(get(1,1,10))
	x=pos("  Page "=text$[1])
	compname$=trim(get(20,1,x-1-20))
	pageno$=trim(get(x,1,20))
	period$=trim(get(1,2,90))
	time$=trim(get(1,3,8))
	title$="G/L "+trim(get(20,3,90))
	comp$=trim(get(1,4,30))
	period_date$=trim(get(40,4,50))
}

# header
const HFONT=univers,9,bold
cerase LEFTCOL,1,MAXCOLS,4
cbox LEFTCOL,.1,MAXCOLS,4.5,3,20
text 2,1,{RPTDATE$},HFONT
text 1,1.25,{compname$},univers,15,bold,center,cols=MAXCOLS
text 1,2.5,{title$},univers,12,bold,center,cols=MAXCOLS
text 1,1,{pageno$},HFONT,right,cols=MAXRCOLS
text 2,2,{period$},HFONT
text 2,3,{time$},HFONT
text 1,3.5,{period_date$},HFONT,center,cols=MAXCOLS
text 2,4,{comp$},HFONT

# body
const HFONT=univers,10,italic
const DFONT=cgtimes,9
const TFONT=cgtimes,10,bold
cbox LEFTCOL,5.5,MAXCOLS,9,1,10
cerase 1,6,MAXCOLS,9
text 59,6,"Actual",HFONT,center,cols=30
text 100,6,"Actual",HFONT,center,cols=30
text 59,7,"Current Period",HFONT,center,cols=30
text 102,7,"Year-to-Date Balance",HFONT,center,cols=30
text 1,8,"GL Account",HFONT
text 15,8,"Description",HFONT
text 62,8,"Debit",HFONT,right,cols=5
text 81,8,"Credit",HFONT,right,cols=6
text 105,8,"Debit",HFONT,right,cols=5
text 124,8,"Credit",HFONT,right,cols=6
cfont 1,10,13,MAXROWS,DFONT
cfont 15,10,50,MAXROWS,DFONT
cfont 54,10,66,MAXROWS,DFONT,right
cfont 74,10,86,MAXROWS,DFONT,right
cfont 97,10,109,MAXROWS,DFONT,right
cfont 117,10,129,MAXROWS,DFONT,right

# totals
erase "BALANCE@1,10",0,-1,MAXCOLS,1
erase "BALANCE@1,10",0,1,MAXCOLS,1
box "BALANCE@1,10",-1,-1,116,2,5,10
font "BALANCE@1,10",0,0,7,1,TFONT,bold
font "BALANCE@1,10",39,0,13,1,TFONT,right
font "BALANCE@1,10",59,0,13,1,TFONT,right
font "BALANCE@1,10",82,0,13,1,TFONT,right
font "BALANCE@1,10",102,0,13,1,TFONT,right
font "End of Report",0,0,13,1,TFONT

#####################
# Module: Inventory #
#####################

####################
# Module: Job Cost #
####################

###################
# Module: Payroll #
###################

[PR Edit Register]
# Tested OK with 6.1.1 9/21/01 - bcj
# added 9/21/01
detect 0,2,"Edit Register - Summary"
const MAXCOLS=130
const MAXRCOLS=128
const LEFTCOL=.5
const MAXROWS=66
cols=MAXCOLS
rows=MAXROWS

# copy 1=employee totals, 2=company totals
pcopies 2

prepage {
	# load row 1 variables
	rptdate$=trim(get(1,1,10))
	grp_code$=trim(get(13,1,20))
	compname$=trim(get(34,1,70))
	pageno$=trim(get(119,1,8))
	x$=set(1,1,MAXCOLS,"")

	# load row 2 variables
	time$=trim(get(1,2,10))
	period$=trim(get(13,2,20))
	title$=trim(get(34,2,70))
	x$=set(1,2,MAXCOLS,"")

	# load row 3 variables
	subtitle$=trim(get(34,3,70))
	x$=set(1,3,MAXCOLS,"")

}

precopy {
	x$=trim(get(1,5,10))
	if copy=1 and x$<>"Employee" then skip=1
	if copy=2 and x$<>"Deductions" then skip=1
}

# make more room for headings
vshift 1

# header
const HFONT=univers,9,bold
cbox LEFTCOL,.1,MAXCOLS,3.75,3,20
text 2,1.25,{rptdate$},HFONT
text 1,1.25,{compname$},univers,15,bold,center,cols=MAXCOLS
text 1,1.25,{pageno$},HFONT,right,cols=MAXRCOLS
text 2,2.5,{time$},HFONT
text 1,2.5,{title$},univers,12,bold,center,cols=MAXCOLS
text 2,3.5,{grp_code$},HFONT
text 1,3.5,{subtitle$},univers,11,center,cols=MAXCOLS
text 1,3.5,{period$},HFONT,right,cols=MAXRCOLS

if copy 1
	# detail headings
	const HFONT=univers,9,italic
	const DFONT=cgtimes,10,bold
	cerase 1,4,MAXCOLS,4
	cbox 27,5,35,5
	text 27,5,"Earnings",HFONT,center,cols=31
	cbox 46,5,57,5
	cbox 58,5,71,5
	text 59,5,"Witholdings",HFONT,center,cols=37
	cbox 84,5,95,5
	cbox 98,5,107,5
	text 98,5,"Deductions",HFONT,center,cols=32
	cbox 119,5,MAXRCOLS,5

	cfont 1,6,9,7,HFONT					# emp id
	cfont 11,6,21,7,HFONT,center				# ssn
	cfont 36,6,45,7,HFONT,right				# hours
	cfont 47,6,57,7,HFONT,right				# wages
	cfont 59,6,84,7,HFONT					# wh desc
	cfont 86,6,95,7,HFONT,right				# wh amt
	cfont 98,6,120,9,HFONT					# ded desc
	cfont 109,6,MAXRCOLS,7,HFONT,right			# ded amt

	cerase 1,7,MAXCOLS,7
	cbox LEFTCOL,8,MAXCOLS,8

	# detail
	shade "Total@30,9,34,MAXROWS",-30,1,MAXRCOLS,1,5
	font "Total@30,9,34,MAXROWS",-29,1,28,1,HFONT,bold	# name
	font "Total@30,9,34,MAXROWS",-29,2,8,1,HFONT		# id
	font "Total@30,9,34,MAXROWS",-19,2,11,1,HFONT		# ssn
	font "Gross Wages",0,1,11,2,HFONT,bold
	font "Gross Wages",12,1,13,2,DFONT,11,right

	cfont 30,10,34,MAXROWS,HFONT				# total
	cfont 36,10,45,MAXROWS,DFONT,right			# hrs
	cfont 38,10,57,MAXROWS,DFONT,right			# amt
	cfont 59,10,84,MAXROWS,HFONT				# wh desc
	cfont 86,10,95,MAXROWS,DFONT,right			# wh amt
	cfont 98,10,117,MAXROWS,HFONT				# ded desc
	cfont 119,10,MAXRCOLS,MAXROWS,DFONT,right		# ded amt
endif

if copy 2
	# detail headings
	cfont 1,5,30,6,HFONT					# desc
	cfont 32,5,45,6,HFONT,right				# amt
	cfont 47,5,58,6,HFONT,right				# hrs

	cerase 1,6,MAXCOLS,6
	cbox LEFTCOL,7,MAXCOLS,7		

	# detail
	font "~[A-Z]@3,7,3,MAXROWS",-2,1,30,1,HFONT,bold,11	# section hdrs
	font "~[A-Z0-9]@5,7,5,MAXROWS",0,1,25,1,HFONT		# desc
	cfont 32,8,45,MAXROWS,DFONT,right				# amt
	cfont 47,8,58,MAXROWS,DFONT,right				# hrs
	cfont 60,8,80,MAXROWS,HFONT,center				# Yes/No's

	# totals
	erase "Earnings Total",0,-1,MAXCOLS,1
	box "Earnings Total",28,0,27,1
	font "Earnings Total",-5,1,19,1,HFONT,bold,11

	erase "Employee Totals",0,-1,MAXCOLS,1
	box "Employee Totals",28,0,14,1
	font "Employee Totals",-5,1,20,2,HFONT,bold,11
	
endif

[PR Checks - laser]
# Tested OK with 6.1.1 9/21/01 - bcj
detect 0,8,"~DATEMASK"
detect 0,22,"~ [0-9][0-9][0-9]-[0-9][0-9]-[0-9][0-9][0-9][0-9]"

const MAXCOLS=80
const MAXRCOLS=79
const MAXROWS=66
const LEFTCOL=.5
cols MAXCOLS
rows MAXROWS

const ONE_STUB_COPY=1
const TWO_STUB_COPY=2
pcopies 2

prepage {
	# load up check data for later placement
	chkno$=trim(get(66,22,10))
	chkno1$="Check Number "+chkno$
	chkdate$=trim(get(53,8,8))
	chkamt$=trim(get(67,8,14))
	chkamt_words$=trim(get(1,9,MAXCOLS))
	name$=trim(get(1,11,MAXCOLS))
	addr1$=trim(get(1,12,MAXCOLS))
	addr2$=trim(get(1,13,MAXCOLS))
	addr3$=trim(get(1,14,MAXCOLS))
}

precopy {
	if copy=ONE_STUB_COPY and copy<>PR_NO_STUBS then skip=1
	if copy=TWO_STUB_COPY and copy<>PR_NO_STUBS then skip=1
}

# first adjust format to standard
cmove 1,20,MAXCOLS,60,1,22

# Check
const SHFONT=univers,11,shade 0
const DFONT=cgtimes,12,bold
const HFONT=univers,12,italic
cerase 1,1,MAXCOLS,19
cbox LEFTCOL,1,MAXCOLS,20,4,20
LOGO_IMAGE 1,1.1,10,5,COMP_LOGO
text 15,3,"COMP_NAME",univers,15,bold
text 15,4,"COMP_ADDR1",univers,12
text 15,5,"COMP_ADDR2",univers,12
text 1,2.5,{chkno1$},cgtimes,16,bold,right,cols=MAXRCOLS

cbox 55,5.5,65,6.5,1,100
cbox 55,6.5,65,7.5
text 56,6,"Date",SHFONT,center,cols=9
text 56,7,{chkdate$},DFONT,center,cols=9

cbox 67,5.5,MAXCOLS,6.5,1,100
cbox 67,6.5,MAXCOLS,7.5
text 70,6,"Amount",SHFONT,right,cols=10
text 70,7,{chkamt$},DFONT,right,cols=10

text 2,9,{chkamt_words$},DFONT,italic

text 2,12,"Pay to the Order of",HFONT
text 11,13,{name$},DFONT
text 11,14,{addr1$},DFONT
text 11,15,{addr2$},DFONT
text 11,16,{addr3$},DFONT
SIGNATURE_IMAGE 50,17,SIGNATURE
box 50,17.5,29,1,3
text 50,18.2,"Authorized Signature",HFONT,center,cols=29
PR_MICR 8,18.5,"PR_MICR_ACCOUNTNO",{chkno$}

# top stub - employee's
const SHFONT=univers,9,shade 0
const DFONT=cgtimes,10,bold
const HFONT=univers,9,italic
cbox LEFTCOL,21,MAXCOLS,21
text 15,22,"COMP_NAME",univers,12,bold
cerase LEFTCOL,22,MAXCOLS,22
cbox LEFTCOL,22.5,MAXCOLS,23.5,1,10
cbox LEFTCOL,23.5,MAXCOLS,24.5
cbox 14,22.5,14,24.5
cbox 32,22.5,32,24.5
cbox 44,22.5,44,24.5
cbox 53,22.5,53,24.5
cbox 65,22.5,65,24.5
cfont 1,23,13,23,HFONT
cfont 15,23,31,23,HFONT
cfont 33,23,43,23,HFONT,center
cfont 45,23,52,23,HFONT,center
cfont 54,23,64,23,HFONT,center
cfont 66,23,MAXCOLS,23,HFONT
cfont 1,24,13,24,DFONT
cfont 15,24,31,24,DFONT
cfont 33,24,43,24,DFONT,center
cfont 45,24,52,24,DFONT,center
cfont 54,24,64,24,DFONT,center
cfont 66,24,MAXCOLS,24,DFONT

cbox LEFTCOL,24.5,MAXCOLS,25.5,1,10
cbox LEFTCOL,25.5,MAXCOLS,38.5
cbox 46,24.5,46,38.5
cfont 1,25,8,25,HFONT
cfont 10,25,21,25,HFONT,right
cfont 23,25,32,25,HFONT,right
cfont 34,25,43,25,HFONT,right
cfont 47,25,58,25,HFONT
cfont 60,25,68,25,HFONT,right
cfont 70,25,MAXRCOLS,25,HFONT,right
cfont 1,26,12,35,HFONT
cfont 14,26,21,35,DFONT,right
cfont 23,26,32,35,DFONT,right
cfont 34,26,43,35,DFONT,right
cfont 47,26,58,38,HFONT
cfont 60,26,68,38,DFONT,right
cfont 70,26,MAXRCOLS,38,DFONT,right
cfont 1,36,14,37,HFONT
cfont 16,36,25,37,DFONT,right

cbox LEFTCOL,38.5,MAXCOLS,39.5,1,100
cbox LEFTCOL,39.5,MAXCOLS,40.5
cbox 12,38.5,12,40.5
cbox 24,38.5,24,40.5
cbox 36,38.5,36,40.5
cbox 47,38.5,47,40.5
cbox 59,38.5,59,40.5
cbox 70,38.5,70,40.5
cfont 1,39,11,39,SHFONT
cfont 13,39,23,39,SHFONT,right
cfont 25,39,35,39,SHFONT,right
cfont 37,39,46,39,SHFONT,right
cfont 48,39,58,39,SHFONT,right
cfont 60,39,69,39,SHFONT,right
text 71,39,"YTD Net Pay",SHFONT,right,cols=9
cerase 69,39,MAXCOLS,39
cfont 1,40,11,40,DFONT
cfont 13,40,23,40,DFONT,right
cfont 25,40,35,40,DFONT,right
cfont 37,40,46,40,DFONT,right
cfont 48,40,58,40,DFONT,right
cfont 60,40,69,40,DFONT,right
cfont 71,40,MAXRCOLS,40,DFONT,right

# Bottom stub - employer's
if copy ONE_STUB_COPY
	cerase 1,43,MAXCOLS,MAXROWS
endif
if copy TWO_STUB_COPY
	cbox LEFTCOL,42,MAXCOLS,42
	text 15,43,"COMP_NAME",univers,12,bold
	cerase LEFTCOL,43,MAXCOLS,43
	cbox LEFTCOL,43.5,MAXCOLS,44.5,1,10
	cbox LEFTCOL,44.5,MAXCOLS,45.5
	cbox 14,43.5,14,45.5
	cbox 32,43.5,32,45.5
	cbox 44,43.5,44,45.5
	cbox 53,43.5,53,45.5
	cbox 65,43.5,65,45.5
	cfont 1,44,13,44,HFONT
	cfont 15,44,31,44,HFONT
	cfont 33,44,43,44,HFONT,center
	cfont 45,44,52,44,HFONT,center
	cfont 54,44,64,44,HFONT,center
	cfont 66,44,MAXCOLS,44,HFONT
	cfont 1,45,13,45,DFONT
	cfont 15,45,31,45,DFONT
	cfont 33,45,43,45,DFONT,center
	cfont 45,45,52,45,DFONT,center
	cfont 54,45,64,45,DFONT,center
	cfont 66,45,MAXCOLS,45,DFONT

	cbox LEFTCOL,45.5,MAXCOLS,46.5,1,10
	cbox LEFTCOL,46.5,MAXCOLS,59.5
	cbox 46,45.5,46,59.5
	cfont 1,46,8,46,HFONT
	cfont 10,46,21,46,HFONT,right
	cfont 23,46,32,46,HFONT,right
	cfont 34,46,43,46,HFONT,right
	cfont 47,46,58,46,HFONT
	cfont 60,46,68,46,HFONT,right
	cfont 70,46,MAXRCOLS,46,HFONT,right
	cfont 1,47,12,56,HFONT
	cfont 14,47,21,56,DFONT,right
	cfont 23,47,32,56,DFONT,right
	cfont 34,47,43,56,DFONT,right
	cfont 47,47,58,59,HFONT
	cfont 60,47,68,59,DFONT,right
	cfont 70,47,MAXRCOLS,59,DFONT,right
	cfont 1,57,14,58,HFONT
	cfont 16,57,25,58,DFONT,right

	cbox LEFTCOL,59.5,MAXCOLS,60.5,1,100
	cbox LEFTCOL,60.5,MAXCOLS,61.5
	cbox 12,59.5,12,61.5
	cbox 24,59.5,24,61.5
	cbox 36,59.5,36,61.5
	cbox 47,59.5,47,61.5
	cbox 59,59.5,59,61.5
	cbox 70,59.5,70,61.5
	cfont 1,60,11,60,SHFONT
	cfont 13,60,23,60,SHFONT,right
	cfont 25,60,35,60,SHFONT,right
	cfont 37,60,46,60,SHFONT,right
	cfont 48,60,58,60,SHFONT,right
	cfont 60,60,69,60,SHFONT,right
	text 71,60,"YTD Net Pay",SHFONT,right,cols=9
	cerase 69,60,MAXCOLS,60
	cfont 1,61,11,61,DFONT
	cfont 13,61,23,61,DFONT,right
	cfont 25,61,35,61,DFONT,right
	cfont 37,61,46,61,DFONT,right
	cfont 48,61,58,61,DFONT,right
	cfont 60,61,69,61,DFONT,right
	cfont 71,61,MAXRCOLS,61,DFONT,right
endif

[PR Checks - blank]
# Tested OK with 6.1.1 9/21/01 - bcj
detect 0,10,"~DATEMASK"
detect 0,24,"~ [0-9][0-9][0-9]-[0-9][0-9]-[0-9][0-9][0-9][0-9]"

const MAXCOLS=80
const MAXRCOLS=79
const MAXROWS=66
const LEFTCOL=.5
cols MAXCOLS
page 42
rows MAXROWS

const ONE_STUB_COPY=1
const TWO_STUB_COPY=2
pcopies 2

prepage {
	# load up check data for later placement
	chkno$=trim(get(70,24,10))
	chkno1$="Check Number "+chkno$
	chkdate$=trim(get(46,10,8))
	chkamt$=trim(get(67,10,14))
	chkamt_words$=trim(get(1,11,MAXCOLS))
	name$=trim(get(1,14,MAXCOLS))
	addr1$=trim(get(1,15,MAXCOLS))
	addr2$=trim(get(1,16,MAXCOLS))
	addr3$=trim(get(1,17,MAXCOLS))
}

precopy {
	if copy=ONE_STUB_COPY and copy<>PR_NO_STUBS then skip=1
	if copy=TWO_STUB_COPY and copy<>PR_NO_STUBS then skip=1
}

# check
const SHFONT=univers,11,shade 0
const DFONT=cgtimes,12,bold
const HFONT=univers,12,italic
cerase 1,1,MAXCOLS,20
cbox LEFTCOL,1,MAXCOLS,20,4,20
LOGO_IMAGE 1,1.1,10,5,COMP_LOGO
text 15,3,"COMP_NAME",univers,15,bold
text 15,4,"COMP_ADDR1",univers,12
text 15,5,"COMP_ADDR2",univers,12
text 1,2.5,{chkno1$},cgtimes,16,bold,right,cols=MAXRCOLS

cbox 55,5.5,65,6.5,1,100
cbox 55,6.5,65,7.5
text 56,6,"Date",SHFONT,center,cols=9
text 56,7,{chkdate$},DFONT,center,cols=9

cbox 67,5.5,MAXCOLS,6.5,1,100
cbox 67,6.5,MAXCOLS,7.5
text 70,6,"Amount",SHFONT,right,cols=10
text 70,7,{chkamt$},DFONT,right,cols=10

text 2,9,{chkamt_words$},DFONT,italic

text 2,12,"Pay to the Order of",HFONT
text 11,13,{name$},DFONT
text 11,14,{addr1$},DFONT
text 11,15,{addr2$},DFONT
text 11,16,{addr3$},DFONT
SIGNATURE_IMAGE 50,17,SIGNATURE
box 50,17.5,29,1,3
text 50,18.2,"Authorized Signature",HFONT,center,cols=29
PR_MICR 8,18.5,"PR_MICR_ACCOUNTNO",{chkno$}

# top stub - employee's
const SHFONT=univers,9,shade 0
const DFONT=cgtimes,10,bold
const HFONT=univers,9,italic
cbox LEFTCOL,21,MAXCOLS,21
text 15,22,"COMP_NAME",univers,12,bold
cerase LEFTCOL,22,MAXCOLS,22
cbox LEFTCOL,22.5,MAXCOLS,23.5,1,10
cbox LEFTCOL,23.5,MAXCOLS,24.5
cbox 14,22.5,14,24.5
cbox 32,22.5,32,24.5
cbox 44,22.5,44,24.5
cbox 53,22.5,53,24.5
cbox 62,22.5,62,24.5
cfont 1,23,13,23,HFONT
cfont 15,23,31,23,HFONT
cfont 33,23,43,23,HFONT,center
cfont 45,23,52,23,HFONT,center
cfont 54,23,61,23,HFONT,center
cfont 63,23,MAXCOLS,23,HFONT
cfont 1,24,13,24,DFONT
cfont 15,24,31,24,DFONT
cfont 33,24,43,24,DFONT,center
cfont 45,24,52,24,DFONT,center
cfont 54,24,64,24,DFONT,center
cfont 63,24,MAXCOLS,24,DFONT

cbox LEFTCOL,25.5,MAXCOLS,26.5,1,10
cbox LEFTCOL,26.5,MAXCOLS,38.5
cbox 46,25.5,46,38.5
cfont 1,26,8,26,HFONT
cfont 10,26,22,26,HFONT,right
cfont 24,26,32,26,HFONT,right
cfont 34,26,43,26,HFONT,right
cfont 47,26,58,26,HFONT
cfont 60,26,68,26,HFONT,right
cfont 70,26,MAXRCOLS,26,HFONT,right
cfont 1,27,12,35,HFONT
cfont 14,27,22,35,DFONT,right
cfont 24,27,32,35,DFONT,right
cfont 34,27,43,35,DFONT,right
cfont 47,27,58,38,HFONT
cfont 60,27,68,38,DFONT,right
cfont 70,27,MAXRCOLS,38,DFONT,right
cfont 1,37,14,38,HFONT
cfont 16,37,25,38,DFONT,right

cbox LEFTCOL,39.5,MAXCOLS,40.5,1,100
cbox LEFTCOL,40.5,MAXCOLS,41.5
cbox 12,39.5,12,41.5
cbox 24,39.5,24,41.5
cbox 36,39.5,36,41.5
cbox 47,39.5,47,41.5
cbox 59,39.5,59,41.5
cbox 70,39.5,70,41.5
cfont 1,40,11,40,SHFONT
cfont 13,40,23,40,SHFONT,right
cfont 25,40,35,40,SHFONT,right
cfont 37,40,46,40,SHFONT,right
cfont 48,40,58,40,SHFONT,right
cfont 60,40,69,40,SHFONT,right
text 71,40,"YTD Net Pay",SHFONT,right,cols=9
cerase 69,40,MAXCOLS,40
cfont 1,41,11,41,DFONT
cfont 13,41,23,41,DFONT,right
cfont 25,41,35,41,DFONT,right
cfont 37,41,46,41,DFONT,right
cfont 48,41,58,41,DFONT,right
cfont 60,41,69,41,DFONT,right
cfont 71,41,MAXRCOLS,41,DFONT,right

# Bottom stub - employer's
if copy TWO_STUB_COPY
	cmove 1,22,MAXCOLS,41,1,43,retain
	cbox LEFTCOL,42,MAXCOLS,42
	text 15,43,"COMP_NAME",univers,12,bold
	cerase LEFTCOL,43,MAXCOLS,43
	cbox LEFTCOL,43.5,MAXCOLS,44.5,1,10
	cbox LEFTCOL,44.5,MAXCOLS,45.5
	cbox 14,43.5,14,45.5
	cbox 32,43.5,32,45.5
	cbox 44,43.5,44,45.5
	cbox 53,43.5,53,45.5
	cbox 62,43.5,62,45.5
	cfont 1,44,13,44,HFONT
	cfont 15,44,31,44,HFONT
	cfont 33,44,43,44,HFONT,center
	cfont 45,44,52,44,HFONT,center
	cfont 54,44,61,44,HFONT,center
	cfont 63,44,MAXCOLS,44,HFONT
	cfont 1,45,13,45,DFONT
	cfont 15,45,31,45,DFONT
	cfont 33,45,43,45,DFONT,center
	cfont 45,45,52,45,DFONT,center
	cfont 54,45,61,45,DFONT,center
	cfont 63,45,MAXCOLS,45,DFONT

	cbox LEFTCOL,46.5,MAXCOLS,47.5,1,10
	cbox LEFTCOL,47.5,MAXCOLS,59.5
	cbox 46,46.5,46,59.5
	cfont 1,47,8,47,HFONT
	cfont 10,47,22,47,HFONT,right
	cfont 24,47,32,47,HFONT,right
	cfont 34,47,43,47,HFONT,right
	cfont 47,47,58,47,HFONT
	cfont 60,47,68,47,HFONT,right
	cfont 70,47,MAXRCOLS,47,HFONT,right
	cfont 1,48,12,56,HFONT
	cfont 14,48,22,56,DFONT,right
	cfont 24,48,32,56,DFONT,right
	cfont 34,48,43,56,DFONT,right
	cfont 47,48,58,59,HFONT
	cfont 60,48,68,59,DFONT,right
	cfont 70,48,MAXRCOLS,59,DFONT,right
	cfont 1,58,14,59,HFONT
	cfont 16,58,25,59,DFONT,right

	cbox LEFTCOL,60.5,MAXCOLS,61.5,1,100
	cbox LEFTCOL,61.5,MAXCOLS,62.5
	cbox 12,60.5,12,62.5
	cbox 24,60.5,24,62.5
	cbox 36,60.5,36,62.5
	cbox 47,60.5,47,62.5
	cbox 59,60.5,59,62.5
	cbox 70,60.5,70,62.5
	cfont 1,61,11,61,SHFONT
	cfont 13,61,23,61,SHFONT,right
	cfont 25,61,35,61,SHFONT,right
	cfont 37,61,46,61,SHFONT,right
	cfont 48,61,58,61,SHFONT,right
	cfont 60,61,69,61,SHFONT,right
	text 71,61,"YTD Net Pay",SHFONT,right,cols=9
	cerase 69,61,MAXCOLS,61
	cfont 1,62,11,62,DFONT
	cfont 13,62,23,62,DFONT,right
	cfont 25,62,35,62,DFONT,right
	cfont 37,62,46,62,DFONT,right
	cfont 48,62,58,62,DFONT,right
	cfont 60,62,69,62,DFONT,right
	cfont 71,62,MAXRCOLS,62,DFONT,right
endif

[PR Checks - preprinted]
# Tested OK with 6.1.1 9/21/01 - bcj
# move check to top to make same as other PA checks
detect 0,27,"~DATEMASK"
detect 0,2,"~ [0-9][0-9][0-9]-[0-9][0-9]-[0-9][0-9][0-9][0-9]"

const MAXCOLS=80
const MAXRCOLS=79
const MAXROWS=66
const LEFTCOL=.5
cols MAXCOLS
page 42
rows MAXROWS

const ONE_STUB_COPY=1
const TWO_STUB_COPY=2
pcopies 2

prepage {
	# load up check data for later placement
	chkno$=trim(get(65,2,10))
	chkno1$="Check Number "+chkno$
	chkdate$=trim(get(58,27,8))
	chkamt$=trim(get(67,27,14))
	chkamt_words$=trim(get(1,30,MAXCOLS))
	name$=trim(get(1,34,MAXCOLS))
	addr1$=trim(get(1,35,MAXCOLS))
	addr2$=trim(get(1,36,MAXCOLS))
	addr3$=trim(get(1,37,MAXCOLS))
}

precopy {
	if copy=ONE_STUB_COPY and copy<>PR_NO_STUBS then skip=1
	if copy=TWO_STUB_COPY and copy<>PR_NO_STUBS then skip=1
}

# move stub from top to middle
cmove 1,1,MAXCOLS,20,1,23

# check
const SHFONT=univers,11,shade 0
const DFONT=cgtimes,12,bold
const HFONT=univers,12,italic
cerase 1,1,MAXCOLS,20
cbox LEFTCOL,1,MAXCOLS,20,4,20
LOGO_IMAGE 1,1.1,10,5,COMP_LOGO
text 15,3,"COMP_NAME",univers,15,bold
text 15,4,"COMP_ADDR1",univers,12
text 15,5,"COMP_ADDR2",univers,12
text 1,2.5,{chkno1$},cgtimes,16,bold,right,cols=MAXRCOLS

cbox 55,5.5,65,6.5,1,100
cbox 55,6.5,65,7.5
text 56,6,"Date",SHFONT,center,cols=9
text 56,7,{chkdate$},DFONT,center,cols=9

cbox 67,5.5,MAXCOLS,6.5,1,100
cbox 67,6.5,MAXCOLS,7.5
text 70,6,"Amount",SHFONT,right,cols=10
text 70,7,{chkamt$},DFONT,right,cols=10

text 2,9,{chkamt_words$},DFONT,italic

text 2,12,"Pay to the Order of",HFONT
text 11,13,{name$},DFONT
text 11,14,{addr1$},DFONT
text 11,15,{addr2$},DFONT
text 11,16,{addr3$},DFONT
SIGNATURE_IMAGE 50,17,SIGNATURE
box 50,17.5,29,1,3
text 50,18.2,"Authorized Signature",HFONT,center,cols=29
PR_MICR 8,18.5,"PR_MICR_ACCOUNTNO",{chkno$}

# top stub - employee's
const SHFONT=univers,9,shade 0
const DFONT=cgtimes,10,bold
const HFONT=univers,9,italic
cbox LEFTCOL,21,MAXCOLS,21
text 15,22,"COMP_NAME",univers,12,bold
cerase LEFTCOL,22,MAXCOLS,23
cbox LEFTCOL,22.5,MAXCOLS,23.5,1,10
cbox LEFTCOL,23.5,MAXCOLS,24.5
cbox 14,22.5,14,24.5
cbox 32,22.5,32,24.5
cbox 44,22.5,44,24.5
cbox 53,22.5,53,24.5
cbox 62,22.5,62,24.5
text 1,23,"EMP NO/DEPT",HFONT
text 15,23,"EMPLOYEE NAME",HFONT
text 33,23,"SSN",HFONT,center,COLS=11
text 45,23,"PER BEG",HFONT,center,COLS=8
text 54,23,"PER END",HFONT,center,COLS=8
text 63,23,"CK NO",HFONT
cfont 1,24,13,24,DFONT
cfont 15,24,31,24,DFONT
cfont 33,24,43,24,DFONT,center
cfont 45,24,52,24,DFONT,center
cfont 54,24,64,24,DFONT,center
cfont 63,24,MAXCOLS,24,DFONT

cbox LEFTCOL,25.5,MAXCOLS,26.5,1,10
cbox LEFTCOL,26.5,MAXCOLS,39.5
cbox 46,25.5,46,39.5
text 1,26,"Earnings",HFONT
text 14,26,"HRS/UNITS",HFONT,right,cols=9
text 24,26,"Curr Amt",HFONT,right,cols=9
text 34,26,"YTD",HFONT,right,cols=10
text 47,26,"Deductions",HFONT
text 60,26,"Curr Amt",HFONT,right,cols=9
text 70,26,"YTD",HFONT,right,cols=10
cfont 1,27,12,35,HFONT
cfont 14,27,22,35,DFONT,right
cfont 24,27,32,35,DFONT,right
cfont 34,27,43,35,DFONT,right
cfont 47,27,58,39,HFONT
cfont 60,27,68,39,DFONT,right
cfont 70,27,MAXRCOLS,39,DFONT,right
cfont 1,37,14,39,HFONT
cfont 16,37,25,39,DFONT,right

cbox LEFTCOL,39.5,MAXCOLS,40.5,1,100
cbox LEFTCOL,40.5,MAXCOLS,41.5
cbox 12,39.5,12,41.5
cbox 24,39.5,24,41.5
cbox 36,39.5,36,41.5
cbox 47,39.5,47,41.5
cbox 59,39.5,59,41.5
cbox 70,39.5,70,41.5
text 1,40,"Pay Rate",SHFONT
text 13,40,"Curr Earn",SHFONT,right,cols=11
text 25,40,"Curr Ded",SHFONT,right,cols=11
text 37,40,"Net Pay",SHFONT,right,cols=10
text 48,40,"YTD Earn",SHFONT,right,cols=11
text 60,40,"YTD Ded",SHFONT,right,cols=10
text 71,40,"YTD Net Pay",SHFONT,right,cols=9
cerase 69,40,MAXCOLS,40
cfont 1,41,11,41,DFONT
cfont 13,41,23,41,DFONT,right
cfont 25,41,35,41,DFONT,right
cfont 37,41,46,41,DFONT,right
cfont 48,41,58,41,DFONT,right
cfont 60,41,69,41,DFONT,right
cfont 71,41,MAXRCOLS,41,DFONT,right

# Bottom stub - employer's
if copy TWO_STUB_COPY
	cmove 1,22,MAXCOLS,41,1,43,retain
	cbox LEFTCOL,42,MAXCOLS,42
	text 15,43,"COMP_NAME",univers,12,bold
	cerase LEFTCOL,43,MAXCOLS,44
	cbox LEFTCOL,43.5,MAXCOLS,44.5,1,10
	cbox LEFTCOL,44.5,MAXCOLS,45.5
	cbox 14,43.5,14,45.5
	cbox 32,43.5,32,45.5
	cbox 44,43.5,44,45.5
	cbox 53,43.5,53,45.5
	cbox 62,43.5,62,45.5
	text 1,44,"EMP NO/DEPT",HFONT
	text 15,44,"EMPLOYEE NAME",HFONT
	text 33,44,"SSN",HFONT,center,COLS=11
	text 45,44,"PER BEG",HFONT,center,COLS=8
	text 54,44,"PER END",HFONT,center,COLS=8
	text 63,44,"CK NO",HFONT
	cfont 1,45,13,45,DFONT
	cfont 15,45,31,45,DFONT
	cfont 33,45,43,45,DFONT,center
	cfont 45,45,52,45,DFONT,center
	cfont 54,45,61,45,DFONT,center
	cfont 63,45,MAXCOLS,45,DFONT

	cbox LEFTCOL,46.5,MAXCOLS,47.5,1,10
	cbox LEFTCOL,47.5,MAXCOLS,60.5
	cbox 46,46.5,46,60.5
	text 1,47,"Earnings",HFONT
	text 14,47,"HRS/UNITS",HFONT,right,cols=9
	text 24,47,"Curr Amt",HFONT,right,cols=9
	text 34,47,"YTD",HFONT,right,cols=10
	text 47,47,"Deductions",HFONT
	text 60,47,"Curr Amt",HFONT,right,cols=9
	text 70,47,"YTD",HFONT,right,cols=10
	cfont 1,48,12,56,HFONT
	cfont 14,48,22,56,DFONT,right
	cfont 24,48,32,56,DFONT,right
	cfont 34,48,43,56,DFONT,right
	cfont 47,48,58,59,HFONT
	cfont 60,48,68,59,DFONT,right
	cfont 70,48,MAXRCOLS,59,DFONT,right
	cfont 1,58,14,60,HFONT
	cfont 16,58,25,60,DFONT,right

	cbox LEFTCOL,60.5,MAXCOLS,61.5,1,100
	cbox LEFTCOL,61.5,MAXCOLS,62.5
	cbox 12,60.5,12,62.5
	cbox 24,60.5,24,62.5
	cbox 36,60.5,36,62.5
	cbox 47,60.5,47,62.5
	cbox 59,60.5,59,62.5
	cbox 70,60.5,70,62.5
	text 1,61,"Pay Rate",SHFONT
	text 13,61,"Curr Earn",SHFONT,right,cols=11
	text 25,61,"Curr Ded",SHFONT,right,cols=11
	text 37,61,"Net Pay",SHFONT,right,cols=10
	text 48,61,"YTD Earn",SHFONT,right,cols=11
	text 60,61,"YTD Ded",SHFONT,right,cols=10
	text 71,61,"YTD Net Pay",SHFONT,right,cols=9
	cerase 69,61,MAXCOLS,61
	cfont 1,62,11,62,DFONT
	cfont 13,62,23,62,DFONT,right
	cfont 25,62,35,62,DFONT,right
	cfont 37,62,46,62,DFONT,right
	cfont 48,62,58,62,DFONT,right
	cfont 60,62,69,62,DFONT,right
	cfont 71,62,MAXRCOLS,62,DFONT,right
endif

##########################
# Module: Purchase Order #
##########################

[PO Purchase Order - 8.5 x 11]
# Tested OK with 6.1.1 9/21/01 - bcj
# adjusted detects for greater uniqueness - 06/25/01
# added e-mail and web site - 07/23/01
# adjusted PO # section to allow more space for company info - 07/23/01
detect 53,3,"~ [0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9]   DATEMASK"
detect 75,6,"~[0-9]"					# page #
detect 5,9,"~ [0-z]"					# cust name
const MAXCOLS=80
const MAXRCOLS=78
const MAXROWS=66
const LEFTCOL=.5
cols MAXCOLS
page MAXROWS
rows MAXROWS

const VENDOR_COPY=1
const FILE_COPY=2
pcopies 2
vshift 2

prepage {
	pono$=trim(get(54,3,8))
	podate$=trim(get(65,3,10))
	reqdate$=trim(get(54,6,10))
	location$=trim(get(66,6,6))
	pageno$=trim(get(75,6,3))
	x$=set(1,15,10,"")
}

# Title area
text 1,2.25,"Purchase Order",univers,18,bold,right,cols=MAXRCOLS
LOGO_IMAGE 1,1,10,6,COMP_LOGO
text 1,2.25,"COMP_NAME",univers,15,bold,center,cols=MAXRCOLS
text 1,3.35,"COMP_ADDR1",univers,12,center,cols=MAXRCOLS
text 1,4.35,"COMP_ADDR2",univers,12,center,cols=MAXRCOLS
text 1,5.35,"COMP_PHONES",univers,12,center,cols=MAXRCOLS
text 1,6.25,"COMP_EMAIL",univers,10,center,cols=MAXRCOLS
text 1,7.25,"COMP_WEBSITE",univers,10,center,cols=MAXRCOLS

# upper right info
const DFONT=cgtimes,10,bold
const HFONT=univers,10,italic
const SHADE=10
cbox 60,4.5,MAXCOLS,9.5
cbox 60,4.5,72,9.5,1,SHADE
cbox 60,5.5,MAXCOLS,6.5
cbox 60,7.5,MAXCOLS,8.5
cerase 54,3,MAXCOLS,6
text 61,5,"PO Number",HFONT
text 61,6,"PO Date",HFONT
text 61,7,"Req'd Ship Date",HFONT
text 61,8,"Location",HFONT
text 61,9,"Page",HFONT
text 73,5,{pono$},DFONT
text 73,6,{podate$},DFONT
text 73,7,{reqdate$},DFONT
text 73,8,{Location$},DFONT
text 73,9,{Pageno$},DFONT

# Address section
cbox LEFTCOL,10,MAXCOLS,20
cbox LEFTCOL,10,5,20,1,SHADE
cbox 40.5,10,45,20,1,SHADE
text 1,11,"Vendor",HFONT
text 41.5,11,"Ship",HFONT
text 41.5,12,"To",HFONT
cfont 6,11,39,19,DFONT
cfont 46,11,79,19,DFONT

# ribbon info
cbox LEFTCOL,20,MAXCOLS,21.5,1,SHADE
cbox LEFTCOL,21.5,MAXCOLS,23
box 21,20,1,3
box 40,20,1,3
box 59,20,1,3
text 1,21,"Ordered By",HFONT
text 22,21,"Ship Via",HFONT
text 41,21,"F.O.B.",HFONT
text 60,21,"Terms Description",HFONT
cfont 1,22,20,22,DFONT
cfont 22,22,39,22,DFONT
cfont 41,22,58,22,DFONT
cfont 60,22,MAXCOLS,22,DFONT

# line detail
cbox LEFTCOL,23,MAXCOLS,24.5,1,SHADE
cbox LEFTCOL,24.5,MAXCOLS,51
box 6,23,1,28
box 34,23,1,28
box 48,23,1,28
box 62,23,1,28
text 1,24,"Entry #",HFONT
text 7,24,"Item ID",HFONT
text 28,24,"U/M",HFONT
text 35,24,"Unit Price",HFONT,right,cols=13
text 49,24,"Ordered Quantity",HFONT,right,cols=13
text 63,24,"Extension",HFONT,right,cols=15
PO_CFONT 2,25,4,50,DFONT
PO_FONT "~ [0-9]@1,23,2,48",6,2,18,1,DFONT
PO_FONT "~ [0-9]@1,23,2,48",27,2,3,1,DFONT
PO_CFONT 35,25,47,50,DFONT,right
PO_CFONT 49,25,61,50,DFONT,right
PO_CFONT 63,25,77,50,DFONT,right
PO_FONT "  @1,23,2,48",6,2,35,1,DFONT

# message area
cbox LEFTCOL,51,MAXCOLS,53
cfont 1,52,48,52,DFONT
cfont 50,52,60,52,DFONT,right
cfont 63,52,77,52,DFONT,right

# sub totals
cbox LEFTCOL,53,MAXCOLS,54.5,1,SHADE
cbox LEFTCOL,54.5,MAXCOLS,56
box 15,53,1,3
box 30,53,1,3
box 45,53,1,3
box 60,53,1,3
text 1,54,"Tax",HFONT,right,cols=14
text 16,54,"Freight",HFONT,right,cols=14
text 31,54,"Misc.",HFONT,right,cols=14
text 46,54,"Prepaid",HFONT,right,cols=14
text 61,54,"Grand Total",HFONT,bold,right,cols=17
cfont 1,55,14,55,DFONT,right
cfont 16,55,29,55,DFONT,right
cfont 31,55,44,55,DFONT,right
cfont 46,55,59,55,DFONT,right
cfont 61,55,77,55,DFONT,right

# approval line
cbox 55,60,MAXCOLS,60
text 55.5,60.75,"Received by",HFONT,10
cbox 55,64,MAXCOLS,64
text 55.5,64.75,"Authorized Signature",HFONT,10
if copy VENDOR_COPY
	text 1,65.5,"Vendor Copy",univers,12,bold,center,cols=MAXRCOLS
endif
if copy FILE_COPY
	text 1,65.5,"Accounting Copy",univers,12,bold,center,cols=MAXRCOLS
endif

[PO Purchase Order - laser]
# Tested OK with 6.1.1 9/21/01 - bcj
# adjusted detects for greater uniqueness - 06/25/01
# added e-mail and web site - 07/23/01
# adjusted PO # section to allow more space for company info - 07/23/01
detect 53,4,"~ [0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9]   DATEMASK"
detect 75,7,"~[0-9]"					# page #
detect 5,10,"~ [0-z]"					# cust name
const MAXCOLS=80
const MAXRCOLS=78
const MAXROWS=66
const LEFTCOL=.5
cols MAXCOLS
page MAXROWS
rows MAXROWS

const VENDOR_COPY=1
const FILE_COPY=2
pcopies 2
vshift 1

prepage {
	pono$=trim(get(54,4,8))
	podate$=trim(get(65,4,10))
	reqdate$=trim(get(54,7,10))
	location$=trim(get(66,7,6))
	pageno$=trim(get(75,7,3))
	x$=set(1,16,10,"")
}

# Title area
text 1,2.25,"Purchase Order",univers,18,bold,right,cols=MAXRCOLS
LOGO_IMAGE 1,1,10,6,COMP_LOGO
text 1,2.25,"COMP_NAME",univers,15,bold,center,cols=MAXRCOLS
text 1,3.35,"COMP_ADDR1",univers,12,center,cols=MAXRCOLS
text 1,4.35,"COMP_ADDR2",univers,12,center,cols=MAXRCOLS
text 1,5.35,"COMP_PHONES",univers,12,center,cols=MAXRCOLS
text 1,6.25,"COMP_EMAIL",univers,10,center,cols=MAXRCOLS
text 1,7.25,"COMP_WEBSITE",univers,10,center,cols=MAXRCOLS

# upper right info
const DFONT=cgtimes,10,bold
const HFONT=univers,10,italic
const SHADE=10
cbox 60,4.5,MAXCOLS,9.5
cbox 60,4.5,72,9.5,1,SHADE
cbox 60,5.5,MAXCOLS,6.5
cbox 60,7.5,MAXCOLS,8.5
cerase 54,4,MAXCOLS,7
text 61,5,"PO Number",HFONT
text 61,6,"PO Date",HFONT
text 61,7,"Req'd Ship Date",HFONT
text 61,8,"Location",HFONT
text 61,9,"Page",HFONT
text 73,5,{pono$},DFONT
text 73,6,{podate$},DFONT
text 73,7,{reqdate$},DFONT
text 73,8,{Location$},DFONT
text 73,9,{Pageno$},DFONT

# Address section
cbox LEFTCOL,10,MAXCOLS,20
cbox LEFTCOL,10,5,20,1,SHADE
cbox 40.5,10,45,20,1,SHADE
text 1,11,"Vendor",HFONT
text 41.5,11,"Ship",HFONT
text 41.5,12,"To",HFONT
cfont 6,11,39,19,DFONT
cfont 46,11,79,19,DFONT

# ribbon info
cbox LEFTCOL,20,MAXCOLS,21.5,1,SHADE
cbox LEFTCOL,21.5,MAXCOLS,23
box 21,20,1,3
box 40,20,1,3
box 59,20,1,3
text 1,21,"Ordered By",HFONT
text 22,21,"Ship Via",HFONT
text 41,21,"F.O.B.",HFONT
text 60,21,"Terms Description",HFONT
cfont 1,22,20,22,DFONT
cfont 22,22,39,22,DFONT
cfont 41,22,58,22,DFONT
cfont 60,22,79,22,DFONT

# line detail
cbox LEFTCOL,23,MAXCOLS,24.5,1,SHADE
cbox LEFTCOL,24.5,MAXCOLS,51
box 6,23,1,28
box 34,23,1,28
box 48,23,1,28
box 62,23,1,28
text 1,24,"Entry #",HFONT
text 7,24,"Item ID",HFONT
text 28,24,"U/M",HFONT
text 35,24,"Unit Price",HFONT,right,cols=13
text 49,24,"Ordered Quantity",HFONT,right,cols=13.5
text 63,24,"Extension",HFONT,right,cols=15
PO_CFONT 2,25,4,50,DFONT
PO_FONT "~ [0-9]@1,23,2,48",6,1,18,1,DFONT
PO_FONT "~ [0-9]@1,23,2,48",27,1,3,1,DFONT
PO_CFONT 35,25,47,50,DFONT,right
PO_CFONT 49,25,61,50,DFONT,right
PO_CFONT 63,25,77,50,DFONT,right
PO_FONT "  @1,23,2,48",6,1,35,1,DFONT

# message area
cbox LEFTCOL,51,MAXCOLS,53
cfont 1,52,48,52,DFONT
cfont 50,52,60,52,DFONT,right
cfont 63,52,77,52,DFONT,right

# sub totals
cbox LEFTCOL,53,MAXCOLS,54.5,1,SHADE
cbox LEFTCOL,54.5,MAXCOLS,56
box 15,53,1,3
box 30,53,1,3
box 45,53,1,3
box 60,53,1,3
text 1,54,"Tax",HFONT,right,cols=14
text 16,54,"Freight",HFONT,right,cols=14
text 31,54,"Misc.",HFONT,right,cols=14
text 46,54,"Prepaid",HFONT,right,cols=14
text 61,54,"Grand Total",HFONT,bold,right,cols=16
cfont 1,55,14,55,DFONT,right
cfont 16,55,29,55,DFONT,right
cfont 31,55,44,55,DFONT,right
cfont 46,55,59,55,DFONT,right
cfont 61,55,77,55,DFONT,right

# approval line
cbox 55,60,MAXCOLS,60
text 55.5,60.75,"Received by",HFONT,10
cbox 55,64,MAXCOLS,64
text 55.5,64.75,"Authorized Signature",HFONT,10
if copy VENDOR_COPY
	text 1,65.5,"Vendor Copy",univers,12,bold,center,cols=MAXRCOLS
endif
if copy FILE_COPY
	text 1,65.5,"Accounting Copy",univers,12,bold,center,cols=MAXRCOLS
endif

[PO Purchase Order - std]
# Tested OK with 6.1.1 9/21/01 - bcj
# added e-mail and web site - 07/23/01
detect 0,1,"~[0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9]"
detect 0,8,"~DATEMASK"
const MAXCOLS=108
const MAXRCOLS=106
const MAXROWS=66
const LEFTCOL=.5
cols MAXCOLS
page MAXROWS
rows MAXROWS

const VENDOR_COPY=1
const FILE_COPY=2
pcopies 2

prepage {
	pono$=trim(get(69,1,8))
	pageno$=trim(get(80,1,6))
	req_ship_date$=trim(get(69,4,10))
	date$=trim(get(1,8,10))
	ordered_by$=trim(get(12,8,20))
	terms$=trim(get(33,8,13))
	fob$=trim(get(47,8,20))
	ship_via$=trim(get(68,8,20))
	x$=set(1,17,15,"")
}

# Title area
cerase 1,1,MAXCOLS,10
text 1,2.25,"Purchase Order",univers,18,bold,right,cols=MAXRCOLS
LOGO_IMAGE 1,1,12,6,COMP_LOGO
text 1,2.25,"COMP_NAME",univers,15,bold,center,cols=MAXRCOLS
text 1,3.35,"COMP_ADDR1",univers,12,center,cols=MAXRCOLS
text 1,4.35,"COMP_ADDR2",univers,12,center,cols=MAXRCOLS
text 1,5.35,"COMP_PHONES",univers,12,center,cols=MAXRCOLS
text 1,6.25,"COMP_EMAIL",univers,10,center,cols=MAXRCOLS
text 1,7.25,"COMP_WEBSITE",univers,10,center,cols=MAXRCOLS

# upper right info
const DFONT=cgtimes,9,bold
const HFONT=univers,9,italic
const SHADE=10
cbox 81,3,MAXRCOLS,4.5,1,SHADE
cbox 81,4.5,MAXRCOLS,6
cbox 81,6,MAXRCOLS,7.5,1,SHADE
cbox 81,7.5,MAXRCOLS,9
box 94,3,1,3
box 100,6,1,3
text 82,4,"PO Number",HFONT,center,cols=12
text 95,4,"PO Date",HFONT,center,cols=12
text 82,7,"Req'd Ship Date",HFONT,center,cols=18
text 101,7,"Page",HFONT,center,cols=5
text 82,5,{pono$},DFONT,center,cols=12
text 95,5,{date$},DFONT,center,cols=12
text 82,8,{req_ship_date$},DFONT,center,cols=18
text 101,8,{pageno$},DFONT,center,cols=5

# Address section
cbox LEFTCOL,10,MAXCOLS,19
cbox LEFTCOL,10,5,19,1,SHADE
cbox 45,10,50,19,1,SHADE
text 1,11,"Vend",HFONT
text 46,11,"Ship",HFONT
text 46,12,"To",HFONT
cfont 6,11,44,18,DFONT
cfont 51,11,85,18,DFONT

# ribbon info
cbox 86,10,MAXCOLS,19
cbox 86,10,MAXCOLS,11.5,1,SHADE,bottom 0
cbox 86,12.5,MAXCOLS,13.5,1,SHADE,bottom 0
cbox 86,14.5,MAXCOLS,15.5,1,SHADE,bottom 0
cbox 86,16.5,MAXCOLS,17.5,1,SHADE,bottom 0
text 87,11,"Ordered by",HFONT
text 87,12,{ordered_by$},DFONT
text 87,13,"FOB",HFONT
text 87,14,{fob$},DFONT,8
text 87,15,"Ship Via",HFONT
text 87,16,{ship_via$},DFONT,8
text 87,17,"Terms Description",HFONT
text 87,18,{terms$},DFONT

# line detail
cbox LEFTCOL,19,MAXCOLS,21,1,SHADE
cbox LEFTCOL,21,MAXCOLS,50
cbox 5,19,5,50
cbox 45,19,45,50
cbox 60,19,60,50
cbox 65,19,65,50
cbox 81,19,81,50
cbox 94,19,94,50
text 1,20,"Line",HFONT
text 6,20,"Item ID/Description",HFONT
text 46,20,"Unit Price",HFONT,right,cols=14
text 61,20,"U/M",HFONT
text 66,20,"Ordered",HFONT,right,cols=15
text 82,20,"Received",HFONT,right,cols=12
text 95,20,"BkOrdered",HFONT,right,cols=13
PO_CFONT 1,21,4,49,DFONT
PO_FONT "~[0-9]@1,21,1,49",5,0,18,1,DFONT
PO_FONT " @1,21,1,49",5,0,35,1,DFONT
PO_CFONT 46,21,59,49,DFONT,right
PO_CFONT 61,21,64,49,DFONT
PO_CFONT 66,21,80,49,DFONT,right
PO_CFONT 82,21,93,49,DFONT,right
PO_CFONT 95,21,107,49,DFONT,right

# sub totals
cbox LEFTCOL,50,MAXCOLS,51.5,1,SHADE
cbox LEFTCOL,51.5,MAXCOLS,53
box 15,50,1,3
box 30,50,1,3
box 45,50,1,3
box 60,50,1,3
box 75,50,1,3
cfont 1,51,14,51,HFONT,right
cfont 16,51,29,51,HFONT,right
cfont 31,51,44,51,HFONT,right
cfont 46,51,59,51,HFONT,right
cfont 61,51,74,51,HFONT,right
cfont 76,51,89,51,HFONT,right
cfont 1,52,14,52,DFONT,right
cfont 16,52,29,52,DFONT,right
cfont 31,52,44,52,DFONT,right
cfont 46,52,59,52,DFONT,right
cfont 61,52,74,52,DFONT,right
cfont 76,52,89,52,DFONT,right

# approval line & message area
cfont 1,53,MAXCOLS,59,DFONT
cbox 75,60,MAXCOLS,60
text 75.5,60.75,"Received by",HFONT,10
cbox 75,64,MAXCOLS,64
text 75.5,64.75,"Authorized Signature",HFONT,10
if copy VENDOR_COPY
	text 1,65.5,"Vendor Copy",univers,12,bold,center,cols=MAXRCOLS
endif
if copy FILE_COPY
	text 1,65.5,"Accounting Copy",univers,12,bold,center,cols=MAXRCOLS
endif

[PO Purchase Order - plain]
# Tested OK with 6.1.1 9/21/01 - bcj
# added e-mail and web site - 07/23/01
detect 0,1,"Purchase Order"
const MAXCOLS=112
const MAXRCOLS=110
const MAXROWS=66
const LEFTCOL=.5
cols MAXCOLS
page MAXROWS
rows MAXROWS

const VENDOR_COPY=1
const FILE_COPY=2
pcopies 2

prepage {
	if trim(get(1,1,40))<>"" then \
			comp_name$=trim(get(1,1,40)); \
			comp_addr1$=trim(get(1,2,40)); \
			comp_addr2$=trim(get(1,3,40)); \
			comp_phones$="" \
		else \
			comp_name$="COMP_NAME";\
			comp_addr1$="COMP_ADDR1";\
			comp_addr2$="COMP_ADDR2";\
			comp_phones$="COMP_PHONES"
	pono$=trim(get(69,4,8))
	pageno$=trim(get(80,4,6))
	req_ship_date$=trim(get(69,7,10))
	x$=set(1,20,15,"")
}

# Title area
cerase 1,1,MAXCOLS,9
text 1,2.25,"Purchase Order",univers,18,bold,right,cols=MAXRCOLS
LOGO_IMAGE 1,1,14,6,COMP_LOGO
text 1,2.25,{comp_name$},univers,15,bold,center,cols=MAXRCOLS
text 1,3.35,{comp_addr1$},univers,12,center,cols=MAXRCOLS
text 1,4.35,{comp_addr2$},univers,12,center,cols=MAXRCOLS
text 1,5.35,{comp_phones$},univers,12,center,cols=MAXRCOLS
text 1,6.25,"COMP_EMAIL",univers,10,center,cols=MAXRCOLS
text 1,7.25,"COMP_WEBSITE",univers,10,center,cols=MAXRCOLS

# upper right info
const DFONT=cgtimes,9,bold
const HFONT=univers,9,italic
const SHADE=10
cbox 95,3,MAXCOLS,4.5,1,SHADE
cbox 95,4.5,MAXCOLS,6
cbox 95,6,MAXCOLS,7.5,1,SHADE
cbox 95,7.5,MAXCOLS,9
box 105,3,1,3
text 96,4,"Number",HFONT,center,cols=9
text 106,4,"Page",HFONT,center,cols=6
text 96,7,"Req'd Ship Date",HFONT,center,cols=16
text 96,5,{pono$},DFONT,center,cols=9
text 106,5,{pageno$},DFONT,center,cols=6
text 96,8,{req_ship_date$},DFONT,center,cols=16

# ribbon section
cerase 1,12,MAXCOLS,12
cbox LEFTCOL,9.5,MAXCOLS,10.5,1,SHADE
cbox LEFTCOL,10.5,MAXCOLS,11.5
cbox 11,9.5,11,11.5
cbox 32,9.5,32,11.5
cbox 46,9.5,46,11.5
cbox 67,9.5,67,11.5
cfont 1,10,10,10,HFONT,center
cfont 12,10,31,10,HFONT
cfont 33,10,45,10,HFONT
cfont 47,10,66,10,HFONT
cfont 68,10,MAXCOLS,10,HFONT
cfont 1,11,10,11,HFONT,center
cfont 12,11,31,11,HFONT
cfont 33,11,45,11,HFONT,8
cfont 47,11,66,11,HFONT,7.5
cfont 68,11,MAXCOLS,11,HFONT

# Address section
cbox LEFTCOL,13.5,MAXCOLS,19
cbox LEFTCOL,13.5,10.5,19,1,SHADE
cbox 49.5,13.5,60,19,1,SHADE
cerase 1,13,10,19
cerase 50,13,59,19
text 1.5,14,"Vendor",HFONT
text 50.5,14,"Ship to",HFONT
cfont 12,13,48,19,DFONT					# vendor name & address
cfont 61,13,MAXCOLS,19,DFONT				# ship to name and address
cfont 11,20,MAXCOLS,21,HFONT				# special notes

# line detail
cerase 1,22,MAXCOLS,22
cerase 1,24,MAXCOLS,24
cbox LEFTCOL,22,MAXCOLS,24,1,SHADE
cbox "Subtotal@1,53",-5.5,-1.5,MAXCOLS,24
cbox "Subtotal@1,53",-1,-1.5,5,22
cbox "Subtotal@1,53",39,-1.5,45,22
cbox "Subtotal@1,53",54,-1.5,60,22
cbox "Subtotal@1,53",61,-1.5,67,22
cbox "Subtotal@1,53",74,-1.5,80,22
cbox "Subtotal@1,53",88,-1.5,94,22

cfont 1,23,4,23,HFONT,right						# line
cfont 6,23,44,23,HFONT							# item/description
cfont 46,23,59,23,HFONT,right						# unit price
cfont 61,23,66,23,HFONT,center					# units
cfont 68,23,79,23,HFONT,right						# ordered
cfont 81,23,93,23,HFONT,right						# received
cfont 95,23,111,23,HFONT,right					# backordered

PO_CFONT 1,25,4,52,DFONT,right					# line
PO_FONT "~[0-9]@1,25,1,52",5,0,18,1,DFONT				# item
PO_FONT " @1,25,1,52",5,0,35,1,DFONT				# description
PO_CFONT 46,25,59,52,DFONT,right					# unit price
PO_CFONT 61,25,66,52,DFONT,center					# units
PO_CFONT 68,25,79,52,DFONT,right					# ordered
PO_CFONT 81,25,93,52,DFONT,right					# received
PO_CFONT 95,25,111,52,DFONT,right					# backordered

# sub totals
erase "Subtotal@1,53",-5,2,MAXCOLS,1
box "Subtotal@1,53",-5.5,-1,90,1.51,1,SHADE
box "Subtotal@1,53",-5.5,.5,90,1.51
box "Subtotal@1,53",8,-1,1,3
box "Tax@1,53",3,-1,1,3
box "Freight@1,53",7,-1,1,3
box "Misc.@1,53",5,-1,1,3
box "Prepaid@1,53",7,-1,1,3

font "Subtotal@1,53",-5,0,13,1,HFONT,right
font "Tax@1,53",-11,0,14,1,HFONT,right
font "Freight@1,53",-7,0,14,1,HFONT,right
font "Misc.@1,53",-9,0,14,1,HFONT,right
font "Prepaid@1,53",-7,0,14,1,HFONT,right
font "Total@1,53",-10,0,15,1,HFONT,right

font "Subtotal@1,53",-5,1,13,1,DFONT,right
font "Tax@1,53",-11,1,14,1,DFONT,right
font "Freight@1,53",-7,1,14,1,DFONT,right
font "Misc.@1,53",-9,1,14,1,DFONT,right
font "Prepaid@1,53",-7,1,14,1,DFONT,right
font "Total@1,53",-10,1,15,1,DFONT,right

# approval line & message area
font "Comments:@1,55",0,0,9,1,HFONT
cerase 66,58,MAXCOLS,63
cbox 75,60,MAXCOLS,60
text 75.5,60.75,"Received by",HFONT,10
cbox 75,64,MAXCOLS,64
text 75.5,64.75,"Authorized Signature",HFONT,10
if copy VENDOR_COPY
	text 1,65.5,"Vendor Copy",univers,12,bold,center,cols=MAXRCOLS
endif
if copy FILE_COPY
	text 1,65.5,"Accounting Copy",univers,12,bold,center,cols=MAXRCOLS
endif

#######################
# Module: Sales Order #
#######################

[SO Invoice - 8.5 x 11]
# Tested OK with 6.1.1 9/21/01 - bcj
# handles invoice, quote, credit memo
# changed detects to pick up date and not invoice # - 05/29/01
# added ability to handle multi-page invoice - 06/05/01
# added e-mail and web site - 07/23/01
detect 62,6,"~ DATEMASK "
detect 77,17,"~\.[0-9][0-9]"
const MAXCOLS=80
const MAXRCOLS=78
const LEFTCOL=1
const MAXROWS=66
cols MAXCOLS
rows MAXROWS

# copies 1,2 have totals, 3,4 have continued
const CUSTOMER_COPY=1,3
const FILE_COPY=2,4
const TOTALS_COPY=1,2
const CONT_COPY=3,4
const TOTALS_PAGE=5
pcopies 5

prepage {
	invno$=trim(get(52,6,8))
	invdate$=trim(get(63,6,8))
	pageno$=trim(get(72,6,7))
	custno$=trim(get(6,10,6));x$=set(6,10,6,"")
	due$=trim(get(70,17,11)),x$=set(70,17,11,"")
	shipto$=trim(get(41,10,6))
	if shipto$<>"" then shipto$="Your ship to code is "+shipto$
	title$="INVOICE"
	# get title from body of invoice, if available.  
	# Must handle credit memo text.
	x$=trim(get(13,10,26)); y$=set(13,10,60,"")
	# replace dbl space with ff's before removing single spaces
	x=pos("  "=x$)
	while x>0
		x$(x,1)=$ff$
		x=pos("  "=x$)
	wend
	# remove <'s and >'s and extra spaces
	x=pos("<"=x$)
	if x=0 then x=pos(">"=x$)
	if x=0 then x=pos(" "=x$)
	while x>0
		x$=trim(x$(1,x-1)+x$(x+1))
		x=pos("<"=x$)
		if x=0 then x=pos(">"=x$)
		if x=0 then x=pos(" "=x$)
	wend
	# now remove ff's	
	x=pos($ff$=x$)
	while x>0
		x$(x,1)=""
		x=pos($ff$=x$)
	wend
	if x$>"" then title$=x$
	# create phrase for invoices
	totaldue$=""
	if title$="INVOICE" totaldue$="The total due on this invoice is $"+ \
						due$+"."

	# look for continued
	cont$="N"
	for i=50 to 66
		x=pos("(continued on next page)"=text$[i])
		if x then cont$="Y";x$=set(x,i,24,"");exitto exit_loop
	next i
exit_loop:

	amount_paid$=trim(get(23,61,11))
	amt_paid$=trim(get(36,61,15))
	net_due$=trim(get(58,61,7))
	nt_due$=trim(get(67,61,14))
	if amount_paid$="" then goto no_amount_paid
	x$=set(1,61,MAXCOLS,"")
	exec("cbox 61,61,70,64,1,10")
	exec("cbox 70,61,MAXCOLS,64")
	exec("cbox 61,62.5,MAXCOLS,64")
	exec("text 62,62,"+$22$+amount_paid$+$22$+",univers,10,italic")
	exec("text 71,62,"+$22$+amt_paid$+$22$+",cgtimes,10,bold,right,cols=9")
	exec("text 62,63.5,"+$22$+net_due$+$22$+",univers,10,bold,italic")
	exec("text 71,63.5,"+$22$+nt_due$+$22$+",cgtimes,10,bold,right,cols=9")
no_amount_paid:

	# mark line types (D=detail, L=lot, R=remark/desc, S=serial
	for i=28 to 54
		if mid(text$[i],4,3)="Lot" and mid(text$[i],38,7)="Ordered" then \
			text$[i](1,1)="L";i=i+1, \
			text$[i](1,1)="L";goto bottom_loop
		if mid(text$[i],6,3)="Ser" and mid(text$[i],61,1)="." then \
			text$[i](1,1)="S";goto bottom_loop
		if mid(text$[i],77,1)="." then \
			text$[i](1,1)="D";goto bottom_loop
		# must be remark
		if text$[i]<>"" then text$[i](1,1)="R"
bottom_loop:
	next i
}

precopy {
	x$=trim(get(1,21,MAXCOLS))
	if copy=1 or copy=2 then if cont$="Y" then skip=1
	if copy=3 or copy=4 then if cont$="N" then skip=1
	if copy=5 and x$<>"Run Totals:" then skip=1
	if copy<5 and x$="Run Totals:" then skip=1
	if copy=5 then title$="Summary"
}

# Title area
cbox LEFTCOL,1,MAXCOLS,MAXROWS
cbox LEFTCOL,1,MAXCOLS,10
erase 1,1,MAXCOLS,6
text 1,2.25,{title$},univers,18,bold,right,cols=MAXRCOLS
LOGO_IMAGE 1,1,11,6,COMP_LOGO
text 1,2.25,"COMP_NAME",univers,15,bold,center,cols=MAXCOLS
text 1,3.35,"COMP_ADDR1",univers,12,center,cols=MAXCOLS
text 1,4.35,"COMP_ADDR2",univers,12,center,cols=MAXCOLS
text 1,5.35,"COMP_PHONES",univers,12,center,cols=MAXCOLS
text 1,6.25,"COMP_EMAIL",univers,10,center,cols=MAXRCOLS
text 1,7.25,"COMP_WEBSITE",univers,10,center,cols=MAXRCOLS

	
if copy 1,2,3,4
	# Invoice block
	const HFONT=univers,10,italic
	const DFONT=cgtimes,10,bold
	const SHADE=10
	cbox 66,4,72,10,1,SHADE
	cbox 72,4,MAXCOLS,10
	cbox 66,6,MAXCOLS,8
	text 67,5,"Invoice",HFONT
	text 67,7,"Date",HFONT
	text 67,9,"Page",HFONT
	text 73,5,{invno$},DFONT
	text 73,7,{invdate$},DFONT
	text 73,9,{pageno$},DFONT
end if

if copy 1,2,3,4
	# sold to region
	cbox LEFTCOL,10,MAXCOLS,20
	cbox LEFTCOL,10,5,20,1,SHADE
	text 2,11,"Sold",HFONT,center,cols=3
	text 2,12,"To",HFONT,center,cols=3
	cfont 6,11,39,18,DFONT							# name & addr
	text 6,19,{"Your customer code is "+custno$},DFONT
end if

if copy 1,2,3,4
	# ship to region
	cbox 40,10,44,20,1,SHADE
	text 41,11,"Ship",HFONT,center,cols=3
	text 41,12,"To",HFONT,center,cols=3
	cfont 45,11,MAXRCOLS,18,DFONT						# name & addr
	text 45,18,{shipto$},DFONT
	text 45,19,{totaldue$},DFONT
end if

if copy 1,2,3,4
	# subhead 1
	cbox LEFTCOL,20,MAXCOLS,21.5,1,SHADE
	cbox LEFTCOL,21.5,MAXCOLS,23
	cbox 7,20,13,23
	cbox 25,20,37,23
	cbox 46,20,58,23
	cbox 70,20,70,23
	text 2,21,"Slsp 1",HFONT,center,cols=5
	text 8,21,"Slsp 2",HFONT,center,cols=5
	text 14,21,"Due Date",HFONT,center,cols=11
	text 26,21,"Disc Due Date",HFONT,center,cols=11
	text 38,21,"Order No",HFONT,center,cols=8
	text 47,21,"Order Date",HFONT,center,cols=11
	text 59,21,"Ship Date",HFONT,center,cols=11
	text 71,21,"Ship No",HFONT
	cfont 2,22,6,22,DFONT,center						# slsp 1
	cfont 8,22,12,22,DFONT,center						# slsp 2
	cfont 14,22,24,22,DFONT,center					# due date
	cfont 26,22,36,22,DFONT,center					# dsc due date
	cfont 38,22,45,22,DFONT,center					# order #
	cfont 47,22,57,22,DFONT,center					# order date
	cfont 59,22,69,22,DFONT,center					# ship date
	cfont 71,22,MAXRCOLS,22,DFONT						# ship #
end if

if copy 1,2,3,4
	# subhead 2
	cbox LEFTCOL,23,MAXCOLS,24.5,1,SHADE
	cbox LEFTCOL,24.5,MAXCOLS,26
	cbox 18,23,45,26
	text 2,24,"Terms Description",HFONT
	text 19,24,"Customer PO No",HFONT
	text 46,24,"Ship Via",HFONT
	cfont 2,25,17,25,DFONT							# terms
	cfont 19,25,44,25,DFONT							# cust po
	cfont 46,25,65,25,DFONT							# ship via
end if

if copy 1,2,3,4
	# items
	cbox LEFTCOL,26,MAXCOLS,27.5,1,SHADE
	cbox LEFTCOL,27.5,MAXCOLS,55
	cbox 22,26,25,55
	cbox 31,26,42,55
	cbox 54,26,66,55
	text 2,27,"Item Information",HFONT
	text 23,27,"Tx",HFONT,center,cols=2
	text 26,27,"U/M",HFONT,center,cols=5
	text 32,27,"Ordered",HFONT,right,cols=10
	text 43,27,"Shipped",HFONT,right,cols=11
	text 55,27,"Unit Price",HFONT,right,cols=11
	text 67,27,"Extension",HFONT,right,cols=13

	# item line
	SO_INV_FONT "D@1,28,1,54",1,0,20,1,DFONT				# part #
	SO_INV_FONT "D@1,28,1,54",22,0,2,1,DFONT,center			# tx
	SO_INV_FONT "D@1,28,1,54",25,0,5,1,DFONT,center			# um
	SO_INV_FONT "D@1,28,1,54",31,0,10,1,DFONT,right			# qty ordered
	SO_INV_FONT "D@1,28,1,54",42,0,11,1,DFONT,right			# qty shipped
	SO_INV_FONT "D@1,28,1,54",54,0,11,1,DFONT,right			# price
	SO_INV_FONT "D@1,28,1,54",66,0,13,1,DFONT,right			# extension

	# lot line
	SO_INV_FONT "L@1,28,1,54",3,0,3,1,HFONT,right			# lot
	SO_INV_FONT "L@1,28,1,54",7,0,20,1,DFONT				# lot id
	SO_INV_FONT "L@1,28,1,54",37,0,9,1,HFONT				# lot ord/ship
	SO_INV_FONT "L@1,28,1,54",46,0,13,1,DFONT,right			# lot qty
	SO_INV_FONT "L@1,28,1,54",60,0,10,1,HFONT				# lot uom

	# ser line
	SO_INV_FONT "S@1,28,1,54",5,0,3,1,HFONT,right			# ser
	SO_INV_FONT "S@1,28,1,54",9,0,20,1,DFONT				# ser id
	SO_INV_FONT "S@1,28,1,54",54,0,11,1,DFONT,right			# ser price

	# description
	SO_INV_FONT "R@1,28,1,54",1,0,77,1,DFONT				# description
	cerase 1,28,1,54
end if

if copy 5
	cfont 21,21,40,50,HFONT
	cfont 42,21,53,50,DFONT,right
	cfont 54,21,54,50,DFONT,black
	bold "Total",-5,0,25,1
end if

# message area
if copy TOTALS_COPY
	cbox LEFTCOL,55,MAXCOLS,58
	cfont 1,56,MAXCOLS,56,DFONT						# msg lines
	cfont 1,57,55,57,DFONT							# msg lines
	cfont 57,57,66,57,DFONT,right						# subtotal:
	cfont 67,57,79,57,DFONT,right						# subtotal amt
end if
if copy CONT_COPY
	cfont 1,56,MAXCOLS,57,DFONT						# msg lines
end if

# totals
if copy TOTALS_COPY
	cbox LEFTCOL,58,MAXCOLS,59.5,1,SHADE
	cbox LEFTCOL,59.5,MAXCOLS,61
	cbox 15,58,28,61
	cbox 41,58,54,61
	cbox 67,58,67,61
	text 3,59,"Taxable",HFONT,right,cols=12
	text 16,59,"Non-Taxable",HFONT,right,cols=12
	text 29,59,"Freight",HFONT,right,cols=12
	text 42,59,"Sales Tax",HFONT,right,cols=12
	text 55,59,"Misc Charge",HFONT,right,cols=12
	text 68,59,"Grand Total",HFONT,bold,right,cols=12
	cfont 3,60,14,60,DFONT,right						# taxable
	cfont 16,60,27,60,DFONT,right						# non-taxable
	cfont 29,60,40,60,DFONT,right						# freight
	cfont 42,60,53,60,DFONT,right						# sales tax
	cfont 55,60,66,60,DFONT,right						# misc
	cfont 68,60,79,60,DFONT,right						# grand total
end if
if copy CONT_COPY
	text 1,63,"Continued on next page.",univers,12,center,cols=MAXCOLS
end if

if copy CUSTOMER_COPY
	text 1,65,"Customer Copy",univers,12,bold,center,cols=MAXCOLS
endif
if copy FILE_COPY
	text 1,65,"Accounting Copy",univers,12,bold,center,cols=MAXCOLS
endif

[SO Invoice - laser]
# Tested OK with 6.1.1 9/21/01 - bcj
# handles invoice, quote, credit memo
# changed detects to pick up date and not invoice # - 05/29/01
# added ability to handle multi-page invoice - 06/05/01
# added e-mail and web site - 07/23/01
detect 111,6,"~ DATEMASK"
detect 0,17,"~\.[0-9][0-9]"
const MAXCOLS=132
const MAXRCOLS=130
const MAXROWS=66
const LEFTCOL=1
cols MAXCOLS
rows MAXROWS

# copies 1,2 have totals, 3,4 have continued
const CUSTOMER_COPY=1,3
const FILE_COPY=2,4
const TOTALS_COPY=1,2
const CONT_COPY=3,4
pcopies 4

prepage {
	invno$=trim(get(112,7,8));x$=set(112,7,8,"")
	invdate$=trim(get(112,6,8));x$=set(112,6,8,"")
	pageno$=trim(get(112,4,7));x$=set(112,4,7,"")
	custno$=trim(get(10,10,6));x$=set(10,10,6,"")
	due$=trim(get(110,17,12)),x$=set(110,17,12,"")
	shipto$=trim(get(45,10,10))
	if shipto$<>"" then shipto$="Your ship to code is "+shipto$
	title$="INVOICE"
	reprint$=""
	# get title from body of invoice, if available.  
	# Must handle credit memo text.
	x$=trim(get(18,10,26)); y$=set(18,10,100,"")
	# replace dbl space with ff's before removing single spaces
	x=pos("  "=x$)
	while x>0
		x$(x,1)=$ff$
		x=pos("  "=x$)
	wend
	# remove <'s and >'s and extra spaces
	x=pos("<"=x$)
	if x=0 then x=pos(">"=x$)
	if x=0 then x=pos(" "=x$)
	while x>0
		x$=trim(x$(1,x-1)+x$(x+1))
		x=pos("<"=x$)
		if x=0 then x=pos(">"=x$)
		if x=0 then x=pos(" "=x$)
	wend
	# now remove ff's	
	x=pos($ff$=x$)
	while x>0
		x$(x,1)=""
		x=pos($ff$=x$)
	wend
	if x$>"" then title$=x$
	# create phrase for invoices
	totaldue$=""
	if title$="INVOICE" totaldue$="The total due is $"+due$+"."
	x=pos("REPRINT"=title$)
	if x then title$="INVOICE";reprint$="REPRINT"

	amount_paid$=trim(get(10,60,20))
	amt_paid$=trim(get(31,60,20))
	net_due$=trim(get(50,60,20))
	nt_due$=trim(get(70,60,20))
	if amount_paid$="" then goto no_amount_paid
	amount_paid$=amount_paid$(1,len(amount_paid$)-1)	# remove colon
	net_due$=net_due$(1,len(net_due$)-1)			# remove colon
	exec("cbox 91,61,114,64,1,10")
	exec("cbox 114,61,MAXCOLS,64")
	exec("cbox 91,62.5,MAXCOLS,64")
	exec("text 92,62,"+$22$+amount_paid$+$22$+",univers,10,italic")
	exec("text 118,62,"+$22$+amt_paid$+$22$+",cgtimes,10,bold,right,cols=14")
	exec("text 92,63.5,"+$22$+net_due$+$22$+",univers,10,bold,italic")
	exec("text 118,63.5,"+$22$+nt_due$+$22$+",cgtimes,10,bold,right,cols=14")
no_amount_paid:

	# look for continued
	cont$="N"
	for i=50 to 66
		x=pos("(continued on next page)"=text$[i])
		if x then cont$="Y";x$=set(x,i,24,"");exitto exit_loop
	next i
exit_loop:

	# mark line types (D=detail, L=lot, R=remark/desc, S=serial
	for i=28 to 54
		if mid(text$[i],4,3)="Lot" and mid(text$[i],46,7)="Ordered" then \
			text$[i](1,1)="L";i=i+1, \
			text$[i](1,1)="L";goto bottom_loop
		if mid(text$[i],6,3)="Ser" and mid(text$[i],107,1)="." then \
			text$[i](1,1)="S";goto bottom_loop
		if mid(text$[i],128,1)="." then \
			text$[i](1,1)="D";goto bottom_loop
		# must be remark
		if text$[i]<>"" then text$[i](1,1)="R"
bottom_loop:
	next i
}

precopy {
	if copy=1 or copy=2 then if cont$="Y" then skip=1
	if copy=3 or copy=4 then if cont$="N" then skip=1
}

# Title area
cbox LEFTCOL,1,MAXCOLS,MAXROWS
cbox LEFTCOL,1,MAXCOLS,10
erase 1,1,MAXCOLS,6
text 1,2.25,{title$},univers,18,bold,right,cols=MAXRCOLS
text 1,3.25,{reprint$},univers,12,right,cols=MAXRCOLS
LOGO_IMAGE 1,1,14,6,COMP_LOGO
text 1,2.25,"COMP_NAME",univers,15,bold,center,cols=MAXCOLS
text 1,3.35,"COMP_ADDR1",univers,12,center,cols=MAXCOLS
text 1,4.35,"COMP_ADDR2",univers,12,center,cols=MAXCOLS
text 1,5.35,"COMP_PHONES",univers,12,center,cols=MAXCOLS
text 1,6.25,"COMP_EMAIL",univers,10,center,cols=MAXRCOLS
text 1,7.25,"COMP_WEBSITE",univers,10,center,cols=MAXRCOLS

# Invoice block
const HFONT=univers,9,italic
const DFONT=cgtimes,9,bold
const SHADE=10
cbox 111,4,120,10,1,SHADE
cbox 120,4,MAXCOLS,10
cbox 111,6,MAXCOLS,8
text 112,9,"Page",HFONT
text 112,7,"Date",HFONT
text 112,5,"Invoice",HFONT
text 121,5,{invno$},DFONT
text 121,7,{invdate$},DFONT
text 121,9,{pageno$},DFONT

# sold to
cbox LEFTCOL,10,MAXCOLS,20
cbox LEFTCOL,10,9,20,1,SHADE
text 2,11,"Sold",HFONT,center,cols=7
text 2,12,"To",HFONT,center,cols=7
cfont 10,11,65,18,DFONT							# sold to addr
text 10,19,{"Your customer code is "+custno$},DFONT

# ship to
cbox 66.5,10,75,20,1,SHADE
text 68,11,"Ship",HFONT,center,cols=7
text 68,12,"To",HFONT,center,cols=7
cfont 76,11,MAXRCOLS,18,DFONT						# ship to addr
text 76,18,{shipto$},DFONT
text 76,19,{totaldue$},DFONT

# subhead 1
cbox LEFTCOL,20,MAXCOLS,21.5,1,SHADE
cbox LEFTCOL,21.5,MAXCOLS,23
box 7,20,1,3
box 1320,1,3
box 24,20,1,3
box 38,20,1,3
box 60,20,1,3
box 78,20,1,3
box 96,20,1,3
box 119,20,1,3
text 2,21,"Slsp1",HFONT,center,cols=5
text 8,21,"Slsp2",HFONT,center,cols=5
text 25,21,"Due Date",HFONT,center,cols=12
text 39,21,"Disc Due Date",HFONT,center,cols=20
text 61,21,"Order No",HFONT,center,cols=17
text 79,21,"Order Date",HFONT,center,cols=16
text 97,21,"Ship Date",HFONT,center,cols=21
text 120,21,"Ship No",HFONT
cfont 2,22,6,22,DFONT,center						# slsp 1
cfont 8,22,23,22,DFONT,center						# slsp 2
cfont 25,22,37,22,DFONT,center					# due date
cfont 39,22,59,22,DFONT,center					# disc due date
cfont 61,22,77,22,DFONT,center					# order #
cfont 79,22,95,22,DFONT,center					# order date
cfont 97,22,118,22,DFONT,center					# ship date
cfont 120,22,MAXRCOLS,22,DFONT,left					# ship #

# subhead 2
cbox LEFTCOL,24.5,MAXCOLS,26
cbox LEFTCOL,23,MAXCOLS,24.5,1,SHADE
box 32,23,1,3
box 78,23,1,3
text 2,24,"Terms Description",HFONT
text 33,24,"Customer PO No",HFONT
text 79,24,"Ship Via",HFONT
cfont 2,25,29,24,DFONT							# terms
cfont 33,25,57,24,DFONT							# cust po
cfont 79,25,MAXCOLS,24,DFONT						# ship via

# items
cbox LEFTCOL,26,MAXCOLS,27.5,1,SHADE
cbox LEFTCOL,27.5,MAXCOLS,55
box 40,26,1,29
box 44,26,1,29
box 50,26,1,29
box 71,26,1,29
box 92,26,1,29
box 113,26,1,29
text 2,27,"Item Information",HFONT
text 41,27,"Tx",HFONT,center,cols=3
text 45,27,"U/M",HFONT,center,cols=5
text 51,27,"Ordered",HFONT,right,cols=20
text 72,27,"Shipped",HFONT,right,cols=20
text 93,27,"Unit Price",HFONT,right,cols=20
text 114,27,"Extension",HFONT,right,cols=18

# item line
SO_INV_FONT "D@1,28,1,54",1,0,20,1,DFONT					# item #
SO_INV_FONT "D@1,28,1,54",40,0,3,1,DFONT,center				# tx
SO_INV_FONT "D@1,28,1,54",44,0,5,1,DFONT,center				# um
SO_INV_FONT "D@1,28,1,54",50,0,20,1,DFONT,right				# qty ordered
SO_INV_FONT "D@1,28,1,54",71,0,20,1,DFONT,right				# qty shipped
SO_INV_FONT "D@1,28,1,54",101,0,11,1,DFONT,right			# price
SO_INV_FONT "D@1,28,1,54",118,0,13,1,DFONT,right			# extension

# lot line
SO_INV_FONT "L@1,28,1,54",3,0,3,1,HFONT,right				# lot
SO_INV_FONT "L@1,28,1,54",7,0,20,1,DFONT					# lot id
SO_INV_FONT "L@1,28,1,54",45,0,11,1,HFONT					# lot ord/ship
SO_INV_FONT "L@1,28,1,54",58,0,13,1,DFONT,right				# lot qty
SO_INV_FONT "L@1,28,1,54",73,0,10,1,HFONT					# lot uom

# ser line
SO_INV_FONT "S@1,28,1,54",5,0,3,1,HFONT,right				# ser
SO_INV_FONT "S@1,28,1,54",9,0,20,1,DFONT					# ser id
SO_INV_FONT "S@1,28,1,54",101,0,11,1,DFONT,right			# ser price

# description
SO_INV_FONT "R@1,28,1,54",1,0,77,1,DFONT					# description
cerase 1,28,1,54

# message area
if copy TOTALS_COPY
	cbox LEFTCOL,55,MAXCOLS,58
	cfont 2,56,92,57,DFONT						# mesg
	cfont 94,57,110,57,DFONT,right				# subtotal:
	cfont 114,57,131,57,DFONT,right				# subtotal amt
end if
if copy CONT_COPY
	cfont 2,56,MAXCOLS,57,DFONT
end if

# totals
if copy TOTALS_COPY
	cerase 2,60,MAXCOLS,60
	cbox LEFTCOL,58,MAXCOLS,59.5
	cbox LEFTCOL,59.5,MAXCOLS,61,1,SHADE
	box 28,58,1,3
	box 49,58,1,3
	box 70,58,1,3
	box 91,58,1,3
	box 114,58,1,3
	text 2,60.5,"Taxable",HFONT,right,cols=26
	text 29,60.5,"Non-Taxable",HFONT,right,cols=20
	text 50,60.5,"Freight",HFONT,right,cols=20
	text 71,60.5,"Sales Tax",HFONT,right,cols=20
	text 92,60.5,"Misc Charge",HFONT,right,cols=22
	text 115,60.5,"Grand Total",HFONT,bold,right,cols=17
	cfont 2,59,27,59,DFONT,right					# taxable
	cfont 29,59,48,59,DFONT,right					# non-taxable
	cfont 50,59,69,59,DFONT,right					# freight
	cfont 71,59,90,59,DFONT,right					# sales tax
	cfont 92,59,113,59,DFONT,right				# misc
	cfont 115,59,131,59,DFONT,right				# grand total
end if
if copy CONT_COPY
	text 1,63,"Continued on next page.",univers,12,center,cols=MAXCOLS
end if

if copy CUSTOMER_COPY
	text 1,65,"Customer Copy",univers,12,bold,center,cols=MAXCOLS
endif
if copy FILE_COPY
	text 1,65,"Accounting Copy",univers,12,bold,center,cols=MAXCOLS
endif

[SO Invoice - std]
# Tested OK with 6.1.1 9/21/01 - bcj
# handles invoice, quote, credit memo
# replace "tear-off" stub with remittance copy
# added e-mail and web site - 07/23/01
detect 0,10,"~DATEMASK"
detect 80,1,"Page"
detect 98,1,"Page"
const MAXCOLS=93
const MAXRCOLS=91
const MAXROWS=66
const LEFTCOL=.5
cols MAXCOLS
page 51
rows MAXROWS

const CUSTOMER_COPY=1
const REMITTANCE_COPY=2
const FILE_COPY=3
pcopies 3

prepage {
	pageno$=trim(get(80,1,10))
	custno$=trim(get(8,2,10))
	title$=trim(get(50,2,40))
	if title$="" then title$="INVOICE"
	x$=title$
	# replace dbl space with ff's before removing single spaces
	x=pos("  "=x$)
	while x>0
		x$(x,1)=$ff$
		x=pos("  "=x$)
	wend
	# remove <'s and >'s and extra spaces
	x=pos("<"=x$)
	if x=0 then x=pos(">"=x$)
	if x=0 then x=pos(" "=x$)
	while x>0
		x$=trim(x$(1,x-1)+x$(x+1))
		x=pos("<"=x$)
		if x=0 then x=pos(">"=x$)
		if x=0 then x=pos(" "=x$)
	wend
	# now remove ff's	
	x=pos($ff$=x$)
	while x>0
		x$(x,1)=""
		x=pos($ff$=x$)
	wend
	if x$>"" then title$=x$
	# now move down to allow space for logo, etc.
	for i=MAXROWS to 9 step -1
		text$[i]=text$[i-6]
		text$[i-6]=""
	next i
	remit$="Remittance Copy - Please return with payment"
}

# Title area
cbox LEFTCOL,1,MAXCOLS,MAXROWS
cbox LEFTCOL,1,MAXCOLS,8
cerase 1,1,MAXCOLS,8
cerase 93,1,110,MAXROWS
text 1,2.25,{title$},univers,18,bold,right,cols=MAXRCOLS
LOGO_IMAGE 1,1,14,6,COMP_LOGO
text 1,2.25,"COMP_NAME",univers,15,bold,center,cols=MAXCOLS
text 1,3.35,"COMP_ADDR1",univers,12,center,cols=MAXCOLS
text 1,4.35,"COMP_ADDR2",univers,12,center,cols=MAXCOLS
text 1,5.35,"COMP_PHONES",univers,12,center,cols=MAXCOLS
text 1,6.25,"COMP_EMAIL",univers,10,center,cols=MAXRCOLS
text 1,7.25,"COMP_WEBSITE",univers,10,center,cols=MAXRCOLS

# page block
const HFONT=univers,10,italic
const DFONT=cgtimes,10,bold
const SHADE=10
text 1,7,{pageno$},HFONT,right,cols=MAXRCOLS

# address region
cbox LEFTCOL,8,MAXCOLS,14
cbox LEFTCOL,8,7,14,1,SHADE
cbox 44,8,51,14,1,SHADE
text 1,9,"Sold",HFONT
text 1,10,"To",HFONT
text 1,12,{custno$},DFONT
text 45,9,"Ship",HFONT
text 45,10,"To",HFONT
cfont 8,8,43,14,DFONT
cfont 52,8,MAXRCOLS,14,DFONT

# subhead 1
cbox LEFTCOL,14,MAXCOLS,15.5,1,SHADE
cbox LEFTCOL,15.5,19,16.5
cbox 34,15.5,MAXCOLS,16.5
box 12,14,1,2.5
box 19,14,1,3.5
box 34,14,1,2.5
box 45,14,1,3.5
box 67,14,1,2.5
box 83,14,1,2.5
text 1,15,"Date",HFONT,center,cols=11
text 13,15,"Rep ID",HFONT
text 20,15,"Order No",HFONT
text 35,15,"Ord Date",HFONT,center,cols=10
text 46,15,"Ship Via",HFONT
text 68,15,"Terms",HFONT
text 84,15,"Invoice No",HFONT
cfont 1,16,11,16,DFONT,center
cfont 13,16,18,16,DFONT
cfont 20,16,33,16,DFONT
cfont 20,17,44,17,DFONT
cfont 35,16,44,16,DFONT,center
cfont 46,16,66,16,DFONT
cfont 68,16,82,16,DFONT
cfont 84,16,MAXCOLS,16,DFONT

# items
cbox LEFTCOL,17.5,MAXCOLS,18.5,1,SHADE
cbox LEFTCOL,18.5,MAXCOLS,43
cbox 37,17.5,37,43
cbox 60,17.5,60,43
cbox 66,17.5,66,43
cbox 81,17.5,81,43
text 1,18,"Item/Description",HFONT
text 38,18,"Quantities",HFONT,right,cols=22
text 61,18,"Units",HFONT
text 67,18,"Price",HFONT,right,cols=14
text 82,18,"Amount",HFONT,right,cols=10
SO_INV_CFONT 1,19,36,43,DFONT
SO_INV_CFONT 38,19,44,43,DFONT
SO_INV_CFONT 46,19,59,43,DFONT,right
SO_INV_CFONT 61,19,65,43,DFONT
SO_INV_CFONT 67,19,80,43,DFONT,right
SO_INV_CFONT 82,19,91,43,DFONT,right

# message area
cbox LEFTCOL,43,MAXCOLS,46
cfont 1,44,MAXCOLS,44,DFONT
cfont 1,45,66,45,DFONT
cfont 68,45,77,45,DFONT
cfont 79,45,91,45,DFONT,right

# totals
cbox LEFTCOL,46,MAXCOLS,47.5,1,SHADE
cbox LEFTCOL,47.5,MAXCOLS,49
cbox 14,46,14,49
cbox 27,46,27,49
cbox 40,46,40,49
cbox 52,46,52,49
cbox 64,46,64,49
text 1,47,"Non-Taxable",HFONT,right,cols=13
text 15,47,"Taxable",HFONT,right,cols=12
text 28,47,"Sales Tax",HFONT,right,cols=12
text 41,47,"Freight",HFONT,right,cols=11
text 53,47,"Misc",HFONT,right,cols=11
text 65,47,"Invoice Total",HFONT,bold,right,cols=27
cfont 1,48,13,48,DFONT,right
cfont 15,48,26,48,DFONT,right
cfont 28,48,39,48,DFONT,right
cfont 41,48,51,48,DFONT,right
cfont 53,48,63,48,DFONT,right
cfont 65,48,91,48,DFONT,right
if copy CUSTOMER_COPY
	text 1,65,"Customer Copy",univers,12,bold,center,cols=MAXCOLS
endif
if copy REMITTANCE_COPY
	text 1,65,{remit$},univers,12,bold,center,cols=MAXCOLS
endif
if copy FILE_COPY
	text 1,65,"Accounting Copy",univers,12,bold,center,cols=MAXCOLS
endif

[SO Invoice - plain]
# Tested OK with 6.1.1 9/21/01 - bcj
# handles invoice, quote, credit memo
# added e-mail and web site - 07/23/01
# added prepayment handling - 10/08/01
detect 0,2,"~(I N V O I C E)|(C R E D I T)"
const MAXCOLS=120
const MAXRCOLS=118
const MAXROWS=66
const LEFTCOL=.5
cols MAXCOLS
rows MAXROWS

const CUSTOMER_COPY=1
const FILE_COPY=2
pcopies 2

prepage {
	if trim(get(30,1,40))<>"" then \
			comp_name$=trim(get(30,1,40)); \
			comp_addr1$=trim(get(30,2,40)); \
			comp_addr2$=trim(get(30,3,40)); \
			comp_phones$="" \
		else \
			comp_name$="COMP_NAME";\
			comp_addr1$="COMP_ADDR1";\
			comp_addr2$="COMP_ADDR2";\
			comp_phones$="COMP_PHONES"
	pageno$=trim(get(111,6,10))
	custno$=trim(get(20,7,10))
	title$=trim(get(60,2,60))
	x$=title$
	# replace dbl space with ff's before removing single spaces
	x=pos("  "=x$)
	while x>0
		x$(x,1)=$ff$
		x=pos("  "=x$)
	wend
	# remove <'s and >'s and extra spaces
	x=pos("<"=x$)
	if x=0 then x=pos(">"=x$)
	if x=0 then x=pos(" "=x$)
	while x>0
		x$=trim(x$(1,x-1)+x$(x+1))
		x=pos("<"=x$)
		if x=0 then x=pos(">"=x$)
		if x=0 then x=pos(" "=x$)
	wend
	# now remove ff's	
	x=pos($ff$=x$)
	while x>0
		x$(x,1)=""
		x=pos($ff$=x$)
	wend
	if x$>"" then title$=x$

	amount_paid$=trim(get(80,55,20))
	amt_paid$=trim(get(100,55,20))
	net_due$=trim(get(80,57,20))
	nt_due$=trim(get(100,57,20))
	if amount_paid$="" then goto no_amount_paid
	amount_paid$=amount_paid$(1,len(amount_paid$)-1)	# remove colon
	net_due$=net_due$(1,len(net_due$)-1)			# remove colon
	exec("cbox 85,53,104,56,1,10")
	exec("cbox 104,53,MAXCOLS,56")
	exec("cbox 85,54.5,MAXCOLS,56")
	exec("text 86,54,"+$22$+amount_paid$+$22$+",univers,11,italic")
	exec("text 108,54,"+$22$+amt_paid$+$22$+",cgtimes,11,bold,right,cols=12")
	exec("text 86,55.5,"+$22$+net_due$+$22$+",univers,11,bold,italic")
	exec("text 108,55.5,"+$22$+nt_due$+$22$+",cgtimes,11,bold,right,cols=12")
no_amount_paid:
}

# Title area
cbox LEFTCOL,1,MAXCOLS,MAXROWS
cbox LEFTCOL,1,MAXCOLS,8
cerase 1,1,MAXCOLS,8
text 1,2.25,{title$},univers,18,bold,right,cols=MAXRCOLS
LOGO_IMAGE 1,1,14,6,COMP_LOGO
text 1,2.25,{comp_name$},univers,15,bold,center,cols=MAXCOLS
text 1,3.35,{comp_addr1$},univers,12,center,cols=MAXCOLS
text 1,4.35,{comp_addr2$},univers,12,center,cols=MAXCOLS
text 1,5.35,{comp_phones$},univers,12,center,cols=MAXCOLS
text 1,6.25,"COMP_EMAIL",univers,10,center,cols=MAXRCOLS
text 1,7.25,"COMP_WEBSITE",univers,10,center,cols=MAXRCOLS

# page block
const HFONT=univers,10,italic
const DFONT=cgtimes,10,bold
const SHADE=10
text 1,7,{pageno$},HFONT,right,cols=MAXRCOLS

# address region
cbox LEFTCOL,8,MAXCOLS,15
cbox 10,8,19,15,1,SHADE
cbox 70,8,79,15,1,SHADE
cerase 10,8,19,15
cerase 70,8,79,15
text 11,9,"Sold",HFONT
text 11,10,"To",HFONT
text 71,9,"Ship",HFONT
text 71,10,"To",HFONT
cfont 21,8,69,15,DFONT
cfont 80,8,MAXRCOLS,15,DFONT
text 21,14,{"Your customer code is "+custno$},DFONT

# subhead 1
cbox LEFTCOL,15,MAXCOLS,16.5,1,SHADE
cbox LEFTCOL,16.5,38,17.5
cbox 52,16.5,MAXCOLS,17.5
box 30,15,1,2.5
box 38,15,1,3.5
box 52,15,1,2.5
box 64,15,1,2.5
box 85,15,1,3.5
box 106,15,1,2.5
cfont 1,16,29,16,HFONT,center
cfont 31,16,37,16,HFONT
cfont 39,16,51,16,HFONT
cfont 53,16,63,16,HFONT,center
cfont 65,16,84,16,HFONT
cfont 86,16,105,16,HFONT
cfont 107,16,MAXCOLS,16,HFONT
cfont 1,17,29,17,DFONT,center
cfont 31,17,37,17,DFONT
cfont 39,17,51,17,DFONT
cfont 39,18,84,18,DFONT
cfont 53,17,63,17,DFONT,center
cfont 65,17,84,17,DFONT
cfont 86,17,105,17,DFONT
cfont 107,17,MAXCOLS,17,DFONT

# items
cbox LEFTCOL,18.5,MAXCOLS,19.5,1,SHADE
cbox LEFTCOL,19.5,MAXCOLS,47
cbox 46,18.5,46,47
cbox 69,18.5,69,47
cbox 77,18.5,77,47
cbox 100,18.5,100,47
cmove 11,19,45,19,2,19
SO_INV_CFONT 2,19,45,19,HFONT
SO_INV_CFONT 47,19,68,19,HFONT,right
SO_INV_CFONT 70,19,76,19,HFONT
SO_INV_CFONT 78,19,99,19,HFONT,right
SO_INV_CFONT 102,19,119,19,HFONT,right
cmove 11,20,45,47,2,20
SO_INV_CFONT 2,20,45,47,DFONT
SO_INV_CFONT 47,20,54,47,DFONT
SO_INV_CFONT 55,20,68,47,DFONT,right
SO_INV_CFONT 70,20,76,47,DFONT
SO_INV_CFONT 78,20,99,47,DFONT,right
SO_INV_CFONT 101,20,119,47,DFONT,right

# message area
cbox LEFTCOL,47,MAXCOLS,50.5
cfont 1,48,91,50,DFONT
cfont 93,50,102,50,DFONT
cfont 103,50,119,50,DFONT,right

# totals
cbox LEFTCOL,50.5,MAXCOLS,51.5,1,SHADE
cbox LEFTCOL,51.5,MAXCOLS,53
cbox 25,50.5,25,53
cbox 40,50.5,40,53
cbox 55,50.5,55,53
cbox 70,50.5,70,53
cbox 85,50.5,85,53
cfont 1,51,24,51,HFONT,right
cfont 26,51,39,51,HFONT,right
cfont 41,51,54,51,HFONT,right
cfont 56,51,69,51,HFONT,right
cfont 71,51,84,51,HFONT,right
cfont 86,51,119,51,HFONT,bold,right
cfont 1,52,24,52,DFONT,right
cfont 26,52,39,52,DFONT,right
cfont 41,52,54,52,DFONT,right
cfont 56,52,69,52,DFONT,right
cfont 71,52,84,52,DFONT,right
cfont 86,52,119,52,DFONT,right
if copy CUSTOMER_COPY
	text 1,65,"Customer Copy",univers,12,bold,center,cols=MAXCOLS
endif
if copy FILE_COPY
	text 1,65,"Accounting Copy",univers,12,bold,center,cols=MAXCOLS
endif
cerase 80,55,MAXCOLS,57

[SO Pick/Pack List - 8.5 x 11]
# Tested OK with 6.1.1 9/21/01 - bcj
# See notes at top about pick/pack list
# added e-mail and web site - 07/23/01
# adjusted PO # section to allow more space for company info - 07/23/01
detect 0,4,"~ [0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9] "
detect 0,4,"~ DATEMASK "
detect 5,9,"~ [A-Z0-9a-z]+"
detect 5,10,"~ [A-Z0-9a-z]+"
const MAXCOLS=81
const MAXRCOLS=79
const MAXROWS=66
const LEFTCOL=.5
cols MAXCOLS
rows MAXROWS
pcopies 1

prepage {
	ordno$=trim(get(51,4,8))
	orddate$=trim(get(63,4,8))
	pageno$=trim(get(72,4,7))
	custpono$=trim(get(51,7,25))
	x$=set(52,4,28,"")
	custno$=trim(get(6,9,10));x$=set(6,9,10,"")

	# mark line types (D=detail, L=lot, R=remark/desc, S=serial
	for i=24 to 54
		if mid(text$[i],5,13)="Lot Numbers :" then \
			text$[i](1,1)="L",i=i+1; \
			if len(text$[i])>0 then text$[i](1,1)="L" fi; \
			goto bottom_loop
		if mid(text$[i],60,1)="." or mid(text$[i],61,1)="."  \
			or mid(text$[i],46,1)="." or mid(text$[i],47,1)="." then \
			goto bottom_loop
		# must be remark
		if text$[i]<>"" then text$[i](1,1)="R"
bottom_loop:
	next i
}

# Title area
cbox LEFTCOL,1,MAXCOLS,MAXROWS
cbox LEFTCOL,1,MAXCOLS,9
erase 1,1,MAXCOLS,7
text 1,2.25,"PICKPACK_8.5X11_TITLE",univers,18,bold,right,cols=MAXRCOLS
LOGO_IMAGE 1,1,10,6,COMP_LOGO
text 1,2.25,"COMP_NAME",univers,15,bold,center,cols=MAXRCOLS
text 1,3.35,"COMP_ADDR1",univers,12,center,cols=MAXRCOLS
text 1,4.35,"COMP_ADDR2",univers,12,center,cols=MAXRCOLS
text 1,5.35,"COMP_PHONES",univers,12,center,cols=MAXRCOLS
text 1,6.25,"COMP_EMAIL",univers,10,center,cols=MAXRCOLS
text 1,7.25,"COMP_WEBSITE",univers,10,center,cols=MAXRCOLS

# Invoice block
const HFONT=univers,10,italic
const DFONT=cgtimes,10,bold
const SHADE=10
cbox 60,3.5,MAXCOLS,6.5
cbox 60,3.5,72,6.5,1,SHADE
cbox 60,4.5,MAXCOLS,5.5
text 61,4,"Order #",HFONT
text 61,5,"Order Date",HFONT
text 61,6,"Page",HFONT
text 73,4,{ordno$},DFONT
text 73,5,{orddate$},DFONT
text 73,6,{Pageno$},DFONT
cbox 60,7,MAXCOLS,9
cbox 60,7,MAXCOLS,8,1,SHADE
text 61,7.5,"Customer PO #",HFONT
text 61,8.5,{custpono$},DFONT

# address region
cbox LEFTCOL,9,MAXCOLS,19
cbox LEFTCOL,9,5,19,1,SHADE
cbox 39.5,9,44,19,1,SHADE
text 1.5,10,"Ship",HFONT
text 1.5,11,"To",HFONT
text 40.5,10,"Sold",HFONT
text 40.5,11,"To",HFONT
cfont 6,10,39,17,DFONT
cfont 45,10,MAXRCOLS,17,DFONT
text 6,18,{"Your customer code is "+custno$},DFONT

# subhead 1
cbox LEFTCOL,19,MAXCOLS,20.5,1,SHADE
cbox LEFTCOL,20.5,MAXCOLS,22
box 7,19,1,3
box 13,19,1,3
box 21,19,1,3
box 44,19,1,3
box 56,19,1,3
box 69,19,1,3
text 1,20,"Slsp 1",HFONT
text 8,20,"Slsp 2",HFONT
text 14,20,"Location",HFONT
text 22,20,"Ship Via",HFONT
text 45,20,"Pack List #",HFONT,center,cols=11
text 57,20,"Rqstd Ship Date",HFONT,center,cols=12
text 70,20,"Actual Ship Date",HFONT,center,cols=10
cfont 1,21,6,21,DFONT
cfont 8,21,12,21,DFONT
cfont 14,21,20,21,DFONT
cfont 22,21,43,21,DFONT
cfont 45,21,55,21,DFONT,center
cfont 57,21,68,21,DFONT,center
cfont 70,21,MAXCOLS,21,DFONT,center

# items
cbox LEFTCOL,22,MAXCOLS,23.5,1,SHADE
cbox LEFTCOL,23.5,MAXCOLS,62
box 4,22,1,40
box 25,22,1,40
box 30,22,1,40
box 40,22,1,40
box 53,22,1,40
box 67,22,1,40
text 1,23,"Line",HFONT
text 5,23,"Item ID",HFONT
text 26,23,"U/M",HFONT
text 31,23,"Bin",HFONT
text 41,23,"Ordered",HFONT,right,cols=12
text 54,23,"Shipped",HFONT,right,cols=13
text 68,23,"Back Ordered",HFONT,right,cols=12

# item lines
SO_PICKPACK_FONT "~[0-9][0-9][0-9]@1,24,3,61",0,0,3,1,DFONT
SO_PICKPACK_FONT "~[0-9][0-9][0-9]@1,24,3,61",4,0,19,1,DFONT
SO_PICKPACK_FONT "~[0-9][0-9][0-9]@1,24,3,61",25,0,4,1,DFONT
SO_PICKPACK_FONT "~[0-9][0-9][0-9]@1,24,3,61",30,0,9,1,DFONT
SO_PICKPACK_FONT "~[0-9][0-9][0-9]@1,24,3,61",40,0,12,1,DFONT,right
SO_PICKPACK_FONT "~[0-9][0-9][0-9]@1,24,3,61",53,0,13,1,DFONT,right
SO_PICKPACK_FONT "~[0-9][0-9][0-9]@1,24,3,61",67,0,13,1,DFONT,right

# lot lines
SO_PICKPACK_FONT "L@1,24,1,61",4,0,35,1,DFONT
SO_PICKPACK_FONT "L@1,24,1,61",40,0,12,1,DFONT,right
SO_PICKPACK_FONT "L@1,24,1,61",54,0,12,1,DFONT,right
erase "L@1,24,1,61",0,0,1,1

# desc/remarks
SO_PICKPACK_FONT "R@1,24,1,61",4,0,70,1,DFONT
erase "R@1,24,1,61",0,0,1,1

[SO Pick/Pack List - laser]
# Tested OK with 6.1.1 9/21/01 - bcj
# See notes at top about pick/pack list
# added e-mail and web site - 07/23/01
# adjusted order # section to allow more space for company info - 07/23/01
detect 0,4,"~ [0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9] "
detect 0,4,"~ DATEMASK "
detect 6,9,"~ [A-Z0-9a-z]+"
detect 6,10,"~ [A-Z0-9a-z]+"
const MAXCOLS=81
const MAXRCOLS=79
const MAXROWS=66
const LEFTCOL=.5
cols MAXCOLS
rows MAXROWS
pcopies 1

prepage {
	ordno$=trim(get(51,4,8))
	orddate$=trim(get(63,4,8))
	pageno$=trim(get(72,4,7))
	batchno$=trim(get(40,4,6))
	custpono$=trim(get(51,7,25))
	custno$=trim(get(6,9,10));x$=set(6,9,10,"")
}

# Title area
cbox LEFTCOL,1,MAXCOLS,MAXROWS
cbox LEFTCOL,1,MAXCOLS,9
erase 1,1,MAXCOLS,8
text 1,2.25,"PICKPACK_LASER_TITLE",univers,18,bold,right,cols=MAXRCOLS
LOGO_IMAGE 1,1,10,6,COMP_LOGO
text 1,2.25,"COMP_NAME",univers,15,bold,center,cols=MAXRCOLS
text 1,3.35,"COMP_ADDR1",univers,11,center,cols=MAXRCOLS
text 1,4.35,"COMP_ADDR2",univers,11,center,cols=MAXRCOLS
text 1,5.35,"COMP_PHONES",univers,11,center,cols=MAXRCOLS
text 1,6.25,"COMP_EMAIL",univers,10,center,cols=MAXRCOLS
text 1,7.25,"COMP_WEBSITE",univers,10,center,cols=MAXRCOLS

# Invoice block
const HFONT=univers,10,italic
const DFONT=cgtimes,10,bold
const SHADE=10
cbox 60,3,MAXCOLS,8
cbox 60,3,72,8,1,SHADE
cbox 60,4,MAXCOLS,5
cbox 60,6,MAXCOLS,7
text 61,3.5,"Order #",HFONT
text 61,4.5,"Order Date",HFONT
text 61,5.5,"Batch #",HFONT
text 61,6.5,"Page",HFONT
text 73,3.5,{ordno$},DFONT
text 73,4.5,{orddate$},DFONT
text 73,5.5,{batchno$},DFONT
text 73,6.5,{Pageno$},DFONT
cbox 60,7,MAXCOLS,9
cbox 60,7,MAXCOLS,8,1,SHADE
text 61,7.5,"Customer PO #",HFONT
text 61,8.5,{custpono$},DFONT

# address region
cbox LEFTCOL,9,MAXCOLS,19
cbox LEFTCOL,9,5,19,1,SHADE
cbox 39.5,9,44,19,1,SHADE
text 1.5,10,"Ship",HFONT
text 1.5,11,"To",HFONT
text 40.5,10,"Sold",HFONT
text 40.5,11,"To",HFONT
cfont 6,10,39,17,DFONT
cfont 45,10,MAXRCOLS,17,DFONT
text 6,18,{"Your customer code is "+custno$},DFONT

# subhead 1
cbox LEFTCOL,19,MAXCOLS,20.5,1,SHADE
cbox LEFTCOL,20.5,MAXCOLS,22
box 7,19,1,3
box 13,19,1,3
box 21,19,1,3
box 44,19,1,3
box 58,19,1,3
box 69,19,1,3
text 2,20,"Slsp 1",HFONT
text 8,20,"Slsp 2",HFONT
text 14,20,"Location",HFONT
text 22,20,"Ship Via",HFONT
text 45,20,"Pack List #",HFONT,center,cols=13
text 59,20,"Rqstd Ship Date",HFONT,9,center,cols=10
text 70,20,"Actual Ship Date",HFONT,9,center,cols=11
cfont 1,21,6,21,DFONT
cfont 8,21,12,21,DFONT
cfont 14,21,20,21,DFONT
cfont 22,21,43,21,DFONT
cfont 45,21,57,21,DFONT,center
cfont 59,21,68,21,DFONT,center
cfont 70,21,MAXCOLS,21,DFONT,center

# items
cbox LEFTCOL,22,MAXCOLS,23.5,1,SHADE
cbox LEFTCOL,23.5,MAXCOLS,62
box 5,22,1,40
box 32,22,1,40
box 39,22,1,40
box 53,22,1,40
box 67,22,1,40
text 2,23,"Line",HFONT
text 6,23,"Item ID",HFONT
text 27,23,"U/M",HFONT,center,cols=5
text 33,23,"Bin",HFONT,center,cols=6
text 40,23,"Ordered",HFONT,right,cols=13
text 54,23,"Shipped",HFONT,right,cols=13
text 68,23,"Back Ordered",HFONT,right,cols=12
SO_PICKPACK_CFONT 1,24,4,61,DFONT
SO_PICKPACK_FONT "~[0-9][0-9][0-9]@2,24,4,61",4,0,19,1,DFONT
SO_PICKPACK_FONT "~[0-9][0-9][0-9]@2,24,4,61",25,0,5,1,DFONT,center
SO_PICKPACK_FONT "~[0-9][0-9][0-9]@2,24,4,61",31,0,6,1,DFONT,center
SO_PICKPACK_FONT "~[0-9][0-9][0-9]@2,24,4,61",38,0,13,1,DFONT,right
SO_PICKPACK_FONT "   @2,24,4,61",4,0,50,1,DFONT
SO_PICKPACK_CFONT 54,24,66,61,DFONT,right
SO_PICKPACK_CFONT 68,24,79,61,DFONT,right

[SO Pick List - std]
# Tested OK with 6.1.1 9/21/01 - bcj
# added e-mail and web site - 07/31/01
# adjusted order # section to allow more space for company info - 07/31/01
detect 0,1,"Batch"
detect 0,5,"~[0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9] "
detect 0,5,"~ DATEMASK "
detect 56,9,"~ [A-Z0-9a-z]+"
detect 56,10,"~ [A-Z0-9a-z]+"
const MAXCOLS=107
const MAXRCOLS=105
const MAXROWS=66
const LEFTCOL=.5
cols MAXCOLS
page MAXROWS
rows MAXROWS
pcopies 1

prepage {
	batchno$=trim(get(83,1,6))
	pslipno$=trim(get(100,2,6))
	custno$=trim(get(57,9,10));x$=set(57,9,10,"")
	for i=MAXROWS to 5 step -1
		text$[i]=text$[i-3]
		text$[i-3]=""
	next i
}

# Title area
cbox LEFTCOL,1,MAXCOLS,MAXROWS
cbox LEFTCOL,1,MAXCOLS,8
erase 1,1,MAXCOLS,7
text 1,2.25,"PICKING LIST",univers,18,bold,right,cols=MAXRCOLS
LOGO_IMAGE 1,1,10,4,COMP_LOGO
text 1,2.25,"COMP_NAME",univers,15,bold,center,cols=MAXRCOLS
text 1,3.35,"COMP_ADDR1",univers,12,center,cols=MAXRCOLS
text 1,4.35,"COMP_ADDR2",univers,12,center,cols=MAXRCOLS
text 1,5.35,"COMP_PHONES",univers,12,center,cols=MAXRCOLS
text 1,6.25,"COMP_EMAIL",univers,10,center,cols=MAXRCOLS
text 1,7.25,"COMP_WEBSITE",univers,10,center,cols=MAXRCOLS

# Invoice block
const HFONT=univers,10,italic
const DFONT=cgtimes,10,bold
const SHADE=10
cbox 80,5.5,MAXCOLS,6.5,1,SHADE
cbox 80,6.5,MAXCOLS,8
cbox 95,5.5,95,8
text 81,6,"Picking Slip #",HFONT
text 96,6,"Batch #",HFONT
text 81,7,{pslipno$},DFONT
text 96,7,{batchno$},DFONT

# subhead
cbox LEFTCOL,8,MAXCOLS,9.5,1,SHADE
cbox LEFTCOL,9.5,56,10.5
cbox 68,9.5,MAXCOLS,10.5
cbox 9,8,9,10.5
cbox 19,8,19,10.5
cbox 30,8,30,10.5
cbox 41,8,41,10.5
cbox 56,8,56,11.5
cbox 68,8,68,10.5
cbox 100,8,100,11.5
cbox 56,11.5,100,11.5
text 1,9,"Order #",HFONT
text 10,9,"Order Date",HFONT,center,cols=9
text 20,9,"Loc Id",HFONT
text 31,9,"Ship Date",HFONT,center,cols=8
text 42,9,"Req'd Ship Date",HFONT,center,cols=13
text 57,9,"Cust. P/O #",HFONT
text 69,9,"Ship Via",HFONT
text 101,9,"Page #",HFONT
cmove 1,8,MAXCOLS,9,1,10
cfont 1,10,8,10,DFONT
cfont 10,10,18,10,DFONT,center
cfont 20,10,29,10,DFONT
cfont 31,10,40,10,DFONT,center
cfont 42,10,55,10,DFONT
cfont 57,10,67,10,DFONT
cfont 69,10,99,10,DFONT
cfont 101,10,MAXCOLS,10,DFONT
cfont 57,11,99,11,DFONT

# address region
cbox LEFTCOL,12,MAXCOLS,18
cbox 8,12,15,18,1,SHADE
cbox 49,12,56,18,1,SHADE
text 9,13,"Ship to",HFONT
text 50,13,"Sold to",HFONT
cfont 16,13,49,18,DFONT
cfont 57,13,MAXCOLS,18,DFONT
text 57,17,{"Your customer code is "+custno$},DFONT

# items
cbox LEFTCOL,18,MAXCOLS,20,1,SHADE
cbox LEFTCOL,20,MAXCOLS,62
box 5,18,1,44
box 51,18,1,44
box 57,18,1,44
box 73,18,1,44
box 88,18,1,44
text 1,19,"Line",HFONT
text 6,19,"Item/Description",HFONT
text 52,19,"Units",HFONT
text 58,19,"Qty Ordered",HFONT,right,cols=15
text 74,19,"Qty Shipped",HFONT,right,cols=14
text 89,19,"Qty Backordered",HFONT,right,cols=18
SO_PICKPACK_CFONT 1,20,4,61,DFONT
SO_PICKPACK_CFONT 6,20,50,61,DFONT
SO_PICKPACK_CFONT 52,20,56,61,DFONT
SO_PICKPACK_CFONT 58,20,72,61,DFONT,right
SO_PICKPACK_CFONT 74,20,87,61,DFONT,right
SO_PICKPACK_CFONT 89,20,105,61,DFONT,right

[SO Pack List - plain]
# Tested OK with 6.1.1 9/21/01 - bcj
# added e-mail and web site - 07/31/01
# adjusted order # section to allow more space for company info - 07/31/01
detect 0,1,"P A C K I N G   L I S T"
const MAXCOLS=125
const MAXRCOLS=123
const MAXROWS=66
const LEFTCOL=.5
cols MAXCOLS
rows MAXROWS
pcopies 1

prepage {
	if trim(get(30,2,40))<>"" then \
			comp_name$=trim(get(30,2,40)); \
			comp_addr1$=trim(get(30,3,40)); \
			comp_addr2$=trim(get(30,4,40)); \
			comp_phones$="" \
		else \
			comp_name$="COMP_NAME";\
			comp_addr1$="COMP_ADDR1";\
			comp_addr2$="COMP_ADDR2";\
			comp_phones$="COMP_PHONES"
	# Long po# ?
	x$=trim(get(1,9,MAXCOLS))
	if x$<>"" then \
		for i=12 to MAXROWS; \
			text$[i-1]=text$[i],text$[i]=""; \
		next i
	custno$=trim(get(67,11,10));x$=set(67,11,10,"")
}

# Title area
cbox LEFTCOL,1,MAXCOLS,MAXROWS
cbox LEFTCOL,1,MAXCOLS,7.5
erase 1,1,MAXCOLS,4
text 1,2.25,"PACKING LIST",univers,18,bold,right,cols=MAXRCOLS
LOGO_IMAGE 1,1,12,4,COMP_LOGO
text 1,2.25,{comp_name$},univers,15,bold,center,cols=MAXRCOLS
text 1,3.35,{comp_addr1$},univers,12,center,cols=MAXRCOLS
text 1,4.35,{comp_addr2$},univers,12,center,cols=MAXRCOLS
text 1,5.35,{comp_phones$},univers,12,center,cols=MAXRCOLS
text 1,6.00,"COMP_EMAIL",univers,10,center,cols=MAXRCOLS
text 1,7.00,"COMP_WEBSITE",univers,10,center,cols=MAXRCOLS

# Invoice block
const HFONT=univers,10,italic
const DFONT=cgtimes,10,bold
const SHADE=10
cbox 90,5.5,108,6.5,1,SHADE
cbox 108,5.5,MAXCOLS,6.5
cmove 91,5,MAXCOLS,5,91,6
text 91,6,"Packing Slip #",HFONT
cfont 109,6,MAXCOLS,6,DFONT

# subhead
cbox LEFTCOL,7.5,MAXCOLS,8.5,1,SHADE
cbox LEFTCOL,8.5,73,9.5
cbox 92,8.5,MAXCOLS,9.5
box 22,7.5,1,2
box 35,7.5,1,2
box 45,7.5,1,2
box 56,7.5,1,2
box 73,7.5,1,3
box 92,7.5,1,2
box 115,7.5,1,3
cbox 73,10.5,115,10.5
cmove 1,7,MAXCOLS,9,1,8
cfont 11,8,21,8,HFONT
cfont 23,8,34,8,HFONT,center
cfont 36,8,44,8,HFONT
cfont 46,8,55,8,HFONT,center
cfont 57,8,72,8,HFONT,center
cfont 74,8,91,8,HFONT
cfont 93,8,114,8,HFONT
cfont 116,8,MAXCOLS,8,HFONT
cfont 11,9,21,9,DFONT
cfont 23,9,34,9,DFONT,center
cfont 36,9,44,9,DFONT
cfont 46,9,55,9,DFONT,center
cfont 57,9,72,9,DFONT,center
cfont 74,9,91,9,DFONT
cfont 74,10,100,10,DFONT
cfont 93,9,114,9,DFONT
cfont 116,9,MAXCOLS,9,DFONT

# address region
cbox LEFTCOL,11,MAXCOLS,18
cmove 17,12,57,17,2,12
cbox LEFTCOL,11,10,18,1,SHADE
cbox 57,11,66,18,1,SHADE
cfont 1,12,9,12,HFONT
cfont 58,12,65,12,HFONT
cfont 11,12,56,18,DFONT
cfont 67,12,MAXCOLS,18,DFONT
text 67,17,{"Your customer code is "+custno$},DFONT

# items
cbox LEFTCOL,18,MAXCOLS,20,1,SHADE
cbox LEFTCOL,20,MAXCOLS,62
box 15,18,1,44
box 66,18,1,44
box 72,18,1,44
box 88,18,1,44
box 107,18,1,44
SO_PICKPACK_CFONT 11,19,14,19,HFONT
SO_PICKPACK_CFONT 16,19,65,19,HFONT
SO_PICKPACK_CFONT 67,19,71,19,HFONT
SO_PICKPACK_CFONT 73,19,87,19,HFONT,right
SO_PICKPACK_CFONT 89,19,106,19,HFONT,right
SO_PICKPACK_CFONT 108,19,124,19,HFONT,right
SO_PICKPACK_CFONT 11,20,13,61,DFONT
SO_PICKPACK_FONT "~[0-9][0-9][0-9]@11,20,13,61",5,0,19,1,DFONT
SO_PICKPACK_FONT "   @11,20,13,61",5,0,28,1,DFONT
SO_PICKPACK_CFONT 67,20,71,61,DFONT
SO_PICKPACK_CFONT 73,20,87,61,DFONT,right
SO_PICKPACK_CFONT 89,20,106,61,DFONT,right
SO_PICKPACK_CFONT 108,20,124,61,DFONT,right

[SO Pick List - plain]
# Tested OK with 6.1.1 9/21/01 - bcj
# added e-mail and web site - 07/31/01
# adjusted order # section to allow more space for company info - 07/31/01
detect 0,1,"P I C K I N G   S L I P"
const MAXCOLS=125
const MAXRCOLS=123
const MAXROWS=66
const LEFTCOL=.5
cols MAXCOLS
rows MAXROWS
pcopies 1

prepage {
	if trim(get(30,2,40))<>"" then \
			comp_name$=trim(get(30,2,40)); \
			comp_addr1$=trim(get(30,3,40)); \
			comp_addr2$=trim(get(30,4,40)); \
			comp_phones$="" \
		else \
			comp_name$="COMP_NAME";\
			comp_addr1$="COMP_ADDR1";\
			comp_addr2$="COMP_ADDR2";\
			comp_phones$="COMP_PHONES"
	batchno$=trim(get(83,5,6))
	# Long po# ?
	x$=trim(get(1,10,MAXCOLS))
	if x$<>"" then \
		for i=12 to MAXROWS; \
			text$[i-1]=text$[i],text$[i]=""; \
		next i
	custno$=trim(get(67,12,10));x$=set(67,12,10,"")
}

# Title area
cbox LEFTCOL,1,MAXCOLS,MAXROWS
cbox LEFTCOL,1,MAXCOLS,8.5
erase 1,1,MAXCOLS,5
text 1,2.25,"PICKING LIST",univers,18,bold,right,cols=MAXRCOLS
LOGO_IMAGE 1,1,12,5,COMP_LOGO
text 1,2.25,{comp_name$},univers,15,bold,center,cols=MAXRCOLS
text 1,3.35,{comp_addr1$},univers,12,center,cols=MAXRCOLS
text 1,4.35,{comp_addr2$},univers,12,center,cols=MAXRCOLS
text 1,5.35,{comp_phones$},univers,12,center,cols=MAXRCOLS
text 1,6.25,"COMP_EMAIL",univers,10,center,cols=MAXRCOLS
text 1,7.25,"COMP_WEBSITE",univers,10,center,cols=MAXRCOLS

# Invoice block
const HFONT=univers,10,italic
const DFONT=cgtimes,10,bold
const SHADE=10
cbox 90,5.5,108,7.5,1,SHADE
cbox 108,5.5,MAXCOLS,7.5
cbox 90,6.5,MAXCOLS,6.5
text 91,6,"Batch No.",HFONT
text 109,6,{batchno$},DFONT
cmove 91,6,MAXCOLS,6,91,7
cfont 91,7,107,7,HFONT
cfont 109,7,MAXCOLS,7,DFONT

# subhead
cbox LEFTCOL,8.5,MAXCOLS,9.5,1,SHADE
cbox LEFTCOL,9.5,73,10.5
cbox 92,9.5,MAXCOLS,10.5
cbox 22,8.5,22,10.5
cbox 35,8.5,35,10.5
cbox 45,8.5,45,10.5
cbox 56,8.5,56,10.5
cbox 73,8.5,73,11.5
cbox 92,8.5,92,10.5
cbox 115,8.5,115,11.5
cbox 73,11.5,115,11.5
cmove 1,8,MAXCOLS,10,1,9
cfont 11,9,21,9,HFONT
cfont 23,9,34,9,HFONT,center
cfont 36,9,44,9,HFONT
cfont 46,9,55,9,HFONT,center
cfont 57,9,72,9,HFONT,center
cfont 74,9,91,9,HFONT
cfont 93,9,114,9,HFONT
cfont 116,9,MAXCOLS,9,HFONT
cfont 11,10,21,10,DFONT
cfont 23,10,34,10,DFONT,center
cfont 36,10,44,10,DFONT
cfont 46,10,55,10,DFONT,center
cfont 57,10,72,10,DFONT,center
cfont 74,10,91,10,DFONT
cfont 93,10,114,10,DFONT
cfont 116,10,MAXCOLS,10,DFONT
cfont 74,11,114,11,DFONT

# address region
cbox LEFTCOL,12,MAXCOLS,19
cmove 17,13,57,18,2,13
cbox LEFTCOL,12,10,19,1,SHADE
cbox 57,12,66,19,1,SHADE
cfont 1,13,9,13,HFONT
cfont 58,13,65,13,HFONT
cfont 11,13,56,18,DFONT
cfont 67,13,MAXCOLS,18,DFONT
text 67,18,{"Your customer code is "+custno$},DFONT

# items
cbox LEFTCOL,19,MAXCOLS,21,1,SHADE
cbox LEFTCOL,21,MAXCOLS,62
box 15,19,1,43
box 55,19,1,43
box 66,19,1,43
box 72,19,1,43
box 88,19,1,43
box 107,19,1,43
SO_PICKPACK_CFONT 11,20,14,20,HFONT
SO_PICKPACK_CFONT 16,20,54,20,HFONT
SO_PICKPACK_CFONT 56,20,65,20,HFONT
SO_PICKPACK_CFONT 67,20,71,20,HFONT
SO_PICKPACK_CFONT 73,20,87,20,HFONT,right
SO_PICKPACK_CFONT 89,20,106,20,HFONT,right
SO_PICKPACK_CFONT 108,20,124,20,HFONT,right
SO_PICKPACK_CFONT 11,22,13,61,DFONT
SO_PICKPACK_FONT "~[0-9][0-9][0-9]@11,22,13,61",5,0,19,1,DFONT
SO_PICKPACK_FONT "   @11,22,13,61",5,0,28,1,DFONT
SO_PICKPACK_CFONT 56,22,65,61,DFONT
SO_PICKPACK_CFONT 67,22,71,61,DFONT
SO_PICKPACK_CFONT 73,22,87,61,DFONT,right
SO_PICKPACK_CFONT 89,22,106,61,DFONT,right
SO_PICKPACK_CFONT 108,22,124,61,DFONT,right

###################
# Generic reports #
###################

[Generic]
# Tested OK with 6.1.1 9/21/01 - bcj
# This rule set will set columns & rows and 
# enhance the heading for all other reports
# requires UnForm 4.1.05, rem out detect below if not this version or higher
detect 0,1,"~(PAGE)|(Page)"

const MAXROWS=66
cols 200					# temp value until setup in prepage
rows MAXROWS

prepage {
	maxlen=80				# minimum # of columns is 80
	for i=1 to MAXROWS
		if len(cvs(text$[i],2))>maxlen then maxlen=len(cvs(text$[i],2))
	next i
	cols$=str(maxlen+1)

	# load row 1 variables
	rptdate$=trim(get(1,1,10))
	x=pos("PAGE"=text$[1])
	if x=0 then x=pos("Page"=text$[1])
	pageno$=trim(get(x,1,11))
	compname$=trim(get(21,1,x-1-20))
	x$=set(1,1,200,"")

	# load row 2 variables
	time$=trim(get(1,2,10))
	x=pos("AM"=time$);if x=0 then x=pos("PM"=time$)
	if x=0 then left2$=trim(get(1,2,20)),time$=""
	title$=trim(get(21,2,100))
	x$=set(1,2,200,"")

	# load row 3 variables
	if time$="" then time$=trim(get(1,3,10))
	subtitle$=trim(get(21,3,100))
	x$=set(1,3,200,"")

	# Now draw box around header
	exec("cbox 1,.5,"+cols$+",3.75,3,20")
	# now place line 1 headers that need justification
	x$="text 1,1.25,"+$22$+compname$+$22$+ \
		",univers,15,bold,center,cols="+str(maxlen)
	exec(x$)
	x$="text 1,1.25,"+$22$+pageno$+$22$+ \
		",univers,9,bold,right,cols="+str(maxlen)
	exec(x$)
	# now place line 2 headers that need justification
	x$="text 1,2.25,"+$22$+title$+$22$+ \
		",univers,12,bold,center,cols="+str(maxlen)
	exec(x$)
	# now place line 3 headers that need justification
	x$="text 1,3.25,"+$22$+subtitle$+$22$+ \
		",univers,12,bold,center,cols="+str(maxlen)
	exec(x$)
}

const HFONT=univers,9,bold
text 2,1.25,{rptdate$},HFONT
text 2,2.25,{time$},HFONT
text 2,3.25,{left2$},HFONT
font "~(End of Report)|(END OF REPORT)",0,0,13,1,HFONT

[Generic1]
# This rule set will set columns & rows and 
# enhance the heading for all other reports
# Use this rule set if not version 4.1.05 or higher
detect 0,1,"~PAGE|Page"

const MAXROWS=66
cols 132
rows MAXROWS
# copy 1=80, copy 2=96, copy 3=132
pcopies 3

prepage {
	maxlen=80
	for i=1 to MAXROWS
		if len(text$[i])>maxlen then maxlen=len(text$[i])
	next i
	rptdate$=trim(get(1,1,10))
	x=pos("Page"=text$[1])
	compname$=trim(get(11,1,x-1-10))
	pageno$=trim(get(x,1,11))
	title$=trim(get(11,2,100))
	time$=trim(get(1,2,8))
	subtitle$=trim(get(11,3,100))
}

precopy {
	if maxlen>132 then skip=1
	if copy=1 and maxlen>80 then skip=1
	if copy=2 and (maxlen<=80 or maxlen>96) then skip=1
	if copy=3 and maxlen<=96 then skip=1
}

# header
const HFONT=univers,9,bold
const LEFTCOL=.5

if copy 1
	const MAXCOLS=80
	const MAXRCOLS=79
	cols MAXCOLS
endif
if copy 2
	const MAXCOLS=96
	const MAXRCOLS=95
	cols MAXCOLS
endif
if copy 3
	const MAXCOLS=132
	const MAXRCOLS=131
	cols MAXCOLS
endif

cerase 1,1,MAXCOLS,3
box LEFTCOL,.1,MAXCOLS,3.5,3,20

# line 1 headers
text 2,1.25,{rptdate$},HFONT
text 1,1.25,{compname$},univers,15,bold,center,cols=MAXCOLS
text 1,1.25,{pageno$},HFONT,right,cols=MAXRCOLS

# line 2 headers
text 1,2.25,{title$},univers,12,bold,center,cols=MAXCOLS
text 2,2.25,{time$},HFONT

# line 3 headers
text 1,3.25,{subtitle$},HFONT,center,cols=MAXCOLS

font "~(End of Report)|(END OF REPORT)",0,0,13,1,HFONT