source: WorldVistAEHR/trunk/r/ENGINEERING-EN/ENY2REP.m@ 738

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

initial load of WorldVistAEHR

File size: 7.6 KB
RevLine 
[613]1ENY2REP ;;(WIRMFO)/DH-Y2K Activity Report ;8.27.98
2 ;;7.0;ENGINEERING;**51,55**;August 17, 1993
3ACT ; periodic activity report
4 ; counts and totals of all entries and changes within a user specified
5 ; date range
6 N %DT
7 I $P($G(^DIC(6910,1,0)),U,2)']"" W !!,"There is no STATION NUMBER in your Engineering Init Parameters file.",!,"Can't proceed.",*7 Q
8ACT1 S %DT="AEP",%DT("A")="Enter starting date: ",%DT(0)=-DT
9 S Y=$E(DT,1,5)-1 S:$E(Y,4,5)="00" Y=($E(Y,1,3)-1)_12 S Y=Y_"01"
10 X ^DD("DD") S %DT("B")=Y
11 D ^%DT Q:Y'>0
12 S Y=$P(Y,"."),ENDATE("STARTI")=Y X ^DD("DD") S ENDATE("STARTE")=Y
13ACT2 S Y=$$EOM^ENUTL(ENDATE("STARTI")) X ^DD("DD") S %DT("B")=Y
14 S %DT("A")="Enter stopping date: " K %DT(0)
15 D ^%DT Q:Y'>0 S Y=$P(Y,"."),ENDATE("STOPI")=Y_".9" X ^DD("DD") S ENDATE("STOPE")=Y
16 I ENDATE("STOPI")'>ENDATE("STARTI") W !!,"STOPPING DATE must follow the STARTING DATE",*7 G ACT2
17 S X=$P($O(^ENG(6918,"C",ENDATE("STARTI"))),".") I X=""!(X>ENDATE("STOPI")) W !!,"There was no Y2K activity between "_ENDATE("STARTE")_" and "_ENDATE("STOPE")_".",!,*7 G ACT1
18 I $P(ENDATE("STOPI"),".",2)="" S ENDATE("STOPI")=ENDATE("STOPI")_".99"
19 S ENSTN=0
20 I $P(^DIC(6910,1,0),U,10)!($D(^DIC(6910,1,3))) D G:ENSTN="^" EXIT
21 . S DIR(0)="Y",DIR("A")="Do you want a breakout by station",DIR("B")="NO"
22 . S DIR("?",1)="If you say 'NO' you will obtain a single report for all your equipment,"
23 . S DIR("?")="regardless of which station it belongs to."
24 . D ^DIR K DIR I $D(DIRUT) S ENSTN="^" Q
25 . S ENSTN=Y
26 K IO("Q") S %ZIS="QM" D ^%ZIS G:POP EXIT
27 I $D(IO("Q")) S ZTRTN="DEQACT^ENY2REP" D G EXIT
28 . S ZTSAVE("EN*")=""
29 . S ZTDESC="Y2K Activity Report (equipment)",ZTIO=ION
30 . D ^%ZTLOAD,HOME^%ZIS K ZTSK
31 ;
32DEQACT K ^TMP($J)
33 N DA,DATE,CAT,EN,TOTAL,STATION,ESCAPE,COST,COUNT,X
34 D CNTACT,PRNTACT
35 G EXIT
36 ;
37CNTACT ; store target population in ^TMP($J,"ENY2A",
38 S DATE=ENDATE("STARTI")-.1 F S DATE=$O(^ENG(6918,"C",DATE)) Q:DATE=""!(DATE>ENDATE("STOPI")) S DA(1)=0 F S DA(1)=$O(^ENG(6918,"C",DATE,DA(1))) Q:'DA(1) D:$D(^ENG(6918,DA(1),0))
39 . I '$D(ZTQUEUED),'(DA(1)#100) W "." ; activity indicator
40 . S DA=$O(^ENG(6918,"C",DATE,DA(1),0)) Q:'$D(^ENG(6918,DA(1),1,DA,0))
41 . S ^TMP($J,"ENY2A",DA(1),DATE)=$P(^ENG(6918,DA(1),1,DA,0),U,2)
42 Q:'$D(^TMP($J))
43 S STATION("PARNT")=$P(^DIC(6910,1,0),U,2)
44 ; initialization
45 F J=0,"FC","CC","NC","NA" F K=0,"FC","CC","NC","NA" F L="COUNT","EST","ACT","REST","RACT" S ^TMP($J,"ENY2B",STATION("PARNT"),J,K,L)=0
46 ; end initialization
47 S DA=0,STATION=STATION("PARNT") F S DA=$O(^TMP($J,"ENY2A",DA)) Q:'DA D READ,WRITE K ^TMP($J,"ENY2A",DA) I '$D(ZTQUEUED),'(DA#100) W "."
48 Q
49 ;
50READ ; extract Y2K activity from skeleton global by date
51 S DATE("END")=$O(^TMP($J,"ENY2A",DA,9999999),-1),CAT("CHG")=$P(^TMP($J,"ENY2A",DA,DATE("END")),U) S:CAT("CHG")="" CAT("CHG")=0
52 I $O(^TMP($J,"ENY2A",DA,DATE("END")),-1)="" D Q
53 . I $O(^ENG(6918,DA,1,"B",ENDATE("STARTI")),-1)="" S CAT("ENT")=CAT("CHG"),CAT("CHG")=0
54 . E S CAT("ENT")=0
55 S DATE("BEGIN")=$O(^TMP($J,"ENY2A",DA,ENDATE("STARTI"))),CAT("ENT")=$P(^TMP($J,"ENY2A",DA,DATE("BEGIN")),U)
56 I $O(^ENG(6918,DA,1,"B",DATE("BEGIN")),-1)]"" S CAT("ENT")=0
57 Q
58 ;
59WRITE ; build global from which report will be drawn (^TMP($J,"ENY2B",)
60 I ENSTN S STATION=$S($P($G(^ENG(6914,DA,9)),U,5)]"":$P(^(9),U,5),1:STATION("PARNT")) D:'$D(^TMP($J,"ENY2B",STATION))
61 . F J=0,"FC","NC","CC","NA" F K=0,"FC","NC","CC","NA" F L="COUNT","EST","ACT","REST","RACT" S ^TMP($J,"ENY2B",STATION,J,K,L)=0
62 S ^TMP($J,"ENY2B",STATION,CAT("ENT"),CAT("CHG"),"COUNT")=^TMP($J,"ENY2B",STATION,CAT("ENT"),CAT("CHG"),"COUNT")+1,EN=$G(^ENG(6914,DA,11))
63 I CAT("ENT")=0 D Q
64 . I CAT("CHG")="FC" D CCST Q
65 . I CAT("CHG")="NC" D NCST Q
66 . I CAT("CHG")="CC" D CCST Q
67 I CAT("ENT")="FC" D Q
68 . I CAT("CHG")="FC" D CCST Q
69 . I CAT("CHG")="NC" D NCST Q
70 . I CAT("CHG")="CC" D CCST Q
71 I CAT("ENT")="NC" D Q
72 . I CAT("CHG")="NC" D NCST Q
73 . I CAT("CHG")=0 D NCST Q
74 . I CAT("CHG")="FC" D CCST Q
75 . I CAT("CHG")="CC" D CCST Q
76 I CAT("ENT")="CC" D Q
77 . I CAT("CHG")="CC" D CCST Q
78 . I CAT("CHG")=0 D CCST Q
79 . I CAT("CHG")="FC" D CCST Q
80 . I CAT("CHG")="NC" D NCST Q
81 Q
82 ;
83CCST ; store Y2K compliance costs
84 ; loc var en contains node 11
85 S ^TMP($J,"ENY2B",STATION,CAT("ENT"),CAT("CHG"),"EST")=^TMP($J,"ENY2B",STATION,CAT("ENT"),CAT("CHG"),"EST")+$P($P(EN,U,3),".")
86 S:CAT("CHG")="FC" ^TMP($J,"ENY2B",STATION,CAT("ENT"),CAT("CHG"),"ACT")=^TMP($J,"ENY2B",STATION,CAT("ENT"),CAT("CHG"),"ACT")+$P($P(EN,U,4),".")
87 Q
88 ;
89NCST ; store replacement costs
90 ; loc var en contains node 11
91 I '$D(COUNT(STATION,CAT("ENT"),CAT("CHG"),"EST")) S COUNT(STATION,CAT("ENT"),CAT("CHG"),"EST")=0
92 I '$D(COUNT(STATION,CAT("ENT"),CAT("CHG"),"ACT")) S COUNT(STATION,CAT("ENT"),CAT("CHG"),"ACT")=0
93 I $P(EN,U,6)="REP" D
94 . S COST("REST")=$P($P($G(^ENG(6914,DA,2)),U,3),".") S:COST("REST")="" COST("REST")=0 S:COST("REST") COUNT(STATION,CAT("ENT"),CAT("CHG"),"EST")=COUNT(STATION,CAT("ENT"),CAT("CHG"),"EST")+1
95 . S COST("RACT")=0,X=$O(^ENG(6914,"AO",DA,0)) I X,$P($G(^ENG(6914,X,2)),U,4)'>ENDATE("STOPI") D
96 .. S COST("RACT")=$P($P($G(^ENG(6914,X,2)),U,3),".") S:COST("RACT")="" COST("RACT")=0 S:COST("RACT") COUNT(STATION,CAT("ENT"),CAT("CHG"),"ACT")=COUNT(STATION,CAT("ENT"),CAT("CHG"),"ACT")+1
97 . F J="REST","RACT" S ^TMP($J,"ENY2B",STATION,CAT("ENT"),CAT("CHG"),J)=^TMP($J,"ENY2B",STATION,CAT("ENT"),CAT("CHG"),J)+COST(J)
98 Q
99 ;
100PRNTACT ; print the hard copy
101 U IO
102 N PAGE,LINE
103 D NOW^%DTC S Y=% X ^DD("DD") S DATE("PRNT")=$P(Y,":",1,2),PAGE=0
104 W:$E(IOST,1,2)="C-" @IOF
105 S STATION=0 F S STATION=$O(^TMP($J,"ENY2B",STATION)) Q:STATION=""!($G(ESCAPE)) D HEADR D Q:$G(ESCAPE) D HOLD Q:$G(ESCAPE)
106 . F J="COUNT","EST","ACT","REST","RACT","ECNT","ACNT" S TOTAL(J)=0
107 . S TOTAL=0 F J=0,"FC","NC","CC","NA" F K=0,"FC","NC","CC","NA" Q:$G(ESCAPE) I '(J=0&(K=0)),^TMP($J,"ENY2B",STATION,J,K,"COUNT")>0 D Q:$G(ESCAPE)
108 .. W ! W:J'=0 ?3,J W:K'=0 ?11,K W ?17,$J(^TMP($J,"ENY2B",STATION,J,K,"COUNT"),5),?24,"$" W:^("EST")>0 $J(^("EST"),8) W ?35,"$" W:^("ACT")>0 $J(^("ACT"),8)
109 .. W ?46,"$" W:^TMP($J,"ENY2B",STATION,J,K,"REST")>0 $J(^("REST"),8)_"("_COUNT(STATION,J,K,"EST")_")" W ?62,"$" W:^("RACT")>0 $J(^("RACT"),8)_"("_COUNT(STATION,J,K,"ACT")_")"
110 .. S TOTAL("COUNT")=TOTAL("COUNT")+^TMP($J,"ENY2B",STATION,J,K,"COUNT"),TOTAL("EST")=TOTAL("EST")+^("EST"),TOTAL("ACT")=TOTAL("ACT")+^("ACT"),TOTAL=TOTAL+1
111 .. S TOTAL("REST")=TOTAL("REST")+^TMP($J,"ENY2B",STATION,J,K,"REST"),TOTAL("RACT")=TOTAL("RACT")+^("RACT")
112 .. S LINE=LINE+1 I (IOSL-LINE)'>2 D HOLD D:'$G(ESCAPE) HEADR
113 . Q:$G(ESCAPE)
114 . I 'TOTAL W !!,?10,"<No activity to report>" Q
115 . W !,X
116 . I $D(COUNT(STATION,"NC",0)) S TOTAL("ECNT")=TOTAL("ECNT")+$G(COUNT(STATION,"NC",0,"EST")),TOTAL("ACNT")=TOTAL("ACNT")+$G(COUNT(STATION,"NC",0,"ACT"))
117 . I $D(COUNT(STATION)) F J=0,"FC","NC","CC","NA" I $D(COUNT(STATION,J,"NC")) S TOTAL("ECNT")=TOTAL("ECNT")+$G(COUNT(STATION,J,"NC","EST")),TOTAL("ACNT")=TOTAL("ACNT")+$G(COUNT(STATION,J,"NC","ACT"))
118 . W !," TOTALS",?17,$J(TOTAL("COUNT"),5),?24,"$"_$J(TOTAL("EST"),8),?35,"$"_$J(TOTAL("ACT"),8),?46,"$"_$J(TOTAL("REST"),8) W:$G(TOTAL("ECNT")) "("_TOTAL("ECNT")_")" W ?62,"$"_$J(TOTAL("RACT"),8) W:$G(TOTAL("ACNT")) "("_TOTAL("ACNT")_")"
119 Q
120 ;
121HEADR ; page header
122 W:PAGE>0 @IOF S PAGE=PAGE+1,LINE=5
123 W "Y2K Net Activity Report from "_ENDATE("STARTE")_" to "_ENDATE("STOPE"),?70,"Page: "_PAGE
124 W !," "_$S('ENSTN:"Consolidated ("_STATION("PARNT")_")",1:"Station: "_STATION),?50,"Printed: "_DATE("PRNT")
125 W !," Entry Change Count Est Y2K Act Y2K Est Repl(Cnt) Act Repl(Cnt)"
126 K X S $P(X,"-",79)="-" W !,X,!
127 Q
128 ;
129HOLD Q:$E(IOST,1,2)'="C-"
130 W !!,"Press <RETURN> to continue, '^' to escape..." R X:DTIME
131 I '$T!($E(X)="^") S ESCAPE=1
132 Q
133EXIT ;
134 K ^TMP($J)
135 D ^%ZISC,HOME^%ZIS
136 I $D(ZTQUEUED) S ZTREQN="@"
137 K J,K,X,ENSTN,ENDATE
138 Q
139 ;ENY2REP
Note: See TracBrowser for help on using the repository browser.