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

ACRFEXP3.m

Go to the documentation of this file.
ACRFEXP3 ;IHS/OIRM/DSD/AEF - EXPORT TO DHR FILE [ 10/4/2005  3:57 PM ]
 ;;2.1;ADMIN RESOURCE MGT SYSTEM;**3,16,19**;NOV 05, 2001
 ;
 ;
 ;This routine processes payments from the 1166 Approvals
 ;for Payment file and places them into the DHR Data Records
 ;file for further processing and subsequent transmission to
 ;CORE.
 ;
 ;It is expected that the global ^TMP("ACR",$J,"DHR") would have
 ;been built by routine ^ACRFEXP2 and will contain the payments
 ;to be placed into the DHR Data Records file.
 ;
DHR ;EP -- MAIN ENTRY POINT
 ;
 Q:'$P($G(^ACRSYS(1,"DT1")),U,9)
 ;
 Q:'$D(^TMP("ACR",$J,"DHR"))
 ;
 D LOOP
 ;
 Q
LOOP ;----- LOOP THROUGH ^TMP("ACR",$J,"DHR") GLOBAL AND PUT
 ;      PAYMENT DATA INTO DHR DATA RECORDS FILE
 ;
 N ACRD0,ACRD1,ACRD2,ACRPMT,ACRVEND
 S ACRVEND=""
 F  S ACRVEND=$O(^TMP("ACR",$J,"DHR",ACRVEND)) Q:ACRVEND']""  D
 . S ACRPMT=0
 . F  S ACRPMT=$O(^TMP("ACR",$J,"DHR",ACRVEND,ACRPMT)) Q:'ACRPMT  D
 . . S ACRDATA=^TMP("ACR",$J,"DHR",ACRVEND,ACRPMT,0)
 . . S ACRD0=$P(ACRDATA,U,3)
 . . S ACRD1=$P(ACRDATA,U,4)
 . . S ACRD2=$P(ACRDATA,U,5)
 . . D ONE(ACRD0,ACRD1,ACRD2)
 Q
ONE(ACRD0,ACRD1,ACRD2)       ;
 ;----- PROCESS ONE PAYMENT
 ;
 ;      INPUT:
 ;      ACRD0  = FY IEN IN 1166 APPROVALS FOR PAYMENT FILE
 ;      ACRD1  = BATCH IEN
 ;      ACRD2  = SEQ IEN
 ;
 N ACRDATA,ACROCC,Z
 ;Q:$P($G(^AFSLAFP(ACRD0,1,ACRD1,1,ACRD2,"ARMS")),U,2)  ;ACR*2.1*16.06 IM15505
 S ACRDATA=$G(^AFSLAFP(ACRD0,1,ACRD1,1,ACRD2,"ARMS"))  ;ACR*2.1*16.06 IM15505
 Q:$P(ACRDATA,U,2)                               ;ACR*2.1*16.06 IM15505
 S ACRDOCDA=$P(ACRDATA,U)                        ;ACR*2.1*16.06 IM15505
 S ACRDOC0=""                                    ;ACR*2.1*16.06 IM15505
 S:ACRDOCDA]"" ACRDOC0=$G(^ACRDOC(ACRDOCDA,0))   ;ACR*2.1*16.06 IM15505
 D SET(ACRD0,ACRD1,ACRD2,.Z)
 S ACRDATA=$G(^AFSLAFP(ACRD0,1,ACRD1,1,ACRD2,0))  ;ACR*2.1*16.06 IM15505
 S ACRIV="PAY"
 S:$P(ACRDATA,U,18)="05025" ACRIV=""     ;DISCOUNT;ACR*2.1*16.06 IM15505
 ;D DHRRCD(Z)                                         ;ACR*2.1*16.06 IM15505
 D DHRRCD(Z,ACRIV)                                    ;ACR*2.1*16.06 IM15505
 ;S ACRDATA=$G(^AFSLAFP(ACRD0,1,ACRD1,1,ACRD2,0))     ;ACR*2.1*16.06 IM15505 
 I +$P(ACRDATA,U,12),$P(ACRDATA,U,24) D
 . Q:$P(ACRDATA,U,18)="06119"
 . S ACROCC=$P(ACRDATA,U,8)
 . I ACROCC S ACROCC=$P($G(^AUTTOBJC(ACROCC,0)),U)
 . Q:ACROCC="219M"
 . Q:$P(ACRDATA,U,6)'=600
 . ;D LTA(ACRD0,ACRD1,ACRD2,.Z)                     ;ACR*2.1*3.06
 . N ACRDAT                                         ;ACR*2.1*3.06
 . D LTA(ACRD0,ACRD1,ACRD2,.Z,.ACRDAT)              ;ACR*2.1*3.06
 . D DHR2^ACRFPAY2(ACRD0,ACRD1,ACRD2,ACRDAT)        ;ACR*2.1*3.06
 .;D DHRRCD(Z)                                   ;ACR*2.1*16.06 IM15505
 . D DHRRCD(Z,"PAY")                             ;ACR*2.1*16.06 IM15505
 D UPDATE(ACRD0,ACRD1,ACRD2)
 Q
