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

ORWLRRG1.m

Go to the documentation of this file.
ORWLRRG1 ;SLC/STAFF- lab worksheet data processing ;07/28/09  11:35
 ;;3.0;ORDER ENTRY/RESULTS REPORTING;**280**;Dec 17, 1997;Build 85
 ;
NTESTS ; from ORWLRRG
 N BTEST,ETEST,INFO,NUM,REFCHECK,TEST,TESTCNT
 S TESTCNT=0
 S NUM=0
 F  S NUM=$O(^TMP("ORWORK",$J,"TEST",NUM)) Q:NUM<1  D
 . S INFO=^TMP("ORWORK",$J,"TEST",NUM)
 . S TEST=+$P(INFO,U,2),BTEST=(TEST-1)_U_"Z",ETEST=TEST_U_"Z"
 . S REFCHECK=BTEST
 . F  S REFCHECK=$O(^TMP("ORWORK",$J,"REFCHECK",REFCHECK)) Q:REFCHECK]ETEST  Q:REFCHECK=""  D
 .. I $P(REFCHECK,U)=TEST D
 ... S TESTCNT=TESTCNT+1
 ... S ^TMP("ORWORK",$J,"NTESTS",TESTCNT)=TESTCNT_U_$P(INFO,U,2,3)_U_REFCHECK
 ... S ^TMP("ORWORK",$J,"REFCHECK",REFCHECK)=TESTCNT
 S ^TMP("ORWORK",$J,"NTESTS",0)=TESTCNT
 Q
 ;
NRESULTS ; from ORWLRRG
 N ACNT,COL,COLNUM,CNT,FLAG,INFO,NUM,REFCHECK,RESULT,TESTNUM
 S ACNT=0,CNT=0
 S NUM=0
 F  S NUM=$O(^TMP("ORWORK",$J,"RESULTS",NUM)) Q:NUM<1  D
 . S INFO=^TMP("ORWORK",$J,"RESULTS",NUM)
 . S COL=+$P(INFO,U,3)
 . S REFCHECK=+$P(INFO,U,2)_U_+$P(INFO,U,7)_U
 . I $L($P(INFO,U,10,11)) S REFCHECK=REFCHECK_$P(INFO,U,10,11)
 . E  S REFCHECK=$G(^TMP("ORWORK",$J,"TESTSPEC",REFCHECK))
 . I '$L(REFCHECK) Q
 . S REFCHECK=$$UP^XLFSTR(REFCHECK)
 . S TESTNUM=$G(^TMP("ORWORK",$J,"REFCHECK",REFCHECK))
 . I 'TESTNUM Q
 . S COLNUM=$G(^TMP("ORWORK",$J,"COL",COL))
 . I 'COLNUM Q
 . S CNT=CNT+1
 . S RESULT=$P(INFO,U,5),FLAG=$P(INFO,U,6)
 . S ^TMP("ORWORK",$J,"NRESULTS",CNT)=COLNUM_U_TESTNUM_U_RESULT_U_FLAG
 . I $L(FLAG) D AB(.ACNT,REFCHECK,COL,RESULT,FLAG)
 S ^TMP("ORWORK",$J,"NRESULTS",0)=CNT
 D ARESULTS
 Q
 ;
AB(ACNT,REFCHECK,COL,RESULT,FLAG) ;
 S ACNT=ACNT+1
 S ^TMP("ORWORK",$J,"RESULTSA",ACNT)=REFCHECK_U_COL_U_RESULT_U_FLAG
 S ^TMP("ORWORK",$J,"REFCHECKA",REFCHECK)=""
 S ^TMP("ORWORK",$J,"COLA",COL)=""
 Q
 ;
