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

SDEC06.m

Go to the documentation of this file.
SDEC06 ;ALB/SAT,WTC - VISTA SCHEDULING RPCS ;Feb 12, 2020@15:22
 ;;5.3;Scheduling;**627,694**;Aug 13, 1993;Build 61
 ;
 Q
 ;
TPBLKOV(SDECY,SDECSTART,SDECEND,SDECRES) ;TYPE BLOCKS OVERLAP
 ;TPBLKOV(SDECY,SDECSTART,SDECEND,SDECRES)  external parameter tag in SDEC
 ;SDECSTART - Start date/time in external format
 ;SDECEND   - End date/time in external format
 ;SDECRES   - Resource name from the NAME field of the SDEC RESOURCE file
 ;SDECRES is resource name
 ;RETURN:
 ;Returns a Global Array in which each array entry contains data Access Block data separated by ^:
 ; 1. StartTime
 ; 2. EndTime
 ; 3. AppointmentTypeID
 ; 4. AvailabilityID
 ; 5. ResourceName
 N SDAB,SDECERR,SDECIEN,SDECDEP,SDECBS,SDECI,SDECNEND,SDECNSTART,SDECPEND,SDECRESD,SDECRESN,SDECS,SDECTPID,SDECNOD,SDECAD
 N %DT,X,Y
 S SDAB="^TMP("_$J_",""SDEC"",""BLKS"")"
 K @SDAB
 K ^TMP("SDEC",$J)
 S SDECERR=""
 S SDECY="^TMP(""SDEC"","_$J_")",SDECI=0
 S ^TMP("SDEC",$J,SDECI)="D00030StartTime^D00030EndTime^I00010AppointmentTypeID^I00010AvailabilityID^T00030ResourceName"_$C(30)
 D
 . S SDECBS=0
 . ;
 . ;  Change date/time conversion so midnight is handled properly.  wtc 694 5/17/18
 . ;
 . S SDECSTART=$$NETTOFM^SDECDATE(SDECSTART,"Y","Y") I SDECSTART=-1 S ^TMP("SDEC",$J,1)=$C(31) Q
 . ;S:SDECSTART["@0000" SDECSTART=$P(SDECSTART,"@")
 . ;S:SDECEND["@0000" SDECEND=$P(SDECEND,"@")
 . ;S %DT="T",X=SDECSTART D ^%DT S SDECSTART=Y
 . ;I SDECSTART=-1 S ^TMP("SDEC",$J,1)=$C(31) Q
 . S SDECEND=$$NETTOFM^SDECDATE(SDECEND,"Y","Y") I SDECSTART=-1 S ^TMP("SDEC",$J,1)=$C(31) Q
 . ;S %DT="T",X=SDECEND D ^%DT S SDECEND=Y
 . ;I SDECEND=-1 S ^TMP("SDEC",$J,1)=$C(31) Q
 . I $L(SDECEND,".")=1 S SDECEND=SDECEND+.9999 ;Go to end of day
 . S SDECRESN=SDECRES
 . Q:SDECRESN=""
 . I +SDECRESN S SDECRESD=SDECRESN,SDECRESN=$P($G(^SDEC(409.831,+SDECRESN,0)),U,1)
 . E  S SDECRESD=$O(^SDEC(409.831,"B",SDECRESN,0))
 . I ('+SDECRESD)!('$D(^SDEC(409.831,+SDECRESD,0))) Q
 . D GETSLOTS^SDEC04(SDAB,SDECRESD,SDECSTART,SDECEND)
 . D STCOMM(SDECRESN,SDECRESD,SDAB)
 . Q
 ;
 S ^TMP("SDEC",$J,SDECI)=^TMP("SDEC",$J,SDECI)_$C(31)
 K @SDAB
 Q
 ;
STCOMM(SDECRESN,SDECRESD,SDAB) ;EP
 ;
 S SDECNEND=0,SDECNSTART=0,SDECPEND=0
 ;
 N SDI
 S SDI=0 F  S SDI=$O(@SDAB@(SDI)) Q:SDI'>0  D
 .S SDECNOD=@SDAB@(SDI)
 .S SDECNSTART=$P(SDECNOD,U,2)
 .S SDECNEND=$P(SDECNOD,U,3)
 .I SDECNEND'>SDECSTART Q
 . ;
 . ;  Change date/time conversion so midnight is handled properly.  wtc 694 5/17/18
 . ;
 . S SDECNSTART=$$FMTONET^SDECDATE(SDECNSTART,"Y") ;
 . ;S Y=SDECNSTART X ^DD("DD") S SDECNSTART=$TR(Y,"@"," ")
 . S SDECNEND=$$FMTONET^SDECDATE(SDECNEND,"Y") ;
 . ;S Y=SDECNEND X ^DD("DD") S SDECNEND=$TR(Y,"@"," ")
 .S SDECTPID=$P(SDECNOD,U,5)
 .S SDECI=SDECI+1
 .S ^TMP("SDEC",$J,SDECI)=SDECNSTART_U_SDECNEND_U_+SDECTPID_U_SDI_U_SDECRESN_$C(30)
 Q