* CJP.CMD - Close Journal Period or Month STORE TRIM(TITLE) TO MTITLE ERASE @ 1,10 SAY TMARK + " " + CNAME SET INTE OFF @ 3,10 SAY MTITLE SET INTE ON STORE 5 TO ROW @ 5,10 SAY "You may use this program to close either a single month or all" @ 6,10 SAY "months currently open. This process involves rolling up dollar" @ 7,10 SAY "amounts stored in transactions and adding them to totals stored" @ 8,10 SAY "in the master files, then deleting the journal transactions." @ 9,10 SAY "Closing a month will affect the amount of detail printed on the" @ 10,10 SAY "AR, AP and Journal register reports. It does not affect the total" @ 11,10 SAY "balance for a customer or vendor nor does it affect your standard" @ 12,10 SAY "reports. You should backup your journal file at this point. Make" @ 13,10 SAY "sure you have printed the following reports before closing:" @ 14,10 SAY " Accounts receivable report" @ 15,10 SAY " Accounts payable report" @ 16,10 SAY " Journal register reports" STORE " " TO ANSWER @ 19,10 SAY "Enter just a RETURN to proceed or (Q)uit " GET ANSWER PICTURE "!" READ IF ANSWER = "Q" RETURN ENDIF ERASE @ 1,10 SAY TMARK + " " + CNAME SET INTE OFF @ 3,10 SAY MTITLE SET INTE ON SELECT SECONDARY USE DAJOUR STORE " " TO MONTH DO WHILE (MONTH < "01" .OR. MONTH > "12") .AND. !(MONTH) <> "ALL" STORE " " TO MONTH @ 5,10 SAY "Enter the month you wish to close (01-12) or 'ALL' " GET MONTH READ ENDDO IF !(MONTH) = "ALL" STORE " " TO CRITERIA ELSE STORE "FOR PDATE = TRIM(MONTH)" TO CRITERIA ENDIF COUNT TO ALLT COUNT &CRITERIA TO DELT STORE 7 TO ROW @ 7,10 SAY STR(DELT,5)+" OF "+STR(ALLT,5)+" transaction records will be removed from" @ 8,10 SAY "your journal transaction file by this closing. Do you wish to" @ 9,10 SAY "copy these records to a backup file before they are deleted? If" @ 10,10 SAY "yes, you will be asked for the name of the file to copy to so be" @ 11,10 SAY "prepared. Enter just RETURN to copy or anything else to not copy." STORE "COPY" TO ANSWER @ 12,10 GET ANSWER PICTURE "!!!!" READ IF ANSWER = "COPY" @ 14,10 SAY "Enter a filename (.DBF extension not necessary) to which you wish" @ 15,10 SAY "these transactions copied. Do not enter the name of an exsisting " @ 16,10 SAY "file unless you want that file replaced. You may preface the name" @ 17,10 SAY "with a drive if you wish or use the default drive of " + ACC + "." STORE " " TO SAVEFILE @ 18,10 SAY "File name is " GET SAVEFILE READ @ 19,10 SAY "Now copying to " + SAVEFILE COPY ALL &CRITERIA TO &SAVEFILE STORE ROW + 13 TO ROW ELSE @ 14,10 SAY "A backup copy of the transactions was not made." STORE ROW + 9 TO ROW ENDIF STORE " " TO ANSWER @ ROW,10 SAY "Enter just a RETURN to close or (Q)uit " GET ANSWER PICTURE "!" READ IF ANSWER = "Q" RETURN ENDIF STORE ROW + 1 TO ROW @ ROW,10 SAY "Standby while we close some transactions." IF CRITERIA = " " STORE "FOR " TO CONNECT ELSE STORE ".AND. " TO CONNECT ENDIF STORE "LEDGER = 'AR'" TO JTYPE COPY ALL &CRITERIA&CONNECT&JTYPE TO DATEMP SELECT SECONDARY USE DATEMP SORT ON ID:NUMB TO DATEMP1 USE SELECT PRIMARY USE DACUST INDEX DACUST1 UPDATE FROM DATEMP1 ON ID:NUMB ADD TTOTAL SELECT SECONDARY USE DAJOUR STORE "LEDGER = 'AP'" TO JTYPE COPY ALL &CRITERIA&CONNECT&JTYPE TO DATEMP SELECT SECONDARY USE DATEMP SORT ON ID:NUMB TO DATEMP1 USE SELECT PRIMARY USE DAVEND INDEX DAVEND1 UPDATE FROM DATEMP1 ON ID:NUMB ADD TTOTAL SELECT SECONDARY USE DAJOUR DELETE ALL &CRITERIA PACK INDEX ON ID:NUMB+PDATE TO DAJOUR1 INDEX ON REF:NO+PDATE TO DAJOUR2 RETURN