PXAPIEED ;ISL/dee - PCE's API to ask standalone encounter or add then edit it or to delete a standalone ;9/5/96
;;1.0;PCE PATIENT CARE ENCOUNTER;**1**;Aug 12, 1996
Q
;
ENCEDIT(WHAT,PACKAGE,SOURCE,DFN,BEGINDT,ENDDT,HLOC,SCREEN,APPOINT,PROMPT,COSTATUS) ;--Ask for encounter the edit it of delete it
;
; >0 = VISIT IEN
; D^Visit IEN = User selected to delete and the visit ien that was deleted
; -1 = nothing was done (user did not select visit or ^-out)
; -2^text = error of some kind^simple text message
; -3^text = error in deleting^simple text message
;
N VISITIEN,PXRESULT,PXRETURN,PXVISIT,PXBEGDT
I $G(DFN)<1 S DFN=$$ASKPAT^PXBAPI1()
Q:DFN<1 -1
S PXBEGDT=$S($$SWITCHD^PXAPI>BEGINDT:$$SWITCHD^PXAPI,1:BEGINDT)
S VISITIEN=$$VISITLST^PXAPI(DFN,PXBEGDT,ENDDT,HLOC,SCREEN,APPOINT,PROMPT,COSTATUS)
I $P(VISITIEN,"^",1)="D" D
. S PXRESULT=$$DELVFILE^PXAPI("ALL",$P(VISITIEN,"^",2),"","",1,1)
. I PXRESULT=1 S PXRETURN=VISITIEN
. E I PXRESULT=0 S PXRETURN="-3^ONLY PARTLY DELETED"
. E I PXRESULT=-1 S PXRETURN=-1
. E I PXRESULT<-1 S PXRETURN="-3^ERROR IN TRYING TO DELETE"
E I VISITIEN>0!(VISITIEN="A") D
. S PXVISIT=$S(VISITIEN>0:VISITIEN,1:"")
. S PXRESULT=$$INTV^PXAPI(WHAT,PACKAGE,SOURCE,VISITIEN,$S(VISITIEN="A":HLOC,1:""),DFN,"",$$SWITCHD^PXAPI)
. I PXRESULT'<0 S PXRETURN=PXVISIT
. E I PXRESULT=-1 S PXRETURN=-1
. E I PXRESULT<-1 S PXRETURN="-2^ERROR IN TRYING TO DO INTERVIEW"
E S PXRETURN=VISITIEN
Q PXRETURN
;
LOPENCED(WHAT,PACKAGE,SOURCE,DFN,BEGINDT,ENDDT,HLOC,SCREEN,APPOINT,PROMPT,COSTATUS) ;
;
; Returns:
; 0 = all oky doky
; -1 = nothing was done (user did not select visit or ^-out)
; -2^text = error of some kind^simple text message
; -3^text = error in deleting^simple text message
;
N PXRETURN,PXRESULT
S PXRESULT=-1
F D Q:PXRETURN<0
. S PXRETURN=$$ENCEDIT(WHAT,PACKAGE,SOURCE,DFN,BEGINDT,ENDDT,HLOC,SCREEN,APPOINT,PROMPT,COSTATUS)
. I PXRETURN'<0 S PXRESULT=0
Q $S(PXRETURN<-1:PXRETURN,1:PXRESULT)
;
PXAPIEED ;ISL/dee - PCE's API to ask standalone encounter or add then edit it or to delete a standalone ;9/5/96
+1 ;;1.0;PCE PATIENT CARE ENCOUNTER;**1**;Aug 12, 1996
+2 QUIT
+3 ;
ENCEDIT(WHAT,PACKAGE,SOURCE,DFN,BEGINDT,ENDDT,HLOC,SCREEN,APPOINT,PROMPT,COSTATUS) ;--Ask for encounter the edit it of delete it
+1 ;
+2 ; >0 = VISIT IEN
+3 ; D^Visit IEN = User selected to delete and the visit ien that was deleted
+4 ; -1 = nothing was done (user did not select visit or ^-out)
+5 ; -2^text = error of some kind^simple text message
+6 ; -3^text = error in deleting^simple text message
+7 ;
+8 NEW VISITIEN,PXRESULT,PXRETURN,PXVISIT,PXBEGDT
+9 IF $GET(DFN)<1
SET DFN=$$ASKPAT^PXBAPI1()
+10 IF DFN<1
QUIT -1
+11 SET PXBEGDT=$SELECT($$SWITCHD^PXAPI>BEGINDT:$$SWITCHD^PXAPI,1:BEGINDT)
+12 SET VISITIEN=$$VISITLST^PXAPI(DFN,PXBEGDT,ENDDT,HLOC,SCREEN,APPOINT,PROMPT,COSTATUS)
+13 IF $PIECE(VISITIEN,"^",1)="D"
Begin DoDot:1
+14 SET PXRESULT=$$DELVFILE^PXAPI("ALL",$PIECE(VISITIEN,"^",2),"","",1,1)
+15 IF PXRESULT=1
SET PXRETURN=VISITIEN
+16 IF '$TEST
IF PXRESULT=0
SET PXRETURN="-3^ONLY PARTLY DELETED"
+17 IF '$TEST
IF PXRESULT=-1
SET PXRETURN=-1
+18 IF '$TEST
IF PXRESULT<-1
SET PXRETURN="-3^ERROR IN TRYING TO DELETE"
End DoDot:1
+19 IF '$TEST
IF VISITIEN>0!(VISITIEN="A")
Begin DoDot:1
+20 SET PXVISIT=$SELECT(VISITIEN>0:VISITIEN,1:"")
+21 SET PXRESULT=$$INTV^PXAPI(WHAT,PACKAGE,SOURCE,VISITIEN,$SELECT(VISITIEN="A":HLOC,1:""),DFN,"",$$SWITCHD^PXAPI)
+22 IF PXRESULT'<0
SET PXRETURN=PXVISIT
+23 IF '$TEST
IF PXRESULT=-1
SET PXRETURN=-1
+24 IF '$TEST
IF PXRESULT<-1
SET PXRETURN="-2^ERROR IN TRYING TO DO INTERVIEW"
End DoDot:1
+25 IF '$TEST
SET PXRETURN=VISITIEN
+26 QUIT PXRETURN
+27 ;
LOPENCED(WHAT,PACKAGE,SOURCE,DFN,BEGINDT,ENDDT,HLOC,SCREEN,APPOINT,PROMPT,COSTATUS) ;
+1 ;
+2 ; Returns:
+3 ; 0 = all oky doky
+4 ; -1 = nothing was done (user did not select visit or ^-out)
+5 ; -2^text = error of some kind^simple text message
+6 ; -3^text = error in deleting^simple text message
+7 ;
+8 NEW PXRETURN,PXRESULT
+9 SET PXRESULT=-1
+10 FOR
Begin DoDot:1
+11 SET PXRETURN=$$ENCEDIT(WHAT,PACKAGE,SOURCE,DFN,BEGINDT,ENDDT,HLOC,SCREEN,APPOINT,PROMPT,COSTATUS)
+12 IF PXRETURN'<0
SET PXRESULT=0
End DoDot:1
IF PXRETURN<0
QUIT
+13 QUIT $SELECT(PXRETURN<-1:PXRETURN,1:PXRESULT)
+14 ;