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

SDES2SDECBLKMOVE.m

Go to the documentation of this file.
SDES2SDECBLKMOVE ;ALB/BLB - SDES2 SDEC BLOCK AND MOVE JSON July 24, 2024
 ;;5.3;Scheduling;**886**;Aug 13, 1993;Build 13
 ;;Per VHA Directive 6402, this routine should not be modified
 ;
 Q
 ;
BLOCKANDMOVE(JSON,APPTIEN,RESOURCEIEN,TARGETDATETIME) ;
 N RETURN,ERRORS,BLOCKMOVERETURN,BLOCKANDMOVE,NEWAPPOINTMENT,SDCONTEXT,RESULTS,CLINICIEN
 ;
 D VALIDATE(.ERRORS,APPTIEN,RESOURCEIEN,.TARGETDATETIME,.CLINICIEN)
 I $D(ERRORS) S ERRORS("BlockAndMove")="" D BUILDJSON^SDESBUILDJSON(.JSON,.ERRORS) Q
 ;
 S SDCONTEXT("ACHERON AUDIT ID")="SDEC GUI RPC"
 S BLOCKANDMOVE("APPOINTMENT IEN")=APPTIEN
 S BLOCKANDMOVE("TARGET CLINIC")=CLINICIEN
 S BLOCKANDMOVE("TARGET DATE TIME")=TARGETDATETIME
 D BLOCKANDMOVE^SDES2BLOCKANDMOV(.BLOCKMOVERETURN,.SDCONTEXT,.BLOCKANDMOVE)
 D DECODE^XLFJSON("BLOCKMOVERETURN","RESULTS")
 ;
 I $G(RESULTS("BlockAndMoveAppointment","NewAppointmentIEN")) D  Q
 .S RETURN("BlockAndMove","NewAppointmentIEN")=$G(RESULTS("BlockAndMoveAppointment","NewAppointmentIEN"))
 .D BUILDJSON^SDES2JSON(.JSON,.RETURN)
 ;
 I '$G(RESULTS("BlockAndMoveAppointment","NewAppointmentIEN")) D
 .M JSON=BLOCKMOVERETURN
 Q
 ;
VALIDATE(ERRORS,APPTIEN,RESOURCEIEN,TARGETDATETIME,CLINICIEN) ;
 N TIMEZONEOFFSET
 ;
 D VALFILEIEN^SDES2VALUTIL(,.ERRORS,409.84,APPTIEN,1,,14,15)
 D VALFILEIEN^SDES2VALUTIL(,.ERRORS,409.831,RESOURCEIEN,1,,69,70)
 I $$NETTOFM^SDECDATE(TARGETDATETIME)<$$NOW^XLFDT D ERRLOG^SDES2JSON(.ERRORS,71)
 I $D(ERRORS) Q
 ;
 S CLINICIEN=$$GET1^DIQ(409.831,RESOURCEIEN,.04,"I")
 S TIMEZONEOFFSET=$$GETTZOFFSET^SDESUTIL($$NETTOFM^SDECDATE(TARGETDATETIME),CLINICIEN)
 ;
 S TARGETDATETIME=$P($$FMTISO^SDAMUTDT($$VALISODTTM^SDES2VALISODTTM(.ERRORS,$$FMTISO^SDAMUTDT($$NETTOFM^SDECDATE(TARGETDATETIME)),,1,9,11)),"-",1,3)_TIMEZONEOFFSET
 Q
 ;