BCHABC2 ; IHS/CMI/LAB - EDIT/DELETE PCC VISIT FROM CHR RECORD ;
;;2.0;IHS RPMS CHR SYSTEM;;OCT 23, 2012;Build 27
;
;If a CHR Record is edited, this routine is called to modify
;or create the associated PCC visit.
;All V Files are deleted, the visit entry modified and the
;V File entries recreated.
;
E ;EP - edited a chr record
I '$G(BCHEV("VFILES",9000010)) S BCHEV("TYPE")="A" D A^BCHABCH Q ;no pcc visit ever created to edit, act like add
S BCHVSIT=BCHEV("VFILES",9000010)
D DELVFS
I $P(^AUPNVSIT(BCHVSIT,0),U,11) S BCHEV("TYPE")="A" D A^BCHABCH Q ;if pcc visit gone get rid of 15th, v file multiple and then act like add
;if not deleted, do visit mod and then re-add vfiles
S APCDALVR("APCDVSIT")=BCHVSIT
S APCDALVR("APCDATMP")="[APCDALVR 9000010 (MOD)]"
D VISIT^BCHABCH
D ^APCDALVR
I $D(APCDALVR("APCDAFLG")) S BCHQUIT=28 D VSERROR^BCHABCH Q
D VFILES^BCHABC1
S BCHV("9000010")=BCHVSIT
D COMPLETE^BCHALD
Q
D ;EP chr visit deleted
I '$G(BCHEV("VFILES",9000010)) Q ;no visit to begin with
S BCHVSIT=BCHEV("VFILES",9000010)
D DELVFS
Q
DELVFS ;delete vfiles
S BCHF=0 F S BCHF=$O(BCHEV("VFILES",BCHF)) Q:BCHF'=+BCHF D
.S BCHN=0 F S BCHN=$O(BCHEV("VFILES",BCHF,BCHN)) Q:BCHN'=+BCHN S DA=BCHN,DIK=^DIC(BCHF,0,"GL") D ^DIK
.K DA,DIK
.Q
I '$P(^AUPNVSIT(BCHVSIT,0),U,9),'$P(^(0),U,11) S APCDVDLT=BCHVSIT D ^APCDVDLT K APCDVDLT ;if no dependent entries delete visit
K BCHF,BCHN,BCHVDLT
Q
BCHABC2 ; IHS/CMI/LAB - EDIT/DELETE PCC VISIT FROM CHR RECORD ;
+1 ;;2.0;IHS RPMS CHR SYSTEM;;OCT 23, 2012;Build 27
+2 ;
+3 ;If a CHR Record is edited, this routine is called to modify
+4 ;or create the associated PCC visit.
+5 ;All V Files are deleted, the visit entry modified and the
+6 ;V File entries recreated.
+7 ;
E ;EP - edited a chr record
+1 ;no pcc visit ever created to edit, act like add
IF '$GET(BCHEV("VFILES",9000010))
SET BCHEV("TYPE")="A"
DO A^BCHABCH
QUIT
+2 SET BCHVSIT=BCHEV("VFILES",9000010)
+3 DO DELVFS
+4 ;if pcc visit gone get rid of 15th, v file multiple and then act like add
IF $PIECE(^AUPNVSIT(BCHVSIT,0),U,11)
SET BCHEV("TYPE")="A"
DO A^BCHABCH
QUIT
+5 ;if not deleted, do visit mod and then re-add vfiles
+6 SET APCDALVR("APCDVSIT")=BCHVSIT
+7 SET APCDALVR("APCDATMP")="[APCDALVR 9000010 (MOD)]"
+8 DO VISIT^BCHABCH
+9 DO ^APCDALVR
+10 IF $DATA(APCDALVR("APCDAFLG"))
SET BCHQUIT=28
DO VSERROR^BCHABCH
QUIT
+11 DO VFILES^BCHABC1
+12 SET BCHV("9000010")=BCHVSIT
+13 DO COMPLETE^BCHALD
+14 QUIT
D ;EP chr visit deleted
+1 ;no visit to begin with
IF '$GET(BCHEV("VFILES",9000010))
QUIT
+2 SET BCHVSIT=BCHEV("VFILES",9000010)
+3 DO DELVFS
+4 QUIT
DELVFS ;delete vfiles
+1 SET BCHF=0
FOR
SET BCHF=$ORDER(BCHEV("VFILES",BCHF))
IF BCHF'=+BCHF
QUIT
Begin DoDot:1
+2 SET BCHN=0
FOR
SET BCHN=$ORDER(BCHEV("VFILES",BCHF,BCHN))
IF BCHN'=+BCHN
QUIT
SET DA=BCHN
SET DIK=^DIC(BCHF,0,"GL")
DO ^DIK
+3 KILL DA,DIK
+4 QUIT
End DoDot:1
+5 ;if no dependent entries delete visit
IF '$PIECE(^AUPNVSIT(BCHVSIT,0),U,9)
IF '$PIECE(^(0),U,11)
SET APCDVDLT=BCHVSIT
DO ^APCDVDLT
KILL APCDVDLT
+6 KILL BCHF,BCHN,BCHVDLT
+7 QUIT