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

ACRFFDS.m

Go to the documentation of this file.
ACRFFDS ;IHS/DSD/THL,AEF - FUNDS DISTRIBUTION SUMMARIES; [ 11/01/2001   9:44 AM ]
 ;;2.1;ADMIN RESOURCE MGT SYSTEM;;NOV 05, 2001
 Q
LOCATION ;EP;TO SUMMARIZE SUB ALLOWANCES BY LOCATION
 D LEXIT
 D L1
LEXIT K ^TMP("ACRGLOC",$J),ACR,ACRFY,ACRLOC,ACRQUIT,ACROUT,ACRSSN,ACRSSA,ACRLCOD,ACRJ,ACRRTN,ACRT1,ACRT2,ACRT3,ACRT4,ACRY,ACRZDA,ACR1,ACR2,ACRDC,ACRFUNDS
 Q
L1 D SLOC
 Q:$D(ACRQUIT)
 S (ACRRTN,ZTRTN)="PLOC^ACRFFDS"
 S ZTDESC="SUB-ALLOWANCE DISTRIBUTION SUMMARY"
 D ^ACRFZIS
 Q
SLOC ;SELECT LOCATIONS
 ;
 S DIR(0)="NO^1000:9999"
 S DIR("A")="Fiscal Year"
 S DIR("B")=$S($E(DT,4,5)<10:$E(DT,1,3)+1700,1:($E(DT,1,3)+1)+1700)
 W !
 D DIR^ACRFDIC
 Q:Y'?4N
 S ACRFY=Y
 S DIR(0)="SO^1:Summarize by LOCATION;2:Summarize by SUB-SUB-ACTIVITY"
 S DIR("A")="Which summary"
 W !
 D DIR^ACRFDIC
 Q:Y<1
 S ACRFUNDS=$S(Y=1:1,1:2)
 I ACRFUNDS=1 D  I 1
 .S DIR(0)="SO^1:ALL Locations;2:Selected Locations"
 .S DIR("A")="ALL or Selected Locations"
 .S DIR("B")="All Locations"
 I ACRFUNDS=2 D
 .S DIR(0)="SO^1:ALL Sub-Sub-Activities;2:Selected Sub-Sub-Activities"
 .S DIR("A")="Which one"
 .S DIR("B")="ALL Sub-Sub-Activities"
 W !
 D DIR^ACRFDIC
 Q:'Y
 I Y=1 S ACRLOC="ALL" Q
 S ACRJ=0
 S ACRLOC=""
 F  D SL1 Q:$D(ACRQUIT)!$D(ACROUT)
 Q:$G(ACRLOC)=""
 K ACRQUIT
 Q
SL1 ;SELECT SPECIFIC LOCATIONS
 I ACRFUNDS=1 D  I 1
 .S DIC="^AUTTLCOD("
 .S DIC(0)="AEMQZ"
 .S DIC("A")="Which LOCATION: "
 .S:ACRJ>1 DIC("A")="Next Location: "
 I ACRFUNDS=2 D  I 1
 .S DIC="^AUTTSSA("
 .S DIC(0)="AEMQZ"
 .S DIC("A")="Which Sub-Sub-Activity: "
 .S:ACRJ>1 DIC("A")="Next Sub-Sub-Activity: "
 W !
 D DIC^ACRFDIC
 I Y<1 S ACRQUIT="" Q
 S ACRJ=ACRJ+1
 S ACRLOC=ACRLOC_+Y_","
 Q
 Q
GLOC ;GATHER DATA INTO TEMP GLOBAL
 N ACR ;,X
 S ACR=0
 I ACRLOC'="ALL" D  Q
 .F ACRJ=1:1 S ACR=$P(ACRLOC,",",ACRJ) Q:ACR=""  D GL1
 S ACRZDA=0
 F  S ACRZDA=$O(^ACRALC("FY",ACRFY,ACRZDA)) Q:'ACRZDA  D
 .S X=$G(^ACRALC(ACRZDA,"DT"))
 .I $P(X,U,11),$P(X,U,8),$P(^ACRALC(ACRZDA,0),U,8)="O" D ID
 Q
GL1 S ACRXREF=$S(ACRFUNDS=1:"LCODE",1:"SS")
 S ACRZDA=0
 F  S ACRZDA=$O(^ACRALC(ACRXREF,ACR,ACRZDA)) Q:'ACRZDA  D
 .S X=$G(^ACRALC(ACRZDA,"DT"))
 .I $P(X,U)=ACRFY,$P(X,U,8),$P(^ACRALC(ACRZDA,0),U,8)="O" D ID
 Q
ID ;CALCULATE INCREASES AND DECREASES
 S ACRSSN=$P($G(^AUTTSSA(+$P(X,U,8),0)),U,3)
 S ACRSSA=$P($G(^AUTTSSA(+$P(X,U,8),0)),U,4)
 S ACRLCOD=$P($G(^AUTTLCOD(+$P(X,U,11),0)),U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(^AUTTLCOD(+$O(^AUTTLCOD("B",ACR2,0)),0)),U,2)
 ...W !,$E(ACR3,1,15),?15,"|",$J($FN($P(X,U),"P,"),13),?29,"|",$J($FN($P(X,U,2),"P,"),11),?41,"|",$J($FN($P(X,U)+$P(X,U,2),"P,"),13),?55,"|",$J($FN($P(X,U,3),"P,"),10),?66,"|",$J($FN($P(X,U)+$P(X,U,2)+$P(X,U,3),"P,"),13)
 ...I IOSL-4<$Y D PAUSE^ACRFWARN Q:$D(ACRQUIT)  D LHEAD
 .D LTAIL
 Q
 W @IOF
 S ACRDC=$G(ACRDC)+1
 W !,"DISTRIBUTION OF FUNDS SUMAMRY"
 W !,"-----------------------------"
 W !,"FISCAL YEAR: ",ACRFY,?55,"PAGE: ",ACRDC
 W !,"REPORT DATE: "
 S Y=DT
 X ^DD("DD")
 W Y
 I ACRFUNDS=1 W !,"LOCATION...: ",ACR1,?$X+3,$P($G(^AUTTLCOD(+$O(^AUTTLCOD("B",ACR1,0)),0)),U,2)
 I ACRFUNDS=2 W !,"SUB-SUB-ACT: ",ACR1,?$X+3,^TMP("ACRGLOC",$J,ACR1)
 W $$DASH^ACRFMENU
 W !?15,"|",?25,"RECURRING",?41,"| TOTAL",?55,"| NON-",?66,"|"
 W !,$S(ACRFUNDS=1:"ACTIVITY",1:"LOCATION")
 W ?15,"| BASE",?29,"| INC/DEC",?41,"| RECURRING",?55,"| RECURRING",?66,"| TOTAL"
 W !,"---------------",?15,"|-------------",?29,"|-----------",?41,"|-------------",?55,"|----------",?66,"|------------"
 Q
LTAIL ;
 W !,"---------------",?15,"|-------------",?29,"|-----------",?41,"|-------------",?55,"|----------",?66,"|------------"
 W !?15,"|",$J($FN(ACRT1,"P,"),13),?29,"|",$J($FN(ACRT2,"P,"),11),?41,"|",$J($FN(ACRT3,"P,"),13),?55,"|",$J($FN(ACRT4,"P,"),10),?66,"|",$J($FN(ACRT3+ACRT4,"P,"),13)
 D PAUSE^ACRFWARN
 Q