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

XTPMSTA3.m

Go to the documentation of this file.
  1. XTPMSTA3 ;OAK/BP - PRINT PATCH STATISTICS BY RELEASED DATE; ; 3/15/11 7:29am
  1. ;;7.3;TOOLKIT;**130**; Apr 25, 1995;Build 2
  1. ;Per VHA Directive 2004-038, this routine should not be modified.
  1. S IOP="HOME" D ^%ZIS K IOP
  1. EN W @IOF,"Patch Monitor Statistics By Released Date",!!!
  1. ;
  1. DATE W ! S %DT="AEP"
  1. S %DT("A")="Enter BEGINNING Released date: " D ^%DT G:Y<0 EXIT S XTBBDT=Y X ^DD("DD") S XTBBDT1=Y
  1. S %DT="AE",%DT("A")=" and ENDING Released date: " D ^%DT G:Y<0 EXIT S XTBEDT=Y X ^DD("DD") S XTBEDT1=Y
  1. I XTBEDT<XTBBDT W !!,$C(7),"Starting date is later than ending date.",!! H 2 G DATE
  1. W !!,"Do you want to see the patch data" S %=2 D YN^DICN S XTBVIEW=%
  1. ;
  1. DEV W !! S %ZIS="AEQ" D ^%ZIS G:POP EXIT
  1. I $D(IO("Q")) S ZTIO=ION,ZTRTN="SORT^XTPMSTA3",ZTSAVE("XTB*")="",ZTDESC="Patch Monitor Statistics By Released Date" D ^%ZTLOAD D HOME^%ZIS
  1. I $D(ZTSK) W !,"Queued as task #",ZTSK H 2 G EXIT
  1. ;
  1. ; sort patches by released date
  1. SORT U IO K ^TMP($J)
  1. S XTBDA=0
  1. F S XTBDA=$O(^XPD(9.9,XTBDA)) Q:'XTBDA DO
  1. .S XTBDTA=$G(^XPD(9.9,XTBDA,0)) Q:XTBDTA=""
  1. .S XTBPTNAM=$P(XTBDTA,U,1),XTBNMSP=$P($P(XTBDTA,U,4)," - ",1) Q:XTBNMSP="" ;parent package missing in file
  1. .S XTBRELDT=$P(XTBDTA,U,2),XTBPRIOR=$P(XTBDTA,U,3),XTBCPLDT=$P(XTBDTA,U,9)
  1. .Q:(XTBRELDT<XTBBDT)!(XTBRELDT>XTBEDT)
  1. .S ^TMP($J,XTBRELDT,XTBPTNAM,XTBDA)=XTBCPLDT_U_XTBPRIOR
  1. PRINT ;
  1. S Y=DT X ^DD("DD") S XTBCURDT=Y
  1. K XTBLINE S $P(XTBLINE,"-",(IOM-2))="-"
  1. S PG=0 D HDR ; first header
  1. S (XTBTPTCH,XTBTLATE)=0,XTBPTNAM=""
  1. F XTBRELDT=0:0 S XTBRELDT=$O(^TMP($J,XTBRELDT)) Q:XTBRELDT="" F S XTBPTNAM=$O(^TMP($J,XTBRELDT,XTBPTNAM)) Q:XTBPTNAM="" D Q:$D(XTBOUT)
  1. .F XTBDA=0:0 S XTBDA=$O(^TMP($J,XTBRELDT,XTBPTNAM,XTBDA)) Q:XTBDA="" D Q:$D(XTBOUT)
  1. ..S XTBTPTCH=XTBTPTCH+1
  1. ..S XTBDTA=^TMP($J,XTBRELDT,XTBPTNAM,XTBDA)
  1. ..S XTBCPLDT=$P(XTBDTA,U),XTBPRIOR=$P(XTBDTA,U,2)
  1. ..S XTBRCVDT=$P($G(^XPD(9.9,XTBDA,0)),U,2)
  1. ..S XTBPTYPE=$P($G(^XPD(9.9,XTBDA,0)),U,10)
  1. ..I +XTBPTYPE=0 S D0=XTBDA D ^XTPMKPCF S XTBINSDT=XTINST K D0
  1. ..I +XTBPTYPE=1 S XTBINSDT=$P($G(^XPD(9.9,XTBDA,0)),U,11)
  1. ..I XTBINSDT]"" S X1=XTBINSDT,X2=XTBCPLDT D ^%DTC S XTBDAYLT=X
  1. ..I XTBINSDT="" S X1=DT,X2=XTBCPLDT D ^%DTC S XTBDAYLT=X
  1. ..S Y=XTBINSDT X ^DD("DD") I Y'="" S XTBINSDT=$P(Y,",",1)_","_$E($P(Y,",",2),1,4) ;set date format "MON DD,YYYY"
  1. ..S Y=XTBRELDT X ^DD("DD") S XTBRELDX=Y
  1. ..S Y=XTBCPLDT X ^DD("DD") S XTBCPLDT=Y
  1. ..S XTBPRIOR=$S(XTBPRIOR="m":"Mandatory",XTBPRIOR="e":"Emergency",1:"Unknown")
  1. ..I XTBVIEW=1 W XTBRELDX,?14,XTBPTNAM,?27,XTBCPLDT,?41,XTBINSDT,?55,XTBPRIOR
  1. ..I XTBVIEW=1,XTBDAYLT>0 W ?67,$J(XTBDAYLT,3,0)_$S(XTBDAYLT>1:" days",1:" day")
  1. ..I XTBDAYLT>0 S XTBTLATE=XTBTLATE+1
  1. ..I XTBVIEW=1 W ! I $Y>(IOSL-6),IOST?1"C-".E D PAUSE Q:$D(XTBOUT)
  1. ..I XTBVIEW=1 I $Y>(IOSL-6) D HDR
  1. G:$D(XTBOUT) EXIT
  1. I $Y>(IOSL-6),IOST?1"C-".E D HDR
  1. W !!?6,"Totals patches received for date range: ",XTBTPTCH,!
  1. W "Total patches installed past compliance date: ",XTBTLATE,!!
  1. S XTBDIVOK=0 I XTBTPTCH>0 S XTBDIVOK=1
  1. W ?25,"Delinquent patch % : ",$S(XTBDIVOK=1:$J((XTBTLATE/XTBTPTCH*100),6,2),1:100)_" %",!
  1. W ?25," Compliance % : ",$S(XTBDIVOK=1:$J(100-(XTBTLATE/XTBTPTCH*100),6,2),1:100)," %",!
  1. I IOST?1"C-".E K XTBANS W !!,"Press ENTER to end " R XTBANS:DTIME
  1. ;
  1. EXIT I IOST?1"C-".E W @IOF,!
  1. D ^%ZISC
  1. K %,%DT,%ZIS,XTBNMSP,XTBANS,XTBBDT,XTBBDT1,XTBCPLDT,XTBCPLDX,XTBDA,XTBEDT,XTBEDT1,XTBDAYLT
  1. K XTBINSDT,XTBLINE,XTBNMSP,XTBOLDNM,XTBNMSP,XTBPTNAM,XTBPTYPE,XTBDTA,XTBGPDA
  1. K XTBRCVDT,XTBTLATE,XTBTPTCH,D0,DIC,PG,POP,X,X1,X2,Y,ZTDESC,ZTIO,ZTRTN,ZTSAVE,%T,%Y
  1. K ^TMP($J),XTBOUT,XTBPGF,XTBOLGRP,ZTSK,XTBRELDT,XTBPRIOR,XTBCURDT,XTBDIVOK,XTBVIEW,XTINST
  1. Q
  1. ;
  1. HDR S PG=PG+1 I IOST?1"P-".E,PG>1 W @IOF
  1. I IOST?1"C-".E W @IOF
  1. W XTBCURDT S X="Patch Statistical Report for "_^DD("SITE")
  1. W ?(IOM-$L(X)\2),X,?(IOM-12),"Page: ",PG,!,?31,"By Released Date",!
  1. S X="Date range: "_XTBBDT1_" to "_XTBEDT1 W ?(IOM-$L(X)\2),X,!
  1. W !,"Release",?14,"Patch",?27,"Compliance",?41,"Install",?67,"# Days",!
  1. W "Date",?14,"Number",?27,"Date",?41,"Date",?55,"Priority",?67,"Delinquent",!,XTBLINE,!
  1. Q
  1. ;
  1. PAUSE Q:IOST'?1"C-".E
  1. K XTBANS,XTBOUT W !!,"Press ENTER to continue or '^' to end " R XTBANS:DTIME
  1. I XTBANS[U!('$T) S (XTBNMSP,XTBPTNAM,XTBCPLDT,XTBDA)="99999999",XTBOUT=1
  1. Q
  1. ;
  1. ADDOP ; Add a new option under the XUSER menu option.
  1. N XUA,XUB,XUC
  1. S XUA="XTPM PATCH REPORTS"
  1. S XUB="XTPM PATCH STATS BY RELEASED"
  1. IF $$FIND1^DIC(19,,"X",XUA,,,),$$FIND1^DIC(19,,"X",XUB,,,) S XUC=$$ADD^XPDMENU(XUA,XUB,8,)
  1. Q