source: FOIAVistA/trunk/r/OUTPATIENT_PHARMACY-PSO-APSP-HUIP/PSOCST9.m@ 1452

Last change on this file since 1452 was 628, checked in by George Lilly, 15 years ago

initial load of FOIAVistA 6/30/08 version

File size: 2.1 KB
Line 
1PSOCST9 ;BHAM ISC/SAB - DIVISION BY PROVIDER COST ; 08/19/92 11:20
2 ;;7.0;OUTPATIENT PHARMACY;**31**;DEC 1997
3 ;External Ref. to ^PS(59, is supp. by DBIA# 212
4BEG S RP=9 D HDC^PSOCSTX F D CDT^PSOCSTX Q:$G(CTR) D DVS^PSOCSTX Q:$G(CTR) S RP=0 D CTP^PSOCSTX Q:$G(CTR) I RP=0 D DEV Q
5 D EX Q
6DEV D DVC^PSOCSTX Q:$G(CTR)
7 K PSOION I $D(IO("Q")) S ZTDESC="DIVISION BY PROVIDER COSTS",ZTRTN="START^PSOCST9" D PAS^PSOCSTX
8 I K IO("Q") D ^%ZTLOAD W:$D(ZTSK) !,"REPORT QUEUED TO PRINT !!",! D EX Q
9START U IO K ^TMP($J) F PSDT=(BEGDATE-1):0:ENDDATE S PSDT=$O(^PSCST(PSDT)) Q:'PSDT!(PSDT>ENDDATE) D @$S('IFN:"DIV",1:"PHY")
10 S DIVX="" I $O(^TMP($J,DIVX))']"" D HD,HDN^PSOCSTX Q
11 F S DIVX=$O(^TMP($J,DIVX)) Q:DIVX="" S PHYX="" F S PHYX=$O(^TMP($J,DIVX,PHYX)) Q:PHYX="" D STR
12 D ZER^PSOCSTX S DIVX="" F S DIVX=$O(^TMP($J,DIVX)) Q:DIVX="" S PHYX="" D HD Q:$G(CTR) F S PHYX=$O(^TMP($J,DIVX,PHYX)) D:PHYX="" SUB Q:PHYX="" D PRT3
13 I 'CTR,'IFN D HD:($Y+2)>IOSL D TOT^PSOCSTX
14EX D EX^PSOCSTX Q
15PRT3 D:($Y+4)>IOSL HD Q:$G(CTR) S Y=^TMP($J,DIVX,PHYX),TTX=PHYX D PRT^PSOCSTX
16 Q
17DIV F DIV=0:0 S DIV=$O(^PSCST(PSDT,"V",DIV)) Q:'DIV D PHY
18 Q
19PHY F PHY=0:0 S PHY=$O(^PSCST(PSDT,"V",DIV,"P",PHY)) Q:'PHY I $D(^(PHY,0)) S X=^(0) D STORE
20 Q
21STORE S DIVX=$S($D(^PS(59,+DIV,0)):$P(^(0),"^"),1:"UNKNOWN")
22 S PHYX=$S($D(^VA(200,+PHY,0)):$P(^(0),"^"),1:"UNKNOWN")
23 S:'$D(^TMP($J,DIVX,PHYX)) ^TMP($J,DIVX,PHYX)="^0^0^0",^TMP($J,DIVX)="^0^0^0^0"
24 S UTL=^TMP($J,DIVX,PHYX),^TMP($J,DIVX,PHYX)="^"_($P(UTL,"^",2)+$P(X,"^",2))_"^"_($P(UTL,"^",3)+$P(X,"^",3))_"^"_($P(UTL,"^",4)+$P(X,"^",4))
25 Q
26STR S $P(^TMP($J,DIVX),"^",2)=($P(^TMP($J,DIVX),"^",2)+$P(^TMP($J,DIVX,PHYX),"^",2)),$P(^TMP($J,DIVX),"^",3)=($P(^TMP($J,DIVX),"^",3)+$P(^TMP($J,DIVX,PHYX),"^",3))
27 S $P(^TMP($J,DIVX),"^",4)=($P(^TMP($J,DIVX),"^",4)+$P(^TMP($J,DIVX,PHYX),"^",4)),$P(^TMP($J,DIVX),"^",5)=($P(^TMP($J,DIVX),"^",5)+$P(^TMP($J,DIVX,PHYX),"^",2)+$P(^TMP($J,DIVX,PHYX),"^",3))
28 Q
29HD D HD^PSOCSTX Q:$G(CTR)
30 W !,?5,"Division: ",DIVX
31 Q
32SUB ;sub-totals per division
33 D HD:($Y+2)>IOSL D FTU^PSOCSTX W !,"Total for "_DIVX D FTT^PSOCSTX,FTU^PSOCSTX,SUB^PSOCSTX
34 Q
Note: See TracBrowser for help on using the repository browser.