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

ACRFFDH.m

Go to the documentation of this file.
ACRFFDH ;IHS/OIRM/DSD/AEF - PRINT FUNDS DISTRIBUTION ACCOUNTS HIERARCHICAL STRUCTURE [ 10/27/2004   4:18 PM ]
 ;;2.1;ADMIN RESOURCE MGT SYSTEM;**5,13**;NOV 05, 2001
 ;;SPECIAL DIAGNOSTIC REPORTS
 ;
 ;
 ;This routine loops through the FMS Department, FMS Sub-Allowance, FMS
 ;Allowance and FMS Appropriation files and produces a report showing
 ;the hierarchical structure of the accounts
 ;
EN ;EP -- MAIN ENTRY POINT      
 ;
 N X,Y,ZTDESC,ZTRTN,ZTSAVE
 D ^XBKVAR,HOME^%ZIS
 D QUE^ACRFUTL("DQ^ACRFFDH",.ZTSAVE,"FUNDS DISTRIBUTION REPORT") ;ACR*2.1*13.02 IM13574
 Q
DQ ;EP -- QUEUED JOB STARTS HERE
 ;
 N ALLOW,APPROP,DEPT,SUBALLOW
 K ^TMP("ACRFFDH",$J)
 D DEPT
 D SUB
 D ALLOW
 D APP
 I $D(^TMP("ACRFFDH",$J)) D ^ACRFFDH1
 D QUIT
 Q
DEPT ;----- LOOP THROUGH DEPARTMENT FILE
 ;
 S DEPT("D","IEN")=0 F  S DEPT("D","IEN")=$O(^ACRLOCB(DEPT("D","IEN"))) Q:'DEPT("D","IEN")  D
 . D D(DEPT("D","IEN"))
 . S ^TMP("ACRFFDH",$J,4,DEPT("D","IEN"),0)=DEPT("D","FY")_U_DEPT("D","CREATE FY")_U_DEPT("D","AMOUNT")_U_U_U_DEPT("D","SUBALLOW IEN")
 . I $G(DEPT("D","SUBALLOW IEN")) D
 . . D S(DEPT("D","SUBALLOW IEN"))
 . . S ^TMP("ACRFFDH",$J,3,SUBALLOW("D","IEN"),4,DEPT("D","IEN"),0)=DEPT("D","FY")_U_DEPT("D","CREATE FY")_U_DEPT("D","AMOUNT")_U_U_U_DEPT("D","SUBALLOW IEN")
 . I $G(SUBALLOW("D","ALLOW IEN")) D
 . . D A(SUBALLOW("D","ALLOW IEN"))
 . . S ^TMP("ACRFFDH",$J,2,ALLOW("D","IEN"),3,SUBALLOW("D","IEN"),4,DEPT("D","IEN"),0)=DEPT("D","FY")_U_DEPT("D","CREATE FY")_U_DEPT("D","AMOUNT")_U_U_U_DEPT("D","SUBALLOW IEN")
 . I $G(ALLOW("D","APPROP IEN")) D
 . . D P(ALLOW("D","APPROP IEN"))
 . . S ^TMP("ACRFFDH",$J,1,APPROP("D","IEN"),2,ALLOW("D","IEN"),3,SUBALLOW("D","IEN"),4,DEPT("D","IEN"),0)=DEPT("D","FY")_U_DEPT("D","CREATE FY")_U_DEPT("D","AMOUNT")_U_U_U_DEPT("D","SUBALLOW IEN")
 Q
SUB ;EP -- LOOP THROUGH SUB-ALLOWANCE FILE
 ;
 S SUBALLOW("D","IEN")=0 F  S SUBALLOW("D","IEN")=$O(^ACRALC(SUBALLOW("D","IEN"))) Q:'SUBALLOW("D","IEN")  D
 . D S(SUBALLOW("D","IEN"))
 . S ^TMP("ACRFFDH",$J,3,SUBALLOW("D","IEN"),0)=SUBALLOW("D","FY")_U_SUBALLOW("D","CREATE FY")_U_SUBALLOW("D","AMOUNT")_U_U_SUBALLOW("D","ALLOW IEN")
 . I $G(SUBALLOW("D","ALLOW IEN")) D
 . . D A(SUBALLOW("D","ALLOW IEN"))
 . . S ^TMP("ACRFFDH",$J,2,ALLOW("D","IEN"),3,SUBALLOW("D","IEN"),0)=SUBALLOW("D","FY")_U_SUBALLOW("D","CREATE FY")_U_SUBALLOW("D","AMOUNT")_U_U_SUBALLOW("D","ALLOW IEN")
 . I $G(ALLOW("D","APPROP IEN")) D
 . . D P(ALLOW("D","APPROP IEN"))
 . . S ^TMP("ACRFFDH",$J,1,APPROP("D","IEN"),2,ALLOW("D","IEN"),3,SUBALLOW("D","IEN"),0)=SUBALLOW("D","FY")_U_SUBALLOW("D","CREATE FY")_U_SUBALLOW("D","AMOUNT")_U_U_SUBALLOW("D","ALLOW IEN")
 Q
