source: FOIAVistA/trunk/r/ACCOUNTS_RECEIVABLE-PRCA-PRY-RC/RCDPEWLB.m@ 1713

Last change on this file since 1713 was 628, checked in by George Lilly, 15 years ago

initial load of FOIAVistA 6/30/08 version

File size: 7.2 KB
Line 
1RCDPEWLB ;ALB/TMK - EEOB WORKLIST BATCH PROCESSING ;10-FEB-2004
2 ;;4.5;Accounts Receivable;**208**;Mar 20, 1995
3 ;;Per VHA Directive 10-93-142, this routine should not be modified.
4 ;
5SETBATCH(RCERA) ; Set up batches for a worklist entry RCERA
6 ; Returns ^TMP($J,"BATCHES",batch criteria code,start param data)=
7 ; batch #^end param data
8 ; Ask to split the ERA
9 N DIR,DUOUT,DTOUT,X,Y,Z,Z0,RCNUM,RCY,RCBAT,RCSEL,RCZ,RCNAMES,RCS
10 K ^TMP($J,"BATCHES")
11 S RCNUM=+$$CTEEOB(RCERA)
12 Q:RCNUM'>1
13 S DIR("A",1)="THERE ARE APPROXIMATELY "_RCNUM_" EEOBS IN THIS ERA",DIR("A")="DO YOU WANT TO SPLIT THIS ERA INTO BATCHES?: ",DIR(0)="YA",DIR("B")=$S(RCNUM>30:"YES",1:"NO") W ! D ^DIR K DIR
14 I Y'=1 Q
15 ;
16 S DIR("A",1)="YOU MAY USE ANY ONE OF THE FOLLOWING CRITERIA TO SPLIT THE ERA INTO BATCHES: ",DIR("A",2)=" ",DIR("A",3)=$J("",10)_"1 - BY MAX # OF EEOBs TO INCLUDE IN A BATCH"
17 S DIR("A",4)=$J("",10)_"2 - BY RANGES OF PATIENT LAST NAME",DIR("A",5)=$J("",10)_"3 - BY EEOB PAYMENT STATUS (FULL/PARTIAL/NO PAY)"
18 S DIR("A",6)=$J("",10)_"4 - BY CO-PAY AND NON-COPAY FOR THE DATE OF SERVICE",DIR("A",7)=" "
19 S DIR(0)="SAO^1:MAX #;2:LAST NAME;3:PAY STATUS;4:CO-PAY STATUS",DIR("A")="CRITERIA SELECTION: "
20 W !! D ^DIR K DIR
21 Q:$D(DUOUT)!$D(DTOUT)!(Y="")
22 S RCBAT=0,RCSEL=Y,^TMP($J,"BATCHES")=RCSEL
23 S DIR(0)="YA",DIR("A")="DO YOU WANT TO NAME YOUR OWN BATCHES?: ",DIR("B")="NO" W ! D ^DIR K DIR
24 Q:$D(DUOUT)!$D(DTOUT)
25 S RCNAMES=+Y
26 I RCSEL=1 D
27 . W ! S DIR(0)="NA^1:"_RCNUM,DIR("A")="MAX # OF EEOBS TO INCLUDE IN A BATCH: ",DIR("?")="ENTER A NUMBER FROM 1 TO "_RCNUM D ^DIR K DIR
28 . I $D(DTOUT)!$D(DUOUT) Q
29 . S RCY=Y
30 . F RCZ=1:1:RCNUM\RCY+$S(RCNUM#RCY:1,1:0) S RCS=((RCZ-1)*RCY)+1 D NEWBAT(RCERA,1,"",RCS_U_(RCS+RCY-1),.RCBAT,RCNAMES) S ^TMP($J,"BATCHES",1,RCS)=RCBAT_U_(RCS+RCY-1)
31 ;
32 I RCSEL=2 D
33 . N RCNMF,RCQUIT,RCDONE
34 . S RCNMF="A",(RCQUIT,RCDONE)=0
35 . F D Q:RCQUIT!RCDONE
36 .. W !!,"START FROM LAST NAME BEGINNING WITH: ",RCNMF
37 .. S DIR("?")="ENTER A LETTER IN UPPERCASE"
38 .. S DIR(0)="FA^1:1^K:X'?.U X",DIR("A")="INCLUDE THROUGH LAST NAME BEGINNING WITH: " D ^DIR K DIR
39 .. I $D(DTOUT)!$D(DUOUT) S RCQUIT=1 Q
40 .. S RCY=Y,RCSEL("NAME",RCNMF)=Y_"ZZZ"
41 .. I $A(RCY)=90 S RCDONE=1 Q
42 .. S RCNMF=$A(RCY)+1,RCNMF=$C(RCNMF)
43 . Q:RCQUIT
44 . S Z="" F S Z=$O(RCSEL("NAME",Z)) Q:Z="" D NEWBAT(RCERA,2,"",Z_U_RCSEL("NAME",Z),.RCBAT,RCNAMES) S ^TMP($J,"BATCHES",2,Z)=RCBAT_U_RCSEL("NAME",Z)
45 ;
46 I RCSEL=3 D
47 . F Y=1:1:3 D NEWBAT(RCERA,3,$P("FULL PAYMENT^PARTIAL PAYMENT^NO PAYMENT",U,Y),Y,.RCBAT,RCNAMES) S ^TMP($J,"BATCHES",3,Y)=RCBAT
48 ;
49 I RCSEL=4 D
50 . F Y=1,2 D NEWBAT(RCERA,RCSEL,$P("CO-PAY EXISTS^NO CO-PAY EXISTS",U,Y),Y,.RCBAT,RCNAMES) S ^TMP($J,"BATCHES",4,Y)=RCBAT
51 ;
52 S DIR(0)="EA",DIR("A")=RCBAT_" BATCHES CREATED. PRESS RETURN TO CONTINUE " W ! D ^DIR K DIR
53 Q
54 ;
55NEWBAT(RCERA,RCSEL,RCDAT,RCVAL,RCBAT,RCNAMES) ; Add a new batch at the top level entry
56 ; RCERA = the ien of the entry in file 344.49
57 ; RCSEL = the # of the selection criteria selected
58 ; RCDAT = the default 'name' of the batch based on the criteria used
59 ; RCVAL = the start value^the end value
60 ; RCBAT = if passed by reference, returned as the next batch #
61 ; RCNAMES = 1 if user wants to name each batch, 0 to accept default
62 ;
63 N DA,DR,DIC,X,Y,DLAYGO,DD,DO
64 S RCBAT=RCBAT+1
65 S DA(1)=RCERA,DIC="^RCY(344.49,"_DA(1)_",3,",DLAYGO=344.493,DIC(0)="L",X=RCBAT
66 I $G(RCNAMES) W !!,"**BATCH #: "_RCBAT
67 S DIC("DR")=".03////0;.04////"_DUZ_";.05////0;.06////"_RCSEL_";.07////"_$P(RCVAL,U)_$S($P(RCVAL,U,2)'="":";.08////"_$P(RCVAL,U,2),1:"")
68 S DIC("DR")=DIC("DR")_";.02R//"_$S(RCNAMES:"",1:"//")_$S(RCSEL=1:"BATCH #: "_RCBAT,RCSEL=2:"LAST NAME FROM "_$P(RCVAL,U)_" - "_$P(RCVAL,U,2),1:RCDAT)
69 D FILE^DICN K DLAYGO,DIC,DD,DO W !
70 Q
71 ;
72GETBATCH(RCZ0) ; Returns the batch # to be assigned to the data in RCZ0
73 ; RCZ0 = 0-node of the entry in file 344.41 to be assigned to a batch
74 N BNUM,Z,Z0
75 S BNUM=""
76 I $G(^TMP($J,"BATCHES"))=1 D ; Max #
77 . N CT
78 . S CT=+$G(^TMP($J,"BATCHES","CT"))+1
79 . S ^TMP($J,"BATCHES","CT")=CT
80 . S Z=+$O(^TMP($J,"BATCHES",1,CT+1),-1),BNUM=+$G(^TMP($J,"BATCHES",1,Z)) S:'BNUM BNUM=1
81 ;
82 I $G(^TMP($J,"BATCHES"))=2 D ; last name
83 . S Z=$P(RCZ0,U,15)
84 . I $P(RCZ0,U,2) S Z0=$P($G(^DGCR(399,+$G(^IBM(361.1,+$P(RCZ0,U,2),0)),0)),U,2),Z0=$P($G(^DPT(Z0,0)),U) I Z0'="" S Z=Z0
85 . S Z0=$A($E(Z))-1,Z0=$C(Z0),Z0=$O(^TMP($J,"BATCHES",2,Z0),-1)
86 . S BNUM=$S(Z0="":1,1:+$G(^TMP($J,"BATCHES",2,Z0))) S:'BNUM BNUM=1
87 ;
88 I $G(^TMP($J,"BATCHES"))=3 D ; payment amount
89 . S Z=+$P(RCZ0,U,3)
90 . I Z'>0!'$P(RCZ0,U,2) S BNUM=3 Q ; 0-PAY/ADJUSTMENT/UNKNOWN CLAIM
91 . I +$P($G(^IBM(361.1,+$P(RCZ0,U,2))),U,4)'>+Z S BNUM=1 Q ; FULL PAY
92 . S BNUM=2 ; PARTIAL PAY
93 ;
94 I $G(^TMP($J,"BATCHES"))=4 D ; Co-pay/not
95 . S BNUM=2
96 . Q:'$P(RCZ0,U,2)
97 . I $$COPAY^RCDPEWL1(+$G(^IBM(361.1,+$P(RCZ0,U,2),0))) S BNUM=1
98 ;
99 Q BNUM
100 ;
101EDIT(RCERA,RCB,ABORT) ; Edit name and posting status of an existing batch
102 ; RCERA = the ien of the worklist entry
103 ; RCB = the ien of the current batch
104 ; RCABORT = if passed by reference, returned as 1 if user aborts
105 N DA,DIE,DR,X,Y
106 D FULL^VALM1
107 S ABORT=0
108 S DA(1)=RCERA,DA=RCB,DIE="^RCY(344.49,"_DA(1)_",3,",DR=".02;.03" D ^DIE I $D(Y) S ABORT=1
109 K VALMHDR ; Used to rebuild the header
110 S VALMBCK="R"
111 Q
112 ;
113MARKALL(RCERA) ; Mark all batches as ready to post
114 N DIR,X,Y,Z,RCT,DA,DIE,DR
115 D FULL^VALM1
116 S VALMBCK="R"
117 I $G(^TMP("RCBATCH_SELECTED",$J)) D NOBATCH^RCDPEWL S VALMBCK="R" Q
118 I '$O(^RCY(344.49,RCERA,3,0)) D NOTSET^RCDPEWLC Q
119 S DIR(0)="YA",DIR("A",1)="THIS ACTION WILL MARK ALL BATCHES FOR THIS ERA AS READY TO POST",DIR("A")="ARE YOU SURE YOU WANT TO DO THIS?: ",DIR("B")="NO" W ! D ^DIR K DIR
120 S RCT=0
121 I Y D
122 . S Z=0 F S Z=$O(^RCY(344.49,RCERA,3,Z)) Q:'Z I '$P($G(^(Z,0)),U,3) S RCT=RCT+1,DA(1)=RCERA,DA=Z,DIE="^RCY(344.49,"_DA(1)_",3,",DR=".03////1" D ^DIE
123 . W !!,RCT," BATCHES CHANGED TO READY TO POST",!,"ALL BATCHES ARE NOW READY TO POST"
124 . S DIR(0)="EA",DIR("A")="PRESS RETURN TO CONTINUE " W ! D ^DIR K DIR
125 . K VALMHDR
126 Q
127 ;
128EDITALL(RCERA) ; Edit all batches
129 N Z,RCQUIT
130 D FULL^VALM1
131 S VALMBCK="R"
132 W !
133 I '$O(^RCY(344.49,RCERA,3,0)) D NOTSET^RCDPEWLC Q
134 S (RCQUIT,Z)=0 F S Z=$O(^RCY(344.49,RCERA,3,Z)) Q:'Z W !!,"BATCH #: "_+$G(^(Z,0)) D EDIT(RCERA,Z,.RCQUIT) Q:RCQUIT
135 Q
136 ;
137REBATCH(RCERA) ; Allow to recreate batches
138 N DIR,X,Y,Z,Z0,RCQUIT,DA,DR,DIE,DIK,RCLINE
139 D FULL^VALM1
140 I $G(^TMP("RCBATCH_SELECTED",$J)) D NOBATCH^RCDPEWL G REBQ
141 ;
142 I '$O(^RCY(344.49,RCERA,3,0)) W !!," ***** THIS ERA CURRENTLY HAS NO BATCHES DEFINED *****"
143 ;
144 S RCQUIT=0
145 I $O(^RCY(344.49,RCERA,3,0)) D G:RCQUIT REBQ
146 . S DIR(0)="YA",DIR("B")="NO",DIR("A",1)="THIS ACTION REMOVES ALL BATCH REFERENCES. THE BATCHES CAN THEN BE REBUILT.",DIR("A")="ARE YOU SURE YOU WANT TO CONTINUE?: " W ! D ^DIR K DIR
147 . I Y'=1 S RCQUIT=1 Q
148 . S Z=0 F S Z=$O(^RCY(344.49,RCERA,3,Z)) Q:'Z S DA(1)=RCERA,DIK="^RCY(344.49,"_DA(1)_",3,",DA=Z D ^DIK
149 ;
150 K ^TMP($J,"BATCHES")
151 D SETBATCH(RCERA)
152 S Z=0 F S Z=$O(^RCY(344.49,RCERA,1,Z)) Q:'Z S Z0=$G(^(Z,0)) I +Z0'["." D
153 . S RCLINE=$G(^RCY(344.4,RCERA,1,+$P(Z0,U,9),0)),DA(1)=RCERA,DIE="^RCY(344.49,"_DA(1)_",1,",DA=Z,DR=".14///"_$S(RCLINE="":"@",1:"/"_$$GETBATCH^RCDPEWLB(RCLINE)) D ^DIE
154 K ^TMP($J,"BATCHES")
155REBQ S VALMBCK="R"
156 Q
157 ;
158CTEEOB(RCERA) ; Returns the approx # of EEOBs in ERA ien RCERA (file 344.4)
159 N RCNUM,Z
160 S (RCNUM,Z)=0 F S Z=$O(^RCY(344.4,RCERA,1,Z)) Q:'Z I $P($G(^(Z,0)),U,3)'<0 S RCNUM=RCNUM+1
161 Q RCNUM
162 ;
Note: See TracBrowser for help on using the repository browser.