source: FOIAVistA/tag/r/REGISTRATION-DGQE-DG-DPT-GRPX-VAD-VAF-VAS-VAT-VAU--VA-VIC--DGBT--DGJ--DGYA--VALM/DGPTFDEL.m@ 1222

Last change on this file since 1222 was 636, checked in by George Lilly, 15 years ago

WorldVistAEHR overlayed on FOIAVistA

File size: 3.3 KB
Line 
1DGPTFDEL ;ALB/JDS - PTF ENTRY DELETION ; 1/15/04 8:23am
2 ;;5.3;Registration;**517**;Aug 13, 1993
3 ;
4A D LO^DGUTL I $D(^DISV(DUZ,"^DPT(")),$D(^("^DGPT(")) S A=+^("^DGPT("),B=+^("^DPT(") I $D(^DGPT(A,0)),$D(^DPT(B,0)) S:(+^DGPT(A,0)'=B&$D(^DGPT("B",B))) ^DISV(DUZ,"^DGPT(")=""
5 Q
6 ;
7ASK D A W !!
8 S Y=1 D RTY^DGPTUTL
9 S DIC("S")="I $P(^(0),U,11)=1,'$D(^DGP(45.84,+Y))",DIC="^DGPT(",DIC(0)="NEAQ",DIC("A")="Enter PTF record to delete: "
10 D ^DIC G Q:Y'>0 S DA=+Y,DIC(0)="NE",X=DA D CEN G ASK:'$D(DA)
11A1 W !! D ^DIC S %=2 W !,"Ok to delete" D YN^DICN
12 I %=1 S DGPTIFN=DA D KDGPT W !,"****** DELETED ******" D HANG^DGPTUTL G Q
13AD I '% W !,"Anwer Yes or No",!,"On deletion pointers will be updated" G A1
14 ;
15 ;
16Q K DA,DFN,A,B,L,I,ANS,DIE,DR,DIK,DIC,DGRTY,DGRTY0,DGPTIFN Q
17 ;
18HEL ;
19 I '$D(DGRTY) S Y=1 D RTY^DGPTUTL
20 D A W !!
21 S DIC(0)="NEAQ",DIC="^DGP(45.84,",DIC("S")="I '$D(^DGP(45.83,""C"",+Y)),$D(^DGPT(+Y,0)),$P(^(0),U,11)="_DGRTY,DIC("A")="Enter "_$P(DGRTY0,U)_" record to re-open: "
22 D ^DIC G Q:Y'>0 S (X,DGPTIFN)=+Y,%=2
23A2 I '% W !!,DGPTIFN," ",$P(^DPT(+^DGPT(DGPTIFN,0),0),U) S DGSENFLG="",X=DGPTIFN,DIC(0)="NE",DIC="^DGP(45.84," D ^DIC K DIC,DGSENFLG
24 I DGRTY=2 D CHK G Q:'DGPTIFN
25 S %=2 W !,"Ok to reactivate" D YN^DICN
26 I '% W !,"Answer Yes or No" G A2
27 G Q:%'=1
28 D OPEN G Q
29 ;
30OLD I '$D(^DISV(DUZ,"PTFAD",DFN)) W " ???",*7,*7 G AD
31 S X=^(DFN)
32 Q
33DREL ; -- open released rec
34 I '$D(DGRTY) S Y=1 D RTY^DGPTUTL
35 W ! S DIC("A")="Enter Released "_$P(DGRTY0,U)_" Record to Re-open: ",DIC("S")="I $D(^DGP(45.83,""C"",+Y)),$D(^DGPT(+Y,0)),$D(^(70)),+^(70)>2901000,$P(^(0),U,11)="_DGRTY,DIC="^DGP(45.84,",DIC(0)="MEQA"
36 D ^DIC K DIC G Q:+Y'>0 S DGPTIFN=+Y
37 I DGRTY=2 D CHK G Q:'DGPTIFN
38OK W !,"Ok to Re-open" S %=2 D YN^DICN
39 I '% W !!?14,"Enter <RET> to exit routine",!?10,"Enter 'Y' for YES to RE-OPEN Record",! G OK
40 G Q:%'=1
41 S DA(1)=$O(^DGP(45.83,"C",DGPTIFN,0)) I DA(1) S DIK="^DGP(45.83,"_DA(1)_",""P"",",DA=DGPTIFN D ^DIK K DIK,DA
42 D OPEN G Q
43 ;
44OPEN ;
45 D KDGP,KDGPT:DGRTY=2
46 W !,"****** RECORD RE-OPENED ******" D HANG^DGPTUTL
47 Q
48 ;
49KDGP ; -- kill close-out rec ; input DGPTIFN := ifn
50 S DA=DGPTIFN,DIK="^DGP(45.84," D ^DIK K DIK,DA
51 Q
52 ;
53KDGPT ; -- kill DGPT rec ; input DGPTIFN := ifn
54 S DA=DGPTIFN,DIK="^DGPT(",FLAG=1,I=0 F S I=$O(^DGCPT(46,"C",DA,I)) Q:'I I '$G(^DGCPT(I,9)) S FLAG=0 Q
55 I FLAG S I=0 F S I=$O(^DGICD9(46.1,"C",DA,I)) Q:'I I '$G(^DGICD9(I,9)) S FLAG=0 Q
56 I 'FLAG W !,"CANNOT DELETE THE PTF RECORD WHEN THERE ARE ACTIVE ORDERS OR CPT RECORDS." H 2 K FLAG Q
57 D ^DIK K DA,DIK,I,FLAG
58 I DGRTY=1 S DA=+$O(^DGPM("APTF",DGPTIFN,0)) I $D(^DGPM(DA,0)),$P(^(0),U,16)=DGPTIFN S DR=".16///@",DIE="^DGPM(" D ^DIE K DR,DIE
59 K DA Q
60 ;
61CHK ; -- check to see if PTF is open ; return DGPTIFN="" is not open
62 I $D(^DGPT(+$P(^DGPT(DGPTIFN,0),U,12),0)),$P(^(0),U,6) W !!,*7,?5,"Associated PTF record #",+$P(^DGPT(DGPTIFN,0),U,12)," must be RE-OPENED",!?5,"in order to re-open Census record #",DGPTIFN,"." S DGPTIFN=""
63 Q
64 ;
65CEN ; -- check if closed for census
66 K DGI
67 F DGI=0:0 S DGI=$O(^DGPT("ACENSUS",DA,DGI)) Q:'DGI I $D(^DGPT(DGI,0)),$P(^(0),U,12)=DA,$D(^DG(45.86,+$P(^(0),U,13),0)) S Y=+^(0) X ^DD("DD") S DGI(DGI)=Y
68 G CENQ:$D(DGI)<10
69 W !!?2,*7,"This PTF record is associated with the following Census records:"
70 F DGI=0:0 S DGI=$O(DGI(DGI)) Q:'DGI W !?10,"Census Record #",DGI,?35,"==>",?40,"Census Date: ",DGI(DGI)
71 W !!?2,"PTF record can not be deleted."
72 K DA
73CENQ K DGI Q
Note: See TracBrowser for help on using the repository browser.