source: WorldVistAEHR/trunk/r/TOOLKIT-AWCM-XD-XIN-XPAR-XQAB-XT-XUC-XUR-ZIN-ZTED/XTPMSTA2.m@ 1639

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

revised back to 6/30/08 version

File size: 4.0 KB
Line 
1XTPMSTA2 ;OAK/BP - PRINT PATCH STATISTICS BY COMPLIANCE DATE; [1/4/06 9:33am]
2 ;;7.3;TOOLKIT;**98,100**; Apr 25, 1995;Build 4
3 ;
4 S IOP="HOME" D ^%ZIS K IOP
5EN W @IOF,"Patch Monitor Statistics By Compliance Date",!!!
6 ;
7DATE W ! S %DT="AEP"
8 S %DT("A")="Enter BEGINNING Compliance date: " D ^%DT G:Y<0 EXIT S XTBBDT=Y X ^DD("DD") S XTBBDT1=Y
9 S %DT="AE",%DT("A")=" and ENDING Compliance date: " D ^%DT G:Y<0 EXIT S XTBEDT=Y X ^DD("DD") S XTBEDT1=Y
10 I XTBEDT<XTBBDT W !!,$C(7),"Starting date is later than ending date.",!! H 2 G DATE
11 W !!,"Do you want to see the patch data" S %=2 D YN^DICN S XTBVIEW=%
12 ;
13DEV W !! S %ZIS="AEQ" D ^%ZIS G:POP EXIT
14 I $D(IO("Q")) S ZTIO=ION,ZTRTN="SORT^XTPMSTA2",ZTSAVE("XTB*")="",ZTDESC="Patch Monitor Statistics By Compliance Date" D ^%ZTLOAD D HOME^%ZIS
15 I $D(ZTSK) W !,"Queued as task #",ZTSK H 2 G EXIT
16 ;
17 ; sort patches by compliance date
18SORT U IO K ^TMP($J)
19 F XTBCPLDT=(XTBBDT-.0001):0 S XTBCPLDT=$O(^XPD(9.9,"D",XTBCPLDT)) Q:XTBCPLDT=""!(XTBCPLDT>XTBEDT) DO
20 .F XTBDA=0:0 S XTBDA=$O(^XPD(9.9,"D",XTBCPLDT,XTBDA)) Q:XTBDA="" DO
21 ..S XTBDTA=$G(^XPD(9.9,XTBDA,0)) Q:XTBDTA=""
22 ..S XTBPTNAM=$P(XTBDTA,U,1),XTBNMSP=$P($P(XTBDTA,U,4)," - ",1) Q:XTBNMSP="" ;parent package missing in file
23 ..S XTBRELDT=$P(XTBDTA,U,2),XTBPRIOR=$P(XTBDTA,U,3)
24 ..S ^TMP($J,XTBCPLDT,XTBPTNAM,XTBDA)=XTBRELDT_U_XTBPRIOR
25PRINT ;
26 S Y=DT X ^DD("DD") S XTBCURDT=Y
27 K XTBLINE S $P(XTBLINE,"-",(IOM-2))="-"
28 S PG=0 D HDR ; first header
29 S XTBPTNAM="",(XTBTPTCH,XTBTLATE)=0
30 F XTBCPLDT=0:0 S XTBCPLDT=$O(^TMP($J,XTBCPLDT)) Q:XTBCPLDT="" F S XTBPTNAM=$O(^TMP($J,XTBCPLDT,XTBPTNAM)) Q:XTBPTNAM="" DO Q:$D(XTBOUT)
31 .F XTBDA=0:0 S XTBDA=$O(^TMP($J,XTBCPLDT,XTBPTNAM,XTBDA)) Q:XTBDA="" DO Q:$D(XTBOUT)
32 ..S XTBTPTCH=XTBTPTCH+1
33 ..S XTBDTA=^TMP($J,XTBCPLDT,XTBPTNAM,XTBDA)
34 ..S XTBRELDT=$P(XTBDTA,U),XTBPRIOR=$P(XTBDTA,U,2)
35 ..S XTBRCVDT=$P($G(^XPD(9.9,XTBDA,0)),U,2)
36 ..S XTBPTYPE=$P($G(^XPD(9.9,XTBDA,0)),U,10)
37 ..I +XTBPTYPE=0 S D0=XTBDA D ^XTPMKPCF S XTBINSDT=X K D0
38 ..I +XTBPTYPE=1 S XTBINSDT=$P($G(^XPD(9.9,XTBDA,0)),U,11)
39 ..I XTBINSDT]"" S X1=XTBINSDT,X2=XTBCPLDT D ^%DTC S XTBDAYLT=X
40 ..I XTBINSDT="" S X1=DT,X2=XTBCPLDT D ^%DTC S XTBDAYLT=X
41 ..S Y=XTBINSDT X ^DD("DD") S XTBINSDT=Y
42 ..S Y=XTBCPLDT X ^DD("DD") S XTBCPLDX=Y
43 ..S Y=XTBRELDT X ^DD("DD") S XTBRELDT=Y
44 ..S XTBPRIOR=$S(XTBPRIOR="m":"Mandatory",XTBPRIOR="e":"Emergency",1:"Unknown")
45 ..I XTBVIEW=1 W XTBCPLDX,?14,XTBPTNAM,?27,XTBRELDT,?41,XTBINSDT,?55,XTBPRIOR
46 ..I XTBVIEW=1,XTBDAYLT>0 W ?67,$J(XTBDAYLT,3,0)_$S(XTBDAYLT>1:" days",1:" day")
47 ..I XTBDAYLT>0 S XTBTLATE=XTBTLATE+1
48 ..I XTBVIEW=1 W ! I $Y>(IOSL-6),IOST?1"C-".E D PAUSE Q:$D(XTBOUT)
49 ..I XTBVIEW=1 I $Y>(IOSL-6) D HDR
50 G:$D(XTBOUT) EXIT
51 I $Y>(IOSL-6),IOST?1"C-".E D HDR
52 W !!?6,"Totals patches received for date range: ",XTBTPTCH,!
53 W "Total patches installed past compliance date: ",XTBTLATE,!!
54 S XTBDIVOK=0 I XTBTPTCH>0 S XTBDIVOK=1
55 W ?25,"Delinquent patch % : ",$S(XTBDIVOK=1:$J((XTBTLATE/XTBTPTCH*100),6,2),1:100)_" %",!
56 W ?25," Compliance % : ",$S(XTBDIVOK=1:$J(100-(XTBTLATE/XTBTPTCH*100),6,2),1:100)," %",!
57 I IOST?1"C-".E K XTBANS W !!,"Press ENTER to end " R XTBANS:DTIME
58 ;
59EXIT I IOST?1"C-".E W @IOF,!
60 D ^%ZISC
61 K %,%DT,%ZIS,XTBNMSP,XTBANS,XTBBDT,XTBBDT1,XTBCPLDT,XTBCPLDX,XTBDA,XTBEDT,XTBEDT1,XTBDAYLT
62 K XTBINSDT,XTBLINE,XTBNMSP,XTBOLDNM,XTBNMSP,XTBPTNAM,XTBPTYPE,XTBDTA,XTBGPDA
63 K XTBRCVDT,XTBTLATE,XTBTPTCH,D0,DIC,PG,POP,X,X1,X2,Y,ZTDESC,ZTIO,ZTRTN,ZTSAVE,%T,%Y
64 K ^TMP($J),XTBOUT,XTBPGF,XTBOLGRP,ZTSK,XTBRELDT,XTBPRIOR,XTBCURDT,XTBDIVOK,XTBVIEW
65 Q
66 ;
67HDR S PG=PG+1 I IOST?1"P-".E,PG>1 W @IOF
68 I IOST?1"C-".E W @IOF
69 W XTBCURDT S X="Patch Statistical Report for "_^DD("SITE")
70 W ?(IOM-$L(X)\2),X,?(IOM-12),"Page: ",PG,!,?31,"By Compliance Date",!
71 S X="Date range: "_XTBBDT1_" to "_XTBEDT1 W ?(IOM-$L(X)\2),X,!
72 W !,"Compliance",?14,"Patch",?27,"Release",?41,"Install",?67,"# Days",!
73 W "Date",?14,"Number",?27,"Date",?41,"Date",?55,"Priority",?67,"Delinquent",!,XTBLINE,!
74 Q
75 ;
76PAUSE Q:IOST'?1"C-".E
77 K XTBANS,XTBOUT W !!,"Press ENTER to continue or '^' to end " R XTBANS:DTIME
78 I XTBANS[U!('$T) S (XTBNMSP,XTBPTNAM,XTBCPLDT,XTBDA)="99999999",XTBOUT=1
79 Q
Note: See TracBrowser for help on using the repository browser.