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

BCHRPT1.m

Go to the documentation of this file.
BCHRPT1 ; IHS/CMI/LAB - SELECTION OF ITEMS FOR REPORTS ; 
 ;;2.0;IHS RPMS CHR SYSTEM;;OCT 23, 2012;Build 27
 ;
SELECT ;EP
 S BCHANS=Y,BCHC="" F BCHI=1:1 S BCHC=$P(BCHANS,",",BCHI) Q:BCHC=""  S BCHCRIT=BCHSEL(BCHC) D
 .S BCHTEXT=$P(^BCHSORT(BCHCRIT,0),U)
 .S BCHVAR=$P(^BCHSORT(BCHCRIT,0),U,6) K ^BCHTRPT(BCHRPT,11,BCHCRIT),^BCHTRPT(BCHRPT,11,"B",BCHCRIT)
 .W !!,BCHC,")  ",BCHTEXT," Selection."
 .I $P(^BCHSORT(BCHCRIT,0),U,2)]"" S BCHCNT=0,^BCHTRPT(BCHRPT,11,0)="^90002.421101PA^0^0" D @$P(^BCHSORT(BCHCRIT,0),U,2)
 .Q
 Q
PSELECT ;EP
 S BCHANS=Y,BCHC="" F BCHI=1:1 S BCHC=$P(BCHANS,",",BCHI) Q:BCHC=""  S BCHCRIT=BCHSEL(BCHC),BCHPCNT=BCHPCNT+1 D
 .S DIR(0)="N^2:80:0",DIR("A")="Enter Column width for "_$P(^BCHSORT(BCHCRIT,0),U)_" (suggested: "_$P(^BCHSORT(BCHCRIT,0),U,7)_")",DIR("B")=$P(^(0),U,7) D ^DIR K DIR S:$D(DUOUT) DIRUT=1
 .I $D(DIRUT) S Y=$P(^BCHSORT(BCHCRIT,0),U,7)
 .S ^BCHTRPT(BCHRPT,12,0)="^90002.421102PA^1^1"
 .I $D(^BCHTRPT(BCHRPT,12,"B",BCHCRIT)) S X=$O(^BCHTRPT(BCHRPT,12,"B",BCHCRIT,"")),BCHTCW=BCHTCW-$P(^BCHTRPT(BCHRPT,12,X,0),U,2)-2,^BCHTRPT(BCHRPT,12,X,0)=BCHCRIT_U_Y D  Q
 ..Q
 .S ^BCHTRPT(BCHRPT,12,BCHPCNT,0)=BCHCRIT_U_Y,^BCHTRPT(BCHRPT,12,"B",BCHCRIT,BCHPCNT)="",BCHTCW=BCHTCW+Y+2
 .W !!?15,"Total Report width (including column margins - 2 spaces):   ",BCHTCW
 .Q
 Q
