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

APSPHLD.m

Go to the documentation of this file.
APSPHLD ;IHS/MSC/PLS- Support for speed unhold ;24-May-2013 09:10;PLS
 ;;7.0;OUTPATIENT PHARMACY;**1013,1015**;DEC 1997;Build 62
SPEED ;speed UNHOLD
 K LST,PSORX("FILL DATE")
 N APSPVAL,PSONOOR
 N VALMCNT I '$G(PSOCNT) S VALMSG="This patient has no Prescriptions!" S VALMBCK="" Q
 K PSOHLD,PSOFDR,DIR,DUOUT,DIRUT S DIR("A")="Select Orders by number",DIR(0)="LO^1:"_PSOCNT D ^DIR I $D(DIRUT)!($D(DTOUT))!($D(DUOUT)) K DIR,DIRUT,DTOUT,DUOUT S VALMBCK="" Q
 K DIR,DIRUT,DTOUT,PSOOELSE,DTOUT I +Y S (SPEED,PSOOELSE)=1 D FULL^VALM1 S LST=Y D  G:$G(PSOHLD("DFLG"))!($G(PSOHLD("QFLG"))) SPEEDX
 .D ASKVAL(.APSPVAL)
 .Q:$G(APSPVAL("DFLG"))
 .F ORD=1:1:$L(LST,",") Q:$P(LST,",",ORD)']""!($G(PSOHLD("QFLG")))  S ORN=$P(LST,",",ORD) D:+PSOLST(ORN)=52
 ..D PSOL^PSSLOCK($P(PSOLST(ORN),"^",2)) I '$G(PSOMSG) W $C(7),!!,$S($P($G(PSOMSG),"^",2)'="":$P($G(PSOMSG),"^",2),1:"Another person is editing Rx "_$P(^PSRX($P(PSOLST(ORN),"^",2),0),"^")),! D PAUSE^VALM1 K PSOMSG Q
 ..I $P($G(^PSRX($P(PSOLST(ORN),"^",2),"STA")),"^")=11 D  D ULK Q
 ...W $C(7),!!?5,"RX "_$P($G(^PSRX($P(PSOLST(ORN),"^",2),0)),"^")_" is in an EXPIRED status." W ! K DIR S DIR(0)="E",DIR("A")="Press Return to Continue" D ^DIR K DIR Q
 ...D:$G(PSOHLD("QFLG")) ULK
 ..S PSONOOR=APSPVAL("NOOR")
 ..D UHLD($P(PSOLST(ORN),U,2)),ULK
 S:'$G(PSOOELSE) VALMBCK=""
 S PSORXED=1 D ^PSOBUILD,BLD^PSOORUT1
SPEEDX D EX K PSOREF,PSORX("BAR CODE"),PSOLIST,LFD,MAX,MIN,NODE,PS,PSOERR,REF,RF,RXO,RXN,RXP,RXS,SD,VAERR,PSORX("FILL DATE")
 K LST,SPEED,PSORXED,PSOREF,PSOFDR,PSOOELSE S:'$D(VALMBCK) VALMBCK="R"
 K PSORX("FILL DATE"),PSORX("MAIL/WINDOW"),PSORX("METHOD OF PICK-UP")
 Q
 ;
ULK D PSOUL^PSSLOCK($P(PSOLST(ORN),"^",2))
 Q
 ;
ULP D ULP^PSOHLD
 Q
UHLD(DA) ;EP-
 S Y(0)=^PSRX(DA,0),STA=+$G(^("STA"))
 I STA=16 S VALMSG="Placed on HOLD by Provider!" K Y,STA D PSOUL^PSSLOCK(DA) D ULP S VALMBCK="" Q
 I STA'=3!('$D(^XUSEC("PSORPH",DUZ))) S VALMSG="Invalid Action Selection!",VALMBCK="" K Y,STA D PSOUL^PSSLOCK(DA) D ULP Q
 D FULL^VALM1 K DIR,DTOUT,DUOUT,DIRUT  ;D NOOR^PSOHLD I $D(DIRUT) Q
 I DT>$P(^PSRX(DA,2),"^",6) D  Q
 .S VALMSG="Medication Expired on "_$E($P(^PSRX(DA,2),"^",6),4,5)_"-"_$E($P(^(2),"^",6),6,7)_"-"_$E($P(^(2),"^",6),2,3) I $P(^PSRX(DA,"STA"),"^")<11 S $P(^PSRX(DA,"STA"),"^")=11
 .S ^PSRX(DA,"H")="",COMM="Medication Expired on "_$E($P(^(2),"^",6),4,5)_"-"_$E($P(^(2),"^",6),6,7)_"-"_$E($P(^(2),"^",6),2,3) D EN^PSOHLSN1(DA,"SC","ZE",COMM,"") K COMM
