*LINES.CMD
SET TALK OFF
ERASE
ACCEPT "DO YOU WANT TO PRINT THIS FILE? (Y/N)" TO P
IF P="N" .OR. P="n"
SET FORMAT TO SCREEN
erase
ELSE
@ 5,5 SAY "GET YOUR PRINTER READY NOW. I'LL WAIT."
WAIT
SET EJECT OFF
SET FORMAT TO PRINT
ENDIF
*
SET MARGIN TO 0
ACCEPT "ENTER DATE" TO date
@  1, 0 SAY CHR(15) + "LINE PERFORMANCE SUMMARY"
@  1,48 SAY date
@  3, 0 SAY "_______________________________________________________"
@  3,55 SAY "___________________________"
@  4, 0 SAY "| LINE       | NO. PCS.| COST    | PIECES|COST OF   |"
@  4,55 SAY "SELLING | GROSS  | GROSS  |"
@  5, 0 SAY "|            | ON HAND | ON HAND | SOLD  |PCS. SOLD |"
@  5,55 SAY "PRICE   | PROFIT |   %    |"
@  6, 0 SAY "-------------------------------------------------------"
@  6,55 SAY "---------------------------"
USE B:LINEFILE
STORE 7 TO X
SELECT SECONDARY
USE B:ITEMS
STORE 0 TO OHT
STORE 0 TO CSTT
STORE 0 TO SOLDT
STORE 0 TO COGT
STORE 0 TO PRCT
STORE 0 TO GROSST
SELECT PRIMARY
GOTO TOP
DO WHILE .NOT. EOF
STORE LINE TO LN
SELECT SECONDARY
@  X, 1 SAY LN 
COUNT FOR (LINE=LN .AND. SELLPRICE=0 .AND. RECEIVED>0) TO oh
@  X, 15 SAY oh USING '###'
SUM COST FOR (LINE=LN .AND. SELLPRICE=0 .AND. RECEIVED>0) TO cst
@  X,24 SAY CST USING '#####.##'
COUNT FOR LINE=LN .AND. SELLPRICE>1 .AND. RECEIVED>0 TO sold
@  X,34 SAY sold USING '###'
SUM COST FOR LINE=LN .AND. SELLPRICE>1 .AND. RECEIVED>0 TO cog
@  X,44 SAY cog USING '#####.##'
SUM SELLPRICE FOR LINE=LN .AND. RECEIVED>0 TO PRC
@  X,55 SAY PRC USING '#####.##'
SUM (SELLPRICE-COST) FOR LINE=LN .AND. SELLPRICE>1 .AND. RECEIVED>0 TO gross
@  X,65 SAY gross USING '#####.##'
IF PRC=0 
STORE 0 TO PERCENT
@ X,76 SAY PERCENT USING '#.##'
ELSE
STORE GROSS/PRC TO PERCENT
STORE "(INT((PERCENT+.005)*100))/100.00" TO PC
@ X,76 SAY &PC USING '#.##'
ENDIF
STORE X+1 TO X
STORE OHT+OH TO OHT
STORE CSTT+CST TO CSTT
STORE SOLDT+SOLD TO SOLDT
STORE COGT+COG TO COGT
STORE PRCT+PRC TO PRCT
STORE GROSST+GROSS TO GROSST
SELECT PRIMARY
SKIP
ENDDO
STORE X+2 TO X
@ X, 0 SAY "__________________________________________________"
@ X,50 SAY "________________________________"
STORE X+2 TO X
@ X, 0 SAY "TOTALS"
@ X, 15 SAY oht USING '###'
@ X,24 SAY Cstt USING '#####.##'
@ X,34 SAY soldt USING '###'
@ X,44 SAY cogt USING '#####.##'
@ X,55 SAY prct USING '#####.##'
@ X,65 SAY grosst USING '#####.##'
STORE GROSST/PRCT TO PERCENTT
STORE "(INT((PERCENTT+.005)*100))/100.00" TO PC2
@ X,76 SAY &PC2 USING '#.##'
@ X,0 SAY CHR(18)+' '
ENDDO
RELEASE ALL
SET FORMAT TO SCREEN
SET PRINT OFF
WAIT
DO B:INVCON
