BSDX26	; IHS/OIT/HMW - WINDOWS SCHEDULING RPCS ;
	;;1.4;BSDX;;Sep 07, 2010
	;
	;
EDITAPTD(BSDXY,BSDXAPTID,BSDXNOTE)	;EP
	;Entry point for debugging
	;
	;D DEBUG^%Serenji("EDITAPT^BSDX26(.BSDXY,BSDXAPTID,BSDXNOTE)")
	Q
	;
EDITAPT(BSDXY,BSDXAPTID,BSDXNOTE)	;EP Edit appointment (only note text can be edited)
	;
	N BSDXNOD,BSDXPATID,BSDXSTART,DIK,DA,BSDXID,BSDXI,BSDXZ,BSDXIENS
	;
	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")
	;
	;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
