          SUBROUTINE (ROID,GEN,VIEW.ONLY,ESC.PATH)
** Version# 30 - 10/22/2003 - 01:20pm - NELSONC - develop

*** Subroutine : RENTAL.OE.HEADER
*-------------------------------------------------------------------------*
*** This routine is the header screen for Rental Agreements. Many of the
*** things common to SOE.HEADER are found on RENTAL.OE.HEADER
*-------------------------------------------------------------------------*
*** Parameters:
*** ROID      - Rental Agreement Number                               [IN]
*** GEN       - Generation ID                                         [IN]
*** VIEW.ONLY - Indicates if Rental Agreement in View Only            (IN)
*** ESC.PATH  - Indicates what Escape Path should be displayed        (IN)
*-------------------------------------------------------------------------*
*** Globals:
*** LED  - Ledger (Rentals)
*** CUSS - Ship-To Customer
*** CUS  - Bill-To Customer
*-------------------------------------------------------------------------*
          SCREEN

          PRINT @(68,21):'Esc-':ESC.PATH "L#7"

          QUIT = NO

          CITY = LED(78)<1,GEN,4>
          ST   = LED(78)<1,GEN,5>
          ZIP  = LED(75)<1,GEN>
          IF NOT(CITY) THEN
             CITY = TRIM(LED(78)<1,GEN,3>)
             CONVERT ',' TO '' IN CITY
             CITY = TRIM(CITY[1,LEN(CITY)-2])
          END
          IF NOT(ST) THEN
             ST = TRIM(LED(78)<1,GEN,3>)
             ST = ST[LEN(ST)-1,2]
          END


          MENU.LOAD  2,21,10, 1,'C'
          MENU.LOAD 15,21,14,10,'I'
          MENU.LOAD 32,21,14,10,'N'

          GOSUB INIT
          GOSUB DISPLAY

          IF VIEW.ONLY THEN
             PRINT @(2,0):BLINK$:'View Only':NORM$
             GOTO IN.OTHER.INST
          END

          IF LED(6)<1,GEN> # 'B' AND LED(6)<1,GEN> # 'X' THEN
             GOSUB CHK.PO
             GOSUB CHK.REL
          END

          BT.CN = LED(1)<1,GEN>
          ST.CN = LED(5)<1,GEN>
          REMINDER.VIEW BT.CN,,2,80,23
          IF ST.CN # BT.CN THEN
             REMINDER.VIEW ST.CN,,2,80,23
          END

          GOTO IN.PO
*-------------------------------------------------------------------------*
EDIT:     *
*-------------------------------------------------------------------------*
IN.BRCH:  LOCATE LED(2)<1,GEN,1> IN SECURITY<9> SETTING POS THEN
IN.BR:       INP.BR 20,7,4,BR,NAME
             IF LED(2)<1,GEN,1>#BR THEN
                IF BR = '' THEN
                   PRINT @(20,7):LED(2)<1,GEN,1>"L#4":BELL
                   GOTO IN.BRCH
                END
                *** See if the billto is authorized for this branch
                ENTITY.BR.CHK.AUTH LED(1)<1,GEN>,BR,AUTH.OK
                IF NOT(AUTH.OK) THEN
                   *** Check the shipto
                   ENTITY.BR.CHK.AUTH LED(5)<1,GEN>,BR,AUTH.OK
                   IF NOT(AUTH.OK) THEN
                      MSG = "Customer Is Not Authorized For Branch : ":BR
                      ERR.MESS 19,5,BELL:MSG
                      BR = LED(2)<1,GEN,1>
                      READV SNAME FROM TERRFILE,BR,1 ELSE SNAME = ''
                      PRINT @(20,7):BR"L#4":'-':SNAME "L#13"
                      GOTO IN.BRCH
                   END
                END
                REDISP          = YES
                LED(2)<1,GEN,1> = BR
                READV SNAME FROM TERRFILE,BR,1 ELSE SNAME = ''
                PRINT @(20,7):BR"L#4":'-':SNAME "L#13"
             END
          END
          IF QUIT THEN GOTO FILEIT
          ON MOVE+1 GOTO IN.BRCH, IN.BRCH, INADR3, IN.REL
