source: FOIAVistA/trunk/r/SCHEDULING-SD-SC/SCMRTMM.m@ 1742

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

initial load of FOIAVistA 6/30/08 version

File size: 3.5 KB
Line 
1SCMRTMM ;ALB/REW/PDR - Patient Team Multiple Reasssignment MailMessages ; 17 JUL 98
2 ;;5.3;Scheduling;**148,157**;AUG 13, 1993
3 ;
4SETLN(TEXT) ;
5 Q:$G(TEXT)=""
6 ; increments SCLNCNT, adds text to sctmxm(sclncnt)
7 S SCLNCNT=SCLNCNT+1
8 S ^TMP($J,"SCTMXM",SCLNCNT)=TEXT
9 Q
10 ;
11TEXT(SCFILE,SCNODE,SCPC,SCSPACE,SCLAB) ;returns fldname & external value
12 ;returns fldname & external value
13 ; Note- Only works for non wp fields of standard numbering conventions
14 ; SCFLILE =FILENUM
15 ; SCNODE = 0 NODE
16 ; SCPC = piece of node
17 ; SCSPACE = 80 SPACES
18 ; SCLAB = 1 if print field name
19 N SCX,SCINT,SCFLD
20 S SCX=""
21 S SCINT=$P(SCNODE,U,SCPC)
22 G:SCINT="" QTTXT
23 S SCFLD=SCPC*.01
24 ;;;
25 IF $G(SCLAB) D
26 . S SCX=$$DDNAME(SCFILE,SCFLD)_":"
27 . S:$G(SCLAB)=1 SCX=SCX_$E(SCSPACE,1,(23-$L(SCX)))
28 . S:$G(SCLAB)=2 SCX=SCX_$E(SCSPACE,1,(50-$L(SCX)))
29 S:SCINT]"" SCX=SCX_$$EXTERNAL^DILFD(SCFILE,SCFLD,"",SCINT)
30QTTXT Q SCX
31 ;
32DDNAME(FILE,FIELD) ;return the fieldname
33 N SCX
34 D FIELD^DID(FILE,FIELD,"","LABEL","SCX")
35 Q $G(SCX("LABEL"))
36 ;
37MAILLST(SCTM,SCFIELDA,SCDATE,SCBADTM) ; Reports only reassignment failures
38 ; Input:
39 ; SCTM - Pointer to Team File (#404.51)
40 ; SCFIELDA - Field array with internal values
41 ; SCDATE - Effective Date
42 ; SCBADTM - DFN array of patients unassignable to team
43 ;
44 G:$G(SCNOMAIL) QTMULT ;- flag can be set to stop message generation
45 G:'$S('$D(SCBADTM):0,1:$O(@SCBADTM@(0))) QTMULT ; bail out if nothing to print
46 N XMDUZ,XMY,XMSUB,XMTEXT,VA,VAERR,XMZ,Y,ZTQUEUED
47 N SCTMNM,DFN,SCOK,SCPTNM,SCFLD,SCNODE,SCNDX,SCSPACE,SCE,SCB,SCTMDT,SCDELTEM
48 S ZTQUEUED=1
49 S SCDELTEM=1 ;ok to delete tmp global
50 IF $D(SCFIELDA) D
51 . IF $D(SCFIELDA(.02)) S SCB=SCFIELDA(.02)
52 . IF $D(SCFIELDA(.09)) S SCE=SCFIELDA(.09)
53 S SCB=$G(SCB,DT)
54 S SCE=$G(SCE,DT)
55 S $P(SCSPACE," ",80)=""
56 S SCTMDT("BEGIN")=$S(SCB<SCDATE:SCB,1:SCDATE)
57 S SCTMDT("END")=$S(SCE>SCDATE:SCE,1:SCDATE)
58 S SCTMDT("INCL")=0
59 S SCTMNM=$P($G(^SCTM(404.51,+SCTM,0)),U,1)
60 S XMSUB="Multiple PATIENT-TEAM REASSIGNMENT FAILURES for "_SCTMNM,XMTEXT="^TMP($J,""SCTMXM"",",SCLNCNT=0
61 D:'$G(DGQUIET) EN^DDIOL("Sending Multiple Patient-Team Reassignment Failures Message")
62 S SCOK=1
63 S SCTMNM=$P($G(^SCTM(404.51,+SCTM,0)),U,1)
64 D SETLN("Team: "_SCTMNM)
65 S Y=SCDATE X ^DD("DD")
66 D SETLN("Effective Date: "_Y)
67 D SETLN(" ")
68 IF $D(SCFIELDA) D
69 . F SCNDX=1:1:14 S SCFLD=SCNDX*.01 IF $D(SCFIELDA(SCFLD)) D
70 .. S $P(SCNODE,U,SCNDX)=SCFIELDA(SCFLD)
71 .. D SETLN($$TEXT(404.42,SCNODE,SCNDX,SCSPACE,1))
72 D SETLN(" ")
73BAD ; Guts of message
74 D SETLN(" ")
75 D SETLN("There has been NO new team reassignment for the following patients:")
76 S DFN=0
77 F S DFN=$O(@SCBADTM@(DFN)) Q:'DFN D
78 . ;;;S:$$PCMMXMY^SCAPMC25(3,DFN,,"SCTMDT",0) SCOK=0
79 . S SCPTNM=$P(^DPT(DFN,0),U,1)
80 . D PID^VADPT6
81 . S ^TMP("SCTM MAIL LST",$J,SCTM,2,DFN)=(" "_SCPTNM_" ("_$G(VA("PID"))_")")_":"
82 . S ^TMP("SCTM MAIL LST",$J,SCTM,3,DFN)=" "_@SCBADTM@(DFN)
83 . S ^TMP("SCTM MAIL LST",$J,SCTM,2,"B",SCPTNM,DFN)=""
84 S SCPTNM=""
85 F S SCPTNM=$O(^TMP("SCTM MAIL LST",$J,SCTM,2,"B",SCPTNM)) Q:SCPTNM']"" D
86 . S DFN=0
87 . F S DFN=$O(^TMP("SCTM MAIL LST",$J,SCTM,2,"B",SCPTNM,DFN)) Q:'DFN D
88 .. S SCDETAIL=$G(^TMP("SCTM MAIL LST",$J,SCTM,2,DFN)) Q:SCDETAIL']"" D SETLN(SCDETAIL)
89 .. S SCDETAIL=$G(^TMP("SCTM MAIL LST",$J,SCTM,3,DFN)) Q:SCDETAIL']"" D SETLN(SCDETAIL)
90 S XMDUZ="PCMM Reassignment"
91 K XMY S XMY(DUZ)=""
92 S SCX=$O(^SD(404.91,"B",0))_","
93 I +SCX S XMY("G."_$$GET1^DIQ(404.91,SCX,804))=""
94 D ^XMD
95QTMULT ;
96 K:$G(SCDELTEM) ^TMP("SCTM MAIL LST",$J,SCTM)
97 K ^TMP($J,"SCTMXM")
98 Q
Note: See TracBrowser for help on using the repository browser.