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

BNIGVL0.m

Go to the documentation of this file.
BNIGVL0 ; IHS/CMI/LAB - SCREEN LOGIC ;
 ;;1.0;BNI CPHD ACTIVITY DATASYSTEM;;DEC 20, 2006
 ;
 ;
Q ;EP
 K ^XTMP("BNIGVL",$J,"QMAN"),^UTILITY("AMQQ TAX",$J)
 K DIC,X,Y,DD S X=$P(^BNIGRI(BNIGCRIT,0),U,3),DIC="^AMQQ(5,",DIC(0)="EQXM",DIC("S")="I $P(^(0),U,14)" D ^DIC K DIC,DA,DINUM,DICR I Y=-1 W "OOPS - QMAN NOT CURRENT - QUITTING" Q
 S BNIGQMAN=+Y
 I $P(^BNIGRI(BNIGCRIT,0),U)="Cause of Injury" S AMQQSQNM="CAUSE OF INJURY"
 D ^AMQQGTX0(BNIGQMAN,"^XTMP(""BNIGVL"",$J,""QMAN"",")
 I '$D(^XTMP("BNIGVL",$J,"QMAN")) W !!,$C(7),"** No ",$P(^BNIGRI(BNIGCRIT,0),U)," selected, all will be included." Q
 I $D(^XTMP("BNIGVL",$J,"QMAN","*")) K ^XTMP("BNIGVL",$J,"QMAN")
 S ^BNIRTMP(BNIGRPT,11,BNIGCRIT,0)=BNIGCRIT,^BNIRTMP(BNIGRPT,11,"B",BNIGCRIT,BNIGCRIT)=""
 S X="",Y=0 F  S X=$O(^XTMP("BNIGVL",$J,"QMAN",X)) Q:X=""  S Y=Y+1,^BNIRTMP(BNIGRPT,11,BNIGCRIT,11,Y,0)=X,^BNIRTMP(BNIGRPT,11,BNIGCRIT,11,"B",X,Y)="",^BNIRTMP(BNIGRPT,11,BNIGCRIT,11,0)="^90512.8110101A^"_Y_"^"_Y
 K X,Y,Z,BNIGQMAN,V,AMQQSQNM
 K ^XTMP("BNIGVL",$J,"QMAN")
 Q
R ;EP
 S DIR(0)=$P(^BNIGRI(BNIGCRIT,0),U,4)_"O",DIR("A")="ENTER "_$P(^(0),U) D ^DIR K DIR S:$D(DUOUT) DIRUT=1
 Q:$D(DIRUT)
 I Y="" Q
 I Y=-1 Q
 S ^BNIRTMP(BNIGRPT,11,BNIGCRIT,0)=BNIGCRIT,^BNIRTMP(BNIGRPT,11,"B",BNIGCRIT,BNIGCRIT)=""
 S BNIGCNT=BNIGCNT+1,^BNIRTMP(BNIGRPT,11,BNIGCRIT,11,BNIGCNT,0)=$P(Y,U),^BNIRTMP(BNIGRPT,11,BNIGCRIT,11,"B",$P(Y,U),BNIGCNT)="",^BNIRTMP(BNIGRPT,11,BNIGCRIT,11,0)="^90512.8910101A^"_BNIGCNT_"^"_BNIGCNT
 G R
 Q
D ;DATE RANGE
BD ;get beginning date
 W ! S DIR(0)="D^::EP",DIR("A")="Enter beginning "_BNIGTEXT_" for Search" D ^DIR K DIR S:$D(DUOUT) DIRUT=1
 I $D(DIRUT) Q
 S BNIGBDAT=Y
ED ;get ending date
 W ! S DIR(0)="D^"_BNIGBDAT_"::EP",DIR("A")="Enter ending "_BNIGTEXT_" for Search" S Y=BNIGBDAT D DD^%DT S DIR("B")=Y,Y="" D ^DIR K DIR S:$D(DUOUT) DIRUT=1
 I $D(DIRUT) G BD
 S BNIGEDAT=Y
 S X1=BNIGBDAT,X2=-1 D C^%DTC S BNIGSDAT=X
 ;
 S ^BNIRTMP(BNIGRPT,11,BNIGCRIT,0)=BNIGCRIT,^BNIRTMP(BNIGRPT,11,"B",BNIGCRIT,BNIGCRIT)=""
 S BNIGCNT=0,^BNIRTMP(BNIGRPT,11,BNIGCRIT,11,BNIGCNT,0)="^90512.8910101A^1^1" S BNIGCNT=BNIGCNT+1,^BNIRTMP(BNIGRPT,11,BNIGCRIT,11,1,0)=BNIGBDAT_U_BNIGEDAT,^BNIRTMP(BNIGRPT,11,BNIGCRIT,11,"B",BNIGBDAT,BNIGCNT)=""
 Q
