Home   Package List   Routine Alphabetical List   Global Alphabetical List   FileMan Files List   FileMan Sub-Files List   Package Component Lists   Package-Namespace Mapping  
Routine: DGPTODB1

DGPTODB1.m

Go to the documentation of this file.
  1. DGPTODB1 ;ALB/AS - PTF DRG BREAKEVEN REPORTS (DRIVER ROUTINE) ; 26 JUN 87 10:00
  1. ;;5.3;Registration;**1015**;Aug 13, 1993;Build 21
  1. S $P(DGLN,"=",132)="",$P(DGLN2,"-",132)="",DGCPG(2)="For "_$S(DGD:"Discharge dates from ",1:"Active Admissions")
  1. I DGD S Y=(DGSD+.1) X ^DD("DD") S DGCPG(2)=DGCPG(2)_$P(Y,"@")_" to ",Y=$P(DGED,".") X ^DD("DD") S DGCPG(2)=DGCPG(2)_Y,DGCPG(3)=$S('DGB:"not ",1:"")_"including TRANSFER DRGs"
  1. I DGS'="S"&($D(^UTILITY($J,"DGPTFR","D"))) D IN S DGRNO=1,DGFLAG="Medical Center by DRG",DGCPG(1)="BREAKEVEN Report for "_DGFLAG,DGTCH="Breakeven by DRG^DRG^PAGE #" D C^DGUTL,HD,^DGPTODB2 G:DGS="D" Q
  1. G:'$D(^UTILITY($J,"DGPTFR","SB")) Q D IN S DGRNO=2 F %=1:1:7 S (DGMC(%),DGAMT(%))=0
  1. S DGSV="",DGCPG(1)="BREAKEVEN Report by SERVICE by SPECIALTY",DGTCH=DGCPG(1)_"^SPECIALTY^PAGE #" D C^DGUTL
  1. F D=0:0 D:DGSV]"" WS^DGPTODB2 S DGSV=$O(^UTILITY($J,"DGPTFR","SB",DGSV)) Q:DGSV']"" S ^UTILITY($J,"DGBE",DGSV)=^(DGSV),DGFLAG=^UTILITY($J,"DGBE",DGSV)_" Service by Specialty by DRG" D HD,SV^DGPTODB2
  1. K DGBNM F %=1:1:7 S DGTT(%)=DGMC(%)
  1. D WM^DGPTODB2 K D5,DGMC,DGBS
  1. D IN S DGRNO=3,DGSV="",DGCPG(1)="BREAKEVEN Report by SERVICE",DGTCH=DGCPG(1)_"^SERVICE^PAGE #" D C^DGUTL
  1. F I=0:0 D:DGSV]"" WS^DGPTODB2 S DGSV=$O(^UTILITY($J,"DGBE",DGSV)) Q:DGSV']"" S X=^(DGSV),DGFLAG=X_" Service" D HD S (DRG,^UTILITY($J,"DGTC",X,DGPAG))="" F J=0:0 S DRG=$O(^UTILITY($J,"DGBE",DGSV,DRG)) Q:DRG']"" S Z=^(DRG) D LN
  1. F %=1:1:7 S DGTT(%)=DGAMT(%)
  1. D WM^DGPTODB2 G Q
  1. LN D LN^DGPTODB2 S D3=0 F D=0:0 S D3=$O(^UTILITY($J,"DGBE",DGSV,DRG,D3)) Q:D3']"" S Z=^UTILITY($J,"DGBE",DGSV,DRG,D3) S:D3="AA" DGA="A",DGLA=$P(Z,"^"),DGDA=$P(Z,"^",2),DGHI=$P(Z,"^",3),DGTT(3)=DGTT(3)+DGDA,DGTT(4)=DGTT(4)+DGLA I D3="BA" D BA
  1. D WLN^DGPTODB2 Q
  1. BA S DGU="B",DGLU=$P(Z,"^"),DGDU=$P(Z,"^",2),DG1DAY=$P(Z,"^",4),DGLODAY=$P(Z,"^",5),DGTT(1)=DGTT(1)+DGDU,DGTT(2)=DGTT(2)+DGLU Q
  1. HD I DGPAG>0 S %=$S($D(IOSL):(IOSL-12),1:54) F I=$Y:1:% W !
  1. I DGPAG>0 D BE^DGPTOD1 W !!?64,"-",DGPAG,"-",!
  1. S DGPAG=DGPAG+1 W @IOF,!!,"BREAKEVEN Report for ",DGFLAG,?110,"PRINTED: " S Y=DT X ^DD("DD") W $P(Y,"@"),!,$P(DGCPG(2),U) I DGD W " ",$P(DGCPG(3),U)
  1. W !!?37,"|",?42,"BELOW BREAKEVEN",?60,"| ABOVE BREAKEVEN |",?92,"TOTAL",?107,"|",!?29,"Facility|----------------------|----------------------|-----------------------|",!,?16,"National",?31,"Break"
  1. W " | Total Total ALOS/ | Total Total ALOS/ | Total Total ALOS/ | ",?110,"Total",?120,"Estimated",!,"DRG Low High ALOS WWU Even | Disch LOS Disch | Disch LOS Disch | Disch LOS Disch |"
  1. W ?111,"WWU",?121,"Total $",!,DGLN Q
  1. IN F %=1:1:7 S DGTT(%)=0
  1. S DGPAG=0 K DGBNM,^UTILITY($J,"DGTC") Q
  1. Q W @IOF K DGTT,DGAMT,%,DGDA,DGA,DGLA,DGU,DGDU,DGLU,D,D3,DGHI,DG1DAY,DGFLAG,DGLN,DGLN2,DGPAG,DGRNO,DGSV,DGTCH,DRG,I,J,X,X2,Y,DGWU,DGTD,DGTL,DGTWW,DGLODAY,DGLOTRIM,^UTILITY($J,"DGBE"),DGCPG,DGLODC,Z Q