EN S RXF=0 F I=0:0 S I=$O(^PSRX(DA,1,I)) Q:'I  S RXF=I,RSDT=$P(^(0),"^")
 I RXF D  I $D(Y) Q
 .S (PSDA,DA(1))=DA,DA=RXF,DIE="^PSRX("_DA(1)_",1,"
 .S RLDT=$P(^PSRX(DA(1),1,DA,0),"^",18)
 .S DR=$S('RLDT:".01R;2;",1:"")_"3COMMENTS"_";8///"_PSOSITE
 .S PSOUNHLD=1 D ^DIE K PSOUNHLD
 .S ZD(PSDA)=$P(^PSRX(DA(1),1,DA,0),U)
 .Q:$D(Y)  S PSORX("FILL DATE")=$P(^PSRX(DA(1),1,DA,0),"^"),DA=PSDA K DA(1)
 S ACT=1,DIE="^PSRX(",FDT=$S($P(^PSRX(DA,2),U,2):$P(^PSRX(DA,2),U,2),1:DT)
 S RLDT=$P(^PSRX(DA,2),U,13)
 S DR="",RLDTP1=$P(RLDT,".",1)
 ;I 'RXF&'RLDT S DR="22//^S X=FDT;11;Q;"
 I 'RXF&'RLDT S DR="22///^S X=APSPVAL(""FILL DATE"");11///^S X=APSPVAL(""MAIL/WINDOW"");Q;"
 ;I RLDT&($P(^PSRX(DA,2),"^",2)="") S DR="22//^S X=RLDTP1;11;Q;"
 I RLDT&($P(^PSRX(DA,2),"^",2)="") S DR="22///^S X=RLDTP1;11///^S X=APSPVAL(""MAIL/WINDOW"");Q;"
 S DR=DR_"100///0;101///^S X=$S(RXF:$G(ZD(DA)),1:$P(^PSRX(DA,2),""^"",2))"
 ;
 S:'RXF DR=DR_";20///"_PSOSITE
 D ^DIE  K FDT   ;I $D(Y) S VALMBCK="R" Q
 S COMM="Medication Removed from Hold by Pharmacy" D EN^PSOHLSN1(DA,"OE","",COMM,PSONOOR) K COMM   ;,PSONOOR
 S PSORX("FILL DATE")=$S('RXF:$P(^PSRX(DA,2),U,2),1:ZD(DA))
 K ^PSRX("AH",$P(^PSRX(DA,"H"),U),DA) S ^PSRX(DA,"H")=""
 D ACT^PSOHLDA S (NEW1,NEW11)="^^"
 S (RXF,RXFL(DA))=0 F JJ=0:0 S JJ=$O(^PSRX(DA,1,JJ)) Q:'JJ  S (RXFL(DA),RXF)=JJ
 I $G(PSXSYS) D UNHOLD^PSOCMOPA Q:$G(XFLAG)
 I $G(DA) D RELC^PSOHLD Q:$G(PSOHRL)
 I PSORX("FILL DATE")>DT,$P(PSOPAR,U,6) D S^PSORXL Q
 S PCOMH(DA)="Medication Removed from Hold by Pharmacy"
 I $G(DA) S RXRH(DA)=DA
 I $P($G(^PSRX(DA,2)),U,15)'="" S $P(^PSRX(DA,2),U,14)=1,RXRP(DA)=1,$P(RXRP(DA),U,2)=$P($G(^PSRX(DA,0)),U,18) ; MARK PRESCRIPTION AND LABEL AS BEING REPRINTED WHEN UNHOLDING A RETURNED TO STOCK PRESCRIPTION
 I $G(PSORX("PSOL",1))']"" S PSORX("PSOL",1)=DA_"," Q
 F PSOX1=0:0 S PSOX1=$O(PSORX("PSOL",PSOX1)) Q:'PSOX1  S PSOX2=PSOX1
 I $L(PSORX("PSOL",PSOX2))+$L(DA)<220 S PSORX("PSOL",PSOX2)=PSORX("PSOL",PSOX2)_DA_","
 E  S PSORX("PSOL",PSOX2+1)=DA_","
 D PSOUL^PSSLOCK($P(PSOLST(ORN),U,2))
 Q
EX D PSOUL^PSSLOCK($P(PSOLST(ORN),"^",2)) D ^PSOBUILD
 K PSOHRL,PSOMSG,PSOPLCK,ST,PSL,PSNP,IR,NOW,DR,NEW1,NEW11,RTN,DA,PPL,RXN,RX0,RXS,DIK,RXP,FLD,ACT,DIE,DIC,DIR,DIE,X,Y,DIRUT,DUOUT,SUSPT,C,D0,LFD,I,PSDA,RFDATE,DI,DQ,%,RFN,XFLAG
 K HRX,PSHLD,PSOLIST,PSORX("FILL DATE"),STA,QTY,RFDT,PSORX0,PSRXN,RXF,JJ Q
 K PSORX("FILL DATE"),PSORX("MAIL/WINDOW"),PSORX("METHOD OF PICK-UP")
 ;
 ; Ask user for values to stuff.
ASKVAL(APSPVAL) ;EP-
 N DATAARY,DIR
 S (DATAARY("DFLG"),DATAARY("QFLG"))=0
 S DATAARY("FIELD")=0
 D NOOR^PSOHLD
 I $D(DIRUT) S APSPVAL("DFLG")=1 Q
 S APSPVAL("NOOR")=PSONOOR
 S APSPVAL("DFLG")=0
 D FILLDT^PSODIR2(.DATAARY)
 I $G(DATAARY("DFLG")) S APSPVAL("DFLG")=1 Q
 S APSPVAL("FILL DATE")=DATAARY("FILL DATE")
 K DIR
 S DIR("B")="WINDOW"
 S DIR(0)="52,11" D ^DIR
 I $D(DIRUT) S APSPVAL("DFLG")=1
 S APSPVAL("MAIL/WINDOW")=Y
 Q