SET(ACRD0,ACRD1,ACRD2,Z)     ;
 ;----- SET DHR INFORMATION INTO VARIABLE Z
 ;
 ;      INPUT:
 ;      ACRD0  = FY IEN OF 1166 APPROVALS FOR PAYMENT FILE
 ;      ACRD1  = BATCH IEN OF 1166 APPROVALS FOR PAYMENT FILE
 ;      ACRD2  = SEQUENCE IEN OF 1166 APPROVALS FOR PAYMENT FILE
 ;
 ;      RETURNS:
 ;      Z      = DHR DATA STRING
 ;
 N ACRAMT,ACRBTYP,ACRCAN,ACROBJ,ACRSEQ0,ACRSEQ1,ACRSEQ3,ACRSSN
 D ^XBKVAR
 S ACRBTYP=$P($G(^AFSLAFP(ACRD0,1,ACRD1,0)),U,4)
 S ACRSEQ0=$G(^AFSLAFP(ACRD0,1,ACRD1,1,ACRD2,0))
 S ACRSEQ1=$G(^AFSLAFP(ACRD0,1,ACRD1,1,ACRD2,1))
 S ACRSEQ3=$G(^AFSLAFP(ACRD0,1,ACRD1,1,ACRD2,3))
 S ACRCAN=$P(ACRSEQ0,U,7)
 I ACRCAN S ACRCAN=$P($G(^AUTTCAN(ACRCAN,0)),U)
 S ACROBJ=$P(ACRSEQ0,U,8)
 I ACROBJ S ACROBJ=$P($G(^AUTTOBJC(ACROBJ,0)),U)
 S ACRAMT=$P(ACRSEQ0,U,11)
 S ACRAMT=$TR(ACRAMT,".","")
 S ACRSSN=""
 I ACRBTYP="V" D
 . S ACRSSN=$P(ACRSEQ0,U,10)
 . S ACRSSN=$P($G(^AUTTVNDR(ACRSSN,11)),U,13)
 I ACRBTYP="T" D
 . S ACRSSN=$P(ACRSEQ0,U,24)
 . S ACRSSN=$P($G(^VA(200,ACRSSN,1)),U,9)
 ;
 S Z=""
 S $E(Z)=2
 S $E(Z,2,7)=$E(DT,4,7)_$E(DT,2,3)
 S $E(Z,8,12)=$$PAD^ACRFUTL($P(ACRSEQ0,U,18),"R",5,"")
 S $E(Z,13,15)=$$PAD^ACRFUTL($P(ACRSEQ0,U,5),"R",3,"")
 S $E(Z,16,25)=$$PAD^ACRFUTL($P(ACRSEQ0,U,20),"R",10,"")
 S $E(Z,26,28)=$$PAD^ACRFUTL($P(ACRSEQ0,U,6),"R",3,"")
 S $E(Z,29,38)=$$PAD^ACRFUTL($P(ACRSEQ0,U,21),"R",10,"")
 S $E(Z,39)=1
 S $E(Z,40)=$$PAD^ACRFUTL($P(ACRSEQ0,U,2),"R",1,"")
 S $E(Z,41,47)=$$PAD^ACRFUTL($G(ACRCAN),"R",7,"")
 S $E(Z,48,51)=$$PAD^ACRFUTL($G(ACROBJ),"R",4,"")
 S $E(Z,52,63)=$$PAD^ACRFUTL(ACRAMT,"L",12,0)
 S $E(Z,64)=1
 S $E(Z,65,79)=$$PAD^ACRFUTL($G(ACRSSN),"R",15,"")
 S $E(Z,80,94)=$$PAD^ACRFUTL("","R",15,"")
 S $E(Z,95,104)=$$PAD^ACRFUTL($P(ACRSEQ1,U,11),"R",10,"")
 S $E(Z,105,106)=$$PAD^ACRFUTL("","R",2,"")
 S $E(Z,107,108)=$$PAD^ACRFUTL("","R",2,"")
 S $E(Z,109)=$$PAD^ACRFUTL("","R",1,"")
 S $E(Z,110,111)=$$PAD^ACRFUTL("","R",2,"")
 S $E(Z,112,115)=$$PAD^ACRFUTL("","R",4,"")
 S $E(Z,116,119)=$$PAD^ACRFUTL("","R",4,"")
 S $E(Z,120,125)=$$PAD^ACRFUTL("","R",6,"")
 S $E(Z,126,129)=$$PAD^ACRFUTL($P(ACRSEQ3,U),"R",4,"")
 S $E(Z,130,133)=$$PAD^ACRFUTL($P(ACRSEQ3,U,2),"R",4,"")
 S $E(Z,134,135)=$$PAD^ACRFUTL($P(ACRSEQ3,U,3),"R",2,"")
 S $E(Z,136)=$$PAD^ACRFUTL("","R",1,"")
 S $E(Z,137,140)=$$PAD^ACRFUTL("","R",4,"")
 S $E(Z,141,160)=$$PAD^ACRFUTL(0,"R",20,0)
 Q