*-------------------------------------------------------------------------*
IN.CODT:  INP CO.DT,20,8,10,'D4/'
          IF CHANGED THEN
             IF CO.DT > LED(10)<1,GEN,1> AND LED(10)<1,GEN,1> # "" THEN
                CO.DT = LED(9)<1,GEN,1>
                GOSUB IN.OUT.ERR
                PRINT @(20,8):OCONV(CO.DT,'D4/')
                GOTO IN.CODT
             END
             IF CO.DT+0<1 THEN
                PRINT @(20,8):OCONV(LED(9)<1,GEN,1>,'D4/')"L#10":BELL:
                GOTO IN.CODT
             END
             LED(9)<1,GEN,1> = CO.DT
          END
          IF QUIT THEN GOTO FILEIT
          ON MOVE+1 GOTO IN.CODT, IN.CODT, IN.BRCH, IN.OBY
*-------------------------------------------------------------------------*
IN.COTM:  INP CO.TM,20,9,7,'MTH'
          IF CHANGED THEN
             IF CO.DT = LED(10)<1,GEN,1> AND CO.TM > LED(10)<1,GEN,2> AND LED(10)<1,GEN,2> # "" THEN
                CO.TM = LED(9)<1,GEN,2>
                GOSUB IN.OUT.ERR
                PRINT @(20,9):OCONV(CO.TM,'MTH') "L#7"
                PRINT @(28,9):TIME.ZONE$         "L#3"
                GOTO IN.COTM
             END
             LED(9)<1,GEN,2> = CO.TM
          END
          IF QUIT THEN GOTO FILEIT
          ON MOVE+1 GOTO IN.COTM, IN.COTM, IN.CODT, IN.PHN
*-------------------------------------------------------------------------*
IN.CIDT:  INP CI.DT,20,10,10,'D4/'
          IF CHANGED THEN
             IF CI.DT < LED(9)<1,GEN,1> THEN
                CI.DT = LED(10)<1,GEN,1>
                GOSUB IN.OUT.ERR
                PRINT @(20,8):OCONV(CI.DT,'D4/')
                GOTO IN.CIDT
             END
             IF CI.DT+0<1 THEN
                PRINT @(20,8):OCONV(LED(10)<1,GEN,1>,'D4/')"L#10":BELL:
                GOTO IN.CIDT
             END
             LED(10)<1,GEN,1> = CI.DT
          END
          IF QUIT THEN GOTO FILEIT
          ON MOVE+1 GOTO IN.CIDT, IN.CIDT, IN.COTM, IN.TERMS
*-------------------------------------------------------------------------*
IN.CITM:  INP CI.TM,20,11,7,'MTH'
          IF CHANGED THEN
*** Reject Return times earlier than check out times
             IF CI.TM < LED(9)<1,GEN,2> AND LED(10)<1,GEN,1> = LED(9)<1,GEN,1> THEN
                CI.TM = LED(10)<1,GEN,2>
                GOSUB IN.OUT.ERR
                PRINT @(20,11):OCONV(CI.TM,'MTH') "L#7"
                PRINT @(28,11):TIME.ZONE$         "L#3"
                GOTO IN.CITM
             END
             LED(10)<1,GEN,2> = CI.TM
          END
          IF QUIT THEN GOTO FILEIT
          ON MOVE+1 GOTO IN.CITM, IN.CITM, IN.CIDT, IN.TERMS
*-------------------------------------------------------------------------*
IN.WRTR:  CHECK.KEY 'SOE.WRITER.EDIT',EDIT.OK,LEVEL
          IF LEVEL>=2 OR (LED(73)<1,GEN>=USER.ID AND (REMOTE.CUST OR LEVEL>=1)) THEN
IN.WRT:      INP B,20,12,10,'MCU',V_'INITIALS',H_"IH#21"
             IF CHANGED THEN
             RENTAL.ADD.COMMENT ROID,GEN,'Changed Writer from : ':LED(73)<1,GEN>:' to : ':B
                LED(73)<1,GEN> = B
             END
          END ELSE IF MOVE=0 OR MOVE=1 THEN MOVE = 5
          IF QUIT THEN GOTO FILEIT

          ON MOVE+1 GOTO IN.WRTR, IN.WRTR, IN.CITM, IN.ASPLT
*-------------------------------------------------------------------------*
IN.SLSP:  CHECK.KEY 'SOE.SALESPERSON.EDIT',EDIT.OK
          IF EDIT.OK OR LED(72)<1,GEN>=USER.ID THEN
             B = LED(72)<1,GEN>
