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

ENFARC3.m

Go to the documentation of this file.
  1. ENFARC3 ;WIRMFO/SAB-FIXED ASSET RPT, TRANSACTION REGISTER (CONT); 12/16/1998
  1. ;;7.0;ENGINEERING;**39,60**;Aug 17, 1993
  1. Q
  1. ;
  1. FCPVAL(ENFILE,ENIEN,ENFAIEN) ; Determine prior values at time of FC
  1. ; Input Variables
  1. ; ENFILE - FAP document file for the input document
  1. ; ENIEN - IEN of the input document in ENFILE
  1. ; ENFAIEN - IEN of the assoicated FA document
  1. ; Returns
  1. ; EN(30) - previous DESCRIPTION
  1. ; EN(34) - previous ACQ METHOD CODE
  1. ; EN(105) - previous ACQ DATE (FileMan format)
  1. ; also when betterment = 00
  1. ; EN(29) - previous LOCATION (NATIONAL EIL)
  1. ; EN(37) - previous USEFUL LIFE
  1. ; EN(106) - previous REPL DATE (FileMan format)
  1. Q:ENFILE'=6915.4 ; must be FC Document
  1. N ENDA,ENDOC,ENDTC,ENFC,ENY
  1. ; get initial values (from FA or FB)
  1. S (EN(30),EN(34),EN(105),EN(29),EN(37),EN(106))=""
  1. S ENFC("BETR")=$P($G(^ENG(ENFILE,ENIEN,3)),U,8)
  1. I ENFC("BETR")="00" D
  1. . S ENDTC("I")=$P($G(^ENG(6915.2,ENFAIEN,0)),U,2) ; date/time of FA
  1. . S ENY(3)=$G(^ENG(6915.2,ENFAIEN,3))
  1. . S EN(30)=$P(ENY(3),U,15)
  1. . S EN(34)=$P(ENY(3),U,19)
  1. . I $P(ENY(3),U,16)]"" D
  1. . . S EN(105)=$P(ENY(3),U,16)-1700
  1. . . S EN(105)=EN(105)_$E("00",1,2-$L($P(ENY(3),U,17)))_$P(ENY(3),U,17)
  1. . . S EN(105)=EN(105)_$E("00",1,2-$L($P(ENY(3),U,18)))_$P(ENY(3),U,18)
  1. . S EN(29)=$P(ENY(3),U,8)
  1. . S EN(37)=$P(ENY(3),U,24)
  1. . I $P(ENY(3),U,21)]"" D
  1. . . S EN(106)=$P(ENY(3),U,21)-1700
  1. . . S EN(106)=EN(106)_$E("00",1,2-$L($P(ENY(3),U,22)))_$P(ENY(3),U,22)
  1. . . S EN(106)=EN(106)_$E("00",1,2-$L($P(ENY(3),U,23)))_$P(ENY(3),U,23)
  1. I ENFC("BETR")'="00" D
  1. . S ENFC("FB")=$P($G(^ENG(6915.4,ENIEN,100)),U,5) ; betterment pointer
  1. . S ENDTC("I")=$P($G(^ENG(6915.3,ENFC("FB"),0)),U,2) ; date/time of FB
  1. . S ENY(3)=$S(ENFC("FB"):$G(^ENG(6915.3,ENFC("FB"),3)),1:"")
  1. . S EN(30)=$P(ENY(3),U,8)
  1. . S EN(34)=$P(ENY(3),U,12)
  1. . I $P(ENY(3),U,9)]"" D
  1. . . S EN(105)=$P(ENY(3),U,9)-1700
  1. . . S EN(105)=EN(105)_$E("00",1,2-$L($P(ENY(3),U,10)))_$P(ENY(3),U,10)
  1. . . S EN(105)=EN(105)_$E("00",1,2-$L($P(ENY(3),U,11)))_$P(ENY(3),U,11)
  1. ; Construct chrono list of FC and FR in time frame for Equipment
  1. S ENY(0)=$G(^ENG(ENFILE,ENIEN,0))
  1. S ENDA("EQ")=$P(ENY(0),U) ; equip id
  1. S ENDTC("F?")=$P(ENY(0),U,2) ; date/time of input doc
  1. ; add FC documents to list
  1. S ENDA("FC")=0
  1. F S ENDA("FC")=$O(^ENG(6915.4,"B",ENDA("EQ"),ENDA("FC"))) Q:'ENDA("FC") D
  1. . S ENDTC("FC")=$P($G(^ENG(6915.4,ENDA("FC"),0)),U,2)
  1. . I ENDTC("FC")>ENDTC("I"),ENDTC("FC")<ENDTC("F?") D
  1. . . Q:ENFC("BETR")'=$P($G(^ENG(ENFILE,ENDA("FC"),3)),U,8) ; diff betr
  1. . . S ENDOC(ENDTC("FC"),"6915.4;"_ENDA("FC"))=""
  1. ; add FR documents to list
  1. S ENDA("FR")=0
  1. F S ENDA("FR")=$O(^ENG(6915.6,"B",ENDA("EQ"),ENDA("FR"))) Q:'ENDA("FR") D
  1. . S ENDTC("FR")=$P($G(^ENG(6915.6,ENDA("FR"),0)),U,2)
  1. . I ENDTC("FR")>ENDTC("I"),ENDTC("FR")<ENDTC("F?") D
  1. . . S ENDOC(ENDTC("FR"),"6915.6;"_ENDA("FR"))=""
  1. ; Loop thru chrono list and update initial values as appropriate
  1. S ENDTC="" F S ENDTC=$O(ENDOC(ENDTC)) Q:ENDTC="" D
  1. . S ENY="" F S ENY=$O(ENDOC(ENDTC,ENY)) Q:ENY="" D
  1. . . S ENFILE=$P(ENY,";"),ENDA=$P(ENY,";",2)
  1. . . I ENFILE=6915.4 D ; FC Document
  1. . . . S ENY(3)=$G(^ENG(6915.4,ENDA,3))
  1. . . . S ENY(4)=$G(^ENG(6915.4,ENDA,4))
  1. . . . S ENY(100)=$G(^ENG(6915.4,ENDA,100))
  1. . . . S:$P(ENY(3),U,11)]"" EN(30)=$P(ENY(3),U,11)
  1. . . . S:$P(ENY(3),U,15)]"" EN(34)=$P(ENY(3),U,15)
  1. . . . S:$P(ENY(100),U,6)]"" EN(105)=$P(ENY(100),U,6)
  1. . . . S:$P(ENY(3),U,10)]"" EN(29)=$P(ENY(3),U,10)
  1. . . . S:$P(ENY(4),U,3)]"" EN(37)=$P(ENY(4),U,3)
  1. . . . S:$P(ENY(100),U,7)]"" EN(106)=$P(ENY(100),U,Y)
  1. . . I ENFILE=6915.6 D ; FR Document
  1. . . . S ENY(3)=$G(^ENG(6915.6,ENDA,3))
  1. . . . S:$P(ENY(3),U,14)]"" EN(29)=$P(ENY(3),U,14)
  1. Q
  1. FRPVAL(ENFILE,ENIEN,ENFAIEN) ; Determine prior values at time of FR
  1. ; Input Variables
  1. ; ENFILE - FAP document file for the input document
  1. ; ENIEN - IEN of the input document in ENFILE
  1. ; ENFAIEN - IEN of the assoicated FA document
  1. ; Returns
  1. ; EN(28) - previous FUND
  1. ; EN(29) - previous A/O
  1. ; EN(32) - previous BOC
  1. ; EN(33) - previous LOCATION (NATIONAL EIL)
  1. ; EN(34) - previous COST CENTER
  1. ; EN(37) - previous XAREA (CMR)
  1. Q:ENFILE'=6915.6 ; must be FR Document
  1. N ENDA,ENDOC,ENDTC,ENFC,ENY
  1. ; get initial values (from FA)
  1. S (EN(28),EN(29),EN(32),EN(33),EN(34))=""
  1. S ENDTC("I")=$P($G(^ENG(6915.2,ENFAIEN,0)),U,2) ; date/time of FA
  1. S ENY(3)=$G(^ENG(6915.2,ENFAIEN,3))
  1. S EN(28)=$P(ENY(3),U,10)
  1. S EN(29)=$P(ENY(3),U,11)
  1. S EN(32)=$P(ENY(3),U,14)
  1. S EN(33)=$P(ENY(3),U,8)
  1. S EN(34)=$P(ENY(3),U,28)
  1. S EN(37)=$P(ENY(3),U,31)
  1. ; Construct chrono list of FC and FR in time frame for Equipment
  1. S ENY(0)=$G(^ENG(ENFILE,ENIEN,0))
  1. S ENDA("EQ")=$P(ENY(0),U) ; equip id
  1. S ENDTC("F?")=$P(ENY(0),U,2) ; date/time of input doc
  1. ; add FC documents to list
  1. S ENDA("FC")=0
  1. F S ENDA("FC")=$O(^ENG(6915.4,"B",ENDA("EQ"),ENDA("FC"))) Q:'ENDA("FC") D
  1. . S ENDTC("FC")=$P($G(^ENG(6915.4,ENDA("FC"),0)),U,2)
  1. . I ENDTC("FC")>ENDTC("I"),ENDTC("FC")<ENDTC("F?") D
  1. . . Q:$P($G(^ENG(ENFILE,ENDA("FC"),3)),U,8)'="00" ; not FC to FA
  1. . . S ENDOC(ENDTC("FC"),"6915.4;"_ENDA("FC"))=""
  1. ; add FR documents to list
  1. S ENDA("FR")=0
  1. F S ENDA("FR")=$O(^ENG(6915.6,"B",ENDA("EQ"),ENDA("FR"))) Q:'ENDA("FR") D
  1. . S ENDTC("FR")=$P($G(^ENG(6915.6,ENDA("FR"),0)),U,2)
  1. . I ENDTC("FR")>ENDTC("I"),ENDTC("FR")<ENDTC("F?") D
  1. . . S ENDOC(ENDTC("FR"),"6915.6;"_ENDA("FR"))=""
  1. ; Loop thru chrono list and update initial values as appropriate
  1. S ENDTC="" F S ENDTC=$O(ENDOC(ENDTC)) Q:ENDTC="" D
  1. . S ENY="" F S ENY=$O(ENDOC(ENDTC,ENY)) Q:ENY="" D
  1. . . S ENFILE=$P(ENY,";"),ENDA=$P(ENY,";",2)
  1. . . I ENFILE=6915.4 D ; FC Document
  1. . . . S ENY(3)=$G(^ENG(6915.4,ENDA,3))
  1. . . . S:$P(ENY(3),U,10)]"" EN(33)=$P(ENY(3),U,10) ; location
  1. . . I ENFILE=6915.6 D ; FR Document
  1. . . . S ENY(3)=$G(^ENG(6915.6,ENDA,3))
  1. . . . S:$P(ENY(3),U,9)]"" EN(28)=$P(ENY(3),U,9) ; fund
  1. . . . S:$P(ENY(3),U,10)]"" EN(29)=$P(ENY(3),U,10) ; a/o
  1. . . . S:$P(ENY(3),U,13)]"" EN(32)=$P(ENY(3),U,13) ; boc
  1. . . . S:$P(ENY(3),U,14)]"" EN(33)=$P(ENY(3),U,14) ; location
  1. . . . S:$P(ENY(3),U,15)]"" EN(34)=$P(ENY(3),U,15) ; cost ctr
  1. . . . S:$P(ENY(3),U,18)]"" EN(37)=$P(ENY(3),U,18) ; xarea
  1. Q
  1. ;ENFARC3