SDCODEL ;ALB/RMO,ESW - Delete - Check Out; 27 APR 1993 3:00 pm ; 10/10/02 5:38pm
;;5.3;Scheduling;**20,27,44,97,105,110,132,257,1015,1019**;Aug 13, 1993;Build 3
;
EN(SDOE,SDMOD,SDELHDL,SDELSRC) ;Delete Check Out
; Input -- SDOE Outpatient Encounter file IEN
; SDMOD 1=Interactive and 0=Non-interactive
; SDELHDL Check Out Deletion Handle [Optional]
; SDELSRC Source of delete
; Output -- Delete Check Out
N DA,DFN,DE,DIE,DR,SDCL,SDDA,SDEVTF,SDOE0,SDOEP,SDORG,SDT,SDVSAV,SDVFLG
D SET(SDOE,.SDOE0,.SDT,.DFN,.SDCL,.SDORG,.SDDA)
S SDVSAV=$P(SDOE0,U,5)
;
; -- ok to delete?
IF '$$EDITOK^SDCO3(SDOE,SDMOD) G ENQ
;
;IF $G(SDELSRC)'="PCE" S X=$$DELVFILE^PXAPI("ALL",$P($G(^SCE(SDOE,0)),U,5),"","","",1)
S SDVFLG=1
;
; -- get handle if not passed and do 'before'
I '$G(SDELHDL) N SDATA,SDELHDL S SDEVTF=1 D EVT^SDCOU1(SDOE,"BEFORE",.SDELHDL,.SDATA)
;
I $G(SDMOD) W !!,">>> Deleting check out information..."
;
; -- delete child data for appts, dispos and stop code addition
I "^1^2^3^"[("^"_SDORG_"^") D CHLD(SDOE,SDMOD) ;SD/257
;
; -- delete SDOE pointers and co d/t
I SDORG=1 D
.;IHS/OIT/LJF 01/26/2006 PATCH 1005 IHS does not remove OE data when deleting check-out
.;S DA(1)=DFN,DA=SDT,DIE="^DPT("_DFN_",""S"",",DR="21///@" D ^DIE
.I $G(SDMOD) W !?3,"...deleting check out date/time"
.S DR="303///@" D DIE^SDCO1(SDCL,SDT,+SDDA,DR)
I SDORG=3 D
.S DA(1)=DFN,DA=+SDDA,DIE="^DPT("_DFN_",""DIS"",",DR="18///@" D ^DIE
;
; -- do final deletes for sdoe
D CO(SDOE,SDMOD)
;IHS/OIT/LJF 01/26/2006 PATCH 1005 IHS does not remove OE data when deleting check-out
; but we do need to change status to Action Required
S DIE="^SCE(",DA=SDOE,DR=".12///14" D ^DIE ;added line
;D OE(SDOE,SDMOD)
;
I $G(SDMOD) W !,">>> done."
;
; -- if handle not passed, then 'after' and event
I $G(SDEVTF) D EVT^SDCOU1(SDOE,"AFTER",SDELHDL,.SDATA,SDOE0)
;
; -- call pce to make sure its data is gone
;I $G(SDVFLG) D DEAD^PXUTLSTP(SDVSAV)
ENQ Q
;
CHLD(SDOEP,SDMOD) ;Delete Children
N DFN,SDCL,SDDA,SDOE0,SDOEC,SDORG,SDT
S SDOEC=0
F S SDOEC=$O(^SCE("APAR",SDOEP,SDOEC)) Q:'SDOEC D
.D SET(SDOEC,.SDOE0,.SDT,.DFN,.SDCL,.SDORG,.SDDA)
.D OE(SDOEC,SDMOD)
Q
;
SET(SDOE,SDOE0,SDT,DFN,SDCL,SDORG,SDDA) ;Set Variables
S SDOE0=$G(^SCE(+SDOE,0)),SDT=+SDOE0,DFN=+$P(SDOE0,"^",2),SDCL=+$P(SDOE0,"^",4),SDORG=+$P(SDOE0,"^",8),SDDA=$P(SDOE0,"^",9)
Q
;
CO(SDOE,SDMOD) ;Delete Classification
N DA,DIK,SDFL,SDI
I $P($G(^SCE(SDOE,0)),"^",6) G COQ
I $O(^SDD(409.42,"AO",SDOE,0))>0 D
.I $G(SDMOD) W !?3,"...deleting classifications"
.D DEL(SDOE,409.42)
COQ Q
;
DEL(SDOE,SDFL) ;Delete Classification
N DA,DIK,SDI
S DIK="^SDD("_SDFL_",",SDI=0
F S SDI=$O(^SDD(SDFL,"AO",SDOE,SDI)) Q:'SDI S DA=+$O(^(SDI,0)) D ^DIK
Q
;
OE(SDOE,SDMOD) ;Delete Outpatient Encounter
N DA,DIK,SDVSIT,SDORG,SDAT
IF '$$EDITOK^SDCO3(SDOE,SDMOD) G OEQ
S SDAT=$P($G(^SCE(+SDOE,0)),U,1)
S SDVSIT=$P($G(^SCE(SDOE,0)),U,5),SDORG=$P($G(^SCE(SDOE,0)),U,8)
S DA=SDOE,DIK="^SCE(" D ^DIK
;S X=$$KILL^VSITKIL(SDVSIT)
OEQ Q
;
COMDT(SDOE,SDMOD) ;Delete Check Out Process Completion Date
N DA,DE,DIE,DQ,DR
I $G(SDMOD) W !?3,"...deleting check out process completion date"
S DA=SDOE,DIE="^SCE(",DR=".07///@" D ^DIE
Q
SDCODEL ;ALB/RMO,ESW - Delete - Check Out; 27 APR 1993 3:00 pm ; 10/10/02 5:38pm
+1 ;;5.3;Scheduling;**20,27,44,97,105,110,132,257,1015,1019**;Aug 13, 1993;Build 3
+2 ;
EN(SDOE,SDMOD,SDELHDL,SDELSRC) ;Delete Check Out
+1 ; Input -- SDOE Outpatient Encounter file IEN
+2 ; SDMOD 1=Interactive and 0=Non-interactive
+3 ; SDELHDL Check Out Deletion Handle [Optional]
+4 ; SDELSRC Source of delete
+5 ; Output -- Delete Check Out
+6 NEW DA,DFN,DE,DIE,DR,SDCL,SDDA,SDEVTF,SDOE0,SDOEP,SDORG,SDT,SDVSAV,SDVFLG
+7 DO SET(SDOE,.SDOE0,.SDT,.DFN,.SDCL,.SDORG,.SDDA)
+8 SET SDVSAV=$PIECE(SDOE0,U,5)
+9 ;
+10 ; -- ok to delete?
+11 IF '$$EDITOK^SDCO3(SDOE,SDMOD)
GOTO ENQ
+12 ;
+13 ;IF $G(SDELSRC)'="PCE" S X=$$DELVFILE^PXAPI("ALL",$P($G(^SCE(SDOE,0)),U,5),"","","",1)
+14 SET SDVFLG=1
+15 ;
+16 ; -- get handle if not passed and do 'before'
+17 IF '$GET(SDELHDL)
NEW SDATA,SDELHDL
SET SDEVTF=1
DO EVT^SDCOU1(SDOE,"BEFORE",.SDELHDL,.SDATA)
+18 ;
+19 IF $GET(SDMOD)
WRITE !!,">>> Deleting check out information..."
+20 ;
+21 ; -- delete child data for appts, dispos and stop code addition
+22 ;SD/257
IF "^1^2^3^"[("^"_SDORG_"^")
DO CHLD(SDOE,SDMOD)
+23 ;
+24 ; -- delete SDOE pointers and co d/t
+25 IF SDORG=1
Begin DoDot:1
+26 ;IHS/OIT/LJF 01/26/2006 PATCH 1005 IHS does not remove OE data when deleting check-out
+27 ;S DA(1)=DFN,DA=SDT,DIE="^DPT("_DFN_",""S"",",DR="21///@" D ^DIE
+28 IF $GET(SDMOD)
WRITE !?3,"...deleting check out date/time"
+29 SET DR="303///@"
DO DIE^SDCO1(SDCL,SDT,+SDDA,DR)
End DoDot:1
+30 IF SDORG=3
Begin DoDot:1
+31 SET DA(1)=DFN
SET DA=+SDDA
SET DIE="^DPT("_DFN_",""DIS"","
SET DR="18///@"
DO ^DIE
End DoDot:1
+32 ;
+33 ; -- do final deletes for sdoe
+34 DO CO(SDOE,SDMOD)
+35 ;IHS/OIT/LJF 01/26/2006 PATCH 1005 IHS does not remove OE data when deleting check-out
+36 ; but we do need to change status to Action Required
+37 ;added line
SET DIE="^SCE("
SET DA=SDOE
SET DR=".12///14"
DO ^DIE
+38 ;D OE(SDOE,SDMOD)
+39 ;
+40 IF $GET(SDMOD)
WRITE !,">>> done."
+41 ;
+42 ; -- if handle not passed, then 'after' and event
+43 IF $GET(SDEVTF)
DO EVT^SDCOU1(SDOE,"AFTER",SDELHDL,.SDATA,SDOE0)
+44 ;
+45 ; -- call pce to make sure its data is gone
+46 ;I $G(SDVFLG) D DEAD^PXUTLSTP(SDVSAV)
ENQ QUIT
+1 ;
CHLD(SDOEP,SDMOD) ;Delete Children
+1 NEW DFN,SDCL,SDDA,SDOE0,SDOEC,SDORG,SDT
+2 SET SDOEC=0
+3 FOR
SET SDOEC=$ORDER(^SCE("APAR",SDOEP,SDOEC))
IF 'SDOEC
QUIT
Begin DoDot:1
+4 DO SET(SDOEC,.SDOE0,.SDT,.DFN,.SDCL,.SDORG,.SDDA)
+5 DO OE(SDOEC,SDMOD)
End DoDot:1
+6 QUIT
+7 ;
SET(SDOE,SDOE0,SDT,DFN,SDCL,SDORG,SDDA) ;Set Variables
+1 SET SDOE0=$GET(^SCE(+SDOE,0))
SET SDT=+SDOE0
SET DFN=+$PIECE(SDOE0,"^",2)
SET SDCL=+$PIECE(SDOE0,"^",4)
SET SDORG=+$PIECE(SDOE0,"^",8)
SET SDDA=$PIECE(SDOE0,"^",9)
+2 QUIT
+3 ;
CO(SDOE,SDMOD) ;Delete Classification
+1 NEW DA,DIK,SDFL,SDI
+2 IF $PIECE($GET(^SCE(SDOE,0)),"^",6)
GOTO COQ
+3 IF $ORDER(^SDD(409.42,"AO",SDOE,0))>0
Begin DoDot:1
+4 IF $GET(SDMOD)
WRITE !?3,"...deleting classifications"
+5 DO DEL(SDOE,409.42)
End DoDot:1
COQ QUIT
+1 ;
DEL(SDOE,SDFL) ;Delete Classification
+1 NEW DA,DIK,SDI
+2 SET DIK="^SDD("_SDFL_","
SET SDI=0
+3 FOR
SET SDI=$ORDER(^SDD(SDFL,"AO",SDOE,SDI))
IF 'SDI
QUIT
SET DA=+$ORDER(^(SDI,0))
DO ^DIK
+4 QUIT
+5 ;
OE(SDOE,SDMOD) ;Delete Outpatient Encounter
+1 NEW DA,DIK,SDVSIT,SDORG,SDAT
+2 IF '$$EDITOK^SDCO3(SDOE,SDMOD)
GOTO OEQ
+3 SET SDAT=$PIECE($GET(^SCE(+SDOE,0)),U,1)
+4 SET SDVSIT=$PIECE($GET(^SCE(SDOE,0)),U,5)
SET SDORG=$PIECE($GET(^SCE(SDOE,0)),U,8)
+5 SET DA=SDOE
SET DIK="^SCE("
DO ^DIK
+6 ;S X=$$KILL^VSITKIL(SDVSIT)
OEQ QUIT
+1 ;
COMDT(SDOE,SDMOD) ;Delete Check Out Process Completion Date
+1 NEW DA,DE,DIE,DQ,DR
+2 IF $GET(SDMOD)
WRITE !?3,"...deleting check out process completion date"
+3 SET DA=SDOE
SET DIE="^SCE("
SET DR=".07///@"
DO ^DIE
+4 QUIT