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

ACRFDHR1.m

Go to the documentation of this file.
ACRFDHR1 ;IHS/OIRM/DSD/THL,AEF - PROCESS DOCUMENT HISTORY RECORDS - CON'T;  [ 02/02/2005  10:25 AM ]
 ;;2.1;ADMIN RESOURCE MGT SYSTEM;**3,16**;NOV 05, 2001
 ;;
DHRRCD ;EP;TO CREATE DHR RECORD IN DHR PROGRAM
 ; Quit if hold for next fiscal year
 Q:$$HOLD($G(ACRFY),$G(ACR3),$G(ACRD0),$G(ACRD1),$G(ACRD2))   ;ACR*2.1*3.08
 ;
 ; Quit if not 'activate DHR interface'
 Q:$P(^ACRSYS($$SYS^ACRFUTL($P($G(ACRDOC0),U,8)),"DT"),U,25)'=1
 ;
 ; Quit if no DHR records
 Q:'$D(^AFSHRCDS(0))#2
 ;
 ; Quit if Travel DHR only, and reference code is not 130 or 600 (travel order or voucher)
 I $P(^ACRSYS($$SYS^ACRFUTL($P($G(ACRDOC0),U,8)),"DT"),U,32),"^130^600^"'[(U_ACRREF_U) Q
 ;
 ; Quit if multi-use standard re and not 'create DHR for Fedstrip'
 I ACRREF=210,'$P(^ACRSYS($$SYS^ACRFUTL($P($G(ACRDOC0),U,8)),"DT"),U,38) Q
 ;
 ;I $P(^ACRSYS(1,"DT"),U,37),"^600^618^"[(U_ACRREF_U),"^181^182^191^192^281^"[(U_(ACR3)_U) Q
 N ACRDATE,ACRDA
 S ACRDATE=DT
 S ACRDA=$S($G(ACRIV)'="PAY":5,1:6)
DATE I $P($G(^AFSHRCDS(ACRDA,"D",ACRDATE,"I",1,0)),U,3)="C" D  G DATE
 .S X1=ACRDATE
 .S X2=1
 .D C^%DTC
 .S ACRDATE=X
 I '$D(^AFSHRCDS(ACRDA,0))#2 D
 .S (X,DINUM)=ACRDA
 .S DIC="^AFSHRCDS("
 .S DIC(0)="L"
 .D FILE^ACRFDIC
 S:$D(ACRDHRZ) ACRDATE=ACRDHRZ
 S:'$D(^AFSHRCDS(ACRDA,"D",0)) ^AFSHRCDS(ACRDA,"D",0)="^9002322.02D"
 I $G(ACRIV)'="PAY",ACRREF'="043" D  I 1
 .S ACRACPT=$P(ACRDOC0,U,8)
 .S ACRACPT=$P(^ACRPO(ACRACPT,0),U,4)
 .I ACRACPT,$D(^AUTTACPT(ACRACPT,0)) S ACRACPT=$P(^AUTTACPT(ACRACPT,0),U)
 I $D(^AFSHRCDS(ACRDA,"D",ACRDATE,0))#2 S Y=ACRDATE
 E  D
 .S DA(1)=ACRDA
 .S (X,DINUM)=ACRDATE
 .S DIC="^AFSHRCDS("_ACRDA_",""D"","
 .S DIC(0)="L"
 .D FILE^ACRFDIC
 S ACRDA(2)=+Y
 S:'$D(^AFSHRCDS(ACRDA,"D",ACRDA(2),"I",0))#2 ^AFSHRCDS(ACRDA,"D",ACRDA(2),"I",0)="^9002322.21"
 I $D(^AFSHRCDS(ACRDA,"D",ACRDA(2),"I","B","R")) S Y=$O(^("R",0))
 E  D
 .S DA(2)=ACRDA
 .S DA(1)=ACRDA(2)
 .S X="R"
 .S DIC="^AFSHRCDS("_ACRDA_",""D"","_ACRDA(2)_",""I"","
 .S DIC(0)="L",DIC("DR")="1////"_ACRACPT_";2////O"
 .D FILE^ACRFDIC
 S ACRDA(3)=+Y
 S:'$D(^AFSHRCDS(ACRDA,"D",ACRDA(2),"I",ACRDA(3),"S",0)) ^AFSHRCDS(ACRDA,"D",ACRDA(2),"I",ACRDA(3),"S",0)="^9002322.216"
 K X
 L +^AFSHRCDS(ACRDA,"D",ACRDA(2),"I",ACRDA(3),"S",0):4 Q:'$T
 S X=$P(^AFSHRCDS(ACRDA,"D",ACRDA(2),"I",ACRDA(3),"S",0),U,3)
 S X=X+1
 L -^AFSHRCDS(ACRDA,"D",ACRDA(2),"I",ACRDA(3),"S",0):0
 Q:'$D(X)
 S DA(3)=ACRDA
 S DA(2)=ACRDA(2)
 S DA(1)=ACRDA(3)
 ;S X=X                                  ;COMMENT OUT ;ACR*2.1*3.09
 S DIC="^AFSHRCDS("_ACRDA_",""D"","_ACRDA(2)_",""I"","_ACRDA(3)_",""S"","
 S DIC(0)="L"
 D FILE^ACRFDIC
 S ACRCNT=$G(ACRCNT)+1
 S DA(3)=ACRDA
 S DA(2)=ACRDA(2)
 S DA(1)=ACRDA(3)
 S DA=+Y
 S DIE="^AFSHRCDS("_ACRDA_",""D"","_ACRDA(2)_",""I"","_ACRDA(3)_",""S"","
 ;I $G(ACRIV)="PAY",'$G(ACRRECOV) Q:$G(ACRDHR)=""  D DR  ;ACR*2.1*16.06 IM15505
 I $G(ACRIV)["PAY",'$G(ACRRECOV) Q:$G(ACRDHR)=""  D DR   ;ACR*2.1*16.06 IM15505
 S DR=ACRDR
 I '$G(ACRFMS) D
 . Q:'$G(ACRD0)  Q:'$G(ACRD1)  Q:'$G(ACRD2)   ;ACR*2.1*3.08
 . S ACRFMS=$P($G(^AFSLAFP(ACRD0,1,ACRD1,1,ACRD2,"ARMS")),U,4) ;ACR*2.1*3.08
 I $E(DR,$L(DR))=";" S DR=$P(DR,";",1,$L(DR,";")-1)
 S DR=DR_";99////"_$G(ACRFMS)
 D DIE^ACRFDIC
 K ACRFMS
 Q
DR ;CREATE DR STRING FROM 1166 DATA RECORD
 N Z
 S Z=ACRDHR
 S DR="1////"_$E(Z)
 S DR=DR_";2///"_$E(Z,2,7)
 S DR=DR_";3////"_$E(Z,8,10)
 S DR=DR_";4////"_$E(Z,11)
 S DR=DR_";5////"_$E(Z,12)
 S DR=DR_";6////"_$E(Z,13,15)
 S DR=DR_";7////"_$E(Z,16,25)
 S DR=DR_";8////"_$E(Z,26,28)
 S DR=DR_";9////"_$E(Z,29,38)
 S DR=DR_";10////"_$E(Z,39)
 S DR=DR_";11////"_$E(Z,40)
 S DR=DR_";12////"_$E(Z,41,47)
 S DR=DR_";13////"_$E(Z,48,51)
 S DR=DR_";14////"_$E(Z,52,63)
 S DR=DR_";15////"_$E(Z,64)
 S DR=DR_";16////"_$E(Z,65,79)
 S DR=DR_";17////"_$E(Z,80,94)
 S DR=DR_";18////"_$E(Z,95,104)
 S DR=DR_";26////"_$E(Z,126,129)
 S DR=DR_";27////"_$E(Z,130,133)
 S DR=DR_";28////"_$E(Z,134,135)
 S DR=DR_";29////"_$E(Z,136)
 S DR=DR_";30////"_$E(Z,137,140)
 S ACRDR=DR
 Q
HOLD(ACRFY,ACR3,ACRFYDA,ACRBATDA,ACRSEQDA)       ;
 ;----- HOLD DHRS FOR NEW FISCAL YEAR
 ;
 ;      BASED ON ENTRY IN FIELD 401 HOLD DHRS FOR NEW FY
 ;      IN THE FMS SYSTEM DEFAULTS FILE
 ;
 N ACRDOCDA
 I '$P($G(^ACRSYS(1,401)),U) Q 0
 I ACRFY,ACRFY=$P($G(^ACRSYS(1,401)),U) Q 1
 I ACR3="050",ACRFY=$P($G(^ACRSYS(1,401)),U) Q 1
 I "^181^182^191^192^061^242^"[(U_ACR3_U) D
 . I $G(ACRFYDA),$G(ACRBATDA),$G(ACRSEQDA) D   ;ACR*2.1*3.15
 . . S ACRDOCDA=$P($G(^AFSLAFP(ACRFYDA,1,ACRBATDA,1,ACRSEQDA,"ARMS")),U)  ;ACR*2.1*3.15
 I $G(ACRDOCDA),$$DOCFY(ACRDOCDA)=$P($G(^ACRSYS(1,401)),U) Q 1
 Q 0
DOCFY(ACRDOCDA)    ;
 ;----- RETURNS FY OF FUNDS FOR ARMS DOCUMENT
 ;
 S Y=""
 S Y=$P($G(^ACRDOC(ACRDOCDA,0)),U,6)
 I Y S Y=$P($G(^ACRLOCB(Y,"DT")),U)
 Q Y