source: WorldVistAEHR/trunk/r/FEE_BASIS-FB/FBNHEP2.m@ 1361

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

initial load of WorldVistAEHR

File size: 3.9 KB
RevLine 
[613]1FBNHEP2 ;AISC/GRR-ENTER NURSING HOME PAYMENT ;12:05 PM 13 Jun 1990;
2 ;;3.5;FEE BASIS;;JAN 30, 1995
3 ;;Per VHA Directive 10-93-142, this routine should not be modified.
4NOBAT W !!,*7,"You do not have an open CNH Batch. You must have an open",!,"CNH type Batch before you can enter a payment!",!
5 D Q
6 Q
7 ;
8GETBAT S FBOUT=0,DIC="^FBAA(161.7,",DIC(0)="AEQM",DIC("S")="I $P(^(0),U,3)=""B9""&($P(^(0),U,5)=DUZ)&($P(^(0),U,15)="""")&($G(^(""ST""))=""O"")" W ! D ^DIC K DIC
9 I X=""!(X="^") S FBOUT=1 Q
10 G GETBAT:Y<0 S FBBAT=+Y,FBCNH=1
11 Q
12Q K FBYY,FBMM,FBDAYS,FBPAYDT,FBENDDT,Z,Y,DIC,FBRIFN,CNT,%DT,FBAABDT,FBAAEDT,FBAAPTC,FBDEFP,FBER,FBERR,FBHZ,FBINA,FBIRAT,FBPIFN,FBPREV,FBPROG,FBPRTR,FBSRAT,FBTRDYS,FBTYPE,FBVCAR,I,IFN,VAL,X,DA,DIE,DR,FBAAID,FBAAIN,FBNL,FBI7078,FBBAT,FBOUT
13 K DAT,F,FBAUT,FBDX,FBEDT,FBI,FBMULT,FBRR,FBTDT,FBXX,FTP,PI,PTYPE,T,ZZ,FB7078,FBAAOUT,FBASSOC,FBLOC,FBPOV,FBPSA,FBPT,FBTT,FBVEN,TA,FBCNH
14 Q
15 ;
16CKRAT ;check rates and fill gaps if needed
17 K FB S FBERR=0 N I,J,FBVIEN,FBCHFDT,FBCHTDT,FBCIEN,FBCNUM,FBDDT,FBEXDT,FBEXNDT,FBFND,FBRFDT,FBRTDT,FBRT,FBUNR S I=0
18 F S I=$O(^FBAA(161.23,"AC",FB7078,I)) Q:'I I $D(^FBAA(161.23,I,0)) S J=^(0) D
19 .S FBRT($P(J,U))=$P(J,U,5)_"^"_$P(J,U,2)
20 S FBRFDT=0,FBCHFDT=$S(FBAABDT<FBPAYDT:$E(FBPAYDT,1,5)_"01",1:FBAABDT),(FBCHTDT,FBDDT)=FBENDDT,I=DFN,FBVIEN=IFN
21 D GETRAT^FBNHRAT,CKFRDT^FBNHRAT
22 I $D(FBUNR) S FBERR=1 D ERR K FB Q
23 D GETRAT
24 Q
25GETRAT N I,J,FBCK S I=0
26 F S I=$O(^FBAA(161.23,"AC",FB7078,I)) Q:'I I $D(^FBAA(161.23,I,0)) S J=^(0) D
27 .S FB($P(J,U,2))=$P(J,U,5)_"^"_$P(J,U)
28 I $O(FB(FBPAYDT+.9))="" S FBERR=1 D ERR Q
29 Q
30 ;
31CALC ;get dollar amount to pay when no movements in month.
32 ;FBPAYS=# of days in month
33 ;FBTRDYS=# of treatment days
34 ;FBPAYDT=month of payment
35 ;FBENDDT=last day of payment month or last day of authorization
36 S FBDEFP=0 N FBCT S FBCT=0
37 I $G(FBDAYS) S FBTRDYS=$S(FBTRDYS>FBDAYS:FBDAYS,1:FBTRDYS)
38 S X=$S(FBAABDT>(FBPAYDT):FBAABDT-1,1:FBPAYDT)
39 S Y=$O(FB(X)) I FBENDDT'>Y S FBDEFP=FBTRDYS*+FB(Y) Q
40RATE S X1=$O(FB(X)),FBCT=FBCT+1 I 'X1 S FBERR=1 Q
41 S FBX1=($S(X1>(FBENDDT-$G(FBENDFLG)):(FBENDDT-$G(FBENDFLG)),1:X1)-X) S:FBCT'>0 FBX1=FBX1+1 S FBDEFP=FBDEFP+(FBX1*$P(FB(X1),U)) S X=X1
42 I FBENDDT>X G RATE
43 Q
44 ;
45ERR W !,"Insufficient Authorization Rate data on file for patient: ",$$NAME^FBCHREQ2(DFN) ;,!,"Use the Edit Authorization option prior to entering payment.",!!
46 W !,"Take the appropriate action prior to entering a payment:"
47 W !?3,"Use the Edit Authorization option to modify the authorization period or",!?3,"assure a contract with valid rates exists for the payment period before",!?8,"continuing with this payment entry.",!!
48 Q
49 ;calculate dollars when at least one movement in month.
50CALC1 S (I,J,Z,FBDEFP)=0
51 F S J=$O(FBZZ(J)) Q:'J D
52 .S I=$O(FBZZ(0)) Q:'I D
53 ..F Q:'$D(FBZZ(I)) S X=$P(FBZZ(I),"^"),Y=$O(FB(X-.1)),X1=$O(FB(X-.1)) Q:'Y D
54 ...I $P(FBZZ(I),"^",2)>Y S Z=1 D DEFP S Z=0 S $P(FBZZ(I),"^")=Y+1 Q
55 ...S Y=$P(FBZZ(I),"^",2) D DEFP K FBZZ(I)
56 K I,J,X,Y,X1 Q
57 ;
58DEFP S FBDEFP=FBDEFP+(($S(FBAABDT=FBAAEDT:1,1:Y-X)+$P(FBZZ(I),"^",3)+Z)*+FB(X1))
59 Q
60 ;
61DAYS S (I,FBTRDYS)=0 K FBPREV,FBHI
62 S FBBEG=FBPAYDT+1
63 F S I=$O(FBZ(I)) Q:'I D
64 .I '$D(FBPREV),$P(FBZ(I),U,2) S FBBEG=$S($P(FBZ(I),U)>FBPAYDT:$P(FBZ(I),U),1:FBPAYDT),FBPREV=1
65 .I '$P(FBZ(I),U,2),$S('$D(FBHI):1,1:$P(FBZ(+FBHI),U,2)) S FBEND=$P(FBZ(I),U),FBTRDYS=FBTRDYS+($S(FBEND-FBBEG:FBEND-FBBEG,((FBAABDT<FBAAEDT)&(+$E(FBAAEDT,6,7)=1)):0,1:1))+$P(FBZ(I),U,2) S FBZZ(I)=FBBEG_"^"_FBEND
66 .I $D(FBHI),$P(FBZ(I),U,2) S FBBEG=$P(FBZ(I),U)
67 .S FBHI=I
68 I FBENDDT>$P(FBZ(FBHI),U),$P(FBZ(FBHI),U,2) S FBTRDYS=FBTRDYS+($S(FBENDDT-FBBEG:FBENDDT-FBBEG,1:1))+1,$P(FBZZ(FBHI),U,3)=1 I '+FBZZ(FBHI) S $P(FBZZ(FBHI),"^",1,2)=FBBEG_"^"_FBENDDT
69 I FBENDDT=$P(FBZ(FBHI),U),$P(FBZ(FBHI),U,2) S FBTRDYS=FBTRDYS+1 I '+$G(FBZZ(FBHI)) S $P(FBZZ(FBHI),"^",1,2)=FBBEG_"^"_FBENDDT
70 Q
71CHECK N FBCK,FBCK1
72 S FBCK=$S(FBABD<FBPAYDT:($E(FBPAYDT,1,5)_"01"),1:FBABD),FBCK1=$O(FB(FBCK-.1)) I $P(FB(FBCK1),"^",2)>FBCK S FBERR=1 D ERR Q
73 Q
Note: See TracBrowser for help on using the repository browser.