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

IBARXEU4.m

Go to the documentation of this file.
  1. IBARXEU4 ;ALB/AAS - RX COPAY EXEMPTION CHECK IF PREVIOUSLY CANCELED ; 12-JAN-93
  1. ;;Version 2.0 ; INTEGRATED BILLING ;; 21-MAR-94
  1. ;;Per VHA Directive 10-93-142, this routine should not be modified.
  1. ;
  1. CANDT ; -- set beginning and ending dates
  1. ; input dfn =: patient internal number
  1. ; ibedt =: end date to cancel
  1. ; ibdt =: beging date to cancel
  1. ;
  1. ; output ibcandt =: begin date^end date to cancel
  1. ;
  1. N X
  1. ;S IBCANDT=IBDT_"^"_IBEDT
  1. ;
  1. ; -- get last end date
  1. S X=+$O(^IBA(354.1,"ACAN",DFN,"")) S:X<0 X=-X D:'X CONV ;never previously cancelled
  1. I X,X>IBDT S IBDT=X
  1. ;
  1. ; -- only cancel back 1 year from today, or eff. legislation max
  1. I IBDT<$$MINUS^IBARXEU0(DT) S IBDT=$$MINUS^IBARXEU0(DT)
  1. I IBDT<$$STDATE^IBARXEU S IBDT=$$STDATE^IBARXEU
  1. S IBCANDT=IBDT_"^"_IBEDT
  1. CANDTQ Q
  1. ;
  1. CONV ; -- see if conversion done
  1. N X
  1. S X=$G(^IBE(350.9,1,3)) G:$P(X,"^",14) CONVQ ; conversion complete
  1. I $P(X,"^",3),DFN<$P(X,"^",4) G CONVQ ; patient already converted
  1. ;
  1. ; -- need to convert patient on the fly
  1. S IBDT=$$STDATE^IBARXEU
  1. CONVQ Q
  1. ;
  1. ARCAN(DFN,IBSTAT,IBDT,IBEDT) ; -- process cancellation with ar logic here
  1. ;
  1. ; Input =: dfn patient internal entry number
  1. ; ibstat patient status from $$rxexmt or $$rxst
  1. ; ibdt beginning date to cancel
  1. ; ibedt ending date to cancel
  1. ;
  1. Q:'+IBSTAT ; non-exempt patient
  1. ;
  1. S:IBEDT>DT IBEDT=DT S:IBDT<$$STDATE^IBARXEU IBDT=$$STDATE^IBARXEU
  1. ;
  1. ; -- set begin and ending date, check x-ref
  1. S X=+$O(^IBA(354.1,"ACAN",DFN,"")) S:X<0 X=-X
  1. I X,X>IBDT S IBDT=X
  1. ;
  1. ; -- end date must be after begin date
  1. I IBDT>IBEDT G ARCANQ
  1. ;
  1. ; -- set begin and ending dates in last entry created
  1. D UPCAN
  1. ;
  1. N IBWHER
  1. S ERR=0,IBWHER=17
  1. D EN1^PRCAX(DFN,IBDT,IBEDT,.ERR)
  1. I ERR]"",+ERR'=ERR S ^TMP("IB-ERROR",$J,DFN)=ERR,IBEXERR=10 S:'$D(IBJOB) IBJOB=11 D ^IBAERR K IBEXERR
  1. ARCANQ Q
  1. ;
  1. UPCAN ; -- update canceled date fields
  1. N X2
  1. S DIE="^IBA(354.1,",DR=".13////"_$P(IBCANDT,"^")_";.14////"_$P(IBCANDT,"^",2)
  1. S DA=$O(^($O(^IBA(354.1,"AIVDT",1,DFN,"")),0))
  1. S X2=$G(^IBA(354.1,DA,0))
  1. I $P(X2,"^",2)'=DFN!($P(X2,"^",14)) G UPCANQ
  1. D ^DIE
  1. K DIC,DIE,DA,DR,X
  1. UPCANQ Q