source: WorldVistAEHR/trunk/r/SCHEDULING-SD-SC/SDAM3.m@ 1766

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

initial load of WorldVistAEHR

File size: 2.6 KB
Line 
1SDAM3 ;MJK/ALB - Appt Mgt (Clinic) ; 4/21/05 12:23pm
2 ;;5.3;Scheduling;**63,189,380,478,492**;Aug 13, 1993;Build 1
3 ;
4INIT ; -- get init clinic appt data
5 ; input: SDCLN := ifn of pat
6 ; output: ^TMP("SDAM" := appt array
7 S X=$P($G(^DG(43,1,"SCLR")),U,12),SDPRD=$S(X:X,1:2)
8 S X1=DT,X2=-SDPRD D C^%DTC S VALMB=X D RANGE^VALM11
9 I '$D(VALMBEG) S VALMQUIT="" G INITQ
10 S SDBEG=VALMBEG,SDEND=VALMEND
11 D CHGCAP^VALM("NAME","Patient")
12 S X="NO ACTION TAKEN" D LIST^SDAM
13INITQ K VALMB,VALMBEG,VALMEND Q
14 ;
15BLD ; -- scan apts
16 N VA,SDAMDD,SDNAME,SDMAX,SDLARGE,DFN,SDCL,BL,XC,XW,AC,AW,TC,TW,NC,NW,SC,SW,SDT,SDDA ; done for speed see INIT^SDAM10
17 D INIT^SDAM10
18 F SDT=SDBEG:0 S SDT=$O(^SC(SDCLN,"S",SDT)) Q:'SDT!($P(SDT,".",1)>SDEND) D
19 .F SDDA=0:0 S SDDA=$O(^SC(SDCLN,"S",SDT,1,SDDA)) Q:'SDDA S CNSTLNK=$P($G(^SC(SDCLN,"S",SDT,1,SDDA,"CONS")),U),CSTAT="" S:CNSTLNK'="" CSTAT=$P($G(^GMR(123,CNSTLNK,0)),U,12) D ;SD/478
20 ..I $D(^SC(SDCLN,"S",SDT,1,SDDA,0)) S DFN=+^(0) D ;SD/492
21 ...N NDX,DA,FND ;SD/492
22 ...S (FND,NDX)="" ;SD/492
23 ...F S NDX=$O(^TMP("SDAMIDX",$J,NDX)) Q:NDX="" D Q:FND ;SD/492
24 ....S DA=^TMP("SDAMIDX",$J,NDX) ;SD/492
25 ....I $P(DA,U,2)=DFN,$P(DA,U,3)=SDT,$P(DA,U,4)=SDCLN S FND=1 ;SD/492
26 ...Q:FND ;SD/492
27 ...D PID^VADPT I $D(^DPT(DFN,"S",SDT,0)),$$VALID^SDAM2(DFN,SDCLN,SDT,SDDA) S SDATA=^DPT(DFN,"S",SDT,0),SDCL=SDCLN,SDNAME=VA("BID")_" "_$P($G(^DPT(DFN,0)),U) D:SDCLN=+SDATA BLD1^SDAM1 ;SD/478,492
28 D NUL^SDAM10,LARGE^SDAM10:$D(SDLARGE)
29 S $P(^TMP("SDAM",$J,0),U,4)=VALMCNT
30 Q
31 ;
32HDR ; -- list screen header
33 ; input: SDCLN := ifn of pat
34 ; output: VALMHDR() := hdr array
35 ;
36 S VALMHDR(1)=$E($P("Clinic: "_$G(^SC(SDCLN,0)),"^",1),1,45) ;for proper display of clinic name for SD*5.3*189
37 Q
38 ;
39CLN ; -- change clinic
40 I $G(SDAMLIST)["CANCELLED" S VALMBCK="" W !!,*7,"You must be viewing a patient to list cancelled appointments." D PAUSE^VALM1 G CLNQ
41 D FULL^VALM1 S VALMBCK="R"
42 S X="" I $D(XQORNOD(0)) S X=$P($P(XQORNOD(0),U,4),"=",2)
43 W ! S DIC="^SC(",DIC(0)=$S(X]"":"",1:"A")_"EMQ",DIC("A")="Select Clinic: ",DIC("S")="I $P(^(0),U,3)=""C"",'$G(^(""OOS""))"
44 D ^DIC K DIC
45 I Y<0 D G CLNQ
46 .I SDAMTYP="C" S VALMSG=$C(7)_"Clinic has not been changed."
47 .I SDAMTYP="P" S VALMSG=$C(7)_"View of patient remains in affect."
48 I SDAMTYP'="C" D CHGCAP^VALM("NAME","Patient") S SDAMTYP="C"
49 N SDRES I SDAMTYP="C" S SDRES=$$CLNCK^SDUTL2(+Y,1) I 'SDRES D G CLNQ
50 .W !,?5,"Clinic MUST be corrected before continuing." D PAUSE^VALM1
51 S SDCLN=+Y K SDFN D BLD
52CLNQ Q
53 ;
Note: See TracBrowser for help on using the repository browser.