************************************************
* ANCHART.CMD - V1.00 -
* USED TO PROCESS ANCHART.
* FROM CHART OF ACCOUNTS MENU.
************************************************
ERASE
******************* DISPLAY ANCHART ***************
IF CHOICEAN = "1"
  USE ANCHART
  DISPLAY ALL
  WAIT
ENDIF
******************* EDIT ANCHART ***************
IF CHOICEAN = "2"
  ERASE
  ? "USE: <CTRL>W TO WRITE (SAVE) EDITS."
  ? "USE: <CTRL>Q TO QUIT (WITHOUT SAVING) EDITS."
  ? "USE: <CR> TO EXIT EDIT MODE."
  ? "USE: ARROW KEYS TO MOVE CURSOR IN EDIT MODE."
  ? "--------------------------------------------------"
  ? " "
  ACCEPT "ENTER ACCOUNT NUMBER TO EDIT" TO MEDAN
  USE ANCHART
  LOCATE FOR AN = MEDAN
  DISPLAY OFF
  @ 18,2 SAY "IS THIS THE ACCOUNT NUMBER TO EDIT? (Y/N)"
  @ 22,1 SAY " "
  WAIT TO MANS
  IF MANS = "Y" .OR. MANS = "y"
    EDIT #
  ENDIF
ENDIF
********************* ADD ACCOUNTS **************
IF CHOICEAN = "3"
  ERASE
  ? "USE: <CTRL>W TO WRITE (SAVE) EDITS."
  ? "USE: <CTRL>Q TO QUIT (WITHOUT SAVING) EDITS."
  ? "USE: <CR> TO EXIT APPEND MODE."
  ? "USE: ARROW KEYS TO MOVE CURSOR IN APPEND MODE."
  ? "--------------------------------------------------"
  ? " "
  USE ANCHART
  APPEND
ENDIF
********************* SORT ANCHART **************
IF CHOICEAN = "4"
  ERASE
  @ 10,5 SAY "SORTING CHART OF ACCOUNTS"
  USE ANCHART
  SORT ON AN TO B:ANTEMP
  USE B:ANTEMP
  DELETE FILE ANCHART
  COPY TO ANCHART
  USE ANCHART
  DELETE FILE B:ANTEMP
ENDIF
********************* DELETE ACCOUNT ************
IF CHOICEAN = "5"
  USE ANCHART
  STORE "Y" TO MANS
DO WHILE MANS = "Y" .OR. MANS = "y"
  ERASE
  ACCEPT "ENTER ACCOUNT NUMBER TO DELETE" TO MDELAN
  USE ANCHART
  LOCATE FOR AN = MDELAN
  DISPLAY OFF
  @ 18,2 SAY "IS THIS THE ACCOUNT TO DELETE?(Y/N)"
  @ 22,1 SAY " "
  WAIT TO MANS
  IF MANS = "Y" .OR. MANS = "y"
    DELETE
    STORE " " TO MANS
  ENDIF
  ACCEPT "DELETE ANOTHER ACCOUNT? (Y/N) <CR>" TO MANS
LOOP
ENDDO
PACK
ENDIF
***************** PRINT ANCHART *****************
IF CHOICEAN = "6"
STORE 1 TO MGRP
STORE " " TO MAN
STORE " " TO MDESCR
ERASE
@ 10,5 SAY "GETTING CHART OF ACCOUNTS"
USE ANCHART
DO WHILE MGRP <= 5
  USE ANCHART
DO CASE
    CASE MGRP = 1
    COPY TO ANTEMP FOR AN <= "199"
    CASE MGRP = 2
    COPY TO ANTEMP FOR AN >= "200" .AND. AN <= "299"
    CASE MGRP = 3
    COPY TO ANTEMP FOR AN >= "300" .AND. AN <= "399"
    CASE MGRP = 4
    COPY TO ANTEMP FOR AN >= "400" .AND. AN <= "499"
    CASE MGRP = 5
    COPY TO ANTEMP FOR AN >= "500" .AND. AN <= "599"
ENDCASE
  USE ANTEMP
ERASE
IF MHNAME = " "
  ACCEPT "TYPE HEADER NAME" TO MHNAME
ENDIF
IF MHDATE = "00/00/00"
  ACCEPT "TYPE HEADER DATE (MM/DD/YY) <CR>" TO MHDATE
ENDIF
  ERASE
  SET PRINT ON
  SET FORMAT TO PRINT
  @ 0,5  SAY MHNAME
  @ 1,5  SAY "CHART OF ACCOUNTS"
  @ 2,5  SAY MHDATE
DO CASE
CASE MGRP = 1
  @ 3,0  SAY "     *** ASSET ACCOUNTS ***"
CASE MGRP = 2
  @ 3,0  SAY "     *** LIABILITY ACCOUNTS ***"
CASE MGRP = 3
  @ 3,0  SAY "     *** CAPITAL ACCOUNTS ***"
CASE MGRP = 4
  @ 3,0  SAY "     *** INCOME ACCOUNTS ***"
CASE MGRP = 5
  @ 3,0  SAY "     *** EXPENSE ACCOUNTS ***"
ENDCASE
  @ 4,0  SAY "     ============================================="
  @ 5,0  SAY "     A/N      DESCRIPTION"
  @ 6,0  SAY "     ---------------------------------------------"
  @ 7,1  SAY "      "
STORE 0 TO MLIN
DO WHILE .NOT. EOF
  STORE MLIN + 1 TO MLIN
  STORE AN TO MAN
  STORE DESCR TO MDESCR
? "    ",MAN,"   ",MDESCR
  IF MLIN = 50
    ? CHR(12)
    STORE 0 TO MLIN
  ENDIF
  SKIP
  LOOP
ENDDO
? " "
STORE MGRP + 1 TO MGRP
ENDDO
? CHR(12)
  SET FORMAT TO SCREEN
  SET PRINT OFF
USE ANCHART
DELETE FILE ANTEMP
ENDIF
******************* RETURN ********************
IF CHOICEAN = "7"
  STORE " " TO CHOICEAN
ENDIF
RETURN
CANCEL
