source: WorldVistAEHR/trunk/r/INCOME_VERIFICATION_MATCH-IVM/IVMCMFB.m@ 724

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

initial load of WorldVistAEHR

File size: 3.9 KB
Line 
1IVMCMFB ;ALB/RMM - SEND INCOME TEST TRANSMISSION BULLETIN ; 07/24/03
2 ;;2.0;INCOME VERIFICATION MATCH;**71,82**;21-OCT-94
3 ;
4BULL(DFN,DGMTDT,IVMERR,SCTST) ;
5 ; Send mail message notifying site of an income test that was completed
6 ; containing data inconsistencies.
7 ;
8 ; Input array required:
9 ; "IVMERR(" -- contains lists of inconsistencies from tests
10 ; which were uploaded (ORU~Z10 and ORF~Z10)
11 ;
12 N DIFROM,XMDUZ,XMTEXT,XMSTRIP,XMROU,XMY,XMZ,XMDF,IVMGRP,IVMPAT
13 S XMDF=""
14 S XMDUZ=""
15 S XMTEXT="IVMTXT("
16 S XMY(DUZ)=""
17 S IVMGRP="MT INCONSISTENCIES"
18 S XMY("G."_IVMGRP_"@"_^XMB("NETNAME"))=""
19 S IVMPAT=$$PT^IVMUFNC4(DFN)
20 S XMSUB="MT INCONSISTENCIES - "_$E($P(IVMPAT,"^"),1)_$P(IVMPAT,"^",3)_"/"_SCTST
21 ;
22 S IVMTXT(1)="An Income Test was edited/completed on "_$$FMTE^XLFDT($$NOW^XLFDT,"1D")
23 S IVMTXT(2)="containing "_($O(IVMERR(""),-1)-1)_" data inconsistencie(s)."
24 S IVMTXT(3)=" "
25 S IVMTXT(4)=" NAME: "_$P(IVMPAT,"^")
26 S IVMTXT(5)=" ID: "_$P(IVMPAT,"^",2)
27 S IVMTXT(6)=" TEST DATE: "_$$FMTE^XLFDT(DGMTDT)
28 S IVMTXT(7)=" "
29 S IVMTXT(8)="The inconsistencies are listed in the comment section of"
30 S IVMTXT(9)="the income test for this veteran."
31 ;
32 D ^XMD
33 K IVMTXT,XMDUZ,XMSUB,XMTEXT,XMY
34 Q
35 ;
36PROB(DGMTDT,IVMERR,BULLRQ) ;
37 ; IVMERR - Contains lists of inconsistencies from tests which were
38 ; uploaded (ORU~Z10 and ORF~Z10) or created during data
39 ; entry (Required)
40 ;
41 ; BULLRQ - MT INCONSISTENCIES Bulletin Required? flag (Optional)
42 ;
43 ; If the test wasn't completed during data entry quit
44 N MTCOMP,DGMTI,TYPE,SCTST
45 S BULLRQ=+$G(BULLRQ)
46 S TYPE=$S($D(IVMTYPE):IVMTYPE,$D(DGMTYPT):DGMTYPT,1:"")
47 S:'$D(DGMTI) DGMTI=+$$LST^DGMTU(DFN,,TYPE)
48 S MTCOMP=$P($G(^DGMT(408.31,+$G(DGMTI),0)),U,7)
49 I BULLRQ,MTCOMP'>0 Q
50 ;
51 ; If errors were found during data entry, send bulletin
52 S SCTST=$P($G(^DGMT(408.31,+$G(DGMTI),2)),U,5)
53 I BULLRQ,$D(IVMERR(2)) D BULL(DFN,DGMTDT,.IVMERR,SCTST)
54 ;
55 ; If inconsistent data was found update the comment field with the list
56 ; of errors.
57 D INCON(DGMTI,.IVMERR)
58 Q
59 ;
60INCON(DGMTI,IVMERR,TFLG) ;
61 ; Append the current comments (if any) with the list of inconsistencies
62 ; found during data entry or upload of ORU/ORF Z10
63 N CNT,INCNT,COMM,TTYPE,TAB,ERR,LNCNT,TFLG
64 I $D(IVMERR(2)),BULLRQ D
65 .S TTYPE=^DG(408.33,+$P($G(^DGMT(408.31,DGMTI,0)),U,19),0)
66 .S IVMERR(1)=":A "_TTYPE_" was edited on "_$$FMTE^XLFDT($$NOW^XLFDT,"1P")_" with data inconsistencies."
67 I $D(IVMERR(2)),'BULLRQ D
68 .S IVMERR(1)=":Received/Uploaded Test on "_$$FMTE^XLFDT($$NOW^XLFDT,"1P")_" with data inconsistencies."
69 ;
70 ; Check for exisiting non-inconsistency messages
71 S TFLG=2
72 D CHECK(DGMTI,.TFLG)
73 ;
74 ; If nothing to add to the COMMENT field, delete all existing msgs
75 I '$D(IVMERR(1)) D INCONR(DGMTI) Q
76 ;
77 ; Overwrite the comments for inconsistencies found during Z10 upload
78 S TAB=": "
79 F LNCNT=TFLG:1 Q:'$D(IVMERR(LNCNT)) S IVMERR(LNCNT)=TAB_IVMERR(LNCNT)
80 D WP^DIE(408.31,DGMTI_",",50,,"IVMERR",.ERR)
81 Q
82 ;
83CHECK(DGMTI,TFLG) ;
84 ; Check for exisiting non-inconsistency messages, and keep all
85 ; non-inconsistency (user entered) messages.
86 ;
87 ; Quit if no comments were entered
88 Q:'$D(^DGMT(408.31,DGMTI,"C",1,0))
89 ;
90 ; Quit if all current comments are for inconsistencies
91 S INCNT=0
92 F CNT=1:1 Q:'$D(^DGMT(408.31,DGMTI,"C",CNT,0)) D
93 .Q:$E(^DGMT(408.31,DGMTI,"C",CNT,0),1)=":"
94 .Q:^DGMT(408.31,DGMTI,"C",CNT,0)']""
95 .S INCNT=INCNT+1,COMM(INCNT)=^DGMT(408.31,DGMTI,"C",CNT,0)
96 Q:INCNT'>0
97 ;
98 ; Re-Build Comment array with user comments
99 S TFLG=INCNT+2
100 F CNT=1:1 Q:'$D(IVMERR(CNT)) S INCNT=INCNT+1,COMM(INCNT)=IVMERR(CNT)
101 M IVMERR=COMM
102 Q
103 ;
104INCONR(DGMTI) ;
105 ; When no inconsistent data and no user comments were found,
106 ; remove everything from the COMMENT Word Procesing field.
107 ;
108 ; Quit if no comments exist
109 Q:'$D(^DGMT(408.31,DGMTI,"C",1,0))
110 ;
111 ; Delete all, when no comments and no inconsistencies
112 D WP^DIE(408.31,DGMTI_",",50,,"@",.ERR)
113 ;
114 Q
Note: See TracBrowser for help on using the repository browser.