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

APSQFAS2.m

Go to the documentation of this file.
APSQFAS2 ;IHS/ASDS/ENM/POC - PROGRAM TO COMPUTE LATE RXS; 
 ;;6.0;IHS PHARMACY MODIFICATIONS;**3**;FEB 20, 2001
 I '$D(IOF) S %ZIS="N",IOP=0 D ^%ZIS
 S U="^",DNUM=0
 IF '$D(DUZ)!($G(DUZ)=0) W !,"NEED TO DEFINE DUZ" G EXIT
 ;IF '($D(DUZ(2))#10) D ^AUKVAR
 IF '$D(DT) D NOW^%DTC S DT=X
 ;
 ;
GETEM K DIC I $D(DELETE) W !,"THE DRUG YOU SELECT WILL BE DELETED FROM YOUR LIST IF IT IS ON THE LIST"
 F  Q:U[$G(X,0)!($G(ALL))  S DNUM=DNUM+1 D  ;U[""OR ^ AS TRUE
 .S DIC="^APSQFAST(",DIC(0)="AEMQ"
 .S DIC("W")="W "" ""_$S($P(^(0),U,2):$P(^PSDRUG($P(^(0),U,2),0),U,1),1:""EXPLODE"")"
 .S DIC("S")="I $G(^(""I""),0)=0!($P($G(^(0)),U)>DT)"
 .S DIC("A")="SELECT THE FAST CODE YOU WANT TO"_$S($D(DELETE):" DELETE",1:" ADD")_": "
 .D ^DIC K DIC
 .IF X="" K DELETE W @IOF Q
 .I $D(DELETE) D  Q
 ..S DRUGX=$P(^APSQFAST(+Y,0),U)
 ..W !,DRUGX," "
 ..I $D(DRUG(DRUGX)) W "DELETED" K DRUG(DRUGX)
 ..E  W "IS NOT A MEMBER OF SELECTED FAST CODES!"
 ..Q
 .;NEXT THREE LINES EDITED 11/24/98 IHS/OKCAO/POC
 .IF +Y>0 D
 ..S DRUGNAM=$P(^APSQFAST(+Y,0),U),DRUG(DRUGNAM)=Y
 ..S DRUGNAM=$P(^APSQFAST(+Y,0),U)_" "_$S($P(^APSQFAST(+Y,0),U,2):$P(^PSDRUG($P(^APSQFAST(+Y,0),U,2),0),U,1),1:"")
 .Q
 ;
LIST ;LIST OF DRUGS CHOOSEN
 W !,"LISTED ARE THE FAST CODES SELECTED SO FAR:",!
 I '$D(DRUG) W !,"NO FAST CODES HAVE BEEN SELECTED",!
 S DRUGNAM=0 F  S DRUGNAM=$O(DRUG(DRUGNAM)) Q:DRUGNAM=""  W !,DRUGNAM
 ;
 K DIR
 S DIR(0)="S^A:ADD MORE FAST CODES;D:DELETE A DRUG;C:CONTINUE"
 S DIR("B")="C"
 S DIR("A")="ANSWER WITH THE RESPONSE TO ADD, DELETE, CONTINUE, OR '^' TO EXIT"
 D ^DIR K DIR,X
 I Y="A" G GETEM
 I Y="D" S DELETE=1 G GETEM
 I $D(DIRUT) G EXIT ;ADD SOME HERE XXX
 D EXPAND
 G:'$D(DRUG) EXIT
 Q
DIQ S APSQHIT=0 F  S APSQHIT=$O(DRUG(APSQHIT)) Q:APSQHIT=""  D  D ^APSQFAS3
 .S APSQDG=+DRUG(APSQHIT)
 .Q:'APSQDG
 .D GETS^DIQ(9009035.3,APSQDG_",","*","I","APSQ","ERR")
 .M APSQF=APSQ(9009035.3,APSQDG_",") K APSQ ;EASIER TO WORK WITH
 ;
 Q
EXPAND ;EXPAND ANY EXPLODING ENTRIES
 S DRUGNAM="" F  S DRUGNAM=$O(DRUG(DRUGNAM)) Q:DRUGNAM=""  D
 .S DRUGNAMI=+DRUG(DRUGNAM)
 .Q:'$O(^APSQFAST(DRUGNAMI,2,0))
 .S APSQEXP=0 F  S APSQEXP=$O(^APSQFAST(DRUGNAMI,2,APSQEXP)) Q:APSQEXP'=+APSQEXP  D
 ..S APSQEXPI=^APSQFAST(DRUGNAMI,2,APSQEXP,0)
 ..S DRUGALSO($P(^APSQFAST(APSQEXPI,0),U,1))=APSQEXPI
 .K DRUG(DRUGNAM)
 M DRUG=DRUGALSO
 K DRUGALSO
 Q
EXIT ;KILL AND EXIT
 K PSONEW,PSONEW1
 S PSONEW("QFLG")=1
 K DRUGALSO,DRUG
 Q