VistA-FOIAVistA/r/FEE_BASIS-FB/FBCKDIS1.m

53 lines
2.2 KiB
Mathematica

FBCKDIS1 ;AISC/CMR - OUTPUT BY CHECK # cont. ;20APR94
;;3.5;FEE BASIS;;JAN 30, 1995
;;Per VHA Directive 10-93-142, this routine should not be modified.
D OPT,INPT,PHARM,TRAV
Q
OPT ;find outpatient payments for check #
Q:'$D(^FBAAC("ACK",FBCN))
S FBPROG="OPT",FBCNT=0
S FB1=0 F S FB1=$O(^FBAAC("ACK",FBCN,FB1)) Q:'FB1 S FB2=0 F S FB2=$O(^FBAAC("ACK",FBCN,FB1,FB2)) Q:'FB2 S FB3=0 F S FB3=$O(^FBAAC("ACK",FBCN,FB1,FB2,FB3)) Q:'FB3 S FB4=0 F S FB4=$O(^FBAAC("ACK",FBCN,FB1,FB2,FB3,FB4)) Q:'FB4 D
.Q:$S('$D(^FBAAC(FB1,1,FB2,1,FB3,1,FB4,0)):1,'$D(^FBAAC(FB1,1,FB2,1,FB3,1,FB4,2)):1,'$D(^FBAAC(FB1,1,FB2,1,FB3,0)):1,1:0)
.S FBCNT=FBCNT+1,FBDA=FB1_"^"_FB2_"^"_FB3_"^"_FB4,DFN=FB1,FBV=FB2
.D SETMP
D CLN Q
INPT ;find inpatient payments for check #
Q:'$D(^FBAAI("ACK",FBCN))
S (FBCNTCH,FBCNTCNH)=0
S FB1=0 F S FB1=$O(^FBAAI("ACK",FBCN,FB1)) Q:'FB1 D
.Q:$S('$D(^FBAAI(FB1,0)):1,'$D(^FBAAI(FB1,2)):1,1:0)
.S FBA=^FBAAI(FB1,0),DFN=$P(FBA,U,4),FBV=$P(FBA,U,3)
.S FBPROG=$S($P(FBA,U,12)=6:"CH",$P(FBA,U,12)=7:"CNH",1:"") Q:FBPROG']""
.I FBPROG="CH" S FBCNTCH=FBCNTCH+1,FBCNT=FBCNTCH
.I FBPROG="CNH" S FBCNTCNH=FBCNTCNH+1,FBCNT=FBCNTCNH
.S FBDA=FB1
.D SETMP
D CLN Q
PHARM ;find pharmacy payments for check #
Q:'$D(^FBAA(162.1,"ACK",FBCN))
S FBCNT=0,FBPROG="PHAR"
S FB1=0 F S FB1=$O(^FBAA(162.1,"ACK",FBCN,FB1)) Q:'FB1 S FB2=0 F S FB2=$O(^FBAA(162.1,"ACK",FBCN,FB1,FB2)) Q:'FB2 D
.Q:$S('$D(^FBAA(162.1,FB1,"RX",FB2,0)):1,'$D(^FBAA(162.1,FB1,"RX",FB2,2)):1,'$D(^FBAA(162.1,FB1,0)):1,1:0)
.S FBCNT=FBCNT+1
.S FBA=^FBAA(162.1,FB1,"RX",FB2,0),DFN=$P(FBA,U,5),FBV=$P(^FBAA(162.1,FB1,0),U,4)
.S FBDA=FB1_"^"_FB2
.D SETMP
D CLN Q
TRAV ;find travel payments for check #
Q:'$D(^FBAAC("ACKT",FBCN))
S FBCNT=0,FBPROG="TRAV"
S FB1=0 F S FB1=$O(^FBAAC("ACKT",FBCN,FB1)) Q:'FB1 S FB2=0 F S FB2=$O(^FBAAC("ACKT",FBCN,FB1,FB2)) Q:'FB2 D
.Q:'$D(^FBAAC(FB1,3,FB2,0))
.S FBCNT=FBCNT+1
.S DFN=FB1,FBV="R"
.S FBDA=FB1_"^"_FB2
.D SETMP
D CLN Q
SETMP ;set up tmp global
S ^TMP($J,"FBCK",FBPROG,FBV,DFN,FBCNT)=FBDA
Q
CLN K FB1,FB2,FB3,FB4,FBA,FBCNT,DFN,FBCNTCH,FBCNTCNH,FBPROG Q
SUSP ;get suspense code
S FBSUSP=$S(FBSUSP="":"",$D(^FBAA(161.27,FBSUSP,0)):^FBAA(161.27,FBSUSP,0),1:"")
Q