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

SDESOPENVETREQS.m

Go to the documentation of this file.
SDESOPENVETREQS ;ALB/JAS,ANU - REPORT OF ALL OPEN VETERAN REQUESTS ; JUL 15, 2023
 ;;5.3;SCHEDULING;**843,851**;AUG 13, 1993;Build 10
 ;;Per VHA Directive 6402, this routine should not be modified
 ;
 Q
 ;
REQSBYVETS ;
 N POP,REQIENS,REQUESTIEN,SRTOPT
 K ^TMP("SDESOPENVETREQS",$J),REQIENS
 ;
 S REQUESTIEN=0
 F  S REQUESTIEN=$O(^SDEC(409.85,"TYPE","VETERAN",REQUESTIEN)) Q:'REQUESTIEN  D
 . I $$GET1^DIQ(409.85,REQUESTIEN,23,"I")="C" Q
 . S REQIENS(REQUESTIEN)=""
 ;
 ; Sort records per user selection
 ;
 S SRTOPT=$$SRTOPT()
 D SRTRECS(.REQIENS,SRTOPT)
 ;
 ; Open report device and print report details
 ;
 D DEVOPEN,HEADER,DETAIL
 ;
 ; Close device and Clean locals vars before exit
 ;
 D DEVCLOSE,EXIT
 ;
 Q
 ;
SRTOPT() ;
 ; 1 - Date Entered (Default)
 ; 2 - Patient Name
 ;
 N DTOUT,DUOUT,Y
 W !!!,?21,"ALL OPEN VETERAN REQUESTS REPORT OPTIONS",!!
 K DIR
 S DIR(0)="SO^1:Date Entered;2:Patient Name"
 S DIR("A")="Sort option"
 S DIR("?")="Enter a number: 1 or 2"
 D ^DIR
 I $D(DTOUT)!$D(DUOUT) Q 1
 Q $S(Y>0:Y,1:1)
 ;
SRTRECS(REQIENS,SRTOPT) ;
 N COMMLN,DFN,ENTERDT,INSTIT,LAST4,PNAME,SDREQDATA,SRTVAL1,SRTVAL2,SRVSPC,VA
 S REQUESTIEN=0
 F  S REQUESTIEN=$O(REQIENS(REQUESTIEN)) Q:REQUESTIEN=""  D
 . D GETS^DIQ(409.85,REQUESTIEN_",","**","IE","SDREQDATA","SDERR")
 . ;
 . ; Detail Line 1
 . ;
 . S PNAME=$G(SDREQDATA(409.85,REQUESTIEN_",",.01,"E"))
 . S DFN=$G(SDREQDATA(409.85,REQUESTIEN_",",.01,"I")) D DEM^VADPT
 . S ENTERDT=$G(SDREQDATA(409.85,REQUESTIEN_",",9.5,"I"))
 . I SRTOPT=1 S SRTVAL1=ENTERDT,SRTVAL2=PNAME
 . I SRTOPT'=1 S SRTVAL1=PNAME,SRTVAL2=ENTERDT
 . S ^TMP("SDESOPENVETREQS",$J,SRTVAL1,SRTVAL2,REQUESTIEN,1)=PNAME_"^"_VA("BID")
 . ;
 . ; Detail Line 2
 . ;
 . S INSTIT=$G(SDREQDATA(409.85,REQUESTIEN_",",2,"E"))
 . S SRVSPC=$G(SDREQDATA(409.85,REQUESTIEN_",",8.5,"E"))
 . S ^TMP("SDESOPENVETREQS",$J,SRTVAL1,SRTVAL2,REQUESTIEN,2)=INSTIT_"^"_SRVSPC
 . ;
 . ; Detail Line 3
 . ;
 . N LSTCON,PIDDT,SUBREQ
 . S (LSTCON,PIDDT)=""
 . I $D(SDREQDATA(409.8544)) D
 . . S SUBREQ=$O(SDREQDATA(409.8544,""),-1),LSTCON=$G(SDREQDATA(409.8544,SUBREQ,3,"E"))
 . I $D(SDREQDATA(409.854)) D
 . . S SUBREQ=$O(SDREQDATA(409.854,""),-1),PIDDT=$G(SDREQDATA(409.854,SUBREQ,1,"E"))
 . S ^TMP("SDESOPENVETREQS",$J,SRTVAL1,SRTVAL2,REQUESTIEN,3)=$P($$FMTE^XLFDT(ENTERDT),"@")_"^"_$$FMDIFF^XLFDT(DT,$P(ENTERDT,"@"))_"^"_PIDDT_"^"_LSTCON
 . ;
 . ; Patient Comments
 . ;
 . ;
 . ; ANU
 . ;I $D(SDREQDATA(409.85,REQUESTIEN_",",60)) D
 . ;. S COMMLN=0
 . ;. F  S COMMLN=$O(SDREQDATA(409.85,REQUESTIEN_",",60,COMMLN)) Q:'COMMLN  D
 . ;. . S ^TMP("SDESOPENVETREQS",$J,SRTVAL1,SRTVAL2,REQUESTIEN,"COMM",COMMLN)=SDREQDATA(409.85,REQUESTIEN_",",60,COMMLN)
 . K SDERR,SDREQDATA
 Q
 ;
 ;
 W !,"PATIENT NAME^LAST FOUR OF SSN^INSTITUTION^SERVICE/SPECIALTY"
 W "^REQUEST ENTRY DATE^WAIT TIME^PID^LAST PATIENT CONTACT"
 Q
 ;
