A1AEPH4 ;isa/rmo ;2014-03-27T16:30
 ;;2.5;PATCH MODULE;;Jun 13, 2015
 ;;Submitted to OSEHRA 3 June 2015 by the VISTA Expertise Network
 ;;Licensed under the terms of the Apache License, version 2.0
 ;
 ;
 ;primary change history
 ;2014-03-28: version 2.4 released
 ;1992-11-23: version 2.2 released
 ;
 ;
 S %DT="",X="T" D ^%DT S DT=Y D PKGPMT^A1AEVP G Q:X["^"!($D(A1AENOSL)) D DATE^A1AEUTL1 G Q:'$D(BEGDATE)!('$D(ENDDATE)) S BEGDATE=9999999-BEGDATE,ENDDATE=9999999-ENDDATE
        N A1AESTRM
        N DIC,X,Y S DIC(0)="AEMQ",DIC=11007.1,DIC("A")="Select a Stream: " D ^DIC
        I Y'>0 QUIT
        S A1AESTRM=+Y
 S PGM="START^A1AEPH4",VAR=$S($D(A1AEPKIF):"A1AEPKIF^DUZ^BEGDATE^ENDDATE^A1AESTRM",1:"DUZ^BEGDATE^ENDDATE^A1AESTRM") W ! D ZIS^A1AEUTL1 G Q:POP
 ;
START S COUNT=0
 U IO K A1AEPGE,A1AELNE S A1AEHD="DHCP Summary Report of Released Patches",$P(A1AELNE,"-",78)="",Y=9999999-BEGDATE D D^DIQ S A1AEBEG=Y S Y=9999999-ENDDATE D D^DIQ S A1AEND=Y I $D(A1AEPKIF) D GETDTV G Q
 F A1AEPKIF=0:0 S A1AEPKIF=+$O(^A1AE(11007,"AU",DUZ,A1AEPKIF)) Q:'A1AEPKIF  I $D(^A1AE(11007,A1AEPKIF,0)) D GETDTV:$P(^(0),"^",2)="Y"!($P(^(0),"^",4)="y") Q:X["^"
 ;
Q I '$D(A1AEPGE)&$D(A1AEBEG)&$D(A1AEND) W !?3,"There were no patches released ",$S(A1AEBEG=A1AEND:"on "_A1AEBEG,1:"between "_A1AEBEG_" and "_A1AEND),"."
 W ! I $D(COUNT),COUNT W "-----------------",!,"# Patches Listed = "_COUNT
 K COUNT K A1AED0,A1AED1,A1AEPKIF,A1AEPKNM,A1AEDTV,A1AEHD,A1AEIFN,A1AEPGE,BEGDATE,ENDDATE,A1AEBEG,A1AEND,VAR,PGM,POP,A1AENOSL,A1AELNE,A1AEPK D CLOSE^A1AEUTL1 Q
 ;
GETDTV F A1AEDTV=ENDDATE-1:0 S A1AEDTV=$O(^A1AE(11005,"AV",A1AEPKIF,A1AEDTV)) Q:'A1AEDTV!(BEGDATE<A1AEDTV)!(X["^")  D GETIFN
 Q
 ;
GETIFN F A1AEIFN=0:0 S A1AEIFN=$O(^A1AE(11005,"AV",A1AEPKIF,A1AEDTV,A1AEIFN)) Q:'A1AEIFN  I $D(^A1AE(11005,A1AEIFN,0)),$P(^(0),"^",8)="v",$P(^(0),U,20)=A1AESTRM S A1AED0=^(0),A1AED1=$P(A1AED0,"^") D PRT S COUNT=COUNT+1 Q:X["^"
 Q
 ;
PRT D HD:($Y+6)>IOSL!('$D(A1AEPGE)) Q:X["^"  W !,$P(A1AED1,"*")_"*"_$S($P(A1AED1,"*",2)=999:"DBA",1:$P(A1AED1,"*",2))_"*"_$P(A1AED1,"*",3),?15,$J($P(A1AED0,"^",6),3),?22,$E($P(A1AED0,"^",5),1,24),?49
 S Y=$P(A1AED0,"^",11) D DT^DIQ W ?62,$P($P(^DD(11005,7,0),$P(A1AED0,"^",7)_":",2),";",1)
 S Y=$P(A1AED0,"^",17) I Y W !?38,"Hold date: " D DT^DIQ
 I $D(^A1AE(11005,A1AEIFN,"Q","B")) S PRINT="",D0=A1AEIFN D PCHK^A1AEUTL1 K AZ,PRINT,D0
 Q
 ;
HD S:'$D(A1AEPGE) A1AEPGE=0 D CRCHK Q:X["^"  W @IOF,A1AEHD,?50 S Y=DT D DT^DIQ S A1AEPGE=A1AEPGE+1 W ?70,"Page: ",A1AEPGE W !,"between ",A1AEBEG," and ",A1AEND,!
 W !,"Patch",?15,"SEQ #",?22,"Patch Subject",?49,"Date",?62,"Priority",!,"Designation",?49,"Released",!,A1AELNE Q
 ;
CRCHK I A1AEPGE,$E(IOST,1)="C" W !!,*7,"Press RETURN to continue or '^' to stop " R X:DTIME Q
