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
K ACRQUIT
S ACRTOT=ACRTOT+ACRPD+ACRLDG+ACRMR+ACRTAX+ACRPHN+ACROTH+ACRRC+ACR4P+ACRAIRPT
S ACROTHT=ACROTHT+ACRMR+ACRTAX+ACRPHN+ACROTH+ACRAIRPT
D ALTOT^ACRFSSA1
D ADVANCE^ACRFSSA1
S ACRTOT=ACRTOT+$G(ACRALTOT)
I $P($G(^ACRDOC(ACRDOCDA,"TRNG4")),U,16) S ACRTOT=$P(^("TRNG4"),U,16)
S ACRREIM=ACRREIM+ACRRC+ACRPD+ACRLDG+ACROTHT+ACR4P+$S($P(^ACRDOC(ACRDOCDA,"TOAU"),U,5)=1:$G(ACRALTOT),1:0)
D TOTAL,UP^ACRFSS3
S D0=ACRDOCDA
K ACRHOT
Q
TAXI ;TO CALCULATE IF AIRPORT PARKING PLUS TRIP TO AIRPORT IS GREATER
;THAN TAXI TO AIRPORT
S ACRAIRPT(1)=ACRAIRPT+ACRAIRT
I ACRAIRPT(1),$P($G(^ACRAU(ACRDUZ,1)),U,9),ACRAIRPT(1)>($P(^(1),U,9)) S ACRAIRPT=$P(^(1),U,9)
E S ACRAIRPT=ACRAIRPT(1)
Q
TOTAL Q:$P(^ACRDOC(ACRDOCDA,"TO"),U,22)'=1
S ACRATM=ACRREIM-ACRLDG-ACRRC-ACRPHN-ACR4P-$S($P(^ACRDOC(ACRDOCDA,"TOAU"),U,5)=1:$G(ACRALTOT),1:0)
S ACRATM=$P(ACRATM,".")
S ACRATMX=$E(ACRATM,$L(ACRATM))
S:ACRATMX#10 ACRATM=ACRATM+(10-ACRATMX)
S:$E(ACRATM,$L(ACRATM)-1)#2 ACRATM=ACRATM+10
S ACRATM1=$S(ACRREFX=600:$P(^ACRDOC(ACRDOCDA,"TO"),U,23),1:ACRATM)
S ACRATM2=$P(^ACRDOC(ACRDOCDA,"TOAU"),U,8)
K ^TMP("ACRTV",$J,"D")
Q
SETS ;SETS TRAVEL INFO
I $G(ACRREFX)'=600,$P($G(^ACRTV(AC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ACRAIRPT,ACRAIRT)=0
+7 SET ACR4P=$PIECE(^ACRDOC(ACRDOCDA,"TO"),U,26)
+8 SET ACRDUZ=$PIECE(^ACRDOC(ACRDOCDA,"TO"),U,9)
+9 IF '$DATA(ACRADV)
SET ACRADV=0
+10 SET ACRALTOT=$GET(ACRALTOT)
+11 FOR
SET ACRTVDA=$ORDER(^ACRTV("D",ACRDOCDA,ACRTVDA))
IF 'ACRTVDA
QUIT
DO SETS
+12 IF $PIECE(^ACRDOC(ACRDOCDA,"TOAU"),U,6)
IF $PIECE(^("TOAU"),U,6)<ACRMR
SET ACRMR=$PIECE(^("TOAU"),U,6)
+13 SET ACRDAYS=ACRJ
+14 SET ACRPHNX=ACRJ-1*$PIECE(^ACRSYS(1,"DT"),U,17)
+15 SET ACRPHN=$SELECT(ACRPHN>ACRPHNX:ACRPHNX,1:ACRPHN)
+16 DO TAXI
+17 KILL ACRPHNX
+18 KILL ACRQUIT
+19 SET ACRTOT=ACRTOT+ACRPD+ACRLDG+ACRMR+ACRTAX+ACRPHN+ACROTH+ACRRC+ACR4P+ACRAIRPT
+20 SET ACROTHT=ACROTHT+ACRMR+ACRTAX+ACRPHN+ACROTH+ACRAIRPT
+21 DO ALTOT^ACRFSSA1
+22 DO ADVANCE^ACRFSSA1
+23 SET ACRTOT=ACRTOT+$GET(ACRALTOT)
+24 IF $PIECE($GET(^ACRDOC(ACRDOCDA,"TRNG4")),U,16)
SET ACRTOT=$PIECE(^("TRNG4"),U,16)
+25 SET ACRREIM=ACRREIM+ACRRC+ACRPD+ACRLDG+ACROTHT+ACR4P+$SELECT($PIECE(^ACRDOC(ACRDOCDA,"TOAU"),U,5)=1:$GET(ACRALTOT),1:0)
+26 DO TOTAL
DO UP^ACRFSS3
+27 SET D0=ACRDOCDA
+28 KILL ACRHOT
+29 QUIT
TAXI ;TO CALCULATE IF AIRPORT PARKING PLUS TRIP TO AIRPORT IS GREATER
+1 ;THAN TAXI TO AIRPORT
+2 SET ACRAIRPT(1)=ACRAIRPT+ACRAIRT
+3 IF ACRAIRPT(1)
IF $PIECE($GET(^ACRAU(ACRDUZ,1)),U,9)
IF ACRAIRPT(1)>($PIECE(^(1),U,9))
SET ACRAIRPT=$PIECE(^(1),U,9)
+4 IF '$TEST
SET ACRAIRPT=ACRAIRPT(1)
+5 QUIT
TOTAL IF $PIECE(^ACRDOC(ACRDOCDA,"TO"),U,22)'=1
QUIT
+1 SET ACRATM=ACRREIM-ACRLDG-ACRRC-ACRPHN-ACR4P-$SELECT($PIECE(^ACRDOC(ACRDOCDA,"TOAU"),U,5)=1:$GET(ACRALTOT),1:0)
+2 SET ACRATM=$PIECE(ACRATM,".")
+3 SET ACRATMX=$EXTRACT(ACRATM,$LENGTH(ACRATM))
+4 IF ACRATMX#10
SET ACRATM=ACRATM+(10-ACRATMX)
+5 IF $EXTRACT(ACRATM,$LENGTH(ACRATM)-1)#2
SET ACRATM=ACRATM+10
+6 SET ACRATM1=$SELECT(ACRREFX=600:$PIECE(^ACRDOC(ACRDOCDA,"TO"),U,23),1:ACRATM)
+7 SET ACRATM2=$PIECE(^ACRDOC(ACRDOCDA,"TOAU"),U,8)
+8 KILL ^TMP("ACRTV",$JOB,"D")
+9 QUIT
SETS ;SETS TRAVEL INFO
+1 IF $GET(ACRREFX)'=600
IF $PIECE($GET(^ACRTV(ACRTVDA,0)),U,5)=1
QUIT
+2 SET ^TMP("ACRTV",$JOB,"D",+$PIECE(^ACRTV(ACRTVDA,"DT"),U),ACRDOCDA,ACRTVDA)=""
+3 SET ACRJ=ACRJ+1
+4 SET ACRTV=ACRTVDA_"^"_^ACRTV(ACRTVDA,0)
+5 SET ACRTV1=^ACRTV(ACRTVDA,"DT")
+6 SET ACRTVDAY=$PIECE(^ACRTV(ACRTVDA,0),U)
+7 SET ACRDESC=$GET(^ACRTV(ACRTVDA,"DESC"))
+8 SET ACRTVEP=$GET(^ACRTV(ACRTVDA,1))
+9 IF ACRTVDAY'=ACRJ
Begin DoDot:1
+10 SET DIE="^ACRTV("
+11 SET DA=ACRTVDA
+12 SET DR=".01///"_ACRJ
+13 DO DIE^ACRFDIC
End DoDot:1
+14 SET ^TMP("ACRTV",$JOB,ACRJ)=ACRTV
+15 SET ACRTVDAT=$EXTRACT($PIECE($PIECE(ACRTV1,U),","),4,7)
+16 SET Y=$PIECE(ACRTV1,U,2)
+17 XECUTE ^DD("DD")
+18 SET ACRTVLV=$PIECE(Y,"@",2)
+19 SET ACRTVLV=$PIECE(ACRTVLV,":")_$PIECE(ACRTVLV,":",2)
+20 SET Y=$PIECE(ACRTV1,U,3)
+21 XECUTE ^DD("DD")
+22 SET ACRTVAR=$PIECE(Y,"@",2)
+23 SET ACRTVAR=$PIECE(ACRTVAR,":")_$PIECE(ACRTVAR,":",2)
+24 SET ACRTVCIT=$SELECT('$PIECE(ACRTV1,U,4):"NOT SPECIFIED",'$DATA(^ACRPD($PIECE(ACRTV1,U,4),0)):"NOT SPECIFIED",1:$EXTRACT($PIECE(^ACRPD($PIECE(ACRTV1,U,4),0),U),1,7))
+25 SET ACRTVPD=$PIECE(ACRTV1,U,5)
+26 IF $PIECE(ACRTV1,U,20)>0
SET ACRMRR=$PIECE(ACRTV1,U,20)
+27 SET ACRPMRR=$PIECE(ACRTV1,U,23)
+28 SET ACRAIRP=$PIECE(ACRTV1,U,22)
+29 SET ACRAIRPT=ACRAIRPT+ACRAIRP
+30 SET ACRTVLDG=$PIECE(ACRTV1,U,6)
+31 SET ACRTVMLS=$PIECE(ACRTV1,U,7)
+32 SET ACRTVPML=$PIECE(ACRTV1,U,21)
+33 SET ACRTVMR=ACRTVPML*ACRPMRR
+34 SET ACRTVTAX=$PIECE(ACRTV1,U,8)
+35 SET ACRAIRT=ACRAIRT+(ACRTVMLS*ACRMRR)
+36 SET ACRTVPHN=$PIECE(ACRTV1,U,9)
+37 SET ACRTVOTH=$PIECE(ACRTV1,U,10)
+38 SET ACRTVEXP=$PIECE(ACRTV1,U,17)
+39 SET ACRTVRC=$PIECE(ACRTV1,U,15)
+40 IF ACRTVEP]""
SET ACRTVEXP=ACRTVEXP_U_ACRTVEP
+41 SET ACRTVRCC=$PIECE(ACRTV1,U,13)
+42 IF ACRTVRCC
IF $DATA(^ACRRCOMP(ACRTVRCC,0))
SET ACRTVRCC=$PIECE(^(0),U)
+43 SET ACROTH=ACROTH+ACRTVOTH
+44 SET ACRPD=ACRPD+ACRTVPD
+45 SET ACRLDG=ACRLDG+ACRTVLDG
+46 SET ACRMR=ACRMR+ACRTVMR
+47 SET ACRTAX=ACRTAX+ACRTVTAX
+48 SET ACRPHN=ACRPHN+ACRTVPHN
+49 SET ACRRC=ACRRC+ACRTVRC
+50 QUIT