Home   Package List   Routine Alphabetical List   Global Alphabetical List   FileMan Files List   FileMan Sub-Files List   Package Component Lists   Package-Namespace Mapping  
Routine: PSUAR3

PSUAR3.m

Go to the documentation of this file.
  1. PSUAR3 ;BIR/PDW - PBM AR/WS EXTRACT DETAILED MAIL GENERATOR ; 1/12/09 12:12pm
  1. ;;4.0;PHARMACY BENEFITS MANAGEMENT;**15**;MARCH, 2005;Build 2
  1. ; DBIA(s)
  1. ; Reference to file #4.3 supported by DBIA 2496
  1. ; Reference to file #40.8 supported by DBIA 2438
  1. ;PSULC = Line processing in ^tmp
  1. ;PSUTLC = Total Line count
  1. ;PSUMC = Message counter
  1. ;PSUMLC = Message Line Counter
  1. ; RETURNS
  1. ;PSUMSG("M") = # Messages
  1. ;PSUMSG("L") = # Lines
  1. ;
  1. EN(PSUMSG) ;Scan and process for Division(s)
  1. ; PSUMSGT ("M")= # MESSAGES ("L")= # LINES
  1. ;
  1. ; restore variables
  1. S PSUVARS="PSUSDT,PSUEDT,PSUMON,PSUDUZ,PSUMASF,PSUPBMG,PSUSMRY,ZTIO,PSUSNDR,PSUOPTS"
  1. F I=1:1:$L(PSUVARS,",") S @$P(PSUVARS,",",I)=$P(^XTMP("PSU_"_PSUJOB,1),U,I)
  1. ;S PSUMSG(PSUDIV,3,"M")=0,PSUMSG("L")=0
  1. I $G(PSUMASF)!$G(PSUDUZ)!$G(PSUPBMG) D
  1. .I '$D(^XTMP(PSUARSUB,"RECORDS")) D NODATA Q
  1. .S PSUDIV=0,Z=0
  1. .F S PSUDIV=$O(^XTMP(PSUARSUB,"RECORDS",PSUDIV)) Q:PSUDIV="" D
  1. .. D XMD^PSUAR3(.Z) ; ==> process one division
  1. .. S PSUMSG(PSUDIV,3,"M")=$G(PSUMSG(PSUDIV,3,"M"))+Z("M")
  1. .. S PSUMSG(PSUDIV,3,"L")=$G(PSUMSG(PSUDIV,3,"L"))+Z("L")
  1. Q
  1. XMD(PSUMSG) ;EP returns PSUMSG("M")= # MESSAGES ("L")= # LINES
  1. NEW PSUMAX,PSULC,PSUTMC,PSUTLC,PSUMC
  1. ; Scan TMP, split lines, transmit per MAX lines in Netmail
  1. S PSUMAX=$$VAL^PSUTL(4.3,1,8.3)
  1. S:PSUMAX'>0 PSUMAX=10000
  1. ;
  1. ; Split and store into ^XTMP(PSUARSUB,"XMD",PSUMC,PSUMLC)
  1. K ^XTMP(PSUARSUB,"XMD")
  1. S PSUMC=1,PSUMLC=0
  1. F PSULC=1:1 S X=$G(^XTMP(PSUARSUB,"RECORDS",PSUDIV,PSULC)) Q:X="" D
  1. . S PSUMLC=PSUMLC+1
  1. . I PSUMLC>PSUMAX S PSUMC=PSUMC+1,PSUMLC=0,PSULC=PSULC+1 Q ; + message
  1. . I $L(X)<235 S ^XTMP(PSUARSUB,"XMD",PSUMC,PSUMLC)=X Q
  1. . F I=235:-1:1 S Z=$E(X,I) Q:Z="^"
  1. . S ^XTMP(PSUARSUB,"XMD",PSUMC,PSUMLC)=$E(X,1,I)
  1. . S PSUMLC=PSUMLC+1
  1. . S ^XTMP(PSUARSUB,"XMD",PSUMC,PSUMLC)="*"_$E(X,I+1,999)
  1. ;
  1. ; Count Lines sent
  1. S PSUTLC=0
  1. F PSUM=1:1:PSUMC S X=$O(^XTMP(PSUARSUB,"XMD",PSUM,""),-1),PSUTLC=PSUTLC+X
  1. ;
  1. ; Transmit Messages
  1. VARS ; Setup variables for contents
  1. F PSUM=1:1:PSUMC D
  1. . S X=PSUDIV,DIC=40.8,DIC(0)="X",D="C" D IX^DIC ;**1
  1. . S X=+Y S PSUDIVNM=$$VAL^PSUTL(40.8,X,.01)
  1. . S XMSUB="V. 4.0 PBMAR "_$G(PSUMON)_" "_PSUM_"/"_PSUMC_" "_PSUDIV_" "_PSUDIVNM
  1. . S XMTEXT="^XTMP(PSUARSUB,""XMD"",PSUM,"
  1. . S XMDUZ=DUZ
  1. . M XMY=PSUXMYH
  1. . S XMCHAN=1
  1. . I $G(PSUMASF)!$G(PSUDUZ)!$G(PSUPBMG) D
  1. ..I '$G(PSUSMRY) D ^XMD
  1. ;
  1. S PSUMSG("M")=PSUMC
  1. S PSUMSG("L")=PSUTLC
  1. M ^XTMP(PSUARSUB,"MSGCOUNT")=PSUMSG ;
  1. Q
  1. ;
  1. NODATA ;EP Build a NODATA Message
  1. S PSUDIV=PSUSNDR
  1. S PSUMSG(PSUDIV,11,"M")=PSUMASF,PSUMSG(PSUDIV,11,"L")=0
  1. S XMDUZ=DUZ
  1. M XMY=PSUXMYH
  1. S (X,PSUDIV)=PSUSNDR,DIC=40.8,DIC(0)="X",D="C" D IX^DIC ;**1
  1. S X=+Y S PSUDIVNM=$$VAL^PSUTL(40.8,X,.01)
  1. S PSUM=1,PSUMC=1
  1. ;PSU*4*15
  1. S XMSUB="V. 4.0 PBMAR "_$G(PSUMON)_" "_PSUM_"/"_PSUMC_" "_PSUDIV_" "_PSUDIVNM
  1. N X
  1. S X(1)="No data to report"
  1. S XMTEXT="X("
  1. S XMCHAN=1
  1. ;I $G(PSUMASF) D ^XMD
  1. D ^XMD
  1. S PSUMSG(PSUDIV,3,"M")=1,PSUMSG(PSUDIV,3,"L")=0
  1. Q