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

BSDX26.m

Go to the documentation of this file.
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