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

RCYDD1.m

Go to the documentation of this file.
  1. RCYDD1 ;WASH-ISC@ALTOONA,PA/RGY-DD CALL UTILITIES ;8/27/96 5:35 PM
  1. V ;;4.5;Accounts Receivable;**9,48,128**;Mar 20, 1995
  1. ;;Per VHA Directive 10-93-142, this routine should not be modified.
  1. PN ;Called by the input transform in field 344.01,.09
  1. N RCY,RCY1,RCY2,Y
  1. I $L(X)>20!($L(X)<1) K X Q
  1. S RCY=X,X=$S($O(^PRCA(430,"B",X,0)):$O(^(0))_";PRCA(430,",$O(^PRCA(430,"D",X,0)):$O(^(0))_";PRCA(430,",1:X) I X[";PRCA(430," D DIS
  1. I X=RCY S DIC="^DPT(",DIC(0)="EM" D ^DIC S X=+Y_";DPT("
  1. I +$G(Y)<0,(RCYTYP=4) D
  1. .S (X,Y)=$$REC^IBRFN(RCY),X=X_";PRCA(430,"
  1. .I Y>0 D
  1. ..N DIR,DIRUT
  1. ..S DIR("A")="Is this TRICARE reference number - "_RCY,DIR("B")="No",DIR("A",1)=" "
  1. ..S RCY=X
  1. ..S DIR(0)="Y^O" D ^DIR S:'Y Y=-1
  1. ..I Y>0 S X=RCY W !!,$P($G(^PRCA(430,+X,0)),"^")," " D DIS
  1. I +$G(Y)<0 K X Q
  1. S RCY=X I RCY[";DPT(" D CHK(+RCY) G Q2
  1. I $$IB^IBRUTL(+RCY) W *7," ... This bill appears to have other patient bills on 'hold'."
  1. S X=$P($G(^RCD(340,+$P(^PRCA(430,+RCY,0),"^",9),0)),"^") I X[";DPT(" D CHK(+X)
  1. Q2 S X=RCY Q
  1. DIS ;DISPLAY BILL INFO
  1. NEW RCY
  1. S RCY=$P(^PRCA(430,+X,0),"^",9) W:RCY " ",$$NAM^RCFN01(RCY)
  1. S RCY=$P(^PRCA(430,+X,0),"^",8) I RCY W " ",$P(^PRCA(430.3,RCY,0),"^") I $P(^(0),"^",3)'=102,$P($G(^RCD(340,+$P(^PRCA(430,+X,0),"^",9),0)),"^")'[";DPT(" W *7,!,"This bill is not in 'active' status."
  1. S RCY=$G(^PRCA(430,+X,7)) W " $",$J($P(RCY,"^")+$P(RCY,"^",2)+$P(RCY,"^",3)+$P(RCY,"^",4)+$P(RCY,"^",5),1,2)
  1. Q
  1. PAY ;Called by the input transform of field 344.01,.04
  1. NEW Y,I,AMT,PROC
  1. S Y=$P($G(^RCY(344,DA(1),1,DA,0)),"^",3),AMT=0
  1. S PROC=$P($G(^RCY(344,DA(1),0)),"^",11)
  1. G:Y'[";PRCA(430," Q1
  1. G:$P($G(^RCD(340,+$P($G(^PRCA(430,+Y,0)),"^",9),0)),"^")[";DPT(" Q1
  1. S Y(1)=Y,Y=$G(^PRCA(430,+Y,7)) F I=1:1:5 S AMT=AMT+$P(Y,"^",I)
  1. I X>AMT W *7," Payment amount greater than amount of bill!",*7
  1. S AMT(1)=$$EOB^IBCNSBL2(+Y(1),+$P($G(^PRCA(430,+Y(1),0)),"^",3),$$PAID^PRCAFN1(+Y(1)))
  1. I AMT(1) D
  1. .W !!,$P(AMT(1),"^",2)," may also be billable.",*7,!
  1. Q1 Q
  1. DEF(DEB) ;Get default for payment amount (used in input templates for payments)
  1. NEW X
  1. S X=0 G:'$G(DEB) Q3
  1. I DEB[";DPT(" S X=$$BAL^PRCAFN(DEB) G Q3
  1. I DEB[";PRCA(430,",",112,107,102,"[(","_$P($G(^PRCA(430.3,+$P($G(^PRCA(430,+DEB,0)),"^",8),0)),"^",3)_",") S X=$G(^PRCA(430,+DEB,7)),X=$P(X,"^")+$P(X,"^",2)+$P(X,"^",3)+$P(X,"^",4)+$P(X,"^",5) G Q3
  1. Q3 Q "<"_$J(X,1,2)_">"
  1. DOP ;Make sure date of payment not in future or more than one month ago
  1. NEW DATE
  1. S DATE=X,X2=DT,X1=X D ^%DTC
  1. I X<-31!(X>0) K X G Q4
  1. S X=DATE
  1. Q4 Q
  1. CHK(DFN) ;Check copay exemption status and RX potential charges
  1. S X="IBARXEU" X ^%ZOSF("TEST") I $T S X=$$RXST^IBARXEU(DFN,DT) I X W *7,!?2,"* Patient is exempt from RX Copay: ",$P(X,"^",4)," *"
  1. S X="PSOCOPAY" X ^%ZOSF("TEST") I $T S X=$$POT^PSOCOPAY(DFN) I X W *7,!?2,"* This patient has ",X,"-30 day RX's totaling $",(X*2),".00 that are potentially *"
  1. I W !,"* billable. This represents any Window Rx's issued today. *"
  1. Q
  1. REC ;Called by the 344,.01 input transform. Make sure duplicate receipts cannot be created.
  1. I $O(^RCY(344,"B",X,""))!$O(^PRCA(433,"AF",X,"")) K X W !,"Receipt already in use, please use another receipt number!" K X
  1. Q
  1. STAT(RCYC) ;Called by the 344,100 field to return status of receipt
  1. NEW X,Y
  1. D NOW^%DTC
  1. S Y=$G(^RCY(344,RCYC,0)) S X="N/A" S:$P(Y,"^",2)]"" X="OPEN" S:$P(Y,"^",7)]"" X="APPROVED" S:$P(Y,"^",9)]"" X="POSTING"
  1. I $P(Y,"^",10)]"" S X="POSTED" S:'$O(^RCY(344,RCYC,1,0)) X="VOIDED"
  1. S:$P(Y,"^",5)>% X="QUEUED"
  1. I $P(Y,"^",9)]"",$P(Y,"^",10)="" L +^RCY(344,RCYC,0):1 I $T L -^RCY(344,RCYC,0) S X="ERRORED"
  1. Q X
  1. NOT(REC) ;Called to calculate the number of transaction for a receipt (344,101)
  1. NEW Y,TOT
  1. S TOT=0
  1. F Y=0:0 S Y=$O(^RCY(344,+$G(REC),1,Y)) Q:'Y S TOT=TOT+1
  1. Q TOT