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

APCLOS6.m

Go to the documentation of this file.
APCLOS6 ; IHS/CMI/LAB - INHOSPULATORY - OPERATIONS SUMMARY ;
 ;;2.0;IHS PCC SUITE;;MAY 14, 2009
 ;
 ;
INHOSP ;
 S X=999,DIC="^AUTTRCD(",DIC(0)="" D ^DIC S APCLAPCD=$S(Y>0:+Y,1:"")
 I $G(APCLMFY)=1!(APCLMFY=3) S X1=APCLFYB,X2=-1 D C^%DTC S APCLSD=X_".9999",APCLED=APCLFYE,APCLOS="APCLOS" D V
 I $G(APCLMFY)=2 S APCLSD=APCL("FY WORKING DT"),APCLED=APCLFYE,APCLOS="APCLOS" D V
 D SET
 S X1=APCLPYB,X2=-1 D C^%DTC S APCLSD=X_".9999",APCLED=APCLPYE,APCLOS="APCLOSP" D V
 D SET
EOJ ;ENTRY POINT
 K APCLSD,APCLODAT,APCLED,APCLVDFN,APCLVREC,APCLINJF,APCLALCH,APCLVLOC,APCL1,APCL2,APCLAP,APCLTYPE,APCLOLOC,APCLVLOC,APCLCLNC,APCLCLIN,APCLDDFN,APCLDENT,APCLF,APCLPOV,APCLINJ,APCLAPC,G
 K APCLX,APCLPROV,APCLY,APCLDISC,APCLPDFN,APCLA,APCLH,APCLD,APCLINHO,APCLEDAT,APCLL,APCLS,APCLC,APCLT,APCLP,APCLF,APCLH,APCLAPCD
 Q
V ; 
 S %="^XTMP("""_APCLOS_""",APCLJOB,APCLBTH,",APCLA=%_"""INHOSPPOV"",APCLPOV)"
 S %="^XTMP("""_APCLOS_""",APCLJOB,APCLBTH,",APCLH=%_"""INHOSPAPC"",APCLAPC)"
 S %="^XTMP("""_APCLOS_""",APCLJOB,APCLBTH,",APCLD=%_"""INHOSPINJCAUSE"",APCLINJ)"
 S %="^XTMP("""_APCLOS_""",APCLJOB,APCLBTH,",APCLP=%_"""INHOSPPROV"",APCLDISC)"
 S %="^XTMP("""_APCLOS_""",APCLJOB,APCLBTH,",APCLT=%_"""INHOSPTYPE"",APCLTYPE)"
 S %="^XTMP("""_APCLOS_""",APCLJOB,APCLBTH,",APCLL=%_"""INHOSPLOC"",APCLVLOC)"
 S %="^XTMP("""_APCLOS_""",APCLJOB,APCLBTH,",APCLS=%_"""INHOSPOLOC"",APCLOLOC)"
 S APCLODAT=APCLSD F  S APCLODAT=$O(^AUPNVSIT("B",APCLODAT)) Q:APCLODAT=""!((APCLODAT\1)>APCLED)  D V1
 Q
V1 ;
 S APCLVDFN="" F  S APCLVDFN=$O(^AUPNVSIT("B",APCLODAT,APCLVDFN)) Q:APCLVDFN'=+APCLVDFN  I $D(^AUPNVSIT(APCLVDFN,0)) S APCLVREC=^(0) D PROC
 Q
PROC ;
 K APCLINJF,APCLALCH
 Q:$$DEMO^APCLUTL($P(APCLVREC,U,5),$G(APCLDEMO))
 Q:'$P(APCLVREC,U,9)
 Q:$P(APCLVREC,U,11)
 Q:$P(APCLVREC,U,7)'="I"
 ;Q:$D(^APCLCNTL(4,11,"B",$P(APCLVREC,U,3)))
 S APCLVLOC=$P(APCLVREC,U,6) Q:APCLVLOC=""
 Q:'$D(^XTMP("APCLSU",APCLJOB,APCLBTH,APCLVLOC))
 Q:'$D(^AUPNVPOV("AD",APCLVDFN))
 S (APCL1,APCL2)=0 F  S APCL2=$O(^AUPNVPRV("AD",APCLVDFN,APCL2)) Q:APCL2=""  I $P(^AUPNVPRV(APCL2,0),U,4)="P" S APCL1=APCL1+1,APCLAP=$P(^(0),U)
 Q:APCL1=0
 Q:APCL1>1
 S ^("INHOSPVCOUNT")=$S($D(^XTMP(APCLOS,APCLJOB,APCLBTH,"INHOSPVCOUNT")):(+^("INHOSPVCOUNT")+1),1:1)
TYPE K ^UTILITY("DIQ1",$J)
 K DIQ,DIC,DA,DR
 S DIC="^AUPNVSIT(",DR=".03",DA=APCLVDFN,DIQ(0)="E" D EN^DIQ1 K DIC,DA,DR,DIQ
 S APCLTYPE=^UTILITY("DIQ1",$J,9000010,APCLVDFN,.03,"E")
 S X=APCLT D COUNT
OLOC ;
 K ^UTILITY("DIQ1",$J)
 K DIQ,DIC,DA,DR
 S DIC="^AUPNVSIT(",DR="2101",DA=APCLVDFN,DIQ(0)="E" D EN^DIQ1 K DIC,DA,DR,DIQ
 S APCLOLOC=$G(^UTILITY("DIQ1",$J,9000010,APCLVDFN,2101,"E"))
 S:APCLOLOC="" APCLOLOC="---not entered---"
 S X=APCLS D COUNT
 K ^UTILITY("DIQ1",$J)
LOC ;
 S X=APCLL D COUNT
 ;
PROV D ^APCLOS61
 Q
SET ;ENTRY POINT
 S APCL1="INHOSPPOVC",APCL3="INHOSPPOV" D SET1
 S APCL1="INHOSPAPCC",APCL3="INHOSPAPC" D SET1
 S APCL1="INHOSPPROVC",APCL3="INHOSPPROV" D SET1
 S APCL1="INHOSPTYPEC",APCL3="INHOSPTYPE" D SET1
 S APCL1="INHOSPOLOCC",APCL3="INHOSPOLOC" D SET1
 S APCL1="INHOSPLOCC",APCL3="INHOSPLOC" D SET1
 Q
SET1 S APCL2="^XTMP("""_APCLOS_""",APCLJOB,APCLBTH,"""_APCL3_""",X)"
 S X="" F  S X=$O(@APCL2) Q:X=""  S %=^(X) S ^XTMP(APCLOS,APCLJOB,APCLBTH,APCL1,9999999-%,X)=%
 Q
COUNT ;
 I '$D(@X) S @X=0
 S %=@X,%=%+1,@X=%
 Q