1 | SDQUT ;ALB/MJK - Query Object Utility Methods ;8/12/96
|
---|
2 | ;;5.3;Scheduling;**131**;Aug 13, 1993
|
---|
3 | ;
|
---|
4 | REG(SDQ,SDGREF) ; -- regular xref validator
|
---|
5 | N SDSUB
|
---|
6 | S SDSUB=$G(^TMP("SDQUERY CLASS",$J,SDQ,"GL SUBSCRIPTS"))+1
|
---|
7 | IF $QS(SDGREF,SDSUB)'=$G(@SDQUERY@(SDQ,"INDEX INTERNAL")) S SDGREF="" G REGQ
|
---|
8 | IF $QS(SDGREF,SDSUB+1)'=$G(@SDQUERY@(SDQ,"MASTER VALUE")) S SDGREF="" G REGQ
|
---|
9 | REGQ Q
|
---|
10 | ;
|
---|
11 | ;
|
---|
12 | REGDT(SDQ,SDGREF) ;-- regular date/time xref validator
|
---|
13 | N SDSUB,SDT,SDBEG,SDEND
|
---|
14 | S SDSUB=$G(^TMP("SDQUERY CLASS",$J,SDQ,"GL SUBSCRIPTS"))+1
|
---|
15 | S SDBEG=$G(@SDQUERY@(SDQ,"BEGIN DATE"))
|
---|
16 | S SDEND=$G(@SDQUERY@(SDQ,"END DATE"))
|
---|
17 | ;
|
---|
18 | IF $QS(SDGREF,SDSUB)'=$G(@SDQUERY@(SDQ,"INDEX INTERNAL")) S SDGREF="" G REGDTQ
|
---|
19 | S SDT=$QS(SDGREF,SDSUB+1)
|
---|
20 | IF SDT>SDEND!(SDT<SDBEG) S SDGREF="" G REGDTQ
|
---|
21 | REGDTQ Q
|
---|
22 | ;
|
---|
23 | ;
|
---|
24 | COM(SDQ,SDGREF) ; -- composite xref validator
|
---|
25 | COMQ Q
|
---|
26 | ;
|
---|
27 | ;
|
---|
28 | COMDT(SDQ,SDGREF) ;-- composite xref with date/time validator
|
---|
29 | N SDSUB,SDT,SDBEG,SDEND
|
---|
30 | S SDSUB=$G(^TMP("SDQUERY CLASS",$J,SDQ,"GL SUBSCRIPTS"))+1
|
---|
31 | S SDBEG=$G(@SDQUERY@(SDQ,"BEGIN DATE"))
|
---|
32 | S SDEND=$G(@SDQUERY@(SDQ,"END DATE"))
|
---|
33 | IF $QS(SDGREF,SDSUB)'=$G(@SDQUERY@(SDQ,"INDEX INTERNAL")) S SDGREF="" G COMDTQ
|
---|
34 | IF $QS(SDGREF,SDSUB+1)'=$G(@SDQUERY@(SDQ,"MASTER VALUE")) S SDGREF="" G COMDTQ
|
---|
35 | S SDT=$QS(SDGREF,SDSUB+2)
|
---|
36 | IF SDT>SDEND!(SDT<SDBEG) S SDGREF="" G COMDTQ
|
---|
37 | COMDTQ Q
|
---|
38 | ;
|
---|
39 | ;
|
---|
40 | REFRESH(SDQ,SDERR) ; -- refresh query
|
---|
41 | ; API ID: 94
|
---|
42 | ; API NAME: SDQ REFRESH
|
---|
43 | ;
|
---|
44 | REFRESHG ; -- goto entry point
|
---|
45 | ; -- do validation checks
|
---|
46 | IF '$$QRY^SDQVAL(.SDQ,$G(SDERR)) G REFRESHQ
|
---|
47 | IF '$$QRYACT^SDQVAL(.SDQ,$G(SDERR)) G REFRESHQ
|
---|
48 | ;
|
---|
49 | D ACTIVE^SDQPROP(.SDQ,"FALSE","SET",$G(SDERR))
|
---|
50 | D ACTIVE^SDQPROP(.SDQ,"TRUE","SET",$G(SDERR))
|
---|
51 | REFRESHQ Q
|
---|
52 | ;
|
---|
53 | ;
|
---|
54 | GETENTRY(SDQ,SDERR) ; -- get ID/IEN number for cursor entry
|
---|
55 | ; API ID: 95
|
---|
56 | ; API NAME: SDQ GET CURRENT ENCOUNTER ID
|
---|
57 | ;
|
---|
58 | ; -- do validation checks
|
---|
59 | IF '$$QRY^SDQVAL(.SDQ,$G(SDERR)) Q ""
|
---|
60 | IF '$$QRYACT^SDQVAL(.SDQ,$G(SDERR)) Q ""
|
---|
61 | ;
|
---|
62 | N SDID,SDGREF,SDSUB
|
---|
63 | S SDGREF=$G(^TMP("SDQUERY LIST",$J,SDQ,+$G(@SDQUERY@(SDQ,"CURSOR"))))
|
---|
64 | S SDSUB=+$G(@SDQUERY@(SDQ,"IEN SUBSCRIPT"))
|
---|
65 | S SDID=$QS(SDGREF,SDSUB)
|
---|
66 | Q SDID
|
---|
67 | ;
|
---|
68 | ;
|
---|
69 | POST ; -- post error action logic
|
---|
70 | ;W !,"Error: ",!
|
---|
71 | ;ZW DIPI ZW DIPE
|
---|
72 | Q
|
---|
73 | ;
|
---|
74 | ;
|
---|
75 | PREP ; -- Prepare environment / clean up generic error arrays
|
---|
76 | D CLEAN^DILF
|
---|
77 | Q
|
---|
78 | ;
|
---|
79 | ;
|
---|
80 | ERRCHK(SDQERRS) ; -- is an error present in error array?
|
---|
81 | IF $G(SDQERRS)]"" Q $O(@SDQERRS@("DIERR",0))>0
|
---|
82 | Q $O(^TMP("DIERR",$J,0))>0
|
---|
83 | ;
|
---|