IBORAT2B ;ALB/RJS - DATE SETUP IBIBROUTINE - 1/22/92
;;Version 2.0 ; INTEGRATED BILLING ;; 21-MAR-94
;CALLED BY IBORAT
;THIS ROUTINE PARSES A TMP FILE CONTAINING DATA FROM FILE
;399.5 AND CALCULATES BEGINNING AND ENDING DATES
;FOR BILLING RATES AND MEDICARE DEDUCTIBLES.
;EG. IF RATE IS EFFECTIVE ON 1/1/87 AND IS SUPERSEDED BY A NEW RATE
;ON 1/1/88 IT IS IN EFFECT FROM 1/1/87-12/31/87
;THIS DATA IS STORED IN
;^TMP($J,IBROUT,IBSPEC,IBREVCDE,IBEFFDAT)=IBCANCEL^AMOUNT^ACTIVE
;OUTPUT BY IBORAT2C
;
START ;
S IBROUT="IBORAT2A",IBSPEC=""
F S IBSPEC=$O(^TMP($J,IBROUT,IBSPEC)) Q:IBSPEC="" D IBREVCDE
END ;
K IBCANCEL,IBEFFDAT,IBREVCDE,IBROUT,IBSPEC,X,X1,X2
Q
IBREVCDE ;
S IBREVCDE=""
F S IBREVCDE=$O(^TMP($J,IBROUT,IBSPEC,IBREVCDE)) Q:IBREVCDE="" D IBPAYORS
Q
IBPAYORS ;
S IBPAYORS=""
F S IBPAYORS=$O(^TMP($J,IBROUT,IBSPEC,IBREVCDE,IBPAYORS)) Q:IBPAYORS="" D IBEFFDAT
Q
IBEFFDAT ;
S IBEFFDAT=-1
F S IBEFFDAT=$O(^TMP($J,IBROUT,IBSPEC,IBREVCDE,IBPAYORS,IBEFFDAT)) Q:IBEFFDAT="" D IBCANCEL
Q
IBCANCEL ;
S IBCANCEL=$O(^TMP($J,IBROUT,IBSPEC,IBREVCDE,IBPAYORS,IBEFFDAT))
I IBCANCEL="" D CANDATE2 Q
S X1=IBCANCEL,X2=-1 D C^%DTC
S ^TMP($J,"IBORAT2B",IBSPEC,IBEFFDAT,IBREVCDE,IBPAYORS)=X_"^"_^(IBEFFDAT)
Q
CANDATE2 ;
S ^TMP($J,"IBORAT2B",IBSPEC,IBEFFDAT,IBREVCDE,IBPAYORS)=9999999_"^"_^(IBEFFDAT)
Q
IBORAT2B ;ALB/RJS - DATE SETUP IBIBROUTINE - 1/22/92
+1 ;;Version 2.0 ; INTEGRATED BILLING ;; 21-MAR-94
+2 ;CALLED BY IBORAT
+3 ;THIS ROUTINE PARSES A TMP FILE CONTAINING DATA FROM FILE
+4 ;399.5 AND CALCULATES BEGINNING AND ENDING DATES
+5 ;FOR BILLING RATES AND MEDICARE DEDUCTIBLES.
+6 ;EG. IF RATE IS EFFECTIVE ON 1/1/87 AND IS SUPERSEDED BY A NEW RATE
+7 ;ON 1/1/88 IT IS IN EFFECT FROM 1/1/87-12/31/87
+8 ;THIS DATA IS STORED IN
+9 ;^TMP($J,IBROUT,IBSPEC,IBREVCDE,IBEFFDAT)=IBCANCEL^AMOUNT^ACTIVE
+10 ;OUTPUT BY IBORAT2C
+11 ;
START ;
+1 SET IBROUT="IBORAT2A"
SET IBSPEC=""
+2 FOR
SET IBSPEC=$ORDER(^TMP($JOB,IBROUT,IBSPEC))
IF IBSPEC=""
QUIT
DO IBREVCDE
END ;
+1 KILL IBCANCEL,IBEFFDAT,IBREVCDE,IBROUT,IBSPEC,X,X1,X2
+2 QUIT
IBREVCDE ;
+1 SET IBREVCDE=""
+2 FOR
SET IBREVCDE=$ORDER(^TMP($JOB,IBROUT,IBSPEC,IBREVCDE))
IF IBREVCDE=""
QUIT
DO IBPAYORS
+3 QUIT
IBPAYORS ;
+1 SET IBPAYORS=""
+2 FOR
SET IBPAYORS=$ORDER(^TMP($JOB,IBROUT,IBSPEC,IBREVCDE,IBPAYORS))
IF IBPAYORS=""
QUIT
DO IBEFFDAT
+3 QUIT
IBEFFDAT ;
+1 SET IBEFFDAT=-1
+2 FOR
SET IBEFFDAT=$ORDER(^TMP($JOB,IBROUT,IBSPEC,IBREVCDE,IBPAYORS,IBEFFDAT))
IF IBEFFDAT=""
QUIT
DO IBCANCEL
+3 QUIT
IBCANCEL ;
+1 SET IBCANCEL=$ORDER(^TMP($JOB,IBROUT,IBSPEC,IBREVCDE,IBPAYORS,IBEFFDAT))
+2 IF IBCANCEL=""
DO CANDATE2
QUIT
+3 SET X1=IBCANCEL
SET X2=-1
DO C^%DTC
+4 SET ^TMP($JOB,"IBORAT2B",IBSPEC,IBEFFDAT,IBREVCDE,IBPAYORS)=X_"^"_^(IBEFFDAT)
+5 QUIT
CANDATE2 ;
+1 SET ^TMP($JOB,"IBORAT2B",IBSPEC,IBEFFDAT,IBREVCDE,IBPAYORS)=9999999_"^"_^(IBEFFDAT)
+2 QUIT