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

SDAMOC.m

Go to the documentation of this file.
SDAMOC ;IOFIO - BAY PINES/TEH - Statistical Report for Cancelled Appointments;4/15/92
 ;;5.3;Scheduling;**487**;Aug 13, 1993
 ;SCK - 5/18/93 MODS FOR APP CLININCS AND STOP CODES
STATS ;
 K ^TMP("SDAMC"),^TMP("SDAMCD")
 N POP,%,%ZIS,ZTSAVE
 S SDFIN=0,SDSORT=SDSEL
 S FMT=$$OPTION()
 I '$$DIV^SDAMO G STATSQ
 I SDSEL=6 S VAUTC=1 G STATS1
 I SDSEL=5 S OPT="GETCLN" D @OPT G:SDFIN STATSQ
STATS1 ;
 I '$$COMPL G ^SDAMOCC
 W !!,$$LINE^SDAMOCC("Device Selection")
 W !!,"This output requires 132 columns.",!!
 S %ZIS="PQM" D ^%ZIS G STATSQ:POP
 I $D(IO("Q")) D QUE G STATSQ
 W ! D WAIT^DICD
 D START^SDAMOC
STATSQ ;
 D:'$D(ZTQUEUED) ^%ZISC
 K SDAMDD,SDAPPT,SDASH,SDAT,SDATA,SDAT,SDCL,SDCLC,SDCLI,SDCLIN,SDCOL,SDDATE,SDDIV,SDDV,SDFLG,SDI,SDLEN,SDNXT,SDPAGE,SDPAT,SDSTAT,SDSTOP,SDTDASH
 K ^TMP("SDAMS",$J),SDSEL,FMT,SDFIN,SDRUN,SCTOT,BLD,VAUTC,VAUTD,SDBEG,SDEND,VAUTNI,VAUTSTR,VAUTVB,SDSORT,DIC,DTOUT,DUOUT,DIROUT
 K SDCI,SDDFN,SDASH,SDAT,SDBEG,SDCL,SDDV,SDDVNM,SDDVNM,SDEND,SDFLG,SDNXT
 K SDPAGE,SDSTOP,SDTAB,SDTDASH,SDTOTT,SDY,Y
 K OPT,SDFIN,SDDFN,SDNAME,X,Y
 Q
 ;
START ;
 U IO
 K ^TMP("SDAMC",$J)
 S SDLEN=25,SDPAGE=1,$P(SDASH,"-",IOM+1)="",$P(SDTDASH,"=",IOM+1)="",SDAMDD=$P(^DD(2.98,3,0),U,3)
 D EN
 I '$D(^TMP("SDAMC",$J)) D NOREP G STATSQ
 I FMT=1 D BLD^SDAMOCP
 I FMT'=1 D BLD^SDAMOCP1
 D STATSQ Q
 ;
EN ; build ^TMP global
 I FMT=1 D BLD1^SDAMOC
 I FMT'=1 D BLD1^SDAMOC
ENQ Q
 ;
BLD1 ;
 I VAUTD=1 S SDDIV=0 D CLINIC
 S SDDV=0 F  S SDDV=$O(VAUTD(SDDV)) Q:'SDDV  S SDDIV=SDDV D CLINIC
 Q
 ;
CLINIC ;all clinic or specific clinic
 ;
 ;all divisions and all clinics selected
 I VAUTD=1&(VAUTC=1) D
 .S SDCLIN=0 F  S SDCLIN=$O(^SC(SDCLIN)) Q:'SDCLIN  I $$CLINIC^SDAMU(SDCLIN) S SDCLC=$G(^SC(SDCLIN,0)) D PATIENT
 ;specific division and all clinics selected
 I SDDIV&(VAUTC=1) D
 .S SDCLIN=0 F  S SDCLIN=$O(^SC(SDCLIN)) Q:'SDCLIN  I $$CLINIC^SDAMU(SDCLIN) D
 ..S SDCLC=$G(^SC(SDCLIN,0)) I SDDIV=$$DIV^SDAMU(.SDCLIN,.VAUTD,.SDNAME,.SDLEN) D PATIENT
 ;all or specific division(s) and specific clinic(s) selected
 I VAUTC=0 D
 .S SDCLIN=0 F  S SDCLIN=$O(VAUTC(SDCLIN)) Q:'SDCLIN  S SDCLC=$G(^SC(+SDCLIN,0)) D:VAUTD!(SDDIV=$$DIV^SDAMU(.SDCLIN,.VAUTD,.SDNAME,.SDLEN)) PATIENT
 Q
 ;
