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

ECRECSIC.m

Go to the documentation of this file.
ECRECSIC ;ALB/DAN - Event Capture Screens w/ Inactive Clinics ;12/14/11  16:09
 ;;2.0;EVENT CAPTURE;**112**;8 May 96;Build 18
 ;
STRPT ;
 D GETREC
 I ECPTYP="E" D EXPORT Q
 U IO
 D PRINT
 Q
 ;
GETREC ;Find screens with inactive clinics
 N STAT,IEN,ACT,FL,V,EI,ECSCR,CLN,LOC,UNT,CAT,PX,NODE,DSSIEN,EC4,EC4N,ECPCL
 K ^TMP("ECRECSIC",$J)
 S STAT="A",FL="4,724,726"
 S V="LOC,UNT,CAT",IEN=0
 F  S IEN=$O(^ECJ(IEN)) Q:'IEN  S NODE=$G(^ECJ(IEN,0)) I NODE'="" D
 .S ACT=$P(NODE,U,2),ECSCR=$TR($P(NODE,U),"-;,","^^")
 .I $S(STAT="A"&(ACT'=""):1,STAT="I"&(ACT=""):1,1:0) Q
 .I '$D(ECLOC1(+$P(ECSCR,U))) Q  ;Not a location we're looking for
 .I '$D(ECDSSU(+$P(ECSCR,U,2))) Q  ;Not a DSS Unit we're looking for
 .S EC4=$P($G(^ECJ(IEN,"PRO")),U,4) I '+EC4 Q  ;No associated clinic
 .D CLIN^ECPCEU I ECPCL Q  ;Clinic is active, not what we're looking for
 .S EC4N=$$GET1^DIQ(44,EC4,.01) ;Get clinic name
 .F EI=1:1:3 D
 ..S @$P(V,",",EI)=$$GET1^DIQ($P(FL,",",EI),$P(ECSCR,U,EI),.01,"E"),PX=""
 .I $P(ECSCR,U,5)["EC" D
 ..S PRO=$G(^EC(725,$P(ECSCR,U,4),0)),PX=$P(PRO,U,2)
 .E  S PRO=$$CPT^ICPTCOD($P(ECSCR,U,4)) S PX=$P(PRO,U,2)
 .S ^TMP("ECRECSIC",$J,UNT,LOC,IEN)=CAT_U_PX_U_EC4_U_EC4N
 Q
 ;
PRINT ;
 N PAGE,UNT,LOC,IEN,DATA
 D HDR
 S UNT="" F  S UNT=$O(^TMP("ECRECSIC",$J,UNT)) Q:UNT=""  D  W !
 .S LOC="" F  S LOC=$O(^TMP("ECRECSIC",$J,UNT,LOC)) Q:LOC=""  S IEN=0 F  S IEN=$O(^TMP("ECRECSIC",$J,UNT,LOC,IEN)) Q:'+IEN  D
 ..S DATA=^TMP("ECRECSIC",$J,UNT,LOC,IEN)
 ..W !,UNT,?32,LOC,?64,$E($P(DATA,U),1,20),?86,$P(DATA,U,2),?93,$P(DATA,U,3),?99,$P(DATA,U,4)
 ..I $Y>(IOSL-4) D HDR
 Q
 ;
HDR ;
 W @IOF
 S PAGE=$G(PAGE)+1
 W !,?56,"EVENT CAPTURE REPORT",?123,"PAGE: ",PAGE
 W !,?37,"EVENT CODE SCREENS WITH INACTIVE DEFAULT ASSOCIATED CLINICS",?104,"RUN DATE: ",$$FMTE^XLFDT($$NOW^XLFDT,"M"),!
 W !,?86,"PROC",?91,"CLINIC",?99,"CLINIC",!,"DSS UNIT",?32,"LOCATION",?64,"CATEGORY",?86,"CODE",?93,"IEN",?99,"NAME"
 W !,$$REPEAT^XLFSTR("-",132)
 Q
EXPORT ;
 N CNT,UNT,LOC,IEN
 K ^TMP($J,"ECRPT")
 S CNT=1,^TMP($J,"ECRPT",CNT)="DSS UNIT^LOCATION^CATEGORY^PROCEDURE CODE^INACTIVE CLINIC IEN^INACTIVE CLINIC NAME"
 S UNT="" F  S UNT=$O(^TMP("ECRECSIC",$J,UNT)) Q:UNT=""  S LOC="" F  S LOC=$O(^TMP("ECRECSIC",$J,UNT,LOC)) Q:LOC=""  S IEN=0 F  S IEN=$O(^TMP("ECRECSIC",$J,UNT,LOC,IEN)) Q:'+IEN  D
 .S CNT=CNT+1,^TMP($J,"ECRPT",CNT)=UNT_U_LOC_U_^TMP("ECRECSIC",$J,UNT,LOC,IEN)
 Q