PSBVDLIV ;BIRMINGHAM/EFC-BCMA IV VIRTUAL DUE LIST ;Mar 2004 ;;3.0;BAR CODE MED ADMIN;**6,38,32**;Mar 2004;Build 32 ;Per VHA Directive 2004-038 (or future revisions regarding same), this routine should not be modified. ; ; Reference/IA ; EN^PSJBCMA/2828 ; EN^PSJBCMA1/2829 ; EN(DFN,PSBDT) ; Default Order List Return for Today ; ; RPC: PSB GETORDERLIST ; ; Description: ; Returns the current IV order set for today to display on the ; client VDL ; N PSBDATA,PSBTBOUT,PSBDOADD S PSBTBOUT=0,PSBDOADD=0 S:PSBTAB="IVTAB" PSBDOADD=1 ; ; Passing PSBDT as 3rd parameter turns off the V.1.0 One-Time lookback K ^TMP("PSJ",$J),^TMP("PSB",$J,"ON IVTAB") S X1=PSBDT,X2=-3 D C^%DTC S PSBDT2=X D EN^PSJBCMA(DFN,PSBDT2,PSBDT) ; I $G(^TMP("PSJ",$J,1,0))=-1 Q ; No orders ; F PSBX=0:0 S PSBX=$O(^TMP("PSJ",$J,PSBX)) Q:('PSBX)!(PSBTBOUT) D .D CLEAN^PSBVT,PSJ^PSBVT(PSBX) .; .; << Standard checks for ALL orders >> .; .Q:PSBONX'["V" ; IVs only .Q:PSBIVT["P" ; No piggybacks .Q:PSBONX["P" ; No Pending Orders .Q:PSBOST>($$FMADD^XLFDT($$NOW^XLFDT,,,$$GET^XPAR("DIV","PSB ADMIN BEFORE"))) .; Need to see if "last order" in chain is active/not pending. .S PSBFON1=PSBFON,PSBLOOP=0 I $G(PSBFON)]"" S PSBLACTV=$S($G(PSBFON)["P":0,1:1) S PSBFON2=$G(PSBFON) I 'PSBLACTV F D Q:($G(PSBFON)="")!($G(PSBFON1)=$G(PSBFON2))!(PSBLOOP)!(PSBLACTV) ; ..I $G(PSBFON)["P" K ^TMP("PSJ1",$J) D EN^PSJBCMA1(DFN,PSBFON2,1) I ^TMP("PSJ1",$J,0)=-1 S PSBFON="" ..D:$G(PSBFON)["" CLEAN^PSBVT,PSJ1^PSBVT(DFN,PSBFON2) ..I PSBFON=PSBFON2 S PSBLOOP=1,PSBLACTV=0 Q ..S PSBLACTV=$S($G(PSBFON)["P":0,$G(PSBFON)']"":PSBLACTV,1:1),PSBFON2=$G(PSBFON) ..S:(PSBLACTV)&($G(PSBOST)>($$FMADD^XLFDT($$NOW^XLFDT,,,$$GET^XPAR("DIV","PSB ADMIN BEFORE")))) PSBLACTV=0 .D CLEAN^PSBVT,PSJ^PSBVT(PSBX) ;Refresh data .K PSBCOMP,PSBCOMPX,PSBINFDT,PSBINFST D INFUSING^PSBVDLU2 .D NOW^%DTC .I ((PSBOSTS="A")!(PSBOSTS="R"))&(PSBOSP<%) S PSBOSTS="E" .I (PSBOSTS["D")&(PSBCOMP=0) Q ; Is it DC'd and not infusing or stopped .I PSBOSTS="E",PSBCOMP=0 Q ; Is expired and not infusing or stopped .I PSBOSTS="D",PSBCOMP=1,($G(PSBFON)]""),PSBLACTV Q ; order is DC'ed will be picked up by following order .I PSBOSTS="E",PSBCOMP=1,($G(PSBFON)]""),PSBLACTV Q ; order is expired will be picked up by following order .I PSBOSTS="R",PSBFOR="R",PSBOSPPSBWEND) ; Make sure it is in the window ...D:(PSB'PSBWEND) ; Make sure it is in the window ...D:(PSB'