PXAPIEED ;ISL/dee - PCE's API to ask standalone encounter or add then edit it or to delete a standalone ; 8/14/00 2:47pm
;;1.0;PCE PATIENT CARE ENCOUNTER;**1,147**;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,PXX
I $G(DFN)<1 S DFN=$$ASKPAT^PXBAPI1()
Q:DFN<1 -1
D 2^VADPT I +VADM(6) D Q:$D(DUOUT)!$D(DIRUT) -1
. S DIR(0)="E",DIR("A")="Enter RETURN to continue or '^' to exit"
. S DIR("A",2)="WARNING "_VADM(7) D ^DIR
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)
;
--- Routine Detail --- with STRUCTURED ROUTINE LISTING ---[H[J[2J[HPXAPIEED 2256 printed Oct 16, 2024@18:26:54 Page 2
PXAPIEED ;ISL/dee - PCE's API to ask standalone encounter or add then edit it or to delete a standalone ; 8/14/00 2:47pm
+1 ;;1.0;PCE PATIENT CARE ENCOUNTER;**1,147**;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,PXX
+9 IF $GET(DFN)<1
SET DFN=$$ASKPAT^PXBAPI1()
+10 if DFN<1
QUIT -1
+11 DO 2^VADPT
IF +VADM(6)
Begin DoDot:1
+12 SET DIR(0)="E"
SET DIR("A")="Enter RETURN to continue or '^' to exit"
+13 SET DIR("A",2)="WARNING "_VADM(7)
DO ^DIR
End DoDot:1
if $DATA(DUOUT)!$DATA(DIRUT)
QUIT -1
+14 SET PXBEGDT=$SELECT($$SWITCHD^PXAPI>BEGINDT:$$SWITCHD^PXAPI,1:BEGINDT)
+15 SET VISITIEN=$$VISITLST^PXAPI(DFN,PXBEGDT,ENDDT,HLOC,SCREEN,APPOINT,PROMPT,COSTATUS)
+16 IF $PIECE(VISITIEN,"^",1)="D"
Begin DoDot:1
+17 SET PXRESULT=$$DELVFILE^PXAPI("ALL",$PIECE(VISITIEN,"^",2),"","",1,1)
+18 IF PXRESULT=1
SET PXRETURN=VISITIEN
+19 IF '$TEST
IF PXRESULT=0
SET PXRETURN="-3^ONLY PARTLY DELETED"
+20 IF '$TEST
IF PXRESULT=-1
SET PXRETURN=-1
+21 IF '$TEST
IF PXRESULT<-1
SET PXRETURN="-3^ERROR IN TRYING TO DELETE"
End DoDot:1
+22 IF '$TEST
IF VISITIEN>0!(VISITIEN="A")
Begin DoDot:1
+23 SET PXVISIT=$SELECT(VISITIEN>0:VISITIEN,1:"")
+24 SET PXRESULT=$$INTV^PXAPI(WHAT,PACKAGE,SOURCE,VISITIEN,$SELECT(VISITIEN="A":HLOC,1:""),DFN,"",$$SWITCHD^PXAPI)
+25 IF PXRESULT'<0
SET PXRETURN=PXVISIT
+26 IF '$TEST
IF PXRESULT=-1
SET PXRETURN=-1
+27 IF '$TEST
IF PXRESULT<-1
SET PXRETURN="-2^ERROR IN TRYING TO DO INTERVIEW"
End DoDot:1
+28 IF '$TEST
SET PXRETURN=VISITIEN
+29 QUIT PXRETURN
+30 ;
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 ;