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

RAFLM.m

Go to the documentation of this file.
RAFLM ;HISC/GJC AISC/MJK,RMO-Film Usage Report ;4/17/96  10:15
 ;;5.0;Radiology/Nuclear Medicine;**10**;Mar 16, 1998
 ;
 I $O(RACCESS(DUZ,""))="" D SETVARS^RAPSET1(0) S RAPSTX=""
 ;
SUM W !!,"Film Usage Report",!,"-----------------" K RAFL1
ASKSUM W ! K DIR S DIR(0)="Y",DIR("A")="Do you wish only the summary report",DIR("B")="NO",DIR("?")="Enter YES for a summary report or NO for a detailed report"
 D ^DIR K DIR I $D(DIRUT) D Q^RAFLM2 Q
 S:Y=0 RAFL1=""
 K DIROUT,DIRUT,DTOUT,DUOUT
 S X=$$DIVLOC^RAUTL7() I X D Q^RAFLM2 Q
 S A="",RATITLE="Film"
 F  S A=$O(RACCESS(DUZ,"DIV-IMG",A)) Q:A']""  D
 . Q:'$D(^TMP($J,"RA D-TYPE",A))  S A1=$O(^TMP($J,"RA D-TYPE",A,0))
 . Q:A1'>0  S B=""
 . F  S B=$O(RACCESS(DUZ,"DIV-IMG",A,B)) Q:B']""  D
 .. I $D(^TMP($J,"RA I-TYPE",B)) D IT^RALWKL2 I B1?3AP1"-".N S ^TMP($J,"RAFLM",A1,B1)=0
 .. Q
 . Q
 K A,A1,B,B1,RACCESS(DUZ,"DIV-IMG")
 S RAINPUT=$$ALLNOTH^RALWKL3() I RAINPUT="" D Q^RAFLM2 Q
 I RAINPUT=0 D FILM I RAQUIT=1 D Q^RAFLM2 Q
 I RAINPUT=0 S RAFLDCNT=0,RALP="" F  S RALP=$O(^TMP($J,"RAFILM",RALP)) Q:RALP=""  S RAFLDCNT=RAFLDCNT+1
 K RALP
 D DATE^RAUTL I RAPOP D Q^RAFLM2 Q
 S RAXIT=0 D DISPXAM^RALWKL1(6) I RAXIT D Q^RAFLM2 Q
 S ZTDESC="Rad/Nuc Med FILM USAGE RPT",ZTRTN="START^RAFLM",ZTSAVE("^TMP($J,""RAFILM"",")="",ZTSAVE("^TMP($J,""RAFLM"",")="" S:$D(RAFL1) ZTSAVE("RAFL1")=""
 F RASV="BEGDATE","ENDDATE","RAFLDCNT","RAINPUT" S ZTSAVE(RASV)=""
DEV W ! D ZIS^RAUTL I RAPOP D Q^RAFLM2 Q
START ; start processing
 U IO K ^TMP($J,"RA") S RABEG=BEGDATE-.0001,RAEND=ENDDATE+.9999,RACRT=6 D CRIT^RAUTL1 S RACPT=""
 S:$D(ZTQUEUED) ZTREQ="@"
 S RAITCNT=0,RALP="",RAEOS=0
 F  S RALP=$O(^TMP($J,"RAFLM",RALP)) Q:RALP=""  S RAITCNT(RALP)=0,^TMP($J,"RA",RALP)="0^0" S RALP1="" F  S RALP1=$O(^TMP($J,"RAFLM",RALP,RALP1)) Q:RALP1=""  S RAITCNT(RALP)=RAITCNT(RALP)+1,^TMP($J,"RA",RALP,RALP1)="0^0"
 K RALP,RALP1
 F RADTE=RABEG:0:RAEND S RADTE=$O(^RADPT("AR",RADTE)) Q:RADTE'>0!(RADTE>RAEND)!(RAEOS)  F RADFN=0:0 S RADFN=$O(^RADPT("AR",RADTE,RADFN)) Q:RADFN'>0  D RADTI^RAFLM1 Q:RAEOS
 G:'RAEOS ^RAFLM2
 Q
FILM ; select films to include in report
 K ^TMP($J,"RAFILM")
 S RAONECHK=$P(^RA(78.4,0),U,4) I RAONECHK=1 S RAIEN=$O(^RA(78.4,0)) Q:RAIEN<1  S RAONENME=$P(^RA(78.4,+RAIEN,0),U,1),RAONENME=$E(RAONENME,1,30),^TMP($J,"RAFILM",RAONENME)="" D KILL Q
 S RADIC="^RA(78.4,",RADIC(0)="QEAMZ",RADIC("A")="Select "_RATITLE_": ",RAUTIL="RAFILM"
 S RADIC("S")="I '$P(^(0),U,4)"
 D EN1^RASELCT(.RADIC,RAUTIL,"",RAINPUT)
KILL ;
 K %W,%Y1,DIC,RACNT,RADIC,RAIEN,RAONECHK,RAONENME,RAUTIL,X,Y
 Q
CPT ;
 Q:'$P(RAPRI,"^",9)  S RACPT=+$P(RAPRI,"^",9)
 S RACPT=$$NAMCODE^RACPTMSC(RACPT,DT),RACPT=$P(RACPT,"^")
 Q:RACPT=""
 S RAPRC=RAPRC_"("_RACPT_")"
 Q