IN.OSLS:     INP B,20,13,10,'MCU',V_'S:VERF.SALESMAN',H_"IH#22"
             IF CHANGED THEN
             RENTAL.ADD.COMMENT ROID,GEN,'Changed Out Salesperson from : ':LED(72)<1,GEN>:' to : ':B
                LED(72)<1,GEN> = B
             END
          END ELSE IF MOVE=0 OR MOVE=1 OR MOVE=4 THEN MOVE = 5
          IF QUIT THEN GOTO FILEIT
          ON MOVE+1 GOTO IN.SLSP, IN.SLSP, IN.WRTR, IN.SLSP
*-------------------------------------------------------------------------*
IN.ISLSP: CHECK.KEY 'SOE.SALESPERSON.EDIT',EDIT.OK
          IF EDIT.OK OR LED(34,GEN)<1>=USER.ID THEN
             B = LED(34)<1,GEN>
IN.ISLS:     INP B,20,14,10,'MCU',V_'S:VERF.SALESMAN',H_"IH#23"
             IF CHANGED THEN
             RENTAL.ADD.COMMENT ROID,GEN,'Changed In Salesperson from : ':LED(34)<1,GEN>:' to : ':B
                LED(34)<1,GEN> = B
             END
          END ELSE IF MOVE=0 OR MOVE=1 OR MOVE=4 THEN MOVE=5
          IF QUIT THEN GOTO FILEIT
          ON MOVE+1 GOTO IN.ISLSP, IN.ISLSP, IN.SLSP, IN.ISLSP, IN.SHP.INST, IN.SHP.INST
*-------------------------------------------------------------------------*
IN.PO:    INP B,56,6,20,V_"S:VERF.CUS.PO.NUM,":LED(5)<1,GEN>
          IF CHANGED THEN
          RENTAL.ADD.COMMENT ROID,GEN,'Changed P/O # from : ':LED(13)<1,GEN>:' to : ':B
             LED(13)<1,GEN> = B
          END
          IF QUIT THEN GOTO FILEIT
          ON MOVE+1 GOTO IN.PO, IN.BRCH, INADR3, IN.PO
*-------------------------------------------------------------------------*
IN.REL:   INP B,56,7,20
          IF CHANGED THEN
          RENTAL.ADD.COMMENT ROID,GEN,'Changed Rel # from : ':LED(65)<1,GEN>:' to : ':B
             LED(65)<1,GEN> = B
          END
          IF QUIT THEN GOTO FILEIT
          ON MOVE+1 GOTO IN.REL, IN.BRCH, IN.PO, IN.REL
*-------------------------------------------------------------------------*
IN.OBY:   INP OBY,56,8,23,V_'D:':CUSS(29)
          IF CUSS(29)#'' AND OBY = '' THEN
             ERR.MESS 19,6,"Customer Requires Order Authorization."
             GOTO IN.OBY
          END
          IF CHANGED THEN
             LED(68)<1,GEN> = OBY
          END
          IF QUIT THEN GOTO FILEIT
          ON MOVE+1 GOTO IN.OBY, IN.CODT, IN.REL, IN.OBY
*-------------------------------------------------------------------------*
IN.PHN:   INP PHN,56,9,20
          IF CHANGED THEN
             LED(71)<1,GEN> = PHN
          END
          IF QUIT THEN GOTO FILEIT
          ON MOVE+1 GOTO IN.PHN, IN.COTM, IN.OBY, IN.PHN
*-------------------------------------------------------------------------*
IN.TERMS: INP B,56,10,12,V_'D:,':PAY.CYCLES
          IF CHANGED THEN
          RENTAL.ADD.COMMENT ROID,GEN,'Changed Pamyent Cycle from : ':LED(29)<1,GEN>:' to ':B
             LED(29)<1,GEN> = B
          END
          IF QUIT THEN GOTO FILEIT
          ON MOVE+1 GOTO IN.TERMS, IN.CIDT, IN.PHN, IN.TERMS
*-------------------------------------------------------------------------*
IN.VIA:   INP B,56,12,20,V_"SHIP.VIAS"
          IF CHANGED THEN
             LED(70)<1,GEN> = B
          END
          IF QUIT THEN GOTO FILEIT
          ON MOVE+1 GOTO IN.VIA, IN.WRTR, IN.TERMS, IN.VIA
