VistA-WorldVistAEHR/r/CLINICAL_MONITORING_SYSTEM-QAM/QAMPRUN0.m

49 lines
2.5 KiB
Mathematica
Raw Permalink Normal View History

2009-11-29 13:37:14 -05:00
QAMPRUN0 ;HISC/DAD-AUTO ENROLL MONITOR RUN REPORT ;5/5/93 14:43
;;1.0;Clinical Monitoring System;;09/13/1993
EN1 ; *** MENU ENTRY POINT
D ^QAQDATE G:QAQQUIT EXIT
K %ZIS,IOP S %ZIS="MQ" D ^%ZIS G:POP EXIT I $D(IO("Q")) K IO("Q") S ZTDESC="Auto enroll monitor run report",ZTRTN="ENTSK^QAMPRUN0",ZTSAVE("QAM*")="",ZTSAVE("QAQ*")="" D ^%ZTLOAD G EXIT
ENTSK ;
K ^UTILITY($J,"QAMPRUN0") S X=QAQNBEG D H^%DTC S START=%H,X=QAQNEND D H^%DTC S END=%H
F QAMDATE=START:1:END S %H=QAMDATE D YMD^%DTC S QAMDT=X D SLOOP1
U IO S QAMQUIT=0,%DT="",X="T" D ^%DT X ^DD("DD") S TODAY=Y,PAGE=1 K UNDL S $P(UNDL,"-",80)="-"
D HEAD I '$D(^UTILITY($J,"QAMPRUN0")) W !!,"*** NO DATA FOUND FOR THIS REPORT ***" G EXIT
F QAMDT=0:0 S QAMDT=$O(^UTILITY($J,"QAMPRUN0",QAMDT)) Q:QAMDT'>0!QAMQUIT D PLOOP1
EXIT ;
W ! D ^%ZISC
K %DT,%H,%ZIS,DIR,END,IOP,PAGE,POP,QA,QAM,QAMDATE,QAMDT,QAMMON,QAMQUIT,QAMS0,QAMS1,START,TODAY,UNDL,X,Y,ZTDESC,ZTDTH,ZTIO,ZTRTN,ZTSAVE D K^QAQDATE
S:$D(ZTQUEUED) ZTREQ="@"
Q
SLOOP1 ;
S QAMS0=$O(^QA(743.6,"B",QAMDT,0)),Y=QAMDT X ^DD("DD")
S ^UTILITY($J,"QAMPRUN0",QAMDT)=$S(QAMS0'>0:Y_"^*** AUTO ENROLL DID NOT RUN FOR THIS DATE ***",1:Y_"^") Q:QAMS0'>0
F QAMS1=0:0 S QAMS1=$O(^QA(743.6,QAMS0,1,QAMS1)) Q:QAMS1'>0 D SLOOP2
Q
SLOOP2 ;
S QA=^QA(743.6,QAMS0,1,QAMS1,0),QAM=$G(^QA(743,+QA,0)) Q:QAM=""
S Y=$P(QA,"^",2) X ^DD("DD") S ^UTILITY($J,"QAMPRUN0",QAMDT,$P(QAM,"^"))=$P(QAM,"^",2)_"^"_Y_"^"_$S($P(QAM,"^",4)'>0:" (m)",1:" (a)")
Q
PLOOP1 ;
S QA=^UTILITY($J,"QAMPRUN0",QAMDT) W !!,$P(QA,"^"),?15,$P(QA,"^",2)
I $Y>(IOSL-6) D:$E(IOST)="C" PAUSE Q:QAMQUIT D HEAD
Q:$P(QA,"^",2)]""
S QAMMON="" F QAMMON(0)=0:1 S QAMMON=$O(^UTILITY($J,"QAMPRUN0",QAMDT,QAMMON)) Q:QAMMON=""!QAMQUIT D PLOOP2
W:QAMMON(0)'>0 !?2,"*** NO MONITORS RUN ***"
Q
PLOOP2 ;
S QA=^UTILITY($J,"QAMPRUN0",QAMDT,QAMMON) W !?2,QAMMON,$P(QA,"^",3),?35,$P(QA,"^"),?68,$P(QA,"^",2) I $Y>(IOSL-6) D:$E(IOST)="C" PAUSE Q:QAMQUIT D HEAD
Q
HEAD ;
W:(PAGE>1)!($E(IOST)="C") @IOF
W !!?24,"AUTO/MANUAL ENROLL MONITORS RUN",?68,TODAY,!?80-$L(QAQ2HED)/2,QAQ2HED,?68,"PAGE: ",PAGE S PAGE=PAGE+1
W !,"AUTO ENROLL RUN DATE",!?2,"MONITOR CODE (a/m=AUTO/MANUAL)",?35,"MONITOR TITLE",?68,"DATE RUN",!,UNDL
Q
PAUSE ;
K DIR S DIR(0)="E" D ^DIR S QAMQUIT=$S(Y'>0:1,1:0)
Q
EN2 ; *** AUTO ENROLL ENTRY POINT
D 2 S ZTIO=$P($G(^QA(740,1,"QAM")),"^",2) G:ZTIO="" 2 S Y=QAMTODAY X ^DD("DD") S QAQ2HED="FOR "_Y,ZTDESC="Auto enroll monitor run report",ZTRTN="ENTSK^QAMPRUN0",ZTDTH=$H
S (ZTSAVE("QAM*"),ZTSAVE("QAQ2HED"))="",(ZTSAVE("QAQNBEG"),ZTSAVE("QAQNEND"))=QAMTODAY D ^%ZTLOAD
2 K ZTDESC,ZTIO,ZTRTN,ZTSAVE,ZTSK
Q