source: FOIAVistA/trunk/r/ORDER_ENTRY_RESULTS_REPORTING-OR-OCX--ORRC--ORRJ/ORQRY01.m@ 1446

Last change on this file since 1446 was 628, checked in by George Lilly, 15 years ago

initial load of FOIAVistA 6/30/08 version

File size: 2.5 KB
Line 
1ORQRY01 ;SLC/JDL - Order query utility ;11/20/06 09:01
2 ;;3.0;ORDER ENTRY/RESULTS REPORTING;**153,174,215,260**;Dec 17, 1997;Build 26
3 ;
4 ; DBIA 3869 GETPLIST^SDAMA202 ^TMP($J,"SDAMA202")
5 ;
6DOCDT(DOCS) ;Date range for TIU
7 N XDT,SDATE,EDATE
8 S XDT=$O(DOCS("Reference",""))
9 Q:'$L(XDT)
10 S SDATE=$P(XDT,":"),EDATE=$P(XDT,":",2)
11 S:SDATE=-1 SDATE=0
12 I EDATE=-1 S EDATE=9999999+EDATE
13 E S EDATE=EDATE+1
14 K DOCS("Reference",XDT)
15 S DOCS("Reference",SDATE_":"_EDATE)=""
16 Q
17CLINPTS(ORY,CLIN,ORBDATE,OREDATE) ; RETURN LIST OF PTS W/CLINIC APPT W/IN DT RNG
18 ;Copied from CLINPTS^ORQPTQ2 without maximum limitation
19 S ORY="^TMP(""ORCLINPT"",$J)"
20 K @ORY
21 I +$G(CLIN)<1 S @ORY@(1)="^No clinic identified" Q
22 I $$ACTLOC^ORWU(CLIN)'=1 S @ORY@(1)="^Clinic is inactive or Occasion Of Service" Q
23 N DFN,NAME,I,J,X,ORERR,ORJ,ORSRV,ORNOWDT,CHKX,CHKIN,ORC,CLNAM
24 S ORNOWDT=$$NOW^XLFDT
25 S ORSRV=$$GET1^DIQ(200,DUZ,29,"I") I +ORSRV>0 S ORSRV=$P(ORSRV,U)
26 S DFN=0,I=1
27 I ORBDATE="" S ORBDATE=$$UP^XLFSTR($$GET^XPAR("USR^SRV.`"_+$G(ORSRV)_"^DIV^SYS^PKG","ORLP DEFAULT CLINIC START DATE",1,"E"))
28 I OREDATE="" S OREDATE=$$UP^XLFSTR($$GET^XPAR("USR^SRV.`"_+$G(ORSRV)_"^DIV^SYS^PKG","ORLP DEFAULT CLINIC STOP DATE",1,"E"))
29 ;CONVERT ORBDATE AND OREDATE INTO FILEMAN DATE/TIME
30 D DT^DILF("T",ORBDATE,.ORBDATE,"","")
31 D DT^DILF("T",OREDATE,.OREDATE,"","")
32 I (ORBDATE=-1)!(OREDATE=-1) S @ORY@(1)="^Error in date range." Q
33 S OREDATE=$P(OREDATE,".")_.5 ;ADD 1/2 DAY TO END DATE
34 ; DBIA 3869
35 N ORI,ORCSTAT
36 K ^TMP($J,"SDAMA202","GETPLIST")
37 D GETPLIST^SDAMA202(+CLIN,"1;3;4","",ORBDATE,OREDATE) ;DBIA 3869
38 S ORERR=$$CLINERR
39 I $L(ORERR) S @ORY@(1)=U_ORERR Q
40 S ORI=0
41 F S ORI=$O(^TMP($J,"SDAMA202","GETPLIST",ORI)) Q:ORI<1 D ;DBIA 3869
42 . S ORCSTAT=+$G(^TMP($J,"SDAMA202","GETPLIST",ORI,3))
43 . I ORCSTAT'="NT" Q:ORCSTAT="C" Q:ORCSTAT="N"
44 . S ORJ=+$G(^TMP($J,"SDAMA202","GETPLIST",ORI,1))
45 . S DFN=+$G(^TMP($J,"SDAMA202","GETPLIST",ORI,4))
46 . I ORJ,DFN S @ORY@(I)=DFN_"^"_$P(^DPT(DFN,0),"^")_"^"_+CLIN_"^"_ORJ,I=I+1
47 K ^TMP($J,"SDAMA202","GETPLIST")
48 S:'$D(@ORY) @ORY@(1)="^No appointments."
49 Q
50 ;
51SDA(ERR,ERRMSG) ; common call to scheduling to return new variables for errors - out of scope
52 D SDA^VADPT
53 S ERR=VAERR
54 I ERR=1 S ERRMSG="^Error encountered^Error encountered" Q
55 I ERR=2 S ERRMSG="^Database is unavailable^Database is unavailable" Q
56 S ERRMSG=""
57 Q
58 ;
59CLINERR() ; $$ -> error msg or ""
60 N ERR,MSG
61 S MSG=""
62 S ERR=+$O(^TMP($J,"SDAMA202","GETPLIST","ERROR",""))
63 I ERR D
64 . S MSG="Server Error #"_ERR_": "
65 . S MSG=MSG_$G(^TMP($J,"SDAMA202","GETPLIST","ERROR",ERR))
66 . K ^TMP($J,"SDAMA202","GETPLIST")
67 Q MSG
Note: See TracBrowser for help on using the repository browser.