source: WorldVistAEHR/trunk/r/REGISTRATION-DGQE-DG-DPT-GRPX-VAD-VAF-VAS-VAT-VAU--VA-VIC--DGBT--DGJ--DGYA--VALM/DGRPEIS1.m@ 1800

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

initial load of WorldVistAEHR

File size: 4.3 KB
Line 
1DGRPEIS1 ;ALB/MIR - CALLS TO ADD NEW PATIENT RELATIONS AND INCOME PERSONS ; 27 FEB 92
2 ;;5.3;Registration;**10,45,108,624**;Aug 13, 1993
3 ;Adds entries to FILES #408.12 & 408.13
4 ;
5NEW ;check if data in FILE #408.12
6 ;out - DGPRI=IFN of #408.12
7 ; DGFL [-1='^'/-2=time-out]
8 N DGRPDOB,DGRP0ND
9 I '$D(DGTSTDT) N DGTSTDT S DGTSTDT=$S($D(DGMTDT):DGMTDT,1:DT)
10 S DGPRI=$O(^DGPR(408.12,"C",DFN_";DPT(",0)),DGFL=$G(DGFL)
11 I '$D(^DGPR(408.12,+DGPRI,0)) S DGRP0ND=DFN_"^"_1_"^"_DFN_";DPT(",DGRPDOB=$P($G(^DPT(+DFN,0)),"^",3) D NEWPR
12 S DGIRI=$O(^DGMT(408.22,"B",DFN,0))
13 I '$D(^DGMT(408.22,+DGIRI,0)) D GETIENS^DGMTU2(DFN,+DGPRI,DGTSTDT)
14 Q
15NEWIP ;Add relation to #408.13 file
16 ; In - DFN=IEN of File #2
17 ; DGRP0ND=0 node of 408.13
18 ;Out - DGIPI=408.13 IEN
19 K DINUM N DGRPDOB,DGSEX,I,X
20 S DGRPDOB=$P(DGRP0ND,"^",3),DGSEX=$P(DGRP0ND,"^",2)
21 S (DIK,DIC)="^DGPR(408.13,",DIC(0)="L",DLAYGO=408.13,X=$P(DGRP0ND,"^",1) K DD,DO D FILE^DICN S (DGIPI,DA)=+Y K DLAYGO
22 L +^DGPR(408.13,+DGIPI) S ^DGPR(408.13,+DGIPI,0)=DGRP0ND S ^DGPR(408.13,+DGIPI,1)=DGRP1ND D IX1^DIK L -^DGPR(408.13,+DGIPI)
23 S Y=DGIPI,DGRP0ND=DFN_"^"_$S(SPOUSE:2,1:"")_"^"_+Y_";DGPR(408.13,"
24 ;FALLS THRU!
25NEWPR ;Add entry to file #408.12
26 ;In - DGRP0ND=0 node of 408.12
27 ; DGRPDOB=DOB of relation
28 ;Out - DGPRI=IFN of new 408.12 entry
29 K DINUM N DOB,X
30 I '$D(DGTSTDT) N DGTSTDT S DGTSTDT=$S($D(DGMTDT):DGMTDT,1:DT)
31 S DOB=$G(DGRPDOB) I 'DOB S DOB=$E(DGTSTDT,1,3)-1_"0101" ; use dob for effective date...default = Jan 1 of prior year
32DIC I $P(DGRP0ND,"^",2)']"" S DIC="^DG(408.11,",DIC(0)="AEQMZ",DIC("A")="RELATIONSHIP: ",DIC("S")="I Y>2,""E""_DGSEX[$P(^(0),""^"",3),$S(DGTYPE=""D"":1,Y<7:1,1:0)" D ^DIC I '$D(DTOUT),(Y'>0) W *7," Required!!" G DIC
33 I $D(DTOUT) K DTOUT S DGFL=-2 G NEWPRQ
34 I $P(DGRP0ND,"^",2)']"" S $P(DGRP0ND,"^",2)=+Y
35 D ACT^DGRPEIS2 I DGFL<0 D G NEWPRQ
36 .W !?3,*7,"Entry incomplete...deleted",!
37 .Q:'$G(DA)!($G(DIK)'="^DGPR(408.13,") ;defined for deps in newip
38 .D ^DIK
39 S (DIK,DIC)="^DGPR(408.12,",DIC(0)="L",DLAYGO=408.12,X=+DGRP0ND K DD,DO D FILE^DICN S DGPRI=+Y K DLAYGO
40 S DA=+DGPRI L +^DGPR(408.12,+DGPRI) S ^DGPR(408.12,+DGPRI,0)=DGRP0ND,^DGPR(408.12,+DGPRI,"E",0)="^408.1275D^1^1",^(1,0)=DGACT_"^"_1 D IX1^DIK L -^DGPR(408.12,+DGPRI)
41 D RESET^DGMTU11(DFN)
42 S Y=DGPRI
43NEWPRQ K DGACT,DGSEX,DGRPDOB,DA,DIC,DIK,DIRUT,DTOUT,DUOUT,X,Y
44 Q
45SETUP ; called from SPINACT / sets vars for ASOF tag
46 N FNAME S FNAME=$P($$NAME^DGMTU1(+X),",",2)
47 S ACT=$O(^DGPR(408.12,+X,"E","AID","")),ACT=$O(^(+ACT,0)),ACT=$G(^DGPR(408.12,+X,"E",+ACT,0))
48 I $P(ACT,"^",2)']"" Q ; never active
49 I '$P(ACT,U,2) D Q
50 .W !,"Dependent has been inactivated as of "
51 .S Y=+ACT
52 .D DD^%DT W Y H 3
53 S IEN=+X
54ASOF ;ask as of date
55 N LYR,SPOUSE,DGXDT
56 I '$D(DGTSTDT) N DGTSTDT S DGTSTDT=$S($D(DGMTDT):DGMTDT,1:DT)
57 S SPOUSE=$S($P($G(^DGPR(408.12,+IEN,0)),"^",2)=2:1,1:0)
58 S LYR=$E($$LYR^DGMTSCU1(DGTSTDT),1,3)_1231
59 ;I 'SPOUSE S LYR=$E($$LYR^DGMTSCU1(LYR),1,3)_1231
60 K DIR S DIR(0)="D^"_+ACT_":"_LYR_":AEP",DIR("A")="Date "_FNAME_" no longer a dependent"
61 S DIR("?",1)="Enter the date this person was no longer a dependent of the veteran.",DIR("?",2)="This could include a date of death or the date a child turned 18 for"
62 S DIR("?",3)="children. For a spouse, this would be the date of divorce or date ",DIR("?",4)="of death of the spouse. Date must be after the person became a"
63 S DIR("?",5)="dependent, but prior to 12/31/"_($E(LYR,1,3)+1700)_"."
64 I 'SPOUSE S DIR("?",6)=" ",DIR("?",7)="A person should only be inactivated if the individual was not a",DIR("?",8)="dependent at any time during the prior calendar year."
65 S DIR("?")=" "
66 I SPOUSE S DIR("?",6)=" ",DIR("?",7)="A spouse should be inactivated if the spouse and veteran were not",DIR("?",8)="married as of 12/31/"_($E(LYR,1,3)+1700)_"."
67 D ^DIR K DIR
68 I $D(DTOUT)!$D(DUOUT) S DGFL=$S($D(DTOUT):-2,1:-1) Q
69 S DGXDT=Y
70 I $E(Y,1,3)=$E(LYR,1,3) D Q:'$G(Y)
71 .N DIR,DIRUT,DIROUT,DTOUT,DUOUT
72 .W !!,"Warning: Data will be used if dependent was active at least one day in a"
73 .W !,"year. Data will not be used if inactivation is prior to 1/1/"_($E(LYR,1,3)+1700)_" or it"
74 .W !,"is equal to the activation date."
75 .S DIR(0)="Y",DIR("B")="NO",DIR("A")="Do you wish to inactivate this dependent on the selected date?"
76 .D ^DIR
77 S DA(1)=IEN,DIC="^DGPR(408.12,"_DA(1)_",""E"",",X=DGXDT,DIC(0)="L",DLAYGO=408.1275 D ^DIC S DIE=DIC,DA=+Y,DR=".02////0" D ^DIE
78 D RESET^DGMTU11(DFN)
79ASOFQ K DA,DIC,DIE,DIR,DIRUT,DLAYGO,DR,DTOUT,DUOUT,X,Y
80 Q
Note: See TracBrowser for help on using the repository browser.