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
;
--- Routine Detail --- with STRUCTURED ROUTINE LISTING ---[H[J[2J[HSDES2SDECBLKMOVE 1785 printed Dec 13, 2024@02:54:37 Page 2
SDES2SDECBLKMOVE ;ALB/BLB - SDES2 SDEC BLOCK AND MOVE JSON July 24, 2024
+1 ;;5.3;Scheduling;**886**;Aug 13, 1993;Build 13
+2 ;;Per VHA Directive 6402, this routine should not be modified
+3 ;
+4 QUIT
+5 ;
BLOCKANDMOVE(JSON,APPTIEN,RESOURCEIEN,TARGETDATETIME) ;
+1 NEW RETURN,ERRORS,BLOCKMOVERETURN,BLOCKANDMOVE,NEWAPPOINTMENT,SDCONTEXT,RESULTS,CLINICIEN
+2 ;
+3 DO VALIDATE(.ERRORS,APPTIEN,RESOURCEIEN,.TARGETDATETIME,.CLINICIEN)
+4 IF $DATA(ERRORS)
SET ERRORS("BlockAndMove")=""
DO BUILDJSON^SDESBUILDJSON(.JSON,.ERRORS)
QUIT
+5 ;
+6 SET SDCONTEXT("ACHERON AUDIT ID")="SDEC GUI RPC"
+7 SET BLOCKANDMOVE("APPOINTMENT IEN")=APPTIEN
+8 SET BLOCKANDMOVE("TARGET CLINIC")=CLINICIEN
+9 SET BLOCKANDMOVE("TARGET DATE TIME")=TARGETDATETIME
+10 DO BLOCKANDMOVE^SDES2BLOCKANDMOV(.BLOCKMOVERETURN,.SDCONTEXT,.BLOCKANDMOVE)
+11 DO DECODE^XLFJSON("BLOCKMOVERETURN","RESULTS")
+12 ;
+13 IF $GET(RESULTS("BlockAndMoveAppointment","NewAppointmentIEN"))
Begin DoDot:1
+14 SET RETURN("BlockAndMove","NewAppointmentIEN")=$GET(RESULTS("BlockAndMoveAppointment","NewAppointmentIEN"))
+15 DO BUILDJSON^SDES2JSON(.JSON,.RETURN)
End DoDot:1
QUIT
+16 ;
+17 IF '$GET(RESULTS("BlockAndMoveAppointment","NewAppointmentIEN"))
Begin DoDot:1
+18 MERGE JSON=BLOCKMOVERETURN
End DoDot:1
+19 QUIT
+20 ;
VALIDATE(ERRORS,APPTIEN,RESOURCEIEN,TARGETDATETIME,CLINICIEN) ;
+1 NEW TIMEZONEOFFSET
+2 ;
+3 DO VALFILEIEN^SDES2VALUTIL(,.ERRORS,409.84,APPTIEN,1,,14,15)
+4 DO VALFILEIEN^SDES2VALUTIL(,.ERRORS,409.831,RESOURCEIEN,1,,69,70)
+5 IF $$NETTOFM^SDECDATE(TARGETDATETIME)<$$NOW^XLFDT
DO ERRLOG^SDES2JSON(.ERRORS,71)
+6 IF $DATA(ERRORS)
QUIT
+7 ;
+8 SET CLINICIEN=$$GET1^DIQ(409.831,RESOURCEIEN,.04,"I")
+9 SET TIMEZONEOFFSET=$$GETTZOFFSET^SDESUTIL($$NETTOFM^SDECDATE(TARGETDATETIME),CLINICIEN)
+10 ;
+11 SET TARGETDATETIME=$PIECE($$FMTISO^SDAMUTDT($$VALISODTTM^SDES2VALISODTTM(.ERRORS,$$FMTISO^SDAMUTDT($$NETTOFM^SDECDATE(TARGETDATETIME)),,1,9,11)),"-",1,3)_TIMEZONEOFFSET
+12 QUIT
+13 ;