SDQUT ;ALB/MJK - Query Object Utility Methods ;8/12/96
;;5.3;Scheduling;**131,1015**;Aug 13, 1993;Build 21
;
REG(SDQ,SDGREF) ; -- regular xref validator
N SDSUB
S SDSUB=$G(^TMP("SDQUERY CLASS",$J,SDQ,"GL SUBSCRIPTS"))+1
IF $QS(SDGREF,SDSUB)'=$G(@SDQUERY@(SDQ,"INDEX INTERNAL")) S SDGREF="" G REGQ
IF $QS(SDGREF,SDSUB+1)'=$G(@SDQUERY@(SDQ,"MASTER VALUE")) S SDGREF="" G REGQ
REGQ Q
;
;
REGDT(SDQ,SDGREF) ;-- regular date/time xref validator
N SDSUB,SDT,SDBEG,SDEND
S SDSUB=$G(^TMP("SDQUERY CLASS",$J,SDQ,"GL SUBSCRIPTS"))+1
S SDBEG=$G(@SDQUERY@(SDQ,"BEGIN DATE"))
S SDEND=$G(@SDQUERY@(SDQ,"END DATE"))
;
IF $QS(SDGREF,SDSUB)'=$G(@SDQUERY@(SDQ,"INDEX INTERNAL")) S SDGREF="" G REGDTQ
S SDT=$QS(SDGREF,SDSUB+1)
IF SDT>SDEND!(SDT<SDBEG) S SDGREF="" G REGDTQ
REGDTQ Q
;
;
COM(SDQ,SDGREF) ; -- composite xref validator
COMQ Q
;
;
COMDT(SDQ,SDGREF) ;-- composite xref with date/time validator
N SDSUB,SDT,SDBEG,SDEND
S SDSUB=$G(^TMP("SDQUERY CLASS",$J,SDQ,"GL SUBSCRIPTS"))+1
S SDBEG=$G(@SDQUERY@(SDQ,"BEGIN DATE"))
S SDEND=$G(@SDQUERY@(SDQ,"END DATE"))
IF $QS(SDGREF,SDSUB)'=$G(@SDQUERY@(SDQ,"INDEX INTERNAL")) S SDGREF="" G COMDTQ
IF $QS(SDGREF,SDSUB+1)'=$G(@SDQUERY@(SDQ,"MASTER VALUE")) S SDGREF="" G COMDTQ
S SDT=$QS(SDGREF,SDSUB+2)
IF SDT>SDEND!(SDT<SDBEG) S SDGREF="" G COMDTQ
COMDTQ Q
;
;
REFRESH(SDQ,SDERR) ; -- refresh query
; API ID: 94
; API NAME: SDQ REFRESH
;
REFRESHG ; -- goto entry point
; -- do validation checks
IF '$$QRY^SDQVAL(.SDQ,$G(SDERR)) G REFRESHQ
IF '$$QRYACT^SDQVAL(.SDQ,$G(SDERR)) G REFRESHQ
;
D ACTIVE^SDQPROP(.SDQ,"FALSE","SET",$G(SDERR))
D ACTIVE^SDQPROP(.SDQ,"TRUE","SET",$G(SDERR))
REFRESHQ Q
;
;
GETENTRY(SDQ,SDERR) ; -- get ID/IEN number for cursor entry
; API ID: 95
; API NAME: SDQ GET CURRENT ENCOUNTER ID
;
; -- do validation checks
IF '$$QRY^SDQVAL(.SDQ,$G(SDERR)) Q ""
IF '$$QRYACT^SDQVAL(.SDQ,$G(SDERR)) Q ""
;
N SDID,SDGREF,SDSUB
S SDGREF=$G(^TMP("SDQUERY LIST",$J,SDQ,+$G(@SDQUERY@(SDQ,"CURSOR"))))
S SDSUB=+$G(@SDQUERY@(SDQ,"IEN SUBSCRIPT"))
S SDID=$QS(SDGREF,SDSUB)
Q SDID
;
;
POST ; -- post error action logic
;W !,"Error: ",!
;ZW DIPI ZW DIPE
Q
;
;
PREP ; -- Prepare environment / clean up generic error arrays
D CLEAN^DILF
Q
;
;
ERRCHK(SDQERRS) ; -- is an error present in error array?
IF $G(SDQERRS)]"" Q $O(@SDQERRS@("DIERR",0))>0
Q $O(^TMP("DIERR",$J,0))>0
;
SDQUT ;ALB/MJK - Query Object Utility Methods ;8/12/96
+1 ;;5.3;Scheduling;**131,1015**;Aug 13, 1993;Build 21
+2 ;
REG(SDQ,SDGREF) ; -- regular xref validator
+1 NEW SDSUB
+2 SET SDSUB=$GET(^TMP("SDQUERY CLASS",$JOB,SDQ,"GL SUBSCRIPTS"))+1
+3 IF $QSUBSCRIPT(SDGREF,SDSUB)'=$GET(@SDQUERY@(SDQ,"INDEX INTERNAL"))
SET SDGREF=""
GOTO REGQ
+4 IF $QSUBSCRIPT(SDGREF,SDSUB+1)'=$GET(@SDQUERY@(SDQ,"MASTER VALUE"))
SET SDGREF=""
GOTO REGQ
REGQ QUIT
+1 ;
+2 ;
REGDT(SDQ,SDGREF) ;-- regular date/time xref validator
+1 NEW SDSUB,SDT,SDBEG,SDEND
+2 SET SDSUB=$GET(^TMP("SDQUERY CLASS",$JOB,SDQ,"GL SUBSCRIPTS"))+1
+3 SET SDBEG=$GET(@SDQUERY@(SDQ,"BEGIN DATE"))
+4 SET SDEND=$GET(@SDQUERY@(SDQ,"END DATE"))
+5 ;
+6 IF $QSUBSCRIPT(SDGREF,SDSUB)'=$GET(@SDQUERY@(SDQ,"INDEX INTERNAL"))
SET SDGREF=""
GOTO REGDTQ
+7 SET SDT=$QSUBSCRIPT(SDGREF,SDSUB+1)
+8 IF SDT>SDEND!(SDT<SDBEG)
SET SDGREF=""
GOTO REGDTQ
REGDTQ QUIT
+1 ;
+2 ;
COM(SDQ,SDGREF) ; -- composite xref validator
COMQ QUIT
+1 ;
+2 ;
COMDT(SDQ,SDGREF) ;-- composite xref with date/time validator
+1 NEW SDSUB,SDT,SDBEG,SDEND
+2 SET SDSUB=$GET(^TMP("SDQUERY CLASS",$JOB,SDQ,"GL SUBSCRIPTS"))+1
+3 SET SDBEG=$GET(@SDQUERY@(SDQ,"BEGIN DATE"))
+4 SET SDEND=$GET(@SDQUERY@(SDQ,"END DATE"))
+5 IF $QSUBSCRIPT(SDGREF,SDSUB)'=$GET(@SDQUERY@(SDQ,"INDEX INTERNAL"))
SET SDGREF=""
GOTO COMDTQ
+6 IF $QSUBSCRIPT(SDGREF,SDSUB+1)'=$GET(@SDQUERY@(SDQ,"MASTER VALUE"))
SET SDGREF=""
GOTO COMDTQ
+7 SET SDT=$QSUBSCRIPT(SDGREF,SDSUB+2)
+8 IF SDT>SDEND!(SDT<SDBEG)
SET SDGREF=""
GOTO COMDTQ
COMDTQ QUIT
+1 ;
+2 ;
REFRESH(SDQ,SDERR) ; -- refresh query
+1 ; API ID: 94
+2 ; API NAME: SDQ REFRESH
+3 ;
REFRESHG ; -- goto entry point
+1 ; -- do validation checks
+2 IF '$$QRY^SDQVAL(.SDQ,$GET(SDERR))
GOTO REFRESHQ
+3 IF '$$QRYACT^SDQVAL(.SDQ,$GET(SDERR))
GOTO REFRESHQ
+4 ;
+5 DO ACTIVE^SDQPROP(.SDQ,"FALSE","SET",$GET(SDERR))
+6 DO ACTIVE^SDQPROP(.SDQ,"TRUE","SET",$GET(SDERR))
REFRESHQ QUIT
+1 ;
+2 ;
GETENTRY(SDQ,SDERR) ; -- get ID/IEN number for cursor entry
+1 ; API ID: 95
+2 ; API NAME: SDQ GET CURRENT ENCOUNTER ID
+3 ;
+4 ; -- do validation checks
+5 IF '$$QRY^SDQVAL(.SDQ,$GET(SDERR))
QUIT ""
+6 IF '$$QRYACT^SDQVAL(.SDQ,$GET(SDERR))
QUIT ""
+7 ;
+8 NEW SDID,SDGREF,SDSUB
+9 SET SDGREF=$GET(^TMP("SDQUERY LIST",$JOB,SDQ,+$GET(@SDQUERY@(SDQ,"CURSOR"))))
+10 SET SDSUB=+$GET(@SDQUERY@(SDQ,"IEN SUBSCRIPT"))
+11 SET SDID=$QSUBSCRIPT(SDGREF,SDSUB)
+12 QUIT SDID
+13 ;
+14 ;
POST ; -- post error action logic
+1 ;W !,"Error: ",!
+2 ;ZW DIPI ZW DIPE
+3 QUIT
+4 ;
+5 ;
PREP ; -- Prepare environment / clean up generic error arrays
+1 DO CLEAN^DILF
+2 QUIT
+3 ;
+4 ;
ERRCHK(SDQERRS) ; -- is an error present in error array?
+1 IF $GET(SDQERRS)]""
QUIT $ORDER(@SDQERRS@("DIERR",0))>0
+2 QUIT $ORDER(^TMP("DIERR",$JOB,0))>0
+3 ;