DETAIL ; Detail line for Open Vet Request
 N COMMLN,VRDATA1,VRDATA2,VRDATA3,VRSRT1,VRSRT2,VRIEN
 S VRSRT1=""
 F  S VRSRT1=$O(^TMP("SDESOPENVETREQS",$J,VRSRT1)) Q:VRSRT1=""  D
 . S VRSRT2=""
 . F  S VRSRT2=$O(^TMP("SDESOPENVETREQS",$J,VRSRT1,VRSRT2)) Q:VRSRT2=""  D
 . . S VRIEN=0
 . . F  S VRIEN=$O(^TMP("SDESOPENVETREQS",$J,VRSRT1,VRSRT2,VRIEN)) Q:'VRIEN  D
 . . . S VRDATA1=$G(^TMP("SDESOPENVETREQS",$J,VRSRT1,VRSRT2,VRIEN,1))
 . . . S VRDATA2=$G(^TMP("SDESOPENVETREQS",$J,VRSRT1,VRSRT2,VRIEN,2))
 . . . S VRDATA3=$G(^TMP("SDESOPENVETREQS",$J,VRSRT1,VRSRT2,VRIEN,3))
 . . . W !,VRDATA1_"^"_VRDATA2_"^"_VRDATA3_"^"
 . . . ;ANU
 . . . ;I $D(^TMP("SDESOPENVETREQS",$J,VRSRT1,VRSRT2,VRIEN,"COMM")) D
 . . . ;. S COMMLN=0
 . . . ;. F  S COMMLN=$O(^TMP("SDESOPENVETREQS",$J,VRSRT1,VRSRT2,VRIEN,"COMM",COMMLN)) Q:'COMMLN  D
 . . . ;. . W ^TMP("SDESOPENVETREQS",$J,VRSRT1,VRSRT2,VRIEN,"COMM",COMMLN)_" | "
 Q
 ;
DEVOPEN ;Prompt for device
 ;
 D ^%ZIS Q:POP
 U IO
 Q
 ;
DEVCLOSE ;Close device
 ;
 D ^%ZISC
 Q
 ;
EXIT ;Clean-up local vars and temp globals
 ;
 K ^TMP("SDESOPENVETREQS",$J),REQIENS,VA
 Q