PRCPRGRA ;WISC/RFJ-graph using list manager ;09 Feb 94
;;5.1;IFCAP;;Oct 20, 2000
;Per VHA Directive 10-93-142, this routine should not be modified.
D ^PRCPUSEL Q:'$G(PRCP("I"))
N BARCHART,ITEMDA,PRCPINPT,PRCPFAVG
S PRCPINPT=PRCP("I")
F W !! S ITEMDA=$$ITEM^PRCPUITM(PRCP("I"),0,"","") Q:'ITEMDA D
. S XP="Do you want a BAR CHART",XH="Enter YES to display a BARCHART, NO to display a LINE CHART"
. W ! S %=$$YN^PRCPUYN(1) I %<1 Q
. S BARCHART=$S(%=1:1,1:0)
. S XP="Do you want to include ZERO values when calculating the AVERAGE",XH="Enter YES to include ZERO values when calculating the AVERAGE, NO to calculate",XH(1)="average using values greater than zero."
. W ! S %=$$YN^PRCPUYN(1) I %<1 Q
. S PRCPFAVG=$S(%=1:1,1:0)
. D EN^VALM("PRCP GRAPH DATA")
Q
;
;
HDR ; build header
S VALMHDR(1)="INVENTORY POINT: "_$$INVNAME^PRCPUX1(PRCPINPT)_" * * * ITEM MASTER NUMBER: "_ITEMDA_" * * *"
S VALMHDR(2)=" DESCRIPTION: "_$$DESCR^PRCPUX1(PRCPINPT,ITEMDA)_" NSN: "_$$NSN^PRCPUX1(ITEMDA)
Q
;
;
INIT ; build array
N DATA,DATE,X1,X2,YLINE
S X1=DT,X2=-400 D C^%DTC S DATE=$E(X,1,5)
F S DATE=DATE+1 S:$E(DATE,4,5)=13 DATE=($E(DATE,1,3)+1)_"01" Q:DATE>$E(DT,1,5) D
. S DATA(DATE)=+$P($G(^PRCP(445,PRCPINPT,1,ITEMDA,2,DATE,0)),"^",2)
D GETGRAPH^PRCPRGRU("*** AMOUNT USED VERSUS MONTH-YR USED ***","AMOUNT USED","MONTH-YR","S Y=X D DD^%DT S X(1)=$E(X,2,3),X=$E(Y,1,3)",BARCHART,PRCPFAVG,.DATA)
K ^TMP($J,"PRCPRGRA")
F VALMCNT=1:1 Q:'$D(YLINE(VALMCNT)) S ^TMP($J,"PRCPRGRA",VALMCNT,0)=YLINE(VALMCNT)
S VALMCNT=VALMCNT-1
Q
;
;
EXIT ; exit and clean up
K ^TMP($J,"PRCPRGRA")
Q
--- Routine Detail --- with STRUCTURED ROUTINE LISTING ---[H[J[2J[HPRCPRGRA 1683 printed Dec 13, 2024@02:14:53 Page 2
PRCPRGRA ;WISC/RFJ-graph using list manager ;09 Feb 94
+1 ;;5.1;IFCAP;;Oct 20, 2000
+2 ;Per VHA Directive 10-93-142, this routine should not be modified.
+3 DO ^PRCPUSEL
if '$GET(PRCP("I"))
QUIT
+4 NEW BARCHART,ITEMDA,PRCPINPT,PRCPFAVG
+5 SET PRCPINPT=PRCP("I")
+6 FOR
WRITE !!
SET ITEMDA=$$ITEM^PRCPUITM(PRCP("I"),0,"","")
if 'ITEMDA
QUIT
Begin DoDot:1
+7 SET XP="Do you want a BAR CHART"
SET XH="Enter YES to display a BARCHART, NO to display a LINE CHART"
+8 WRITE !
SET %=$$YN^PRCPUYN(1)
IF %<1
QUIT
+9 SET BARCHART=$SELECT(%=1:1,1:0)
+10 SET XP="Do you want to include ZERO values when calculating the AVERAGE"
SET XH="Enter YES to include ZERO values when calculating the AVERAGE, NO to calculate"
SET XH(1)="average using values greater than zero."
+11 WRITE !
SET %=$$YN^PRCPUYN(1)
IF %<1
QUIT
+12 SET PRCPFAVG=$SELECT(%=1:1,1:0)
+13 DO EN^VALM("PRCP GRAPH DATA")
End DoDot:1
+14 QUIT
+15 ;
+16 ;
HDR ; build header
+1 SET VALMHDR(1)="INVENTORY POINT: "_$$INVNAME^PRCPUX1(PRCPINPT)_" * * * ITEM MASTER NUMBER: "_ITEMDA_" * * *"
+2 SET VALMHDR(2)=" DESCRIPTION: "_$$DESCR^PRCPUX1(PRCPINPT,ITEMDA)_" NSN: "_$$NSN^PRCPUX1(ITEMDA)
+3 QUIT
+4 ;
+5 ;
INIT ; build array
+1 NEW DATA,DATE,X1,X2,YLINE
+2 SET X1=DT
SET X2=-400
DO C^%DTC
SET DATE=$EXTRACT(X,1,5)
+3 FOR
SET DATE=DATE+1
if $EXTRACT(DATE,4,5)=13
SET DATE=($EXTRACT(DATE,1,3)+1)_"01"
if DATE>$EXTRACT(DT,1,5)
QUIT
Begin DoDot:1
+4 SET DATA(DATE)=+$PIECE($GET(^PRCP(445,PRCPINPT,1,ITEMDA,2,DATE,0)),"^",2)
End DoDot:1
+5 DO GETGRAPH^PRCPRGRU("*** AMOUNT USED VERSUS MONTH-YR USED ***","AMOUNT USED","MONTH-YR","S Y=X D DD^%DT S X(1)=$E(X,2,3),X=$E(Y,1,3)",BARCHART,PRCPFAVG,.DATA)
+6 KILL ^TMP($JOB,"PRCPRGRA")
+7 FOR VALMCNT=1:1
if '$DATA(YLINE(VALMCNT))
QUIT
SET ^TMP($JOB,"PRCPRGRA",VALMCNT,0)=YLINE(VALMCNT)
+8 SET VALMCNT=VALMCNT-1
+9 QUIT
+10 ;
+11 ;
EXIT ; exit and clean up
+1 KILL ^TMP($JOB,"PRCPRGRA")
+2 QUIT