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

SDAMOS1.m

Go to the documentation of this file.
  1. SDAMOS1 ;ALB/SCK - AM MGT REPORTS STATISTICS OUTPUT ; 5/14/93
  1. ;;5.3;Scheduling;;Aug 13, 1993
  1. ;
  1. BLD ; build report from data stored in TMP global
  1. N I,SDFIN,STATUS
  1. S (TC,TA,TI,SDCO,SDAR,SDIP,SDTOT,SDFIN,TCOCNT,TARCNT,TIPCNT)=0,PAGE=1
  1. S SDLST="",SDLST=$O(^TMP("SDAMS",$J,SDLST)),SDFIN=$$HDR(SDLST)
  1. S SDNXT="" F S SDNXT=$O(^TMP("SDAMS",$J,SDNXT)) Q:SDNXT="" D G:SDFIN BLDQ
  1. . I SDNXT'=SDLST S SDFIN=$$HDR(SDNXT) Q:SDFIN S SDLST=SDNXT,(TC,TI,TA)=0
  1. . S NXTSC="" F S NXTSC=$O(^TMP("SDAMS",$J,SDNXT,NXTSC)) Q:NXTSC="" D Q:SDFIN
  1. .. S STATUS=0 F S STATUS=$O(^TMP("SDAMS",$J,SDNXT,NXTSC,STATUS)) Q:'STATUS D Q:SDFIN
  1. ... S SDFIN=$$STCNT(STATUS,+^(STATUS)) ; ref to tmp(sdams,$j,div,stocode,status)
  1. .. S SDFIN=$$SUBTOT(NXTSC)
  1. . D TOTALS
  1. D TDIV
  1. BLDQ K SDCO,SDAR,SDIP,SDTOT,TCOCNT,TARCNT,TIPCNT,SDLST,LSTSC,SDNXT,NXTSC,ACTION,QFLAG,TC,TI,TA,TOT,PAGE,SDFIN,%
  1. Q
  1. ;
  1. STCNT(STAT,COUNT) ; increment action count for stopcode
  1. ; sdar = action req by stop code
  1. ; sdco = checked out by stop code
  1. ; sdip = in-pat by stop code
  1. ;
  1. N Y S Y=0
  1. S:STAT=14 SDAR=SDAR+COUNT
  1. S:STAT=2 SDCO=SDCO+COUNT
  1. S:STAT=8 SDIP=SDIP+COUNT
  1. Q (Y)
  1. ;
  1. SUBTOT(SDCODE) ; totals by stopcode
  1. ; tcocnt = checked out total by division (per page)
  1. ; tarcnt = action req tot by div/page
  1. ; tipcnt = In-pat tot by div/page
  1. ;
  1. N Y,SDFIN
  1. S Y=0
  1. I $Y+5>IOSL D G:SDFIN SUBTOTQ
  1. . D TOTALS
  1. . S SDFIN=$$HDR(SDNXT) Q:SDFIN
  1. I SDSEL=5 W !,SDCODE,?34,SDCO,?53,SDAR,?64,SDIP,?77,SDCO+SDAR+SDIP
  1. S TCOCNT=TCOCNT+SDCO,TARCNT=TARCNT+SDAR,TIPCNT=TIPCNT+SDIP
  1. S (SDCO,SDAR,SDIP)=0
  1. SUBTOTQ Q (Y)
  1. ;
  1. TOTALS ; total of actions by stopcode for division
  1. ; tc = check out total for division
  1. ; ta = action required tot for div.
  1. ; ti = in-pat tot for div.
  1. ;
  1. N SDIV
  1. I SDSEL=5 W !,SDTDASH,!,"TOTAL",?34,TCOCNT,?53,TARCNT,?64,TIPCNT,?77,TCOCNT+TARCNT+TIPCNT
  1. S TC=TC+TCOCNT,TA=TA+TARCNT,TI=TI+TIPCNT
  1. S TOT(SDNXT)=TC_U_TA_U_TI
  1. S (TCOCNT,TARCNT,TIPCNT)=0
  1. Q
  1. ;
  1. HDR(SDIV) ; page header
  1. N Y
  1. S Y=0
  1. G:SDSEL'=5 HDRQ
  1. D PAUSE
  1. W !!,"Statistics Report by Stop Code"
  1. W !,"Division: ",SDIV,?40,"Date Range ",$$FDATE^VALM1(SDBEG)_" to "_$$FDATE^VALM1(SDEND)
  1. D NOW^%DTC W ?95,"Run Date: ",$E($$FDTTM^VALM1(%),1,14),?125,"Page: ",PAGE S PAGE=PAGE+1
  1. W !," Stop Code",?25,"Checked-Out",?40,"Action Required",?58,"Inpatient",?75,"Total",!,SDASH
  1. HDRQ Q (Y)
  1. ;
  1. TDIV ; final totals by division for med center
  1. ; reuse tc for check out total by med ctr
  1. ; ta for action req tot
  1. ; ti for in-pat tot
  1. ; tcd = check out totals by div
  1. ; tad = action req totals by div
  1. ; tip = in-pat totals by div
  1. ;
  1. N SDIV,TC,TA,TI,TCD,TAD,TID
  1. S (TC,TA,TI,TCD,TAD,TID)=0
  1. D PAUSE
  1. W !!,"Statistics Report Totals by Division"
  1. W !,"MEDICAL CENTER",?40,"Date Range ",$$FDATE^VALM1(SDBEG)_" to "_$$FDATE^VALM1(SDEND)
  1. D NOW^%DTC W ?95,"Run Date: ",$E($$FDTTM^VALM1(%),1,14),?125,"Page: ",PAGE S PAGE=PAGE+1
  1. W !," Division",?25,"Checked-Out",?40,"Action Required",?58,"Inpatient",?75,"Total"
  1. S SDIV="" F S SDIV=$O(TOT(SDIV)) Q:SDIV="" D
  1. . W !,SDASH
  1. . S TCD=$P(TOT(SDIV),U),TAD=$P(TOT(SDIV),U,2),TID=$P(TOT(SDIV),U,3)
  1. . W !,SDIV,?34,TCD,?54,TAD,?65,TID,?75,TCD+TAD+TID
  1. . S TC=TC+TCD,TA=TA+TAD,TI=TI+TID
  1. W !,SDTDASH
  1. W !,"TOTAL",?34,TC,?54,TA,?65,TI,?75,TC+TA+TI
  1. K TCD,TAD,TID
  1. TDIVQ Q
  1. ;
  1. PAUSE ;
  1. I $E(IOST,1,2)="C-" D
  1. . S DIR(0)="FO",DIR("A")="Press RETURN to continue or '^' to exit"
  1. . D ^DIR K DIR I $D(DUOUT)!($D(DTOUT)) Q
  1. . W @IOF
  1. E W @IOF
  1. PAUSEQ Q
  1. ;
  1. NOREP ; report if no data in TMP global
  1. W !!,"Statistics Report by Stop Code"
  1. W !,"Date Range ",$$FDATE^VALM1(SDBEG)_" to "_$$FDATE^VALM1(SDEND)
  1. D NOW^%DTC W ?95,"Run Date: ",$E($$FDTTM^VALM1(%),1,14),?125,"Page: 1"
  1. W !,SDASH
  1. W !!?10,"No data found matching sort parameters"
  1. Q