| 1 | PRCPUX2 ;WISC/RFJ/VAC/DST-extrinsic functions                              ; 2/21/07 10:52am | 
|---|
| 2 | ;;5.1;IFCAP;**98**;Oct 20, 2000;Build 37 | 
|---|
| 3 | ;Per VHA Directive 2004-038, this routine should not be modified. | 
|---|
| 4 | ;*98 Added three new calls to support On-Demand Items | 
|---|
| 5 | ;*98 Added fourth call to support ODI All items or single item | 
|---|
| 6 | Q | 
|---|
| 7 | ; | 
|---|
| 8 | ; | 
|---|
| 9 | ISMSFLAG(SITE) ;  isms switch on|off for site | 
|---|
| 10 | ;  switch=0 or 1 for log code sheet format | 
|---|
| 11 | ;  switch=2 for isms code sheet formats | 
|---|
| 12 | N % S %=+$P($G(^PRC(411,+SITE,0)),"^",23) | 
|---|
| 13 | Q $S(1:1,%=0:1,1:%) | 
|---|
| 14 | ; | 
|---|
| 15 | ; | 
|---|
| 16 | INPERCNT(V1,V2,V3,V4) ;  initialize percent graph | 
|---|
| 17 | ;  v1=total number of entries | 
|---|
| 18 | ;  v2=display character | 
|---|
| 19 | ;  v3=reverse video on (optional) | 
|---|
| 20 | ;  v4=reverse video off (optional) | 
|---|
| 21 | ;  returns number v2 to display per entry | 
|---|
| 22 | W !!?30,"% COMPLETE",!?10,"0   10   20   30   40   50   60   70   80   90   100" | 
|---|
| 23 | W !?10,"|----+----+----+----+----+----+----+----+----+----|" | 
|---|
| 24 | W !?10,V3,V2,V4 | 
|---|
| 25 | S %=.02*V1,%=$S(%=0:50,1:1/%) | 
|---|
| 26 | Q % | 
|---|
| 27 | ; | 
|---|
| 28 | ; | 
|---|
| 29 | SHPERCNT(V1,V2,V3,V4,V5,V6) ; display percent complete | 
|---|
| 30 | ;  v1=current entry number executed | 
|---|
| 31 | ;  v2=display this many v3 for each entry | 
|---|
| 32 | ;  v3=character to display | 
|---|
| 33 | ;  v4=reverse video on (optional) | 
|---|
| 34 | ;  v5=reverse video off (optional) | 
|---|
| 35 | ;  return last one displayed | 
|---|
| 36 | N % | 
|---|
| 37 | S X=V1*V2\1 S:X>50 X=50 F %=((V1-1*V2\1)+1):1:X W V4,V3,V5 I $X>50,$D(PRCP("XY")) X PRCP("XY") | 
|---|
| 38 | Q X | 
|---|
| 39 | ; | 
|---|
| 40 | ; | 
|---|
| 41 | QPERCNT(V1,V2,V3,V4) ;  finish percent display | 
|---|
| 42 | ;  v1=last v2 displayed | 
|---|
| 43 | ;  v2=character to display | 
|---|
| 44 | ;  v3=reverse video on (optional) | 
|---|
| 45 | ;  v4=reverse video off (optional) | 
|---|
| 46 | N % | 
|---|
| 47 | F %=V1+1:1:50 W V3,V2,V4 I $X>50,$D(PRCP("XY")) X PRCP("XY") | 
|---|
| 48 | Q | 
|---|
| 49 | ; | 
|---|
| 50 | ; | 
|---|
| 51 | DISPLAY(DX1,DX2,X) ;  display message | 
|---|
| 52 | ;  dx1 = begin column | 
|---|
| 53 | ;  dx2 = end column | 
|---|
| 54 | ;  x = message | 
|---|
| 55 | N %,END,LENGTH,LINE,NEXT,PRCPFLAG,PRCPLINE,TEXT | 
|---|
| 56 | S LENGTH=DX2-DX1 I LENGTH<10 S (DX1,DX2)=1,LENGTH=79 | 
|---|
| 57 | S DX1=DX1-1,DX2=DX2-1,PRCPLINE="",$P(PRCPLINE,"-",LENGTH)="",PRCPLINE="+"_PRCPLINE_"+" | 
|---|
| 58 | W !?DX1,PRCPLINE | 
|---|
| 59 | S LINE=0,TEXT="" | 
|---|
| 60 | F  D  I TEXT="",'$O(X(LINE)) Q | 
|---|
| 61 | .   ; | 
|---|
| 62 | .   ;  get more text if less than 240 characters | 
|---|
| 63 | .   F  D  Q:$G(PRCPFLAG) | 
|---|
| 64 | .   .   S NEXT=+$O(X(LINE)) | 
|---|
| 65 | .   .   I NEXT,$L(TEXT)+$L($G(X(NEXT)))<240 S TEXT=TEXT_$S(TEXT'="":" ",1:"")_$G(X(NEXT)) K X(NEXT) Q | 
|---|
| 66 | .   .   S PRCPFLAG=1 | 
|---|
| 67 | .   ; | 
|---|
| 68 | .   ;  fit text in window | 
|---|
| 69 | .   F END=LENGTH:-1:0 S %=$E(TEXT,END) I %=""!(%=" ") Q | 
|---|
| 70 | .   I END=0 S END=LENGTH | 
|---|
| 71 | .   W !?DX1,"|",$E(TEXT,1,END-1),?DX2,"|" S TEXT=$E(TEXT,END+1,255) | 
|---|
| 72 | W !?DX1,PRCPLINE | 
|---|
| 73 | Q | 
|---|
| 74 | ; | 
|---|
| 75 | ODITEM(INVPT,ITEMDA) ;Return a flag for On-Demand Item | 
|---|
| 76 | ; If an item is in the warehouse, return a "W", if the item is an | 
|---|
| 77 | ;   on-demand item, return a "Y", otherwise return a null. | 
|---|
| 78 | Q:$P($G(^PRCP(445,INVPT,0)),"^",3)="W" "W" | 
|---|
| 79 | Q:$P($G(^PRCP(445,INVPT,1,ITEMDA,0)),"^",30)="N" "" | 
|---|
| 80 | Q $P($G(^PRCP(445,INVPT,1,ITEMDA,0)),"^",30) | 
|---|
| 81 | ; | 
|---|
| 82 | ODIPROM(Y) ; Display prompt to user for On-Demand Items selection | 
|---|
| 83 | ; | 
|---|
| 84 | ; DIRUT - "^" entered, exit from this option and return to menu. | 
|---|
| 85 | ; Y - user selection, passed to calling routine for further process: | 
|---|
| 86 | ;        if Y = 1 - display Standard Items on the report only. | 
|---|
| 87 | ;        if Y = 2 - display On-Demand Items on the report only. | 
|---|
| 88 | ;        if Y = 3 - display All Items on the report. | 
|---|
| 89 | ; | 
|---|
| 90 | N X | 
|---|
| 91 | W ! | 
|---|
| 92 | S X(1)=" Select On-Demand/Standard items to include on this report:             " | 
|---|
| 93 | D DISPLAY^PRCPUX2(3,75,.X) | 
|---|
| 94 | ; Choose one | 
|---|
| 95 | K DIR | 
|---|
| 96 | S DIR(0)="S^1:Standard Items Only;2:On-Demand Items Only;3:All Items (Both Standard and On-Demand)" | 
|---|
| 97 | S DIR("A")="Display information for" | 
|---|
| 98 | D ^DIR | 
|---|
| 99 | K DIR | 
|---|
| 100 | Q:$D(DIRUT) 0 | 
|---|
| 101 | Q Y | 
|---|
| 102 | ; | 
|---|
| 103 | SRTPRMP(Y) ; Display prompt for On-Demand Items SORT selection | 
|---|
| 104 | ; | 
|---|
| 105 | ; DIRUT - "^" entered, exit from this option and return to menu. | 
|---|
| 106 | ; Y - user selection, passed to calling routine for further process: | 
|---|
| 107 | ;     If Y = 1, report sorted by Item Description | 
|---|
| 108 | ;        Y = 2, report sorted by Item Number | 
|---|
| 109 | N X | 
|---|
| 110 | W ! | 
|---|
| 111 | S X(1)=" Select the order in which you want the item information to appear.      " | 
|---|
| 112 | D DISPLAY^PRCPUX2(3,42,.X) | 
|---|
| 113 | K DIR | 
|---|
| 114 | S DIR(0)="S^1:ITEM DESCRIPTION;2:ITEM NUMBER" | 
|---|
| 115 | S DIR("A")="Sort By" | 
|---|
| 116 | D ^DIR | 
|---|
| 117 | K DIR | 
|---|
| 118 | Q:$D(DIRUT) 0 | 
|---|
| 119 | Q Y | 
|---|
| 120 | ; | 
|---|
| 121 | SINGIT(PRCPIP) ; Prompt for selecting a single item or all items | 
|---|
| 122 | ; *98 Used by PRCPRODA | 
|---|
| 123 | ; ITEMSEL=NULL for all items selected or non-NULL for a single item | 
|---|
| 124 | N XP,ITEMSEL | 
|---|
| 125 | SING1 S %=0,ITEMSEL="" | 
|---|
| 126 | W ! | 
|---|
| 127 | W "To select All items, press RETURN." | 
|---|
| 128 | S ITEMSEL=$$ITEM^PRCPUITM(PRCPIP,0,"","") | 
|---|
| 129 | I ITEMSEL=0 D  G SING1:%=2 | 
|---|
| 130 | .S XP="Do you want to select ALL items" | 
|---|
| 131 | .W ! | 
|---|
| 132 | .S %=$$YN^PRCPUYN(1) | 
|---|
| 133 | .I %=1 S ITEMSEL="" Q | 
|---|
| 134 | .S ITEMSEL="^" | 
|---|
| 135 | Q ITEMSEL | 
|---|