home *** CD-ROM | disk | FTP | other *** search
- ********************** ' MultiNet Source Code ' ***********************
- ** ' SBT Corporation ' **
- ** ' One Harbor Drive, Sausalito, California 94965 ' **
- ** ' Telephone (415) 331-9900 ' **
- ***********************************************************************
- ** ' (c) Copyright 1984, Revisions 1985 - 1990 SBT Corporation ' **
- ** ' All Rights Reserved by SBT Corporation ' **
- ** ' ' **
- ***********************************************************************
- ** ' 06/04/90 = Last Update ** ARLKGL.PRG ** Version 6.35.00 ' **
- ***********************************************************************
- * ' Release Postings to General Ledger - called by ARMENU
- *
- CLOSE DATABASES
- @ 21,0 CLEAR
- @ 22,2 SAY '***** Checking General Ledger Linking File *****'
- SELECT b
- USE &m0gllkf
- LOCATE FOR amount <> 0.00
- IF EOF()
- USE
- SELECT a
- STORE ' ' TO mans
- ?? CHR(7)
- @ 22,0
- @ 22,2 SAY 'No postings found in Ledger linking file. ' + ;
- 'Press any key...' GET mans
- READ
- RETURN
- ENDIF
- SET ESCAPE OFF
- SUM amount TO mbal
- STORE 0 - mbal TO mbal
- SELECT a
- USE &m0sysdr.sysdata
- LOCATE FOR UPPER(sysid) = 'GL' + SUBSTR(m0link,2,2)
- IF EOF() .OR. SUBSTR(pass2,1,1) = 'D' .OR. DELETED() .OR. SUBSTR(a->link,21,9) ;
- = SPACE(9)
- STORE '39999- ' TO msuspens
- ELSE
- STORE SUBSTR(a->link,21,9) TO msuspens
- ENDIF
- LOCATE FOR UPPER(sysid) = m0pgmid + SUBSTR(m0comp,1,2)
- DO p0rlockd
- IF .NOT. lockedr
- CLOSE DATABASES
- SET ESCAPE ON
- RETURN
- ENDIF
- STORE SUBSTR(a->link,193,8) TO mbegin
- STORE TRIM(SUBSTR(link,4,30)) + m0pgmid + 'GLTR' + ;
- SUBSTR(a->link,2,2) TO mgltrf
- STORE TRIM(SUBSTR(link,4,30)) + m0pgmid + 'GLHD' + ;
- SUBSTR(a->link,2,2) TO mglhdf
- IF DTOC(CTOD(mbegin)) <> mbegin
- STORE DTOC(m0date) TO mbegin
- ENDIF
- STORE SUBSTR(STR(1000 + VAL(SUBSTR(a->link,37,3)),4,0),2,3) TO mbatch
- STORE 'Y' TO mans
- @ 22,0
- @ 22,2 SAY 'Do you want to print a Posting Register ? (Y/N) ' + ;
- SUBSTR(m0border,181,5) GET mans PICTURE 'Y'
- READ
- IF mans = 'Y'
- @ 22,0
- @ 22,2 SAY 'Turn on printer and align paper. Ready to ' + ;
- 'print? (Y/N) ' + SUBSTR(m0border,180,7) GET mans PICTURE 'Y'
- READ
- @ 22,0
- IF mans = 'N'
- RETURN
- ENDIF
- @ 22,2 SAY '***** Printing Posting Register *****'
- SELECT b
- COPY TO &m0dbfdr.&m0tmpf1 FOR amount <> 0.00
- SELECT c
- USE &m0dbfdr.&m0tmpf1 EXCLUSIVE
- IF VAL(STR(mbal,10,2)) <> 0.00
- APPEND BLANK
- REPLACE account WITH 'SUSPENSE ', amount WITH mbal
- ENDIF
- REPLACE ALL begin WITH mbegin, end WITH DTOC(m0date), batch WITH mbatch
- INDEX ON account TO &m0dbfdr.&m0tmpf1..ndx
- GO TOP
- IF DATE() <> CTOD('01/01/80')
- STORE '; Printed at ' + TIME() TO mtime
- ELSE
- STORE ' ' TO mtime
- ENDIF
- DO p0setprn WITH 'OFF', 'PRINT', 'ON', 0
- REPORT FORM &m0cmddr.sysgllk FOR amount <> 0.00 HEADING ;
- [Posting from &m0system.&mtime.; for &m0cname.] TO PRINT
- DO p0setprn WITH 'ON', 'SCREEN', 'OFF', 0
- USE
- DELETE FILE &m0dbfdr.&m0tmpf1..dbf
- DELETE FILE &m0dbfdr.&m0tmpf1..ndx
- SELECT b
- GO TOP
- ENDIF
- SELECT b
- IF VAL(STR(mbal,10,2)) <> 0.00
- ?? CHR(7)
- STORE ' ' TO mans
- @ 21,0 CLEAR
- @ 21,2 SAY 'This Ledger posting is not balanced (Credits <> Debits).'
- @ 22,2 SAY 'A balancing entry will be posted to the Suspense account.'
- @ 23,2 SAY 'Press any key to continue...' GET mans
- READ
- @ 21,0 CLEAR
- @ 22,2 SAY 'Confirm Suspense account or blanks to quit ' + ;
- SUBSTR(m0border,180,6) GET msuspens PICTURE '#####-###'
- READ
- SELECT d
- USE &m0glanf INDEX &m0glanf..ndx
- DO WHILE .t.
- SEEK msuspens
- IF msuspens <> ' ' .AND. (d->glstat = 'I' .OR. DELETED() .OR. EOF())
- ?? CHR(7)
- @ 22,2 SAY 'Confirm Suspense account or blanks to quit ' + ;
- SUBSTR(m0border,180,6) GET msuspens PICTURE '#####-###'
- @ 23,2 SAY 'Invalid or Inactive account. Please reenter...'
- READ
- ELSE
- EXIT
- ENDIF
- ENDDO
- IF msuspens = ' '
- CLOSE DATABASES
- SELECT a
- SET ESCAPE ON
- RETURN
- ENDIF
- STORE ' ' TO mans
- @ 22,0 CLEAR
- @ 22,2 SAY '** An entry of ' + LTRIM(STR(mbal,10,2)) + ' will be posted ' + ;
- 'to account ' + RTRIM(msuspens) + ' **'
- @ 23,2 SAY 'Press any key to continue...' GET mans
- READ
- USE
- SELECT b
- ENDIF
- STORE 'Y' TO mans
- @ 22,0 CLEAR
- @ 22,2 SAY 'Release Information to General Ledger? (Y/N) ' + ;
- SUBSTR(m0border,181,5) GET mans PICTURE 'Y'
- READ
- IF mans = 'N'
- CLOSE DATABASES
- SELECT a
- SET ESCAPE ON
- RETURN
- ENDIF
- CLEAR GETS
- SET ESCAPE OFF
- SELECT b
- @ 22,0
- @ 22,2 SAY ;
- '***** Releasing Information from General Ledger Linking File *****'
- DO p0flockd
- IF .NOT. lockedf
- CLOSE DATABASES
- SELECT a
- RETURN
- ENDIF
- LOCATE FOR amount <> 0.00
- IF EOF()
- SELECT a
- CLOSE DATABASES
- STORE ' ' TO mans
- ?? CHR(7)
- @ 22,0
- @ 22,3 SAY 'A user at another station has released this ' + m0pgmid + ;
- ' batch to Ledger. '
- @ 23,3 SAY 'Press any key...' GET mans
- READ
- SET ESCAPE ON
- RETURN
- ENDIF
- IF VAL(STR(mbal,10,2)) <> 0.00
- SET INDEX TO &m0gllkf..ndx
- SEEK msuspens
- IF EOF()
- APPEND BLANK
- REPLACE account WITH msuspens, amount WITH mbal
- ELSE
- REPLACE amount WITH amount + mbal
- ENDIF
- SET INDEX TO
- ENDIF
- GO TOP
- REPLACE ALL begin WITH mbegin, end WITH DTOC(m0date), batch WITH mbatch
- IF FILE('&mgltrf..dbf')
- COPY TO &m0dbfdr.&m0tmpf1 FOR amount <> 0.00
- SELECT c
- DO WHILE FILE('&mglhdf..dbf')
- STORE 'Y' TO mretry
- @ 22,0 CLEAR
- @ 22,2 SAY 'A user at another station is releasing ' + m0pgmid + ;
- ' information to this GL company. '
- @ 23,2 SAY 'Do you want to try again? (Y/N)' GET mretry PICTURE 'Y'
- READ
- IF mretry = 'N'
- CLOSE DATABASES
- IF FILE('&m0dbfdr.&m0tmpf1..dbf')
- DELETE FILE &m0dbfdr.&m0tmpf1..dbf
- ENDIF
- SELECT a
- SET ESCAPE ON
- RETURN
- ENDIF
- ENDDO
- RENAME &mgltrf..dbf TO &mglhdf..dbf
- USE &mglhdf EXCLUSIVE
- APPEND FROM &m0dbfdr.&m0tmpf1
- USE
- DELETE FILE &m0dbfdr.&m0tmpf1..dbf
- SELECT b
- ELSE
- DO WHILE FILE('&mglhdf..dbf')
- STORE 'Y' TO mretry
- @ 22,0 CLEAR
- @ 22,2 SAY 'A user at another station is releasing ' + m0pgmid + ;
- ' information to this GL company. '
- @ 23,2 SAY 'Do you want to try again? (Y/N)' GET mretry PICTURE 'Y'
- READ
- IF mretry = 'N'
- CLOSE DATABASES
- IF FILE('&m0dbfdr.&m0tmpf1..dbf')
- DELETE FILE &m0dbfdr.&m0tmpf1..dbf
- ENDIF
- SELECT a
- SET ESCAPE ON
- RETURN
- ENDIF
- ENDDO
- COPY TO &mglhdf FOR amount <> 0.00
- ENDIF
- REPLACE ALL amount WITH 0.00
- USE
- IF .NOT. FILE('&mgltrf..dbf')
- RENAME &mglhdf..dbf TO &mgltrf..dbf
- ELSE
- USE &mgltrf EXCLUSIVE
- APPEND FROM &mglhdf
- IF FILE('&mglhdf..dbf')
- DELETE FILE &mglhdf..dbf
- ENDIF
- USE
- ENDIF
- SELECT a
- STORE SUBSTR(STR(1000 + VAL(mbatch) + 1,4,0),2,3) TO mbatch
- IF mbatch = '000'
- STORE '001' TO mbatch
- ENDIF
- REPLACE link WITH SUBSTR(link,1,36) + mbatch + ;
- SUBSTR(link,40,153) + DTOC(m0date)
- UNLOCK
- CLOSE DATABASES
- SET ESCAPE ON
- RETURN
- *
- * ' $Revision: 1.16 $
- * ' $Date: 25 May 1990 16:20:10 $
- **********************
- ** ' ARLKGL.PRG ' **
- ** ' 267 Lines ' **
- **********************