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

BNIGVL4.m

Go to the documentation of this file.
  1. BNIGVL4 ; IHS/CMI/LAB - general retrieval select ;
  1. ;;1.0;BNI CPHD ACTIVITY DATASYSTEM;;DEC 20, 2006
  1. ;; ;
  1. EN ; -- main entry point for BNIG GENRET SELECT ITEMS
  1. K BNIGCSEL
  1. D EN^VALM("BNIG GENRET SELECT ITEMS")
  1. D CLEAR^VALM1
  1. K BNIGDISP,BNIGSEL,BNIGLIST,C,X,I,K,J,BNIGHIGH,BNIGCUT,BNIGCSEL,BNIGCNTL
  1. K VALMHDR,VALMCNT
  1. Q
  1. ;
  1. HDR ; -- header code
  1. D @("HDR"_BNIGCNTL)
  1. Q
  1. HDRS ;
  1. S VALMHDR(1)=" "_$G(IORVON)_"CPHAD Activity Record Selection Menu"_$G(IORVOFF)
  1. S VALMHDR(2)="Activity Records can be selected based upon any of the following items. Select"
  1. S VALMHDR(3)="as many as you wish, in any order or combination. An (*) asterisk indicates"
  1. S VALMHDR(4)="items already selected. To bypass screens and select all records, type Q."
  1. Q
  1. ;
  1. HDRP ;print selection header
  1. S VALMHDR(1)=" "_$G(IORVON)_"PRINT ITEM SELECTION MENU"_$G(IORVOFF)
  1. S VALMHDR(2)="The following data items can be printed. Choose the items in the order you"
  1. S VALMHDR(3)="want them to appear on the printout. Keep in mind that you have an 80"
  1. S VALMHDR(4)="column screen available, or a printer with either 80 or 132 column width."
  1. Q
  1. ;
  1. HDRR ;sort header
  1. S VALMHDR(1)=""
  1. S VALMHDR(2)=" "_$G(IORVON)_"SORT ITEM SELECTION MENU"_$G(IORVOFF)
  1. S VALMHDR(3)="The Activity records displayed can be SORTED by ONLY ONE of the following items."
  1. S VALMHDR(4)="If you don't select a sort item, the report will be sorted by activity date."
  1. Q
  1. ;
  1. INIT ; -- init variables and list array
  1. K BNIGDISP,BNIGSEL,BNIGHIGH,BNIGLIST
  1. S BNIGHIGH=0,X=0 F S X=$O(^BNIGRI("C",X)) Q:X'=+X S Y=$O(^BNIGRI("C",X,"")) I $P(^BNIGRI(Y,0),U,5)[BNIGCNTL,$P(^(0),U,11)[BNIGPTVS S BNIGHIGH=BNIGHIGH+1,BNIGSEL(BNIGHIGH)=Y
  1. S BNIGCUT=((BNIGHIGH/3)+1)\1
  1. S (C,I)=0,J=1,K=1 F S I=$O(BNIGSEL(I)) Q:I'=+I Q:$D(BNIGDISP(I)) D
  1. .S C=C+1,BNIGLIST(C,0)=I_") "_$S($D(BNIGCSEL(I)):"*",1:" ")_$S($P(^BNIGRI(BNIGSEL(I),0),U,12)="":$E($P(^(0),U),1,20),1:$P(^(0),U,12)) S BNIGDISP(I)="",BNIGLIST("IDX",C,C)=""
  1. .S J=I+BNIGCUT I $D(BNIGSEL(J)),'$D(BNIGDISP(J)) S $E(BNIGLIST(C,0),28)=J_") "_$S($D(BNIGCSEL(J)):"*",1:" ")_$S($P(^BNIGRI(BNIGSEL(J),0),U,12)="":$E($P(^BNIGRI(BNIGSEL(J),0),U),1,20),1:$P(^(0),U,12)) S BNIGDISP(J)=""
  1. .S K=J+BNIGCUT I $D(BNIGSEL(K)),'$D(BNIGDISP(K)) S $E(BNIGLIST(C,0),55)=K_") "_$S($D(BNIGCSEL(K)):"*",1:" ")_$S($P(^BNIGRI(BNIGSEL(K),0),U,12)="":$E($P(^BNIGRI(BNIGSEL(K),0),U),1,20),1:$P(^(0),U,12)) S BNIGDISP(K)=""
  1. K BNIGDISP
  1. S VALMCNT=C
  1. Q
  1. ;
  1. ADD ;EP - add an item to the selected list - called from a protocol
  1. G:BNIGCNTL="R" SELECTR
  1. W ! S DIR(0)="LO^1:"_BNIGHIGH,DIR("A")="Which activity record item(s)" D DIRQ^BNIGVLS1,^DIR K DIR S:$D(DUOUT) DIRUT=1
  1. I Y="" W !,"No items selected." G ADDX
  1. I $D(DIRUT) W !,"No items selected." G ADDX
  1. D FULL^VALM1 W:$D(IOF) @IOF
  1. D @("SELECT"_BNIGCNTL)
  1. ADDX ;
  1. S DIR(0)="EO",DIR("A")="Hit return to continue..." K DA D ^DIR K DIR
  1. D BACK
  1. Q
  1. SELECTS ;select screen items
  1. S BNIGANS=Y,BNIGC="" F BNIGI=1:1 S BNIGC=$P(BNIGANS,",",BNIGI) Q:BNIGC="" S BNIGCRIT=BNIGSEL(BNIGC) D
  1. .S BNIGTEXT=$P(^BNIGRI(BNIGCRIT,0),U)
  1. .S BNIGVAR=$P(^BNIGRI(BNIGCRIT,0),U,6) K ^BNIRTMP(BNIGRPT,11,BNIGCRIT),^BNIRTMP(BNIGRPT,11,"B",BNIGCRIT)
  1. .W !!,BNIGC,") ",BNIGTEXT," Selection."
  1. .I $P(^BNIGRI(BNIGCRIT,0),U,2)]"" S BNIGCNT=0,^BNIRTMP(BNIGRPT,11,0)="^90512.81101PA^0^0" D @($P(^BNIGRI(BNIGCRIT,0),U,2)_"^BNIGVL0")
  1. .I $D(^BNIRTMP(BNIGRPT,11,BNIGCRIT,11,1)) S BNIGCSEL(BNIGC)=""
  1. .I $P(^BNIGRI(BNIGCRIT,0),U,13) S BNIGDTR=1
  1. .Q
  1. D SHOW^BNIGVLS
  1. Q
  1. SELECTR ;sort select
  1. W ! S DIR(0)="NO^1:"_BNIGHIGH_":0",DIR("A")=$S(BNIGCTYP="S":"Sub-total ",1:"Sort ")_"records by which of the above" D ^DIR K DIR
  1. SELECTR1 ;
  1. I $D(DUOUT) W !,"exiting" S BNIGQUIT=1 Q
  1. I Y="",BNIGCTYP="D"!(BNIGCTYP="L") W !!,"No sort criteria selected ... will sort by Activity Record date." S BNIGSORT=1,BNIGSORV="Activity Date" H 3 D Q
  1. .S DA=BNIGRPT,DIE="^BNIRTMP(",DR=".07////"_BNIGSORT D ^DIE K DA,DR,DIE,DIU,DIV,DIY,DIW
  1. I Y="",BNIGCTYP'="D",BNIGCTYP'="L" W !!,"No sub-totalling will be done.",!! D Q
  1. .S BNIGCTYP="T"
  1. .H 2
  1. .S BNIGSORT=1,BNIGSORV="Activity Date"
  1. S BNIGSORT=BNIGSEL(+Y),BNIGSORV=$P(^BNIGRI(BNIGSORT,0),U),DA=BNIGRPT,DIE="^BNIRTMP(",DR=".07////"_BNIGSORT D ^DIE K DA,DR,DIE,DIU,DIV,DIY,DIW
  1. Q
  1. SELECTP ;print select - get columns
  1. S BNIGANS=Y,BNIGC="" F BNIGI=1:1 S BNIGC=$P(BNIGANS,",",BNIGI) Q:BNIGC="" S BNIGCRIT=BNIGSEL(BNIGC),BNIGPCNT=BNIGPCNT+1 D
  1. .I BNIGCTYP="D" D
  1. ..S DIR(0)="N^2:80:0",DIR("A")="Enter Column width for "_$P(^BNIGRI(BNIGCRIT,0),U)_" (suggested: "_$P(^BNIGRI(BNIGCRIT,0),U,7)_")",DIR("B")=$P(^(0),U,7) D ^DIR K DIR S:$D(DUOUT) DIRUT=1
  1. ..I $D(DIRUT) S Y=$P(^BNIGRI(BNIGCRIT,0),U,7)
  1. .I BNIGCTYP="L" S Y=""
  1. .S ^BNIRTMP(BNIGRPT,12,0)="^90512.81102PA^1^1"
  1. .I $D(^BNIRTMP(BNIGRPT,12,"B",BNIGCRIT)) S X=$O(^BNIRTMP(BNIGRPT,12,"B",BNIGCRIT,"")),BNIGTCW=BNIGTCW-$P(^BNIRTMP(BNIGRPT,12,X,0),U,2)-2,^BNIRTMP(BNIGRPT,12,X,0)=BNIGCRIT_U_Y
  1. .S ^BNIRTMP(BNIGRPT,12,BNIGPCNT,0)=BNIGCRIT_U_Y,^BNIRTMP(BNIGRPT,12,"B",BNIGCRIT,BNIGPCNT)="",BNIGTCW=BNIGTCW+Y+2,BNIGCSEL(BNIGC)=""
  1. .I BNIGCTYP="D" W !!?15,"Total Report width (including column margins - 2 spaces): ",BNIGTCW
  1. .Q
  1. Q
  1. REM ;EP - remove a selected item - called from protocol entry
  1. I '$D(BNIGCSEL) W !!,"No items have been selected.",! H 2 G REMX
  1. S DIR(0)="LO^:",DIR("A")="Remove which selected item" K DA D ^DIR K DIR S:$D(DUOUT) DIRUT=1
  1. I Y="" W !,"No items selected." G REMX
  1. I $D(DIRUT) W !,"No items selected." G REMX
  1. S BNIGANS=Y,BNIGC="" F BNIGI=1:1 S BNIGC=$P(BNIGANS,",",BNIGI) Q:BNIGC="" S BNIGCRIT=BNIGSEL(BNIGC) D
  1. .I '$D(BNIGCSEL(BNIGC)) W !,"Item ",BNIGC," ",$P(^BNIGRI(BNIGCRIT,0),U)," has not been selected.",! Q
  1. .K BNIGCSEL(BNIGC)
  1. .I BNIGCNTL="S" K ^BNIRTMP(BNIGRPT,11,BNIGCRIT),^BNIRTMP(BNIGRPT,11,"B",BNIGCRIT)
  1. .I BNIGCNTL="P" S X=$O(^BNIRTMP(BNIGRPT,12,"B",BNIGCRIT,0)) I X K ^BNIRTMP(BNIGRPT,12,X),^BNIRTMP(BNIGRPT,12,"B",BNIGCRIT)
  1. .W !,"Item ",$P(^BNIGRI(BNIGCRIT,0),U)," removed from selected list of items."
  1. REMX ;
  1. S DIR(0)="EO",DIR("A")="Hit return to continue..." K DA D ^DIR K DIR
  1. D BACK
  1. Q
  1. Q ;EP - quit selections
  1. I BNIGCNTL="R" S Y="" G SELECTR1
  1. Q
  1. EXITR ;EP - exit report called from protocol entry
  1. S BNIGQUIT=1
  1. Q
  1. HELP ; -- help code
  1. D FULL^VALM1
  1. W:$D(IOF) @IOF
  1. W !,"Enter an S to Select an Item, and R to remove a selected item, Q to Quit",!,"the selection process. To exit the report, enter an E.",!,"Hit a Q to select all ",$S(BNIGPTVS="R":"visits",1:"patients"),", bypassing all screens.",!
  1. S X="?" D DISP^XQORM1 W !
  1. S DIR(0)="EO",DIR("A")="Hit return to continue..." K DA D ^DIR K DIR
  1. D BACK
  1. Q
  1. ;
  1. BACK ;go back to listman
  1. D TERM^VALM0
  1. S VALMBCK="R"
  1. D INIT
  1. D HDR
  1. K DIR
  1. K X,Y,Z,I
  1. Q
  1. EXIT ; -- exit code
  1. K BNIGDISP
  1. K VALMCC,VALMHDR
  1. Q
  1. ;
  1. EXPND ; -- expand code
  1. Q
  1. ;