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

ACRFSOF.m

Go to the documentation of this file.
ACRFSOF ;IHS/OIRM/DSD/THL,AEF - STATUS OF FUNDS REPORT;  [ 02/02/2005  10:23 AM ]
 ;;2.1;ADMIN RESOURCE MGT SYSTEM;**16**;NOV 05, 2001
 ;;ROUTINE TO PRINT THE STATUS OF FUNDS REPORT
EN F  D SELECT Q:$D(ACRQUIT)!$D(ACROUT)
EXIT K ACR,ACR1,ACR2,ACR3,ACR4,ACR5,ACR6,ACR0,ACROBJ,ACROBJ0,ACRDTAIL,ACRDOC,ACRDOC0,ACRREQ2,ACRSOFT,ACRDTL1,ACRBOTH,ACRZZDA,ACRZDA,ACRBUD,ACRSUBO,ACRQUIT,ACROUT,ACRXX,ACRYY,ACROCG,ACR11,ACR21,ACR22,ACR25,ACRDOCDA,ACRDT,ACRFY,ACRGLB,ACRGREF
 K ACRI,ACRLCDA,ACROBL,ACRPURP,ACRREF,ACRREQ,ACRSPT,ACRTO,ACRTOT,ACRX
 F X="ACRSOF","ACRXX","ACRYY" K ^TMP(X,$J)
 Q
