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

RCDPEWL3.m

Go to the documentation of this file.
RCDPEWL3 ;ALB/TMK/KML - ELECTRONIC EOB WORKLIST ACTIONS ;24-FEB-03
 ;;4.5;Accounts Receivable;**173,276,321**;Mar 20, 1995;Build 48
 ;;Per VHA Directive 2004-038, this routine should not be modified.
 Q
 ;
SPLIT(RCSCR,RCL) ; Perform line splits
 N Z,Z0,DIR,X,Y,RCL1,DA,DR,DIE,DIC,RCDONE,RCDIR,RCSPLIT,RCTOT,RCOK,RCLINE
 ;
 D CLEAR^VALM1
 S ^TMP($J,"RCDPE_SPLIT")=""
 S RCLINE=$G(^TMP("RCDPE-EOB_WLDX",$J,RCL)),RCL1=$G(^TMP("RCDPE-EOB_WLDX",$J,RCL\1))
 ;
 S Z=+$O(^TMP("RCDPE-EOB_WLDX",$J,RCL)),Z0=+$G(^TMP("RCDPE-EOB_WLDX",$J,Z)) S:'Z0 Z0=999
 W !
 F Z=+RCLINE:1:Z0 Q:'$D(^TMP("RCDPE-EOB_WL",$J,Z,0))!(Z'<Z0)  W !,^TMP("RCDPE-EOB_WL",$J,Z,0)
 ;
 I $E($P(RCL1,U,2),1,3)["ADJ" D  G SPLITQ
 . W !,"THIS IS AN ERA-LEVEL ADJUSTMENT - ONLY THE ADJUSTMENT COMMENT CAN BE EDITED"
 . S DIR(0)="A" D ^DIR K DIR
 . S DA(2)=RCSCR,DA(1)=+$P(RCLINE,U,2),DA=+$P($P(RCL1,U,2),"ADJ",2)
 . Q:'DA
 . D EDITCOM(.DA)
 ;
 S RCDONE=0,RCDIR(1)=$P($G(^RCY(344.49,RCSCR,1,+$P(RCLINE,U,2),0)),U,2),RCDIR(2)=$P($G(^RCY(344.49,RCSCR,1,+$P(RCLINE,U,2),0)),U,5),RCDIR(3)=$P($G(^RCY(344.49,RCSCR,1,+$P(RCLINE,U,2),0)),U,8),RCDIR(6)=+$P(RCLINE,U,2)
 S RCDIR=RCDIR(1)_U_RCDIR(2)_U_RCDIR(3)
 ;
 S RCSPLIT=0
 I $P(RCDIR,U,3) W !!,"NOTE: THIS LINE HAS AN ADJUSTMENT RECORD ASSOCIATED WITH IT",!
 F  D  Q:RCDONE
 . S RCSPLIT=RCSPLIT+1
 . D EDIT(RCSCR,RCLINE,.RCDIR,.RCSPLIT,"",.RCDONE)
 . I '$D(RCSPLIT(RCSPLIT)) S RCSPLIT=RCSPLIT-1
 ;
 G:'$O(RCSPLIT(0)) SPLITQ
 N VALMCNT,VALMBG
 S VALMCNT=0,VALMBG=1
 S ^TMP($J,"RCDPE_SPLIT_FILE")=1
 D EN^VALM("RCDPE EOB WORKLIST SPLIT")
 ;
SPLITQ Q
 ;
TOT(N,RCSPLIT,RCLINE) ; CALCULATE TOTAL OF PAY (N=2) or ADJ (N=3)
 ; RCSPLIT = the array (passed by ref) where the amounts are stored
 ; RCLINE = if editing, this is the line # NOT to add in when
 ;          determining previous amounts entered
 N Z,Z0
 S (Z,Z0)=0
 F  S Z=$O(RCSPLIT(Z)) Q:'Z  I $S('$G(RCLINE):1,1:RCLINE'=Z) S Z0=Z0+$P(RCSPLIT(Z),U,N)
 Q $J(Z0,"",2)
 ;
UPD(Q,Q1) ;
 N DA,DIE,DR,X,Y
 S DA(1)=Q,DA=Q1
 S DIE="^RCY(344.49,"_DA(1)_",1,",DR="2.03////"_DUZ_";2.04////"_$$NOW^XLFDT() D ^DIE
 S ^TMP("RCDPE_SPLIT_REBLD",$J)=1
 Q
 ;
HDR ;
 N Z,Z0,ZCT
 S ZCT=0
 S Z=+$O(^TMP("RCDPE-EOB_WLDX",$J,RCL)),Z0=+$G(^TMP("RCDPE-EOB_WLDX",$J,Z)) S:'Z0 Z0=999
 F Z=+RCLINE:1:Z0 Q:'$D(^TMP("RCDPE-EOB_WL",$J,Z,0))!(Z'<Z0)!(ZCT'<6)  S ZCT=ZCT+1,VALMHDR(ZCT)=^TMP("RCDPE-EOB_WL",$J,Z,0)
 S ZCT=ZCT+1,VALMHDR(ZCT)=" "
 Q
 ;
FNL ;
 K ^TMP("RCDPE_EOB_SPLIT",$J),^TMP("RCDPE_EOB_SPLIT_OK",$J),^TMP("RCDPE_EOB_SPLITDX",$J)
 Q
 ;
INIT ; Build screen for display
 ; RCSCR, RCDIR, RCSPLIT must already exist
 N Z,RCTOT,DIR,X,Y,RCNT,RCCT,Q,RCT
 K ^TMP("RCDPE_EOB_SPLIT",$J)
 S (VALMCNT,RCNT)=0
 S ^TMP("RCDPE_EOB_SPLIT_OK",$J)=1
 F Z=2,3 S RCTOT(Z)=$$TOT(Z,.RCSPLIT)
 I +RCTOT(2)'=+$P(RCDIR,U,2)!(+RCTOT(3)'=+$P(RCDIR,U,3)) D
 . D SET("**** TOTAL AMOUNTS ENTERED DO NOT MATCH THE ORIGINAL AMOUNTS ****",1),SET(" ",1)
 . S ^TMP("RCDPE_EOB_SPLIT_OK",$J)=0
 ;
 S (RCCT,Z,RCT(1),RCT(2),RCT(3))=0
 F  S Z=$O(RCSPLIT(Z)) Q:'Z  D
 . S X="",RCCT=RCCT+1
 . S X=$$SETFLD^VALM1(RCCT,X,"NUM")
 . S X=$$SETFLD^VALM1($P(RCSPLIT(Z),U)_$S('$P(RCSPLIT(Z),U,5):" (NOT IN A/R)",1:""),X,"CLAIM")
 . S X=$$SETFLD^VALM1($J(+$P(RCSPLIT(Z),U,2),15,2),X,"PAYMENT"),RCT(1)=RCT(1)+$P(RCSPLIT(Z),U,2)
 . S X=$$SETFLD^VALM1($J(+$P(RCSPLIT(Z),U,3),15,2),X,"ADJUSTMENT"),RCT(2)=RCT(2)+$P(RCSPLIT(Z),U,3)
 . S X=$$SETFLD^VALM1($J($P(RCSPLIT(Z),U,2)+$P(RCSPLIT(Z),U,3),15,2),X,"NET"),RCT(3)=RCT(3)+$P(RCSPLIT(Z),U,2)+$P(RCSPLIT(Z),U,3)
 . D SET(X,RCCT)
 . I $P(RCSPLIT(Z),U,6)'="",$P(RCSPLIT(Z),U,6)'="@" S X=$$SETSTR^VALM1($J("",10)_$P(RCSPLIT(Z),U,6),"",1,70) D SET(X,RCCT)
 S Q="",$P(Q,"=",15)=""
 D SET($J("",32)_Q_"   "_Q_"   "_Q,RCCT),SET($E("    TOTALS: "_$J("",31),1,31)_$E($J(+RCT(1),15,2)_$J("",17),1,17)_$E($J(+RCT(2),15,2)_$J("",17),1,17)_$E($J(+RCT(3),15,2)_$J("",17),1,17),RCCT)
 ;
 Q
 ;
SET(X,RCSEQ) ;
 S VALMCNT=VALMCNT+1
 S ^TMP("RCDPE_EOB_SPLIT",$J,VALMCNT,0)=X
 S ^TMP("RCDPE_EOB_SPLIT",$J,"IDX",VALMCNT,RCSEQ)=""
 S ^TMP("RCDPE_EOB_SPLITDX",$J,RCSEQ)=VALMCNT
 Q
 ;
EDITCOM(DA) ; Edit the comment for an adjustment entry
 N RCX,DIE,X,Y,DR
 S RCX=$P($G(^RCY(344.49,DA(2),1,DA(1),1,DA,0)),U,9)
 S DIE="^RCY(344.49,"_DA(2)_",1,"_DA(1)_",1,",DR=".09"
 D ^DIE
 Q:$P($G(^RCY(344.49,DA(2),1,DA(1),1,DA,0)),U,9)=RCX
 D UPD(DA(2),DA(1))
 Q
 ;
EDIT(RCSCR,RCLINE,RCDIR,RCSPLIT,RCDEF,RCDONE) ; Edit a split line
 ;
 N CT,DIC,DIR,DIRUT,DTOUT,DUOUT,RCOK,RCL,X,Y,Z
 ; Enter claim #
 S RCL=$G(RCDIR(6))
EDCL ;
 S DIR("?",1)="ENTER THE CLAIM # TO WHICH THE PAYMENT OR ADJUSTMENT WILL BE APPLIED."
 S DIR("?",2)="THE CLAIM # DOES NOT HAVE TO EXIST IN YOUR AR IF THE PAYMENT/ADJUSTMENT"
 S DIR("?")="BELONGS TO ANOTHER SITE."
 S DIR(0)="FAO^1:15",DIR("A")="CLAIM #: "
 S:$P($G(RCDEF),U)'="" DIR("B")=$P(RCDEF,U)
 S:$G(RCDIR(1))'=""&($G(DIR("B"))="") DIR("B")=RCDIR(1)
 W ! D ^DIR K DIR
 I $D(DTOUT)!$D(DUOUT) D ABORT Q
 I Y="" D  G:'RCDONE EDCL Q
 . S DIR(0)="YA",DIR("A",1)="YOU MUST SPLIT THE ENTIRE AMOUNT OF THE LINE."
 . S DIR("A",2)=" $"_$J(+RCDIR(2),"",2)_" PAYMENT IS LEFT"_$S($P(RCDIR,U,3)&$G(RCDIR(3)):" AND $"_$J(+RCDIR(3),"",2)_" ADJ IS LEFT",1:"")
 . S DIR("A")="DO YOU WANT TO ABORT THIS SPLIT NOW?: ",DIR("B")="NO"
 . W ! D ^DIR K DIR
 . I Y'=0 D ABORT Q
 S $P(RCSPLIT(RCSPLIT),U)=Y
 ;
 I $E(Y,1,3)?3N,$L(Y)>7,Y'["-" S Y=$E(Y,1,3)_"-"_$E(Y,4,$L(Y))
 I $TR(Y," ")="" S Y=-1
 I Y'=-1 S DIC="^PRCA(430,",DIC(0)="M" D ^DIC K DIC
 I +Y>0 D  I 'RCOK K RCSPLIT(RCSPLIT) G EDCL
 . S RCOK=1
 . I '$D(^DGCR(399,+Y,0)) D  Q    ; prca276 place screen to only allow selection of third party claims
 . . W !,"   THIS IS NOT A 3RD PARTY CLAIM. CLAIMS NEED TO BE 3RD PARTY."
 . . S RCOK=0
 . I '$$VALSTAT^RCDPEM5(+Y) W !,"  CLAIM IS IN AN INCOMPLETE STATUS. ENTER ANOTHER CLAIM." S RCOK=0  ; prca276 do not allow incomplete claims
 I Y<0 D  G:'RCOK EDCL
 . S RCOK=1
 . S DIR("A")="   THIS CLAIM WAS NOT FOUND IN YOUR AR.  DO YOU WANT TO CONTINUE?: ",DIR("B")="NO",DIR(0)="YA" D ^DIR K DIR W ! I Y'=1 K RCSPLIT(RCSPLIT) S RCOK=0
 E  D
 . S $P(RCSPLIT(RCSPLIT),U,5)=+Y
 . W "  >>Current claim balance is: ",$J(+$P($$BILL^RCJIBFN2(+Y),U,3),"",2)
 ; Enter payment
 S RCDIR(1)=""
 S DIR("?",1)="**************"
 S CT=1
 I $P(RCDIR,U,3) D
 . S DIR("?",CT+1)="SINCE THIS LINE HAS AN ADJUSTMENT, THE AMOUNT ENTERED HERE SHOULD BE THE",DIR("?",CT+2)="CORRECTED AMOUNT THE PAYER INDICATED THEY SHOULD HAVE PAID FOR THE CLAIM",DIR("?",CT+3)=" ",CT=CT+3
 S CT=CT+1,DIR("?",CT)="ENTER THE AMT FROM THE PAYMENT TOTAL FOR THIS LINE ("_$J(+$P(RCDIR,U,2),"",2)_")"
 I $G(RCDEF)="" D
 . S CT=CT+1,DIR("?",CT)=" THAT APPLIES TO THIS CLAIM.  THE PAYMENT AMOUNT ALREADY USED FOR THIS"
 . S CT=CT+1,DIR("?",CT)=" LINE SPLIT IS: "_$J(+$$TOT(2,.RCSPLIT,$S(RCDEF="":"",1:RCSPLIT)),"",2)_" LEAVING A BALANCE TO DISTRIBUTE OF: "_$J($P(RCDIR,U,2)-$$TOT(2,.RCSPLIT,$S(RCDEF="":"",1:RCSPLIT)),"",2)
 S CT=CT+1,DIR("?",CT)="THE TOTAL PAYMENTS ENTERED DURING THIS SPLIT MUST EQUAL THE ORIGINAL LINE",DIR("?")=" PAYMENT AMOUNT OF $"_$J(+$P(RCDIR,U,2),"",2)
 S DIR(0)="NAO^0:"_$S(RCDEF="":$P(RCDIR,U,2)-$$TOT(2,.RCSPLIT,RCSPLIT),1:$P(RCDIR,U,2))_":2"
 S DIR("A")="PAYMENT AMOUNT TO APPLY TO THIS CLAIM: " S:$P($G(RCDEF),U,2)'="" DIR("B")=$J(+$P(RCDEF,U,2),"",2) S:$G(RCDIR(2))'=""&($G(DIR("B"))="") DIR("B")=RCDIR(2) D ^DIR K DIR
 I $D(DTOUT)!$D(DUOUT) K RCSPLIT(RCSPLIT) G EDCL
 S $P(RCSPLIT(RCSPLIT),U,2)=Y,RCDIR(2)=$J($P(RCDIR,U,2)-$$TOT(2,.RCSPLIT),"",2)
 ; Enter adj
 I $O(^RCY(344.49,RCSCR,1,+$P(RCLINE,U,2),1,0)) D  G:'RCOK EDCL
 . S RCOK=1
 . W !!,$J("",5)_"THIS LINE CONTAINS AN ADJUSTMENT AMOUNT OF $"_$J(+$P(RCDIR,U,3),"",2),!,$J("",5)_"THIS AMT IS USUALLY THE AMT THE PAYER PREVIOUSLY PAID",!,$J("",5),"ON A CLAIM WHICH THEY HAVE NOW AMENDED.  IF THERE WAS"
 . W !,$J("",5)_"AN AMT PREVIOUSLY PAID FOR THIS CLAIM, ENTER THAT AMOUNT",!,$J("",5),"AS A NEGATIVE AMOUNT HERE.",!
 . S DIR("?",1)="**************"
 . S DIR("?",2)="ENTER THE AMT FROM THE ADJUSTMENT TOTAL FOR THIS LINE ("_$J(+$P(RCDIR,U,3),"",2)_")",DIR("?",3)=" THAT APPLIES TO THIS CLAIM.  THE ADJUSTMENT AMOUNT ALREADY USED FOR THIS"
 . S DIR("?",4)=" LINE SPLIT IS "_$J(+$$TOT(3,.RCSPLIT,$S(RCDEF="":"",1:RCSPLIT)),"",2)_" LEAVING A BALANCE OF "_$J($P(RCDIR,U,3)-$$TOT(3,.RCSPLIT,$S(RCDEF="":"",1:RCSPLIT)),"",2)_" TO DISTRIBUTE"
 . S DIR("?",5)=" ENTER IT AS THE NEGATIVE OF THE AMT THE PAYER PREVIOUSLY PAID ON THIS CLAIM"
 . S DIR("?",6)="THE TOTAL ADJUSTMENTS ENTERED DURING THIS SPLIT MUST EQUAL THE ORIGINAL LINE",DIR("?")=" ADJUSTMENT AMOUNT OF $"_$J(+$P(RCDIR,U,3),"",2)
 . S DIR(0)="NAO^"_$J($P(RCDIR,U,3)-$$TOT(3,.RCSPLIT,$S(RCDEF="":"",1:RCSPLIT)),"",2)_":0:2",DIR("A")="ADJUSTMENT AMOUNT: " S:$P($G(RCDEF),U,3)'="" DIR("B")=$J(+$P(RCDEF,U,3),"",2) S:$G(RCDIR(3))'=""&($G(DIR("B"))="") DIR("B")=RCDIR(3)
 . D ^DIR K DIR
 . I $D(DTOUT)!$D(DUOUT) S RCOK=0 K RCSPLIT(RCSPLIT) Q
 . S $P(RCSPLIT(RCSPLIT),U,3)=Y,RCDIR(3)=$J($P(RCDIR,U,3)-$$TOT(3,.RCSPLIT),"",2)
 I +RCDIR(2)=0,+RCDIR(3)=0 S RCDONE=1
 ; PRCA*4.5*321 - BEGIN
 S DIR("A")="RECEIPT LINE COMMENT: "
 ;Retrieve comment previously entered from RCSPLIT if present
 I $P($G(RCSPLIT(RCSPLIT)),U,6)'="" D
 . I $P(RCSPLIT(RCSPLIT),U,6)'="@" S DIR("B")=$P(RCSPLIT(RCSPLIT),U,6)
 ;Otherwise retrieve comment previously filed in scratchpad
 E  D
 . I $P($G(^RCY(344.49,RCSCR,1,+RCL,0)),U,10)'="" S DIR("B")=$P(^(0),U,10)
 ;If non-suspensed line allow optional free text entry
 I $P(RCSPLIT(RCSPLIT),U,5) D
 . S DIR(0)="344.491,.1AO"
 . D ^DIR
 ;if suspense force selection from drop down list
 I '$P(RCSPLIT(RCSPLIT),U,5) S Y=$$COM^RCDPECH I Y=-1 K RCSPLIT(RCSPLIT) G EDCL
 ; PRCA*4.5*321 - END
 ;
 I Y="",$G(DIR("B"))'="" W "   Comment will be deleted"
 K DIR
 I $D(DTOUT)!$D(DUOUT) K RCSPLIT(RCSPLIT) G EDCL
 S $P(RCSPLIT(RCSPLIT),U,6)=$S(Y="":"@",1:Y)
 Q
 ;
ABORT ; User aborted split - kill split array
 N Z
 S Z=RCSPLIT K RCSPLIT S RCSPLIT=Z,RCDONE=1
 Q
 ;