PSOTPRX1 ;BIR/MHA-TPB medication procesing driver ;29-May-2012 15:15;PLS
;;7.0;OUTPATIENT PHARMACY;**146,182,227,268,300,1015**;DEC 1997;Build 62
;External reference ^PS(55 supported by DBIA 2228
;External reference ^DIC(31 supported by DBIA 658
;External reference EN2^GMRAPEM0 supported by DBIA 190
;
; Modified - IHS/MSC/PB - 03/30/2012 - Line OERR+16
Q ;placed out of order by patch PSO*7*227
START K PSOQFLG,PSOID,PSOFIN,PSOQUIT,PSODRUG S (PSOBCK,PSOERR)=1 D INIT
W:'$D(PSOTPBFG) !!,"*** Transitional Pharmacy Benefit Flag Undefined - Quitting ***"
G:PSORX("QFLG")!('$D(PSOTPBFG)) END
D PT G:$G(PSORX("QFLG")) END D FULL^VALM1 I $G(NOPROC) K NOPROC G NX
;call to add bingo board data to file 52.11
F SLPPL=0:0 S SLPPL=$O(RXRS(SLPPL)) Q:'SLPPL D
.I $P($G(^PSRX(SLPPL,"STA")),"^")'=5 K RXRS(SLPPL) Q
.S RXREC=SLPPL D WIND^PSOSUPOE I $G(PBINGRTE) D BBADD^PSOSUPOE S (BINGCRT,BINGRTE)=1 S:$G(PSOFROM)'="NEW" PSOFROM="REFILL"
K TM,TM1 I $G(PSORX("PSOL",1))]""!($D(RXRS)) D ^PSORXL K PSORX S PSOPBM1=1
G:$G(NOBG) NX
S TM=$P(^TMP("PSOBB",$J),"^"),TM1=$P(^TMP("PSOBB",$J),"^",2) K ^TMP("PSOBB",$J)
I $G(PSOFROM)="NEW"!($G(PSOFROM)="REFILL")!($G(PSOFROM)="PARTIAL") D:$D(BINGCRT)&($D(BINGRTE)&($D(DISGROUP))) ^PSOBING1 K BINGCRT,BINGRTE,BBRX,BBFLG
I $G(PSOPBM),$G(PSOPBM1) S $P(^PS(55,PSODFN,0),"^",7)=PSOPBM,$P(^(0),"^",8)="A" K PSOPBM,PSOPBM1
NX D:$G(PSODFN) EXFLAG^PSOTPCAN(PSODFN) D EOJ G START
END Q
;---------------------------------------------------------
INIT ;
S PSORX("QFLG")=0
D:'$D(PSOPAR) ^PSOLSET I '$D(PSOPAR) S PSORX("QFLG")=1
I $P($G(PSOPAR),"^",2),'$D(^XUSEC("PSORPH",DUZ)) S PSORX("VERIFY")=1
INITX Q
;
PT ;
K ^TMP("PSORXDC",$J),CLOZPAT,DIC,PSODFN,PSOPBM,PSOPBM1 S PSORX("QFLG")=0
S DIC("S")="I '$P(^PS(52.91,+Y,0),""^"",3)!($P(^(0),""^"",3)>DT)"
S DIC=52.91,DIC(0)="QEAM" D ^DIC K DIC,DA
I +Y'>0 S PSORX("QFLG")=1 G PTX
OERR N:$G(MEDP) PAT,POERR K PSOXFLG S (DFN,PSODFN)=+Y,PSORX("NAME")=$P($G(^DPT(PSODFN,0)),"^")
K NPPROC,PSOQFLG,DIC,DR,DIQ S DIC=2,DA=PSODFN,DR=.351,DIQ="PSOPTPST" D EN^DIQ1 K DIC,DA,DR,DIQ D DEAD^PSOPTPST I $G(PSOQFLG) S NOPROC=1 Q
I $P($G(^PS(55,PSODFN,"LAN")),"^") W !,"Patient has another language preference!",! H 3
D NOW^%DTC S TM=$E(%,1,12),TM1=$P(TM,".",2) S ^TMP("PSOBB",$J)=TM_"^"_TM1
S PSOQFLG=0,DIC="^PS(55,",DLAYGO=55
I $G(PSOFIN) S SSN=$P(^DPT(PSODFN,0),"^",9) W !!?10,$C(7),PSORX("NAME")_" ("_$E(SSN,1,3)_"-"_$E(SSN,4,5)_"-"_$E(SSN,6,9)_")" K SSN
K PSOPBM ; KILL SO THAT WON'T CARRY OVER PRIOR PATIENT'S VALUE
I '$D(^PS(55,PSODFN,0)) D
.S PSOPBM=$P(TM,".")
.K DD,DO S DIC(0)="L",(DINUM,X)=PSODFN D FILE^DICN D:Y<1 K DIC,DA,DR,DD,DO
..S $P(^PS(55,PSODFN,0),"^")=PSODFN K DIK S DA=PSODFN,DIK="^PS(55,",DIK(1)=.01 D EN^DIK K DIK
S PSOLOUD=1 D:$P($G(^PS(55,PSODFN,0)),"^",6)'=2 EN^PSOHLUP(PSODFN) K PSOLOUD
I $G(^PS(55,PSODFN,"PS"))']"" D I $G(POERR("QFLG")) G EOJ
.L +^PS(55,PSODFN):$S(+$G(^DD("DILOCKTM"))>0:+^DD("DILOCKTM"),1:3) I '$T W $C(7),!!,"Patient Data is Being Edited by Another User!",! S POERR("QFLG")=1 S:$G(PSOFIN) PSOQUIT=1 Q
.S PSOXFLG=1,SSN=$P(^DPT(PSODFN,0),"^",9) W !!?10,$C(7),PSORX("NAME")_" ("_$E(SSN,1,3)_"-"_$E(SSN,4,5)_"-"_$E(SSN,6,9)_")",! K SSN
.;IHS/MSC/PB - 03/30/2012 - Remove other language field
.;S DIE=55,DR=".02;.03;.04;.05;1;D ELIG^PSORX1;@1;3//NON-VA;D CHK^PSOTPRX1;50;106;106.1"
.S DIE=55,DR=".02;.03;.04;.05;1;D ELIG^PSORX1;@1;3//NON-VA;D CHK^PSOTPRX1;50;106.1"
.S DA=PSODFN W !!,?5,">>PHARMACY PATIENT DATA<<",! D ^DIE L -^PS(55,PSODFN)
.I $D(Y)!($D(DTOUT)) S PSOX=$G(^PS(55,PSODFN,"PS")) D:+$P(PSOX,"^")
..I $$UP^XLFSTR($P(^PS(53,$P(PSOX,"^"),0),"^"))'="NON-VA" S DR="3////@" D ^DIE
S PSOX=$G(^PS(55,PSODFN,"PS"))
I PSOX]"" S (X,PSORX("PATIENT STATUS"))=$$UP^XLFSTR($P(^PS(53,$P(PSOX,"^"),0),"^")) D:X'="NON-VA" WRN
I PSOX']"" D I $G(POERR("QFLG")) G EOJ
.W !!,"Patient Status Required!!",! D ELIG
.W ! K POERR("QFLG"),DIC,DR,DIE S DIC("B")="NON-VA"
.S DIC("A")="PATIENT STATUS: ",DIC(0)="QEAMZ",DIC=53 D ^DIC K DIC
.I $D(DIRUT)!(Y=-1) D Q
..W $C(7),"Required Data!",! S POERR("QFLG")=1 S:$G(PSOFIN) PSOQUIT=1
..I $G(PSOPBM) D K PSOPBM
...I $O(^PS(55,PSODFN,0))="" S DA=PSODFN,DIK="^PS(55," D ^DIK
.I $$UP^XLFSTR($P(^PS(53,+Y,0),"^"))'="NON-VA" D MES S POERR("QFLG")=1 Q
.S ^PS(55,PSODFN,"PS")=+Y,PSORX("PATIENT STATUS")=$P(^PS(53,+Y,0),"^")
.D KV
Q:$G(PSOFIN)
PROV ;
D ST^PSOTPPRV G:'$G(DA) NX
S PSORX("PROVIDER NAME")=$P(^VA(200,DA,0),"^")
D KV S DIR("A")="Do you want to enter allergies or adverse reactions at this time?"
S DIR("B")="Y",DIR(0)="YN" W !! D ^DIR I Y W !
D:Y EN2^GMRAPEM0
I '$G(PSOPBM),'$P(^PS(55,PSODFN,0),"^",7),$P(^(0),"^",8)']"" S PSOPBM=$P(TM,".")
D ^PSOBUILD
F PT="GET","DEAD","INP","CNH","ADDRESS","COPAY" S RTN=PT_"^PSOPTPST" D @RTN Q:$G(POERR("DEAD"))!($G(PSOQFLG))
I $G(POERR("DEAD")) S POERR("QFLG")=1 F II=0:0 S II=$O(^PS(52.41,"P",PSODFN,II)) D:$P($G(^PS(52.41,II,0)),"^",3)'="DC"&($P($G(^(0)),"^",3)'="DE") DC^PSOORFI2
K PSOERR("DEAD"),II I $G(PSOQFLG) S POERR("QFLG")=1 G EOJ Q
S (PAT,PSOXXDFN)=PSODFN,POERR=1 D ^PSOORUT2,BLD^PSOORUT1,EN^PSOLMUTL
D CLEAR^VALM1 G:$G(PSOQUIT) PTX D EN^PSOLMAO
S (DFN,PSODFN)=PSOXXDFN K DIE,DIC,DLAYGO,DR,DA,PSOX,PSORXED
PTX ;
K X,Y,^TMP("PS",$J),C,DEA,PRC,PSCNT,PSOACT,PSOCLC,PSOCS,PSOCT,PSOFINFL,PSOHD,PSOLST,PSOOPT,PSOPF,PSOX,PSOX1,PSOXXDFN,SIGOK,STP,STR
Q
CHK ;
Q:'X
I $$UP^XLFSTR($P(^PS(53,+X,0),"^"))'="NON-VA" D MES S Y="@1",$P(^PS(55,PSODFN,"PS"),"^")=""
Q
MES W $C(7),!!,"Invalid Selection - Only 'NON-VA' patient status can be processed through"
W !,"this option. For all other statuses use the regular Patient Prescription"
W !,"Processing option"
Q
WRN W $C(7),!!?15,"*** Current RX Patient Status is "_X_" ***"
W !,"Only 'NON-VA' patient status should be processed through this option."
W !,"For all other statuses use the regular Patient Prescription Processing option."
Q
EOJ ;
K PSOERR,PSOMED,PSORX,PSOSD,PSODRUG,PSODFN,PSOOPT,PSOBILL,PSOIBQS,PSOCPAY,PSOPF,PSOPI,COMM,DGI,DGS,PT,PTDY,PTRF,RN,RTN,SERS,ST0,STAT,DFN,STOP,SLPPL,RXREC,PSOPBM
K:'$G(MEDP) PSOQFLG
D KVA^VADPT,FULL^VALM1 K PSOLST,PSOXFLG,PSCNT,PSDIS,PSOAL,P1,LOG,%,%DT,%I,D0,DAT,DFN,DRG,ORX,PSON,PSOPTPST,PTST,PSOBCK,PSOID,PSOBXPUL
K INCOM,SIG,SG,STP,RX0,RXN,RX2,RX3,RTS,C,DEAD,PS,PSOCLC,PSOCNT,PSOCT,PSODA,PSOFROM,PSOHD,R3,REA,RF,RFD,RFM,RLD,RXNUM,RXP,RXPR,RXRP,RXRS,STR,POERR,VALMSG
K ^TMP("PSORXDC",$J),^TMP("PSOAL",$J),^TMP("PSOAO",$J),^TMP("PSOSF",$J),^TMP("PSOPF",$J),^TMP("PSOPI",$J),^TMP("PSOPO",$J),^TMP("PSOHDR",$J) I '$G(MEDP),'$G(PSOQUIT) K PAT
K RFN,PSOXXDFN,VALM,VALMKEY,PSOBCK,SPOERR,PSOFLAG,VALMBCK,D,GMRA,GMRAL,GMRAREC,PSOSTA,PSODT,RXFL,NOBG,BBRX,BBFLG
KV K DIR,DIRUT,DTOUT,DUOUT,X,Y
Q
ELIG ; shows eligibility and disabilities
D ELIG^VADPT W !,"Eligibility: "_$P(VAEL(1),"^",2)_$S(+VAEL(3):" SC%: "_$P(VAEL(3),"^",2),1:"") S N=0 F S N=$O(VAEL(1,N)) Q:'N W !,?10,$P(VAEL(1,N),"^",2)
W !,"Disabilities: " F I=0:0 S I=$O(^DPT(DFN,.372,I)) Q:'I S I1=$S($D(^DPT(DFN,.372,I,0)):^(0),1:"") D:+I1
.S PSDIS=$S($P($G(^DIC(31,+I1,0)),"^")]""&($P($G(^(0)),"^",4)']""):$P(^(0),"^"),$P($G(^DIC(31,+I1,0)),"^",4)]"":$P(^(0),"^",4),1:""),PSCNT=$P(I1,"^",2)
.W:$L(PSDIS_"-"_PSCNT_"% ("_$S($P(I1,"^",3):"SC",1:"NSC")_"), ")>80 !,?15
.W $S($G(PSDIS)]"":PSDIS_"-",1:"")_PSCNT_"% ("_$S($P(I1,"^",3):"SC",1:"NSC")_"), "
K N
Q
PROFILE ;
S (PSORX("REFILL"),PSORX("RENEW"))=0,PSOX="" D ^PSOBUILD
I '$G(PSOSD) W !,"This patient has no prescriptions" S:'$D(DFN) DFN=PSODFN D GMRA^PSODEM G PROFILEX
S (PSODRG,PSOX)="" F S PSODRG=$O(PSOSD(PSODRG)) Q:PSODRG="" F S PSOX=$O(PSOSD(PSODRG,PSOX)) Q:PSOX="" S:$P(PSOSD(PSODRG,PSOX),"^",3)="" PSORX("RENEW")=1 S:$P(PSOSD(PSODRG,PSOX),"^",4)="" PSORX("REFILL")=1
K PSOX
PROFILEX ;
Q
PSOTPRX1 ;BIR/MHA-TPB medication procesing driver ;29-May-2012 15:15;PLS
+1 ;;7.0;OUTPATIENT PHARMACY;**146,182,227,268,300,1015**;DEC 1997;Build 62
+2 ;External reference ^PS(55 supported by DBIA 2228
+3 ;External reference ^DIC(31 supported by DBIA 658
+4 ;External reference EN2^GMRAPEM0 supported by DBIA 190
+5 ;
+6 ; Modified - IHS/MSC/PB - 03/30/2012 - Line OERR+16
+7 ;placed out of order by patch PSO*7*227
QUIT
START KILL PSOQFLG,PSOID,PSOFIN,PSOQUIT,PSODRUG
SET (PSOBCK,PSOERR)=1
DO INIT
+1 IF '$DATA(PSOTPBFG)
WRITE !!,"*** Transitional Pharmacy Benefit Flag Undefined - Quitting ***"
+2 IF PSORX("QFLG")!('$DATA(PSOTPBFG))
GOTO END
+3 DO PT
IF $GET(PSORX("QFLG"))
GOTO END
DO FULL^VALM1
IF $GET(NOPROC)
KILL NOPROC
GOTO NX
+4 ;call to add bingo board data to file 52.11
+5 FOR SLPPL=0:0
SET SLPPL=$ORDER(RXRS(SLPPL))
IF 'SLPPL
QUIT
Begin DoDot:1
+6 IF $PIECE($GET(^PSRX(SLPPL,"STA")),"^")'=5
KILL RXRS(SLPPL)
QUIT
+7 SET RXREC=SLPPL
DO WIND^PSOSUPOE
IF $GET(PBINGRTE)
DO BBADD^PSOSUPOE
SET (BINGCRT,BINGRTE)=1
IF $GET(PSOFROM)'="NEW"
SET PSOFROM="REFILL"
End DoDot:1
+8 KILL TM,TM1
IF $GET(PSORX("PSOL",1))]""!($DATA(RXRS))
DO ^PSORXL
KILL PSORX
SET PSOPBM1=1
+9 IF $GET(NOBG)
GOTO NX
+10 SET TM=$PIECE(^TMP("PSOBB",$JOB),"^")
SET TM1=$PIECE(^TMP("PSOBB",$JOB),"^",2)
KILL ^TMP("PSOBB",$JOB)
+11 IF $GET(PSOFROM)="NEW"!($GET(PSOFROM)="REFILL")!($GET(PSOFROM)="PARTIAL")
IF $DATA(BINGCRT)&($DATA(BINGRTE)&($DATA(DISGROUP)))
DO ^PSOBING1
KILL BINGCRT,BINGRTE,BBRX,BBFLG
+12 IF $GET(PSOPBM)
IF $GET(PSOPBM1)
SET $PIECE(^PS(55,PSODFN,0),"^",7)=PSOPBM
SET $PIECE(^(0),"^",8)="A"
KILL PSOPBM,PSOPBM1
NX IF $GET(PSODFN)
DO EXFLAG^PSOTPCAN(PSODFN)
DO EOJ
GOTO START
END QUIT
+1 ;---------------------------------------------------------
INIT ;
+1 SET PSORX("QFLG")=0
+2 IF '$DATA(PSOPAR)
DO ^PSOLSET
IF '$DATA(PSOPAR)
SET PSORX("QFLG")=1
+3 IF $PIECE($GET(PSOPAR),"^",2)
IF '$DATA(^XUSEC("PSORPH",DUZ))
SET PSORX("VERIFY")=1
INITX QUIT
+1 ;
PT ;
+1 KILL ^TMP("PSORXDC",$JOB),CLOZPAT,DIC,PSODFN,PSOPBM,PSOPBM1
SET PSORX("QFLG")=0
+2 SET DIC("S")="I '$P(^PS(52.91,+Y,0),""^"",3)!($P(^(0),""^"",3)>DT)"
+3 SET DIC=52.91
SET DIC(0)="QEAM"
DO ^DIC
KILL DIC,DA
+4 IF +Y'>0
SET PSORX("QFLG")=1
GOTO PTX
OERR IF $GET(MEDP)
NEW PAT,POERR
KILL PSOXFLG
SET (DFN,PSODFN)=+Y
SET PSORX("NAME")=$PIECE($GET(^DPT(PSODFN,0)),"^")
+1 KILL NPPROC,PSOQFLG,DIC,DR,DIQ
SET DIC=2
SET DA=PSODFN
SET DR=.351
SET DIQ="PSOPTPST"
DO EN^DIQ1
KILL DIC,DA,DR,DIQ
DO DEAD^PSOPTPST
IF $GET(PSOQFLG)
SET NOPROC=1
QUIT
+2 IF $PIECE($GET(^PS(55,PSODFN,"LAN")),"^")
WRITE !,"Patient has another language preference!",!
HANG 3
+3 DO NOW^%DTC
SET TM=$EXTRACT(%,1,12)
SET TM1=$PIECE(TM,".",2)
SET ^TMP("PSOBB",$JOB)=TM_"^"_TM1
+4 SET PSOQFLG=0
SET DIC="^PS(55,"
SET DLAYGO=55
+5 IF $GET(PSOFIN)
SET SSN=$PIECE(^DPT(PSODFN,0),"^",9)
WRITE !!?10,$CHAR(7),PSORX("NAME")_" ("_$EXTRACT(SSN,1,3)_"-"_$EXTRACT(SSN,4,5)_"-"_$EXTRACT(SSN,6,9)_")"
KILL SSN
+6 ; KILL SO THAT WON'T CARRY OVER PRIOR PATIENT'S VALUE
KILL PSOPBM
+7 IF '$DATA(^PS(55,PSODFN,0))
Begin DoDot:1
+8 SET PSOPBM=$PIECE(TM,".")
+9 KILL DD,DO
SET DIC(0)="L"
SET (DINUM,X)=PSODFN
DO FILE^DICN
IF Y<1
Begin DoDot:2
+10 SET $PIECE(^PS(55,PSODFN,0),"^")=PSODFN
KILL DIK
SET DA=PSODFN
SET DIK="^PS(55,"
SET DIK(1)=.01
DO EN^DIK
KILL DIK
End DoDot:2
KILL DIC,DA,DR,DD,DO
End DoDot:1
+11 SET PSOLOUD=1
IF $PIECE($GET(^PS(55,PSODFN,0)),"^",6)'=2
DO EN^PSOHLUP(PSODFN)
KILL PSOLOUD
+12 IF $GET(^PS(55,PSODFN,"PS"))']""
Begin DoDot:1
+13 LOCK +^PS(55,PSODFN):$SELECT(+$GET(^DD("DILOCKTM"))>0:+^DD("DILOCKTM"),1:3)
IF '$TEST
WRITE $CHAR(7),!!,"Patient Data is Being Edited by Another User!",!
SET POERR("QFLG")=1
IF $GET(PSOFIN)
SET PSOQUIT=1
QUIT
+14 SET PSOXFLG=1
SET SSN=$PIECE(^DPT(PSODFN,0),"^",9)
WRITE !!?10,$CHAR(7),PSORX("NAME")_" ("_$EXTRACT(SSN,1,3)_"-"_$EXTRACT(SSN,4,5)_"-"_$EXTRACT(SSN,6,9)_")",!
KILL SSN
+15 ;IHS/MSC/PB - 03/30/2012 - Remove other language field
+16 ;S DIE=55,DR=".02;.03;.04;.05;1;D ELIG^PSORX1;@1;3//NON-VA;D CHK^PSOTPRX1;50;106;106.1"
+17 SET DIE=55
SET DR=".02;.03;.04;.05;1;D ELIG^PSORX1;@1;3//NON-VA;D CHK^PSOTPRX1;50;106.1"
+18 SET DA=PSODFN
WRITE !!,?5,">>PHARMACY PATIENT DATA<<",!
DO ^DIE
LOCK -^PS(55,PSODFN)
+19 IF $DATA(Y)!($DATA(DTOUT))
SET PSOX=$GET(^PS(55,PSODFN,"PS"))
IF +$PIECE(PSOX,"^")
Begin DoDot:2
+20 IF $$UP^XLFSTR($PIECE(^PS(53,$PIECE(PSOX,"^"),0),"^"))'="NON-VA"
SET DR="3////@"
DO ^DIE
End DoDot:2
End DoDot:1
IF $GET(POERR("QFLG"))
GOTO EOJ
+21 SET PSOX=$GET(^PS(55,PSODFN,"PS"))
+22 IF PSOX]""
SET (X,PSORX("PATIENT STATUS"))=$$UP^XLFSTR($PIECE(^PS(53,$PIECE(PSOX,"^"),0),"^"))
IF X'="NON-VA"
DO WRN
+23 IF PSOX']""
Begin DoDot:1
+24 WRITE !!,"Patient Status Required!!",!
DO ELIG
+25 WRITE !
KILL POERR("QFLG"),DIC,DR,DIE
SET DIC("B")="NON-VA"
+26 SET DIC("A")="PATIENT STATUS: "
SET DIC(0)="QEAMZ"
SET DIC=53
DO ^DIC
KILL DIC
+27 IF $DATA(DIRUT)!(Y=-1)
Begin DoDot:2
+28 WRITE $CHAR(7),"Required Data!",!
SET POERR("QFLG")=1
IF $GET(PSOFIN)
SET PSOQUIT=1
+29 IF $GET(PSOPBM)
Begin DoDot:3
+30 IF $ORDER(^PS(55,PSODFN,0))=""
SET DA=PSODFN
SET DIK="^PS(55,"
DO ^DIK
End DoDot:3
KILL PSOPBM
End DoDot:2
QUIT
+31 IF $$UP^XLFSTR($PIECE(^PS(53,+Y,0),"^"))'="NON-VA"
DO MES
SET POERR("QFLG")=1
QUIT
+32 SET ^PS(55,PSODFN,"PS")=+Y
SET PSORX("PATIENT STATUS")=$PIECE(^PS(53,+Y,0),"^")
+33 DO KV
End DoDot:1
IF $GET(POERR("QFLG"))
GOTO EOJ
+34 IF $GET(PSOFIN)
QUIT
PROV ;
+1 DO ST^PSOTPPRV
IF '$GET(DA)
GOTO NX
+2 SET PSORX("PROVIDER NAME")=$PIECE(^VA(200,DA,0),"^")
+3 DO KV
SET DIR("A")="Do you want to enter allergies or adverse reactions at this time?"
+4 SET DIR("B")="Y"
SET DIR(0)="YN"
WRITE !!
DO ^DIR
IF Y
WRITE !
+5 IF Y
DO EN2^GMRAPEM0
+6 IF '$GET(PSOPBM)
IF '$PIECE(^PS(55,PSODFN,0),"^",7)
IF $PIECE(^(0),"^",8)']""
SET PSOPBM=$PIECE(TM,".")
+7 DO ^PSOBUILD
+8 FOR PT="GET","DEAD","INP","CNH","ADDRESS","COPAY"
SET RTN=PT_"^PSOPTPST"
DO @RTN
IF $GET(POERR("DEAD"))!($GET(PSOQFLG))
QUIT
+9 IF $GET(POERR("DEAD"))
SET POERR("QFLG")=1
FOR II=0:0
SET II=$ORDER(^PS(52.41,"P",PSODFN,II))
IF $PIECE($GET(^PS(52.41,II,0)),"^",3)'="DC"&($PIECE($GET(^(0)),"^",3)'="DE")
DO DC^PSOORFI2
+10 KILL PSOERR("DEAD"),II
IF $GET(PSOQFLG)
SET POERR("QFLG")=1
GOTO EOJ
QUIT
+11 SET (PAT,PSOXXDFN)=PSODFN
SET POERR=1
DO ^PSOORUT2
DO BLD^PSOORUT1
DO EN^PSOLMUTL
+12 DO CLEAR^VALM1
IF $GET(PSOQUIT)
GOTO PTX
DO EN^PSOLMAO
+13 SET (DFN,PSODFN)=PSOXXDFN
KILL DIE,DIC,DLAYGO,DR,DA,PSOX,PSORXED
PTX ;
+1 KILL X,Y,^TMP("PS",$JOB),C,DEA,PRC,PSCNT,PSOACT,PSOCLC,PSOCS,PSOCT,PSOFINFL,PSOHD,PSOLST,PSOOPT,PSOPF,PSOX,PSOX1,PSOXXDFN,SIGOK,STP,STR
+2 QUIT
CHK ;
+1 IF 'X
QUIT
+2 IF $$UP^XLFSTR($PIECE(^PS(53,+X,0),"^"))'="NON-VA"
DO MES
SET Y="@1"
SET $PIECE(^PS(55,PSODFN,"PS"),"^")=""
+3 QUIT
MES WRITE $CHAR(7),!!,"Invalid Selection - Only 'NON-VA' patient status can be processed through"
+1 WRITE !,"this option. For all other statuses use the regular Patient Prescription"
+2 WRITE !,"Processing option"
+3 QUIT
WRN WRITE $CHAR(7),!!?15,"*** Current RX Patient Status is "_X_" ***"
+1 WRITE !,"Only 'NON-VA' patient status should be processed through this option."
+2 WRITE !,"For all other statuses use the regular Patient Prescription Processing option."
+3 QUIT
EOJ ;
+1 KILL PSOERR,PSOMED,PSORX,PSOSD,PSODRUG,PSODFN,PSOOPT,PSOBILL,PSOIBQS,PSOCPAY,PSOPF,PSOPI,COMM,DGI,DGS,PT,PTDY,PTRF,RN,RTN,SERS,ST0,STAT,DFN,STOP,SLPPL,RXREC,PSOPBM
+2 IF '$GET(MEDP)
KILL PSOQFLG
+3 DO KVA^VADPT
DO FULL^VALM1
KILL PSOLST,PSOXFLG,PSCNT,PSDIS,PSOAL,P1,LOG,%,%DT,%I,D0,DAT,DFN,DRG,ORX,PSON,PSOPTPST,PTST,PSOBCK,PSOID,PSOBXPUL
+4 KILL INCOM,SIG,SG,STP,RX0,RXN,RX2,RX3,RTS,C,DEAD,PS,PSOCLC,PSOCNT,PSOCT,PSODA,PSOFROM,PSOHD,R3,REA,RF,RFD,RFM,RLD,RXNUM,RXP,RXPR,RXRP,RXRS,STR,POERR,VALMSG
+5 KILL ^TMP("PSORXDC",$JOB),^TMP("PSOAL",$JOB),^TMP("PSOAO",$JOB),^TMP("PSOSF",$JOB),^TMP("PSOPF",$JOB),^TMP("PSOPI",$JOB),^TMP("PSOPO",$JOB),^TMP("PSOHDR",$JOB)
IF '$GET(MEDP)
IF '$GET(PSOQUIT)
KILL PAT
+6 KILL RFN,PSOXXDFN,VALM,VALMKEY,PSOBCK,SPOERR,PSOFLAG,VALMBCK,D,GMRA,GMRAL,GMRAREC,PSOSTA,PSODT,RXFL,NOBG,BBRX,BBFLG
KV KILL DIR,DIRUT,DTOUT,DUOUT,X,Y
+1 QUIT
ELIG ; shows eligibility and disabilities
+1 DO ELIG^VADPT
WRITE !,"Eligibility: "_$PIECE(VAEL(1),"^",2)_$SELECT(+VAEL(3):" SC%: "_$PIECE(VAEL(3),"^",2),1:"")
SET N=0
FOR
SET N=$ORDER(VAEL(1,N))
IF 'N
QUIT
WRITE !,?10,$PIECE(VAEL(1,N),"^",2)
+2 WRITE !,"Disabilities: "
FOR I=0:0
SET I=$ORDER(^DPT(DFN,.372,I))
IF 'I
QUIT
SET I1=$SELECT($DATA(^DPT(DFN,.372,I,0)):^(0),1:"")
IF +I1
Begin DoDot:1
+3 SET PSDIS=$SELECT($PIECE($GET(^DIC(31,+I1,0)),"^")]""&($PIECE($GET(^(0)),"^",4)']""):$PIECE(^(0),"^"),$PIECE($GET(^DIC(31,+I1,0)),"^",4)]"":$PIECE(^(0),"^",4),1:"")
SET PSCNT=$PIECE(I1,"^",2)
+4 IF $LENGTH(PSDIS_"-"_PSCNT_"% ("_$SELECT($PIECE(I1,"^",3)
WRITE !,?15
+5 WRITE $SELECT($GET(PSDIS)]"":PSDIS_"-",1:"")_PSCNT_"% ("_$SELECT($PIECE(I1,"^",3):"SC",1:"NSC")_"), "
End DoDot:1
+6 KILL N
+7 QUIT
PROFILE ;
+1 SET (PSORX("REFILL"),PSORX("RENEW"))=0
SET PSOX=""
DO ^PSOBUILD
+2 IF '$GET(PSOSD)
WRITE !,"This patient has no prescriptions"
IF '$DATA(DFN)
SET DFN=PSODFN
DO GMRA^PSODEM
GOTO PROFILEX
+3 SET (PSODRG,PSOX)=""
FOR
SET PSODRG=$ORDER(PSOSD(PSODRG))
IF PSODRG=""
QUIT
FOR
SET PSOX=$ORDER(PSOSD(PSODRG,PSOX))
IF PSOX=""
QUIT
IF $PIECE(PSOSD(PSODRG,PSOX),"^",3)=""
SET PSORX("RENEW")=1
IF $PIECE(PSOSD(PSODRG,PSOX),"^",4)=""
SET PSORX("REFILL")=1
+4 KILL PSOX
PROFILEX ;
+1 QUIT