VistA-WorldVistAEHR/r/TOOLKIT-AWCM-XD-XIN-XPAR-XQ.../XTPMNEX7.m

66 lines
3.0 KiB
Mathematica

XTPMNEX7 ;OAK/BP - PATCHES DUE IN NEXT 7 DAYS ; 2/7/06
;;7.3;TOOLKIT;**98,100**; Apr 25, 1995;Build 4
;
RPT S XTBHDR="Patches Due Within Seven Days for "_^DD("SITE")
S XTBBDT=3010101,X="T+7",%DT="" D ^%DT S XTBEDT=Y
W @IOF,!,XTBHDR,!!! S %ZIS="AEQ" D ^%ZIS G:POP EXIT
I $D(IO("Q")) S ZTIO=ION,ZTRTN="RPT1^XTPMNEX7",ZTDESC=XTBHDR,ZTSAVE("XTB*")="" D ^%ZTLOAD D HOME^%ZIS
I $D(ZTSK) W !,"Queued as task# ",ZTSK,!! H 2 G EXIT
;
RPT1 U IO K ^TMP($J) S XTBX="",(XTBCNT,XTBLN)=0
S XTBUP="I $Y>(IOSL-5) S PG=PG+1 D PAUSE W @IOF,!,XTBHDR,?(IOM-12),""Page: "",PG,!!"
S Y=DT X ^DD("DD") S XTBRUNDT=Y
F XTBX=XTBBDT:0 S XTBX=$O(^XPD(9.9,"D",XTBX)) Q:XTBX=""!(XTBX>XTBEDT) DO
.F XTBDA=0:0 S XTBDA=$O(^XPD(9.9,"D",XTBX,XTBDA)) Q:XTBDA="" DO
..S XTBDTA=$G(^XPD(9.9,XTBDA,0)),XTBINST=$P(XTBDTA,U,8) Q:XTBDTA=""!(XTBINST="") ; no data or no install name
..Q:$P(XTBDTA,U,11)]"" ; non-kids install date
..S XTBXX=$O(^XPD(9.7,"B",XTBINST,9999999999),-1) I $G(^XPD(9.7,+XTBXX,2))["TEST" S XTBXX=""
..Q:$P($G(^XPD(9.7,+XTBXX,0)),U,9)=3 ; 3 = installed
..D SET
S PG=0 D HDR S (XTBCPLDT,XTBPTNM,OLXTBCPL)=""
I '$D(^TMP($J)) W !!,?10,"Nothing to report",! G PREXIT
F S XTBCPLDT=$O(^TMP($J,XTBCPLDT)) Q:XTBCPLDT="" DO
.F S XTBPTNM=$O(^TMP($J,XTBCPLDT,XTBPTNM)) Q:XTBPTNM="" DO
..F XTBLN=0:0 S XTBLN=$O(^TMP($J,XTBCPLDT,XTBPTNM,XTBLN)) Q:XTBLN="" DO
...S XTBDTA=^TMP($J,XTBCPLDT,XTBPTNM,XTBLN)
...S XTBSUBJ=$P(XTBDTA,U),XTBPRIO=$P(XTBDTA,U,2),XTBRECPT=$P(XTBDTA,U,3)
...I OLXTBCPL'=XTBCPLDT W !
...S Y=XTBCPLDT X ^DD("DD") S XTBCPLD1=Y
...W XTBCPLD1,?13,XTBPTNM,?27,XTBSUBJ,?55,XTBPRIO,?67,XTBRECPT,! S XTBCNT=XTBCNT+1
...S OLXTBCPL=XTBCPLDT
...X XTBUP
X XTBUP
;
PREXIT W !!,"Number of patches: ",XTBCNT,!
I IOST?1"C-".E W !,"Press RETURN to end " R ANS:DTIME
;
EXIT D ^%ZISC
K ^TMP($J),%ZIS,ANS,XTBANS,XTBCNT,XTBCPLDT,XTBDA,XTBINST,XTBLN,XTBPKG,XTBPRIO,XTBPTNM
K XTBRECPT,XTBRUNDT,XTBSUBJ,XTBX,XTBXX,XTBDTA,XTBHDR,OLXTBCPL,PG,XTBPKFLV,XTBPKPTR,POP,XTBPTCVR,X,X1
K Y,YY1,ZTDESC,ZTSK,ZTIO,ZTRTN,ZTSAVE,XTBCPLD1,%DT,XTBBDT,XTBEDT,XTBPSITE,XTBUP,IOP,XMY
Q
;
SET S XTBPTNM=$P(XTBDTA,U,1),XTBSUBJ=$E($P(XTBDTA,U,7),1,26)
S X=$P(XTBDTA,U,3),XTBPRIO=$S(X="m":"Mandatory",X="e":"Emergency",1:"Unknown")
S Y=$P(XTBDTA,U,2) X ^DD("DD") S XTBRECPT=Y
S XTBCPLDT=$P(XTBDTA,U,9) ; compliance date
S XTBLN=XTBLN+1,^TMP($J,XTBCPLDT,XTBPTNM,XTBLN)=XTBSUBJ_U_XTBPRIO_U_XTBRECPT
Q
;
HDR I PG<1,IOST?1"C-".E W @IOF
S PG=PG+1
W:PG>1 @IOF W !,XTBHDR,?(IOM-12),"Page: ",PG,!,"Run date: "_XTBRUNDT,!!!
W "Compliance",!,"Date",?13,"Patch #",?27,"Subject",?55,"Priority",?67,"Recpt Date",!
W "----------",?13,"-------",?27,"-------",?55,"--------",?67,"----- ----",!
Q
;
PAUSE W !,"Press RETURN to continue or '^' to exit: " R XTBANS:DTIME
I XTBANS[U S (XTBLN,XTBCPLDT,XTBPTNM)="ZZZZZ"
Q
;
SITETSK ;compile a list from sites
S XTBPSITE=1,IOP="P-MESSAGE;80;60",XMY("TRAN.BA@NXT.KERNEL.FO-OAKLAND.MED.VA.GO")=""
S XTBHDR="Patches Due Within Eight Days for "_^DD("SITE")
S XTBBDT=3010101,X="T+8",%DT="" D ^%DT S XTBEDT=Y
G RPT1