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

SCRPW17.m

Go to the documentation of this file.
  1. SCRPW17 ;RENO/KEITH/MRY - Prompts for clinic related outputs ; 21 JUL 2000 1:45 PM
  1. ;;5.3;Scheduling;**139,144,155,222,1015**;AUG 13, 1993;Build 21
  1. ;IHS/ANMC/LJF 8/24/2001 return division using IHS call
  1. ;
  1. ASK(SDADD,SDRES,SD,SDFMT,SDORD,SDSDT) ;Ask for clinic report parameters
  1. ;Required input: SDADD='1' to prompt user for "addons", "0" to not ask
  1. ;Required input: SDRES='1' to prompt user for clinic to restart run from, '0' to not ask
  1. ;Required input: SD=array name to return clinic selection parameters
  1. ;Optional input: SDFMT=default format^suppress prompt (1=yes, 0=no)
  1. ;Optional input: SDORD=default print order (A:alphabetic, D:date/time, T:terminal digit)^suppress prompt (1=yes, 0=no)
  1. ;Optional input: SDSDT='1' to suppress date prompt
  1. ;Output: SD("ADDON")=add-ons date, if selected
  1. ; SD("RESTART")="clinic IFN^clinic name" to restart run from, if selected
  1. ; SD("DATE")=appointment date to print
  1. ; SD("CLINIC",clinicname)=clinic IFN
  1. ; SD("FORMAT")=report format (AC:all clinics, SC:selected clinics, RC:range of clinics, SS:selected stop codes, RS:range of stop codes, AG:all clinic groups, SG:selected clinic group)
  1. ; SD("GROUP")="clinic group IFN^clinic group name"
  1. ; SD("ORDER")=output order (A:alphabetic, D:date/time, T:terminal digit)
  1. ; SD("STOPCODE",stopcodenumber)=stop code name
  1. ;Output: '0' if abnormal exit occured, '1' otherwise
  1. ;
  1. N %DT,SDCL1,SDCL2,SDDICA,SDI,SDOUT,SDSC1,SDSC2,DIC,DIR,DTOUT,DUOUT,X,Y
  1. DT I $G(SDSDT) S SD("DATE")="" G ADD
  1. S %DT="AEFX",%DT("A")="Select Appointment Date to Print: " W ! D ^%DT Q:(Y'>0!$D(DTOUT)) 0 S SD("DATE")=$P(Y,".")
  1. ADD I SDADD K SD("ADDON"),DIR S DIR(0)="S^A:ALL;O:ONLY ADD-ONS",DIR("A")="Include (A)LL or (O)NLY ADD-ONS",DIR("B")="ALL" D ^DIR Q:($D(DTOUT)!$D(DUOUT)) 0 I Y="O" D ADDON Q:'$D(SD("ADDON")) 0
  1. I SDRES K SD("RESTART"),DIR S DIR(0)="Y",DIR("A")="Would you like to re-start output from specific clinic",DIR("B")="NO" W ! D ^DIR Q:($D(DTOUT)!$D(DUOUT)) 0 I Y D CLIN Q:'$D(SD("RESTART")) 0
  1. I $L($G(SDFMT)),$P(SDFMT,U,2)=1 S SD("FORMAT")=$P(SDFMT,U) G ORD
  1. K DIR I $L($G(SDFMT)) S DIR("B")=$S(SDFMT="AC":"ALL CLINICS",SDFMT="SC":"SELECTED CLINICS",SDFMT="RC":"RANGE OF CLINICS",SDFMT="AG":"ALL CLINIC GROUPS",SDFMT="SG":"SELECTED CLINIC GROUP",1:"")
  1. I $L($G(SDFMT)) S DIR("B")=$S(SDFMT="SS":"SELECTED STOP CODES",SDFMT="RS":"RANGE OF STOP CODES",1:DIR("B")) K:'$L(DIR("B")) DIR("B")
  1. S DIR(0)="S^AC:ALL CLINICS;SC:SELECTED CLINICS;RC:RANGE OF CLINICS;SS:SELECTED STOP CODES;RS:RANGE OF STOP CODES;AG:ALL CLINIC GROUPS;SG:SELECTED CLINIC GROUP",DIR("A")="Select report format"
  1. D ^DIR Q:$D(DTOUT)!$D(DUOUT) 0 S SD("FORMAT")=Y
  1. K SD("CLINIC") I "SC^RC"[SD("FORMAT") D @SD("FORMAT") Q:'$D(SD("CLINIC")) 0
  1. I "SS^RS"[SD("FORMAT") K SD("STOPCODE") D @SD("FORMAT") Q:'$D(SD("STOPCODE")) 0
  1. I SD("FORMAT")="SG" K SD("GROUP") D SG Q:'$D(SD("GROUP")) 0
  1. ORD I $P($G(SDORD),U,2)=1,$L($P(SDORD,U)),"ADT"[$P(SDORD,U) S SD("ORDER")=$P(SDORD,U) G END
  1. K DIR S DIR(0)="S^A:ALPHABETIC;D:DATE/TIME;T:TERMINAL DIGIT",DIR("A")="Within clinic, print patients in what order"
  1. I $L($P($G(SDORD),U)) S SDORD=$P(SDORD,U),SDORD=$S(SDORD="A":"ALPHABETIC",SDORD="D":"DATE/TIME",SDORD="T":"TERMINAL DIGIT",1:"")
  1. S:$L($G(SDORD)) DIR("B")=SDORD D ^DIR Q:$D(DTOUT)!$D(DUOUT) 0 S SD("ORDER")=Y
  1. END Q 1
  1. ;
  1. CLIN S DIC="^SC(",DIC(0)="AEMQZ",DIC("A")="Select CLINIC: " W ! D ^DIC Q:($D(DTOUT)!$D(DUOUT)) I $P(Y(0),U,3)'="C" W !!,$C(7),"Location selected must be a clinic!",! G CLIN
  1. S:+Y>0 SD("RESTART")=Y Q
  1. ;
  1. ADDON K DIR S DIR(0)="D^::AEPX",%DT("A")="Produce output for patients scheduled since what date?",DIR("?",1)="Enter the date of your initial run of this appointment date, that way only"
  1. S DIR("?")="appointments scheduled since that date will be included in this run." D ^DIR Q:$D(DTOUT)!$D(DUOUT) S:Y>0 SD("ADDON")=Y Q
  1. ;
  1. SC ;Clinic selector
  1. S SDOUT=0 F SDI=1:1:30 S SDCL1=$$SC1("Select CLINIC: ") Q:SDOUT
  1. Q
  1. ;
  1. RC ;Clinic range selector
  1. S SDCL1=$$SC1("Select beginning CLINIC: ") Q:'$L(SDCL1)
  1. RCE S SDCL2=$$SC1("Select ending CLINIC: ") I '$L(SDCL2) W !,"Ending clinic must be specified!" K SD("CLINIC") Q
  1. I SDCL2']SDCL1 K SD("CLINIC",SDCL2) W !!,$C(7),"Ending clinic must collate after beginning clinic!" G RCE
  1. Q
  1. ;
  1. SS ;Stop Code selector
  1. S SDOUT=0 F SDI=1:1:30 S SDSC1=$$SS1("Select STOP CODE: ") Q:SDOUT
  1. Q
  1. ;
  1. RS ;Stop Code range selector
  1. S SDSC1=$$SS1("Select beginning STOP CODE: ") Q:'$L(SDSC1)
  1. RSE S SDSC2=$$SS1("Select ending STOP CODE: ") I '$L(SDSC2) W !,"Ending Stop Code must be specified!" K SD("STOPCODE") Q
  1. I SDSC2']SDSC1 K SD("STOPCODE",SDSC2) W !!,$C(7),"Ending Stop Code must collate after beginning Stop Code!" G RSE
  1. Q
  1. ;
  1. SS1(SDDICA) ;Select a Stop Code
  1. SS2 K DIC S DIC("A")=SDDICA,DIC="^DIC(40.7,",DIC(0)="AEMQZ" D ^DIC I $D(DTOUT)!$D(DUOUT)!(X="") S SDOUT=1 Q ""
  1. I '$P(Y(0),U,2) W $C(7)," ???" G SS2
  1. I $P(Y(0),U,3),$P(Y(0),U,3)'>DT W !,"Only active Stop Codes can be selected!",! G SS2
  1. S SD("STOPCODE",$P(Y(0),U,2))=$P(Y,U,2) Q $P(Y(0),U,2)
  1. ;
  1. SG ;Select clinic group
  1. K DIC S DIC="^SD(409.67,",DIC(0)="AEMQ" D ^DIC Q:$D(DTOUT)!$D(DUOUT) S:+Y>0 SD("GROUP")=Y Q
  1. ;
  1. SC1(SDDICA) ;Select a clinic
  1. SC2 K DIC S DIC("A")=SDDICA,DIC="^SC(",DIC(0)="AEMQZ" D ^DIC I $D(DTOUT)!$D(DUOUT)!(X="") S SDOUT=1 Q ""
  1. I $P(Y(0),U,3)'="C" W !,"Location selected must be a clinic!",! G SC2
  1. S SD("CLINIC",$P(Y,U,2))=$P(Y,U) Q $P(Y,U,2)
  1. ;
  1. DIVA(SDDIV) ;Ask for division(s)
  1. ;Required input: SDDIV=array to return responses (pass by reference)
  1. ;Output: '1' if successful, '0' if not
  1. ;Output: SDDIV='0' if 'all', '1' if specific divisions^text: "all" or institution name^division ifn, for non-multidivisional
  1. ;Output: SDDIV(division ifn)=division name
  1. ;IHS/ANMC/LJF 8/24/2001 return division using IHS call
  1. NEW X S X=$$DIV^BSDU I 'X Q 0
  1. S SDDIV(X)=$$DIVNM^BSDU(X),SDDIV="1^"_SDDIV(X)_U_X Q 1
  1. ;IHS/ANMC/LJF 8/24/2001 end of new code
  1. ;
  1. N SDX,SDOUT S SDOUT=0 K SDDIV
  1. S SDX=$G(^DG(43,1,"GL")) I '$$PRIM^VASITE() W !!,$C(7),"No medical center defined in site parameters!" Q 0
  1. I '$P(SDX,U,2) S SDDIV="0^"_$P($G(^DG(40.8,$$PRIM^VASITE(),0)),U)_U_$$PRIM^VASITE() Q 1
  1. F SDX=1:1 D DIVA1 Q:SDOUT
  1. I $D(SDDIV)>1 S SDDIV="1^SELECTED DIVISIONS" Q 1
  1. Q $D(SDDIV)
  1. ;
  1. DIVA1 N DIC W ! S DIC="^DG(40.8,",DIC(0)="AEMQ",DIC("A")=$S(SDX=1:"For Medical Center Division: ALL// ",1:"Select another division: ")
  1. D ^DIC I $D(DTOUT)!$D(DUOUT) S SDOUT=1 Q
  1. I SDX=1,X="" S SDOUT=1,SDDIV="0^ALL DIVISIONS" Q
  1. I X="" S SDOUT=1 Q
  1. I Y>0 S SDDIV(+Y)=$P(Y,U,2)
  1. Q
  1. ;
  1. ERRSUB(SDX) ;Return substitute error message for ^SD(409.76) entry
  1. ;Required input: SDX=external message code from ^SD(409.76) file
  1. ;Output: Substitute error message if successful, null if not
  1. Q $P($T(@("Z"_SDX)),";",3)
  1. ;
  1. ;Substitute error messages for ^SD(409.76)
  1. Z0009 ;0009;No Procedures defined for encounter (PR1 segment)