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

SDAMA306.m

Go to the documentation of this file.
  1. SDAMA306 ;BPOIFO/ACS-Filter API Utilities ; 6/21/05 1:50pm
  1. ;;5.3;Scheduling;**301,347,508,1015**;13 Aug 1993;Build 21
  1. ;PER VHA DIRECTIVE 2004-038, DO NOT MODIFY THIS ROUTINE
  1. ;
  1. ;
  1. ;*****************************************************************
  1. ; CHANGE LOG
  1. ;
  1. ; DATE PATCH DESCRIPTION
  1. ;-------- ---------- -----------------------------------------
  1. ;12/04/03 SD*5.3*301 ROUTINE COMPLETED
  1. ;08/06/04 SD*5.3*347 ADDITION OF A NEW FILTER - DATE APPOINTMENT
  1. ; MADE (FIELD #16) AND 2 NEW FIELDS TO RETURN:
  1. ; 1) AUTO-REBOOKED APPT DATE/TIME (FIELD #24)
  1. ; 2) NO-SHOW/CANCEL APPT DATE/TIME (FIELD #25)
  1. ;02/22/07 SD*5.3*508 SEE SDAMA301 FOR CHANGE LIST
  1. ;*****************************************************************
  1. ;*****************************************************************
  1. ;
  1. ;INPUT
  1. ; SDARRAY Appointment Filter array (by reference)
  1. ;
  1. ;*****************************************************************
  1. INITAE(SDARRAY) ;Initialize Array Entries as needed
  1. ;Initialize Appointment "From" and "To" dates if null
  1. N SDI
  1. F SDI=1,16 D INITDTS(SDI)
  1. ;
  1. ;Initialize Fields Array if ALL Fields Requested
  1. D:($$UPCASE(SDARRAY("FLDS"))="ALL") INITFLDS(.SDARRAY)
  1. ;
  1. ;Remove leading and trailing semi-colons from filter lists if present
  1. N SDNODE
  1. F SDNODE=2,3,4,13,"FLDS" D
  1. . I $L($G(SDARRAY(SDNODE)))>0 D
  1. .. I $E(SDARRAY(SDNODE),$L(SDARRAY(SDNODE)))=";" D
  1. ... S SDARRAY(SDNODE)=$E(SDARRAY(SDNODE),1,($L(SDARRAY(SDNODE))-1))
  1. .. I $E(SDARRAY(SDNODE),1)=";" D
  1. ... S SDARRAY(SDNODE)=$E(SDARRAY(SDNODE),2,$L(SDARRAY(SDNODE)))
  1. ;
  1. ;If the patient list is in a global, add comma at end if needed
  1. S SDARRAY("PATGBL")=0
  1. I $G(SDARRAY(4))["(" D
  1. . ;flag as patient global input
  1. . S SDARRAY("PATGBL")=1
  1. . ;add comma to end of global root if needed
  1. . N SDLCHAR S SDLCHAR=$E(SDARRAY(4),$L(SDARRAY(4)))
  1. . I SDLCHAR="," Q
  1. . E I SDLCHAR'="(" S SDARRAY(4)=SDARRAY(4)_","
  1. ;
  1. ;If the clinic list is in a global, add comma at end if needed
  1. S SDARRAY("CLNGBL")=0
  1. I $G(SDARRAY(2))["(" D
  1. . ;flag as clinic global input
  1. . S SDARRAY("CLNGBL")=1
  1. . ;add comma to end of global root if needed
  1. . N SDLCHAR S SDLCHAR=$E(SDARRAY(2),$L(SDARRAY(2)))
  1. . I SDLCHAR="," Q
  1. . E I SDLCHAR'="(" S SDARRAY(2)=SDARRAY(2)_","
  1. ;Initialize Encounter Filter
  1. S SDARRAY("ENCTR")=$$UPCASE($G(SDARRAY(12)))
  1. Q
  1. ;
  1. ;***************************************************
  1. ;INPUT
  1. ; SDFLTR Filter to initialize
  1. ;***************************************************
  1. INITDTS(SDFLTR) ;initialize Appt Date/Time and Date Appt Made
  1. N SDFROM,SDTO,SDYR,SDDAY,SDMNTH,SDTIME,SDVAR
  1. ;initialize variables to passed in values
  1. S SDFROM=$P($G(SDARRAY(SDFLTR)),";",1)
  1. S SDTO=$P($G(SDARRAY(SDFLTR)),";",2)
  1. ;replace day and month to Jan 01 (0101) if 0s or "" are passed
  1. ;replace time with 2359 if time is greater than 2359
  1. F SDVAR="SDFROM","SDTO" D
  1. .I @SDVAR'="" D
  1. ..S SDYR=$E(@SDVAR,1,3),SDMNTH=$E(@SDVAR,4,5),SDDAY=$E(@SDVAR,6,7)
  1. ..S SDTIME=$P(@SDVAR,".",2) S:(SDTIME'="") SDTIME="."_SDTIME
  1. ..S:(+SDDAY'>0) SDDAY="01"
  1. ..S:(+SDMNTH'>0) SDMNTH="01"
  1. ..S:((+SDTIME'=0)&(+SDTIME>.2359)) SDTIME=.2359
  1. ..S @SDVAR=SDYR_SDMNTH_SDDAY
  1. ..S:(SDTIME'="") @SDVAR=@SDVAR_SDTIME
  1. ;initialize SDTO to default if null
  1. I $G(SDTO)="" D
  1. .S:SDFLTR=1 SDTO="9999999.9999"
  1. .S:SDFLTR=16 SDTO="9999999"
  1. ;if date passed in without time for Appt Date/Time filter add time
  1. I SDFLTR=1,SDTO'["." S SDTO=SDTO_".2359"
  1. ;create new variables to reference Date(/Time)s
  1. I SDFLTR=1 D
  1. .S SDARRAY("FR")=$G(SDFROM)
  1. .S SDARRAY("TO")=$G(SDTO)
  1. I SDFLTR=16 D
  1. .S SDARRAY("DAMFR")=$G(SDFROM)
  1. .S SDARRAY("DAMTO")=$G(SDTO)
  1. Q
  1. ;
  1. ;*****************************************************************
  1. ;INPUT
  1. ; SDARRAY Appointment Filter array (by reference)
  1. ;*****************************************************************
  1. INITFLDS(SDARRAY) ;initialize Fields Requested
  1. N SDFLD
  1. S SDARRAY("FLDS")="" ;Reset Field Array
  1. ;add all available fields to Field Request
  1. F SDFLD=1:1:26,28:1:SDARRAY("FC") S SDARRAY("FLDS")=SDARRAY("FLDS")_SDFLD_";"
  1. Q
  1. UPCASE(SDDATA) ;ensure RSA text is upper case
  1. Q $TR(SDDATA,"abcdefghijklmnopqrstuvwxyz","ABCDEFGHIJKLMNOPQRSTUVWXYZ")