*-------------------------------------------------------------------------*
IN.ASPLT: INP B,62,13,1,'YN'
          IF CHANGED THEN
             LED(28)<1,GEN> = B
          END
          IF QUIT THEN GOTO FILEIT
          ON MOVE+1 GOTO IN.ASPLT, IN.ISLSP, IN.VIA, IN.ASPLT
*-------------------------------------------------------------------------*
IN.OTHER.INST: *
          B = LED(80)<1,GEN,1>
          CONVERT SVM TO VM IN B
IN$$12:   INPWP B,40,16,38,4,99,'1100'
          CONVERT VM TO SVM IN B
          IF B#LED(80)<1,GEN,1> AND NOT(VIEW.ONLY) AND NOT(REMOTE.CUST) THEN
             LED(80)<1,GEN,1> = B
          END
          IF QUIT THEN
             IF NOT(VIEW.ONLY) THEN GOTO FILEIT ELSE GOTO FINISH
          END
          IF NOT(VIEW.ONLY) THEN
             ON MOVE+1 GOTO IN.OTHER.INST,IN.SHP.INST,IN.ASPLT,IN.OTHER.INST,IN.OTHER.INST,IN.OTHER.INST
          END ELSE
             ON MOVE+1 GOTO IN.OTHER.INST,IN.SHP.INST,IN.OTHER.INST,IN.OTHER.INST,IN.OTHER.INST,IN.OTHER.INST
          END
*-------------------------------------------------------------------------*
IN.SHP.INST: *
          B = LED(74)<1,GEN,1>
          CONVERT SVM TO VM IN B
IN$$11:   INPWP B,1,16,38,4,99,'0110'
          CONVERT VM TO SVM IN B
          IF B#LED(74)<1,GEN,1> AND NOT(VIEW.ONLY) THEN
             LED(74)<1,GEN,1> = B
          END
          IF QUIT THEN
             IF NOT(VIEW.ONLY) THEN GOTO FILEIT ELSE GOTO FINISH
          END
          IF NOT(VIEW.ONLY) THEN
             ON MOVE + 1 GOTO IN.SHP.INST,IN.SHP.INST,IN.ISLSP,IN.OTHER.INST,IN.SHP.INST,IN.SHP.INST
          END ELSE
             ON MOVE+1 GOTO IN.SHP.INST,IN.SHP.INST,IN.SHP.INST,IN.OTHER.INST,IN.SHP.INST,IN.SHP.INST
          END
