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

FBNHRAT.m

Go to the documentation of this file.
  1. FBNHRAT ;AISC/CMR - POST NEW RATES FOR VETERAN ;9/19/2014
  1. ;;3.5;FEE BASIS;**154**;JAN 30, 1995;Build 12
  1. ;;Per VA Directive 6402, this routine should not be modified.
  1. S FBRATE=1 K ^TMP($J,"FB")
  1. VENDOR ;select CNH vendor from the fee vendor file (161.2)
  1. S DIC="^FBAAV(",DIC(0)="AEQM",DIC("A")="Select CNH Vendor:",DIC("S")="I $P(^(0),U,9)=5" D ^DIC K DIC G Q:X=""!(X="^")!(Y<0) S FBVIEN=+Y
  1. ;
  1. VETDISP ;get patients in the selected nursing home
  1. S I=0
  1. F S I=$O(^FBAACNH("AD",I)) Q:'I S J=0 F S J=+$O(^FBAACNH("AD",I,J)) Q:'J I $P($G(^FBAACNH(J,0)),U,9)=FBVIEN S FB(0)=$G(^(0)) D DRIV(I,J,.FB) K FBNFDT,FBNTDT
  1. I '$G(FBFND) W !!,"There are presently no patients that need rates updated for this vendor."
  1. Q K DIC,X,Y,FBVIEN,I,J,FB,FBTYP,FBNFDT,FBNTDT,FBAUTHN,FBAUTH,FBAFDT,FBATDT,FB7078,FBRT1,FBNFDT,FBNTDT,FBRTDT,FBIEN,FBRFDT,FBCFDT,FBI,FBCTDT,FBCNUM,FBRATE,FBFND,FBX,FBNRTDT,FBNRFDT,DUOUT,DTOUT,DIRUT,DR,DIE,FBCHFDT,FBCHTDT,FBRT,FBZ
  1. K FBRET
  1. Q
  1. DRIV(I,J,FB,FBDDT) ;identify incomplete rate data for a given authorization
  1. ;INPUT I = DFN
  1. ; J = ien of active admission from movement file (162.3)
  1. ; FB = passing of 0 node of mvmnt(162.3)
  1. ; FBDDT (optional) = date of discharge
  1. ;output FBFND = if 1 means at least 1 pt. had a rate created
  1. ; FBUNR (only set if FBDDT passed) = array containing timeframes
  1. ; unable to establish rates for
  1. N FBVIEN,FBAUTHN,FBAUTH,FBAFDT,FBATDT,FB7078,FBNFDT,FBNTDT,FBIEN,FBRFDT,FBRTDT,FBRT,FBCHFDT,FBCHTDT
  1. ; FBNHARUP flag (N, 1, or 11)
  1. ; when value is true (1 or 11) rates can be changed within
  1. ; SET^FBNHRAT1 because calling option can edit 'authorization'
  1. ; SET^FBNHRAT1 changes the value from 1 to 11 if a rate is added
  1. N FBNHARUP
  1. S FBNHARUP=1
  1. S FBVIEN=+$P(FB(0),U,9),FBAUTHN=$P(^FBAACNH(J,0),"^",10),FBAUTH=$G(^FBAAA(I,1,FBAUTHN,0)),FBAFDT=+FBAUTH,FBATDT=$P(FBAUTH,"^",2),FB7078=+$P(FBAUTH,"^",9)
  1. I $G(FBDDT) S FBAFDT=$S($$DTC^FBUCUTL(DT,FBAFDT)>730:$$CDTC^FBUCUTL(DT,-730),1:FBAFDT) Q:FBAFDT>FBDDT
  1. ;checks rate file, if no rates exist it will create one
  1. I '$D(^FBAA(161.23,"AC",FB7078)) S FBNFDT=FBAFDT,FBNTDT=$S($G(FBDDT):FBDDT,1:FBATDT) D VENDAT^FBNHRAT1 D:FBNHARUP=11 Q
  1. . N FBX
  1. . S FBX=$$ADDUA^FBUTL9(162.4,FB7078_",","Add CNH rate(s).")
  1. . I 'FBX W !,"Error adding record in User Audit. Please contact IRM."
  1. ;set up array of existing rates
  1. K FBRT S FBIEN=0 F S FBIEN=$O(^FBAA(161.23,"AC",FB7078,FBIEN)) Q:'$G(FBIEN) S FB(1)=$G(^FBAA(161.23,FBIEN,0)),FBRFDT=+FB(1),FBRT(FBRFDT)=FB(1) K FB(1)
  1. ;FBCHFDT and FBCHTDT are check dates (initially = to auth fr & to dates, they are incremented based on existing rates throughout the check)
  1. S FBCHFDT=FBAFDT,FBCHTDT=$S($G(FBDDT):FBDDT,1:FBATDT),FBRFDT=0 D GETRAT,CKFRDT
  1. I FBNHARUP=11 D
  1. . N FBX
  1. . S FBX=$$ADDUA^FBUTL9(162.4,FB7078_",","Add CNH rate(s).")
  1. . I 'FBX W !,"Error adding record in User Audit. Please contact IRM."
  1. Q
  1. GETRAT ;gets next rate from rate array
  1. S FBRFDT=+$O(FBRT(FBRFDT)) Q:'FBRFDT S FBRTDT=$P(FBRT(FBRFDT),"^",2) Q
  1. CKFRDT ;comparison of from dates
  1. Q:FBCHFDT>FBCHTDT
  1. I FBCHFDT=FBRFDT G CKTODT
  1. I FBCHFDT<FBRFDT S FBNFDT=FBCHFDT,FBNTDT=$S($$CDTC^FBUCUTL(FBRFDT,-1)>FBCHTDT:FBCHTDT,1:$$CDTC^FBUCUTL(FBRFDT,-1)) D VENDAT^FBNHRAT1 S FBCHFDT=$$CDTC^FBUCUTL(FBNTDT,1) K FBNFDT,FBNTDT G CKFRDT
  1. I FBCHFDT>FBRFDT Q:FBCHFDT>FBCHTDT I 'FBRFDT S FBNFDT=FBCHFDT,FBNTDT=FBCHTDT D VENDAT^FBNHRAT1 K FBNFDT,FBNTDT Q
  1. I FBCHFDT>FBRFDT G CKTODT
  1. Q
  1. CKTODT ;comparison of to dates
  1. Q:FBCHTDT=FBRTDT!(FBCHTDT<FBRTDT)
  1. I FBCHFDT'>FBRTDT S FBCHFDT=$$CDTC^FBUCUTL(FBRTDT,1)
  1. D GETRAT G CKFRDT