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

PRCASER1.m

Go to the documentation of this file.
  1. PRCASER1 ;WASH-ISC@ALTOONA,PA/RGY - Accept transaction from billing engine ;9/8/93 2:21 PM
  1. V ;;4.5;Accounts Receivable;**48,104,165,233,301,307,337,353,364,377,402,425**;Mar 20, 1995;Build 8
  1. ;;Per VA Directive 6402, this routine should not be modified.
  1. ;
  1. ;PRCA*4.5*337 Added a bill lock to insure that decreases are stacked
  1. ; instead of slamming bill simultaneously.
  1. ;
  1. ;PRCA*4.5*353 Add check to clear (exempt) any interest and admin
  1. ; fees when a decrease makes principle balance zero
  1. ; In addition, added modification that will allow
  1. ; decreases to post to 'Suspended' bills to avoid
  1. ; further billing issues if the bill is re-opened.
  1. ;PRCA*4.5*364 Ensure exempt transaction has date/time stamp
  1. ;PRCA*4.5*402 Add new category TRICARE PHARMACY
  1. ;PRCA*4.5*425 Add category CHAMPVA THIRD PARTY (28)
  1. ;
  1. NEW AMT,AMT1,PRCAERR,PRCABN,PRCADJ,X1,XMDUZ,XMSUB,XMTEXT,XMY,DEBT
  1. I '$D(X) S Y="-1^PRCA020" G Q
  1. I $O(^PRCA(430.3,"AC",+X,0))'?1N.N,$P($G(^PRCA(430.3,+X,0)),"^",3)'=21 S Y="-1^PRCA021" G Q
  1. I +X'=21,$P($G(^PRCA(430.3,+X,0)),"^",3)'=21 S Y="-1^PRCA022" G Q
  1. I $P(X,"^",2)'?.N.1".".2N S Y="-1^PRCA023" G Q
  1. I $P(X,"^",2)'>0 S Y="-1^PRCA017" G Q
  1. I $P(X,"^",3)="" S Y="-1^PRCA006" G Q
  1. S PRCABN=$O(^PRCA(430,"B",$P(X,"^",3),0)) I $G(^PRCA(430,+PRCABN,0))="" S Y="-1^PRCA007" G Q
  1. I '$D(^VA(200,+$P(X,"^",4),0)) S Y="-1^PRCA013" G Q
  1. I $P(X,"^",5)'?7N S Y="-1^PRCA024" G Q
  1. S (AMT1,AMT)=$P(X,"^",2)
  1. D DEC(PRCABN,.AMT,$P(X,"^",4),$P(X,U,6),$P(X,U,5))
  1. S XMDUZ="AR Package",XMTEXT="X1(",DEBT=$P($G(^PRCA(430,PRCABN,0)),"^",9),DEBT=$E($$NAM^RCFN01(DEBT),1)_" ("_$E($$SSN^RCFN01(DEBT),6,9)_")"
  1. I AMT'=AMT1 S X1(1)="A decrease adjustment for bill/Pt name (SSN) #"_$P(X,"^",3)_"/"_DEBT_" has been",XMSUB="Automatic Adj: "_$P(X,"^",3)
  1. I AMT=AMT1 S X1(1)="**** NOTICE: A decrease adjustment for bill/Pt name (SSN) #"_$P(X,U,3)_"/"_DEBT,XMSUB="Manual Adj: "_$P(X,U,3),X1(3)=" "
  1. S Y=DT X ^DD("DD") S X1(2)=$S(AMT'=AMT1:"automatically",1:"needs to be manually")_" applied in the amount of $"_$J($S(AMT1=AMT:AMT1,1:AMT1-AMT),0,2)_" on "_Y_"."
  1. I AMT,AMT'=AMT1 S X1(3)="Please review bill for proper application of the unapplied amount of $"_$J(AMT,0,2)_"."
  1. S X1(4)=" ",X1(5)="Data sent from Service"
  1. S X1(6)=" Amount: $"_$J(AMT1,0,2)
  1. S Y=$P(X,U,5) X ^DD("DD") S X1(7)=" Date: "_Y
  1. S X1(8)=" Reason: "_$S($P(X,"^",6)]"":$P(X,"^",6),1:"N/A")
  1. S X1(9)=" Adjustment by: "_$P($G(^VA(200,+$P(X,"^",4),0)),"^")
  1. S AMT=0 F X=1:1:5 S AMT=AMT+$P($G(^PRCA(430,PRCABN,7)),U,X)
  1. S AMT1=AMT-+$G(^PRCA(430,PRCABN,7))
  1. S X=$P(^PRCA(430.3,+$P($G(^PRCA(430,PRCABN,0)),U,8),0),U,1)
  1. S X1(10)=" ",X1(12)=" ",X1(13)="Bill status is "_$S(XMSUB["Auto":"now ",1:"")_X_" with a balance of $"_$J(AMT,0,2)_".",X1(14)=" "
  1. I AMT1>0 S X1(15)=" *WARNING* There is outstanding administrative charges of $"_$J(AMT1,0,2)_".",X1(16)=" An adjustment of administrative charges MAY need to be done."
  1. S XMY("G.PRCA ADJUSTMENT TRANS")=""
  1. D ^XMD
  1. Q S Y=$S($G(Y)<0:Y,1:1) Q
  1. ;
  1. DEC(PRCABN,AMT,APR,REA,BDT,PRCAEN) ;Auto decrease from service Bill#,Tran amt,person,reason,Tran date
  1. N BAL,DA,DIC,DIE,DR,ERR,PRCA,PRCAA2,PRCAMT,PRCASV,X,PRCAAMT,PRCATRAN,RCRPIEN
  1. S Y=1
  1. L +^PRCA(430,PRCABN,"PRCASER1"):$S(DILOCKTM>30:DILOCKTM,1:30) I '$T S Y="-1^PRCA004^AR Package 'busy' while trying to add transaction." Q
  1. S PRCAEN="",BAL=+$G(^PRCA(430,PRCABN,7)) I 'BAL S Y="-1^Bill balance less than decrease" G Q1
  1. I $P(^PRCA(430,PRCABN,0),U,8)'=$O(^PRCA(430.3,"AC",102,"")),$P(^PRCA(430,PRCABN,0),U,8)'=$O(^PRCA(430.3,"AC",112,"")),$P(^PRCA(430,PRCABN,0),U,8)'=$O(^PRCA(430.3,"AC",240,"")) S Y="-1^Invalid status for posting" G Q1 ;PRCA*4.5*353
  1. I $P(^PRCA(430,PRCABN,0),U,2)=$O(^PRCA(430.2,"AC",33,0)) S Y="-1^Cannot post against pre-pay bill" G Q1
  1. S BAL=$S(AMT>BAL:BAL,1:AMT)
  1. S PRCA("ADJ")=$O(^PRCA(430.3,"AC",21,0)),PRCASV("FY")=$$FY^RCFN01(DT)_U_BAL,PRCASV("APR")=APR,PRCASV("BDT")=$S($G(BDT)>0:BDT,1:DT)
  1. D SETTR^PRCAUTL,PATTR^PRCAUTL S DIE="^PRCA(433,",DR="[PRCA FY ADJ2 BATCH]",DA=PRCAEN D ^DIE
  1. S PRCAA2=$P(^PRCA(433,PRCAEN,4,0),U,3) D UPFY^PRCADJ,TRANUP^PRCAUTL
  1. ;PRCA*4.5*402 - add category TRICARE PHARMACY
  1. ;PRCA*4.5*425 - add category CHAMPVA THIRD PARTY (28)
  1. I ("^28^30^31^80^")[("^"_$P($G(^PRCA(430,PRCABN,0)),"^",2)_"^") D EN^PRCAFBDM(PRCABN,BAL,PRCA("ADJ"),$G(PRCADJ("BDT")),PRCAEN,.ERR)
  1. D UPPRIN^PRCADJ
  1. I "AutoAUTO"'[$E(REA,1,4) S REA="Auto Dec.: "_REA
  1. S DA=PRCAEN,DIE="^PRCA(433,",DR="41///"_REA D ^DIE
  1. S AMT=AMT-+$P($G(^PRCA(433,PRCAEN,1)),U,5)
  1. ;PRCA*4.5*377 - update Repayment Plan with as a decrease adjustment
  1. D UPDBAL^RCRPU1(PRCABN,PRCAEN)
  1. ; ;End PRCE*4.5*377
  1. I PRCAEN,$D(^PRCA(430,"TCSP",PRCABN)) D DECADJ^RCTCSPU(PRCABN,PRCAEN) ;prca*4.5*301 add cs decrease adjustment 5B
  1. S PRCAAMT=$G(^PRCA(430,PRCABN,7)) I $P(PRCAAMT,U)=0,($P(PRCAAMT,U,2)+$P(PRCAAMT,"^",3)+$P(PRCAAMT,"^",4)+$P(PRCAAMT,"^",5)'=0) D ;PRCA*4.5*353
  1. . S PRCATRAN=$$EXEMPT^RCBEUTR2(PRCABN,$P(PRCAAMT,"^",2)_"^"_$P(PRCAAMT,"^",3)_"^^"_$P(PRCAAMT,"^",4)_"^"_$P(PRCAAMT,"^",5),"PRINCIPAL BAL EQUALS ZERO",0,1)
  1. . I PRCATRAN,$D(^PRCA(430,"TCSP",PRCABN)) D DECADJ^RCTCSPU(PRCABN,PRCATRAN)
  1. Q1 L -^PRCA(430,PRCABN,"PRCASER1") S Y=$S($G(Y)<0:Y,1:1)
  1. Q