source: FOIAVistA/trunk/r/SCHEDULING-SD-SC/SDCLAS.m@ 1154

Last change on this file since 1154 was 628, checked in by George Lilly, 15 years ago

initial load of FOIAVistA 6/30/08 version

File size: 3.6 KB
Line 
1SDCLAS ;ALB/TMP,MRY - Clinic Assignment List Extract ;12/23/92 11:42
2 ;;5.3;Scheduling;**63,243,517,523**;Aug 13, 1993;Build 6
3 ;SD/517 CORRECTED ALL $NEXT FUNCTIONAL COMMANDS
4 S DIV="" D DIV^SDUTL I $T D CALST^SDDIV Q:Y<0
5 S:'$D(DTIME) DTIME=300 I '$D(DT) D DT^SDUTL
6 S SDIFN="",SDI=0,DIC="^SC(",DIC(0)="EFMQ",DIC("S")="I $P(^(0),U,3)=""C"",'$G(^(""OOS"")),$S(DIV="""":1,$P(^(0),U,15)=DIV:1,1:0)" D SELECT^SDCLAS0 K DIC Q:X["^"
7 S Y=DT D DTS^SDUTL S SDTS=Y
8OPT2 W !!,"Select 'As of' Date: ",SDTS," // " R X:DTIME Q:X["^" I X']"" S SDTS=DT G OVR
9 S %DT(0)=-DT,%DT="EPX" D ^%DT K %DT
10 I Y'>0 W !,*7,"A date must be entered here to get a 'snapshot' of the clinic's enrollment as of",!," this date. Date can not be in future." G OPT2
11 S SDTS=+Y
12OVR I SDSRT="C",SDSAV']"",SDIFN'="ALL",$S('$D(^SC(SDIFN,"I")):0,+^("I")=0:0,+^("I")>SDTS:0,+$P(^("I"),"^",2)'>SDTS&(+$P(^("I"),"^",2)'=0):0,1:1) W !,"Clinic ",$S(SDTS=DT:"is",1:"was")," inactive" W:SDTS<DT " on date selected" G END^SDCLAS1
13 W !!,*7,"This needs to be printed at 132 columns"
14 S PGM="START^SDCLAS",VAR="SDIFN^SDSRT^DIV^SDTS^SDSAV^SDFAST",VAL=SDIFN_"^"_SDSRT_"^"_DIV_"^"_SDTS_"^"_SDSAV_"^"_SDFAST D ZIS^DGUTQ Q:POP
15START K ^UTILITY($J) S SDSTOP=$S(SDSRT="S":SDIFN,1:""),SD1="",U="^" U IO G:SDIFN="ALL"!(SDSRT="S")!(SDSAV]"") ALL
16ONE S ONE=1 D INIT F SDAPPT=SDTS:0 S SDAPPT=$O(^SC(SDIFN,"S",SDAPPT)) Q:SDAPPT'>0 D PT
17 D:'SDFAST AEB^SDCLAS0 G ^SDCLAS1
18ALL S ONE=0 I SDSAV']"" S SDIFN=0 F S SDIFN=$O(^SC(SDIFN)) Q:'SDIFN I $P(^(SDIFN,0),"^",3)="C" D APPT
19 I SDSAV]"" D APART S SDIFN=0 F S SDIFN=$O(SDZ(SDIFN)) Q:'SDIFN I $D(^SC(SDIFN,0)),$P(^(0),"^",3)="C" D APPT
20 G ^SDCLAS1
21APPT D CHECK I 'POP K ^UTILITY($J,"PAT",SDIFN) D INIT F SDAPPT=SDTS:0 S SDAPPT=$O(^SC(SDIFN,"S",SDAPPT)) D:SDAPPT>0 PT I SDAPPT'>0 D:'SDFAST AEB^SDCLAS0 Q
22 Q
23PT S SD=0 F S SD=$O(^SC(SDIFN,"S",SDAPPT,1,SD)) Q:'SD Q:'$D(^(SD,0)) S DFN=+^(0) D PT1
24 Q
25PT1 I '$D(^UTILITY($J,"PAT",SDIFN,DFN)),$D(^DPT(DFN,0)),$D(^("S",SDAPPT,0)),$P(^(0),"^",2)=""!($P(^(0),"^",2)="I"),$S('$D(^DPT(DFN,.35)):1,'^(.35):1,1:0) D S,EXT^SDCLAS0
26 Q
27S S Y(0)=^DPT(DFN,0),SDACT=1,SDENR=0 D SET1
28 S I=0 F S I=$O(^DPT(DFN,"DE","B",SDIFN,I)) Q:'I I $D(^DPT(DFN,"DE",I,0)) D EDENR Q:SDENR
29 S ^UTILITY($J,"PAT",SDIFN,DFN)="" S:'$D(Y(1))!('SDENR) Y(1)="" I '$D(^UTILITY($J,"PAT"," ",DFN)) D MT S ^UTILITY($J,"PAT"," ",DFN)=$P(Y(0),"^",9)_"^"_SDELIG_"^"_SDZIP_"^"_$P(Y(0),"^",3)_U_SDMT
30 Q
31EDENR K Y(1) S I1=0 F S I1=$O(^DPT(DFN,"DE",I,1,I1)) Q:'I1 S X=$P(^(I1,0),"^"),X(1)=$P(^(0),"^",3) Q:X>SDTS S:'X(1)!(X(1)>SDTS) Y(1)=^(0),SDENR=1 Q:SDENR
32 Q
33SET1 S SDELIG=$S($D(^DPT(DFN,.36)):$P(^(.36),"^",1),1:""),SDELIG=$S($D(^DIC(8,+SDELIG,0)):SDELIG,1:""),SDELIG(1)=$S(SDELIG]"":$P(^(0),"^",5),1:""),SDZIP=$S($D(^DPT(DFN,.11)):$P(^(.11),"^",6),1:"")
34 Q
35MT ;
36 S SDMT="*" Q:SDELIG(1)']"" I SDELIG(1)="N" S SDMT="N" Q
37 S SDMT=$$LST^DGMTU(DFN) I SDMT']"" S SDMT=$S(SDELIG'=6:"A",1:"X") Q
38 S:$P(SDMT,U,2)>SDTS SDMT=$$LST^DGMTU(DFN,SDTS)
39 I $P(SDMT,U,4)="P" S SDMT=$$PA^DGMTUTL($P(SDMT,U)),SDMT=$S('$D(SDMT):"U",SDMT="MT":"C",SDMT="GMT":"G",1:"U")
40 E S SDMT=$P(SDMT,U,4)
41 I SDMT="" S SDMT="X"
42 I SDMT="P" S SDMT="C"
43 I SDMT="R" S SDMT="U"
44 I SDMT="N" S SDMT="A"
45 D DOM^SDOPC4(DFN,SDTS_.9,.SDMT) I SDMT="X0" S SDMT="X"
46 K SDMT1 Q
47CHECK S POP=0 I SDSRT="S",SDSTOP'="ALL",$P(^SC(SDIFN,0),"^",7)'=SDSTOP S POP=1 Q
48 I $S(DIV="":1,$P(^SC(SDIFN,0),"^",15)=DIV:1,1:0),$S('$D(^SC(SDIFN,"I")):1,+^("I")=0:1,+^("I")>DT:1,+$P(^("I"),"^",2)'>DT&(+$P(^("I"),"^",2)'=0):1,1:0) Q
49 S POP=1 Q
50APART S SDZ="" F I=1:1 Q:$P(SDSAV,",",I)']"" S SDZ=$P(SDSAV,",",I) D:SDZ["--" SPLIT^SDCLAS0 I SDZ'["--" S:'$D(SDZ(+SDZ)) SDZ(+SDZ)=""
51 Q
52INIT F I1="SDENR","SDACT" S I2="^UTILITY("_$J_","""_I1_""","_SDIFN_")",@I2=0
53 Q
Note: See TracBrowser for help on using the repository browser.