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

PSUCP2.m

Go to the documentation of this file.
  1. PSUCP2 ;BIR/TJH - CHECK COMPLETION OF MONTHLY PBM REPORT ;25 AUG 1998
  1. ;;4.0;PHARMACY BENEFITS MANAGEMENT;;MARCH, 2005
  1. ;
  1. ;DBIAs
  1. ; Reference to File #4 supported by DBIA 10090
  1. ; Reference to File #4.3 supported by DBIA 10091
  1. ; Reference to File #40.8 supported by DBIA 2438
  1. ; Reference to File #59.7 supported by DBIA 2854
  1. ;
  1. MANUAL ; Entry point if tasked by PSU PBM MANUAL option
  1. S PSUWAY="Manual"
  1. AUTO ; Entry point if tasked by PSU PBM AUTO option
  1. I '$D(PSUWAY) S PSUWAY="Automatic"
  1. D NOW^%DTC
  1. S PSUNOW=% K %,%H,%I,X
  1. S PSULRD=$$VALI^PSUTL(59.7,1,90) ; last run date
  1. D
  1. .I PSULRD="" S PSUOK=0 Q ; it's 24 hours later and finish time is not set, may be a problem.
  1. .S X1=PSUNOW,X2=PSULRD D ^%DTC
  1. .I X>6 S PSUOK=0 Q ; the last run date must be left over from a previous run, it's a problem.
  1. .S PSUOK=1
  1. G:PSUOK EXIT ; no message sent if OK.
  1. D XMY^PSUTL1
  1. M XMY=PSUXMYS1
  1. I $G(PSUMASF) M XMY=PSUXMYH
  1. S X=$$VALI^PSUTL(4.3,1,217),PSUDIV=+$$VAL^PSUTL(4,X,99)
  1. S X=PSUDIV,DIC=40.8,DIC(0)="XM" D ^DIC
  1. S X=+Y S PSUDIVNM=$$VAL^PSUTL(40.8,X,.01)
  1. S XMSUB="PBM "_PSUWAY_" Statistics Job "_PSUDIV_" "_PSUDIVNM
  1. S X(1)="The PBM "_PSUWAY_" Statistics background job did not run to completion."
  1. S X(2)="Please correct the problem and retransmit the data to the National PBM"
  1. S X(3)="section at Hines."
  1. S XMTEXT="X("
  1. S XMCHAN=1
  1. D ^XMD
  1. EXIT ; normal exit point from PSUCP2
  1. K PSUWAY,PSUNOW,PSULRD,PSUOK,PSUDIV,PSUDIVNM
  1. Q
  1. MMNOMAP ; Generate MM regarding locations not mapped
  1. Q:$D(^XTMP("PSU_"_PSUJOB,"PSUFLAG3")) ;Quit if user does not want a
  1. ;copy sent to self
  1. ;
  1. N TXT1,TXT2
  1. ;
  1. D PULL^PSUCP
  1. F I=1:1:$L(PSUOPTS,",") S PSUMOD($P(PSUOPTS,",",I))=""
  1. S X=$$VALI^PSUTL(4.3,1,217),PSUSNDR=+$$VAL^PSUTL(4,X,99),PSUNAME=$$VAL^PSUTL(4,X,.01)
  1. K TXT
  1. S TXT(1)="The locations listed below have not been mapped to a Medical Center"
  1. S TXT(2)="Division or Outpatient Site. All data extracted from these locations have"
  1. S TXT(3)="been attributed to "_PSUSNDR_" "_PSUNAME
  1. S TXT(4)=" "
  1. S TLC=4
  1. ;
  1. I $D(PSUARSUB) D
  1. .I $D(^XTMP(PSUARSUB,"AOU")),$D(PSUMOD(3)) D
  1. ..K AOUNMAP,MAP ;Array to hold unmapped AOU data
  1. ..N LOC,LOC1
  1. ..M MAP=^XTMP(PSUARSUB,"AOU")
  1. ..F TXT=" ","AOUs:" D TXT
  1. ..S IEN=0 F S IEN=$O(MAP(IEN)) Q:IEN="" D
  1. ...S LOC=MAP(IEN,.01)
  1. ...M AOUNMAP(LOC)=MAP(IEN)
  1. ..S LOC1=0
  1. ..F S LOC1=$O(AOUNMAP(LOC1)) Q:LOC1="" D
  1. ...S TXT1=AOUNMAP(LOC1,.01)
  1. ...S TXT2=$G(AOUNMAP(LOC1,3)) I TXT2'="" S TXT2=" **INACTIVE**"
  1. ...S TXT=TXT1_TXT2 D TXT
  1. .;
  1. .I '$D(^XTMP(PSUARSUB,"AOU")),$D(PSUMOD(3)) D
  1. ..F TXT=" ","AOUs:" D TXT
  1. ..S TXT="There are no unmapped AOU's for the dates of this extract" D TXT
  1. ;
  1. I $D(PSUARSUB) D
  1. .I $D(^XTMP(PSUARSUB,"NAOU")),$D(PSUMOD(6)) D
  1. ..K NAOUMAP,MAP
  1. ..N LOC,LOC1
  1. ..M MAP=^XTMP(PSUARSUB,"NAOU")
  1. ..F TXT="","NAOUs:" D TXT
  1. ..S IEN=0 F S IEN=$O(MAP(IEN)) Q:IEN'>0 D
  1. ...S LOC=MAP(IEN,.01)
  1. ...M NAOUMAP(LOC)=MAP(IEN)
  1. ..S LOC1=0
  1. ..F S LOC1=$O(NAOUMAP(LOC1)) Q:LOC1="" D
  1. ...S TXT1=NAOUMAP(LOC1,.01)
  1. ...S TXT2=$G(NAOUMAP(LOC1,4)) I TXT2'="" S TXT2=" **INACTIVE**"
  1. ...S TXT=TXT1_TXT2 D TXT
  1. .;
  1. .I '$D(^XTMP(PSUARSUB,"NAOU")),$D(PSUMOD(6)) D
  1. .. F TXT=" ","NAOUs:" D TXT
  1. ..S TXT="There are no unmapped NAOU's for the dates of this extract" D TXT
  1. ;
  1. I $D(PSUARSUB) D
  1. .I $D(^XTMP(PSUARSUB,"DAPH")),$D(PSUMOD(5)) D
  1. ..K DAPH,MAP
  1. ..N LOC,LOC1
  1. ..M MAP=^XTMP(PSUARSUB,"DAPH")
  1. ..F TXT="","DA Pharmacy Locations:" D TXT
  1. ..S IEN=0 F S IEN=$O(MAP(IEN)) Q:IEN'>0 D
  1. ...S LOC=MAP(IEN,.01)
  1. ...M DAPH(LOC)=MAP(IEN)
  1. ..S LOC1=0
  1. ..F S LOC1=$O(DAPH(LOC1)) Q:LOC1="" D
  1. ...S TXT1=DAPH(LOC1,.01)
  1. ...S TXT2=$G(DAPH(LOC1,4)) I TXT2'="" S TXT2=" **INACTIVE**"
  1. ...S TXT=TXT1_TXT2 D TXT
  1. .;
  1. .I '$D(^XTMP(PSUARSUB,"DAPH")),$D(PSUMOD(5)) D
  1. .. F TXT=" ","DA Pharmacy Locations:" D TXT
  1. ..S TXT="There are no unmapped DA Pharmacy Locations for the dates of this extract" D TXT
  1. ;
  1. MSGNOMAP ; send MM
  1. ;
  1. S Y=PSUSDT\1 X ^DD("DD") S PSUDTS=Y
  1. S Y=PSUEDT\1 X ^DD("DD") S PSUDTE=Y
  1. S XMSUB="PBM Unmapped Locations for "_PSUDTS_" to "_PSUDTE_" from "_PSUSNDR_" "_PSUNAME
  1. S XMTEXT="TXT("
  1. S XMY("G.PSU PBM")=""
  1. S XMY(DUZ)=""
  1. I $D(PSUARSUB) D ^XMD
  1. Q
  1. ;
  1. TXT S TLC=TLC+1,TXT(TLC)=TXT
  1. Q