LTA(ACRD0,ACRD1,ACRD2,Z,ACRDAT)     ; ACR*2.1*3.06
 ;----- LIQUIDATE TRAVEL ADVANCE, SET LTA DHR DATA INTO VARIABLE Z
 ;      IF PAYMENT IS FOR TRAVEL VOUCHER WITH TRAVEL ADVANCE AMOUNT,
 ;      CREATE SECOND DHR TO LIQUIDATE THE TRAVEL ADVANCE
 ;
 ;      INPUT:
 ;      ACRD0  = FY IEN IN 1166 APPROVALS FOR PAYMENT FILE
 ;      ACRD1  = BATCH IEN IN 1166 APPROVALS FOR PAYMENT FILE
 ;      ACRD2  = SEQUENCE IEN OF 1166 APPROVALS FOR PAYMENT FILE
 ;      Z      = DHR DATA STRING FOR ORIGINAL DHR
 ;      ACRDAT = NULL
 ;
 ;      RETURNS:
 ;      Z      = DHR DATA STRING CONTAINING TRAVEL ADVANCE LIQUIDATION
 ;      ACRDAT = MODIFIED STRING REPRESENTING THE ZERO NODE
 ;
 N ACRAMT,ACRNAME
 S ACRDAT=$G(^AFSLAFP(ACRD0,1,ACRD1,1,ACRD2,0))
 S ACRAMT=$P(ACRDAT,U,12)
 S ACRAMT=$$DOL^ACRFUTL(ACRAMT)
 S ACRAMT=$TR(ACRAMT,".","")
 S ACRNAME=$P(ACRDAT,U,24)
 ;S ACRNAME=$P($G(^VA(200,ACRNAME,0)),U)        ;ACR*2.1*19.02 IM16848
 ;S ACRNAME=$P(ACRNAME,",")_" "_$E($P(ACRNAME,",",2)) ;ACR*2.1*19.02 IM16848
 S ACRNAME=$$NAME3^ACRFUTL1(ACRNAME)            ;ACR*2.1*19.02 IM16848
 ;
 S ($P(ACRDAT,U,18),$E(Z,8,12))="24219"
 S ($P(ACRDAT,U,6),$E(Z,26,28))="602"
 S ($P(ACRDAT,U,11),$E(Z,52,63))=$$PAD^ACRFUTL(ACRAMT,"L",12,0)
 S $P(ACRDAT,U,12)=""
 S ($P(ACRDAT,U,24),$E(Z,80,94))=$$PAD^ACRFUTL(ACRNAME,"R",15,"")
 Q
DHRRCD(Z,ACRIV)          ;                      ;ACR*2.1*16.06 IM15505
 ;----- INTERFACE TO DHRRCD^ACRFDHR1 ROUTINE
 ;      SETS UP VARIABLES NEEDED TO CALL DHRRCD^ACRFDHR1 ROUTINE
 ;      TO PUT DHR RECORDS INTO DHR DATA RECORDS FILE
 ;
 ;      INPUT: 
 ;      Z       = DHR DATA STRING
 ;      ACRIV   = OBLIGATION/PAYMENT INDICATOR   ;ACR*2.1*16.06 IM15505
 ;
 ;      ACR3    = TRANSACTION CODE
 ;      ACRACPT = ACCOUNTING POINT
 ;      ACRDHR  = DHR DATA STRING
 ;      ACRREF  = ORIGINAL DOCUMENT REFERENCE CODE
 ;
 ;N ACR3,ACRACPT,ACRDHR,ACRIV,ACRREF            ;ACR*2.1*16.06 IM15505
 N ACR3,ACRACPT,ACRDHR,ACRREF                   ;ACR*2.1*16.06 IM15505
 S ACR3=$E(Z,8,10)
 S ACRACPT=$E(Z,42,43)
 S ACRREF=$E(Z,13,15)
 ;S ACRIV="PAY"                                  ;ACR*2.1*16.06 IM15505
 S ACRDHR=$$UPPER^ACRFUTL(Z)
 D DHRRCD^ACRFDHR1
 Q
UPDATE(ACRD0,ACRD1,ACRD2)    ;
 ;----- UPDATE ARMS DHR FILED FIELD
 ;
 N DA,DIE,DR,X,Y
 S DA(2)=ACRD0
 S DA(1)=ACRD1
 S DA=ACRD2
 S DIE="^AFSLAFP("_DA(2)_",1,"_DA(1)_",1,"
 S DR=".03////1"
 D ^DIE
 Q