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

SDAMOW.m

Go to the documentation of this file.
  1. SDAMOW ;ALB/CAW - Waiting Time Report ; 12/1/91
  1. ;;5.3;Scheduling;**12**;Aug 13, 1993
  1. ;
  1. EN ; main entry point
  1. N DIC,SDBEG,SDEND,SDSEL,VAUTD,VAUTC,SDSORT,SDAMLIST
  1. EN1 I '$$INIT G ENQ
  1. I '$$RANGE G ENQ
  1. I '$$SELECT G ENQ
  1. I '$$SORT G ENQ
  1. EN2 I '$$DIV G ENQ
  1. I SDSORT=5 S (VAUTS,VAUTC)=1 G EN3
  1. I SDSORT=1!(SDSORT=2) G ENQ:'$$CLINIC
  1. I SDSORT=3!(SDSORT=4) G ENQ:'$$STOP
  1. EN3 I '$$ASK G EN1
  1. W !!,$$LINE("Device Selection")
  1. W !!,"This output requires 132 columns.",!!
  1. S %ZIS="PMQ" D ^%ZIS I POP G ENQ
  1. I '$D(IO("Q")) D START^SDAMOW1 G ENQ
  1. S Y=$$QUE
  1. ENQ D:'$D(ZTQUEUED) ^%ZISC
  1. K VAUTD,VAUTC,VAUTS Q
  1. ;
  1. INIT() ; -- init vars
  1. Q 1
  1. ;
  1. RANGE() ; select date range
  1. ; input: none
  1. ; output: SDBEG := begin date
  1. ; SDEND := end date
  1. ; return: was selection made [ 1|yes 0|no]
  1. ;
  1. W !!,$$LINE("Date Range Selection")
  1. Q $$RANGE^SDAMQ(.SDBEG,.SDEND)
  1. ;
  1. SELECT() ; -- get selection criteria
  1. ; input: none
  1. ; output: SDSEL := criteria selected
  1. ; return: was selection made [ 1|yes 0|no]
  1. ;
  1. W !!,$$LINE("Type of Report Criteria")
  1. S X="S^"
  1. S X=X_"1:Full Report;"
  1. S X=X_"2:Totals Only;"
  1. S DIR(0)=X,DIR("A")="Which Report",DIR("B")="Totals Only"
  1. D ^DIR K DIR S SDSEL=$S($D(DIRUT):0,1:+Y)
  1. Q SDSEL>0
  1. ;
  1. SORT() ; -- how to sort
  1. ; input: none
  1. ; output: SDSORT := sort selected
  1. ; return: was selection made [ 1|yes 0|no]
  1. ;
  1. W !!,$$LINE("Sort Selection")
  1. W !!,"Note: Top level sort will always be by Division."
  1. S X="S^"
  1. S X=X_"1:Clinic, then by Patient;"
  1. S X=X_"2:Clinic, then by Appointment Date/Time;"
  1. S X=X_"3:Stop Code, then by Clinic;"
  1. S X=X_"4:Stop Code, then by Patient;"
  1. S X=X_"5:Patient then by Appointment Date/Time;"
  1. S DIR(0)=X,DIR("A")="Within Division Sort By",DIR("B")="Clinic, then by Patient"
  1. D ^DIR K DIR S SDSORT=$S($D(DIRUT):0,1:+Y)
  1. Q SDSORT>0
  1. ;
  1. DIV() ; -- get division data
  1. ; input: none
  1. ; output: VAUTD := divs selected (VAUTD=1 for all)
  1. ; return: was selection made [ 1|yes 0|no]
  1. ;
  1. W:$P($G(^DG(43,1,"GL")),U,2) !!,$$LINE("Division Selection")
  1. D ASK2^SDDIV I Y<0 K VAUTD
  1. Q $D(VAUTD)>0
  1. ;
  1. CLINIC() ; -- get clinic data
  1. ; input: VAUTD := divisions selected
  1. ; output: VAUTC := clinic selected (VAUTC=1 for all)
  1. ; return: was selection made [ 1|yes 0|no]
  1. ;
  1. W !!,$$LINE("Clinic Selection")
  1. D CLINIC^SDAMO0
  1. I Y<0 K VAUTC
  1. CLINICQ Q $D(VAUTC)>0
  1. ;
  1. STOP() ; -- get stop code data
  1. ; output: VAUTS := stop codes selected (VAUTS=1 for all)
  1. ; return: was selection made [ 1|yes 0|no]
  1. ;
  1. W !!,$$LINE("Stop Codes Selection")
  1. S DIC="^DIC(40.7,",VAUTSTR="stop code",VAUTVB="VAUTS",VAUTNI=2
  1. D FIRST^VAUTOMA
  1. I Y<0 K VAUTS
  1. STOPQ Q $D(VAUTS)>0
  1. ;
  1. ;
  1. LINE(STR) ; -- print line
  1. ; input: STR := text to insert
  1. ; output: none
  1. ; return: text to use
  1. ;
  1. N X
  1. S:STR]"" STR=" "_STR_" "
  1. S $P(X,"_",(IOM/2)-($L(STR)/2))=""
  1. Q X_STR_X
  1. ;
  1. QUE() ; -- que job
  1. ; return: did job que [ 1|yes 0|no ]
  1. ;
  1. K ZTSK,IO("Q")
  1. S ZTDESC="Appointment Management Report",ZTRTN="START^SDAMOW1"
  1. F X="VAUTD(","VAUTC(","SDSORT","SDSEL","SDBEG","SDEND","VAUTD","VAUTC","VAUTS","VAUTS(" S ZTSAVE(X)=""
  1. D ^%ZTLOAD W:$D(ZTSK) " (Task: ",ZTSK,")"
  1. Q $D(ZTSK)
  1. ;
  1. ASK() ; -- ask if ok to use specs
  1. ; input: all selection variables
  1. ; output: none
  1. ; return: ok to continue [ 1|yes 0|no]
  1. ;
  1. I '$$DISP^SDAMOW1 S Y=0 G ASKQ
  1. S DIR(0)="Y",DIR("A")="Continue",DIR("B")="Yes" D ^DIR K DIR
  1. ASKQ Q $S($D(DIRUT):0,1:Y)