BSDX26 ; IHS/OIT/HMW/MSC/SAT - WINDOWS SCHEDULING RPCS ;
;;3.0;IHS WINDOWS SCHEDULING;;DEC 09, 2010
;
;
EDITAPTD(BSDXY,BSDXAPTID,BSDXNOTE) ;EP
;Entry point for debugging
;
;D DEBUG^%Serenji("EDITAPT^BSDX26(.BSDXY,BSDXAPTID,BSDXNOTE)")
Q
;
EDITAPT(BSDXY,BSDXAPTID,BSDXNOTE,BSDXLEN) ;EP Edit appointment (only note text and appontment length can be edited)
;
; BSDXAPTID - Appointment ID
; BSDXNOTE - Note
; BSDXLEN - If there is a change in the length of appointment, this is the new value (in minutes) for length
;
N BSDXNOD,BSDXPATID,BSDXSTART,DIK,DA,BSDXID,BSDXI,BSDXZ,BSDXIENS,BSDXEND
;
D ^XBKVAR
S X="ETRAP^BSDX26",@^%ZOSF("TRAP")
S BSDXI=0
K ^BSDXTMP($J)
S BSDXY="^BSDXTMP("_$J_")"
S ^BSDXTMP($J,BSDXI)="T00020ERRORID"_$C(30)
S BSDXI=BSDXI+1
TSTART
I '+BSDXAPTID D ERR(BSDXI,"BSDX26: Invalid Appointment ID") Q
I '$D(^BSDXAPPT(BSDXAPTID,0)) D ERR(BSDXI,"BSDX26: Invalid Appointment ID") Q
;Add WP field
;I BSDXNOTE]"" S BSDXNOTE(.5)=BSDXNOTE,BSDXNOTE=""
S BSDXNOTE(.5)=BSDXNOTE,BSDXNOTE=""
I $D(BSDXNOTE(0)) S BSDXNOTE(.5)=BSDXNOTE(0) K BSDXNOTE(0)
I $D(BSDXNOTE(.5)) D
. D WP^DIE(9002018.4,BSDXAPTID_",",1,"","BSDXNOTE","BSDXMSG")
;
;Edit appointment length
I $G(BSDXLEN),$G(BSDXLEN)>0 D
. S BSDXSTART=$$GET1^DIQ(9002018.4,BSDXAPTID,.01,"I"),BSDXEND=$$GET1^DIQ(9002018.4,BSDXAPTID,.02,"I")
. S BSDXOLEN=$$FMDIFF^XLFDT(BSDXEND,BSDXSTART,2),BSDXOLEN=BSDXOLEN/60
. Q:BSDXOLEN=BSDXLEN
. S BSDXRES=$$GET1^DIQ(9002018.4,BSDXAPTID,.07,"I") Q:'BSDXRES
. S BSDXPAT=$$GET1^DIQ(9002018.4,BSDXAPTID,.05,"I") Q:'BSDXPAT
. S BSDXCL=$$GET1^DIQ(9002018.1,BSDXRES,.04,"I") Q:'BSDXCL
. S BSDXAP=0 F S BSDXAP=$O(^SC(BSDXCL,"S",BSDXSTART,1,BSDXAP)) Q:'BSDXAP D
. . S BSDXIENS=BSDXAP_","_BSDXSTART_","_BSDXCL_","
. . I $$GET1^DIQ(44.003,BSDXIENS,.01,"I")=BSDXPAT,$$GET1^DIQ(44.003,BSDXIENS,1,"I")=BSDXOLEN D
. . . S FDA(44.003,BSDXIENS,1)=BSDXLEN D FILE^DIE(,"FDA") K FDA
. . . S BSDXNEND=$$FMADD^XLFDT(BSDXSTART,,,BSDXLEN)
. . . S FDA(9002018.4,BSDXAPTID_",",.02)=BSDXNEND D FILE^DIE(,"FDA") K FDA
;
;Return Recordset
TCOMMIT
S BSDXI=BSDXI+1
S ^BSDXTMP($J,BSDXI)="-1"_$C(30)
S BSDXI=BSDXI+1
S ^BSDXTMP($J,BSDXI)=$C(31)
Q
;
;
ERR(BSDXI,BSDXERR) ;Error processing
S BSDXI=BSDXI+1
TROLLBACK
S ^BSDXTMP($J,BSDXI)=BSDXERR_$C(30)
S BSDXI=BSDXI+1
S ^BSDXTMP($J,BSDXI)=$C(31)
Q
;
ETRAP ;EP Error trap entry
TROLLBACK
D ^%ZTER
I '$D(BSDXI) N BSDXI S BSDXI=999999
S BSDXI=BSDXI+1
D ERR(BSDXI,"BSDX26 Error: "_$G(%ZTERROR))
Q
BSDX26 ; IHS/OIT/HMW/MSC/SAT - WINDOWS SCHEDULING RPCS ;
+1 ;;3.0;IHS WINDOWS SCHEDULING;;DEC 09, 2010
+2 ;
+3 ;
EDITAPTD(BSDXY,BSDXAPTID,BSDXNOTE) ;EP
+1 ;Entry point for debugging
+2 ;
+3 ;D DEBUG^%Serenji("EDITAPT^BSDX26(.BSDXY,BSDXAPTID,BSDXNOTE)")
+4 QUIT
+5 ;
EDITAPT(BSDXY,BSDXAPTID,BSDXNOTE,BSDXLEN) ;EP Edit appointment (only note text and appontment length can be edited)
+1 ;
+2 ; BSDXAPTID - Appointment ID
+3 ; BSDXNOTE - Note
+4 ; BSDXLEN - If there is a change in the length of appointment, this is the new value (in minutes) for length
+5 ;
+6 NEW BSDXNOD,BSDXPATID,BSDXSTART,DIK,DA,BSDXID,BSDXI,BSDXZ,BSDXIENS,BSDXEND
+7 ;
+8 DO ^XBKVAR
+9 SET X="ETRAP^BSDX26"
SET @^%ZOSF("TRAP")
+10 SET BSDXI=0
+11 KILL ^BSDXTMP($JOB)
+12 SET BSDXY="^BSDXTMP("_$JOB_")"
+13 SET ^BSDXTMP($JOB,BSDXI)="T00020ERRORID"_$CHAR(30)
+14 SET BSDXI=BSDXI+1
+15 TSTART
+16 IF '+BSDXAPTID
DO ERR(BSDXI,"BSDX26: Invalid Appointment ID")
QUIT
+17 IF '$DATA(^BSDXAPPT(BSDXAPTID,0))
DO ERR(BSDXI,"BSDX26: Invalid Appointment ID")
QUIT
+18 ;Add WP field
+19 ;I BSDXNOTE]"" S BSDXNOTE(.5)=BSDXNOTE,BSDXNOTE=""
+20 SET BSDXNOTE(.5)=BSDXNOTE
SET BSDXNOTE=""
+21 IF $DATA(BSDXNOTE(0))
SET BSDXNOTE(.5)=BSDXNOTE(0)
KILL BSDXNOTE(0)
+22 IF $DATA(BSDXNOTE(.5))
Begin DoDot:1
+23 DO WP^DIE(9002018.4,BSDXAPTID_",",1,"","BSDXNOTE","BSDXMSG")
End DoDot:1
+24 ;
+25 ;Edit appointment length
+26 IF $GET(BSDXLEN)
IF $GET(BSDXLEN)>0
Begin DoDot:1
+27 SET BSDXSTART=$$GET1^DIQ(9002018.4,BSDXAPTID,.01,"I")
SET BSDXEND=$$GET1^DIQ(9002018.4,BSDXAPTID,.02,"I")
+28 SET BSDXOLEN=$$FMDIFF^XLFDT(BSDXEND,BSDXSTART,2)
SET BSDXOLEN=BSDXOLEN/60
+29 IF BSDXOLEN=BSDXLEN
QUIT
+30 SET BSDXRES=$$GET1^DIQ(9002018.4,BSDXAPTID,.07,"I")
IF 'BSDXRES
QUIT
+31 SET BSDXPAT=$$GET1^DIQ(9002018.4,BSDXAPTID,.05,"I")
IF 'BSDXPAT
QUIT
+32 SET BSDXCL=$$GET1^DIQ(9002018.1,BSDXRES,.04,"I")
IF 'BSDXCL
QUIT
+33 SET BSDXAP=0
FOR
SET BSDXAP=$ORDER(^SC(BSDXCL,"S",BSDXSTART,1,BSDXAP))
IF 'BSDXAP
QUIT
Begin DoDot:2
+34 SET BSDXIENS=BSDXAP_","_BSDXSTART_","_BSDXCL_","
+35 IF $$GET1^DIQ(44.003,BSDXIENS,.01,"I")=BSDXPAT
IF $$GET1^DIQ(44.003,BSDXIENS,1,"I")=BSDXOLEN
Begin DoDot:3
+36 SET FDA(44.003,BSDXIENS,1)=BSDXLEN
DO FILE^DIE(,"FDA")
KILL FDA
+37 SET BSDXNEND=$$FMADD^XLFDT(BSDXSTART,,,BSDXLEN)
+38 SET FDA(9002018.4,BSDXAPTID_",",.02)=BSDXNEND
DO FILE^DIE(,"FDA")
KILL FDA
End DoDot:3
End DoDot:2
End DoDot:1
+39 ;
+40 ;Return Recordset
+41 TCOMMIT
+42 SET BSDXI=BSDXI+1
+43 SET ^BSDXTMP($JOB,BSDXI)="-1"_$CHAR(30)
+44 SET BSDXI=BSDXI+1
+45 SET ^BSDXTMP($JOB,BSDXI)=$CHAR(31)
+46 QUIT
+47 ;
+48 ;
ERR(BSDXI,BSDXERR) ;Error processing
+1 SET BSDXI=BSDXI+1
+2 TROLLBACK
+3 SET ^BSDXTMP($JOB,BSDXI)=BSDXERR_$CHAR(30)
+4 SET BSDXI=BSDXI+1
+5 SET ^BSDXTMP($JOB,BSDXI)=$CHAR(31)
+6 QUIT
+7 ;
ETRAP ;EP Error trap entry
+1 TROLLBACK
+2 DO ^%ZTER
+3 IF '$DATA(BSDXI)
NEW BSDXI
SET BSDXI=999999
+4 SET BSDXI=BSDXI+1
+5 DO ERR(BSDXI,"BSDX26 Error: "_$GET(%ZTERROR))
+6 QUIT