source: WorldVistAEHR/trunk/r/SCHEDULING-SD-SC/SDAMC.m@ 1147

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

initial load of WorldVistAEHR

File size: 2.7 KB
Line 
1SDAMC ;ALB/MJK - Cancel Appt Action ; 8/31/05 3:02pm
2 ;;5.3;Scheduling;**20,28,32,46,263,414,444,478**;Aug 13, 1993
3 ;
4EN ; -- protocol SDAM APPT CANCEL entry pt
5 ; input: VALMY := array entries
6 ;
7 N SDI,SDAT,VALMY,SDAMCIDT,CNT,L,SDWH,SDCP,SDREM,SDSCR,SDMSG,SCLHOLD
8 K ^UTILITY($J)
9 ;
10 ;
11 I '$D(DFN),$G(SDFN),($G(SDAMTYP)="P") S DFN=SDFN
12 ;
13 S VALMBCK=""
14 D SEL^VALM2,CHK G ENQ:'$O(VALMY(0))
15 D FULL^VALM1 S VALMBCK="R"
16 S SDWH=$$WHO,SDCP=$S(SDWH="C":0,1:1) G ENQ:SDWH=-1
17 S SDSCR=$$RSN(SDWH) G ENQ:SDSCR=-1
18 S (TMPD,SDREM)=$$REM G ENQ:SDREM=-1 ;SD/478
19 S (SDI,CNT,L)=0
20 F S SDI=$O(VALMY(SDI)) Q:'SDI I $D(^TMP("SDAMIDX",$J,SDI)) K SDAT S SDAT=^(SDI) W !,^TMP("SDAM",$J,+SDAT,0) D CAN($P(SDAT,U,2),$P(SDAT,U,3),.CNT,.L,SDWH,SDCP,SDSCR,SDREM)
21 I SDAMTYP="P" D BLD^SDAM1
22 I SDAMTYP="C" D BLD^SDAM3
23ENQ Q
24 ;
25CAN(DFN,SDT,CNT,L,SDWH,SDCP,SDSCR,SDREM) ;
26 N A1,NDT S NDT=SDT
27 I $P($G(^DPT(DFN,"S",NDT,0)),U,2)["C" W !!,"Appointment already cancelled" H 2 G CANQ
28 I $D(^DPT(DFN,"S",NDT,0)) S SD0=^(0) I $P(SD0,"^",2)'["C" S SC=+SD0,L=L\1+1,APL="" D FLEN^SDCNP1A S ^UTILITY($J,"SDCNP",L)=NDT_"^"_SC_"^"_COV_"^"_APL_"^^"_APL_"^^^^^^"_SDSP D CHKSO^SDCNP0 ;SD/478
29 ;SD*5.3*414 next line added to set hold variable SCLHOLD for clinic ptr
30 S APP=1,A1=L\1 S SCLHOLD=$P(^UTILITY($J,"SDCNP",A1),U,2) D BEGD^SDCNP0
31 D MES,NOPE W ! S (CNT,L)=0 K ^UTILITY($J,"SDCNP")
32CANQ ;
33 ;Wait List Message
34 ;
35 I $G(SCLHOLD)'="" S:'$D(SDCLN) SDCLN=SCLHOLD ; SD*5.3*414
36 I $G(SDCLN)'="",$D(^SDWL(409.3,"SC",SDCLN)) D
37 .W !,?1,"There are Patients on the Wait List waiting for an Appointment in the",!?1,$P(^SC(SDCLN,0),U,1)," Clinic.",!
38 S DIR(0)="E" D ^DIR W !
39 K:SDAMTYP="P" SDCLN
40 K SCLHOLD,SC,COV,APP
41 Q
42MES ; -- set error message
43 S SDMSG="W !,""Enter appt. numbers separated by commas and/or a range separated"",!,""by dashes (ie 2,4,6-9)"" H 2"
44 Q
45 ;
46WHO() ;
47 W ! S DIR(0)="SOA^PC:PATIENT;C:CLINIC",DIR("A")="Appointments cancelled by (P)atient or (C)linic: ",DIR("B")="Patient"
48 D ^DIR K DIR
49 Q $S(Y=""!(Y="^"):-1,1:Y)
50 ;
51RSN(SDWH) ;
52RSN1 W ! S DIC="^SD(409.2,",DIC(0)="AEMQ",DIC("S")="I '$P(^(0),U,4),"""_$E(SDWH)_"B""[$P(^(0),U,2)" D ^DIC K DIC
53 I X["^" G RSNQ
54 I Y<0 W *7 G RSN1
55RSNQ Q +Y
56 ;
57REM() ;
58 W ! S DIR(0)="2.98,17" D ^DIR K DIR
59 I $E(X)="^" S Y=-1
60 Q Y
61 ;
62NOPE ;
63 N SDEND,SDPAUSE
64 S:'CNT SDPAUSE=1
65 D NOPE^SDCNP1
66 D:$G(SDPAUSE) PAUSE^VALM1
67 Q
68 ;
69CHK ; -- check if status of appt permits cancelling
70 N SDI S SDI=0
71 F S SDI=$O(VALMY(SDI)) Q:'SDI I $D(^TMP("SDAMIDX",$J,SDI)) K SDAT S SDAT=^(SDI) I '$D(^SD(409.63,"ACAN",1,+$$STATUS^SDAM1($P(SDAT,U,2),$P(SDAT,U,3),+$G(^DPT(+$P(SDAT,U,2),"S",+$P(SDAT,U,3),0)),$G(^(0))))) D
72 .W !,^TMP("SDAM",$J,+SDAT,0),!!,*7,"You cannot cancel this appointment."
73 .K VALMY(SDI) D PAUSE^VALM1
74 Q
Note: See TracBrowser for help on using the repository browser.