N ;EP
 K ^BNIRTMP(BNIGRPT,11,BNIGCRIT),^BNIRTMP(BNIGRPT,11,"B",BNIGCRIT)
 S DIR(0)="FO^1:11",DIR("A")="Enter a Range of numbers (e.g. 5-12,1-1)" D ^DIR K DIR S:$D(DUOUT) DIRUT=1
 I Y="" W !!,"No numeric range entered.  All numerics will be included." Q
 I $D(^BNIGRI(BNIGCRIT,25)) S X=Y X ^(25) I '$D(X),$D(^BNIGRI(BNIGCRIT,26)) W !! X ^(26) G N ;if input tx exists and fails G N
 I '$D(^BNIGRI(BNIGCRIT,25)),Y'?1.3N1"-"1.3N W !!,$C(7),$C(7),"Enter a numeric range in the format nnn-nnn.  E.g. 0-5, 0-99, 5-20." G N
 S ^BNIRTMP(BNIGRPT,11,BNIGCRIT,0)=BNIGCRIT,^BNIRTMP(BNIGRPT,11,"B",BNIGCRIT,BNIGCRIT)=""
 S ^BNIRTMP(BNIGRPT,11,BNIGCRIT,11,0)="^90512.8910101A^1^1" S ^BNIRTMP(BNIGRPT,11,BNIGCRIT,11,1,0)=$P(Y,"-"),^BNIRTMP(BNIGRPT,11,BNIGCRIT,11,"B",$P(Y,"-"),1)=""
 S $P(^BNIRTMP(BNIGRPT,11,BNIGCRIT,11,1,0),U,2)=$P(Y,"-",2)
 Q
J ;EP - JUST A HIT
 S ^BNIRTMP(BNIGRPT,11,BNIGCRIT,0)=BNIGCRIT,^BNIRTMP(BNIGRPT,11,"B",BNIGCRIT,BNIGCRIT)=""
 S ^BNIRTMP(BNIGRPT,11,BNIGCRIT,11,1,0)=1,^BNIRTMP(BNIGRPT,11,BNIGCRIT,11,"B",1,1)="",^BNIRTMP(BNIGRPT,11,BNIGCRIT,11,0)="^90512.8910101A^"_1_"^"_1
 Q
Y ;EP - called from apclvl0
 S DIR(0)="S^1:"_BNIGTEXT_";0:NO "_BNIGTEXT_"",DIR("A")="Should "_$S(BNIGPTVS="P":"patient",1:"procedure")_" have",DIR("B")="1" D ^DIR K DIR S:$D(DUOUT) DIRUT=1
 Q:$D(DIRUT)
 Q:Y=""
 S ^BNIRTMP(BNIGRPT,11,BNIGCRIT,0)=BNIGCRIT,^BNIRTMP(BNIGRPT,11,"B",BNIGCRIT,BNIGCRIT)=""
 S ^BNIRTMP(BNIGRPT,11,BNIGCRIT,11,1,0)=Y,^BNIRTMP(BNIGRPT,11,BNIGCRIT,11,"B",Y,1)="",^BNIRTMP(BNIGRPT,11,BNIGCRIT,11,0)="^90512.8910101A^"_1_"^"_1
 Q
F ;FREE TEXT RANGE
 K ^BNIRTMP(BNIGRPT,11,BNIGCRIT),^BNIRTMP(BNIGRPT,11,"B",BNIGCRIT)
 S DIR(0)="FO^1:20",DIR("A")="Enter a Range of Characters for Search (e.g. A:B) " D ^DIR K DIR S:$D(DUOUT) DIRUT=1
 I Y="" W !!,"No range entered.  All ",BNIGTEXT,"  will be included." Q
 I $D(^BNIGRI(BNIGCRIT,21)) S X=Y X ^(21) I '$D(X),$D(^BNIGRI(BNIGCRIT,22)) W !! X ^(22) G F ;if input tx exists and fails G N
 I '$D(^BNIGRI(BNIGCRIT,21)),Y'?1.ANP1":"1.ANP W !!,$C(7),$C(7),"Enter an free text range in the format AAA:AAA.  E.g. 94-01:94-200,CA:CZ, A:Z." G F
 S ^BNIRTMP(BNIGRPT,11,BNIGCRIT,0)=BNIGCRIT,^BNIRTMP(BNIGRPT,11,"B",BNIGCRIT,BNIGCRIT)=""
 S BNIGCNT=0,^BNIRTMP(BNIGRPT,11,BNIGCRIT,11,BNIGCNT,0)="^90512.8910101A^1^1" S BNIGCNT=BNIGCNT+1,^BNIRTMP(BNIGRPT,11,BNIGCRIT,11,1,0)=$P(X,":")_U_$P(X,":",2),^BNIRTMP(BNIGRPT,11,BNIGCRIT,11,"B",$P(X,":"),BNIGCNT)=""
 Q