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

GMRAEF.m

Go to the documentation of this file.
GMRAEF ;HIRMFO/WAA-PRINT FDA EXCEPTION REPORT ;11/29/95  14:40
 ;;4.0;Adverse Reaction Tracking;;Mar 29, 1996
EN1 ;This is the main entry point for this routine
 I '$D(^TMP($J,"GMRAEF")) W !,"No data for this REPORT." Q
PRINTER ;Select printer
 S GMRAOUT=0,GMRAPG=0
 W ! K GMRAZIS D DEV^GMRAUTL I POP W !,"PLEASE TRY LATER" S GMRAOUT=1 G EXIT
 I $D(IO("Q")) D  D EXIT Q
 . S ZTRTN="PRINT^GMRAEF",ZTSAVE("GMRAPG")="",ZTSAVE("GMRAOUT")="",ZTSAVE("^TMP($J,""GMRAEF"",")=""
 . S:$D(GMRASTDT) ZTSAVE("GMRASTDT")=""
 . S:$D(GMRAEDT) ZTSAVE("GMRAEDT")=""
 . S ZTDESC="Print FDA Exception Report" D ^%ZTLOAD
 . W !!,$S($D(ZTSK):"Request queued...",1:"Request NOT queued please try later...")
 . Q
 U IO D PRINT U IO(0) D EXIT
 Q
PRINT ;Central Print
 I IOST?1"C".E W @IOF
 S GMRASTDT=$$FMTE^XLFDT(GMRASTDT,"2P")
 S:$D(GMRAEDT) GMRAEDT=$$FMTE^XLFDT(GMRAEDT,"2P")
 D HDR1 S GMRDFN=0 F  S GMRDFN=$O(^TMP($J,"GMRAEF",GMRDFN)) Q:GMRDFN<1!(GMRAOUT)  S GMRABGDT=0 S DFN=GMRDFN D PID^VADPT6 W !,?5,"Patient: ",$P(^DPT(GMRDFN,0),U)," (",VA("PID"),")" K VA D PRT
 D CLOSE^GMRAUTL
 Q
PRT ;Print loop
 I $Y>(IOSL-3) D HEAD Q:GMRAOUT
 S GMRABGDT=$O(^TMP($J,"GMRAEF",GMRDFN,GMRABGDT)) Q:GMRABGDT<1  S GMRAIEN=^(GMRABGDT)
 S GMRA(0)=^GMR(120.8,GMRAIEN,0)
 W !,$$DATE^GMRAUTL1(GMRABGDT),?20,$P(GMRA(0),U,2),?50,$S($P(GMRA(0),U,5)'="":$P(^VA(200,$P(GMRA(0),U,5),0),U),1:"<None>")
 G PRT
HDR ;
 I IOST?1"C".E K DIR S DIR(0)="E" D ^DIR K DIR I Y'>0 S GMRAOUT=1 Q
 W @IOF
HDR1 S GMRAPG=GMRAPG+1 D NOW^%DTC S Y=$$DATE^GMRAUTL1(%)
 W $P(Y,"@")," ",$P(Y,"@",2),?70,"Page: ",GMRAPG
 W !,?20,"FDA EXCEPTION REPORT ("
 W:$D(GMRAEDT) GMRASTDT_" to "_GMRAEDT_")"
 W:'$D(GMRAEDT) "Starting at "_GMRASTDT_")"
 W !,"ORIGINATION D/T",?20,"CAUSATIVE AGENT",?50,"ORIGINATOR"
 W !,$$REPEAT^XLFSTR("-",79),!
 I $D(ZTQUEUED) S:$$STPCK^GMRAUTL1 GMRAOUT=1 ; Check if stopped by user
 Q
EXIT ;EXIT
 K ^TMP($J,"GMRAEF")
 Q