PATIENT ;loop through appointments - find status of appt.
 ;
 S SDDATE=SDBEG-.1 N SDCTYP
 F SDDATE=SDDATE:0 S SDDATE=$O(^DPT("ASDCN",SDCLIN,SDDATE)) Q:'SDDATE!(SDDATE>(SDEND_".9"))  D
 .S SDDFN=0 F  S SDDFN=$O(^DPT("ASDCN",SDCLIN,SDDATE,SDDFN)) Q:SDDFN=""  D SET
 Q
 ;
SET ;Set in ^TMP("SDAMC",$J,Division,Clinic Name,Clinic)
 ;
 S SDDV=$$DIV^SDAMU(.SDCLIN,.VAUTD,.SDNAME,.SDLEN)
 S SDATA=$G(^DPT(SDDFN,"S",SDDATE,0)) I 'SDATA G SETQ
 S SDCTYP=$P(SDATA,U,2) I SDCTYP="" G SETQ
 I SDCTYP="N"!(SDCTYP="NT")!(SDCTYP="NA")!(SDCTYP="I") G SETQ
 S SDCTYP=$S(SDCTYP="C":1,SDCTYP="CA":2,SDCTYP="PC":3,SDCTYP="PCA":4,1:1)
 S ^TMP("SDAMC",$J,SDDV,SDCLIN,SDCTYP)=$G(^TMP("SDAMC",$J,SDDV,SDCLIN,SDCTYP))+1
 S ^TMP("SDAMCD",$J,SDDV,$P(SDATA,"^",2),SDCLIN,SDDATE,SDDFN)=SDATA_";"_SDDATE
SETQ Q
 ;
GETCLN S SDFIN='$$CLINIC^SDAMO Q
 ;
GETSC S SDFIN='$$STOP Q
 ;
NOREP ;report if no data in TMP global
 W !!,?29,"Cancelled Clinic Report"
 W !,?20,"Date Range ",$$FDATE^VALM1(SDBEG)_" to "_$$FDATE^VALM1(SDEND)
 D NOW^%DTC W !,?20,"Run Date: ",$E($$FDTTM^VALM1(%),1,14),?50,"Page: 1"
 W !,SDASH
 W !!?20,"No data found matching sort parameters"
 Q
 ;
OPTION(CHECK) ;
 S X="S^"
 S X=X_"1:Summary;"
 S X=X_"2:Detail"
 S DIR(0)=X,DIR("A")="Select Report Format",DIR("?")="Select format for printed report",DIR("B")="Summary"
 D ^DIR K DIR
 Q (+Y)
QUE ;
 S ZTRTN="START^SDAMOC",ZTDESC="Cancelled Clinic Report"
 F X="FMT","VAUTC(","VAUTD(","SDSORT","SDSEL","SDBEG","SDEND","VAUTD","VAUTC" S ZTSAVE(X)=""
 D ^%ZTLOAD W:$D(ZTSK) !,"Task #",ZTSK," Started."
 D HOME^%ZIS K IO("Q"),ZTSK,ZTDESC,ZTQUEUED,ZTRTN
 Q
STOP() ;
 W !!,$$LINE^SDAMO("Stop Code Selection")
 S DIC="^DIC(40.7,",VAUTSTR="Stop Code",VAUTVB="VAUTC",VAUTNI=2
 D FIRST^VAUTOMA
 I Y<0 K VAUTC
 Q $D(VAUTC)>0
 ;
COMPL() ;
 I '$$DISP^SDAMOC0 S Y=0 G COMPLQ
 S DIR(0)="Y",DIR("A")="Continue",DIR("?")="Enter 'Y'es or 'N'o.",DIR("B")="YES"
 D ^DIR K DIR I $D(DTOUT) S Y=0
COMPLQ Q (Y)