66 lines
4.0 KiB
Mathematica
66 lines
4.0 KiB
Mathematica
FBCHPSA ;AISC/DMK-CALCULATES COSTS BY PSA ;13JUN90
|
|
;;3.5;FEE BASIS;;JAN 30, 1995
|
|
;;Per VHA Directive 10-93-142, this routine should not be modified.
|
|
EN S FBPSA=0
|
|
S DIR(0)="Y",DIR("A")="Do you want this report for all PSAs",DIR("B")="YES" D ^DIR K DIR G END:$D(DIRUT),SELECT:'Y
|
|
ASKDT D PROG^FBCHPSA1 G END:'$O(FBPROG(0))
|
|
D DATE^FBAAUTL G END:FBPOP S FBBEG=9999999-ENDDATE,FBEND=9999999-BEGDATE
|
|
S VAR="FBBEG^FBEND^FBPSA^BEGDATE^ENDDATE^FBPROG(",PGM="START^FBCHPSA" S IOP="Q" D ZIS^FBAAUTL G END:FBPOP
|
|
;
|
|
START ; start output
|
|
S BEGDATE=$$DATX^FBAAUTL(BEGDATE),ENDDATE=$$DATX^FBAAUTL(ENDDATE)
|
|
S:$E(IOST,1,2)'="C-" FBPG=1
|
|
S (FBAAOUT,FBCNT)=0,QQ="=",$P(QQ,"=",80)="=",Q="-",$P(Q,"-",80)="-"
|
|
K ^TMP("FBPSA",$J)
|
|
S FBPROG=0
|
|
S FBHPSA=FBPSA
|
|
F S FBPROG=$O(FBPROG(FBPROG)) Q:'FBPROG!($G(FBAAOUT)) D G END:$G(FBAAOUT) S FBPSA=FBHPSA
|
|
. I FBPROG=6 D REPORT Q:$G(FBAAOUT)
|
|
. I FBPROG=7 D REPORT Q:$G(FBAAOUT)
|
|
. I FBPROG=3 D ^FBCHPSA1 Q:$G(FBAAOUT)
|
|
. I FBPROG=2 D ^FBCHPSA0 Q:$G(FBAAOUT)
|
|
;
|
|
G END:$G(FBAAOUT)
|
|
D PSATOT^FBCHPSA0
|
|
G END
|
|
REPORT U IO
|
|
K ^TMP("FBPSA",$J) D HED
|
|
I FBPSA>0 F FBI=FBBEG-.1:0 S FBI=$O(^FBAAI("AP",FBPSA,FBI)) Q:FBI'>0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=$$DATX^FBAAUTL(FBPDDT) S VAPA("P")="" D ADD^VADPT S FBCOUNTY=$P(VAPA(7),"^",2)
|
|
Q:$P(FBY(0),"^",12)'=FBPROG
|
|
S FB7078=$P(FBY(0),"^",5) Q:FB7078="" D EN1 S FBAMTPD=FBAMTPD+FBAMT
|
|
S FBNAME=$$NAME^FBCHREQ2(FBDFN),FBSSN=$$SSN^FBAAUTL(FBDFN)
|
|
S FBSTA=$S($D(^DIC(4,FBPPSA,0)):$P(^(0),"^"),1:"Unknown")
|
|
S FBOBL=$P(FBY(0),"^",17),FBOBL=$S(FBOBL="":"Unknown",1:$S($D(^FBAA(161.7,FBOBL,0)):$P(^(0),"^",2),1:"Unknown"))
|
|
I $Y+4>IOSL D HANG Q:FBAAOUT D HED
|
|
W !,$E(FBNAME,1,30)," -",$$SSN^FBAAUTL(FBDFN,1),?42,FBOBL,?57,FBCOUNTY,!,?4,FBINV,?21,FBAMTPD,?39,FBPDDT,?60,FBSTA,!,Q,!
|
|
S:'$D(^TMP("FBPSA",$J,FBPPSA)) ^TMP("FBPSA",$J,FBPPSA)=0
|
|
S ^TMP("FBPSA",$J,FBPPSA)=^TMP("FBPSA",$J,FBPPSA)+FBAMTPD
|
|
S:'$D(^TMP("FBTOT",$J,FBPPSA)) ^TMP("FBTOT",$J,FBPPSA)=0
|
|
S ^TMP("FBTOT",$J,FBPPSA)=^TMP("FBTOT",$J,FBPPSA)+FBAMTPD
|
|
Q
|
|
HED W:'$G(FBPG) @IOF I $G(FBPG) K FBPG
|
|
W !?25,$S(FBPROG=6:"CIVIL HOSPITAL PSA REPORT",FBPROG=2:"OUTPATIENT MEDICAL PSA REPORT",FBPROG=3:"PHARMACY PSA REPORT",1:"COMMUNITY N.H. PSA REPORT")
|
|
W !?24,"-------------------------------",!,"Patient Name",?40,"Obligation #",?56,"County Code",!
|
|
W ?3,"Invoice #",?20,"Amount Paid",?38,"Date Finalized",?59,"PSA",!,QQ
|
|
Q
|
|
SELECT S DIR(0)="161.01,101" D ^DIR G END:$D(DUOUT),H^XUS:$D(DTOUT),EN:X="" S FBPSA=+Y G ASKDT
|
|
HANG I $E(IOST,1,2)["C-" S DIR(0)="E" D ^DIR K DIR S:'Y FBAAOUT=1
|
|
Q
|
|
HED1 W !,QQ,!?7,"Total Dollars spent by PSA for the dates of ",BEGDATE," to ",ENDDATE,". ",!!?5,"PSA",?40,"TOTAL AMOUNT PAID",!,?4,"-----",?39,"--------------------" Q
|
|
EN1 S FBAMT=0 Q:'$D(^FBAAC("AM",FB7078))
|
|
F I=0:0 S I=$O(^FBAAC("AM",FB7078,I)) Q:I'>0 F J=0:0 S J=$O(^FBAAC("AM",FB7078,I,J)) Q:J'>0 F K=0:0 S K=$O(^FBAAC("AM",FB7078,I,J,K)) Q:K'>0 F L=0:0 S L=$O(^FBAAC("AM",FB7078,I,J,K,L)) Q:L'>0 I $D(^FBAAC(I,1,J,1,K,1,L,0)) S FBZ(0)=^(0) D GT
|
|
Q
|
|
GT S FBAMT=FBAMT+$P(FBZ(0),"^",3) Q
|