
* RATIO.CMD
SET MARGIN TO   0
SET TALK OFF
ERASE
USE B:ITEMFILE
COPY STRUCTURE TO B:TEMP
COPY STRUCTURE TO B:TEMP2
USE B:TEMP
APPEND FROM ITEMFILE
REPLACE ALL BUY WITH 0
ERASE
GOTO TOP
DO WHILE .NOT. EOF
STORE ITEM TO ITM
ACCEPT "ENTER THE NUMBER OF &ITM YOU WANT TO BUY" TO BY
REPLACE BUY WITH &BY FOR ITEM=ITM
USE B:TEMP2
APPEND FROM TEMP FOR BUY>0
ERASE
USE B:TEMP
DELETE RECORD 1
PACK
GOTO TOP
ENDDO
USE B:TEMP2
LIST
STORE "N" TO OK
DO WHILE OK="N" .OR. OK="n"
ACCEPT "ARE THESE CORRECT? (Y/N)" TO OK
      IF OK="N" .OR. OK="n"
      ACCEPT "WHAT ITEM DO YOU WANT TO CHANGE?" TO NEWITM
      ACCEPT "HOW MANY?" TO NEWBY
      REPLACE BUY WITH &NEWBY FOR ITEM=NEWITM
      LIST
      WAIT
ENDDO
ENDIF
*
COPY TO ITEMFILE
ERASE
*
ACCEPT "DATE" TO DATE
ACCEPT "DO YOU WANT THIS FILE PRINTED?" TO P
IF P="N" .OR. P="n"
SET PRINT OFF
ELSE
@ 5,5 SAY "THEN GET YOUR PRINTER READY NOW. I'LL WAIT."
WAIT
SET EJECT OFF
SET FORMAT TO PRINT
SET PRINT ON
SET EJECT OFF
ENDIF
SET MARGIN TO   0
STORE 0 TO X
@  X,0  SAY CHR(15)+"G U I D E  T O  B U Y I N G   S I Z E S"
@  X,43 SAY DATE
@  X+2,0 SAY CHR(15)+"RATIOS OF EACH SIZE TO SMALLEST SIZE"
@  X+2,48 SAY "NUMBER OF PIECES TO BUY IN EACH SIZE"
@  X+3, 0 SAY "=================================================="
@  X+3,50 SAY "===================================="
STORE 4 TO X
*SIZECHANGE
@  X, 7 SAY "4    6    8    10   12   14            4    6"
@  X,56 SAY "8    10   12   14   TOTAL BUY"
@  X+1, 0 SAY "__________________________________________________"
@  X+1,50 SAY "____________________________________"
STORE 6 TO X
USE B:ITEMFILE
GOTO TOP
SELECT SECONDARY
USE B:ITEMS
*
SELECT PRIMARY
DO WHILE .NOT. EOF
STORE ITEM TO IT
STORE BUY TO BY
SELECT SECONDARY
*
*SIZECHANGE
COUNT FOR ITEM=IT .AND. SIZE='4' .AND. SELLPRICE>1 TO FOUR
COUNT FOR ITEM=IT .AND. SIZE='6' .AND. SELLPRICE>1 TO SIX
COUNT FOR ITEM=IT .AND. SIZE='8' .AND. SELLPRICE>1 TO EIGHT
COUNT FOR ITEM=IT .AND. SIZE='10' .AND. SELLPRICE>1 TO TEN
COUNT FOR ITEM=IT .AND. SIZE='12' .AND. SELLPRICE>1 TO TWEL
COUNT FOR ITEM=IT .AND. SIZE='14' .AND. SELLPRICE>1 TO FRTEEN
*
STORE FOUR/FOUR TO FF 
STORE SIX/FOUR TO SF
STORE EIGHT/FOUR TO EF
STORE TEN/FOUR TO TF
STORE TWEL/FOUR TO TWF
STORE FRTEEN/FOUR TO FRF
*
STORE "(INT((FF+.05)*100))/100.00" TO FZ
STORE "(INT((SF+.05)*100))/100.00" TO SZ
STORE "(INT((EF+.05)*100))/100.00" TO EZ
STORE "(INT((TF+.05)*100))/100.00" TO TZ
STORE "(INT((TWF+.05)*100))/100.00" TO TWZ
STORE "(INT((FRF+.05)*100))/100.00" TO FRZ
*
STORE X+1 TO X
*
@  X,0 SAY IT 
@  X,7 SAY &FZ USING '#.#'
@  X,12 SAY &SZ USING '#.#'
@  X,17 SAY &EZ USING '#.#'
@  X,22 SAY &TZ USING '#.#'
@  X,27 SAY &TWZ USING '#.#'
@  X,32 SAY &FRZ USING '#.#'
*
STORE &FZ+&SZ+&EZ+&TZ+&TWZ+&FRZ TO TOT
*
@ X,37 SAY IT
STORE BY/TOT TO BASE
*
STORE BASE*&FZ TO BUY4
STORE BASE*&SZ TO BUY6
STORE BASE*&EZ TO BUY8
STORE BASE*&TZ TO BUY10
STORE BASE*&TWZ TO BUY12
STORE BASE*&FRZ TO BUY14
*
STORE "(INT(BUY4+.5))" TO A
STORE "(INT(BUY6+.5))" TO B
STORE "(INT(BUY8+.5))" TO C
STORE "(INT(BUY10+.5))" TO D
STORE "(INT(BUY12+.5))" TO E
STORE "(INT(BUY14+.5))" TO F
*
@ X,45 SAY &A USING '###'
@ X,50 SAY &B USING '###'
@ X,55 SAY &C USING '###'
@ X,60 SAY &D USING '###'
@ X,65 SAY &E USING '###'
@ X,70 SAY &F USING '###'
STORE &A+&B+&C+&D+&E+&F TO TT
@ X,76 SAY TT USING '###'
*
SELECT PRIMARY
SKIP
ENDDO
STORE X+1 TO X
@ X,0 SAY CHR(18)+' '
RELEASE ALL
SET FORMAT TO SCREEN
SET PRINT OFF
WAIT
DO B:INVCON
