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

BLRTNA.m

Go to the documentation of this file.
BLRTNA ;IHS/ITSC/TPF - CREATE/EDIT TRANSACTIONS [ 12/19/2002  6:40 AM ]
 ;;5.2;IHS LABORATORY;**1028**;NOV 01, 1997;Build 46
 ;;5.2;LR;**1013,1015**;NOV 18, 2002
 ;
CPTCODE ;EP - CALLED FROM BLRTN,BLRTNB,BLRTNM1
 D:$G(SNAPSHOT) ENTRYAUD^BLRUTIL("ENTER CPTCODE^BLRTNA")
 S BLRFOUND=0,(BLRXII,BLRCPTS,BLRCPTP)="" F  S BLRXII=$O(^BLRCPT("C",BLRTEST1,BLRXII)) Q:(BLRXII="")  I '$P(^BLRCPT(BLRXII,1),U,2) D GETCPT Q:BLRFOUND
 D:$G(SNAPSHOT) ENTRYAUD^BLRUTIL("EXIT CPTCODE^BLRTNA")
 Q
 ;
GETCPT ;EP - CALLED FROM BLRTN
 D:$G(SNAPSHOT) ENTRYAUD^BLRUTIL("ENTER GETCPT^BLRTNA")
 Q:BLRODTM<$P($G(^BLRCPT(BLRXII,0)),U,3)
 S BLRFOUND=1,BLRCPTP=BLRXII
 ;---LR*5.2*1028;01/14/11;IHS/OIT/MPW- Corrected error in next line
 ;S BLRCPTN=0 F BLRNN=1:1 S BLRCPTN=$O(^BLRCPT(BLRXII,11,BLRCPTN)) Q:'BLRCPTN  S BLRCPDAT=$g(^BLRCPT(BLRXII,11,BLRCPTN,0)),BLRCPCD=$P(BLRCPDAT,U),BLRCPCST=$P(BLRCPDAT,U,2),BLRCPRC=$P(BLRCPDAT,U,3),BLRCPACT=$P(BLRCPDAT,U,4) D
 S BLRCPTN=0 F BLRNN=1:1 S BLRCPTN=$O(^BLRCPT(BLRXII,11,BLRCPTN)) Q:'BLRCPTN  S BLRCPDAT=$G(^BLRCPT(BLRXII,11,BLRCPTN,0)),BLRCPCD=$P(BLRCPD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TN
 D:$G(SNAPSHOT) ENTRYAUD^BLRUTIL("ENTER RES1^BLRTNA")
 I BLRCMF'="C" S BLRDEL=$P($G(^BLRTXLOG(BLR("SEQUENCE NUMBER"),1)),U,2)="D" Q:BLRDEL
 I BLRSPEC'="" S BLRZ=$G(^LAB(60,BLRTEST1,1,BLRSPEC,0)) I BLRZ'="" D
 .S BLRRL=$P(BLRZ,U,2),BLRRH=$P(BLRZ,U,3),BLRUNITS=$P($P(BLRZ,U,7)," ")
 .;[LR*5.2*1028;08/20/10;IHS/OIT/MPW]Added next 1 line
 .I BLRUNITS=+BLRUNITS,$D(^BLRUCUM(BLRUNITS,0)) S BLRUNITS=$P($G(^BLRUCUM(BLRUNITS,0)),U,1)
 .S AGE=$G(^BLRSITE(BLRQSITE,20,BLRQDH,1,BLRLTP,"AGE"))
 .S SEX=$G(^BLRSITE(BLRQSITE,20,BLRQDH,1,BLRLTP,"SEX"))
 .X:BLRRH'?.N "S BLRRH="_BLRRH X:BLRRL'?.N "S BLRRL="_BLRRL
 .S BLR("UNITS")=BLRUNITS,BLR("REFERENCE HIGH")=BLRRH,BLR("REFERENCE LOW")=BLRRL
 .K AGE,SEX
 S BLR("RESULT")=BLRRES
 S BLR("RESULT N/A FLAG")=BLRNAF
 S BLR("STATUS FLAG")=$S(BLRRES="pending":"A",BLRRES'="":"R",1:"A")  ;IHS/ITSC/TPF 08/15/01 ADDED TO HANDLE NO ANSWER FOR TEST
 S BLRDUZN=$S($D(^VA(200,BLRDUZ,0)):$P($G(^VA(200,BLRDUZ,0)),U),1:"UNK"_BLRDUZ)
 S BLR("VERIFIER POINTER")=BLRDUZ
 D:$G(SNAPSHOT) ENTRYAUD^BLRUTIL("EXIT RES1^BLRTNA")
 Q
 ;
CRSFLDS ;EP - CALLED FROM BLRTN
 K BLR("REFERENCE HIGH"),BLR("REFERENCE LOW"),BLR("RESULT"),BLR("RESULT N/A FLAG")
 Q
SETPRNT ;EP - CALLED BY BLRTN
 D:$G(SNAPSHOT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SHOT) ENTRYAUD^BLRUTIL("EXIT SETPRNT^BLRTNA")
 Q
 ;
GETIEN() ;EP - CALLED BY BLRTN
 D:$G(SNAPSHOT) ENTRYAUD^BLRUTIL("ENTER GETIEN^BLRTNA")
 S BLRERR=0
 D
 .I BLRCMF="C" D GETNEW Q
 .S BLRCRGL="^BLRTXLOG("_BLRCRSBS_")"
 .S BLRENT=$O(@BLRCRGL@(""),BLRDIR)
 .S:'BLRENT BLRERR=1
 .I BLRENT,BLROKCK'="" D @BLROKCK
 .I 'BLRERR,BLRBADCK'="" D @BLRBADCK
 .I BLRERR D EMSG^BLRTNA Q
 .S BLRIEN=BLRENT_"," Q
 D:$G(SNAPSHOT) ENTRYAUD^BLRUTIL("EXIT GETIEN^BLRTNA")
 Q BLRENT
 ;
GETNEW ;EP - CALLED FROM BLRTNA
 D:$G(SNAPSHOT) ENTRYAUD^BLRUTIL("ENTER GETNEW^BLRTNA")
 S BLRENT=$G(^BLRTXLOG("SEQ"))
 I 'BLRENT S BLRENT=$O(^BLRTXLOG("@"),-1) I BLRENT,'$D(^BLRTXLOG(1)) S BLRENT=0
 F BLRENT=BLRENT+1:1 Q:'$D(^BLRTXLOG(BLRENT))
 S BLRENTS="BLRENTS"
 S BLRENTS(1)=BLRENT
 S ^BLRTXLOG("SEQ")=BLRENT
 S BLRIEN="+1,"
 D:$G(SNAPSHOT) ENTRYAUD^BLRUTIL("EXIT GETNEW^BLRTNA")
 Q
 ;
CHKDT ;EP - CALLED BY BLRTN
 D:'BLRENT EMSG^BLRTNA Q:BLRERR
 S BLRCDT=$P($G(^BLRTXLOG(BLRENT,12)),U)
 I $E(BLRCDT,1,3)=$E(DT,1,3) S BLRIEN=BLRENT_"," Q
 I ($E(BLRCDT,1,3)+1)'=$E(DT,1,3) S BLRERR=1,BLRDTER=1 Q  ;MORE THAN 1 YEAR AHEAD
 I $E(BLRCDT,4,5)<11 S BLRERR=1,BLRDTER=1 Q
 S BLRIEN=BLRENT_"," Q
 Q
 ;
CKORD ;EP - CALLED FROM BLRTN
 D:$G(SNAPSHOT) ENTRYAUD^BLRUTIL("ENTER CKORD^BLRTNA")
 S BLRERR=1
 F  D  Q:'BLRENT!'BLRERR
 .S BLRENT1=BLRENT
 .F  Q:'$P($G(^BLRTXLOG(BLRENT1,1)),U)  S BLRENT1=$P(^BLRTXLOG(BLRENT1,1),U)
 .D  Q:'BLRERR
 ..I $D(LRAN) D  Q
 ...I $D(^LRO(68,LRAA,1,LRAD,1,LRAN,4,$P($G(^BLRTXLOG(BLRENT1,0)),U,6))) S BLRERR=0 Q
 ..I $D(^LRO(69,BLRODTM,1,BLRSEQ,2,"B",$P($G(^BLRTXLOG(BLRENT1,0)),U,6))) S BLRERR=0 Q
 .S BLRENT=$O(@BLRCRGL@(BLRENT),BLRDIR)
 D:$G(SNAPSHOT) ENTRYAUD^BLRUTIL("EXIT CKORD^BLRTNA")
 K BLRENT1
 Q
EMSG ;EP - CALLED FROM BLRTN
 ; Log an error because the crossreference isn't set.
 I 'BLRENT D
 .S BLRERR=1,BLRERROR(1)="Something wrong -- problem with IHS Lab Transaction Log Cross Reference: "_BLRCRGL
 Q
 ;
KILL ;EP - CALLED FROM BLRTN
 K BLR,BLRARRAY,BLREMSG,BLRENTS,BLRERR,BLRERROR,BLRFDA,BLRI,BLRICNT,BLRIEN,BLRIENS,BLRIII,BLRLOGDA,BLRQUIET,BLRSFID,BLRSIEN,BLRSTOP,BLRT,BLRTCNT,BLRVL,BLRVR,BLRVRS
 K ZTDESC,ZTDTH,ZTIO,ZTRTN,ZTSAVE,BLRESTR,BLRPT,BLRXQY0,BLRPC,BLRMI,BLRDTER
 Q