ARESULTS ;
 N COL,COLNUM,CNT,FLAG,INFO,NUM,REFCHECK,RESULT,TESTNUM
 D ACOL
 D NACOL
 D ATESTS
 S CNT=0,NUM=0
 F  S NUM=$O(^TMP("ORWORK",$J,"RESULTSA",NUM)) Q:NUM<1  D
 . S INFO=^TMP("ORWORK",$J,"RESULTSA",NUM)
 . S COL=+$P(INFO,U,5)
 . S REFCHECK=$P(INFO,U,1,4)
 . S TESTNUM=$G(^TMP("ORWORK",$J,"REFCHECKA",REFCHECK))
 . I 'TESTNUM Q
 . S COLNUM=$G(^TMP("ORWORK",$J,"COLA",COL))
 . I 'COLNUM Q
 . S CNT=CNT+1
 . S RESULT=$P(INFO,U,6),FLAG=$P(INFO,U,7)
 . S ^TMP("ORWORK",$J,"NRESULTSA",CNT)=COLNUM_U_TESTNUM_U_RESULT_U_FLAG
 S ^TMP("ORWORK",$J,"NRESULTSA",0)=CNT
 Q
 ;
ACOL ;
 N COL,COLCNT
 S COLCNT=0
 S COL=""
 F  S COL=$O(^TMP("ORWORK",$J,"COLA",COL),-1) Q:COL=""  D
 . S COLCNT=COLCNT+1
 . S ^TMP("ORWORK",$J,"COLA",COL)=COLCNT
 S ^TMP("ORWORK",$J,"COLA",0)=COLCNT
 Q
NACOL ;
 N CNT,COL,COMMENT,INEXACT,INFO,NUM,SNUM,SPEC,SPECNAME
 S CNT=0
 S NUM=0
 F  S NUM=$O(^TMP("ORWORK",$J,"SPEC",NUM)) Q:NUM<1  D
 . S INFO=^TMP("ORWORK",$J,"SPEC",NUM)
 . S COL=$P(INFO,U,2)
 . S SNUM=$G(^TMP("ORWORK",$J,"COLA",COL)) I SNUM D
 .. S COMMENT=$P(INFO,U,1),INEXACT=$P(INFO,U,3),SPEC=$P(INFO,U,6)
 .. S SPECNAME=$G(^TMP("ORWORK",$J,"SPECNAME",SPEC))
 .. I INEXACT=1 S INEXACT=COL\1
 .. E  S INEXACT=COL
 .. S ^TMP("ORWORK",$J,"NCOLA",NUM)=SNUM_U_COL_U_SPEC_U_SPECNAME_U_COMMENT_U_INEXACT
 .. S CNT=CNT+1
 S ^TMP("ORWORK",$J,"NCOLA",0)=CNT
 Q
 ;
ATESTS ;
 N BTEST,ETEST,INFO,NUM,REFCHECK,TEST,TESTCNT
 S TESTCNT=0
 S NUM=0
 F  S NUM=$O(^TMP("ORWORK",$J,"TEST",NUM)) Q:NUM<1  D
 . S INFO=^TMP("ORWORK",$J,"TEST",NUM)
 . S TEST=+$P(INFO,U,2),BTEST=(TEST-1)_U_"Z",ETEST=TEST_U_"Z"
 . S REFCHECK=BTEST
 . F  S REFCHECK=$O(^TMP("ORWORK",$J,"REFCHECKA",REFCHECK)) Q:REFCHECK]ETEST  Q:REFCHECK=""  D
 .. I $P(REFCHECK,U)=TEST D
 ... S TESTCNT=TESTCNT+1
 ... S ^TMP("ORWORK",$J,"NTESTSA",TESTCNT)=TESTCNT_U_$P(INFO,U,2,3)_U_REFCHECK
 ... S ^TMP("ORWORK",$J,"REFCHECKA",REFCHECK)=TESTCNT
 S ^TMP("ORWORK",$J,"NTESTSA",0)=TESTCNT
 Q
 ;
SPECREF ; from ORWLRRG
 N CNT,HIGH,INFO,LOW,RANGE,REF,SNAME,SPEC,SUB,TEST,UNITS
 S CNT=0
 S REF=""
 F  S REF=$O(^TMP("ORWORK",$J,"REFCHECK",REF)) Q:REF=""  D
 . S SUB=+^TMP("ORWORK",$J,"REFCHECK",REF)
 . S TEST=+$P(REF,U),SPEC=+$P(REF,U,2),RANGE=$P(REF,U,3),UNITS=$P(REF,U,4)
 . S LOW=$P(RANGE,"!"),HIGH=$P(RANGE,"!",2)
 . S SNAME=$G(^TMP("ORWORK",$J,"SPECNAME",SPEC))
 . S CNT=CNT+1
 . S ^TMP("ORWORK",$J,"SPECREF",SUB)=TEST_U_SNAME_U_SPEC_U_LOW_U_HIGH_U_UNITS
 S ^TMP("ORWORK",$J,"SPECREF",0)=CNT
 Q
 ;
