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

PSSP176.m

Go to the documentation of this file.
PSSP176 ;DAL/RJS-PSS*1.0*176 PRE INSTALL ROUTINE
 ;;1.0;PHARMACY DATA MANAGEMENT;**176**;9/30/97;Build 3
 ;;
 ;;Reference to ^DDMOD is supported by DBIA# 2916.
 ;;
 Q
PREINT ; PRE INSTALL ENTRY POINT.
 D BMES^XPDUTL("PSS*1*176 PRE INSTALL STARTED!")
 D DELIX^DDMOD(50,13,1),DELIX^DDMOD(50,15,1)
 N PSSDRG,PSSNAME,PSSDEA,PSSNDC,PSSKEYN,PSSCNT,PSSTMP,PSSSITE,X1,X2,X
 S X1=DT,X2=180 D C^%DTC S ^XTMP("PSSP176",0)=X_"^"_DT_"^PSDRUG NDCOP BACKUP"  ;; STORE NDCOP DATA FOR 180 DAYS
 K ^TMP("PSSDRUG",$J),^TMP("PSSTEXT",$J)
 S (PSSDRG,PSSCNT)=0
 F PSSDRG=0:0 S PSSDRG=$O(^PSDRUG(PSSDRG)) Q:'PSSDRG  D CKDEA
 D MAIL
 K PSSDRG,PSSNAME,PSSDEA,PSSNDC,PSSKEYN,PSSCNT,PSSTMP,PSSSITE,PSSTXLN,PSSDSH,PSSDATA,XMTEXT
 D BMES^XPDUTL("PSS*1*176 PRE INSTALL COMPLETE!")
 Q
CKDEA ;Check each drug in the Drug file for non E PAYABLE drugs.
 S PSSDEA=""
 S PSSDEA=$$GET1^DIQ(50,PSSDRG,3)
 I PSSDEA="" D CKNDC Q
 I $G(PSSDEA)["M"!($G(PSSDEA)["0") D CKNDC Q
 I $G(PSSDEA)'["E" D
 .I $G(PSSDEA)["S"!($G(PSSDEA)["I")!($G(PSSDEA)["9") D CKNDC Q
 Q
CKNDC ;If a drug is non e-billable remove the NDC BY OUTPATIENT SITE multiple from the drug file
 Q:'$D(^PSDRUG(PSSDRG,"NDCOP",0))
 I '$O(^PSDRUG(PSSDRG,"NDCOP",0)) K ^PSDRUG(PSSDRG,"NDCOP") Q
 S PSSNAME=$$GET1^DIQ(50,PSSDRG,.01)
 S PSSNDC=$$GET1^DIQ(50,PSSDRG,31)
 I PSSNDC="" S PSSNDC="NO NDC"
 I PSSDEA="" S PSSDEA="NO DEA"
 S PSSCNT=PSSCNT+1
 S ^TMP("PSSDRUG",$J,PSSCNT)=PSSDRG_"^"_$E(PSSNAME,1,40)_"^"_PSSNDC_"^"_PSSDEA D XTMP
 K ^PSDRUG(PSSDRG,"NDCOP")
 Q
MAIL ;Set up mail message
 S XMDUZ="PSS*1*176 INCORRECT DRUG COST IN OUTPATIENT RX",XMSUB="WRONG NDC BY OUTPATIENT SITE"
 F PSSKEYN=0:0 S PSSKEYN=$O(^XUSEC("PSNMGR",PSSKEYN)) Q:'PSSKEYN  S XMY(PSSKEYN)=""
 S XMY(DUZ)=""
 S PSSDSH="",PSSCTR=0
 F PSSCTR=1:1:79 S PSSDSH=PSSDSH_"-"
 S ^TMP("PSSTEXT",$J,1)="The following is a list of drugs where the NDC by OUTPATIENT"
 S ^TMP("PSSTEXT",$J,2)="             SITE multiple has been removed."
 S ^TMP("PSSTEXT",$J,3)=""
 S ^TMP("PSSTEXT",$J,4)="No action is needed to be taken on these entries, unless the assigned"
 S ^TMP("PSSTEXT",$J,5)="   DEA Special Handling designation appears incorrect."
 S ^TMP("PSSTEXT",$J,6)=""
 S ^TMP("PSSTEXT",$J,7)="Total number of drug files modified = "_$S(PSSCNT=0:"(None modified)",1:PSSCNT)
 S ^TMP("PSSTEXT",$J,8)=""
 S PSSTXLN=9
 I $D(^TMP("PSSDRUG",$J)) D
 .S ^TMP("PSSTEXT",$J,PSSTXLN)="",PSSTXLN=PSSTXLN+1
 .S ^TMP("PSSTEXT",$J,PSSTXLN)="DRUG IEN                                                         DEA",PSSTXLN=PSSTXLN+1
 .S ^TMP("PSSTEXT",$J,PSSTXLN)=" GENERIC NAME                                     NDC         SPECIAL HDLG",PSSTXLN=PSSTXLN+1
 .S ^TMP("PSSTEXT",$J,PSSTXLN)=PSSDSH,PSSTXLN=PSSTXLN+1
 .F PSSCNT=0:0 S PSSCNT=$O(^TMP("PSSDRUG",$J,PSSCNT)) Q:'PSSCNT  D
 ..S PSSDATA=$G(^TMP("PSSDRUG",$J,PSSCNT))
 ..S ^TMP("PSSTEXT",$J,PSSTXLN)=$P(PSSDATA,"^",1),PSSTXLN=PSSTXLN+1
 ..S PSSTXT="" D TXT($P(PSSDATA,"^",2),2),TXT($P(PSSDATA,"^",3),48),TXT($P(PSSDATA,"^",4),66)
 ..S ^TMP("PSSTEXT",$J,PSSTXLN)=PSSTXT,PSSTXLN=PSSTXLN+1
 I '$D(^TMP("PSSDRUG",$J)) S ^TMP("PSSTEXT",$J,PSSTXLN)=PSSDSH,PSSTXLN=PSSTXLN+1
 S ^TMP("PSSTEXT",$J,PSSTXLN)="",PSSTXLN=PSSTXLN+1,^TMP("PSSTEXT",$J,PSSTXLN)="   *** End of Report ***"
 S XMTEXT="^TMP(""PSSTEXT"",$J," N DIFROM D ^XMD K XMSUB,XMTEST,XMY,XMDUZ
 K ^TMP("PSSTEXT",$J),^TMP("PSSDRUG",$J),PSSTXT,PSSCTR
 Q
TXT(PSSVAL,PSSCAL) S:'$D(PSSTXT) PSSTXT="" S PSSTXT=$$SETSTR^VALM1(PSSVAL,PSSTXT,PSSCAL,$L(PSSVAL))
 Q
XTMP ; BUILD A BACKUP OF THE REMOVED DATA
 N PSS1
 S ^XTMP("PSSP176",PSSDRG,"NDCOP",0)=^PSDRUG(PSSDRG,"NDCOP",0)
 S PSS1=0 F  S PSS1=$O(^PSDRUG(PSSDRG,"NDCOP",PSS1)) Q:'PSS1  S ^XTMP("PSSP176",PSSDRG,"NDCOP",PSS1)=^PSDRUG(PSSDRG,"NDCOP",PSS1,0)
 Q