SDCLAV0 ;ALB/LDB,GXT - OUTPUT PATTERNS (cont.) ; 06 JUN 2018 10:14 AM
;;5.3;Scheduling;**184,439,490,517,529,509,703**;Aug 13, 1993;Build 5
;SD/517 CHANGED FOR LOOPS
I 'VAUTC S SDC=0 F S SDC=$O(VAUTC(SDC)) Q:'SDC S SDV=VAUTC(SDC) D:VAUTD!($D(VAUTD(+$P(^SC(SDC,0),"^",15))))!('$P(^(0),"^",15)&$D(VAUTD($P(^DG(43,1,"GL"),"^",3)))) S1
I VAUTC S SDC=0 F S SDC=$O(^SC(SDC)) Q:'SDC I $P(^(SDC,0),"^",3)="C" D:VAUTD!($D(VAUTD(+$P(^(0),"^",15))))!('$P(^(0),"^",15)&$D(VAUTD($P(^DG(43,1,"GL"),"^",3)))) S1
I $D(^UTILITY($J,"SDNMS")) D S2^SDCLAV1
;following line commented off per SD*529
;S DGTCH="CLINIC AVAILABILITY REPORT^CLINIC^PAGE#" D:$E(IOST,1,2)="P-" TP^DGUTL K SDBD,SDCI,SDED D END^SDCLAV Q
D END^SDCLAV Q
S1 S SD=^SC(SDC,0),D=$S($P(SD,"^",15):$P(SD,"^",15),1:$P(^DG(43,1,"GL"),"^",3)),SD5=0,SDNM=$P(SD,"^")
S $P(^UTILITY($J,"SDNMS",D,SDNM),"^",3)=SDC
Q
NM ;called by SDCLAV1 - SD/517 CHANGED FOR LOOP
S SDAP1=0 F S SDAP1=$O(^SC(SDC,"S",SDAP,1,SDAP1)) Q:'SDAP1 D NM1
K M1,SDN1,SDN2,SDN3,SDC3,SDAP1 ; SD*5.3*439 added Kill of local vars
Q
NM1 I '$D(^SC(SDC,"S",SDAP,1,SDAP1,0)) N POP S POP=0,(SDN1,SDN2,SDN3)="" D CHECK,KILL Q ;added SD/517
I $P(^SC(SDC,"S",SDAP,1,SDAP1,0),U,1)="" D SETUTL Q ;SD*509
;NSR #20180316 SSN REDUCTION - Clinic Availability Report
;SD*5.3*703
S SDN1=+^SC(SDC,"S",SDAP,1,SDAP1,0),M1=$P(^(0),"^",2),SDC3=$P(^(0),"^",9),SDN2=$P(^DPT(+SDN1,0),"^"),SDN3=$P(^(0),"^",9),SDN3=$S(SDN3="":"UNKNOWN",1:"*****"_$E(SDN3,6,9)) I $D(SDCI) D NM2 Q
; SD*5.3*439 added quit if clinic in "S" node not = to selected clinic
I '$D(SDCI),$D(^DPT(SDN1,"S",SDAP,0)),$P(^(0),"^",2)'["C",$P(^(0),"^",2)'="N",$P(^(0),"^",2)'="NA" Q:$P(^(0),U,1)'=SDC D NM2 Q
Q
;SD*5.3*490 do not display appts prior to clinic start date
NM2 Q:$P(SDAP,".",1)<$O(^SC(SDC,"T",0)) ;SD*5.3*490
S:$D(^DPT(SDN1,"S",SDAP,0)) ^UTILITY($J,"SDNMS",D,SDV,SDAP,SDN2,SDN3)=M1_$S(($P(^DPT(SDN1,"S",SDAP,0),"^",2)["C"):"^*",SDC3="C":"^*",($P(^(0),"^",2)="N"):"^**",($P(^(0),"^",2)="NA"):"^**",1:"")
S:$D(^DPT(SDN1,"S",SDAP,0)) $P(^UTILITY($J,"SDNMS",D,SDV,SDAP,SDN2,SDN3),"^",3)=$S($P(^DPT(SDN1,"S",SDAP,0),"^",7)=4:"***",1:"")
Q
;
CHECK ;Added SD/517
N SDIEN,NODE,NODE0,HDFN,HDNAM,HDSN,POP
S SDIEN=0,NODE="",HDAP1=SDAP1
F S SDIEN=$O(^SCE("B",SDAP,SDIEN)) Q:'SDIEN D
.S NODE=^SCE(SDIEN,0)
.Q:$P(NODE,U,4)'=SDC
.S HDFN=$P(NODE,U,2),HDNAM=$P(^DPT(HDFN,0),U),HDSN=$P(^(0),U,9)
.Q:$D(^UTILITY($J,"SDNMS",D,SDV,SDAP,HDNAM,HDSN))
.S POP=0 D CHECK1 Q:POP
.S SDN1=$P(NODE,U,2),SDN2=$P(^DPT(SDN1,0),U),SDN3=$P(^DPT(SDN1,0),U,9),M1="",SDC3=""
.D NM2
Q
;
CHECK1 ;Added SD/517
S HDAP1=$O(^SC(SDC,"S",SDAP,1,HDAP1)) Q:'HDAP1
Q:'$D(^SC(SDC,"S",SDAP,1,HDAP1,0)) S NODE0=^(0)
I $P(NODE0,U,1)=HDFN S POP=1 Q
Q
;
KILL K SDIEN,NODE,NODE0,POP,HDFN,HDNAM,HDSN,HDAP1 ;added SD/517
Q
;
SETUTL ;SD*509 set Utility for null DFN, corrupt node will be deleted in SDCLAV1
S (SDN1,SDN2,SDN3)="UNKNOWN",M1=0
S ^UTILITY($J,"SDNMS",D,SDV,SDAP,SDN2,SDN3)=M1_"^"_SDC_"^"_SDAP1
Q
;
--- Routine Detail --- with STRUCTURED ROUTINE LISTING ---[H[J[2J[HSDCLAV0 3035 printed Oct 16, 2024@18:49:40 Page 2
SDCLAV0 ;ALB/LDB,GXT - OUTPUT PATTERNS (cont.) ; 06 JUN 2018 10:14 AM
+1 ;;5.3;Scheduling;**184,439,490,517,529,509,703**;Aug 13, 1993;Build 5
+2 ;SD/517 CHANGED FOR LOOPS
+3 IF 'VAUTC
SET SDC=0
FOR
SET SDC=$ORDER(VAUTC(SDC))
if 'SDC
QUIT
SET SDV=VAUTC(SDC)
if VAUTD!($DATA(VAUTD(+$PIECE(^SC(SDC,0),"^",15))))!('$PIECE(^(0),"^",15)&$DATA(VAUTD($PIECE(^DG(43,1,"GL"),"^",3))))
DO S1
+4 IF VAUTC
SET SDC=0
FOR
SET SDC=$ORDER(^SC(SDC))
if 'SDC
QUIT
IF $PIECE(^(SDC,0),"^",3)="C"
if VAUTD!($DATA(VAUTD(+$PIECE(^(0),"^",15))))!('$PIECE(^(0),"^",15)&$DATA(VAUTD($PIECE(^DG(43,1,"GL"),"^",3))))
DO S1
+5 IF $DATA(^UTILITY($JOB,"SDNMS"))
DO S2^SDCLAV1
+6 ;following line commented off per SD*529
+7 ;S DGTCH="CLINIC AVAILABILITY REPORT^CLINIC^PAGE#" D:$E(IOST,1,2)="P-" TP^DGUTL K SDBD,SDCI,SDED D END^SDCLAV Q
+8 DO END^SDCLAV
QUIT
S1 SET SD=^SC(SDC,0)
SET D=$SELECT($PIECE(SD,"^",15):$PIECE(SD,"^",15),1:$PIECE(^DG(43,1,"GL"),"^",3))
SET SD5=0
SET SDNM=$PIECE(SD,"^")
+1 SET $PIECE(^UTILITY($JOB,"SDNMS",D,SDNM),"^",3)=SDC
+2 QUIT
NM ;called by SDCLAV1 - SD/517 CHANGED FOR LOOP
+1 SET SDAP1=0
FOR
SET SDAP1=$ORDER(^SC(SDC,"S",SDAP,1,SDAP1))
if 'SDAP1
QUIT
DO NM1
+2 ; SD*5.3*439 added Kill of local vars
KILL M1,SDN1,SDN2,SDN3,SDC3,SDAP1
+3 QUIT
NM1 ;added SD/517
IF '$DATA(^SC(SDC,"S",SDAP,1,SDAP1,0))
NEW POP
SET POP=0
SET (SDN1,SDN2,SDN3)=""
DO CHECK
DO KILL
QUIT
+1 ;SD*509
IF $PIECE(^SC(SDC,"S",SDAP,1,SDAP1,0),U,1)=""
DO SETUTL
QUIT
+2 ;NSR #20180316 SSN REDUCTION - Clinic Availability Report
+3 ;SD*5.3*703
+4 SET SDN1=+^SC(SDC,"S",SDAP,1,SDAP1,0)
SET M1=$PIECE(^(0),"^",2)
SET SDC3=$PIECE(^(0),"^",9)
SET SDN2=$PIECE(^DPT(+SDN1,0),"^")
SET SDN3=$PIECE(^(0),"^",9)
SET SDN3=$SELECT(SDN3="":"UNKNOWN",1:"*****"_$EXTRACT(SDN3,6,9))
IF $DATA(SDCI)
DO NM2
QUIT
+5 ; SD*5.3*439 added quit if clinic in "S" node not = to selected clinic
+6 IF '$DATA(SDCI)
IF $DATA(^DPT(SDN1,"S",SDAP,0))
IF $PIECE(^(0),"^",2)'["C"
IF $PIECE(^(0),"^",2)'="N"
IF $PIECE(^(0),"^",2)'="NA"
if $PIECE(^(0),U,1)'=SDC
QUIT
DO NM2
QUIT
+7 QUIT
+8 ;SD*5.3*490 do not display appts prior to clinic start date
NM2 ;SD*5.3*490
if $PIECE(SDAP,".",1)<$ORDER(^SC(SDC,"T",0))
QUIT
+1 if $DATA(^DPT(SDN1,"S",SDAP,0))
SET ^UTILITY($JOB,"SDNMS",D,SDV,SDAP,SDN2,SDN3)=M1_$SELECT(($PIECE(^DPT(SDN1,"S",SDAP,0),"^",2)["C"):"^*",SDC3="C":"^*",($PIECE(^(0),"^",2)="N"):"^**",($PIECE(^(0),"^",2)="NA"):"^**",1:"")
+2 if $DATA(^DPT(SDN1,"S",SDAP,0))
SET $PIECE(^UTILITY($JOB,"SDNMS",D,SDV,SDAP,SDN2,SDN3),"^",3)=$SELECT($PIECE(^DPT(SDN1,"S",SDAP,0),"^",7)=4:"***",1:"")
+3 QUIT
+4 ;
CHECK ;Added SD/517
+1 NEW SDIEN,NODE,NODE0,HDFN,HDNAM,HDSN,POP
+2 SET SDIEN=0
SET NODE=""
SET HDAP1=SDAP1
+3 FOR
SET SDIEN=$ORDER(^SCE("B",SDAP,SDIEN))
if 'SDIEN
QUIT
Begin DoDot:1
+4 SET NODE=^SCE(SDIEN,0)
+5 if $PIECE(NODE,U,4)'=SDC
QUIT
+6 SET HDFN=$PIECE(NODE,U,2)
SET HDNAM=$PIECE(^DPT(HDFN,0),U)
SET HDSN=$PIECE(^(0),U,9)
+7 if $DATA(^UTILITY($JOB,"SDNMS",D,SDV,SDAP,HDNAM,HDSN))
QUIT
+8 SET POP=0
DO CHECK1
if POP
QUIT
+9 SET SDN1=$PIECE(NODE,U,2)
SET SDN2=$PIECE(^DPT(SDN1,0),U)
SET SDN3=$PIECE(^DPT(SDN1,0),U,9)
SET M1=""
SET SDC3=""
+10 DO NM2
End DoDot:1
+11 QUIT
+12 ;
CHECK1 ;Added SD/517
+1 SET HDAP1=$ORDER(^SC(SDC,"S",SDAP,1,HDAP1))
if 'HDAP1
QUIT
+2 if '$DATA(^SC(SDC,"S",SDAP,1,HDAP1,0))
QUIT
SET NODE0=^(0)
+3 IF $PIECE(NODE0,U,1)=HDFN
SET POP=1
QUIT
+4 QUIT
+5 ;
KILL ;added SD/517
KILL SDIEN,NODE,NODE0,POP,HDFN,HDNAM,HDSN,HDAP1
+1 QUIT
+2 ;
SETUTL ;SD*509 set Utility for null DFN, corrupt node will be deleted in SDCLAV1
+1 SET (SDN1,SDN2,SDN3)="UNKNOWN"
SET M1=0
+2 SET ^UTILITY($JOB,"SDNMS",D,SDV,SDAP,SDN2,SDN3)=M1_"^"_SDC_"^"_SDAP1
+3 QUIT
+4 ;