VistA-WorldVistAEHR/r/OUTPATIENT_PHARMACY-PSO-APS.../PSOQ0076.m

22 lines
823 B
Mathematica

PSOQ0076 ;HINES/RMS - PRESCRIPTION FUNCTION "LAST RELEASED" ; 30 Nov 2007 7:49 AM
;;7.0;OUTPATIENT PHARMACY;**294**;DEC 1997;Build 13
;
LRDFUNC(PSOQRX) ;LAST RELEASE DATE IN FILEMAN FORMAT
N PSOQRD,PSOQRFD,PSOQANS,PSOQ
S PSOQANS=""
S PSOQRD=$P($G(^PSRX(PSOQRX,2)),"^",13)
S PSOQANS=PSOQRD
S PSOQ=0 F S PSOQ=$O(^PSRX(PSOQRX,1,PSOQ)) Q:'+PSOQ D ;
. S PSOQRFD=$P($G(^PSRX(PSOQRX,1,PSOQ,0)),"^",18)
. I PSOQRFD>PSOQANS S PSOQANS=PSOQRFD
Q PSOQANS
DAYSSUPP(PSOQRX) ;DAYS SUPPLY INDICATOR
Q $P($G(^PSRX(PSOQRX,0)),"^",8)
EXPDATE(PSOQRX) ;EXPIRATION DATE OF A PRESCRIPTION
Q $P($G(^PSRX(PSOQRX,2)),"^",6)
REFILLS(PSOQRX) ;REFILLS REMAINING
N PSOQRCT K RFILLS
Q:'$D(^PSRX(PSOQRX,0)) ""
S RFILLS=$P(^PSRX(PSOQRX,0),"^",9),PSOQRCT=0 F S PSOQRCT=$O(^PSRX(PSOQRX,1,PSOQRCT)) Q:'PSOQRCT S RFILLS=RFILLS-1
Q RFILLS