Home   Package List   Routine Alphabetical List   Global Alphabetical List   FileMan Files List   FileMan Sub-Files List   Package Component Lists   Package-Namespace Mapping  
Routine: SDESCCAVAIL2

SDESCCAVAIL2.m

Go to the documentation of this file.
SDESCCAVAIL2 ;ALB/BWF - VISTA SCHEDULING RPCS CANCEL CLINIC AVAILABILITY UTILITIES ; August 30, 2022
 ;;5.3;Scheduling;**824**;Aug 13, 1993;Build 3
 ;;Per VHA Directive 6402, this routine should not be modified
 ;
 ;
 Q  ;No Direct Call
 ;
COED(SDCL,SDBEG,SDEND,SDMSG) ; -- scan appts for those co'ed
 N SDDA,SDATE,SD0,SDC,SDESC
 S SDESC=0,SDATE=SDBEG-.0000001
 F  S SDATE=$O(^SC(SDCL,"S",SDATE)) Q:'SDATE!(SDATE>SDEND)  D
 .S SDDA=0 F  S SDDA=$O(^SC(SDCL,"S",SDATE,1,SDDA)) Q:'SDDA  D
 ..I $$GET1^DIQ(44.003,SDDA_","_SDATE_","_SDCL_",",310,"I")="C" Q
 ..I $$GET1^DIQ(44.003,SDDA_","_SDATE_","_SDCL_",",303,"I") S SDESC=1
 Q SDESC
 ;
CHKOVERLAP(CANARY,FROM,TO) ;
 N CHKDT,SDERR
 S (CHKDT,SDERR)=0
 F  S CHKDT=$O(CANARY(CHKDT)) Q:'CHKDT!(SDERR)  D
 .S SDERR=$S(FROM'<CHKDT&(FROM<CANARY(CHKDT)):1,TO>CHKDT&(TO<CANARY(CHKDT)):1,1:0) Q:SDERR
 .I CHKDT'<FROM&(CHKDT<TO) S SDERR=1 Q
 I $G(SDERR) Q 1
 Q 0
 ;
TC(TIME,SD,STARTOFDAY,SI) ;
 N %DT,X,Y,SDXX,FTIME,MSG
 ; fix times less than 4 characters
 S FTIME=SD_"."_TIME
 S FTIME=$P($$FMTE^XLFDT(FTIME,"T"),"@",2)
 S FTIME=$TR(FTIME,":","")
 S X=$$FMTE^XLFDT(SD)_"@"_FTIME,%DT="T"
 D ^%DT
 I Y<0!(X["?") Q ""
 S X=$E($P(Y_"0000",".",2),1,4)
 S SDXX=$E(X,3,4)
 S SDXX=X\100-STARTOFDAY*SI+(SDXX*SI\60)*2
 I SDXX<0 S MSG="Day Starts at "_STARTOFDAY,Y=-1
 I SDXX>72 S MSG="Day Ends prior to provided end time "_X,Y=-1
 Q X_U_Y_U_SDXX_U_$G(MSG)
 ;
CK1(CANDTTM,DFN,SDIV) ;
 N SDX,SD1,CANDATE,CANDATELOOP,SDQUIT,STATUS,CANDATE
 S SDQUIT=0
 S (CANDATELOOP,CANDATE)=$P(CANDTTM,".")
 F  S CANDATELOOP=$O(^DPT(DFN,"S",CANDATELOOP)) Q:'CANDATELOOP!(CANDATELOOP'=CANDATE)  D
 .S STATUS=$$GET1^DIQ(2.98,CANDATELOOP_","_DFN_",",3,"I")
 .I STATUS'["C",STATUS'["N" S SDQUIT=1
 Q:SDQUIT
 F SD1=2,4 I $D(^SC("AAS",CANDTTM,CANDATE,DFN)) S SDQUIT=1 Q:SDQUIT
 I $D(^SCE(+$$EXAE^SDOE(DFN,CANDATE,CANDATE),0)) S SDQUIT=1 Q:SDQUIT
 ; future - try to locate index for the below line to properly kill it with fileman
 K ^DPT("ASDPSD","B",SDIV,CANDATE,DFN)
 Q
 ;
EVT(DFN,SDTTM,SDSC,SDPL,SDCNHDL) ; -- separate tag if need to NEW vars
 ; -- cancel event
 N FR,I,SDTIME,DH,SC
 D CANCEL^SDAMEVT(.SDATA,DFN,SDTTM,SDSC,SDPL,0,SDCNHDL) K SDATA,SDCNHDL
 Q
 ;