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

ACRFCALC.m

Go to the documentation of this file.
  1. ACRFCALC ;IHS/OIRM/DSD/THL,AEF - SELECTED FINANCIAL CALCULATIONS; [ 11/01/2001 9:44 AM ]
  1. ;;2.1;ADMIN RESOURCE MGT SYSTEM;;NOV 05, 2001
  1. ;;ROUTINE USED TO RECALCULATE ALL FINANCIAL TRANSACTIONS
  1. EN ;EP;TO RECALCULATE DATABASE
  1. D ^XBKVAR
  1. D EN1
  1. EXIT K ACRY,ACRDA,ACRQUIT,DIE,DA,DR,ACR2,ACRREQ,ACROBL,ACRSPT,ACRX,ACR,ACRDA
  1. Q
  1. EN1 W @IOF
  1. W !,"Recalculation of the database can take from several minutes."
  1. W !
  1. S DIR(0)="Y"
  1. S DIR("A")="Sure you want to recalculate"
  1. S DIR("B")="NO"
  1. D DIR^ACRFDIC
  1. I ACRY'=1!$D(ACRQUIT)!$D(ACROUT) D Q
  1. .W !!,"NO RECALCULATION HAS TAKEN PLACE."
  1. .H 2
  1. ;SYNCHRONIZE OBLIGATIONS, DISAPPROVAL/CANCELLATIONS
  1. W !!
  1. S ACRX=0
  1. F S ACRX=$O(^ACROBL(ACRX)) Q:'ACRX D
  1. .S X=$G(^ACROBL(ACRX,"APV"))
  1. .S ACR=0
  1. .F S ACR=$O(^ACRSS("J",ACRX,ACR)) Q:'ACR D
  1. ..S Y=$G(^ACRSS(ACR,"DT"))
  1. ..S Z=Y
  1. ..I $E(X)'="A" D
  1. ...S:$P(Y,U,9) $P(Y,U,9)=0
  1. ...S:$P(Y,U,21) $P(Y,U,21)=0
  1. ...I $E(X)="C"!($E(X)="D")!($P(X,U,3)="C")!($P(X,U,3)="D") D
  1. ....S $P(Y,U,4)=0,$P(Y,U,7)=0,$P(Y,U,21)=0
  1. ....Q:'$D(^ACRAL("E",ACRX))
  1. ....S ACRAL=0
  1. ....F S ACRAL=$O(^ACRAL("E",ACRX,ACRAL)) Q:'ACRAL I $P($G(^ACRAL(ACRAL,"DT")),U,9) S $P(^("DT"),U,9)="" W "*"
  1. ..Q:Z=Y
  1. ..W "."
  1. ..S ^ACRSS(ACR,"DT")=Y
  1. D ^ACRFCAL1
  1. I $E($G(IOST),1,2)="C-" W !,"Recalculating Requests. Please wait."
  1. D ALBOBL
  1. I $E($G(IOST),1,2)="C-" W !,"Recalculating Sub-Allowances. Please wait."
  1. D ALCOBL
  1. I $E($G(IOST),1,2)="C-" W !,"Recalculating Allowances. Please wait."
  1. D ALLTOBL
  1. I $E($G(IOST),1,2)="C-" W !,"Recalculating Allotments. Please wait."
  1. D APPOBL
  1. I $E($G(IOST),1,2)="C-" W !!,"RECALCULATION COMPLETED" H 2
  1. Q
  1. APPOBL ;RECALCULATES ALL APPROPRIATIONS
  1. S ACRDA=0,DIE="^ACRAPP("
  1. F S ACRDA=$O(^ACRAPP(ACRDA)) Q:'ACRDA D
  1. .S ACR2=0
  1. .S (ACROBL,ACRREQ,ACRSPT)=0
  1. .F S ACR2=$O(^ACROBL("PROP",ACRDA,ACR2)) Q:'ACR2 D
  1. ..S ACRREQ=ACRREQ+$G(^ACROBL(ACR2,0))
  1. ..S X=$G(^ACROBL(ACR2,"DT"))
  1. ..S ACRSPT=ACRSPT+$P(X,U,2)
  1. ..S ACROBL=ACROBL+$P(X,U,4)
  1. .L +^ACRAPP(ACRDA,"BA"):4 Q:'$T
  1. .S X=$G(^ACRAPP(ACRDA,"BA"))
  1. .S $P(X,U,2)=ACRREQ
  1. .S $P(X,U,3)=ACRSPT
  1. .S $P(X,U,7)=ACROBL
  1. .S ^ACRAPP(ACRDA,"BA")=X
  1. .L -^ACRAPP(ACRDA,"BA"):0
  1. Q
  1. ALLTOBL ;RECALCULATES ALL ALLOWANCES
  1. S ACRDA=0,DIE="^ACRALW("
  1. F S ACRDA=$O(^ACRALW(ACRDA)) Q:'ACRDA D
  1. .S ACR2=0
  1. .S (ACROBL,ACRREQ,ACRSPT)=0
  1. .F S ACR2=$O(^ACRSS("H",ACRDA,ACR2)) Q:'ACR2 D
  1. ..S X=$G(^ACRSS(ACR2,"DT"))
  1. ..S ACRREQ=ACRREQ+$P(X,U,4)
  1. ..S ACRSPT=ACRSPT+$P(X,U,21)
  1. ..S ACROBL=ACROBL+$P(X,U,9)
  1. .L +^ACRALW(ACRDA,"BA"):4 Q:'$T
  1. .S X=$G(^ACRALW(ACRDA,"BA"))
  1. .S $P(X,U,2)=ACRREQ
  1. .S $P(X,U,3)=ACRSPT
  1. .S $P(X,U,7)=ACROBL
  1. .S ^ACRALW(ACRDA,"BA")=X
  1. .L -^ACRALW(ACRDA,"BA"):0
  1. Q
  1. ALCOBL ;RECALCULATES ALL SUB-ALLOWANCES
  1. S ACRDA=0,DIE="^ACRALC("
  1. F S ACRDA=$O(^ACRALC(ACRDA)) Q:'ACRDA D
  1. .S ACR2=0
  1. .S (ACROBL,ACRREQ,ACRSPT)=0
  1. .F S ACR2=$O(^ACRSS("G",ACRDA,ACR2)) Q:'ACR2 D
  1. ..S X=$G(^ACRSS(ACR2,"DT"))
  1. ..S ACRREQ=ACRREQ+$P(X,U,4)
  1. ..S ACRSPT=ACRSPT+$P(X,U,21)
  1. ..S ACROBL=ACROBL+$P(X,U,9)
  1. .L +^ACRALC(ACRDA,"BA"):4 Q:'$T
  1. .S X=$G(^ACRALC(ACRDA,"BA"))
  1. .S $P(X,U,2)=ACRREQ
  1. .S $P(X,U,3)=ACRSPT
  1. .S $P(X,U,7)=ACROBL
  1. .S ^ACRALC(ACRDA,"BA")=X
  1. .L -^ACRALC(ACRDA,"BA"):0
  1. Q
  1. ALBOBL ;RECALCULATES ALL DEPARTMENT ACCOUNTS
  1. S ACRDA=0,DIE="^ACRLOCB("
  1. F S ACRDA=$O(^ACRLOCB(ACRDA)) Q:'ACRDA D
  1. .S ACR2=0
  1. .S (ACROBL,ACRREQ,ACRSPT)=0
  1. .F S ACR2=$O(^ACRSS("F",ACRDA,ACR2)) Q:'ACR2 D
  1. ..S X=$G(^ACRSS(ACR2,"DT"))
  1. ..S ACRREQ=ACRREQ+$P(X,U,4)
  1. ..S ACRSPT=ACRSPT+$P(X,U,21)
  1. ..S ACROBL=ACROBL+$P(X,U,9)
  1. .L +^ACRLOCB(ACRDA,"BA"):4 Q:'$T
  1. .S X=$G(^ACRLOCB(ACRDA,"BA"))
  1. .S $P(X,U,2)=ACRREQ
  1. .S $P(X,U,3)=ACRSPT
  1. .S $P(X,U,7)=ACROBL
  1. .S ^ACRLOCB(ACRDA,"BA")=X
  1. .L -^ACRLOCB(ACRDA,"BA"):0
  1. Q