source: WorldVistAEHR/trunk/r/ENGINEERING-EN/ENY2REP8.m@ 861

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

initial load of WorldVistAEHR

File size: 7.6 KB
Line 
1ENY2REP8 ;;(WIRMFO)/DH-Print Y2K Summary Reports ;9.30.98
2 ;;7.0;ENGINEERING;**51,55**;August 17, 1993
3 ;
4 ; extension of ^ENY2REP1
5 ;
6DEQUE ; print a summary report
7 K ^TMP($J)
8 N CAT,MFG,CSN,DA,COUNT,Y2K,PAGE,LINE,DATE,ESCAPE,TOTAL,STATION
9 S PAGE=0 D NOW^%DTC S Y=% X ^DD("DD") S DATE("PRNT")=$P(Y,":",1,2)
10 S STATION("PARNT")=$P(^DIC(6910,1,0),U,2)
11 ; general initialization
12 S TOTAL(STATION("PARNT"))=0 F J=0,"FC","NC","CC","NA" S TOTAL(STATION("PARNT"),J)=0
13 ; end general initialization
14CSN I ENTYPE="CSN" D CSN^ENY2REP7 K ENTYPE,ENSUP,ENSORT,ENSTN G EXIT
15 ;
16CAT I ENTYPE="CAT" D K ENTYPE,ENSUP,ENSORT,ENSTN G EXIT
17 . ; cat initialization
18 . S CAT(0)=0 F S CAT(0)=$O(^ENG(6914,"G",CAT(0))) Q:'CAT(0) S ^TMP($J,STATION("PARNT"),"COUNT",CAT(0))=0 F J=0,"NA","FC","NC","CC" S ^TMP($J,STATION("PARNT"),CAT(0),J)=0
19 . ; end cat initialization
20 . ; begin data gather
21 . S CAT(0)=0,STATION=STATION("PARNT") F S CAT(0)=$O(^ENG(6914,"G",CAT(0))) Q:'CAT(0) K:'$D(^ENG(6911,CAT(0),0)) ^ENG(6914,"G",CAT(0)) I $D(^ENG(6911,CAT(0),0)) S (DA,COUNT)=0 F S DA=$O(^ENG(6914,"G",CAT(0),DA)) Q:'DA D
22 .. Q:'$D(^ENG(6914,DA,0))
23 .. I "^4^5^"[(U_$P($G(^ENG(6914,DA,3)),U)_U) Q
24 .. I '$D(ZTQUEUED),'(DA#100) W "." ; activity indicator
25 .. S Y2K=$P($G(^ENG(6914,DA,11)),U) S:Y2K="" Y2K=0
26 .. I ENSUP,"^NA^FC^"[(U_Y2K_U) Q
27 .. ; initialize station if need be
28 .. I ENSTN S STATION=$S($P($G(^ENG(6914,DA,9)),U,5)]"":$P(^(9),U,5),1:STATION("PARNT")) D:'$D(^TMP($J,STATION))
29 ... S TOTAL(STATION)=0 F J=0,"FC","NC","CC","NA" S TOTAL(STATION,J)=0
30 ... S CAT(1)=0 F S CAT(1)=$O(^ENG(6914,"G",CAT(1))) Q:'CAT(1) S ^TMP($J,STATION,"COUNT",CAT(1))=0 F J=0,"FC","NC","CC","NA" S ^TMP($J,STATION,CAT(1),J)=0
31 ... ; end initialize
32 .. S ^TMP($J,STATION,"COUNT",CAT(0))=^TMP($J,STATION,"COUNT",CAT(0))+1,^TMP($J,STATION,CAT(0),Y2K)=^TMP($J,STATION,CAT(0),Y2K)+1
33 .. S TOTAL(STATION,Y2K)=TOTAL(STATION,Y2K)+1,TOTAL(STATION)=TOTAL(STATION)+1
34 .. ; end data gather
35 . ; begin sort
36 . S STATION=0 F S STATION=$O(^TMP($J,STATION)) Q:STATION="" S CAT(0)=0 F S CAT(0)=$O(^TMP($J,STATION,"COUNT",CAT(0))) Q:'CAT(0) S COUNT=^TMP($J,STATION,"COUNT",CAT(0)) I COUNT D
37 .. I $E(ENSORT)="C" D Q
38 ... I $G(ENSORT("MIN"))>COUNT Q
39 ... S ^TMP($J,STATION,"SORT",COUNT,CAT(0))=""
40 .. S CAT=$P($G(^ENG(6911,CAT(0),0)),U) S:CAT="" CAT=0 S ^TMP($J,STATION,"SORT",CAT,CAT(0))=""
41 .. ; end sort
42 . ; print the list
43 . U IO
44 . I '$D(^TMP($J)) D HEADR W !!,?15,"<Nothing to print>" D HOLD Q
45 . S STATION=0 F S STATION=$O(^TMP($J,STATION)) Q:STATION=""!($G(ESCAPE)) D Q:$G(ESCAPE) D HOLD Q:$G(ESCAPE)
46 .. D HEADR
47 .. I '$D(^TMP($J,STATION,"SORT")) W !!,"** No records to print **" Q
48 .. I $E(ENSORT)="C" S J=99999 F S J=$O(^TMP($J,STATION,"SORT",J),-1) Q:'J!($G(ESCAPE)) S CAT(0)=0 F S CAT(0)=$O(^TMP($J,STATION,"SORT",J,CAT(0))) Q:'CAT(0) D PRTCAT Q:$G(ESCAPE) ; J => count
49 .. I $E(ENSORT)="A" S J="" F S J=$O(^TMP($J,STATION,"SORT",J)) Q:J=""!($G(ESCAPE)) S CAT(0)=0 F S CAT(0)=$O(^TMP($J,STATION,"SORT",J,CAT(0))) Q:'CAT(0) D PRTCAT Q:$G(ESCAPE) ; J => category
50 .. D TOTALS
51 ;
52MFG ; must be by manufacturer
53 ; mfg initialization
54 S MFG(0)=0 F S MFG(0)=$O(^ENG(6914,"K",MFG(0))) Q:'MFG(0) S ^TMP($J,STATION("PARNT"),"COUNT",MFG(0))=0 F J=0,"NA","FC","NC","CC" S ^TMP($J,STATION("PARNT"),MFG(0),J)=0
55 ; end mfg initialization
56 ; begin data gather
57 S MFG(0)=0,STATION=STATION("PARNT") F S MFG(0)=$O(^ENG(6914,"K",MFG(0))) Q:'MFG(0) K:'$D(^ENG("MFG",MFG(0),0)) ^ENG(6914,"K",MFG(0)) I $D(^ENG("MFG",MFG(0),0)) S (DA,COUNT)=0 F S DA=$O(^ENG(6914,"K",MFG(0),DA)) Q:'DA D
58 . Q:'$D(^ENG(6914,DA,0))
59 . I "^4^5^"[(U_$P($G(^ENG(6914,DA,3)),U)_U) Q
60 . I '$D(ZTQUEUED),'(DA#100) W "." ; activity indicator
61 . S Y2K=$P($G(^ENG(6914,DA,11)),U) S:Y2K="" Y2K=0
62 . I ENSUP,"^NA^FC^"[(U_Y2K_U) Q
63 . ; initialize station if need be
64 . I ENSTN S STATION=$S($P($G(^ENG(6914,DA,9)),U,5)]"":$P(^(9),U,5),1:STATION("PARNT")) D:'$D(^TMP($J,STATION))
65 .. S TOTAL(STATION)=0 F J=0,"FC","NC","CC","NA" S TOTAL(STATION,J)=0
66 .. S MFG(1)=0 F S MFG(1)=$O(^ENG(6914,"K",MFG(1))) Q:'MFG(1) S ^TMP($J,STATION,"COUNT",MFG(1))=0 F J=0,"FC","NC","CC","NA" S ^TMP($J,STATION,MFG(1),J)=0
67 .. ; end initialization
68 . S ^TMP($J,STATION,"COUNT",MFG(0))=^TMP($J,STATION,"COUNT",MFG(0))+1,^TMP($J,STATION,MFG(0),Y2K)=^TMP($J,STATION,MFG(0),Y2K)+1
69 . S TOTAL(STATION,Y2K)=TOTAL(STATION,Y2K)+1,TOTAL(STATION)=TOTAL(STATION)+1
70 . ; end data gather
71 ; begin sort
72 S STATION=0 F S STATION=$O(^TMP($J,STATION)) Q:STATION="" S MFG(0)=0 F S MFG(0)=$O(^TMP($J,STATION,"COUNT",MFG(0))) Q:'MFG(0) S COUNT=^TMP($J,STATION,"COUNT",MFG(0)) I COUNT D
73 . I $E(ENSORT)="C" D Q
74 .. I $G(ENSORT("MIN"))>COUNT Q
75 .. S ^TMP($J,STATION,"SORT",COUNT,MFG(0))=""
76 . S MFG=$P($G(^ENG("MFG",MFG(0),0)),U) S:MFG="" MFG=0 S ^TMP($J,STATION,"SORT",MFG,MFG(0))=""
77 . ; end sort
78 ; print the list
79 U IO
80 S STATION=0 F S STATION=$O(^TMP($J,STATION)) Q:STATION=""!($G(ESCAPE)) D Q:$G(ESCAPE) D HOLD Q:$G(ESCAPE)
81 . D HEADR
82 . I '$D(^TMP($J,STATION,"SORT")) W !!,"** No records to print **" Q
83 . I $E(ENSORT)="C" S J=99999 F S J=$O(^TMP($J,STATION,"SORT",J),-1) Q:'J!($G(ESCAPE)) S MFG(0)=0 F S MFG(0)=$O(^TMP($J,STATION,"SORT",J,MFG(0))) Q:'MFG(0) D PRTMFG Q:$G(ESCAPE) ; J => count
84 . I $E(ENSORT)="A" S J="" F S J=$O(^TMP($J,STATION,"SORT",J)) Q:J=""!($G(ESCAPE)) S MFG(0)=0 F S MFG(0)=$O(^TMP($J,STATION,"SORT",J,MFG(0))) Q:'MFG(0) D PRTMFG Q:$G(ESCAPE) ; J => manufacturer
85 . D TOTALS
86 K ENTYPE,ENSUP,ENSORT,ENSTN
87 G EXIT
88 ;
89PRTCAT I ENSUP W !,$E($P(^ENG(6911,CAT(0),0),U),1,30),?42,$J(^TMP($J,STATION,CAT(0),"NC"),5),?49,$J(^("CC"),5),?63,$J(^(0),5),?71,$J(^TMP($J,STATION,"COUNT",CAT(0)),5)
90 I 'ENSUP W !,$E($P(^ENG(6911,CAT(0),0),U),1,30),?35,$J(^TMP($J,STATION,CAT(0),"FC"),5),?42,$J(^("NC"),5),?49,$J(^("CC"),5),?56,$J(^("NA"),5),?63,$J(^(0),5),?71,$J(^TMP($J,STATION,"COUNT",CAT(0)),5)
91 S LINE=LINE+1 I (IOSL-LINE)'>4 D HOLD Q:$G(ESCAPE) I $O(^TMP($J,STATION,"SORT",J,CAT(0)))!($O(^TMP($J,STATION,"SORT",J))]"")!($O(^TMP($J,STATION))]"") D HEADR
92 Q
93 ;
94PRTMFG I ENSUP W !,$E($P(^ENG("MFG",MFG(0),0),U),1,30),?42,$J(^TMP($J,STATION,MFG(0),"NC"),5),?49,$J(^("CC"),5),?63,$J(^(0),5),?71,$J(^TMP($J,STATION,"COUNT",MFG(0)),5)
95 I 'ENSUP W !,$E($P(^ENG("MFG",MFG(0),0),U),1,30),?35,$J(^TMP($J,STATION,MFG(0),"FC"),5),?42,$J(^("NC"),5),?49,$J(^("CC"),5),?56,$J(^("NA"),5),?63,$J(^(0),5),?71,$J(^TMP($J,STATION,"COUNT",MFG(0)),5)
96 S LINE=LINE+1 I (IOSL-LINE)'>4 D HOLD Q:$G(ESCAPE) I $O(^TMP($J,STATION,"SORT",J,MFG(0)))!($O(^TMP($J,STATION,"SORT",J))]"")!($O(^TMP($J,STATION))]"") D HEADR
97 Q
98 ;
99TOTALS ; skip totals if printing high counts only
100 Q:$G(ESCAPE)!($G(ENSORT("MIN"))>1)
101 K X S $P(X,"-",79)="-" W !,X
102 I ENSUP W !,"TOTALS",?42,$J(TOTAL(STATION,"NC"),5),?49,$J(TOTAL(STATION,"CC"),5),?63,$J(TOTAL(STATION,0),5),?71,$J(TOTAL(STATION),5)
103 I 'ENSUP W !,"TOTALS",?35,$J(TOTAL(STATION,"FC"),5),?42,$J(TOTAL(STATION,"NC"),5),?49,$J(TOTAL(STATION,"CC"),5),?56,$J(TOTAL(STATION,"NA"),5),?63,$J(TOTAL(STATION,0),5),?71,$J(TOTAL(STATION),5)
104 Q
105 ;
106HEADR ; header for summary listing
107 W:PAGE>0!($E(IOST,1,2)="C-") @IOF S PAGE=PAGE+1,LINE=4
108 W "Y2K Data by "_$S(ENTYPE="CAT":"EQUIPMENT CATEGORY",1:"MANUFACTURER "),?45,DATE("PRNT"),?70,"Page: "_PAGE
109 W !,$S('ENSTN:"Consolidated ("_STATION("PARNT")_") ",1:"Station: "_STATION_" ")
110 I ENSUP W "(Y2K CATEGORIES 'FC' and 'NA' are being ignored.)"
111 W !,$S(ENTYPE="CAT":"EQUIPMENT CATEGORY NAME",1:"MANUFACTURER NAME"),?38,"FC",?45,"NC",?52,"CC",?59,"NA",?64,"NULL",?71,"TOTAL"
112 K X S $P(X,"-",79)="-" W !,X
113 Q
114 ;
115HOLD Q:$E(IOST,1,2)'="C-"!($G(ESCAPE))
116 W !!,"Press <RETURN> to continue, '^' to escape..." R X:DTIME
117 I '$T!($E(X)="^") S ESCAPE=1
118 Q
119EXIT ;
120 K ^TMP($J)
121 D ^%ZISC,HOME^%ZIS
122 I $D(ZTQUEUED) S ZTREQN="@"
123 K J,K,X
124 Q
125 ;ENY2REP8
Note: See TracBrowser for help on using the repository browser.