APCLVL6 ; IHS/CMI/LAB - NO DESCRIPTION PROVIDED 25-JUN-1996 ;
;;2.0;IHS PCC SUITE;;MAY 14, 2009
;; ;
EN ; -- main entry point for APCL VGEN SELECT ITEMS
;
D EN^VALM("APCL VGENG SELECT ITEMS")
D CLEAR^VALM1
;
K VALMHDR,VALMCNT
Q
;
HDR ; -- header code
I $G(APCLCNTL)="" Q
D @("HDR"_APCLCNTL)
Q
HDRS ;
S VALMHDR(1)=" "_$G(IORVON)_$S(APCLPTVS="V":"VISIT ",1:"PATIENT ")_"Selection Menu"_$G(IORVOFF)
S VALMHDR(2)=$S(APCLPTVS="V":"Visits",1:"Patients")_" can be selected based upon any of the following items. Select"
S VALMHDR(3)="as many as you wish, in any order or combination. An (*) asterisk indicates"
S VALMHDR(4)="items already selected. To bypass screens and select all "_$S(APCLPTVS="V":"visits",1:"patients")_" hit Q."
Q
;
HDRP ;print selection header
S VALMHDR(1)=" "_$G(IORVON)_"PRINT ITEM SELECTION MENU"_$G(IORVOFF)
S VALMHDR(2)="The following data items can be printed. Choose the items in the order you"
S VALMHDR(3)="want them to appear on the printout. Keep in mind that you have an 80"
S VALMHDR(4)="column screen available, or a printer with either 80 or 132 column width."
Q
;
HDRR ;sort header
S VALMHDR(1)=""
S VALMHDR(2)=" "_$G(IORVON)_"SORT ITEM SELECTION MENU"_$G(IORVOFF)
S VALMHDR(3)="The "_$S(APCLPTVS="P":"patients",1:"visits")_" displayed can be SORTED by ONLY ONE of the following items."
S VALMHDR(4)="If you don't select a sort item, the report will be sorted by "_$S(APCLPTVS="V":"visit date.",1:"patient name.")
Q
;
INIT ; -- init variables and list array
K APCLDISP,APCLSEL,APCLHIGH,APCLLIST
S APCLXREF="C"
S APCLHIGH=0,X=0 F S X=$O(^APCLVSTS(APCLXREF,X)) Q:X="" S Y=$O(^APCLVSTS(APCLXREF,X,"")) I $P(^APCLVSTS(Y,0),U,5)[APCLCNTL,$P(^(0),U,11)[APCLPTVS,$P(^APCLVSTS(Y,0),U,15)=APCLGIEN S APCLHIGH=APCLHIGH+1,APCLSEL(APCLHIGH)=Y
S APCLCUT=((APCLHIGH/3)+1)\1
S (C,I)=0,J=1,K=1 F S I=$O(APCLSEL(I)) Q:I="" Q:($D(APCLDISP(I))) D
.S C=C+1,APCLZZ=$$T(I,APCLCNTL),APCLLIST(C,0)=I_")"_$S($D(APCLCSEL(APCLSEL(I))):"*",1:" ")_APCLZZ S APCLDISP(I)="",APCLLIST("IDX",C,C)=""
.S J=I+APCLCUT I $D(APCLSEL(J)),'$D(APCLDISP(J)) S APCLZZ=$$T(J,APCLCNTL),$E(APCLLIST(C,0),28)=J_")"_$S($D(APCLCSEL(APCLSEL(J))):"*",1:" ")_APCLZZ S APCLDISP(J)=""
.S K=J+APCLCUT I $D(APCLSEL(K)),'$D(APCLDISP(K)) S APCLZZ=$$T(K,APCLCNTL),$E(APCLLIST(C,0),55)=K_")"_$S($D(APCLCSEL(APCLSEL(K))):"*",1:" ")_APCLZZ S APCLDISP(K)=""
K APCLDISP
S VALMCNT=C
Q
;
;
ADD ;EP - add an item to the selected list - called from a protocol
G:APCLCNTL="R" SELECTR
W ! S DIR(0)="LO^1:"_APCLHIGH,DIR("A")="Which "_$S(APCLPTVS="P":"patient",1:"visit")_" item(s)" D DIRQ^APCLVLS1,^DIR K DIR S:$D(DUOUT) DIRUT=1
I Y="" W !,"No items selected." G ADDX
I $D(DIRUT) W !,"No items selected." G ADDX
D FULL^VALM1 W:$D(IOF) @IOF
D @("SELECT"_APCLCNTL)
ADDX ;
S DIR(0)="EO",DIR("A")="Hit return to continue..." K DA D ^DIR K DIR
D BACK
Q
SELECTS ;select screen items
S APCLANS=Y,APCLC="" F APCLI=1:1 S APCLC=$P(APCLANS,",",APCLI) Q:APCLC="" S APCLCRIT=APCLSEL(APCLC) D
.S APCLTEXT=$P(^APCLVSTS(APCLCRIT,0),U)
.S APCLVAR=$P(^APCLVSTS(APCLCRIT,0),U,6) K ^APCLVRPT(APCLRPT,11,APCLCRIT),^APCLVRPT(APCLRPT,11,"B",APCLCRIT)
.W !!,APCLC,") ",APCLTEXT," Selection."
.I $O(^APCLVSTS(APCLCRIT,11,0)) D SELECTST
.I $P(^APCLVSTS(APCLCRIT,0),U,2)]"" S APCLCNT=0,^APCLVRPT(APCLRPT,11,0)="^9001003.81101PA^0^0" D @($P(^APCLVSTS(APCLCRIT,0),U,2)_"^APCLVL0")
.I $D(^APCLVRPT(APCLRPT,11,APCLCRIT,11,1)) S APCLCSEL(APCLCRIT)="",APCLCSEL("GRP",APCLGIEN,APCLCRIT)=""
.Q
D SHOW^APCLVLS
Q
SELECTST ;print help text for this item
W ! NEW X S X=0 F S X=$O(^APCLVSTS(APCLCRIT,11,X)) Q:X'=+X W !,^APCLVSTS(APCLCRIT,11,X,0)
W !
Q
SELECTR ;sort select
W ! S DIR(0)="NO^1:"_APCLHIGH_":0",DIR("A")=$S(APCLCTYP="S":"Sub-total ",1:"Sort ")_$S(APCLPTVS="P":"Patients",1:"visits")_" by which of the above" D ^DIR K DIR
SELECTR1 ;
I $D(DUOUT) W !,"exiting" S APCLQUIT=1 Q
S APCLANSW=Y
I APCLANSW="" Q ;,(APCLCTYP="D"!(APCLCTYP="L")) W !!,"No sort criteria selected ... will sort by "_$S(APCLPTVS="P":"Patient Name",1:"Visit Date")_"." S:APCLPTVS="V" APCLSORT=19,APCLSORV="Visit Date" D Q
;.S:APCLPTVS="P" APCLSORT=1,APCLSORV="Patient Name" H 2 D Q
;..S DA=APCLRPT,DIE="^APCLVRPT(",DR=".07////"_APCLSORT D ^DIE K DA,DR,DIE,DIU,DIV,DIY,DIW
;I APCLANSW="",APCLCTYP'="D",APCLCTYP'="L" W !!,"No sub-totalling will be done.",!! D Q
;.S APCLCTYP="T"
;.H 3
;.S:APCLPTVS="V" APCLSORT=19,APCLSORV="Visit Date"
;.S:APCLPTVS="P" APCLSORT=1,APCLSORV="Patient Name"
S APCLSORT=APCLSEL(+Y),APCLSORV=$P(^APCLVSTS(APCLSORT,0),U),APCLSORG=$P(^APCLVSTS(APCLSORT,0),U,15),DA=APCLRPT,DIE="^APCLVRPT(",DR=".07////"_APCLSORT D ^DIE K DA,DR,DIE,DIU,DIV,DIY,DIW
Q
SELECTP ;print select - get columns
S APCLANS=Y,APCLC="" F APCLI=1:1 S APCLC=$P(APCLANS,",",APCLI) Q:APCLC="" S APCLCRIT=APCLSEL(APCLC),APCLPCNT=APCLPCNT+1 D
.I APCLCTYP="D" D
..S DIR(0)="N^2:80:0",DIR("A")="Enter Column width for "_$P(^APCLVSTS(APCLCRIT,0),U)_" (suggested: "_$P(^APCLVSTS(APCLCRIT,0),U,7)_")",DIR("B")=$P(^(0),U,7) D ^DIR K DIR S:$D(DUOUT) DIRUT=1
..I $D(DIRUT) S Y=$P(^APCLVSTS(APCLCRIT,0),U,7)
.I APCLCTYP="L" S Y=""
.S ^APCLVRPT(APCLRPT,12,0)="^9001003.81102PA^1^1"
.I $D(^APCLVRPT(APCLRPT,12,"B",APCLCRIT)) S X=$O(^APCLVRPT(APCLRPT,12,"B",APCLCRIT,"")),APCLTCW=APCLTCW-$P(^APCLVRPT(APCLRPT,12,X,0),U,2)-2,^APCLVRPT(APCLRPT,12,X,0)=APCLCRIT_U_Y D Q
..Q
.S ^APCLVRPT(APCLRPT,12,APCLPCNT,0)=APCLCRIT_U_Y,^APCLVRPT(APCLRPT,12,"B",APCLCRIT,APCLPCNT)="",APCLTCW=APCLTCW+Y+2,APCLCSEL(APCLCRIT)="",APCLCSEL("GRP",APCLGIEN,APCLCRIT)=""
.I APCLCTYP="D" W !!?15,"Total Report width (including column margins - 2 spaces): ",APCLTCW
.;new functionality to print 1 or all
.Q:'$D(^APCLVRPT(APCLRPT,11,"B",APCLCRIT)) ;didn't select this item
.Q:'$P(^APCLVSTS(APCLCRIT,0),U,13) ;not one of these items
.;one or all
.W !!,"*** This item, ",$P(^APCLVSTS(APCLCRIT,0),U)," was a selection item. Do you want to print",!,"ALL ",$P(^APCLVSTS(APCLCRIT,0),U),"'s or just those you selected.",!
.S DIR(0)="S^A:ALL items;O:Only the ones selected",DIR("A")="For this item",DIR("B")="A" KILL DA D ^DIR KILL DIR
.I $D(DIRUT) S Y="A"
.I Y="O" S $P(^APCLVRPT(APCLRPT,12,APCLPCNT,0),U,3)=1
Q
REM ;EP - remove a selected item - called from protocol entry
I '$D(APCLCSEL) W !!,"No items have been selected.",! H 2 G REMX
S DIR(0)="LO^:",DIR("A")="Remove which selected item" K DA D ^DIR K DIR S:$D(DUOUT) DIRUT=1
;W ! S DIR(0)="LO^1:"_APCLHIGH,DIR("A")="Remove Which "_$S(APCLPTVS="P":"patient",1:"visit")_" item(s)" D DIRQ^APCLVLS1,^DIR K DIR S:$D(DUOUT) DIRUT=1
I Y="" W !,"No items selected." G REMX
I $D(DIRUT) W !,"No items selected." G REMX
S APCLANS=Y,APCLC="" F APCLI=1:1 S APCLC=$P(APCLANS,",",APCLI) Q:APCLC="" D
.I '$D(APCLSEL(APCLC)) W !,APCLC," is not a valid choice" Q
.S APCLCRIT=APCLSEL(APCLC) D
..I '$D(APCLCSEL(APCLCRIT)) W !,"Item ",APCLC," ",$P(^APCLVSTS(APCLCRIT,0),U)," has not been selected.",! Q
..K APCLCSEL(APCLCRIT),APCLCSEL("GRP",APCLGIEN,APCLCRIT)
..I APCLCNTL="S" K ^APCLVRPT(APCLRPT,11,APCLCRIT),^APCLVRPT(APCLRPT,11,"B",APCLCRIT)
..I APCLCNTL="P" S X=$O(^APCLVRPT(APCLRPT,12,"B",APCLCRIT,0)) I X K ^APCLVRPT(APCLRPT,12,X),^APCLVRPT(APCLRPT,12,"B",APCLCRIT)
..W !,"Item ",$P(^APCLVSTS(APCLCRIT,0),U)," removed from selected list of items."
REMX ;
S DIR(0)="EO",DIR("A")="Hit return to continue..." K DA D ^DIR K DIR
D BACK
Q
T(Z,Y) ;
NEW T
S T=$P(^APCLVSTS(APCLSEL(Z),0),U)
I $P(^APCLVSTS(APCLSEL(Z),0),U,12)]"",Y="P" S T=$P(^APCLVSTS(APCLSEL(Z),0),U,12)
Q $E(T,1,22)
Q ;EP - quit selections
;I APCLCNTL="R" S Y="" G SELECTR1
Q
EXITR ;EP - exit report called from protocol entry
S APCLQUIT=1
Q
HELP ; -- help code
D FULL^VALM1
W:$D(IOF) @IOF
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(APCLPTVS="V":"visits",1:"patients"),", bypassing all screens.",!
S X="?" D DISP^XQORM1 W !
S DIR(0)="EO",DIR("A")="Hit return to continue..." K DA D ^DIR K DIR
D BACK
Q
;
BACK ;go back to listman
D TERM^VALM0
S VALMBCK="R"
D INIT
D HDR
K DIR
K X,Y,Z,I
Q
EXIT ; -- exit code
K APCLDISP
K VALMCC,VALMHDR
Q
;
EXPND ; -- expand code
Q
;
APCLVL6 ; IHS/CMI/LAB - NO DESCRIPTION PROVIDED 25-JUN-1996 ;
+1 ;;2.0;IHS PCC SUITE;;MAY 14, 2009
+2 ;; ;
EN ; -- main entry point for APCL VGEN SELECT ITEMS
+1 ;
+2 DO EN^VALM("APCL VGENG SELECT ITEMS")
+3 DO CLEAR^VALM1
+4 ;
+5 KILL VALMHDR,VALMCNT
+6 QUIT
+7 ;
HDR ; -- header code
+1 IF $GET(APCLCNTL)=""
QUIT
+2 DO @("HDR"_APCLCNTL)
+3 QUIT
HDRS ;
+1 SET VALMHDR(1)=" "_$GET(IORVON)_$SELECT(APCLPTVS="V":"VISIT ",1:"PATIENT ")_"Selection Menu"_$GET(IORVOFF)
+2 SET VALMHDR(2)=$SELECT(APCLPTVS="V":"Visits",1:"Patients")_" can be selected based upon any of the following items. Select"
+3 SET VALMHDR(3)="as many as you wish, in any order or combination. An (*) asterisk indicates"
+4 SET VALMHDR(4)="items already selected. To bypass screens and select all "_$SELECT(APCLPTVS="V":"visits",1:"patients")_" hit Q."
+5 QUIT
+6 ;
HDRP ;print selection header
+1 SET VALMHDR(1)=" "_$GET(IORVON)_"PRINT ITEM SELECTION MENU"_$GET(IORVOFF)
+2 SET VALMHDR(2)="The following data items can be printed. Choose the items in the order you"
+3 SET VALMHDR(3)="want them to appear on the printout. Keep in mind that you have an 80"
+4 SET VALMHDR(4)="column screen available, or a printer with either 80 or 132 column width."
+5 QUIT
+6 ;
HDRR ;sort header
+1 SET VALMHDR(1)=""
+2 SET VALMHDR(2)=" "_$GET(IORVON)_"SORT ITEM SELECTION MENU"_$GET(IORVOFF)
+3 SET VALMHDR(3)="The "_$SELECT(APCLPTVS="P":"patients",1:"visits")_" displayed can be SORTED by ONLY ONE of the following items."
+4 SET VALMHDR(4)="If you don't select a sort item, the report will be sorted by "_$SELECT(APCLPTVS="V":"visit date.",1:"patient name.")
+5 QUIT
+6 ;
INIT ; -- init variables and list array
+1 KILL APCLDISP,APCLSEL,APCLHIGH,APCLLIST
+2 SET APCLXREF="C"
+3 SET APCLHIGH=0
SET X=0
FOR
SET X=$ORDER(^APCLVSTS(APCLXREF,X))
IF X=""
QUIT
SET Y=$ORDER(^APCLVSTS(APCLXREF,X,""))
IF $PIECE(^APCLVSTS(Y,0),U,5)[APCLCNTL
IF $PIECE(^(0),U,11)[APCLPTVS
IF $PIECE(^APCLVSTS(Y,0),U,15)=APCLGIEN
SET APCLHIGH=APCLHIGH+1
SET APCLSEL(APCLHIGH)=Y
+4 SET APCLCUT=((APCLHIGH/3)+1)\1
+5 SET (C,I)=0
SET J=1
SET K=1
FOR
SET I=$ORDER(APCLSEL(I))
IF I=""
QUIT
IF ($DATA(APCLDISP(I)))
QUIT
Begin DoDot:1
+6 SET C=C+1
SET APCLZZ=$$T(I,APCLCNTL)
SET APCLLIST(C,0)=I_")"_$SELECT($DATA(APCLCSEL(APCLSEL(I))):"*",1:" ")_APCLZZ
SET APCLDISP(I)=""
SET APCLLIST("IDX",C,C)=""
+7 SET J=I+APCLCUT
IF $DATA(APCLSEL(J))
IF '$DATA(APCLDISP(J))
SET APCLZZ=$$T(J,APCLCNTL)
SET $EXTRACT(APCLLIST(C,0),28)=J_")"_$SELECT($DATA(APCLCSEL(APCLSEL(J))):"*",1:" ")_APCLZZ
SET APCLDISP(J)=""
+8 SET K=J+APCLCUT
IF $DATA(APCLSEL(K))
IF '$DATA(APCLDISP(K))
SET APCLZZ=$$T(K,APCLCNTL)
SET $EXTRACT(APCLLIST(C,0),55)=K_")"_$SELECT($DATA(APCLCSEL(APCLSEL(K))):"*",1:" ")_APCLZZ
SET APCLDISP(K)=""
End DoDot:1
+9 KILL APCLDISP
+10 SET VALMCNT=C
+11 QUIT
+12 ;
+13 ;
ADD ;EP - add an item to the selected list - called from a protocol
+1 IF APCLCNTL="R"
GOTO SELECTR
+2 WRITE !
SET DIR(0)="LO^1:"_APCLHIGH
SET DIR("A")="Which "_$SELECT(APCLPTVS="P":"patient",1:"visit")_" item(s)"
DO DIRQ^APCLVLS1
DO ^DIR
KILL DIR
IF $DATA(DUOUT)
SET DIRUT=1
+3 IF Y=""
WRITE !,"No items selected."
GOTO ADDX
+4 IF $DATA(DIRUT)
WRITE !,"No items selected."
GOTO ADDX
+5 DO FULL^VALM1
IF $DATA(IOF)
WRITE @IOF
+6 DO @("SELECT"_APCLCNTL)
ADDX ;
+1 SET DIR(0)="EO"
SET DIR("A")="Hit return to continue..."
KILL DA
DO ^DIR
KILL DIR
+2 DO BACK
+3 QUIT
SELECTS ;select screen items
+1 SET APCLANS=Y
SET APCLC=""
FOR APCLI=1:1
SET APCLC=$PIECE(APCLANS,",",APCLI)
IF APCLC=""
QUIT
SET APCLCRIT=APCLSEL(APCLC)
Begin DoDot:1
+2 SET APCLTEXT=$PIECE(^APCLVSTS(APCLCRIT,0),U)
+3 SET APCLVAR=$PIECE(^APCLVSTS(APCLCRIT,0),U,6)
KILL ^APCLVRPT(APCLRPT,11,APCLCRIT),^APCLVRPT(APCLRPT,11,"B",APCLCRIT)
+4 WRITE !!,APCLC,") ",APCLTEXT," Selection."
+5 IF $ORDER(^APCLVSTS(APCLCRIT,11,0))
DO SELECTST
+6 IF $PIECE(^APCLVSTS(APCLCRIT,0),U,2)]""
SET APCLCNT=0
SET ^APCLVRPT(APCLRPT,11,0)="^9001003.81101PA^0^0"
DO @($PIECE(^APCLVSTS(APCLCRIT,0),U,2)_"^APCLVL0")
+7 IF $DATA(^APCLVRPT(APCLRPT,11,APCLCRIT,11,1))
SET APCLCSEL(APCLCRIT)=""
SET APCLCSEL("GRP",APCLGIEN,APCLCRIT)=""
+8 QUIT
End DoDot:1
+9 DO SHOW^APCLVLS
+10 QUIT
SELECTST ;print help text for this item
+1 WRITE !
NEW X
SET X=0
FOR
SET X=$ORDER(^APCLVSTS(APCLCRIT,11,X))
IF X'=+X
QUIT
WRITE !,^APCLVSTS(APCLCRIT,11,X,0)
+2 WRITE !
+3 QUIT
SELECTR ;sort select
+1 WRITE !
SET DIR(0)="NO^1:"_APCLHIGH_":0"
SET DIR("A")=$SELECT(APCLCTYP="S":"Sub-total ",1:"Sort ")_$SELECT(APCLPTVS="P":"Patients",1:"visits")_" by which of the above"
DO ^DIR
KILL DIR
SELECTR1 ;
+1 IF $DATA(DUOUT)
WRITE !,"exiting"
SET APCLQUIT=1
QUIT
+2 SET APCLANSW=Y
+3 ;,(APCLCTYP="D"!(APCLCTYP="L")) W !!,"No sort criteria selected ... will sort by "_$S(APCLPTVS="P":"Patient Name",1:"Visit Date")_"." S:APCLPTVS="V" APCLSORT=19,APCLSORV="Visit Date" D Q
IF APCLANSW=""
QUIT
+4 ;.S:APCLPTVS="P" APCLSORT=1,APCLSORV="Patient Name" H 2 D Q
+5 ;..S DA=APCLRPT,DIE="^APCLVRPT(",DR=".07////"_APCLSORT D ^DIE K DA,DR,DIE,DIU,DIV,DIY,DIW
+6 ;I APCLANSW="",APCLCTYP'="D",APCLCTYP'="L" W !!,"No sub-totalling will be done.",!! D Q
+7 ;.S APCLCTYP="T"
+8 ;.H 3
+9 ;.S:APCLPTVS="V" APCLSORT=19,APCLSORV="Visit Date"
+10 ;.S:APCLPTVS="P" APCLSORT=1,APCLSORV="Patient Name"
+11 SET APCLSORT=APCLSEL(+Y)
SET APCLSORV=$PIECE(^APCLVSTS(APCLSORT,0),U)
SET APCLSORG=$PIECE(^APCLVSTS(APCLSORT,0),U,15)
SET DA=APCLRPT
SET DIE="^APCLVRPT("
SET DR=".07////"_APCLSORT
DO ^DIE
KILL DA,DR,DIE,DIU,DIV,DIY,DIW
+12 QUIT
SELECTP ;print select - get columns
+1 SET APCLANS=Y
SET APCLC=""
FOR APCLI=1:1
SET APCLC=$PIECE(APCLANS,",",APCLI)
IF APCLC=""
QUIT
SET APCLCRIT=APCLSEL(APCLC)
SET APCLPCNT=APCLPCNT+1
Begin DoDot:1
+2 IF APCLCTYP="D"
Begin DoDot:2
+3 SET DIR(0)="N^2:80:0"
SET DIR("A")="Enter Column width for "_$PIECE(^APCLVSTS(APCLCRIT,0),U)_" (suggested: "_$PIECE(^APCLVSTS(APCLCRIT,0),U,7)_")"
SET DIR("B")=$PIECE(^(0),U,7)
DO ^DIR
KILL DIR
IF $DATA(DUOUT)
SET DIRUT=1
+4 IF $DATA(DIRUT)
SET Y=$PIECE(^APCLVSTS(APCLCRIT,0),U,7)
End DoDot:2
+5 IF APCLCTYP="L"
SET Y=""
+6 SET ^APCLVRPT(APCLRPT,12,0)="^9001003.81102PA^1^1"
+7 IF $DATA(^APCLVRPT(APCLRPT,12,"B",APCLCRIT))
SET X=$ORDER(^APCLVRPT(APCLRPT,12,"B",APCLCRIT,""))
SET APCLTCW=APCLTCW-$PIECE(^APCLVRPT(APCLRPT,12,X,0),U,2)-2
SET ^APCLVRPT(APCLRPT,12,X,0)=APCLCRIT_U_Y
Begin DoDot:2
+8 QUIT
End DoDot:2
QUIT
+9 SET ^APCLVRPT(APCLRPT,12,APCLPCNT,0)=APCLCRIT_U_Y
SET ^APCLVRPT(APCLRPT,12,"B",APCLCRIT,APCLPCNT)=""
SET APCLTCW=APCLTCW+Y+2
SET APCLCSEL(APCLCRIT)=""
SET APCLCSEL("GRP",APCLGIEN,APCLCRIT)=""
+10 IF APCLCTYP="D"
WRITE !!?15,"Total Report width (including column margins - 2 spaces): ",APCLTCW
+11 ;new functionality to print 1 or all
+12 ;didn't select this item
IF '$DATA(^APCLVRPT(APCLRPT,11,"B",APCLCRIT))
QUIT
+13 ;not one of these items
IF '$PIECE(^APCLVSTS(APCLCRIT,0),U,13)
QUIT
+14 ;one or all
+15 WRITE !!,"*** This item, ",$PIECE(^APCLVSTS(APCLCRIT,0),U)," was a selection item. Do you want to print",!,"ALL ",$PIECE(^APCLVSTS(APCLCRIT,0),U),"'s or just those you selected.",!
+16 SET DIR(0)="S^A:ALL items;O:Only the ones selected"
SET DIR("A")="For this item"
SET DIR("B")="A"
KILL DA
DO ^DIR
KILL DIR
+17 IF $DATA(DIRUT)
SET Y="A"
+18 IF Y="O"
SET $PIECE(^APCLVRPT(APCLRPT,12,APCLPCNT,0),U,3)=1
End DoDot:1
+19 QUIT
REM ;EP - remove a selected item - called from protocol entry
+1 IF '$DATA(APCLCSEL)
WRITE !!,"No items have been selected.",!
HANG 2
GOTO REMX
+2 SET DIR(0)="LO^:"
SET DIR("A")="Remove which selected item"
KILL DA
DO ^DIR
KILL DIR
IF $DATA(DUOUT)
SET DIRUT=1
+3 ;W ! S DIR(0)="LO^1:"_APCLHIGH,DIR("A")="Remove Which "_$S(APCLPTVS="P":"patient",1:"visit")_" item(s)" D DIRQ^APCLVLS1,^DIR K DIR S:$D(DUOUT) DIRUT=1
+4 IF Y=""
WRITE !,"No items selected."
GOTO REMX
+5 IF $DATA(DIRUT)
WRITE !,"No items selected."
GOTO REMX
+6 SET APCLANS=Y
SET APCLC=""
FOR APCLI=1:1
SET APCLC=$PIECE(APCLANS,",",APCLI)
IF APCLC=""
QUIT
Begin DoDot:1
+7 IF '$DATA(APCLSEL(APCLC))
WRITE !,APCLC," is not a valid choice"
QUIT
+8 SET APCLCRIT=APCLSEL(APCLC)
Begin DoDot:2
+9 IF '$DATA(APCLCSEL(APCLCRIT))
WRITE !,"Item ",APCLC," ",$PIECE(^APCLVSTS(APCLCRIT,0),U)," has not been selected.",!
QUIT
+10 KILL APCLCSEL(APCLCRIT),APCLCSEL("GRP",APCLGIEN,APCLCRIT)
+11 IF APCLCNTL="S"
KILL ^APCLVRPT(APCLRPT,11,APCLCRIT),^APCLVRPT(APCLRPT,11,"B",APCLCRIT)
+12 IF APCLCNTL="P"
SET X=$ORDER(^APCLVRPT(APCLRPT,12,"B",APCLCRIT,0))
IF X
KILL ^APCLVRPT(APCLRPT,12,X),^APCLVRPT(APCLRPT,12,"B",APCLCRIT)
+13 WRITE !,"Item ",$PIECE(^APCLVSTS(APCLCRIT,0),U)," removed from selected list of items."
End DoDot:2
End DoDot:1
REMX ;
+1 SET DIR(0)="EO"
SET DIR("A")="Hit return to continue..."
KILL DA
DO ^DIR
KILL DIR
+2 DO BACK
+3 QUIT
T(Z,Y) ;
+1 NEW T
+2 SET T=$PIECE(^APCLVSTS(APCLSEL(Z),0),U)
+3 IF $PIECE(^APCLVSTS(APCLSEL(Z),0),U,12)]""
IF Y="P"
SET T=$PIECE(^APCLVSTS(APCLSEL(Z),0),U,12)
+4 QUIT $EXTRACT(T,1,22)
Q ;EP - quit selections
+1 ;I APCLCNTL="R" S Y="" G SELECTR1
+2 QUIT
EXITR ;EP - exit report called from protocol entry
+1 SET APCLQUIT=1
+2 QUIT
HELP ; -- help code
+1 DO FULL^VALM1
+2 IF $DATA(IOF)
WRITE @IOF
+3 WRITE !,"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 ",$SELECT(APCLPTVS="V":"visits",1:"patients"),", bypassing all screens.",!
+4 SET X="?"
DO DISP^XQORM1
WRITE !
+5 SET DIR(0)="EO"
SET DIR("A")="Hit return to continue..."
KILL DA
DO ^DIR
KILL DIR
+6 DO BACK
+7 QUIT
+8 ;
BACK ;go back to listman
+1 DO TERM^VALM0
+2 SET VALMBCK="R"
+3 DO INIT
+4 DO HDR
+5 KILL DIR
+6 KILL X,Y,Z,I
+7 QUIT
EXIT ; -- exit code
+1 KILL APCLDISP
+2 KILL VALMCC,VALMHDR
+3 QUIT
+4 ;
EXPND ; -- expand code
+1 QUIT
+2 ;