*-------------------------------------------------------------------------*
INIT:     QSIGN      = -1
          GEN        = 1
          REDISP     = NO
          CVERF.REQ  = NO
          WAS.CV.REQ = NO
          SV.ADDR1 = ''; SV.ADDR2 = ''; SV.CITYST = ''; SV.ZIP = ''
          SV.CITYO = ''; SV.STO   = '';
          READ CITY.VERF FROM CTRLFILE,'OE.CITY.VERF' ELSE CITY.VERF = NO
          READ GL.SALES.TYPE FROM CTRLFILE,'GL.SALES.TYPE' ELSE GL.SALES.TYPE = ''
          GET.CUS LED(2)<1,GEN,1>,LED(1)<1,GEN>,LED(5)<1,GEN>,QSIGN
          PO.CHK  = (CUSS(45)<1,1>#'' AND CUSS(45)<1,1>#'R' AND CUSS(45)<1,1>#0 AND CUSS(45)<1,1>#'N')
          REL.CHK = (CUSS(45)<1,1>='R' OR CUSS(45)<1,1>='B')

          CO.DT = LED(9)<1,GEN,1>
          CO.TM = LED(9)<1,GEN,2>
          CI.DT = LED(10)<1,GEN,1>
          CI.TM = LED(10)<1,GEN,2>
          ASPLT = LED(28)<1,GEN>+0
          PAY.CYCLES = "Daily,Weekly,Monthly,Yearly,OneTime"

          RETURN
*-------------------------------------------------------------------------*
DISPLAY:  *
          OE.DISP.BT.ST GEN
          OE.ORN.CONV ROID,GEN,ORN
          BR = LED(2)<1,GEN,1>

          PRINT @(20,6):ORN                            "L#14"
          READV SNAME FROM TERRFILE,BR,1 ELSE NAME = ''
          PRINT @(20,7):BR"L#4":'-':SNAME              "L#13"
          PRINT @(20,8):OCONV(CO.DT,'D4/')             "L#10"
          PRINT @(20,9):OCONV(CO.TM,'MTH')             "L#7"
          PRINT @(28,9):TIME.ZONE$                     "L#3"
          PRINT @(20,10):OCONV(CI.DT,'D4/')            "L#10"
          PRINT @(20,11):OCONV(CI.TM,'MTH')            "L#7"
          PRINT @(28,11):TIME.ZONE$                    "L#3"
          PRINT @(20,12):LED(73)<1,GEN>                "L#10"
          PRINT @(20,13):LED(72)<1,GEN>                "L#10"
          PRINT @(20,14):LED(34)<1,GEN>                "L#15"
          PRINT @(56,6):LED(13)<1,GEN>                 "L#20"
          PRINT @(56,7):LED(65)<1,GEN>                 "L#20"
          PRINT @(56,8):LED(68)<1,GEN>                 "L#23"
          PRINT @(56,9):LED(71)<1,GEN>                 "L#20"
          PRINT @(56,10):LED(29)<1,GEN>                "L#12"
          PRINT @(56,11):OCONV(LED(21)<1,GEN>,'D4/')   "L#10"
          PRINT @(56,12):LED(70)<1,GEN>                "L#20"
          PRINT @(62,13):"NY"[(ASPLT+1),1]             "L#1"

*** Reset and redisplay the shipping instructions and internal notes
PRT.CMTS: OTHER.INST = LED(80)<1,GEN,1>
          SHP.INST = LED(74)<1,GEN,1>

          CT = DCOUNT(SHP.INST,SVM)
          IF CT>4 THEN CT = 4; PRINT @(28,20):'More'
          IF CT<4 THEN CT = 4
          FOR J=1 TO CT
          PRINT @(1,15+J):SHP.INST<1,1,J>           "L#38"
          NEXT J

          CT = DCOUNT(OTHER.INST,SVM)
          IF CT>4 THEN CT=4; PRINT @(70,20):'More'
          FOR J = 1 TO CT
          PRINT @(40,15+J):OTHER.INST<1,1,J>        "L#38"
          NEXT J

          RETURN
*-------------------------------------------------------------------------*
CHNG.BT:  *
          LOG.GEN.MV   = ''
          CLOSED.ITEMS = NO
          READ TST.LED FROM LEDFILE,ROID ELSE TST.LED = ""
          GCT = DCOUNT(TST.LED(9)<1,GEN>,SVM)
          FOR GN = 1 TO GCT
          IF TST.LED<8> # '' THEN
             CLOSED.ITEMS = YES
          END
          NEXT GN

          IF CLOSED.ITEMS THEN
             PMPT = "Cannot Change Bill-To. Rental Has Been Billed."
             ANS  = ""
IN$$1:       INP.PROMPT ANS,PMPT,,0
             GOTO INADR1
          END

          MESS 34,5,'Enter new Bill/Ship To or press <ESC> to Exit'
          PRINT @(41,1):''"L#35"

          PREV.BT = LED(1)<1,GEN>
          PREV.ST = LED(5)<1,GEN>
          BR      = LED(2)<1,GEN,1>

!!!       RENTAL.SELECT.CUS PRC.BR,RCV.BR,BT,ST,ROID
!!!       IF QUIT THEN
             GOSUB RELOAD.CUS
             GOTO INADR1
!!!       END

          GET.CUS BR,BT.CN,ST.CN,QSIGN

          IF PREV.BT # BT.CN OR PREV.ST # ST.CN THEN
             WINDOW ,,60,3,3
             PRINT @(0,1):"Change ShipTo Address to New Customer's (Y/N) :"
IN.CST:      INP CHNG.ST,48,1,1,'YN',H_"IH#29"
             WINDOW.CLOSE
             IF QUIT THEN GOTO CHNG.BT
             KEEP.ST = NOT(CHNG.ST)
!!!          OE.CHANGE.BT.ST OID,GEN,BR,BT.CN,ST.CN,QSIGN,LOG.MV,KEEP.ST,CHNG.ERR
!!!          IF CHNG.ERR THEN
                GOSUB RELOAD.CUS
                GOTO INADR1
!!!          END
          END

          GOSUB INIT
          GOSUB DISPLAY
          REDISP = YES

          GOTO INADR1
*-------------------------------------------------------------------------*
RELOAD.CUS: * Reload customer values to the original bt/st combination
          BT.CN = PREV.BT
          ST.CN = PREV.ST
          GET.CUS BR,BT.CN,ST.CN,QSIGN
          PRINT @(41,1):CUSS(1)"L#35"
          RETURN
*-------------------------------------------------------------------------*
INADR1:   INP B,41,2,35
          IF CHANGED THEN
             REDISP = YES
             IF SV.ADDR1 = '' THEN SV.ADDR1 = LED(78)<1,GEN,1>
             LED(78)<1,GEN,1> = B
             GOSUB FIND.ZIP4
             IF CITY.VERF THEN
                IF SV.ADDR2 = '' THEN SV.ADDR2  = LED(78)<1,GEN,2>
                IF SV.CITYST= '' THEN SV.CITYST = LED(78)<1,GEN,3>
                IF SV.CITYO = '' THEN SV.CITYO  = LED(78)<1,GEN,4>
                IF SV.STO   = '' THEN SV.STO    = LED(78)<1,GEN,5>
                IF SV.ZIP   = '' THEN SV.ZIP    = LED(75)<1,GEN>
                PRINT @(41,3):SPACE(35); LED(78)<1,GEN,2> = ''
                PRINT @(41,4):SPACE(38); LED(78)<1,GEN,3> = ''
                LED(75)<1,GEN> = ''
                CVERF.REQ = YES
                GOTO INADR2
             END
          END
          IF HELP THEN GOSUB ZIP4
          IF QUIT AND CVERF.REQ THEN
             IF F12 THEN
                LED(78)<1,GEN,1> = SV.ADDR1;  SV.ADDR1  = ''
                LED(78)<1,GEN,2> = SV.ADDR2;  SV.ADDR2  = ''
                LED(78)<1,GEN,3> = SV.CITYST; SV.CITYST = ''
                LED(78)<1,GEN,4> = SV.CITYO;  SV.CITYO  = ''
                LED(78)<1,GEN,5> = SV.STO;    SV.STO    = ''
                LED(75)<1,GEN>   = SV.ZIP;    SV.ZIP    = ''
                CVERF.REQ = NO
                GOSUB DISPLAY
             END ELSE
                GOTO INADR3
             END
          END
          IF QUIT THEN GOTO FILEIT
          ON MOVE+1 GOTO INADR1,INADR1,CHNG.BT,INADR1,INADR2,INADR2
*-------------------------------------------------------------------------*
INADR2:   INP B,41,3,35
          IF CHANGED THEN
             REDISP = YES
             IF SV.ADDR2 = '' THEN SV.ADDR2 = LED(78)<1,GEN,2>
             LED(78)<1,GEN,2>=B
             GOSUB FIND.ZIP4
             IF CITY.VERF THEN
                IF SV.ADDR1 = '' THEN SV.ADDR1 = LED(78)<1,GEN,1>
                IF SV.CITYST= '' THEN SV.CITYST= LED(78)<1,GEN,3>
                IF SV.CITYO = '' THEN SV.CITYO = LED(78)<1,GEN,4>
                IF SV.STO   = '' THEN SV.STO   = LED(78)<1,GEN,5>
                IF SV.ZIP   = '' THEN SV.ZIP   = LED(75)<1,GEN>
                PRINT @(41,4):SPACE(38); LED(78)<1,GEN,3> = ''
                LED(75)<1,GEN> = ''
                CVERF.REQ = YES
                GOTO INADR3
             END
          END
          IF QUIT AND CVERF.REQ THEN
             IF F12 THEN
                LED(78)<1,GEN,1> = SV.ADDR1;  SV.ADDR1  = ''
                LED(78)<1,GEN,2> = SV.ADDR2;  SV.ADDR2  = ''
                LED(78)<1,GEN,3> = SV.CITYST; SV.CITYST = ''
                LED(78)<1,GEN,4> = SV.CITYO;  SV.CITYO  = ''
                LED(78)<1,GEN,5> = SV.STO;    SV.STO    = ''
                LED(75)<1,GEN>   = SV.ZIP;    SV.ZIP    = ''
                CVERF.REQ = NO
                GOSUB DISPLAY
             END ELSE
                GOTO INADR3
             END
          END
          IF QUIT THEN GOTO FILEIT
          ON MOVE+1 GOTO INADR2,INADR2,INADR1,INADR2,INADR3,INADR3
*-------------------------------------------------------------------------*
INADR3:   IF CVERF.REQ THEN
             SV.ADDR1 = ''; SV.ADDR2 = ''; SV.CITYST = ''; SV.ZIP = ''
             SV.CITYO = ''; SV.STO   = ''
             WAS.CV.REQ = YES
             CVERF.REQ  = NO
             MESS 24,7,'Shipping Address Changed. City Verification Required.'
          END
IN.ADR3:  INP SRCH.ID,41,4,20
          IF SRCH.ID='' THEN GOTO INADR3
          IF CHANGED THEN
             REDISP = YES
             ZIP.CODE.GET SRCH.ID,CITY,ST,ZIP
             IF SRCH.ID='' OR ZIP='' THEN
                PRINT @(41,4):SPACE(20)
                CITY = ''
                ST   = ''
                IF WAS.CV.REQ THEN
                   WAS.CV.REQ = NO
                   CVERF.REQ = YES
                END
                GOTO INADR3
             END
             CITY = CITY[1,15]:','
             GN = GEN
             GOSUB UPD.ZIP
             GOSUB COPY.ZIP
             GOSUB DISPLAY
             GOSUB FIND.ZIP4
          END
          IF HELP THEN GOSUB ZIP4
          IF QUIT THEN GOTO FILEIT
          ON MOVE+1 GOTO INADR3,INADR3,INADR2,INADR3,IN.PO,IN.PO
*-------------------------------------------------------------------------*
     * Copy ZIP to all GENs if new order
COPY.ZIP: COPY.IT = ''
          GEN.CT = DCOUNT(LED(9)<1,GEN>,SVM)
          FOR GN = 1 TO GEN.CT
             IF GN#GEN AND LED(8)<1,GN>='' AND LED(6)<1,GN>#'Y' THEN
                IF COPY.IT='' THEN
                   SV.QUIT = QUIT
                   SV.F12  = F12
                   PROMPT = 'Copy Change to all Open Shipments (Y/N) : '
IN$$15:      INP.PROMPT COPY.IT,PROMPT,'YN',1
                   QUIT = SV.QUIT
                   F12  = SV.F12
                   IF NOT(COPY.IT) THEN EXIT
                END
                GOSUB UPD.ZIP
             END
          NEXT GN
          RETURN
*-------------------------------------------------------------------------*
UPD.ZIP:  LED(78)<1,GEN,3> = CITY[1,22]:','
          LED(78)<1,GEN,3> = LED(78)<1,GEN,3> "L#23 ":ST"L#3"
          LED(78)<1,GEN,4> = CITY
          LED(78)<1,GEN,5> = ST
          LED(75)<1,GEN>   = ZIP
          RETURN
*-------------------------------------------------------------------------*
SUBS:     ON OPTION GOTO CHG.LOG,INSTR,NOTES
*-------------------------------------------------------------------------*
CHG.LOG:  *
          RENTAL.VIEW.COMMENTS ROID,GEN
          RETURN
*-------------------------------------------------------------------------*
INSTR:    *
          ENTITY.STD.CMTS.DISP 'C',74,GEN,ABRT
          IF NOT(ABRT) THEN
             GOSUB PRT.CMTS
             RETURN TO IN.SHP.INST
          END
          RETURN
*-------------------------------------------------------------------------*
NOTES:    *
          ENTITY.STD.CMTS.DISP 'C',80,GEN,ABRT
          IF NOT(ABRT) THEN
             GOSUB PRT.CMTS
             RETURN TO IN.OTHER.INST
          END
*-------------------------------------------------------------------------*
CHK.PO:   IF LED(6)<1,GEN>#'X' AND LED(13)<1,GEN>='' THEN
             IF PO.CHK THEN
                ERR.MESS 40,9,BELL:'PO Number is Required'
                RETURN TO IN.PO
             END
          END
          *** If PO has been changed then log it.
          IF OLED(13)<1,GEN>#LED(13)<1,GEN> THEN
             CMNT  = 'Changed Customer P/O # from '
             CMNT := OLED(13)<1,GEN>:' to ':LED(13)<1,GEN>
          RENTAL.ADD.COMMENT ROID,GEN,CMNT
          END

          RETURN
*-------------------------------------------------------------------------*
CHK.REL:  IF LED(6)<1,GEN>#'X' AND LED(65)<1,GEN>='' THEN
             IF REL.CHK THEN
                ERR.MESS 40,10,BELL:'Release Number is Required'
                RETURN TO IN.REL
             END
          END
          *** If Release # has been changed then log it.
          IF OLED(65)<1,GEN>#LED(65)<1,GEN> THEN
             CMNT  = 'Changed Customer Rel # from '
             CMNT := OLED(65)<1,GEN>:' to ':LED(65)<1,GEN>
          RENTAL.ADD.COMMENT ROID,GEN,CMNT
          END
          RETURN
*-------------------------------------------------------------------------*
ZIP4:     ZIP = LED(75)<1,GEN>
          ADDR1 = LED(78)<1,GEN,1>
          ADDR2 = LED(78)<1,GEN,2>
          IF NOT(CITY) OR NOT(ST) THEN
             CITY = LED(78)<1,GEN,4>
             IF NOT(CITY) THEN
                CITY = TRIM(LED(78)<1,GEN,3>)
                CONVERT ',' TO '' IN CITY
                CITY = TRIM(CITY[1,LEN(CITY)-2])
             END

             ST = LED(78)<1,GEN,5>
             IF NOT(ST) THEN
                ST = TRIM(LED(78)<1,GEN,3>)
                ST = ST[LEN(ST)-1,2]
             END
          END
          VERIFY.ZIP4 ADDR1,ADDR2,CITY,ST,ZIP
          LED(78)<1,GEN,1> = ADDR1
          LED(78)<1,GEN,2> = ADDR2
          LED(75)<1,GEN>   = ZIP
          GN = GEN
          IF TRIM(CITY)[LEN(CITY),1] # ',' THEN CITY = TRIM(CITY):','
          GOSUB UPD.ZIP
          GOSUB COPY.ZIP
          GOSUB DISPLAY
          REDISP = YES
          RETURN
*-------------------------------------------------------------------------*
FIND.ZIP4:** Tries to find an exact match
          IF NOT(USE.ZIP4$) THEN RETURN
          IF NOT(LED(75)<1,GEN> AND LED(78)<1,GEN>) THEN RETURN
          SRCH.ID = LED(78)<1,GEN,1>:VM:LED(78)<1,GEN,2>
          S.CITY  = LED(78)<1,GEN,4>
          IF NOT(S.CITY) THEN
             S.CITY  = TRIM(LED(78)<1,GEN,3>)
             S.CITY  = S.CITY[1,LEN(S.CITY)-2]
             CONVERT ',' TO '' IN S.CITY
          END
          SV.CITY = TRIM(S.CITY)
          ST.ST   = LED(78)<1,GEN,5>
          IF NOT(ST.ST) THEN
             S.ST    = TRIM(LED(78)<1,GEN,3>)
             S.ST    = S.ST[LEN(S.ST)-1,2]
          END
          SV.ST   = S.ST
          S.ZIP   = LED(75)<1,GEN>
          ZIP.CODE.GET SRCH.ID,S.CITY,S.ST,S.ZIP
          IF FIELD(S.ZIP,'-',1) # FIELD(LED(75)<1,GEN>,'-',1) THEN RETURN
          IF TRIM(OCONV(S.CITY,'MCU')) # OCONV(SV.CITY,'MCU') THEN RETURN
          IF S.ST # SV.ST THEN RETURN
          LED(75)<1,GEN> = S.ZIP
          GN = GEN
          GOSUB UPD.ZIP
          GOSUB COPY.ZIP
          GOSUB DISPLAY
          REDISP = YES
          RETURN
*-------------------------------------------------------------------------*
IN.OUT.ERR:  * Error message for chk in before check out
          MSG = BELL:"Item check in cannot be before it's checked out!"
          ERR.MESS 18,3,MSG
          RETURN
*-------------------------------------------------------------------------*
FILEIT:   IF F12 THEN GOSUB DISPLAY

          IF LED(6)<1,GEN> # 'B' AND LED(6)<1,GEN> # 'X' THEN
             GOSUB CHK.PO
             GOSUB CHK.REL
          END

          IF F12 THEN
             QUIT = NO; F12 = NO
             PRINT BELL:; GOTO EDIT
          END ELSE
             RENTAL.UPD.LED ROID,GEN
          END
*-------------------------------------------------------------------------*
FINISH:   WINDOW.CLOSE
          RETURN

!NELSONC~10/22/03~13:20
