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

ACRFDC.m

Go to the documentation of this file.
ACRFDC ;IHS/OIRM/DSD/THL,AEF - UTILITY TO COUNT DOCUMENTS; [ 11/01/2001   9:44 AM ]
 ;;2.1;ADMIN RESOURCE MGT SYSTEM;;NOV 05, 2001
 ;;UTILITY TO DISPLAY COUNTS OF DOCUMENTS FOR A FISCAL YEAR
EN D EN1
EXIT K ACRX,ACR0,ACRAMT,ACRAREA,ACRFY,ACRI,ACRY,ACRZ,ACRQUIT,ACRTOTN,ACRRAMT,ACRSIGS,ACRREC,ACRAPDA,ACRQUIT,ACROUT
 Q
EN1 D FY
 Q:$D(ACROUT)!$D(ACRQUIT)
 D AREA:$O(^ACRSYS(1))
 Q:$D(ACROUT)!$D(ACRQUIT)
 D ZIS
 Q
FY ;EP;
 S DIR(0)="SO^1:Specify Fiscal Year;2:All Documents/All Years"
 S DIR("A")="Which one"
 S DIR("B")="Specify Fiscal Year"
 W !
 D DIR^ACRFDIC
 I $D(ACRQUIT)!(Y<1) S ACRQUIT="" Q
 I Y=2 S ACRFY="ALL" Q
 S ACRFY=$E(DT,4,5)
 S ACRFY=$S(ACRFY<10:$E(DT,1,3),1:$E(DT,1,3)+1),ACRFY=ACRFY+1700
 S DIR(0)="N0A^1000:9999"
 S DIR("A")="Fiscal year: ",DIR("B")=ACRFY
 W !
 D DIR^ACRFDIC
 I $D(ACRQUIT)!(Y'?4N) S ACRQUIT="" Q
 S ACRFY=Y
 Q
AREA ;SELECT AREA OF REPORT
 W !!?10,"NO.",?15,"AREA"
 W !?10,"---",?15,"--------------------"
 N ACRX,Y,Z
 S (ACRX,Z)=0
 F  S ACRX=$O(^ACRSYS(ACRX)) Q:'ACRX  D
 .S Y=$P(^ACRSYS(ACRX,0),U)
 .S Y=$P(^AUTTAREA(Y,0),U)
 .S Z=Z+1
 .S Z(Z)=ACRX
 .W !?10,Z,?15,Y
 S DIR(0)="NO^1:"_Z
 S DIR("A")="Report for which Area"
 S DIR("A",1)="(Leave blank to report for all Areas)"
 W !
 D DIR^ACRFDIC
 I +Y<1 K ACRQUIT Q
 S ACRAREA=Z(Y)
 Q
COUNT ;
 S (ACRX,ACRSIGS,ACRREC,ACRRAMT)=0
 F ACRX=22,33,35,69,133,53,111 S ACRX(ACRX)=0
 F  S ACRX=$O(^ACRDOC(ACRX)) Q:'ACRX  D
 .S ACR0=$G(^ACRDOC(ACRX,0))
 .I $D(ACRAREA),ACRAREA'=$P($G(^ACRPO(+$P(ACR0,U,8),0)),U,19) Q
 .I ACRFY="ALL"!(ACRFY=+$G(^ACRLOCB(+$P(ACR0,U,6),"DT"))) D
 ..S ACRZ=$P(ACR0,U,13)
 ..S:$P(ACR0,U,24) ACRZ=111
 ..I "^22^33^35^69^133^53^111^"[(U_ACRZ_U) D
 ...D AMT
 ...S:ACRZ=69 ACRZ=$S($E($G(^ACROBL(ACRX,"APV")))="A":22,1:33)
 ...S $P(ACRX(ACRZ),U)=$P(ACRX(ACRZ),U)+1
 ...S $P(ACRX(ACRZ),U,2)=$P(ACRX(ACRZ),U,2)+ACRAMT
 ...I ACRZ=22!(ACRZ=111) D
 ....S $P(ACRX(33),U)=$P(ACRX(33),U)+1
 ....S $P(ACRX(33),U,2)=$P(ACRX(33),U,2)+ACRAMT
 ...I ACRZ=133 D
 ....S $P(ACRX(35),U)=$P(ACRX(35),U)+1
 ....S $P(ACRX(35),U,2)=$P(ACRX(35),U,2)+ACRAMT
 ...I ACRFY'="ALL" D
 ....N J
 ....S (ACRAPDA,J)=0
 ....F  S ACRAPDA=$O(^ACRAPVS("AB",ACRX,ACRAPDA)) Q:'ACRAPDA  S J=J+1
 ....S ACRSIGS=ACRSIGS+J
 I ACRFY="ALL" S ACRSIGS=$P(^ACRAPVS(0),U,4)
 Q
AMT S (ACRI,ACRAMT)=0
 N X
 F  S ACRI=$O(^ACRSS("C",ACRX,ACRI)) Q:'ACRI  D
 .S ACRAMT=ACRAMT+$P($G(^ACRSS(ACRI,"DT")),U,4)
 .S X=0
 .F  S X=$O(^ACRRR("B",ACRI,X)) Q:'X  D
 ..S ACRREC=$G(ACRREC)+1
 ..S Y=$P($G(^ACRSS(ACRI,"DT")),U,3)*$P($G(^ACRRR(X,"DT")),U,3)
 ..S ACRRAMT=ACRRAMT+Y
 Q
PRINT ;
 D COUNT
 N X
 S X=+$G(^ACRSYS(+$G(ACRAREA),0))
 I $G(ACRAREA),X,$D(^AUTTAREA(X,0)) N X S X=^(0) D  I 1
 .W !?10,$P(X,U)
 .W:$P(X,U)'["HEAD" " AREA"
 E  W !
 S Y=DT
 X ^DD("DD")
 W ?33,"REPORT DATE: ",Y
 W !?10,"DOCUMENT SUMMARY"
 W ?33,"FISCAL YEAR:   ",ACRFY
 W !?10,"-----------------------------------------------"
 W !?40,"DOLLAR VALUE"
 W !?32,"TOTAL"
 W ?40,"OF DOCUMENTS"
 W !?10,"TYPE OF DOCUMENT"
 W ?32,"NUMBER"
 W ?40,"PROCESSED"
 W !?10,"------------------"
 W ?32,"------"
 W ?40,"-----------------"
 N ACRTOTN,ACRTOTD
 S (ACRTOTN,ACRTOTD)=0
 F ACRZ=33,22,111,35,133,53 D
 .W !?10,$S(ACRZ=33:"REQUISITION",ACRZ=22:"PURCHASE ORDER",ACRZ=111:"CONTRACT ACTIONS",ACRZ=35:"TRAVEL ORDER",ACRZ=53:"TRAINING 350",1:"TRAVEL VOUCHER")
 .W ?32,$J($P(ACRX(ACRZ),U),6)
 .W ?40,$J($FN($P(ACRX(ACRZ),U,2),"P,",2),18)
 .S ACRTOTN=ACRTOTN+$P(ACRX(ACRZ),U)
 .S ACRTOTD=ACRTOTD+$P(ACRX(ACRZ),U,2)
 S ACRTOTN=ACRTOTN+ACRREC
 W !?10,"RECEIVING ACTIONS"
 W ?32,$J(ACRREC,6)
 W ?40,$J($FN(ACRRAMT,"P,",2),18)
 W !?10,"ELECTRONIC SIGNATURES"
 W ?32,$J(ACRSIGS,6)
 W !?32,"------"
 W ?40,"-----------------"
 W !?32,$J(ACRTOTN,6)
 W ?40,$J($FN(ACRTOTD,"P,",2),18)
 D PAUSE^ACRFWARN
 W @IOF
 Q
ZIS N X
 W !!?10
 F X=1:1:5 W @ACRON,"NOTE",@ACROF,?$X+5
 W !!,"This report takes several minutes to compile and print."
 W !,"You should QUEUE the report to print offline."
 S ACRRTN="PRINT^ACRFDC"
 S ZTDESC="FISCAL YEAR DOCUMENT SUMMARY REPORT"
 D ^ACRFZIS
 K ACRQUIT
 Q
REC ;COUNT NUMBER OF RECEIVING ACTIONS
 N X,Y,Z
 S (Z,X)=0
 F  S X=$O(^ACRRR("AC",X)) Q:'X  D
 .S Y=0
 .F  S Y=$O(^ACRRR("AC",X,Y)) Q:'Y  S Z=Z+1
 S ACRREC=Z
 Q