DIFF
SET TALK OFF
SET BELL OFF
SET STATUS ON
*SET ESCAPE OFF
SET CONFIRM ON
set exclusive on
STORE '00000 000000' TO LROUTENO
STORE 'N' TO LRFLAG
MANS='F'
@ 02, 10 SAY ' IS THIS A RESTART? '
@ 02, 30 GET LRFLAG PICT '!'
READ
IF LRFLAG ='Y'
@ 05, 10 SAY 'LAST GOOD BILL ROUTENO ='
@ 05, 26 GET LROUTENO PICT 'XXXXX XXXXXX'
READ
USE &LNEWCUSFIL
DELETE ALL FOR FROUTENO > LROUTENO
PACK
USE
STORE 'N' TO LRFLAG
ENDIF
SET PRINT OFF
STORE .F. TO LGOOD
STORE 'Y' TO LALIGN
DO WHILE .NOT. LGOOD
CLEAR
@ 02, 10 SAY LVER
@ 04, 10 SAY ' SET PRINTER TO FORM LENGTH = 11 INCHES, CPI = 10 -- PLAIN PAPER'
@ 05, 10 SAY 'DO YOU WANT AN ALIGNMENT TEST?'
@ 05, 41 GET LALIGN
READ
STORE UPPER(LALIGN) TO LALIGN
IF LALIGN = 'Y'
SET PRINT ON
*FOR EPSON DFX-5000
* COMMENT LINE BELOW FOR PLAIN PAPER
* ?? CHR(27)+CHR(64) + CHR(27)+CHR(80)+ CHR(27)+CHR(67)+CHR(33)
SET PRINT OFF
STORE ' ' TO MJUNK
@ 06, 10 SAY 'MAKE SURE FORM IS SET AT TOP, THEN HIT RETURN'
@ 07, 10 GET MJUNK
READ
SET DEVICE TO PRINT
@ 01, 01 SAY 'TOP LEFT'
EJECT
SET DEVICE TO SCREEN
ELSE
STORE .T. TO LGOOD
SET DEVICE TO SCREEN
ENDIF
ENDDO
SELECT A
USE &LCUSFILE INDEX &LCUSRTNDX, &LCUSACNDX
STORE .F. TO LGOOD
DO WHILE .NOT. LGOOD
CLEAR
STORE SPACE(12) TO LROUTENO, LEND_ROUTE
STORE CTOD(' / / ') TO LTHRU,LPAY_BY
store 000000 TO MCURINV
STOR CTOD(' / / ') TO LPRINT_DT
set century on
@ 2,10 SAY 'ACTUAL DATE BILLS PRINTED '
@ 2,45 GET LPRINT_DT pict '@D'
@ 3, 10 SAY 'STARTING INVOICE NO.='
@ 3, 33 GET MCURINV
@ 4, 10 SAY 'STARTING ROUTE NO.='
@ 4, 33 GET LROUTENO PICT 'XXXXX XXXXXX'
@ 05, 10 SAY 'ENDING ROUTE NO. = '
@ 05, 33 GET LEND_ROUTE PICT 'XXXXX XXXXXX'
@ 6, 10 SAY 'PAYMENTS THRU '
@ 6, 33 GET LTHRU pict '@D'
@ 7, 10 SAY 'PAYMENT DUE '
@ 07, 33 GET LPAY_BY pict '@D'
READ
seek LROUTENO
IF .NOT. EOF()
STORE .T. TO LGOOD
ENDIF
ENDDO
SELE C
USE (LPMT_MONTH) INDEX (LPMT_RT)
DO WHILE C->FROUTENO< LROUTENO .AND. .NOT. EOF()
SKIP
ENDDO
SELE B
USE &LRD_FILE INDEX &LRD_RTNDX
DO WHILE B->FROUTENO < LROUTENO .AND. .NOT. EOF()
SKIP
ENDDO
SELECT D
USE &LNEWCUSFIL
SET DEVICE TO PRINT
* SET DEVICE TO SCREEN
SELECT A
DO WHILE .NOT. EOF() .AND. A->FROUTENO <= LEND_ROUTE
STORE A->FBAL TO M30BAL
STORE A->FINVNO TO M30INV
STORE A->FCURAMT TO M30AMT
STORE A->FCURPMT TO M30PMT
STORE A->F30PMT TO M60PMT
STORE A->F30BAL TO M60BAL
STORE A->F30INV TO M60INV
STORE A->F30AMT TO M60AMT
STORE A->F60BAL TO M90BAL
STORE A->F60INV TO M90INV
LBILL_THRU=CMONTH(FBILL_THRU)+STR(YEAR(FBILL_THRU),5)
@ 01, 01 SAY 'This is your bill from KWAJALEIN ATOLL JOINT UTIL. RES.'
@ 03, 56 SAY 'PRINTED '
@ 03, 64 SAY LPRINT_DT
@ 04, 48 SAY 'Account No.'
@ 04,61 SAY A->FCUSTNO
@ 05, 48 say ' Route No.'
@ 05,61 SAY A->FROUTENO
* @ 05,89 SAY LBILL_THRU
@ 7, 23 SAY "For service through "
@ 7, 46 SAY LBILL_THRU
@ 8,53 SAY 'PREVIOUS BALANCE'
@ 8, 75 SAY A->FBAL PICT '999,999.99'
STORE 10 TO LN
STORE A->FBAL TO MBAP
STORE 0 TO LCURPMT
SELECT C
DO WHILE C->FROUTENO < A->FROUTENO .AND. .NOT. EOF()
SET DEVICE TO SCREEN
CLEAR
@ 2, 10 SAY 'LOST PAYMENT TRANS'
@ 2, 38 SAY C->FROUTENO
@ 2, 55 SAY RECNO()
@ 3, 10 SAY 'RECORD INFO ABOVE'
WAIT TO MJUNK
SET DEVICE TO PRINT
SKIP
ENDDO
*CLEAR
*@ 4, 10 SAY 'DO YOU WANT TO SEND THE OUTPUT TO THE SCREEN?'
*@ 5, 10 SAY 'PLEASE ANSWER WITH EITHER CAPITAL T OR CAPITAL F'
*@ 4, 50 GET MANS
*READ
*IF MANS='T'
*SET PRINT OFF
*SET DEVICE TO SCREEN
*ENDIF
@LN, 01 SAY '--PAYMENTS--'
@ LN, 14 SAY "(THRU " + DTOC(LTHRU) +")"
LN=LN+1
DO WHILE C->FROUTENO = A->FROUTENO .AND. .NOT. EOF()
@ LN, 15 SAY C->FPDATE
@ LN, 25 SAY "Receipt #"
@ LN, 35 SAY C->FRRCPT
@ LN, 45 SAY "Check #"
@ LN, 54 SAY C->FRCHK
@ LN, 60 SAY 'you paid '
@ LN, 75 SAY C->FAMTPD PICT '999,999.99'
IF LEFT(C->FCOMNT,1) <> ' '
@ LN+1, 35 SAY C->FCOMNT
LN=LN+1
ENDIF
STORE MBAP - C->FAMTPD TO MBAP
STORE LCURPMT + C->FAMTPD TO LCURPMT
STORE LN+1 TO LN
SKIP
ENDDO
IF LN > 40
@ 55, 40 SAY TRIM(A->FFIRSTNAME)+' '+A->FCOMPANY
@ 56, 40 SAY A->FADDR1
* @ 56, 75 SAY 'NEXT PAGE'
@ 57, 40 SAY A->FADDR2
@ 58, 40 SAY TRIM(A->FCITY)+' '+TRIM(A->FSTATE)+' '+A->FZIP
@ 59, 70 SAY 'NEXT PAGE'
EJECT
@ 04,61 SAY A->FCUSTNO
@ 05,61 SAY A->FROUTENO
@ 05,89 SAY LBILL_THRU
@ 7, 46 SAY LBILL_THRU
@ 7, 91 SAY A->FCUSTNO
@ 8, 15 SAY "CONTINUATION BILL"
STORE MCURINV +1 TO MCURINV
LN=11
ENDIF
LN=LN+1
@LN, 40 SAY 'BALANCE AFTER PAYMENTS = '
@ LN, 75 SAY MBAP PICT '999,999.99'
STORE MBAP TO MNEWBAL
* GET READY TO PROCESS NEW CHARGE TRANSACTIONS
STORE 0 TO MREADING, MWREADING, MSREADING
STORE 0 TO LCONSUMPT, LEDAYS, MWDAYS, MSDAYS, MWCONSUMPT, MSCONSUMPT
STORE 0 TO LEYTD, LCURCONS, LCURDAYS
STORE ' ' TO MCLASS, MWCLASS, MSCLASS
STORE 1 TO MMULTIPL, MWMULTIPL, MSMULTIPL
STORE CTOD(' / / ') TO MREADDATE, MWREADDATE, MSREADDATE
STORE CTOD(' / / ') TO LOLDRDDT
STORE ' ' TO MESSAGE1
STORE ' ' TO MESSAGE2
STORE 0.00 TO LCURAMT, MWCURAMT, MSCURAMT
LN=LN+2
SELECT B
DO WHILE B->FROUTENO < A->FROUTENO .AND. .NOT. EOF()
SET DEVICE TO SCREEN
CLEAR
@ 2, 10 SAY 'LOST READING TRANS'
@ 2, 38 SAY B->FROUTENO
@ 2, 55 SAY RECNO()
@ 3, 10 SAY 'RECORD INFO ABOVE'
WAIT TO MJUNK
IF MANS='T'
SET DEVICE TO SCREEN
SET PRINT OFF
ELSE
SET DEVICE TO PRINT
ENDIF
SKIP
ENDDO
@ LN,01 SAY '--NEW CHARGES--'
LN=LN+1
@LN,10 SAY 'New Reading'
@ln,25 SAY 'Previous Reading'
@LN,50 SAY ' Gallons Rate'
ln=ln+1
DO WHILE B->FROUTENO = A->FROUTENO .AND. .NOT. EOF()
IF LN > 40
@ 55, 40 SAY TRIM(A->FFIRSTNAME)+' '+A->FCOMPANY
@ 56, 40 SAY A->FADDR1
* @ 56, 75 SAY 'NEXT PAGE'
@ 57, 40 SAY A->FADDR2
@ 58, 40 SAY TRIM(A->FCITY)+' '+TRIM(A->FSTATE)+' '+A->FZIP
@ 59, 70 SAY 'NEXT PAGE'
EJECT
@ 04,61 SAY A->FCUSTNO
@ 05,61 SAY A->FROUTENO
* @ 05,89 SAY LBILL_THRU
@ 7, 46 SAY LBILL_THRU
* @ 7, 91 SAY A->FCUSTNO
@ 8, 15 SAY "CONTINUATION BILL"
STORE MCURINV +1 TO MCURINV
LN=11
ENDIF
LN=LN+1
STORE B->FCONSUMPT TO LCONSUMPT
STORE B->FCLASS TO MCLASS
IF SUBSTR(MCLASS,2,1) <> 'F'
@ LN, 10 SAY B->FNEWREAD
@ LN, 25 SAY B->FREADING
@ LN, 46 SAY B->FMULTIPL
@ LN, 51 SAY LCONSUMPT pict '9999999'
@ LN, 63 SAY B->FPRICE PICT '9.999'
ENDIF
STORE B->FNEWREAD TO MREADING
STORE B->FNEWRDDATE TO MREADDATE
STORE B->FMULTIPL TO MMULTIPL
STORE B->FDIGITS TO MDIGITS
STORE B->FCLASS TO MCLASS
STORE B->FREADDATE TO LOLDRDDT
STORE B->FNEWRDDATE - B->FREADDATE TO LCURDAYS
IF LCURDAYS < 1 .OR. LCURDAYS > 200
STORE 30 TO LCURDAYS
ENDIF
STORE LN+1 TO LN
@ LN, 43 SAY MCLASS
@ LN, 15 SAY B->FNEWRDDATE
@ LN, 30 SAY LOLDRDDT
@ LN, 48 SAY SUBSTR(B->FDESCRIPT,1,26)
@ LN, 75 SAY B->FAMT PICT '999,999.99'
STORE LCURAMT + B->FAMT TO LCURAMT
DO CASE
CASE LEFT(MCLASS,1) = 'W'
STORE MCLASS TO MWCLASS
STORE MREADING TO MWREADING
STORE MREADDATE TO MWREADDATE
STORE MMULTIPL TO MWMULTIPL
STORE MDIGITS TO MWDIGITS
STORE MWDAYS + LCURDAYS TO MWDAYS
STORE LCURCONS + MWCONSUMPT TO MWCONSUMPT
STORE B->FAMT + MWCURAMT TO MWCURAMT
STORE B->FMETER_SN TO LWMETER_SN
CASE LEFT(MCLASS,1) = 'S'
STORE MCLASS TO MSCLASS
STORE MREADING TO MSREADING
STORE MREADDATE TO MSREADDATE
STORE MMULTIPL TO MSMULTIPL
STORE MDIGITS TO MSDIGITS
STORE MSDAYS + LCURDAYS TO MSDAYS
STORE LCURCONS + MSCONSUMPT TO MSCONSUMPT
STORE B->FAMT + MSCURAMT TO MSCURAMT
ENDCASE
STORE LN+1 TO LN
SKIP
ENDDO
MNEWBAL=MBAP + LCURAMT
STORE 0 TO LTOT_PMT, L60_DAYS, L30_DAYS, L90_DAYS, L0_29DAYS, LAGE_SUM
IF MNEWBAL <= 0
LTOT_PMT = 0
L90_DAYS = 0
L60_DAYS = 0
L30_DAYS = 0
L0_29DAYS= MNEWBAL
ELSE
IF LCURPMT >0
LTOT_PMT = LCURPMT
ENDIF
IF M30PMT >0
LTOT_PMT = LTOT_PMT + M30PMT
ENDIF
IF M60PMT > 0
LTOT_PMT = LTOT_PMT + M60PMT
ENDIF
IF LCURAMT < 0
LTOT_PMT = LTOT_PMT - LCURAMT
ENDIF
IF M30AMT < 0
LTOT_PMT = LTOT_PMT - M30AMT
ENDIF
IF M60AMT < 0
LTOT_PMT = LTOT_PMT - M60AMT
ENDIF
IF LTOT_PMT >= M90BAL
LTOT_PMT = LTOT_PMT - M90BAL
L90_DAYS = 0
ELSE
L90_DAYS = M90BAL - LTOT_PMT
LTOT_PMT = 0
ENDIF
IF M60AMT > 0
L60_DAYS = M60AMT
ENDIF
IF M60PMT < 0
L60_DAYS = L60_DAYS - M60PMT
ENDIF
IF LTOT_PMT >= L60_DAYS
LTOT_PMT = LTOT_PMT - L60_DAYS
L60_DAYS = 0
ELSE
L60_DAYS = L60_DAYS - LTOT_PMT
LTOT_PMT = 0
ENDIF
IF M30AMT > 0
L30_DAYS = M30AMT
ENDIF
IF M30PMT < 0
L30_DAYS = L30_DAYS - M30PMT
ENDIF
IF LTOT_PMT >= L30_DAYS
LTOT_PMT = LTOT_PMT - L30_DAYS
L30_DAYS = 0
ELSE
L30_DAYS = L30_DAYS - LTOT_PMT
LTOT_PMT = 0
ENDIF
ENDIF
IF LN > 40
@ 55, 40 SAY TRIM(A->FFIRSTNAME)+' '+A->FCOMPANY
@ 56, 40 SAY A->FADDR1
* @ 56, 75 SAY 'NEXT PAGE'
@ 57, 40 SAY A->FADDR2
@ 58, 40 SAY TRIM(A->FCITY)+' '+TRIM(A->FSTATE)+' '+A->FZIP
@ 59, 70 SAY 'NEXT PAGE'
EJECT
@ 04,61 SAY A->FCUSTNO
@ 05,61 SAY A->FROUTENO
* @ 05,89 SAY LBILL_THRU
@ 7, 46 SAY LBILL_THRU
* @ 7, 91 SAY A->FCUSTNO
@ 8, 15 SAY "CONTINUATION BILL"
STORE MCURINV +1 TO MCURINV
LN=11
ENDIF
IF L90_DAYS > 0
LN=LN+1
@ LN, 12 SAY "EWOR AM MURI EMOTLOK JEN 90 RAN KIN JONAN IN "
@ LN, 57 SAY L90_DAYS PICT "99,999.99"
LN=LN+1
@ LN, 12 SAY "ENAJ TUM (DISCONNECT) JAROM EO ILO EJELOK BAR KOJELLA"
ENDIF
@ 41, 40 SAY 'Your new Balance is >>'
@ 41, 75 SAY MNEWBAL PICT '$$$,$$9.99'
@ 42, 40 say 'Payment due by '
@ 42,55 say Lpay_by
@ 44,01 say '_'
@ 46,05 SAY 'KWAJALEIN ATOLL JOINT UTILITY RES.'
@ 47,05 SAY 'EBEYE'
@ 48,05 SAY 'EBEYE RMI MH 96970'
@ 55, 40 SAY TRIM(A->FFIRSTNAME)+' '+A->FCOMPANY
@ 56, 40 SAY A->FADDR1
@ 57, 40 SAY A->FADDR2
@ 58, 40 SAY TRIM(A->FCITY)+' '+TRIM(A->FSTATE)+' '+A->FZIP
EJECT
SELECT D
APPEND BLANK
REPLACE D->FCUSTNO WITH A->FCUSTNO
REPLACE D->FFIRSTNAME WITH A->FFIRSTNAME
REPLACE D->FCOMPANY WITH A->FCOMPANY
REPLACE D->FADDR1 WITH A->FADDR1
REPLACE D->FADDR2 WITH A->FADDR2
REPLACE D->FCITY WITH A->FCITY
REPLACE D->FSTATE WITH A->FSTATE
REPLACE D->FZIP WITH A->FZIP
REPLACE D->FROUTENO WITH A->FROUTENO
IF MWCURAMT > 0
REPLACE D->FEYTD WITH MWCONSUMPT + A->FEYTD
REPLACE D->FEDAYS WITH MWDAYS + A->FEDAYS
REPLACE D->FREADDATE WITH MWREADDATE
REPLACE D->FREADING WITH MWREADING
REPLACE D->FDIGITS WITH MWDIGITS
REPLACE D->FMULTIPL WITH MWMULTIPL
REPLACE D->FCLASS WITH MWCLASS
ELSE
REPLACE D->FEYTD WITH A->FEYTD
REPLACE D->FEDAYS WITH A->FEDAYS
REPLACE D->FREADDATE WITH A->FREADDATE
REPLACE D->FREADING WITH A->FREADING
REPLACE D->FDIGITS WITH A->FDIGITS
REPLACE D->FMULTIPL WITH A->FMULTIPL
IF SUBSTR(MWCLASS,2,1) = 'I'
REPLACE D->FCLASS WITH MWCLASS
ELSE
REPLACE D->FCLASS WITH A->FCLASS
ENDIF
ENDIF
IF MSCURAMT > 0
REPLACE D->FSWYTD WITH MSCONSUMPT + A->FSWYTD
REPLACE D->FSWDAYS WITH MSDAYS + A->FSWDAYS
REPLACE D->FSWREADDAT WITH MSREADDATE
REPLACE D->FSWREADING WITH MSREADING
REPLACE D->FSWDIGITS WITH MSDIGITS
REPLACE D->FSWMULTIPL WITH MSMULTIPL
REPLACE D->FSWCLASS WITH MSCLASS
ELSE
REPLACE D->FSWYTD WITH A->FSWYTD
REPLACE D->FSWDAYS WITH A->FSWDAYS
REPLACE D->FSWREADDAT WITH A->FSWREADDAT
REPLACE D->FSWREADING WITH A->FSWREADING
REPLACE D->FSWDIGITS WITH A->FSWDIGITS
REPLACE D->FSWMULTIPL WITH A->FSWMULTIPL
IF SUBSTR(MSCLASS,2,1) = 'I'
REPLACE D->FSWCLASS WITH MSCLASS
ELSE
REPLACE D->FSWCLASS WITH A->FSWCLASS
ENDIF
ENDIF
REPLACE D->FBAL WITH MNEWBAL
REPLACE D->FINVNO WITH MCURINV
REPLACE D->FSPEC_RATE WITH A->FSPEC_RATE
REPLACE D->FCURAMT WITH LCURAMT
REPLACE D->FCURPMT WITH LCURPMT
REPLACE D->F30BAL WITH M30BAL
REPLACE D->F60BAL WITH M60BAL
REPLACE D->F60PMT WITH M60PMT
REPLACE D->F30AMT WITH M30AMT
REPLACE D->F30PMT WITH M30PMT
REPLACE D->F60INV WITH M60INV
REPLACE D->F30INV WITH M30INV
REPLACE D->F60AMT WITH M60AMT
REPLACE D->F90BAL WITH M90BAL
REPLACE D->F90INV WITH M90INV
IF LWMETER_SN <> ' ' .AND. LWMETER_SN <> ''
REPLACE D->FMETER_SN WITH LWMETER_SN
ELSE
REPLACE D->FMETER_SN WITH A->FMETER_SN
ENDIF
REPL D->FSWMETERSN WITH A->FSWMETERSN
REPL D->FADDTOILET WITH A->FADDTOILET
REPLACE D->FSEAL_NO WITH A->FSEAL_NO
REPLACE D->FCONN_DATE WITH A->FCONN_DATE
REPLACE D->FW_STDEV WITH A->FW_STDEV
STORE MCURINV + 1 TO MCURINV
SELECT A
SKIP
ENDDO
SET DEVICE TO SCREEN
CLOSE DATABASES
SET PROC TO
SET EXCLUSIVE OFF
RETURN
SET TALK OFF
SET BELL OFF
SET STATUS ON
*SET ESCAPE OFF
SET CONFIRM ON
set exclusive on
STORE '00000 000000' TO LROUTENO
STORE 'N' TO LRFLAG
MANS='F'
@ 02, 10 SAY ' IS THIS A RESTART? '
@ 02, 30 GET LRFLAG PICT '!'
READ
IF LRFLAG ='Y'
@ 05, 10 SAY 'LAST GOOD BILL ROUTENO ='
@ 05, 26 GET LROUTENO PICT 'XXXXX XXXXXX'
READ
USE &LNEWCUSFIL
DELETE ALL FOR FROUTENO > LROUTENO
PACK
USE
STORE 'N' TO LRFLAG
ENDIF
SET PRINT OFF
STORE .F. TO LGOOD
STORE 'Y' TO LALIGN
DO WHILE .NOT. LGOOD
CLEAR
@ 02, 10 SAY LVER
@ 04, 10 SAY ' SET PRINTER TO FORM LENGTH = 11 INCHES, CPI = 10 -- PLAIN PAPER'
@ 05, 10 SAY 'DO YOU WANT AN ALIGNMENT TEST?'
@ 05, 41 GET LALIGN
READ
STORE UPPER(LALIGN) TO LALIGN
IF LALIGN = 'Y'
SET PRINT ON
*FOR EPSON DFX-5000
* COMMENT LINE BELOW FOR PLAIN PAPER
* ?? CHR(27)+CHR(64) + CHR(27)+CHR(80)+ CHR(27)+CHR(67)+CHR(33)
SET PRINT OFF
STORE ' ' TO MJUNK
@ 06, 10 SAY 'MAKE SURE FORM IS SET AT TOP, THEN HIT RETURN'
@ 07, 10 GET MJUNK
READ
SET DEVICE TO PRINT
@ 01, 01 SAY 'TOP LEFT'
EJECT
SET DEVICE TO SCREEN
ELSE
STORE .T. TO LGOOD
SET DEVICE TO SCREEN
ENDIF
ENDDO
SELECT A
USE &LCUSFILE INDEX &LCUSRTNDX, &LCUSACNDX
STORE .F. TO LGOOD
DO WHILE .NOT. LGOOD
CLEAR
STORE SPACE(12) TO LROUTENO, LEND_ROUTE
STORE CTOD(' / / ') TO LTHRU,LPAY_BY
store 000000 TO MCURINV
STOR CTOD(' / / ') TO LPRINT_DT
set century on
@ 2,10 SAY 'ACTUAL DATE BILLS PRINTED '
@ 2,45 GET LPRINT_DT pict '@D'
@ 3, 10 SAY 'STARTING INVOICE NO.='
@ 3, 33 GET MCURINV
@ 4, 10 SAY 'STARTING ROUTE NO.='
@ 4, 33 GET LROUTENO PICT 'XXXXX XXXXXX'
@ 05, 10 SAY 'ENDING ROUTE NO. = '
@ 05, 33 GET LEND_ROUTE PICT 'XXXXX XXXXXX'
@ 6, 10 SAY 'PAYMENTS THRU '
@ 6, 33 GET LTHRU pict '@D'
@ 7, 10 SAY 'PAYMENT DUE '
@ 07, 33 GET LPAY_BY pict '@D'
READ
seek LROUTENO
IF .NOT. EOF()
STORE .T. TO LGOOD
ENDIF
ENDDO
SELE C
USE (LPMT_MONTH) INDEX (LPMT_RT)
DO WHILE C->FROUTENO< LROUTENO .AND. .NOT. EOF()
SKIP
ENDDO
SELE B
USE &LRD_FILE INDEX &LRD_RTNDX
DO WHILE B->FROUTENO < LROUTENO .AND. .NOT. EOF()
SKIP
ENDDO
SELECT D
USE &LNEWCUSFIL
SET DEVICE TO PRINT
* SET DEVICE TO SCREEN
SELECT A
DO WHILE .NOT. EOF() .AND. A->FROUTENO <= LEND_ROUTE
STORE A->FBAL TO M30BAL
STORE A->FINVNO TO M30INV
STORE A->FCURAMT TO M30AMT
STORE A->FCURPMT TO M30PMT
STORE A->F30PMT TO M60PMT
STORE A->F30BAL TO M60BAL
STORE A->F30INV TO M60INV
STORE A->F30AMT TO M60AMT
STORE A->F60BAL TO M90BAL
STORE A->F60INV TO M90INV
LBILL_THRU=CMONTH(FBILL_THRU)+STR(YEAR(FBILL_THRU),5)
@ 01, 01 SAY 'This is your bill from KWAJALEIN ATOLL JOINT UTIL. RES.'
@ 03, 56 SAY 'PRINTED '
@ 03, 64 SAY LPRINT_DT
@ 04, 48 SAY 'Account No.'
@ 04,61 SAY A->FCUSTNO
@ 05, 48 say ' Route No.'
@ 05,61 SAY A->FROUTENO
* @ 05,89 SAY LBILL_THRU
@ 7, 23 SAY "For service through "
@ 7, 46 SAY LBILL_THRU
@ 8,53 SAY 'PREVIOUS BALANCE'
@ 8, 75 SAY A->FBAL PICT '999,999.99'
STORE 10 TO LN
STORE A->FBAL TO MBAP
STORE 0 TO LCURPMT
SELECT C
DO WHILE C->FROUTENO < A->FROUTENO .AND. .NOT. EOF()
SET DEVICE TO SCREEN
CLEAR
@ 2, 10 SAY 'LOST PAYMENT TRANS'
@ 2, 38 SAY C->FROUTENO
@ 2, 55 SAY RECNO()
@ 3, 10 SAY 'RECORD INFO ABOVE'
WAIT TO MJUNK
SET DEVICE TO PRINT
SKIP
ENDDO
*CLEAR
*@ 4, 10 SAY 'DO YOU WANT TO SEND THE OUTPUT TO THE SCREEN?'
*@ 5, 10 SAY 'PLEASE ANSWER WITH EITHER CAPITAL T OR CAPITAL F'
*@ 4, 50 GET MANS
*READ
*IF MANS='T'
*SET PRINT OFF
*SET DEVICE TO SCREEN
*ENDIF
@LN, 01 SAY '--PAYMENTS--'
@ LN, 14 SAY "(THRU " + DTOC(LTHRU) +")"
LN=LN+1
DO WHILE C->FROUTENO = A->FROUTENO .AND. .NOT. EOF()
@ LN, 15 SAY C->FPDATE
@ LN, 25 SAY "Receipt #"
@ LN, 35 SAY C->FRRCPT
@ LN, 45 SAY "Check #"
@ LN, 54 SAY C->FRCHK
@ LN, 60 SAY 'you paid '
@ LN, 75 SAY C->FAMTPD PICT '999,999.99'
IF LEFT(C->FCOMNT,1) <> ' '
@ LN+1, 35 SAY C->FCOMNT
LN=LN+1
ENDIF
STORE MBAP - C->FAMTPD TO MBAP
STORE LCURPMT + C->FAMTPD TO LCURPMT
STORE LN+1 TO LN
SKIP
ENDDO
IF LN > 40
@ 55, 40 SAY TRIM(A->FFIRSTNAME)+' '+A->FCOMPANY
@ 56, 40 SAY A->FADDR1
* @ 56, 75 SAY 'NEXT PAGE'
@ 57, 40 SAY A->FADDR2
@ 58, 40 SAY TRIM(A->FCITY)+' '+TRIM(A->FSTATE)+' '+A->FZIP
@ 59, 70 SAY 'NEXT PAGE'
EJECT
@ 04,61 SAY A->FCUSTNO
@ 05,61 SAY A->FROUTENO
@ 05,89 SAY LBILL_THRU
@ 7, 46 SAY LBILL_THRU
@ 7, 91 SAY A->FCUSTNO
@ 8, 15 SAY "CONTINUATION BILL"
STORE MCURINV +1 TO MCURINV
LN=11
ENDIF
LN=LN+1
@LN, 40 SAY 'BALANCE AFTER PAYMENTS = '
@ LN, 75 SAY MBAP PICT '999,999.99'
STORE MBAP TO MNEWBAL
* GET READY TO PROCESS NEW CHARGE TRANSACTIONS
STORE 0 TO MREADING, MWREADING, MSREADING
STORE 0 TO LCONSUMPT, LEDAYS, MWDAYS, MSDAYS, MWCONSUMPT, MSCONSUMPT
STORE 0 TO LEYTD, LCURCONS, LCURDAYS
STORE ' ' TO MCLASS, MWCLASS, MSCLASS
STORE 1 TO MMULTIPL, MWMULTIPL, MSMULTIPL
STORE CTOD(' / / ') TO MREADDATE, MWREADDATE, MSREADDATE
STORE CTOD(' / / ') TO LOLDRDDT
STORE ' ' TO MESSAGE1
STORE ' ' TO MESSAGE2
STORE 0.00 TO LCURAMT, MWCURAMT, MSCURAMT
LN=LN+2
SELECT B
DO WHILE B->FROUTENO < A->FROUTENO .AND. .NOT. EOF()
SET DEVICE TO SCREEN
CLEAR
@ 2, 10 SAY 'LOST READING TRANS'
@ 2, 38 SAY B->FROUTENO
@ 2, 55 SAY RECNO()
@ 3, 10 SAY 'RECORD INFO ABOVE'
WAIT TO MJUNK
IF MANS='T'
SET DEVICE TO SCREEN
SET PRINT OFF
ELSE
SET DEVICE TO PRINT
ENDIF
SKIP
ENDDO
@ LN,01 SAY '--NEW CHARGES--'
LN=LN+1
@LN,10 SAY 'New Reading'
@ln,25 SAY 'Previous Reading'
@LN,50 SAY ' Gallons Rate'
ln=ln+1
DO WHILE B->FROUTENO = A->FROUTENO .AND. .NOT. EOF()
IF LN > 40
@ 55, 40 SAY TRIM(A->FFIRSTNAME)+' '+A->FCOMPANY
@ 56, 40 SAY A->FADDR1
* @ 56, 75 SAY 'NEXT PAGE'
@ 57, 40 SAY A->FADDR2
@ 58, 40 SAY TRIM(A->FCITY)+' '+TRIM(A->FSTATE)+' '+A->FZIP
@ 59, 70 SAY 'NEXT PAGE'
EJECT
@ 04,61 SAY A->FCUSTNO
@ 05,61 SAY A->FROUTENO
* @ 05,89 SAY LBILL_THRU
@ 7, 46 SAY LBILL_THRU
* @ 7, 91 SAY A->FCUSTNO
@ 8, 15 SAY "CONTINUATION BILL"
STORE MCURINV +1 TO MCURINV
LN=11
ENDIF
LN=LN+1
STORE B->FCONSUMPT TO LCONSUMPT
STORE B->FCLASS TO MCLASS
IF SUBSTR(MCLASS,2,1) <> 'F'
@ LN, 10 SAY B->FNEWREAD
@ LN, 25 SAY B->FREADING
@ LN, 46 SAY B->FMULTIPL
@ LN, 51 SAY LCONSUMPT pict '9999999'
@ LN, 63 SAY B->FPRICE PICT '9.999'
ENDIF
STORE B->FNEWREAD TO MREADING
STORE B->FNEWRDDATE TO MREADDATE
STORE B->FMULTIPL TO MMULTIPL
STORE B->FDIGITS TO MDIGITS
STORE B->FCLASS TO MCLASS
STORE B->FREADDATE TO LOLDRDDT
STORE B->FNEWRDDATE - B->FREADDATE TO LCURDAYS
IF LCURDAYS < 1 .OR. LCURDAYS > 200
STORE 30 TO LCURDAYS
ENDIF
STORE LN+1 TO LN
@ LN, 43 SAY MCLASS
@ LN, 15 SAY B->FNEWRDDATE
@ LN, 30 SAY LOLDRDDT
@ LN, 48 SAY SUBSTR(B->FDESCRIPT,1,26)
@ LN, 75 SAY B->FAMT PICT '999,999.99'
STORE LCURAMT + B->FAMT TO LCURAMT
DO CASE
CASE LEFT(MCLASS,1) = 'W'
STORE MCLASS TO MWCLASS
STORE MREADING TO MWREADING
STORE MREADDATE TO MWREADDATE
STORE MMULTIPL TO MWMULTIPL
STORE MDIGITS TO MWDIGITS
STORE MWDAYS + LCURDAYS TO MWDAYS
STORE LCURCONS + MWCONSUMPT TO MWCONSUMPT
STORE B->FAMT + MWCURAMT TO MWCURAMT
STORE B->FMETER_SN TO LWMETER_SN
CASE LEFT(MCLASS,1) = 'S'
STORE MCLASS TO MSCLASS
STORE MREADING TO MSREADING
STORE MREADDATE TO MSREADDATE
STORE MMULTIPL TO MSMULTIPL
STORE MDIGITS TO MSDIGITS
STORE MSDAYS + LCURDAYS TO MSDAYS
STORE LCURCONS + MSCONSUMPT TO MSCONSUMPT
STORE B->FAMT + MSCURAMT TO MSCURAMT
ENDCASE
STORE LN+1 TO LN
SKIP
ENDDO
MNEWBAL=MBAP + LCURAMT
STORE 0 TO LTOT_PMT, L60_DAYS, L30_DAYS, L90_DAYS, L0_29DAYS, LAGE_SUM
IF MNEWBAL <= 0
LTOT_PMT = 0
L90_DAYS = 0
L60_DAYS = 0
L30_DAYS = 0
L0_29DAYS= MNEWBAL
ELSE
IF LCURPMT >0
LTOT_PMT = LCURPMT
ENDIF
IF M30PMT >0
LTOT_PMT = LTOT_PMT + M30PMT
ENDIF
IF M60PMT > 0
LTOT_PMT = LTOT_PMT + M60PMT
ENDIF
IF LCURAMT < 0
LTOT_PMT = LTOT_PMT - LCURAMT
ENDIF
IF M30AMT < 0
LTOT_PMT = LTOT_PMT - M30AMT
ENDIF
IF M60AMT < 0
LTOT_PMT = LTOT_PMT - M60AMT
ENDIF
IF LTOT_PMT >= M90BAL
LTOT_PMT = LTOT_PMT - M90BAL
L90_DAYS = 0
ELSE
L90_DAYS = M90BAL - LTOT_PMT
LTOT_PMT = 0
ENDIF
IF M60AMT > 0
L60_DAYS = M60AMT
ENDIF
IF M60PMT < 0
L60_DAYS = L60_DAYS - M60PMT
ENDIF
IF LTOT_PMT >= L60_DAYS
LTOT_PMT = LTOT_PMT - L60_DAYS
L60_DAYS = 0
ELSE
L60_DAYS = L60_DAYS - LTOT_PMT
LTOT_PMT = 0
ENDIF
IF M30AMT > 0
L30_DAYS = M30AMT
ENDIF
IF M30PMT < 0
L30_DAYS = L30_DAYS - M30PMT
ENDIF
IF LTOT_PMT >= L30_DAYS
LTOT_PMT = LTOT_PMT - L30_DAYS
L30_DAYS = 0
ELSE
L30_DAYS = L30_DAYS - LTOT_PMT
LTOT_PMT = 0
ENDIF
ENDIF
IF LN > 40
@ 55, 40 SAY TRIM(A->FFIRSTNAME)+' '+A->FCOMPANY
@ 56, 40 SAY A->FADDR1
* @ 56, 75 SAY 'NEXT PAGE'
@ 57, 40 SAY A->FADDR2
@ 58, 40 SAY TRIM(A->FCITY)+' '+TRIM(A->FSTATE)+' '+A->FZIP
@ 59, 70 SAY 'NEXT PAGE'
EJECT
@ 04,61 SAY A->FCUSTNO
@ 05,61 SAY A->FROUTENO
* @ 05,89 SAY LBILL_THRU
@ 7, 46 SAY LBILL_THRU
* @ 7, 91 SAY A->FCUSTNO
@ 8, 15 SAY "CONTINUATION BILL"
STORE MCURINV +1 TO MCURINV
LN=11
ENDIF
IF L90_DAYS > 0
LN=LN+1
@ LN, 12 SAY "EWOR AM MURI EMOTLOK JEN 90 RAN KIN JONAN IN "
@ LN, 57 SAY L90_DAYS PICT "99,999.99"
LN=LN+1
@ LN, 12 SAY "ENAJ TUM (DISCONNECT) JAROM EO ILO EJELOK BAR KOJELLA"
ENDIF
@ 41, 40 SAY 'Your new Balance is >>'
@ 41, 75 SAY MNEWBAL PICT '$$$,$$9.99'
@ 42, 40 say 'Payment due by '
@ 42,55 say Lpay_by
@ 44,01 say '_'
@ 46,05 SAY 'KWAJALEIN ATOLL JOINT UTILITY RES.'
@ 47,05 SAY 'EBEYE'
@ 48,05 SAY 'EBEYE RMI MH 96970'
@ 55, 40 SAY TRIM(A->FFIRSTNAME)+' '+A->FCOMPANY
@ 56, 40 SAY A->FADDR1
@ 57, 40 SAY A->FADDR2
@ 58, 40 SAY TRIM(A->FCITY)+' '+TRIM(A->FSTATE)+' '+A->FZIP
EJECT
SELECT D
APPEND BLANK
REPLACE D->FCUSTNO WITH A->FCUSTNO
REPLACE D->FFIRSTNAME WITH A->FFIRSTNAME
REPLACE D->FCOMPANY WITH A->FCOMPANY
REPLACE D->FADDR1 WITH A->FADDR1
REPLACE D->FADDR2 WITH A->FADDR2
REPLACE D->FCITY WITH A->FCITY
REPLACE D->FSTATE WITH A->FSTATE
REPLACE D->FZIP WITH A->FZIP
REPLACE D->FROUTENO WITH A->FROUTENO
IF MWCURAMT > 0
REPLACE D->FEYTD WITH MWCONSUMPT + A->FEYTD
REPLACE D->FEDAYS WITH MWDAYS + A->FEDAYS
REPLACE D->FREADDATE WITH MWREADDATE
REPLACE D->FREADING WITH MWREADING
REPLACE D->FDIGITS WITH MWDIGITS
REPLACE D->FMULTIPL WITH MWMULTIPL
REPLACE D->FCLASS WITH MWCLASS
ELSE
REPLACE D->FEYTD WITH A->FEYTD
REPLACE D->FEDAYS WITH A->FEDAYS
REPLACE D->FREADDATE WITH A->FREADDATE
REPLACE D->FREADING WITH A->FREADING
REPLACE D->FDIGITS WITH A->FDIGITS
REPLACE D->FMULTIPL WITH A->FMULTIPL
IF SUBSTR(MWCLASS,2,1) = 'I'
REPLACE D->FCLASS WITH MWCLASS
ELSE
REPLACE D->FCLASS WITH A->FCLASS
ENDIF
ENDIF
IF MSCURAMT > 0
REPLACE D->FSWYTD WITH MSCONSUMPT + A->FSWYTD
REPLACE D->FSWDAYS WITH MSDAYS + A->FSWDAYS
REPLACE D->FSWREADDAT WITH MSREADDATE
REPLACE D->FSWREADING WITH MSREADING
REPLACE D->FSWDIGITS WITH MSDIGITS
REPLACE D->FSWMULTIPL WITH MSMULTIPL
REPLACE D->FSWCLASS WITH MSCLASS
ELSE
REPLACE D->FSWYTD WITH A->FSWYTD
REPLACE D->FSWDAYS WITH A->FSWDAYS
REPLACE D->FSWREADDAT WITH A->FSWREADDAT
REPLACE D->FSWREADING WITH A->FSWREADING
REPLACE D->FSWDIGITS WITH A->FSWDIGITS
REPLACE D->FSWMULTIPL WITH A->FSWMULTIPL
IF SUBSTR(MSCLASS,2,1) = 'I'
REPLACE D->FSWCLASS WITH MSCLASS
ELSE
REPLACE D->FSWCLASS WITH A->FSWCLASS
ENDIF
ENDIF
REPLACE D->FBAL WITH MNEWBAL
REPLACE D->FINVNO WITH MCURINV
REPLACE D->FSPEC_RATE WITH A->FSPEC_RATE
REPLACE D->FCURAMT WITH LCURAMT
REPLACE D->FCURPMT WITH LCURPMT
REPLACE D->F30BAL WITH M30BAL
REPLACE D->F60BAL WITH M60BAL
REPLACE D->F60PMT WITH M60PMT
REPLACE D->F30AMT WITH M30AMT
REPLACE D->F30PMT WITH M30PMT
REPLACE D->F60INV WITH M60INV
REPLACE D->F30INV WITH M30INV
REPLACE D->F60AMT WITH M60AMT
REPLACE D->F90BAL WITH M90BAL
REPLACE D->F90INV WITH M90INV
IF LWMETER_SN <> ' ' .AND. LWMETER_SN <> ''
REPLACE D->FMETER_SN WITH LWMETER_SN
ELSE
REPLACE D->FMETER_SN WITH A->FMETER_SN
ENDIF
REPL D->FSWMETERSN WITH A->FSWMETERSN
REPL D->FADDTOILET WITH A->FADDTOILET
REPLACE D->FSEAL_NO WITH A->FSEAL_NO
REPLACE D->FCONN_DATE WITH A->FCONN_DATE
REPLACE D->FW_STDEV WITH A->FW_STDEV
STORE MCURINV + 1 TO MCURINV
SELECT A
SKIP
ENDDO
SET DEVICE TO SCREEN
CLOSE DATABASES
SET PROC TO
SET EXCLUSIVE OFF
RETURN