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

IBPF1.m

Go to the documentation of this file.
  1. IBPF1 ;ALB/CPM - FIND BILLING DATA TO ARCHIVE (CON'T.) ; 20-APR-92
  1. ;;2.0;INTEGRATED BILLING;**45,347**;21-MAR-94;Build 24
  1. ;;Per VHA Directive 2004-038, this routine should not be modified.
  1. ;
  1. BILL ; Find all UB-82's which may be archived. Check only those bills
  1. ; whose First Printed Date is prior to the last date on which a
  1. ; bill must have been closed out in Accounts Receivable.
  1. ;
  1. ; Input: IBEDT -- last valid date on which a bill may be closed out
  1. ; IBTMPL -- search template in which to store entries
  1. ; Output: IBCNT -- number of IB Actions which may be archived.
  1. ;
  1. S (IBDT,IBN)="",IBCNT=0
  1. F S IBDT=$O(^DGCR(399,"AP",IBDT)) Q:'IBDT!(IBDT>IBEDT) F S IBN=$O(^DGCR(399,"AP",IBDT,IBN)) Q:'IBN I $$ALL(IBN,IBEDT) S IBCNT=IBCNT+1,^DIBT(IBTMPL,1,IBN)=""
  1. K IBCLO,IBDT,IBN
  1. Q
  1. ;
  1. ;
  1. IB ; Find Pharmacy Co-pay IB Actions which may be archived. Check
  1. ; only those Pharmacy Co-pay IB Actions which have been added to the
  1. ; database prior to the last date on which a bill must have been
  1. ; closed out in Accounts Receivable. Only "parent actions" will
  1. ; be checked, and if the parent action may be archived, the parent
  1. ; and its "children" will all be marked for archiving.
  1. ;
  1. ; Input: IBEDT -- last valid date on which a bill may be closed out
  1. ; IBTMPL -- search template in which to store entries
  1. ; Output: IBCNT -- number of IB Actions which may be archived.
  1. ;
  1. ; - first find all Pharmacy action types.
  1. K IBA F I=1:1 S IBATYPN=$P($T(PSO+I),";;",2,99) Q:IBATYPN="" S IBATYP=$O(^IBE(350.1,"B",IBATYPN,0)) I IBATYP S IBA(IBATYP)=""
  1. ;
  1. ; - locate all Pharmacy Co-pay actions which may be archived.
  1. S (IBDT,IBN)="",IBCNT=0
  1. F S IBDT=$O(^IB("D",IBDT)) Q:'IBDT!(IBDT>(IBEDT+.3)) D
  1. . F S IBN=$O(^IB("D",IBDT,IBN)) Q:'IBN D:$D(^IB("AD",IBN))
  1. .. S IBND=$G(^IB(IBN,0)) Q:IBND="" ; 0th node missing
  1. .. Q:'$D(IBA(+$P(IBND,"^",3))) ; not a Pharmacy co-pay action
  1. .. Q:$$RXFILE(IBND) ; billed prescription has not been archived
  1. .. S IBAR=$P(IBND,"^",11) Q:IBAR=""
  1. .. S X="RCFN03" X ^%ZOSF("TEST")
  1. .. S IBAR=$S($T:$$BIEN^RCFN03(IBAR),1:$O(^PRCA(430,"B",IBAR,0)))
  1. .. I IBAR,$$CLO(IBAR,IBEDT) F DA=0:0 S DA=$O(^IB("AD",IBN,DA)) Q:'DA S IBCNT=IBCNT+1,^DIBT(IBTMPL,1,DA)=""
  1. ;
  1. ; - kill variables and quit.
  1. K DA,IBA,IBAR,IBATYP,IBATYPN,IBCLO,IBDT,IBN,IBND,X
  1. Q
  1. ;
  1. ;
  1. RXFILE(IBND) ; Is the prescription still resident on-line?
  1. ; Input: IBND -- zeroth node of IB Action
  1. ; Output: 1 -- the rx is still on file
  1. ; 0 -- the rx is no longer on file (archived)
  1. N IBSL,RXCHK
  1. S IBSL=$P(IBND,"^",4) I +IBSL'=52 Q 0
  1. S IBSL=$P(IBSL,":",2)
  1. S RXCHK=$$FILE^IBRXUTL(+IBSL,.01)
  1. I RXCHK'="" Q 1
  1. Q 0
  1. ;
  1. ALL(IBN,DATE) ; Are all bills for an episode of care closed before DATE?
  1. ; Input: IBN -- ien of bill in file #399
  1. ; DATE -- the date by which the bills must be closed
  1. ; Output: 1 -- all bills are closed
  1. ; 0 -- at least one bill is not closed
  1. N I,X
  1. S X=$$CLO(IBN,DATE)
  1. I X S I=0 F S I=$O(^DGCR(399,"AC",IBN,I)) Q:'I I I'=IBN,'$$CLO(I,DATE) S X=0 Q
  1. Q X
  1. ;
  1. CLO(IBN,DATE) ; Is the bill closed before DATE?
  1. ; Input: IBN -- ien of bill in file #399
  1. ; DATE -- the date by which the bill must be closed
  1. ; Output: 1 -- the bill is closed
  1. ; 0 -- the bill is not closed
  1. N CLO S CLO=$$PUR^PRCAFN(IBN)
  1. Q $S(CLO=-2:1,CLO=-1:0,1:CLO'>DATE)
  1. ;
  1. ;
  1. PSO ; Pharmacy Co-pay Action Types
  1. ;;PSO NSC RX COPAY CANCEL
  1. ;;PSO NSC RX COPAY NEW
  1. ;;PSO NSC RX COPAY UPDATE
  1. ;;PSO SC RX COPAY CANCEL
  1. ;;PSO SC RX COPAY NEW
  1. ;;PSO SC RX COPAY UPDATE
  1. ;