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

ACRFCAA.m

Go to the documentation of this file.
ACRFCAA ;IHS/OIRM/DSD/THL,AEF - CALCULATE QUARTERLY ALLOWANCE TOTALS; [ 11/01/2001   9:44 AM ]
 ;;2.1;ADMIN RESOURCE MGT SYSTEM;;NOV 05, 2001
 ;;ROUTINE USED TO CALCULATE QUARTERLY ALLOWANCE TOTALS
EN S ACRX=@ACRGREF@(ACRZDA,"DT"),ACR0=@ACRGREF@(ACRZDA,0),ACRAMT=+ACR0,ACRORIG=$P(ACR0,U,8)
 S ACRFY=$P(ACRX,U)
 S ACRQT=$P(ACRX,U,2)
 S ACRREC=$E($P(ACRX,U,3))
 S ACRAPPNO=$P(ACRX,U,4)
 S ACRALWNO=$P(ACRX,U,5)
 S ACRBANO=$P(ACRX,U,6)
 S ACRSSANO=$P(ACRX,U,8)
 S ACRAPTNO=$P(ACRX,U,13)
 D CALC
 S ACRALW=$P(^AUTTALLW(ACRALWNO,0),U)
 S ACRAPP=$P(^AUTTPRO(ACRAPPNO,0),U)
 S ACRBA=$P(^AUTTBA(ACRBANO,0),U,2)
 S ACRAPT=$P(^AUTTACPT(ACRAPTNO,0),U)
 S Y=DT
 X ^DD("DD")
 S ACRTODAY=Y
 S ACRAMDNO=1
 S ACRSTRET="300 SAN MATEO, N.E., SUITE 600"
 S ACRCITY="ALBUQUERQUE"
 S ACRSTATE="NM"
 S ACRZIP="87108"
 S ACRTO="CMB"
 D ^ACRFPAA
 D EXIT
 Q
CALC S (ACRX,ACRO1,ACRI1,ACRD1,ACRNO1,ACRNI1,ACRND1,ACRTNO1,ACRTNI1,ACRTND1,ACRO2,ACRI2,ACRD2,ACRNO2,ACRNI2,ACRND2,ACRTNO2,ACRTNI2,ACRTND2,ACRO3,ACRI3,ACRD3,ACRNO3,ACRNI3,ACRND3,ACRTNO3,ACRTNI3,ACRTND3)=0
 S (ACRO4,ACRI4,ACRD4,ACRNO4,ACRNI4,ACRND4,ACRTNO4,ACRTNI4,ACRTND4)=0
 F  S ACRX=$O(@ACRGREF@("AC",ACRALWNO,ACRFY,ACRX)) Q:'ACRX  D SET
 D SSA
 Q
FIRST ;
 S:ACRREC="R"&(ACRORIG="O") ACRO1=ACRO1+ACRAMT
 S:ACRREC="R"&(ACRORIG="I") ACRI1=ACRI1+ACRAMT
 S:ACRREC="R"&(ACRORIG="D") ACRD1=ACRD1+ACRAMT
 S:ACRREC='"R"&(ACRORIG="O") ACRNO1=ACRNO1+ACRAMT
 S:ACRREC='"R"&(ACRORIG="I") ACRNI1=ACRNI1+ACRAMT
 S:ACRREC='"R"&(ACRORIG="D") ACRND1=ACRND1+ACRAMT
 S ACRTNO1=ACRTNO1+ACRNO1,ACRTNI1=ACRTNI1+ACRNI1,ACRTND1=ACRTND1+ACRND1
 Q
SECOND ;
 S:ACRREC="R"&(ACRORIG="O") ACRO2=ACRO2+ACRAMT
 S:ACRREC="R"&(ACRORIG="I") ACRI2=ACRI2+ACRAMT
 S:ACRREC="R"&(ACRORIG="D") ACRD2=ACRD2+ACRAMT
 S:ACRREC='"R"&(ACRORIG="O") ACRNO2=ACRNO2+ACRAMT
 S:ACRREC='"R"&(ACRORIG="I") ACRNI2=ACRNI2+ACRAMT
 S:ACRREC='"R"&(ACRORIG="D") ACRND2=ACRND2+ACRAMT
 S ACRTNO2=ACRTNO2+ACRNO2,ACRTNI2=ACRTNI2+ACRNI2,ACRTND2=ACRTND2+ACRND2
 Q
THIRD ;
 S:ACRREC="R"&(ACRORIG="O") ACRO3=ACRO3+ACRAMT
 S:ACRREC="R"&(ACRORIG="I") ACRI3=ACRI3+ACRAMT
 S:ACRREC="R"&(ACRORIG="D") ACRD3=ACRD3+ACRAMT
 S:ACRREC='"R"&(ACRORIG="O") ACRNO3=ACRNO3+ACRAMT
 S:ACRREC='"R"&(ACRORIG="I") ACRNI3=ACRNI3+ACRAMT
 S:ACRREC='"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