Home   Package List   Routine Alphabetical List   Global Alphabetical List   FileMan Files List   FileMan Sub-Files List   Package Component Lists   Package-Namespace Mapping  
Routine: ACRFTOT

ACRFTOT.m

Go to the documentation of this file.
ACRFTOT ;IHS/OIRM/DSD/THL,AEF - CALCULATE TO/TV TOTAL; [ 11/01/2001   9:44 AM ]
 ;;2.1;ADMIN RESOURCE MGT SYSTEM;;NOV 05, 2001
 ;;CALCULATE TRAVEL ORDER/TRAVEL VOUCHER TOTALS
DISPLAY ;EP;
 N ACRMRR,ACRJ,ACRTVDA,ACRTOT,ACRPD,ACRLDG,ACRMR,ACRTAX,ACRPHN,ACROTH,ACROTHT,ACRRC,ACRTVRC,ACRAIRPT,ACRAIRT,ACR4P,ACRALTOT,ACRADV,ACRTV1,ACRTVDAY,ACRDESC,ACRTVEP,ACRTVLV,ACRTVDAT,ACRTVAR,ACRTVCIT,ACRTVPD,ACRPMRR,ACRTVLDG,ACRTVMLS
 N ACRTVPML,ACRTVMR,ACRTVTAX,ACRTVPHN,ACRTVOTH,ACRTVEXP,ACRTVRC,ACRTVRCC,ACRPHN,ACRPHNX,ACRATM,ACRATMX,ACRATM1,ACRATM2
 D CHK^ACRFSSA1
 K ACRQUIT
 S ACRMRR=$P(^ACRDOC(ACRDOCDA,"TOSA"),U,10)
 S (ACRREIM,ACRJ,ACRTVDA,ACRTOT,ACRPD,ACRLDG,ACRMR,ACRTAX,ACRPHN,ACROTH,ACROTHT,ACRRC,ACRTVRC,ACRAIRPT,ACRAIRT)=0
 S ACR4P=$P(^ACRDOC(ACRDOCDA,"TO"),U,26)
 S ACRDUZ=$P(^ACRDOC(ACRDOCDA,"TO"),U,9)
 S:'$D(ACRADV) ACRADV=0
 S ACRALTOT=$G(ACRALTOT)
 F  S ACRTVDA=$O(^ACRTV("D",ACRDOCDA,ACRTVDA)) Q:'ACRTVDA  D SETS
 I $P(^ACRDOC(ACRDOCDA,"TOAU"),U,6),$P(^("TOAU"),U,6)<ACRMR S ACRMR=$P(^("TOAU"),U,6)
 S ACRDAYS=ACRJ
 S ACRPHNX=ACRJ-1*$P(^ACRSYS(1,"DT"),U,17)
 S ACRPHN=$S(ACRPHN>ACRPHNX:ACRPHNX,1:ACRPHN)
 D TAXI
 K ACRPHNX
 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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