****************************************************************
** ITEM_SCR.PRG - generalized sales record display function
** J Osako    29 Jan 1996	'This code is cursed'
** Copyright 1996 The Used Computer Store, All Rights Reserved
**
**	REVISION HISTORY 
**	----------------
**	Prerelease :
**		14 Mar 96 - Added spacing for warranty field,
**				reordered fields, changed to *_pos
**				design for ease of modification
**		11 Mar 96 - started as seperate from IN_ITEM
**
****************************************************************

*PROCEDURE item_screen
***********
** item_screen() - draw background screen for sales sheets
** build the screen for the sales record
** I've done all I can to keep out the magic numbers,
** and I think the current design is actually
** rather better than the genned Screen Builder
** equivalent would be.
*************************************************
** Be aware of the dependencies that in_item() **
** and summary() have on this code!!!		   **
*************************************************


PUBLIC spaced, listing_line, lower
PUBLIC qty_pos, item_pos, ser_pos, stock_pos, war_pos, price_pos
PUBLIC qty_len, item_len, ser_len, stock_len, war_len, price_len

** magic numbers for spacing the borders	
	right = 80 
	lower = 25
	middle = lower/2
	qty_len = 4
	ser_len = 20
	stock_len = 5
	war_len = 3
	price_len = 8
	item_len = right - (qty_len + ser_len + stock_len + war_len + price_len + 10)
	spaced = 2   	&& enough space to have one bordered line
	totl_space = 8	&& space for total at bottom of screen
	listing_line = lower-totl_space	&& the pos of the totl_space
** description bar lines - needed to get LEN() offsets
	qtyline = 'Qty'
	itemline = 'Item'
	sernumline = 'Serial #'
	stockline = 'Stk #'	
	priceline = 'Price'
	warline = 'Wty'

	DEFINE WINDOW sheet FROM 1,1 TO lower,right;
		SHADOW PANEL 
	MOVE WINDOW sheet CENTER
	ACTIVATE WINDOW sheet

** draw the screen boxes and get positions for 
** the labels
** as this goes draws the boxes, the place
** where each box begins is saved in the 
** appropriate *_pos variable. These are
** then used as constants with which to
** position the box labels, and later,
** the listed information.
 	@ 0,0 TO spaced,right		&& upper description bar
	qty_pos = 1
	@ 0,0 TO listing_line, qty_len
	item_pos = COL()
	@ 0,COL()-1 TO listing_line,COL() + item_len
	ser_pos = COL()
	@ 0,COL()-1 TO listing_line,COL() + ser_len
	stock_pos = COL()
	@ 0,COL()-1 TO listing_line,COL() + stock_len 
	war_pos = COL()
	@0, COL()-1 TO listing_line,COL() + war_len
	price_pos = COL()
	@ 0,COL()-1 TO (lower),right 
* add the descriptions of the columns
	@ 1, qty_pos SAY qtyline
	@ 1, item_pos SAY itemline
	@ 1, ser_pos SAY sernumline	
	@ 1, stock_pos SAY stockline
	@ 1, war_pos SAY warline
	@ 1, price_pos SAY priceline	

RETURN		&& ITEM_SCREEN()