source: WorldVistAEHR/trunk/r/TOOLKIT-AWCM-XD-XIN-XPAR-XQAB-XT-XUC-XUR-ZIN-ZTED/XDRVCHEK.m@ 1474

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

initial load of WorldVistAEHR

File size: 2.8 KB
RevLine 
[613]1XDRVCHEK ;SF-IRMFO.SEA/JLI - CHECK FOR ENTRIES WHICH HAVE PASSED THE NUMBER OF DAYS REQUIRED FOR VERIFICATION ;02/24/2000 07:46
2 ;;7.3;TOOLKIT;**23,46**;Apr 25, 1995
3 ;;
4 ;;
5EN ;
6 N XDRDAYS,XDRGLB,XDRI,XDRJ,XDRK,XDRX,DIE,DA,DR,XDRDA,XDRXREF
7 F XDRI=0:0 S XDRI=$O(^VA(15.1,XDRI)) Q:XDRI'>0 D
8 . S XDRGLB=$P(^DIC(XDRI,0,"GL"),U,2)
9 . S XDRDAYS=$P(^VA(15.1,XDRI,0),U,13)
10 . F XDRXREF="AXDUP","ARDUP1" F XDRJ=0:0 S XDRJ=$O(^VA(15,XDRXREF,XDRGLB,XDRJ)) Q:XDRJ'>0 D
11 . . S XDRX=$P(^VA(15,XDRJ,0),U,7)
12 . . I XDRX>0,$$FMDIFF^XLFDT(DT,XDRX)'<XDRDAYS D FINALVER(XDRJ)
13 D CHKREADY
14 Q
15FINALVER(XDRDA) ;
16 N XDRFDA,X,XDRX1,XDRX2,NAME,FILE
17 S XDRFDA=$$FIND1^DIC(15.02,","_XDRDA_",","X","PRIMARY")
18 S X=$S(XDRFDA>0:^VA(15,XDRDA,2,XDRFDA,0),1:"") Q:X=""
19 I $P(X,U,2)'="V" Q
20 S XDRFDA(15,XDRDA_",",.04)=$P(X,U,5) Q:$P(X,U,5)'>0
21 D FILE^DIE("","XDRFDA") K XDRFDA ; SET DIRECTION IN BEFORE SETTING STATUS
22 S FILE=$P($P(^VA(15,XDRDA,0),U),";",2),FILE=+$P(@(U_FILE_"0)"),U,2)
23 S XDRX1="V" F XDRFDA=0:0 S XDRFDA=$O(^VA(15.1,FILE,2,XDRFDA)) Q:XDRFDA'>0 S NAME=$P(^(XDRFDA,0),U) S NAME=$$FIND1^DIC(15.02,","_XDRDA_",","X",NAME) I NAME'>0 S XDRX1="R" Q
24 ;S XDRX1="V" F XDRFDA=0:0 S XDRFDA=$O(^VA(15,XDRDA,2,XDRFDA)) Q:XDRFDA'>0 I $P(^(XDRFDA,0),U,2)'="V",$P(^(0),U,2)'="D" S XDRX1="R" Q
25 K XDRFDA S XDRFDA(15,XDRDA_",",.03)=XDRX1
26 I XDRX1="V" D
27 . S XDRFDA(15,XDRDA_",",.07)=($$NOW^XLFDT()\1)
28 . S XDRFDA(15,XDRDA_",",.11)=$S(X'="":$P(X,U,3),1:DUZ)
29 D FILE^DIE("","XDRFDA")
30 I XDRX1'="V" Q
31NAME ;
32 S X=^VA(15,XDRDA,0)
33 I $P(X,U,4)=2 D
34 . S XDRX1=+$P(X,U,2)
35 . S XDRX2=+$P(X,U)
36 E D
37 . S XDRX1=+$P(X,U)
38 . S XDRX2=+$P(X,U,2)
39 S X=U_$P($P(X,U),";",2)_"XDRX1,0)"
40 S NAME=$P(@X,U)
41 F Q:NAME'["MERGING INTO" S NAME=$P($P(NAME,"(",2,10),")",1,$L(NAME,")")-1)
42 S NAME="MERGING INTO `"_XDRX2_" USE THAT ENTRY ("_NAME_")"
43 S $P(@X,U)=NAME
44 Q
45 ;
46CHKREADY ; Check whether the status with respect to merge can be changed
47 ; from NOT READY to READY based on the minimum number of days prior to
48 ; merging
49 ;
50 F XDRFILE=0:0 S XDRFILE=$O(^VA(15.1,XDRFILE)) Q:XDRFILE'>0 D
51 . S XDRGLOB=$P(^DIC(XDRFILE,0,"GL"),U,2)
52 . S XDRDAYS=+$P($G(^VA(15.1,XDRFILE,0)),U,14)
53 . S XDRDAYS=$S(XDRDAYS>0:XDRDAYS,1:-1)
54 . S XDRDATE=$$FMADD^XLFDT(DT,-XDRDAYS)
55 . S XDRI="" F S XDRI=$O(^VA(15,"AVDUP",XDRGLOB,XDRI)) Q:XDRI="" D
56 . . S XDRJ=$O(^VA(15,"AVDUP",XDRGLOB,XDRI,0))
57 . . S XDRJV=$G(^VA(15,XDRJ,0)) I XDRJV="" K ^VA(15,"AVDUP",XDRGLOB,XDRI,XDRJ) Q
58 . . I $P(XDRJV,U,5)<2,$P(XDRJV,U,7)<XDRDATE D
59 . . . S DIE=15,DA=XDRJ,DR=".05///1;" D ^DIE K DIE,DA,DR
60 ;
61CLEAN ;
62 N I,J,X,Y
63 F I=0:0 S I=$O(^VA(15,I)) Q:I'>0 D
64 . S V=$G(^VA(15,I,0)) I $P(V,U,3)'="V" Q
65 . S Y=$P(V,U,4)
66 . S Y=$S(Y>0:Y,1:1)
67 . S X=$P(V,U,Y)
68 . F J=0:0 S J=$O(^VA(15,"B",X,J)) Q:J'>0 I J'=I D
69 . . S Y=$P($G(^VA(15,J,0)),U,3)
70 . . I Y="P"!(Y="") D
71 . . . S DA=J
72 . . . N I,J,X,Y,V
73 . . . S DIK="^VA(15,"
74 . . . D ^DIK
75 Q
Note: See TracBrowser for help on using the repository browser.