ALLOW ;EP -- LOOP THROUGH ALLOWANCE FILE
 ;
 S ALLOW("D","IEN")=0 F  S ALLOW("D","IEN")=$O(^ACRALW(ALLOW("D","IEN"))) Q:'ALLOW("D","IEN")  D
 . D A(ALLOW("D","IEN"))
 . S ^TMP("ACRFFDH",$J,2,ALLOW("D","IEN"),0)=ALLOW("D","FY")_U_ALLOW("D","CREATE FY")_U_ALLOW("D","AMOUNT")_U_ALLOW("D","APPROP IEN")
 . I $G(ALLOW("D","APPROP IEN")) D
 . . D P(ALLOW("D","APPROP IEN"))
 . . S ^TMP("ACRFFDH",$J,1,APPROP("D","IEN"),2,ALLOW("D","IEN"),0)=ALLOW("D","FY")_U_ALLOW("D","CREATE FY")_U_ALLOW("D","AMOUNT")_U_ALLOW("D","APPROP IEN")
 Q
APP ;EP -- LOOP THROUGH APPROPRIATION FILE
 ;
 S APPROP("D","IEN")=0 F  S APPROP("D","IEN")=$O(^ACRAPP(APPROP("D","IEN"))) Q:'APPROP("D","IEN")  D
 . D P(APPROP("D","IEN"))
 . S ^TMP("ACRFFDH",$J,1,APPROP("D","IEN"),0)=APPROP("D","FY")_U_APPROP("D","CREATE FY")_U_APPROP("D","AMOUNT")
 Q
D(X) ;----- SET DEPARTMENT VARIABLES
 ;
 ;      X  =  DEPARTMENT IEN
 ;
 N DATA
 K DEPT("D")
 S DEPT("D","IEN")=X
 S DATA=$G(^ACRLOCB(DEPT("D","IEN"),0))
 S DEPT("D","PTR")=$P(DATA,U,5)
 I DEPT("D","PTR") S DEPT("D","NAME")=$P($G(^AUTTPRG(DEPT("D","PTR"),0)),U)
 I $G(DEPT("D","NAME"))']"" S DEPT("D","NAME")="UNKNOWN"
 S DEPT("D","SUBALLOW IEN")=$P(DATA,U,4)
 S DEPT("D","AMOUNT")=$P(DATA,U)
 S DEPT("D","CREATE FY")=$P(DATA,U,16)
 S DEPT("D","FY")=$P($G(^ACRLOCB(DEPT("D","IEN"),"DT")),U)
 Q
S(X) ;EP -- SET SUB ALLOWANCE VARIABLES
 ;
 ;      X  =  SUBALLOWANCE IEN
 ;
 N DATA
 K SUBALLOW("D")
 S SUBALLOW("D","IEN")=X
 S DATA=$G(^ACRALC(SUBALLOW("D","IEN"),0))
 S SUBALLOW("D","NAME")=$P(DATA,U,12) ;ACR*2.1*5.16
 I SUBALLOW("D","NAME")']"" S SUBALLOW("D","NAME")="UNKNOWN" ;ACR*2.1*5.16
 S SUBALLOW("D","ALLOW IEN")=$P(DATA,U,3)
 S SUBALLOW("D","AMOUNT")=$P(DATA,U)
 S SUBALLOW("D","CREATE FY")=$P(DATA,U,16)
 S SUBALLOW("D","FY")=$P($G(^ACRALC(SUBALLOW("D","IEN"),"DT")),U)
 Q
A(X) ;EP -- SET ALLOWANCE VARIABLES
 ;
 ;      X  =  ALLOWANCE IEN
 ;
 N DATA
 K ALLOW("D")
 S ALLOW("D","IEN")=X
 S DATA=$G(^ACRALW(ALLOW("D","IEN"),0))
 S ALLOW("D","NAME")=$P(DATA,U,12)  ;ACR*2.1*5.16
 S ALLOW("D","APPROP IEN")=$P(DATA,U,2)
 S ALLOW("D","AMOUNT")=$P(DATA,U)
 S ALLOW("D","CREATE FY")=$P(DATA,U,16)
 S DATA=$G(^ACRALW(ALLOW("D","IEN"),"DT"))
 S ALLOW("D","FY")=$P(DATA,U)
 S ALLOW("D","PTR")=$P(DATA,U,5)
 I ALLOW("D","PTR")]"" S ALLOW("D","NAME")=$P($G(^AUTTALLW(ALLOW("D","PTR"),0)),U)_" "_ALLOW("D","NAME") ;ACR*2.1*5.16
 I $G(ALLOW("D","NAME"))']"" S ALLOW("D","NAME")="UNKNOWN"
 Q
P(X) ;EP -- SET APPROPRIATION VARIABLES
 ;
 ;      X  =  APPROPRIATION IEN
 ;
 N DATA
 K APPROP("D")
 S APPROP("D","IEN")=X
 S DATA=$G(^ACRAPP(APPROP("D","IEN"),0))
 S APPROP("D","PTR")=$P(DATA,U,2)
 I APPROP("D","PTR")]"" S APPROP("D","NAME")=$P($G(^AUTTPRO(APPROP("D","PTR"),0)),U)
 I $G(APPROP("D","NAME"))']"" S APPROP("D","NAME")="UNKNOWN"
 S APPROP("D","AMOUNT")=$P(DATA,U)
 S APPROP("D","CREATE FY")=$P(DATA,U,16)
 S APPROP("D","FY")=$P($G(^ACRAPP(APPROP("D","IEN"),"DT")),U)
 Q
QUIT ;----- CLEAN UP, CLOSE DEVICE, QUIT JOB
 ;
 K ZTSAVE
 K ^TMP("ACRFFDH",$J)
 D ^%ZISC
 Q