SELECT D EXIT
 D HOME^ACRFMENU
 K ACRSOFT,ACRDTAIL,ACRDTL1
 W @IOF
 W !?10,"Status of Funds Report"
 S DIR(0)="SO^1:Department Account;2:Common Accounting Number;3:Sub-Allowance;4:Allowance;5:Location Code;6:Area Office;7:Funds Distribution Summaries"
 S DIR("A")="Which type of report"
 D DIR^ACRFDIC
 I $D(ACRQUIT)!$D(ACROUT)!("1234567"'[+Y) Q
 I Y=7 D LOCATION^ACRFFDS Q
 S ACRSOFT=$S(Y=1:"F",Y=2:"CAN",Y=3:"G",Y=4:"H",Y=5:"LCOD",Y=6:"AREA",1:"")
 Q:ACRSOFT=""
 D DETAIL
 I $D(ACRQUIT)!$D(ACROUT) K ACRQUIT Q
 I ACRSOFT="CAN" D CAN^ACRFSOF1 Q:$D(ACRQUIT)!$D(ACROUT)  G ZIS
 I ACRSOFT="AREA" D  Q:$D(ACRQUIT)!$D(ACROUT)  G ZIS
 .D AREA^ACRFTV
 .Q:$D(ACRQUIT)!$D(ACROUT)
 .S ACRZDA=ACRADA
 .D FY^ACRFSOF1
 I ACRSOFT="LCOD" D  Q:$D(ACRQUIT)!$D(ACROUT)  G ZIS
 .D LCOD^ACRFSOF1
 .Q:$D(ACRQUIT)!$D(ACROUT)
 .S (ACRZDA,ACRLCDA)=+Y
 .D FY^ACRFSOF1
 S ACRENTR1=$S(ACRSOFT="F":"LOCBAMT",ACRSOFT="G":"ALCAMT",ACRSOFT="H":"ALLAMT")
 S ACRENTRY=$S(ACRSOFT="F":"ALCAMT",ACRSOFT="G":"ALLAMT",ACRSOFT="H":"APPAMT")
 K ACRZDA
 D ENTRY^ACRFDTP
 I '$D(ACRZDA) K ACRQUIT Q
 I ACRSOFT'="CAN" D BUDGET
 I ACRSOFT="F" D C1^ACRFSOF1 Q:$D(ACRQUIT)!$D(ACROUT)
ZIS S ACRGLB=$S(ACRSOFT="F":"^ACRLOCB",ACRSOFT="H":"^ACRALW",ACRSOFT="G":"^ACRALC",1:"")
 S ACRRTN="SS^ACRFSOF"
 S ZTDESC="STATUS OF FUNDS REPORT"
 D ^ACRFZIS
 K ACRQUIT
 Q
DETAIL ;EP;
 K ACRDTAIL,ACRBOTH,ACRDTL1,ACROCG
 S DIR(0)="SO^1:Summary;2:Sub-Object Code Summary;3:Detailed Report;4:Summary and Detailed REport"
 S DIR("A")="Which one"
 W !
 D DIR^ACRFDIC
 I $D(ACRQUIT)!$D(ACROUT) Q
 I ACRY=1 K ACRDTAIL Q
 I ACRY=2 K ACRDTAIL S ACRSUBO="" D OCG Q
 I ACRY=3 S ACRDTAIL="" W ! D OC Q
 I Y=4 S ACRBOTH="" D OCG
 Q
SS ;EP;TO PRINT STATUS OF FUNDS REPORT
 I '$D(ACRDTAIL)!$D(ACRBOTH),$G(ACRGLB)]"" D P2^ACRFEA43
 I $D(ACRBOTH) D  Q
 .K ACRDTAIL,ACRDTL1
 .D SS0
 .S ACRDTAIL=""
 .D SS0
 .S ACRDTL1=""
 .D SS0
 .K ACRDTL1,^TMP("ACRSOF",$J),^TMP("ACRXX",$J),^TMP("ACRYY",$J)
SS0 Q:$D(ACRQUIT)!$D(ACROUT)
 U IO
 K ^TMP("ACRSOF",$J),^TMP("ACRXX",$J),^TMP("ACRYY",$J)
 S (ACR,ACR4,ACR9,ACR21,ACR25,ACRREQ,ACROBL,ACRSPT,ACRTOT)=0
 F  S ACR=$O(^ACRSS(ACRSOFT,ACRZDA,ACR)) Q:'ACR  D
 .S ACR0=$G(^ACRSS(ACR,0))
 .S ACRDT=$G(^ACRSS(ACR,"DT"))
 .S ACRDOCDA=$P(ACR0,U,2)
 .Q:'ACRDOCDA
 .Q:'$D(^ACRDOC(ACRDOCDA))                    ;ACR*2.1*16.05 IM11519
 .Q:'$P(ACR0,U,6)
 .Q:'$D(^ACRLOCB($P(ACR0,U,6),"DT"))
 .I ACRSOFT["CAN",$P(ACR0,U,5)'=ACRZDA Q
 .I "^CAN^AREA^LCOD^"[(U_ACRSOFT_U),+^ACRLOCB($P(ACR0,U,6),"DT")'=ACRFY Q
 .S ACROBJ0=$P(ACR0,U,4)
 .Q:'$D(^AUTTOBJC(+ACROBJ0,0))
 .S ACROBJ0=$P(^AUTTOBJC(ACROBJ0,0),U)
 .S ACROBJ=$E(ACROBJ0,1,2)_"00"
 .I $D(ACROCG)#2 Q:$E(ACROBJ,1,2)'=$E(ACROCG,1,2)
 .I $D(ACROCG)#2,$E(ACROCG,3,4)'="00",$E(ACROBJ0,3,4)'=$E(ACROCG,3,4) Q
 .I $D(ACROCG)#2,$E(ACROCG,3,4)'="00",$E(ACROBJ0,3,4)=$E(ACROCG,3,4) S ACROBJ=ACROCG
 .S:$D(ACRDTL1) ACROBJ="ALL"
 .I '$D(ACRSUBO) S:'$D(^TMP("ACRSOF",$J,ACROBJ)) ^TMP("ACRSOF",$J,ACROBJ)=""
 .E  S:'$D(^TMP("ACRSOF",$J,"SUB",ACROBJ0)) ^TMP("ACRSOF",$J,"SUB",ACROBJ0)=""
 .F ACRI=4,9,21 S @("ACR"_ACRI)=$P(ACRDT,U,ACRI)
 .N X
 .I '$D(ACRSUBO) S X=^TMP("ACRSOF",$J,ACROBJ)
 .E  S X=^TMP("ACRSOF",$J,"SUB",ACROBJ0)
 .S $P(X,U)=$P(X,U)+ACR4
 .S $P(X,U,2)=$P(X,U,2)+ACR9
 .I '$D(^TMP("ACRXX",$J,ACRDOCDA)) D
 ..S $P(X,U,25)=$P(X,U,25)+1
 ..S ^TMP("ACRXX",$J,ACRDOCDA)=""
 .S $P(X,U,4)=$P(X,U,4)+ACR21
 .I '$D(ACRSUBO) S ^TMP("ACRSOF",$J,ACROBJ)=X
 .E  S ^TMP("ACRSOF",$J,"SUB",ACROBJ0)=X
 .I $D(ACRDTAIL) D
 ..S ACRDOC=$P(ACR0,U,3)
 ..Q:'ACRDOC
 ..S ACRPURP=$E($P($G(^ACROBL(ACRDOC,"JST")),U),1,28)
 ..S ACRTO=$G(^ACRDOC(ACRDOC,"TO"))
 ..S ACRREQ2=$G(^ACRDOC(ACRDOC,"REQ2"))
 ..S ACRDOC=^ACRDOC(ACRDOC,0)
 ..S ACRREF=$P(ACRDOC,U,13)
 ..S ACRREF=$P(^AUTTDOCR(ACRREF,0),U)
 ..I "^130^600^"[(U_ACRREF_U) D
 ...S $P(ACRDOC,U,14)=ACRPURP
 ...S $P(ACRDOC,U,3)=$P(ACRTO,U,14)
 ...S $P(ACRDOC,U,11)=$P(ACRTO,U,15)
 ..I "^103^349^326^210^"'[(U_ACRREF_U) D  I 1
 ...S ACRDOC0=$P(ACRDOC,U)
 ...S ACRDOC2=""
 ..E  D
 ...S ACRDOC2=$P(ACRDOC,U)
 ...S ACRDOC0=$S($L($P(ACRDOC,U,2))>3&($P(ACRDOC,U,2)'["PEND"):$P(ACRDOC,U,2),1:$P(ACRDOC,U))
 ..I '$D(^TMP("ACRSOF",$J,ACROBJ,ACRDOC0)) D  I 1
 ...S X=$P(ACRDOC,U,3)_U_ACRDOC0_U_$P(ACRDOC,U,14)_U_$P(ACRREQ2,U,8)
 ...S:ACRDOC0'=ACRDOC2 $P(X,U,10)=ACRDOC2
 ..E  S X=^TMP("ACRSOF",$J,ACROBJ,ACRDOC0)
 ..S $P(X,U,5)=$P(X,U,5)+ACR4
 ..S $P(X,U,6)=$P(X,U,6)+ACR9
 ..S $P(X,U,21)=$P(X,U,21)+ACR21
 ..I '$D(^TMP("ACRYY",$J,ACRDOCDA)) D
 ...S $P(X,U,25)=$P(X,U,25)+1
 ...S ^TMP("ACRYY",$J,ACRDOCDA)=""
 ..S $P(X,U,11)=$P(ACRTO,U,15)
 ..S ^TMP("ACRSOF",$J,ACROBJ,ACRDOC0)=X
 ..K ACR4,ACR21,ACR9,ACRDOC2
 I '$D(ACRQUIT),$D(^TMP("ACRSOF",$J)) D SS1^ACRFSOF1
 I '$D(ACRQUIT),$E(IOST,1,2)="C-" D PAUSE^ACRFWARN
 W @IOF
 K ^TMP("ACRSOF",$J)
 Q
OC ;EP;SORT BY OBJECT CLASS
 S DIR(0)="YO"
 S DIR("A")="By Object Code"
 S DIR("B")="NO"
 D DIR^ACRFDIC
 Q:$D(ACROUT)!$D(ACRQUIT)
 I Y=0 S ACRDTL1="" Q
OCG ;SELECT OBJECT CLASS GROUP
 W !!?7,"If you want to print the report for one OBJECT CLASS group,"
 W !?7,"select the group below.  If no group is selected the report"
 W !?7,"will include all OBJECT CLASS groups."
 S DIR(0)="SO^1100:Personnel Costs;2100:Travel;2200:Transportation;2300:Rent;2400:Printing;2500:Services;2600:Supplies;3100:Equipment;3200:Land and Structures;4100:Grants"
 S DIR("A")="Which OBJECT CLASS Group"
 D DIR^ACRFDIC
 I '+Y K ACRQUIT Q
 S ACROCG=Y
 S DIR(0)="YO"
 S DIR("A",1)="Report for one specific"
 S DIR("A")=$S(Y=1100:"Personnel",Y=2100:"Travel",Y=2200:"Transportation",Y=2300:"Rent",Y=2400:"Printing",Y=2500:"Services",Y=2600:"Supplies",Y=3100:"Equipment",Y=3200:"Land and Structures",Y=4100:"Granst")_" Sub-Object Code ONLY"
 S DIR("B")="NO"
 W !
 D DIR^ACRFDIC
 I 'Y K ACRQUIT Q
 S DIC="^AUTTOBJC("
 S DIC(0)="AEMQZ"
 S DIC("S")="I $E($P(^(0),U),1,2)=$E($G(ACROCG),1,2)"
 S Y=ACROCG
 S DIC("A")="Which "_$S(Y=1100:"Personnel",Y=2100:"Travel",Y=2200:"Transportation",Y=2300:"Rent",Y=2400:"Printing",Y=2500:"Services",Y=2600:"Supplies",Y=3100:"Equipment",Y=3200:"Land and Structures",Y=4100:"Grants")_" Sub-Object Code: "
 W !
 D DIC^ACRFDIC
 I +Y<1 S ACRQUIT="" Q
 S ACROCG=$P(^AUTTOBJC(+Y,0),U)
 Q
BUDGET ;DETERMINE DOLLARS IN ACCOUNT
 K ACRBUD
 N ACRAMT,X,ACRX
 S X=U_"ACR"_$P(ACRENTR1,"AMT")
 S:X["ACRALL" X="^ACRALW"
 S ACRBUD=+@X@(ACRZDA,0) S:X["ACRLOCB" ACRBUD=ACRBUD+$P(^(0),U,11)
 S ACRX=0
 F  S ACRX=$O(@X@("ORIG",ACRZDA,ACRX)) Q:'ACRX  S ACRAMT=$S($P(@X@(ACRX,0),U,8)'="D":1,1:-1),ACRBUD=ACRBUD+(+@X@(ACRX,0)*ACRAMT)
 Q