source: FOIAVistA/trunk/r/SCHEDULING-SD-SC/SDN0.m@ 1328

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

initial load of FOIAVistA 6/30/08 version

File size: 2.3 KB
Line 
1SDN0 ;ALB/TMP - NO SHOW AUTO-REBOOK ; 6/21/04 2:09pm
2 ;;5.3;Scheduling;**381**;Aug 13, 1993
3START U IO K ^UTILITY($J) I C="ALL" K C
4 ;G:ANS'["Y" PLET
5 I ANS'["Y" G PLET:$D(C),^SDN1
6 I $D(C),$P(^SC(C,0),"^",3)="C",$S($P(^(0),"^",15)="":1,$P(^(0),"^",15)=SDV1:1,1:0) S SC=C D OVR G PLET
7 G:$D(C) END
8 S SDQ=0
9 F S SDQ=$O(^SC(SDQ)) Q:+SDQ=0 D
10 .I $P(^SC(SDQ,0),"^",3)="C",$S($P(^(0),"^",15)="":1,$P(^(0),"^",15)=SDV1:1,1:0),($O(^SC(SDQ,"S",SDT))\1)=SDT S SC=SDQ D OVR
11 ;G PLET
12 G END:ALS="N",^SDN1
13OVR S SL=$S($D(^SC(SC,"SL")):^("SL"),1:"") Q:'SL S %=$P(SL,U,6),SI=$S(%="":4,%<3:4,%:%,1:4),%=$P(SL,U,3),STARTDAY=$S(%:%,1:8),SDSTRTDT=$S(DT>SDT:DT,1:SDT),STIME=$S($D(^SC(SC,"SDP")):$P(^("SDP"),U,3),1:"0800")
14 S CDATE=SDT,SDNOSH="" D ^SDAUT1
15 I MAX=0 W !,"AUTO-REBOOKING NOT ALLOWED FOR CLINIC ",$P(^SC(SC,0),"^",1) Q
16 K FSW
17 S GDATE=CDATE
18 F S GDATE=$O(^SC(SC,"S",GDATE)) Q:GDATE=""!(GDATE>(CDATE+1)) D
19 .S L=0
20 .F S L=$O(^SC(SC,"S",GDATE,1,L)) Q:L="" S A=^(L,0) I $D(^DPT(+A,"S",GDATE,0)),$P(^(0),"^",2)="N",$P(^(0),"^",14)=SDTIME D MAXCK D:'POP EN1^SDAUT2 D ^SDNP
21 W:$G(ALS)="Y" @IOF
22 Q
23PLET S SDC=SC,SDFORM="" I $D(^DG(40.8,SDV1,"LTR")),^("LTR") S SDFORM=^("LTR")
24 S SDLET="" I $D(^SC(SC,"LTR")),^("LTR") S SDLET=+^("LTR")
25 I ALS["Y"&(SDLET) G ^SDN1
26 W:ALS="Y"&('SDLET) !,$P(^SC(SC,0),"^")," DOES NOT HAVE A NO-SHOW LETTER ASSIGNED TO IT" G END
27MAXCK S POP=0,SDC=SC,SDC=$S('$D(^SC(SC,"SL")):SC,$P(^("SL"),"^",5)']"":SC,1:$P(^("SL"),"^",5))
28 K SDIS
29 S I=0
30 F S I=$O(^DPT(+A,"DE","B",SDC,I)) Q:I=""!($D(SDIS)) D
31 .I $D(^DPT(+A,"DE",I)) D
32 ..S I1=0
33 ..F S I1=$O(^DPT(+A,"DE",I,1,I1)) Q:I1="" S SDD=$P(^(I1,0),"^",3)\1 I '(SDD-SDDT),$P(^(0),"^",4)["Exceeded" D SETM Q
34 Q
35SETM S POP=1,(SDIS,NDATE,DUPE)="",MESS="No rebook - Max. # of consecutive no-shows ("_$S($D(^SC(SC,"SDP")):+^("SDP"),1:"")_") has been exceeded"
36 Q
37END K %,%DT,%I,%IS,A,A0,A1,A2,ALL,ALS,ANS,BY,CDATE,DA,DATEND,DFN,DH,DHD,DIC,DIS,DIV,DO,DOW,DUPE,F,F1,FLDS,FR,GDATE,I,I1,J,L,K,LET,MAX,MESS,NOAP,P,POP,S1,SC,SD,SD1,SD2,SDD,SDDT,SDMSG,SI,SL,SS,ST,SDSTRTDT,STARTDAY,TO,X,Y,ADDR,B,CLIN,HX,LL
38 K DGPGM,DGVAR,Z,D,ENDATE,NDATE,J,SM,SM1,SDTIME,STIME,X1,X2,SDC,SDCT,SDIS,SDRE,SDRE1,SDIN,SDYES,SDT,SDTADE,SDTADB,SDPRT,SDMDT,SDCTR,SDCMAX,SDCONS,SDDIF,SDED,SDFORM,SDLET,SDLT1,SDNOSH,SDQ,SDSOH,SDSTAT,SDZSC,VAUTC,SDV1
39 K %ZIS,PDAT,S,TIME,TST,Y1 D CLOSE^DGUTQ Q
Note: See TracBrowser for help on using the repository browser.