source: WorldVistAEHR/trunk/r/ENGINEERING-EN/ENFAR4.m@ 1361

Last change on this file since 1361 was 613, checked in by George Lilly, 15 years ago

initial load of WorldVistAEHR

File size: 4.4 KB
RevLine 
[613]1ENFAR4 ;WIRMFO/SAB-FIXED ASSET RPT, CAPITALIZED EQUIP FOR STATION; 3/11/96
2 ;;7.0;ENGINEERING;**25**;Aug 17, 1993
3 ; Capitalized Equipment List for STATION by CSN and CMR
4 ;
5EN ;
6 ; ask STATION
7 S DIR(0)="F^3:5",DIR("A")="STATION NUMBER"
8 S DIR("B")=$$GET1^DIQ(6910,"1,",1)
9 D ^DIR K DIR G:$D(DIRUT) EXIT
10 S ENSNR=Y
11 ; ask device
12 S %ZIS="QM" D ^%ZIS G:POP EXIT
13 I $D(IO("Q")) D G EXIT
14 . S ZTRTN="QEN^ENFAR4",ZTDESC="Capitalized Equip for Station"
15 . S ZTSAVE("ENSNR")=""
16 . D ^%ZTLOAD,HOME^%ZIS K ZTSK
17QEN ; queued entry
18 U IO
19 ; collect and sort equipment
20 K ^TMP($J)
21 S ENSND=$$GET1^DIQ(6910,"1,",1) ; default station number
22 S ENDA=0 F S ENDA=$O(^ENG(6914,ENDA)) Q:'ENDA D
23 . Q:$P($G(^ENG(6914,ENDA,8)),U,2)'=1 ; not capitalized
24 . S ENSN=$P($G(^ENG(6914,ENDA,9)),U,5) S:ENSN="" ENSN=ENSND
25 . Q:ENSN'=ENSNR ; not station
26 . S ENY2=$G(^ENG(6914,ENDA,2))
27 . S X=$P(ENY2,U,9),ENCMR=$S(X:$E($P($G(^ENG(6914.1,X,0)),U),1,5),1:"")
28 . Q:ENCMR="" ; not on a CMR
29 . S ENCSNI=$P(ENY2,U,8)
30 . S ENCSN=$S(ENCSNI:$P($G(^ENCSN(6917,ENCSNI,0)),U),1:"")
31 . I ENCSN="" S (ENCSN,ENCSNI)="<null value>"
32 . S ^TMP($J,ENCSN,ENCMR,ENDA)=""
33 . I $D(^TMP($J,ENCSN))#10=0 S ^TMP($J,ENCSN)=ENCSNI
34 ; generate output
35 K ENT
36 S (END,ENPG)=0 D NOW^%DTC S Y=% D DD^%DT S ENDT=Y
37 S ENL="",$P(ENL,"-",IOM)=""
38 S ENCSN="" D HD
39 I 'END F S ENCSN=$O(^TMP($J,ENCSN)) Q:ENCSN="" D Q:END
40 . ; category stock number
41 . S ENC="0^0" ; initialize CSN count and value
42 . S ENCSNI=$P($G(^TMP($J,ENCSN)),U)
43 . I $Y+4>IOSL D HD Q:END
44 . W !! W:ENCSNI $P($G(^ENCSN(6917,ENCSNI,0)),U,3) W " (CSN: ",ENCSN,")"
45 . S ENCMR="" F S ENCMR=$O(^TMP($J,ENCSN,ENCMR)) Q:ENCMR="" D Q:END
46 . . ; cmr
47 . . S ENDA=0 F S ENDA=$O(^TMP($J,ENCSN,ENCMR,ENDA)) Q:'ENDA D Q:END
48 . . . ; equipment item
49 . . . I $Y+8>IOSL D HD Q:END D HDCSN
50 . . . S ENY2=$G(^ENG(6914,ENDA,2))
51 . . . S X=$P($G(^ENG(6914,ENDA,8)),U,6)
52 . . . S ENSGL=$S(X:$P($G(^ENG(6914.3,X,0)),U),1:"")
53 . . . W !!,?2,ENDA ; equipment id
54 . . . W ?13,$P(ENY2,U,7) ; NXRN
55 . . . W ?22,$E($P(ENY2,U,4),4,5),?24,"/",$E($P(ENY2,U,4),2,3) ; acq date
56 . . . W ?28,ENSGL ; sgl
57 . . . W ?33,$J("$"_$FN($P(ENY2,U,3),",",2),14) ; asset value
58 . . . W ?48,$P(ENY2,U,6) ; le
59 . . . W ?51,$E($P(ENY2,U,10),4,5),?53,"/",$E($P(ENY2,U,10),2,3) ; repl
60 . . . W ?57,$E($P($G(^ENG(6914,ENDA,1)),U,3),1,16) ; serial #
61 . . . W ?74,ENCMR ; cmr
62 . . . S ENPM=$P($G(^ENG(6914,ENDA,3)),U,6)
63 . . . W:ENPM]"" !,?4,"PM: ",ENPM
64 . . . S ENMAN=$E($$GET1^DIQ(6914,ENDA_",",1),1,30)
65 . . . W:ENMAN]"" !,?4,"Manf: ",ENMAN
66 . . . S ENMOD=$P($G(^ENG(6914,ENDA,1)),U,2)
67 . . . W:ENMOD]"" !,?4,"Model: ",ENMOD
68 . . . S:ENSGL="" ENSGL="<null>"
69 . . . S $P(ENT(ENSGL),U)=$P($G(ENT(ENSGL)),U)+1
70 . . . S $P(ENT(ENSGL),U,2)=$P($G(ENT(ENSGL)),U,2)+$P(ENY2,U,3)
71 . . . S $P(ENC,U)=$P($G(ENC),U)+1
72 . . . S $P(ENC,U,2)=$P($G(ENC),U,2)+$P(ENY2,U,3)
73 . Q:END
74 . W !,?16,"(CSN TOTAL",?27,$J("#"_$P(ENC,U),3)
75 . W ?33,$J("$"_$FN($P(ENC,U,2),",",2),14),")"
76 I 'END D
77 . ; report footer
78 . S ENSGL="",ENC=0 F S ENSGL=$O(ENT(ENSGL)) Q:ENSGL="" S ENC=ENC+1
79 . I $Y+ENC+6>IOSL D HD Q:END
80 . W !,ENL,!,"TOTALS",?19,"COUNT",?27,"ASSET VALUE"
81 . S ENT="0^0"
82 . S ENSGL="" F S ENSGL=$O(ENT(ENSGL)) Q:ENSGL="" D
83 . . W !,?8,"SGL ",ENSGL
84 . . W ?19,$J($P(ENT(ENSGL),U),5)
85 . . W ?27,"$",$J($FN($P(ENT(ENSGL),U,2),",",2),15)
86 . . S $P(ENT,U)=$P(ENT,U)+$P(ENT(ENSGL),U)
87 . . S $P(ENT,U,2)=$P(ENT,U,2)+$P(ENT(ENSGL),U,2)
88 . W !,?19,"-----",?27,"----------------"
89 . W !,?5,"REPORT TOTAL"
90 . W ?19,$J($P(ENT,U),5)
91 . W ?27,"$",$J($FN($P(ENT,U,2),",",2),15)
92 . I $E(IOST,1,2)="C-" S DIR(0)="E" D ^DIR K DIR
93 D ^%ZISC
94EXIT I $D(ZTQUEUED) S ZTREQ="@"
95 K ^TMP($J)
96 K DIR,DIROUT,DIRUT,DIWF,DIWL,DTOUT,DUOUT,X,Y
97 K ENC,ENCMR,ENCMRI,ENCSN,ENCSNI,ENDA,ENMAN,ENMOD,ENPM,ENSGL
98 K ENSN,ENSND,ENSNR,ENT,ENY2
99 K END,ENDT,ENL,ENPG
100 Q
101HD ; header
102 I $D(ZTQUEUED),$$S^%ZTLOAD S ZTSTOP=1,END=1 Q
103 I $E(IOST,1,2)="C-",ENPG S DIR(0)="E" D ^DIR K DIR I 'Y S END=1 Q
104 I $E(IOST,1,2)="C-"!ENPG W @IOF
105 S ENPG=ENPG+1
106 W !,"CAPITALIZED EQUIPMENT BY CSN FOR STATION: ",ENSNR
107 W ?48,ENDT,?72,"page ",ENPG
108 W !!,?2,"EQUIP ID #",?13,"NXRN",?22,"ACQ",?28,"SGL",?33,"ASSET VALUE"
109 W ?48,"LE",?51,"REPL",?57,"SERIAL NUMBER",?74,"CMR"
110 W !,?2,$E(ENL,1,10),?13,$E(ENL,1,8),?22,$E(ENL,1,5),?28,$E(ENL,1,4)
111 W ?33,$E(ENL,1,14),?48,$E(ENL,1,2),?51,$E(ENL,1,5),?57,$E(ENL,1,16)
112 W ?74,$E(ENL,1,5)
113 Q
114HDCSN ; header for continued CSN
115 I $G(ENCSN)]"" D
116 . W ! W:$G(ENCSNI) $P($G(^ENCSN(6917,ENCSNI,0)),U,3)
117 . W " (CSN: ",ENCSN," continued)"
118 Q
119 ;ENFAR4
Note: See TracBrowser for help on using the repository browser.