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

ENFACTL.m

Go to the documentation of this file.
  1. ENFACTL ;(WCIOFO)/SAB-FAP CAPITALIZATION THRESHOLD LIST ;10/14/1999
  1. ;;7.0;ENGINEERING;**63**;Aug 17, 1993
  1. EN ;
  1. ; ask device
  1. S %ZIS="QM" D ^%ZIS G:POP EXIT
  1. I $D(IO("Q")) D G EXIT
  1. . S ZTRTN="QEN^ENFACTL"
  1. . S ZTDESC="ENG List Equip to be Expensed"
  1. . D ^%ZTLOAD,HOME^%ZIS K ZTSK
  1. ;
  1. QEN ; queued entry
  1. U IO
  1. ;
  1. COLLECT ; collect data
  1. S END=0 ; init flag, =true if user stopped job
  1. K ENT ; totals ENT(station,fund,sgl)
  1. ; =capitalized count^$^to be expensed count^$
  1. K ^TMP($J)
  1. ;
  1. ; loop thru equipment in FA DOCUMENT LOG file
  1. S ENDA=0 F S ENDA=$O(^ENG(6915.2,"B",ENDA)) Q:'ENDA D
  1. . Q:+$$CHKFA^ENFAUTL(ENDA)'>0 ; not currently reported to FAP
  1. . ; get equipment data
  1. . S ENSN=$$GET1^DIQ(6914,ENDA_",",60)_" " S:ENSN=" " ENSN="UNK"
  1. . S ENFUND=$$GET1^DIQ(6914,ENDA_",",62)_" " S:ENFUND=" " ENFUND="UNK"
  1. . S ENSGL=$$GET1^DIQ(6914,ENDA_",",38) S:ENSGL="" ENSGL="UNK"
  1. . S ENVAL=$$GET1^DIQ(6914,ENDA_",",12)
  1. . ; update capitalized count and amount
  1. . S $P(ENT(ENSN,ENFUND,ENSGL),U)=$P($G(ENT(ENSN,ENFUND,ENSGL)),U)+1
  1. . S $P(ENT(ENSN,ENFUND,ENSGL),U,2)=$P(ENT(ENSN,ENFUND,ENSGL),U,2)+ENVAL
  1. . ; quit if item should not be expensed
  1. . Q:$P($$CHKEXP^ENFACTU(ENDA),U)'=1
  1. . ; put on sorted list of items that will be expensed and update counts
  1. . S ENSYS=+$$TOPSYS^ENFACTU(ENDA) ; plus value to treat ? as standalone
  1. . S ENSYSV=+$S(ENSYS>0:$$SYSVAL^ENFACTU(ENSYS,"C"),1:ENVAL)
  1. . S ^TMP($J,ENSN,ENSYSV,ENSYS,ENDA)=""
  1. . S $P(ENT(ENSN,ENFUND,ENSGL),U,3)=$P(ENT(ENSN,ENFUND,ENSGL),U,3)+1
  1. . S $P(ENT(ENSN,ENFUND,ENSGL),U,4)=$P(ENT(ENSN,ENFUND,ENSGL),U,4)+ENVAL
  1. ;
  1. PRINT ; print results
  1. S ENPG=0 D NOW^%DTC S Y=% D DD^%DT S ENDT=Y
  1. S ENL="",$P(ENL,"-",IOM)=""
  1. I '$D(ENT) S ENSN="" D HD W !!,"Nothing to report."
  1. ; loop thru ENT( by station
  1. S ENSN="" F S ENSN=$O(ENT(ENSN)) Q:ENSN="" D Q:END
  1. . D HD Q:END
  1. . I '$D(^TMP($J,ENSN)) W !!,"NO EQUIPMENT WILL BE EXPENSED BY CT TASK FOR THIS STATION."
  1. . ; loop thru system values in ^TMP(
  1. . S ENSYSV="" F S ENSYSV=$O(^TMP($J,ENSN,ENSYSV)) Q:ENSYSV="" D Q:END
  1. . . ; loop thru system # (will be 0 for standalone items)
  1. . . S ENSYS=""
  1. . . F S ENSYS=$O(^TMP($J,ENSN,ENSYSV,ENSYS)) Q:ENSYS="" D Q:END
  1. . . . ; if system then print parent data and system info
  1. . . . I ENSYS>0 D
  1. . . . . W !!,?2,"TOP PARENT SYSTEM ENTRY #: ",ENSYS
  1. . . . . W ?40,"CMR: ",$E($$GET1^DIQ(6914,ENSYS,19),1,5)
  1. . . . . W ?51,"Parent Value: "
  1. . . . . I +$$CHKFA^ENFAUTL(ENSYS) W $FN($$GET1^DIQ(6914,ENSYS,12),",",2)
  1. . . . . E W "not in FAP"
  1. . . . . S ENCSN=$$GET1^DIQ(6914,ENSYS,18)
  1. . . . . W !,?2,"CATEGORY STOCK NUMBER: ",ENCSN
  1. . . . . I ENCSN]"" W " (",$$GET1^DIQ(6914,ENSYS,"18:2"),")"
  1. . . . . W !,?2,"Sum of Capitalized Values in System: "
  1. . . . . W $FN(ENSYSV,",",2)
  1. . . . ; loop thru equipment
  1. . . . S ENDA=0
  1. . . . F S ENDA=$O(^TMP($J,ENSN,ENSYSV,ENSYS,ENDA)) Q:'ENDA D Q:END
  1. . . . . Q:ENDA=ENSYS ; already displayed as parent of system
  1. . . . . I $Y+4>IOSL D HD Q:END W " (continued)"
  1. . . . . S ENCSN=$$GET1^DIQ(6914,ENDA,18)
  1. . . . . ; print format for component of system
  1. . . . . I ENSYS>0 D
  1. . . . . . W !!,?6,"COMPONENT ENTRY #: ",ENDA
  1. . . . . . W ?36,"CMR: ",$E($$GET1^DIQ(6914,ENDA,19),1,5)
  1. . . . . . W ?47,"Component Value: ",$FN($$GET1^DIQ(6914,ENDA,12),",",2)
  1. . . . . . W !,?6,"CATEGORY STOCK NUMBER: ",ENCSN
  1. . . . . . I ENCSN]"" W " (",$$GET1^DIQ(6914,ENDA,"18:2"),")"
  1. . . . . ; print format for standalone equipment
  1. . . . . I ENSYS=0 D
  1. . . . . . W !!,?2,"ENTRY #: ",ENDA
  1. . . . . . W ?22,"CMR: ",$E($$GET1^DIQ(6914,ENDA,19),1,5)
  1. . . . . . W ?33,"Value: ",$FN($$GET1^DIQ(6914,ENDA,12),",",2)
  1. . . . . . W !,?2,"CATEGORY STOCK NUMBER: ",ENCSN
  1. . . . . . I ENCSN]"" W " (",$$GET1^DIQ(6914,ENDA,"18:2"),")"
  1. . Q:END
  1. . ; print station totals
  1. . I $Y+14>IOSL D HD Q:END W " (continued)"
  1. . D HDST
  1. . S ENFUND="" F S ENFUND=$O(ENT(ENSN,ENFUND)) Q:ENFUND="" D Q:END
  1. . . S ENSGL=""
  1. . . F S ENSGL=$O(ENT(ENSN,ENFUND,ENSGL)) Q:ENSGL="" D Q:END
  1. . . . I $Y+6>IOSL D HD Q:END W " (continued)" D HDST
  1. . . . W !,ENFUND,?7,ENSGL
  1. . . . S ENX=$G(ENT(ENSN,ENFUND,ENSGL))
  1. . . . W ?12,$J($FN($P(ENX,U,1),","),5)
  1. . . . W ?18,$J($FN($P(ENX,U,2),",",2),14)
  1. . . . W ?35,$J($FN($P(ENX,U,3),","),5)
  1. . . . W ?41,$J($FN($P(ENX,U,4),",",2),14)
  1. . . . W ?58,$J($FN($P(ENX,U,1)-$P(ENX,U,3),","),5)
  1. . . . W ?64,$J($FN($P(ENX,U,2)-$P(ENX,U,4),",",2),14)
  1. . . . ; add sgl to subtotals for station
  1. . . . S $P(ENT(ENSN),U,1)=$P($G(ENT(ENSN)),U,1)+$P(ENX,U,1)
  1. . . . S $P(ENT(ENSN),U,2)=$P(ENT(ENSN),U,2)+$P(ENX,U,2)
  1. . . . S $P(ENT(ENSN),U,3)=$P(ENT(ENSN),U,3)+$P(ENX,U,3)
  1. . . . S $P(ENT(ENSN),U,4)=$P(ENT(ENSN),U,4)+$P(ENX,U,4)
  1. . W !," ----- -------------- ----- -------------- ----- --------------"
  1. . W !,"Station Tot"
  1. . W ?12,$J($FN($P(ENT(ENSN),U,1),","),5)
  1. . W ?18,$J($FN($P(ENT(ENSN),U,2),",",2),14)
  1. . W ?35,$J($FN($P(ENT(ENSN),U,3),","),5)
  1. . W ?41,$J($FN($P(ENT(ENSN),U,4),",",2),14)
  1. . W ?58,$J($FN($P(ENT(ENSN),U,1)-$P(ENT(ENSN),U,3),","),5)
  1. . W ?64,$J($FN($P(ENT(ENSN),U,2)-$P(ENT(ENSN),U,4),",",2),14)
  1. I END W !!,"REPORT STOPPED BY USER REQUEST"
  1. I 'END,$E(IOST,1,2)="C-" S DIR(0)="E" D ^DIR K DIR
  1. D ^%ZISC
  1. EXIT I $D(ZTQUEUED) S ZTREQ="@"
  1. K ^TMP($J)
  1. K DIR,DIROUT,DIRUT,DTOUT,DUOUT,X,Y,END,ENDT,ENL,ENPG
  1. K ENCSN,ENDA,ENFUND,ENSGL,ENSN,ENSYS,ENSYSV,ENT,ENVAL,ENX
  1. Q
  1. ;
  1. HD ; header
  1. I $D(ZTQUEUED),$$S^%ZTLOAD S ZTSTOP=1,END=1 Q
  1. I $E(IOST,1,2)="C-",ENPG S DIR(0)="E" D ^DIR K DIR I 'Y S END=1 Q
  1. I $E(IOST,1,2)="C-"!ENPG W @IOF
  1. S ENPG=ENPG+1
  1. W !,"EQUIPMENT CT TASK WILL EXPENSE sorted by value"
  1. W ?49,ENDT,?72,"page ",ENPG
  1. W !,ENL
  1. I ENSN]"" W !,"STATION ",ENSN
  1. Q
  1. ;
  1. HDST ; header for station totals
  1. W !!," Current Capitalized CT Task Will Expense Remain Capitalized"
  1. W !,"Fund SGL Count $ Amount Count $ Amount Count $ Amount"
  1. W !,"------ ---- ----- -------------- ----- -------------- ----- --------------"
  1. Q
  1. ;ENFACTL