Q ;EP
 K ^TMP("BCHVL",$J,"QMAN"),^UTILITY("AMQQ TAX",$J)
 K DIC,X,Y,DD S X=$P(^BCHSORT(BCHCRIT,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 BCHQMAN=+Y
 D PEP^AMQQGTX0(BCHQMAN,"^TMP(""BCHVL"",$J,""QMAN"",")
 I '$D(^TMP("BCHVL",$J,"QMAN")) W !!,$C(7),"** No ",$P(^BCHSORT(BCHCRIT,0),U)," selected, all will be included." Q
 I $D(^TMP("BCHVL",$J,"QMAN","*")) K ^TMP("BCHVL",$J,"QMAN")
 S ^BCHTRPT(BCHRPT,11,BCHCRIT,0)=BCHCRIT,^BCHTRPT(BCHRPT,11,"B",BCHCRIT,BCHCRIT)=""
 S X="",Y=0 F  S X=$O(^TMP("BCHVL",$J,"QMAN",X)) Q:X=""  S Y=Y+1,^BCHTRPT(BCHRPT,11,BCHCRIT,11,Y,0)=X,^BCHTRPT(BCHRPT,11,BCHCRIT,11,"B",X,Y)="",^BCHTRPT(BCHRPT,11,BCHCRIT,11,0)="^90002.42110101A^"_Y_"^"_Y
 K X,Y,Z,BCHQMAN,V
 K ^TMP("BCHVL",$J,"QMAN")
 Q
R ;EP
 S DIR(0)=$P(^BCHSORT(BCHCRIT,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
 S ^BCHTRPT(BCHRPT,11,BCHCRIT,0)=BCHCRIT,^BCHTRPT(BCHRPT,11,"B",BCHCRIT,BCHCRIT)=""
 S BCHCNT=BCHCNT+1,^BCHTRPT(BCHRPT,11,BCHCRIT,11,BCHCNT,0)=$P(Y,U),^BCHTRPT(BCHRPT,11,BCHCRIT,11,"B",$P(Y,U),BCHCNT)="",^BCHTRPT(BCHRPT,11,BCHCRIT,11,0)="^90002.42110101A^"_BCHCNT_"^"_BCHCNT
 G R
 Q
D ;DATE RANGE
BD ;get beginning date
 W ! S DIR(0)="D^::EP",DIR("A")="Enter beginning "_BCHTEXT_" for Search" D ^DIR K DIR S:$D(DUOUT) DIRUT=1
 I $D(DIRUT) Q
 S BCHBD=Y
ED ;get ending date
 W ! S DIR(0)="D^"_BCHBD_"::EP",DIR("A")="Enter ending "_BCHTEXT_" for Search" S Y=BCHBD D DD^%DT S DIR("B")=Y,Y="" D ^DIR K DIR S:$D(DUOUT) DIRUT=1
 I $D(DIRUT) G BD
 S BCHED=Y
 S X1=BCHBD,X2=-1 D C^%DTC S BCHSD=X
 ;
 S ^BCHTRPT(BCHRPT,11,BCHCRIT,0)=BCHCRIT,^BCHTRPT(BCHRPT,11,"B",BCHCRIT,BCHCRIT)=""
 S BCHCNT=0,^BCHTRPT(BCHRPT,11,BCHCRIT,11,BCHCNT,0)="^90002.42110101A^1^1" S BCHCNT=BCHCNT+1,^BCHTRPT(BCHRPT,11,BCHCRIT,11,1,0)=BCHBD_U_BCHED,^BCHTRPT(BCHRPT,11,BCHCRIT,11,"B",BCHBD,BCHCNT)=""
 Q
N ;
 K ^BCHTRPT(BCHRPT,11,BCHCRIT),^BCHTRPT(BCHRPT,11,"B",BCHCRIT)
 S DIR(0)="FO^1:7",DIR("A")="Enter a Range for "_$P(^BCHSORT(BCHCRIT,0),U)_", (e.g. 5-12)" D ^DIR K DIR S:$D(DUOUT) DIRUT=1
 I Y="" W !!,"No number range entered.  All numbers will be included." Q
 I Y'?1.3N1"-"1.3N W !!,$C(7),$C(7),"Enter an number range in the format nnn-nnn.  E.g. 0-5, 0-99, 5-20." G N
 S ^BCHTRPT(BCHRPT,11,BCHCRIT,0)=BCHCRIT,^BCHTRPT(BCHRPT,11,"B",BCHCRIT,BCHCRIT)=""
 S BCHCNT=0,^BCHTRPT(BCHRPT,11,BCHCRIT,11,BCHCNT,0)="^90002.42110101A^1^1" F X=$P(Y,"-"):1:$P(Y,"-",2) S BCHCNT=BCHCNT+1,^BCHTRPT(BCHRPT,11,BCHCRIT,11,1,0)=X,^BCHTRPT(BCHRPT,11,BCHCRIT,11,"B",X,BCHCNT)=""
 S $P(^BCHTRPT(BCHRPT,11,BCHCRIT,11,1,0),U,2)=$P(Y,"-",2)
 Q
SPECIAL ;
 K ^BCHTRPT(BCHRPT,11,BCHCRIT),^BCHTPRT(BCHRPT,11,"B",BCHCRIT)
 S Y="" X:$D(^BCHSORT(BCHCRIT,4)) ^(4)
 I Y="" Q
 S ^BCHTRPT(BCHRPT,11,BCHCRIT,0)=BCHCRIT,^BCHTRPT(BCHRPT,11,"B",BCHCRIT,BCHCRIT)=""
 S BCHCNT=BCHCNT+1,^BCHTRPT(BCHRPT,11,BCHCRIT,11,BCHCNT,0)=$P(Y,U),^BCHTRPT(BCHRPT,11,BCHCRIT,11,"B",$P(Y,U),BCHCNT)="",^BCHTRPT(BCHRPT,11,BCHCRIT,11,0)="^90002.42110101A^"_BCHCNT_"^"_BCHCNT
 Q
J ;JUST A HIT
 S ^BCHVRPT(BCHRPT,11,BCHCRIT,0)=BCHCRIT,^BCHVRPT(BCHRPT,11,"B",BCHCRIT,BCHCRIT)=""
 S ^BCHVRPT(BCHRPT,11,BCHCRIT,11,1,0)=1,^BCHVRPT(BCHRPT,11,BCHCRIT,11,"B",1,1)="",^BCHVRPT(BCHRPT,11,BCHCRIT,11,0)="^90002.42110101A^"_1_"^"_1
 Q
Y ;
 D Y^BCHRPT0
 Q