DGBTCE1 ;ALB/LM - BENEFICIARY TRAVEL CLAIM RE-ENTER/EDIT CONT.; 9/13/89@8:00 ;4/23/91 09:42
;;1.0;Beneficiary Travel;**17,20**;September 25, 2001;Build 185
Q
CONT ; ENTRY POINTS FROM DGBTEE,DGBTCE
N MOSTENC
F I=0,"A","C","D","M","R","T" S DGBTVAR(I)=$S($D(^DGBT(392,DGBTDT,I)):^(I),1:"")
I DGBTDE<0 S DGBTDE=0
I $G(DGBTCCREQ) S DGBTFLX=" DEDUCTIBLE AMOUNT HAS BEEN CHANGED " I DGBTACCT=4 S DGBTPA=$S(DGBTTC-DGBTDE>0:DGBTTC-DGBTDE,DGBTTC-DGBTDE<0:DGBTTC,1:0)
DIE5 ;S DGBTINFL=$S(DGBTDE=DGBTDCV:$P(DGBTVAR("R"),DGBTFLX)_$P(DGBTVAR("R"),DGBTFLX,2)_" ",DGBTDE'=DGBTDCV&(DGBTVAR("R")'[DGBTFLX):$E(DGBTVAR("R")_DGBTINFL_DGBTFLX,1,79),1:DGBTVAR("R"))
S MOSTENC=$$GET1^DIQ(392,DGBTDT,8)
S DGBTPA=$P(DGBTVAR(0),"^",10)
I $G(DGBTCCREQ) S DGBTPA=$S($G(MOSTENC)>0&(MOSTENC<DGBTPA):MOSTENC,1:DGBTPA),DGBTPA=$S(DGBTPA-$G(DGBTDE)<0:0,1:DGBTPA) ;$P(DGBTVAR(0),"^",9)
I '$G(DGBTCCREQ),'$G(MOSTENC) D
.S DGBTPA=$P(DGBTVAR("C"),"^",2)+$P(DGBTVAR("M"),"^",4)+$P(DGBTVAR("M"),"^",5)
.I $P(DGBTVAR("M"),"^",3)-$G(DGBTDCV1)>0 S DGBTPA=DGBTPA+(DGBTMLT-$G(DGBTDE))
.I $P(DGBTVAR("M"),"^",3)-$G(DGBTDCV1)<0 S DGBTPA=DGBTPA
; stuff amount payable
I DGBTFLAG=2 W !!,"DEDUCTIBLE AMOUNT CAN NOT EXCEED THE TOTAL COSTS FOR THIS CLAIM",! K X S DGBTFLAG=0 G DED1^DGBTCE
I DGBTFLAG=1 W !!,"DEDUCTIBLE FOR THIS CLAIM CAN NOT EXCEED THE AMOUNT REMAINING FOR THIS MONTH",! K X S DGBTFLAG=0 G DED1^DGBTCE
;
S DIE="^DGBT(392,",DA=DGBTDT,DIE("NO^")="BACK",DR="51"
DIE6 D ^DIE K DIE,DQ,DR I $D(DTOUT)!($D(Y)) S DGBTTOUT=-1 Q
I ($L(DGBTACCT)=1),("45"[DGBTACCT) D
.N FDA,ERR
.S DGBTPA=$$PAYABLE
.S FDA(392,DGBTDT_",",9)=DGBTDE
.S FDA(392,DGBTDT_",",10)=DGBTPA
.D FILE^DIE("E","FDA","ERR")
.I $D(ERR) S DGBTTOUT=-1
I $G(DGBTTOUT)=-1 Q
D QUIT
D SCREEN^DGBTCD
Q
QUIT ;KILL VARIABLES
K DGBTCITY,DGBTSTAT,DGBTWAY,DGBTMILE,DIE,DR,DGBTOWRT,DGBTML,DGBTMLFB,DGBTACCT,DGBTAP,DGBTMAL,DGBTFAB,DGBTME,DGBTMAF,DGBTTC,DGBTDCM,DGBTDPV,DGBTDPM,DGBTDRM,DGBTDCV,DGBTDE,DGBTPA,I,DGBTELIG,DGBTFLAG,DGBTMETC,DGBTMLT,DGBTCP,DGBTMR1
K DGBTFR1,DGBTFR2,DGBTFR3,DGBTFR4,DGBTTO1,DGBTTO2,DGBTTO3,DGBTTO4,DGBTMR,DGBTRATE,DGBTSCP,DGBTFLX Q
PAYABLE() ;
N DGBTRAY,FERRIES,MEALS,MILEAGE
D GETS^DIQ(392,DGBTDT_",","8;33;34;35;55;55.1","EI","DGBTRAY")
S MEALS=+DGBTRAY(392,DGBTDT_",",34,"I")
S MILEAGE=+DGBTRAY(392,DGBTDT_",",33,"I")
S FERRIES=+DGBTRAY(392,DGBTDT_",",35,"I")
I DGBTDE>MILEAGE S DGBTDE=MILEAGE
I DGBTRAY(392,DGBTDT_",",55.1,"E")="NO" Q $$COMCARN
I DGBTRAY(392,DGBTDT_",",55.1,"E")="YES" Q $$COMCARY
S DGBTPA=MILEAGE+MEALS+FERRIES
I DGBTDE>DGBTPA Q 0
Q (DGBTPA-DGBTDE)
;
COMCARN() ;CC not required
N CCFEE,MOSTEC,FDA
S MOSTEC=+DGBTRAY(392,DGBTDT_",",8,"I")
I DGBTDE>MILEAGE S DGBTDE=MILEAGE
I (MOSTEC>0)&(MILEAGE'>0) Q (MOSTEC+MEALS+FERRIES)
I (MOSTEC>0)&(MOSTEC>MILEAGE) S DGBTPA=(MILEAGE+MEALS+FERRIES)
I (MOSTEC>0)&(MOSTEC'>MILEAGE) D Q (MOSTEC+MEALS+FERRIES)
.S FDA(392,DGBTDT_",",9)=0 S DGBTDE=0
.D FILE^DIE("E","FDA","ERR")
I (MOSTEC'>0) S DGBTPA=(MILEAGE+MEALS+FERRIES)
I DGBTDE>DGBTPA Q 0
Q (DGBTPA-DGBTDE)
;
COMCARY() ; CC required
N CCFEE,MOSTEC
S CCFEE=+DGBTRAY(392,DGBTDT_",",55,"I")
I DGBTDE>MILEAGE S DGBTDE=MILEAGE,MILEAGE=DGBTDE
S DGBTPA=CCFEE+MILEAGE+MEALS+FERRIES
S DGBTPA=CCFEE+MEALS+FERRIES+MILEAGE
I DGBTDE>DGBTPA Q 0
Q (DGBTPA-DGBTDE)
--- Routine Detail --- with STRUCTURED ROUTINE LISTING ---[H[J[2J[HDGBTCE1 3332 printed Dec 13, 2024@01:40:28 Page 2
DGBTCE1 ;ALB/LM - BENEFICIARY TRAVEL CLAIM RE-ENTER/EDIT CONT.; 9/13/89@8:00 ;4/23/91 09:42
+1 ;;1.0;Beneficiary Travel;**17,20**;September 25, 2001;Build 185
+2 QUIT
CONT ; ENTRY POINTS FROM DGBTEE,DGBTCE
+1 NEW MOSTENC
+2 FOR I=0,"A","C","D","M","R","T"
SET DGBTVAR(I)=$SELECT($DATA(^DGBT(392,DGBTDT,I)):^(I),1:"")
+3 IF DGBTDE<0
SET DGBTDE=0
+4 IF $GET(DGBTCCREQ)
SET DGBTFLX=" DEDUCTIBLE AMOUNT HAS BEEN CHANGED "
IF DGBTACCT=4
SET DGBTPA=$SELECT(DGBTTC-DGBTDE>0:DGBTTC-DGBTDE,DGBTTC-DGBTDE<0:DGBTTC,1:0)
DIE5 ;S DGBTINFL=$S(DGBTDE=DGBTDCV:$P(DGBTVAR("R"),DGBTFLX)_$P(DGBTVAR("R"),DGBTFLX,2)_" ",DGBTDE'=DGBTDCV&(DGBTVAR("R")'[DGBTFLX):$E(DGBTVAR("R")_DGBTINFL_DGBTFLX,1,79),1:DGBTVAR("R"))
+1 SET MOSTENC=$$GET1^DIQ(392,DGBTDT,8)
+2 SET DGBTPA=$PIECE(DGBTVAR(0),"^",10)
+3 ;$P(DGBTVAR(0),"^",9)
IF $GET(DGBTCCREQ)
SET DGBTPA=$SELECT($GET(MOSTENC)>0&(MOSTENC<DGBTPA):MOSTENC,1:DGBTPA)
SET DGBTPA=$SELECT(DGBTPA-$GET(DGBTDE)<0:0,1:DGBTPA)
+4 IF '$GET(DGBTCCREQ)
IF '$GET(MOSTENC)
Begin DoDot:1
+5 SET DGBTPA=$PIECE(DGBTVAR("C"),"^",2)+$PIECE(DGBTVAR("M"),"^",4)+$PIECE(DGBTVAR("M"),"^",5)
+6 IF $PIECE(DGBTVAR("M"),"^",3)-$GET(DGBTDCV1)>0
SET DGBTPA=DGBTPA+(DGBTMLT-$GET(DGBTDE))
+7 IF $PIECE(DGBTVAR("M"),"^",3)-$GET(DGBTDCV1)<0
SET DGBTPA=DGBTPA
End DoDot:1
+8 ; stuff amount payable
+9 IF DGBTFLAG=2
WRITE !!,"DEDUCTIBLE AMOUNT CAN NOT EXCEED THE TOTAL COSTS FOR THIS CLAIM",!
KILL X
SET DGBTFLAG=0
GOTO DED1^DGBTCE
+10 IF DGBTFLAG=1
WRITE !!,"DEDUCTIBLE FOR THIS CLAIM CAN NOT EXCEED THE AMOUNT REMAINING FOR THIS MONTH",!
KILL X
SET DGBTFLAG=0
GOTO DED1^DGBTCE
+11 ;
+12 SET DIE="^DGBT(392,"
SET DA=DGBTDT
SET DIE("NO^")="BACK"
SET DR="51"
DIE6 DO ^DIE
KILL DIE,DQ,DR
IF $DATA(DTOUT)!($DATA(Y))
SET DGBTTOUT=-1
QUIT
+1 IF ($LENGTH(DGBTACCT)=1)
IF ("45"[DGBTACCT)
Begin DoDot:1
+2 NEW FDA,ERR
+3 SET DGBTPA=$$PAYABLE
+4 SET FDA(392,DGBTDT_",",9)=DGBTDE
+5 SET FDA(392,DGBTDT_",",10)=DGBTPA
+6 DO FILE^DIE("E","FDA","ERR")
+7 IF $DATA(ERR)
SET DGBTTOUT=-1
End DoDot:1
+8 IF $GET(DGBTTOUT)=-1
QUIT
+9 DO QUIT
+10 DO SCREEN^DGBTCD
+11 QUIT
QUIT ;KILL VARIABLES
+1 KILL DGBTCITY,DGBTSTAT,DGBTWAY,DGBTMILE,DIE,DR,DGBTOWRT,DGBTML,DGBTMLFB,DGBTACCT,DGBTAP,DGBTMAL,DGBTFAB,DGBTME,DGBTMAF,DGBTTC,DGBTDCM,DGBTDPV,DGBTDPM,DGBTDRM,DGBTDCV,DGBTDE,DGBTPA,I,DGBTELIG,DGBTFLAG,DGBTMETC,DGBTMLT,DGBTCP,DGBTMR1
+2 KILL DGBTFR1,DGBTFR2,DGBTFR3,DGBTFR4,DGBTTO1,DGBTTO2,DGBTTO3,DGBTTO4,DGBTMR,DGBTRATE,DGBTSCP,DGBTFLX
QUIT
PAYABLE() ;
+1 NEW DGBTRAY,FERRIES,MEALS,MILEAGE
+2 DO GETS^DIQ(392,DGBTDT_",","8;33;34;35;55;55.1","EI","DGBTRAY")
+3 SET MEALS=+DGBTRAY(392,DGBTDT_",",34,"I")
+4 SET MILEAGE=+DGBTRAY(392,DGBTDT_",",33,"I")
+5 SET FERRIES=+DGBTRAY(392,DGBTDT_",",35,"I")
+6 IF DGBTDE>MILEAGE
SET DGBTDE=MILEAGE
+7 IF DGBTRAY(392,DGBTDT_",",55.1,"E")="NO"
QUIT $$COMCARN
+8 IF DGBTRAY(392,DGBTDT_",",55.1,"E")="YES"
QUIT $$COMCARY
+9 SET DGBTPA=MILEAGE+MEALS+FERRIES
+10 IF DGBTDE>DGBTPA
QUIT 0
+11 QUIT (DGBTPA-DGBTDE)
+12 ;
COMCARN() ;CC not required
+1 NEW CCFEE,MOSTEC,FDA
+2 SET MOSTEC=+DGBTRAY(392,DGBTDT_",",8,"I")
+3 IF DGBTDE>MILEAGE
SET DGBTDE=MILEAGE
+4 IF (MOSTEC>0)&(MILEAGE'>0)
QUIT (MOSTEC+MEALS+FERRIES)
+5 IF (MOSTEC>0)&(MOSTEC>MILEAGE)
SET DGBTPA=(MILEAGE+MEALS+FERRIES)
+6 IF (MOSTEC>0)&(MOSTEC'>MILEAGE)
Begin DoDot:1
+7 SET FDA(392,DGBTDT_",",9)=0
SET DGBTDE=0
+8 DO FILE^DIE("E","FDA","ERR")
End DoDot:1
QUIT (MOSTEC+MEALS+FERRIES)
+9 IF (MOSTEC'>0)
SET DGBTPA=(MILEAGE+MEALS+FERRIES)
+10 IF DGBTDE>DGBTPA
QUIT 0
+11 QUIT (DGBTPA-DGBTDE)
+12 ;
COMCARY() ; CC required
+1 NEW CCFEE,MOSTEC
+2 SET CCFEE=+DGBTRAY(392,DGBTDT_",",55,"I")
+3 IF DGBTDE>MILEAGE
SET DGBTDE=MILEAGE
SET MILEAGE=DGBTDE
+4 SET DGBTPA=CCFEE+MILEAGE+MEALS+FERRIES
+5 SET DGBTPA=CCFEE+MEALS+FERRIES+MILEAGE
+6 IF DGBTDE>DGBTPA
QUIT 0
+7 QUIT (DGBTPA-DGBTDE)