COMBINE ; from ORWLRRG
 N ACOLCNT,ARESCNT,ATESTCNT,CNT,COLCNT,INFO,RESCNT,SUB,TESTCNT,TOSPEC,TOCOM,TSCNT
 S COLCNT=+$G(^TMP("ORWORK",$J,"NCOL",0))
 S TESTCNT=+$G(^TMP("ORWORK",$J,"NTESTS",0))
 S RESCNT=+$G(^TMP("ORWORK",$J,"NRESULTS",0))
 S ACOLCNT=+$G(^TMP("ORWORK",$J,"NCOLA",0))
 S ATESTCNT=+$G(^TMP("ORWORK",$J,"NTESTSA",0))
 S ARESCNT=+$G(^TMP("ORWORK",$J,"NRESULTSA",0))
 S TSCNT=^TMP("ORWORK",$J,"SPECREF",0)
 S TOSPEC=COLCNT+TESTCNT+RESCNT+ACOLCNT+ATESTCNT+ARESCNT+2
 S TOCOM=TOSPEC+TSCNT
 S ^TMP("ORGRID",$J,1)=TESTCNT_U_COLCNT_U_RESCNT_U_TOSPEC_U_TOCOM
 S CNT=1
 S SUB=0
 F  S SUB=$O(^TMP("ORWORK",$J,"NTESTS",SUB)) Q:SUB<1  D
 . S INFO=^TMP("ORWORK",$J,"NTESTS",SUB)
 . S CNT=CNT+1
 . S ^TMP("ORGRID",$J,CNT)=INFO
 S SUB=0
 F  S SUB=$O(^TMP("ORWORK",$J,"NCOL",SUB)) Q:SUB<1  D
 . S INFO=^TMP("ORWORK",$J,"NCOL",SUB)
 . S CNT=CNT+1
 . S ^TMP("ORGRID",$J,CNT)=INFO
 S SUB=0
 F  S SUB=$O(^TMP("ORWORK",$J,"NRESULTS",SUB)) Q:SUB<1  D
 . S INFO=^TMP("ORWORK",$J,"NRESULTS",SUB)
 . S CNT=CNT+1
 . S ^TMP("ORGRID",$J,CNT)=INFO
 S CNT=CNT+1
 S ^TMP("ORGRID",$J,CNT)=ATESTCNT_U_ACOLCNT_U_ARESCNT
 S SUB=0
 F  S SUB=$O(^TMP("ORWORK",$J,"NTESTSA",SUB)) Q:SUB<1  D
 . S INFO=^TMP("ORWORK",$J,"NTESTSA",SUB)
 . S CNT=CNT+1
 . S ^TMP("ORGRID",$J,CNT)=INFO
 S SUB=0
 F  S SUB=$O(^TMP("ORWORK",$J,"NCOLA",SUB)) Q:SUB<1  D
 . S INFO=^TMP("ORWORK",$J,"NCOLA",SUB)
 . S CNT=CNT+1
 . S ^TMP("ORGRID",$J,CNT)=INFO
 S SUB=0
 F  S SUB=$O(^TMP("ORWORK",$J,"NRESULTSA",SUB)) Q:SUB<1  D
 . S INFO=^TMP("ORWORK",$J,"NRESULTSA",SUB)
 . S CNT=CNT+1
 . S ^TMP("ORGRID",$J,CNT)=INFO
 S SUB=0
 F  S SUB=$O(^TMP("ORWORK",$J,"SPECREF",SUB)) Q:SUB<1  D
 . S INFO=^TMP("ORWORK",$J,"SPECREF",SUB)
 . S CNT=CNT+1
 . S ^TMP("ORGRID",$J,CNT)=INFO
 S SUB=0
 F  S SUB=$O(^TMP("ORWORK",$J,"COMMENTS",SUB)) Q:SUB<1  D
 . S INFO=^TMP("ORWORK",$J,"COMMENTS",SUB)
 . S CNT=CNT+1
 . S ^TMP("ORGRID",$J,CNT)=INFO
 Q