source: FOIAVistA/trunk/r/PHARMACY_BENEFITS_MANAGEMENT-PSU/PSUAR3.m@ 802

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

initial load of FOIAVistA 6/30/08 version

File size: 2.8 KB
Line 
1PSUAR3 ;BIR/PDW - PBM AR/WS EXTRACT DETAILED MAIL GENERATOR ;10 JUL 1999
2 ;;4.0;PHARMACY BENEFITS MANAGEMENT;;MARCH, 2005
3 ; DBIA(s)
4 ; Reference to file #4.3 supported by DBIA 2496
5 ; Reference to file #40.8 supported by DBIA 2438
6 ;PSULC = Line processing in ^tmp
7 ;PSUTLC = Total Line count
8 ;PSUMC = Message counter
9 ;PSUMLC = Message Line Counter
10 ; RETURNS
11 ;PSUMSG("M") = # Messages
12 ;PSUMSG("L") = # Lines
13 ;
14EN(PSUMSG) ;Scan and process for Division(s)
15 ; PSUMSGT ("M")= # MESSAGES ("L")= # LINES
16 ;
17 ; restore variables
18 S PSUVARS="PSUSDT,PSUEDT,PSUMON,PSUDUZ,PSUMASF,PSUPBMG,PSUSMRY,ZTIO,PSUSNDR,PSUOPTS"
19 F I=1:1:$L(PSUVARS,",") S @$P(PSUVARS,",",I)=$P(^XTMP("PSU_"_PSUJOB,1),U,I)
20 ;S PSUMSG(PSUDIV,3,"M")=0,PSUMSG("L")=0
21 I $G(PSUMASF)!$G(PSUDUZ)!$G(PSUPBMG) D
22 .I '$D(^XTMP(PSUARSUB,"RECORDS")) D NODATA Q
23 .S PSUDIV=0,Z=0
24 .F S PSUDIV=$O(^XTMP(PSUARSUB,"RECORDS",PSUDIV)) Q:PSUDIV="" D
25 .. D XMD^PSUAR3(.Z) ; ==> process one division
26 .. S PSUMSG(PSUDIV,3,"M")=$G(PSUMSG(PSUDIV,3,"M"))+Z("M")
27 .. S PSUMSG(PSUDIV,3,"L")=$G(PSUMSG(PSUDIV,3,"L"))+Z("L")
28 Q
29XMD(PSUMSG) ;EP returns PSUMSG("M")= # MESSAGES ("L")= # LINES
30 NEW PSUMAX,PSULC,PSUTMC,PSUTLC,PSUMC
31 ; Scan TMP, split lines, transmit per MAX lines in Netmail
32 S PSUMAX=$$VAL^PSUTL(4.3,1,8.3)
33 S:PSUMAX'>0 PSUMAX=10000
34 ;
35 ; Split and store into ^XTMP(PSUARSUB,"XMD",PSUMC,PSUMLC)
36 K ^XTMP(PSUARSUB,"XMD")
37 S PSUMC=1,PSUMLC=0
38 F PSULC=1:1 S X=$G(^XTMP(PSUARSUB,"RECORDS",PSUDIV,PSULC)) Q:X="" D
39 . S PSUMLC=PSUMLC+1
40 . I PSUMLC>PSUMAX S PSUMC=PSUMC+1,PSUMLC=0,PSULC=PSULC+1 Q ; + message
41 . I $L(X)<235 S ^XTMP(PSUARSUB,"XMD",PSUMC,PSUMLC)=X Q
42 . F I=235:-1:1 S Z=$E(X,I) Q:Z="^"
43 . S ^XTMP(PSUARSUB,"XMD",PSUMC,PSUMLC)=$E(X,1,I)
44 . S PSUMLC=PSUMLC+1
45 . S ^XTMP(PSUARSUB,"XMD",PSUMC,PSUMLC)="*"_$E(X,I+1,999)
46 ;
47 ; Count Lines sent
48 S PSUTLC=0
49 F PSUM=1:1:PSUMC S X=$O(^XTMP(PSUARSUB,"XMD",PSUM,""),-1),PSUTLC=PSUTLC+X
50 ;
51 ; Transmit Messages
52VARS ; Setup variables for contents
53 F PSUM=1:1:PSUMC D
54 . S X=PSUDIV,DIC=40.8,DIC(0)="X",D="C" D IX^DIC ;**1
55 . S X=+Y S PSUDIVNM=$$VAL^PSUTL(40.8,X,.01)
56 . S XMSUB="V. 4.0 PBMAR "_$G(PSUMON)_" "_PSUM_"/"_PSUMC_" "_PSUDIV_" "_PSUDIVNM
57 . S XMTEXT="^XTMP(PSUARSUB,""XMD"",PSUM,"
58 . S XMDUZ=DUZ
59 . M XMY=PSUXMYH
60 . S XMCHAN=1
61 . I $G(PSUMASF)!$G(PSUDUZ)!$G(PSUPBMG) D
62 ..I '$G(PSUSMRY) D ^XMD
63 ;
64 S PSUMSG("M")=PSUMC
65 S PSUMSG("L")=PSUTLC
66 M ^XTMP(PSUARSUB,"MSGCOUNT")=PSUMSG ;
67 Q
68 ;
69NODATA ;EP Build a NODATA Message
70 S PSUDIV=PSUSNDR
71 S PSUMSG(PSUDIV,11,"M")=PSUMASF,PSUMSG(PSUDIV,11,"L")=0
72 S XMDUZ=DUZ
73 M XMY=PSUXMYH
74 S (X,PSUDIV)=PSUSNDR,DIC=40.8,DIC(0)="X",D="C" D IX^DIC ;**1
75 S X=+Y S PSUDIVNM=$$VAL^PSUTL(40.8,X,.01)
76 S PSUM=1,PSUMC=1
77 S XMSUB="V 4.0 PBMAR "_$G(PSUMON)_" "_PSUM_"/"_PSUMC_" "_PSUDIV_" "_PSUDIVNM
78 N X
79 S X(1)="No data to report"
80 S XMTEXT="X("
81 S XMCHAN=1
82 ;I $G(PSUMASF) D ^XMD
83 D ^XMD
84 S PSUMSG(PSUDIV,3,"M")=1,PSUMSG(PSUDIV,3,"L")=0
85 Q
Note: See TracBrowser for help on using the repository browser.