VistA-WorldVistAEHR/r/BENEFICIARY_TRAVEL-DGBT/DGBTOA4.m

46 lines
3.7 KiB
Mathematica

DGBTOA4 ;ALB/MAC - BENEFICIARY OUTPUTS HEADER ROUTINE ;2/21/91 15:57
;;1.0;Beneficiary Travel;**7**;September 25, 2001
;Adds up totals
DTC K X,X2 I DGBTSL="PAT" S:DGBTZ="T" DGBTSSN=SSN I DGBTSL="PAT" S DGBTOD=$S(DGBTZ="F":^UTILITY($J,2,DGBTDD,DGBTX1,DGBTSSN,"T"),1:^UTILITY($J,2,DGBTDN,DGBTX,DGBTSSN,"T"))
I DGBTSL'="PAT" S DGBTOD=$S(DGBTZ="F":^UTILITY($J,2,DGBTDD,DGBTX1,"T"),1:^UTILITY($J,2,DGBTDN,DGBTX,"T"))
W ! I DGBTZ="T" W DGBTX,?32
I DGBTZ="F" W:DGBTSL'="PAT" !?35,"TOTAL",?45 W:DGBTSL="PAT" !?32,"TOTAL",?38
S:DGBTZ="F" X2="2$" S X=$P(DGBTOD,"^",2) S DGBTSDT=DGBTSDT+X D CM W X W:DGBTZ="T" ?46 I DGBTZ="F" W:DGBTSL="PAT" ?52 W:DGBTSL'="PAT" ?57
S:DGBTZ="F" X2="2$" S X=$P(DGBTOD,"^",1) S DGBTAT=DGBTAT+X D CM W X
I DGBTZ="T" S X=$P(DGBTOD,"^",1)+$P(DGBTOD,"^",2) S DGBTGT=DGBTGT+X D CM W ?60,X W:DGBTSL'="PAT" ?76,$J(DGBTOTX(DGBTDN,DGBTX1),4) S DGBTGT(DGBTDV)=DGBTAT_"^"_DGBTSDT Q
S DGBTGT(DGBTODV)=DGBTAT_"^"_DGBTSDT Q
;Prints page headings
HE S DGBTPG=DGBTPG+1
W @IOF W:'DGBT4 !?3,"DIVISION: ",$S(DGBTDV="ZNOT SPECIFIED":"NOT SPECIFIED",DGBTD1:DGBTODV,1:DGBTDV) W ?50,DGBTDT," PAGE ",DGBTPG
S X="BENEFICIARY TRAVEL OUTPUT "_"BY "_$S(DGBTSL="CAR":"CARRIER",DGBTSL="ACCT":"ACCOUNT",DGBTSL="TYP":"ACCOUNT TYPE",1:"PATIENT")
W !?(40-($L(X)/2)),X I DGBTZ="T" W !?32,"DIVISION TOTALS"
S DGBTBG=DGBTBEG+.0001,DGBTT=$S(DGBTBG=(DGBTEND\1):"FOR ",1:"FROM "),VADAT("W")=DGBTBG D ^VADATE S DGBTT=DGBTT_$P(VADATE("E"),"@",1) I DGBTEND\1'=DGBTBG S VADAT("W")=DGBTEND\1 D ^VADATE S DGBTT=DGBTT_" TO "_$P(VADATE("E"),"@",1)
S DGBTY=40-($L(DGBTT)/2) W !?DGBTY,DGBTT,!
W ! I DGBTSL="PAT" W:DGBTZ="F" ?7,"DATE",?25,"ACCOUNT",?43
I DGBTSL'="PAT" W:DGBTZ="F" ?7,"NAME",?22,"PT ID",?35,"DATE",?50
I DGBTZ="T" W:DGBT4 ?5 W:'DGBT4 ?10 W $S(DGBT4:"DIVISION NAME",DGBTSL="PAT":"NAME",DGBTSL="CAR":"CARRIER",1:"ACCOUNT")
I DGBTZ="F" W "$DEDUC" W:DGBTSL="PAT" ?55 W:DGBTSL'="PAT" ?60 W "$PAYABLE" W:DGBTZ="F" ?70,$S(DGBTSL="CAR":"ACCOUNT",1:"CARRIER") W !,DGBTCL,! Q
W ?37,"$DEDUC",?49,"$PAYABLE",?65,"$TOTAL" W:DGBTSL'="PAT" ?75,"# PAT" W !,DGBTCL Q
RT Q:$Y=0 Q:IOST'?1"C-".E F X=$Y:1:(IOSL-2) W !
S DIR("A",1)="",DIR("A")="Enter <RET> to continue or ^ to QUIT ",DIR(0)="FO" D ^DIR K DIR S:$D(DUOUT)!($D(DTOUT)) DGBTU=1 Q:DGBTU W:DGBTZ="T" @IOF Q
RP I $Y+6>IOSL D RT:(IOST?1"C-".E) Q:DGBTU D HE D:DGBTX=DGBTG HDR S DGBTF=1
Q
HDR I DGBTZ="F" S DGBTXX=$S(DGBTSL="ACCT":DGBTX_":",DGBTSL="PAT":$P(DGBTNO,"^",1)_":"_SSN,1:$P(DGBTNO,"^",5)_":"_$P(DGBTNO,"^",3)),DGBTG=DGBTX W !,DGBTXX S DGBTF=1
Q
;prints total for divisions
SM I DGBTZ="T" Q:'DGBT3
I DGBTZ="F" Q:'DGBTF
S:DGBTX="" DGBTD1=1 D RP Q:DGBTU S DGBTD1=0 W !! W:DGBTZ="T" ?3 W:DGBTZ="F" ?10 W "DIVISION TOTAL" S X=DGBTSDT,X2="2$" D CM W:DGBTZ="T" ?32,X I DGBTZ="F" W:DGBTSL="PAT" ?38 W:DGBTSL'="PAT" ?45 W X
S X=DGBTAT,X2="2$" D CM W:DGBTZ="T" ?46,X I DGBTZ="F" W:DGBTSL="PAT" ?52 W:DGBTSL'="PAT" ?57 W X
I DGBTZ="T" S X=DGBTGT,X2="2$" D CM W ?60,X I DGBTSL'="PAT" W ?76,$J(DGBTPTC(DGBTODV),4)
S (DGBTAT,DGBTSDT,DGBTGT,DGBTPTC)=0 Q
;Prints total page plus grand total.
TOTAL S DGBTZ="T",DGBT4=1,DGBTPG=0 D HE S (DGBTDV,DGBTC)=0 F X=0:0 S DGBTDV=$O(DGBTGT(DGBTDV)) Q:DGBTDV="" D:DGBT3 RP Q:DGBTU D CON
D RP Q:DGBTU W !!?12,"GRAND TOTAL",?32 S X2="2$",X=DGBTSDT D CM W X S X2="2$",X=DGBTAT D CM W ?46,X S X2="2$",X=DGBTGT D CM W ?60,X I DGBTSL'="PAT" W ?74,$J(DGBTPTC,6)
Q
CON S:DGBTSL'="PAT" DGBTPTC=DGBTPTC+DGBTPTC(DGBTDV) W !,$S(DGBTDV="ZNOT SPECIFIED":"NOT SPECIFIED",1:$E(DGBTDV,1,30)),?32 S X2="2$",X=$P(DGBTGT(DGBTDV),"^",2),DGBTSDT=DGBTSDT+X D CM W X
S X2="2$",X=$P(DGBTGT(DGBTDV),"^",1),DGBTAT=DGBTAT+X D CM W ?46,X S X2="2$",X=$P(DGBTGT(DGBTDV),"^",1)+$P(DGBTGT(DGBTDV),"^",2),DGBTGT=DGBTGT+X D CM W ?60,X I DGBTSL'="PAT" W ?74,$J(DGBTPTC(DGBTDV),6)
S DGBT3=1 D:$O(DGBTGT(DGBTDV))'="" RP
Q
CM N X3 D COMMA^%DTC Q