source: FOIAVistA/trunk/r/IFCAP-PRC-PRX--PRCA--PRCN/PRCPRCTP.m@ 1328

Last change on this file since 1328 was 628, checked in by George Lilly, 15 years ago

initial load of FOIAVistA 6/30/08 version

File size: 4.1 KB
Line 
1PRCPRCTP ;WISC/RFJ/DST-cost trend analysis (primary) ;26 May 93
2 ;;5.1;IFCAP;**98**;Oct 20, 2000;Build 37
3 ;Per VHA Directive 2004-038, this routine should not be modified.
4 Q
5 ;
6 ;
7PRIMARY ; cost trend analysis for primary
8 ; There is no Cost Trend Analysis for secondary
9 N %,%H,%I,DATEEND,DATESTRT,PRCPALLI,PRCPSUMM,X,X1,X2,Y
10 N ODI ; On-Demand Item flag
11 K X S X(1)="The Cost Trend Analysis Report will compute the average item cost for the specified period based on the monthly opening balance last receipt cost."
12 S X(2)="It will compare the computed average item cost with the current monthly opening balance average cost and display the percent increase or decrease change."
13 S X(3)="The report will sort Primary inventory items by description."
14 D DISPLAY^PRCPUX2(40,79,.X)
15 K X S X(1)="Enter the date range (month-year) for computing the average item cost." D DISPLAY^PRCPUX2(2,40,.X)
16 D MONTHSEL^PRCPURS2 I '$G(DATEEND) Q
17 K X S X(1)="Select the Items to display." W ! D DISPLAY^PRCPUX2(2,40,.X)
18 D ITEMSEL^PRCPURS4 I '$G(PRCPALLI),'$O(^TMP($J,"PRCPURS4",0)) Q
19 S PRCPSUMM=$$SUMMARY^PRCPURS0 I PRCPSUMM<0 Q
20 W ! S %ZIS="Q" D ^%ZIS G:POP Q I $D(IO("Q")) D D ^%ZTLOAD K IO("Q"),ZTSK D Q Q
21 . S ZTDESC="Cost Trend Analysis",ZTRTN="DQ^PRCPRCTP"
22 . S ZTSAVE("PRCP*")="",ZTSAVE("DATE*")="",ZTSAVE("^TMP($J,""PRCPURS4"",")="",ZTSAVE("ZTREQ")="@"
23 W !!,"<*> please wait <*>"
24DQ ; queue starts here
25 N AVG,CHANGE,COUNT,CURDT,CURRENT,D,DATA,DATE,DATEEDT,DATESDT,DESCR,HDR,ITEMDA,ITEMDATA,NOW,NSN,PAGE,PRCPFLAG,SCREEN,TOTAL
26 K ^TMP($J,"PRCPRCTP")
27 S ITEMDA=0 F S ITEMDA=$O(^PRCP(445,PRCP("I"),1,ITEMDA)) Q:'ITEMDA D
28 . I '$G(PRCPALLI),'$D(^TMP($J,"PRCPURS4",ITEMDA)) Q
29 . S DESCR=$$DESCR^PRCPUX1(PRCP("I"),ITEMDA) S:DESCR="" DESCR=" "
30 . S (COUNT,TOTAL)=0
31 . S DATE=$E(DATESTRT,1,5) F D Q:DATE>$E(DATEEND,1,5)
32 . . S D=$G(^PRCP(445.1,PRCP("I"),1,ITEMDA,1,DATE,0))
33 . . S ^TMP($J,"PRCPRCTP",$E(DESCR,1,15),ITEMDA,DATE)=+$P(D,"^",7)
34 . . I $P(D,"^",7) S COUNT=COUNT+1,TOTAL=TOTAL+$P(D,"^",7)
35 . . S X1=DATE_"00",X2=40 D C^%DTC S DATE=$E(X,1,5)
36 . S AVG=$S(COUNT=0:0,1:$J(TOTAL/COUNT,0,3)),CURRENT=+$P($G(^PRCP(445.1,PRCP("I"),1,ITEMDA,1,$E(DT,1,5),0)),"^",7),CHANGE=$S(AVG=0:"***.**",1:(CURRENT-AVG)/AVG*100)
37 . S ^TMP($J,"PRCPRCTP",$E(DESCR,1,15),ITEMDA,"TOTAL")=AVG_"^"_CURRENT_"^"_CHANGE
38 ; print report
39 D NOW^%DTC S Y=% D DD^%DT S NOW=Y,Y=$E(DT,1,5)_"00" D DD^%DT S CURDT=Y
40 S Y=$E(DATESTRT,1,5)_"00" D DD^%DT S DATESDT=Y,Y=$E(DATEEND,1,5)_"00" D DD^%DT S DATEEDT=Y
41 S PAGE=1,SCREEN=$$SCRPAUSE^PRCPUREP U IO D H
42 S DESCR="" F S DESCR=$O(^TMP($J,"PRCPRCTP",DESCR)) Q:DESCR=""!($G(PRCPFLAG)) S ITEMDA=0 F S ITEMDA=$O(^TMP($J,"PRCPRCTP",DESCR,ITEMDA)) Q:'ITEMDA!($G(PRCPFLAG)) D
43 . I $G(ZTQUEUED),$$S^%ZTLOAD S PRCPFLAG=1 W !?10,"<<< TASKMANAGER JOB TERMINATED BY USER >>>" Q
44 . I $Y>(IOSL-6) D:SCREEN P^PRCPUREP Q:$D(PRCPFLAG) D H
45 . S ITEMDATA=$G(^PRCP(445,PRCP("I"),1,ITEMDA,0))
46 . ; On-Demand Item flag check
47 . S ODI=$$ODITEM^PRCPUX2(PRCP("I"),ITEMDA)
48 . ;
49 . W !!,$E($$DESCR^PRCPUX1(PRCP("I"),ITEMDA),1,33),?35,$J(ITEMDA,6),?42,$S(ODI="Y":"D",1:""),?43,$J($$UNIT^PRCPUX1(PRCP("I"),ITEMDA,"/"),8)
50 . S D=$G(^TMP($J,"PRCPRCTP",DESCR,ITEMDA,"TOTAL"))
51 . W $J($P(D,"^"),9,2),$J($P(D,"^",2),10,2),$J($P(D,"^",3),10,2)
52 . I $G(PRCPSUMM) Q
53 . S DATE=0 F D Q:'DATE!($G(PRCPFLAG))
54 . . S (DATA,HDR)=""
55 . . F COUNT=1:1:9 S DATE=$O(^TMP($J,"PRCPRCTP",DESCR,ITEMDA,DATE)) Q:'DATE S D=^(DATE) D
56 . . . S %=$P("Jan^Feb^Mar^Apr^May^Jun^Jul^Aug^Sep^Oct^Nov^Dec","^",+$E(DATE,4,5))_" "_$E(DATE,2,3),HDR=HDR_$J(%,8)
57 . . . S DATA=DATA_$J(D,8,2)
58 . . I DATA'="" W !?5,HDR,!?5,DATA
59 . . I $Y>(IOSL-6) D:SCREEN P^PRCPUREP Q:$D(PRCPFLAG) D H
60 I '$G(PRCPFLAG) D END^PRCPUREP
61Q D ^%ZISC K ^TMP($J,"PRCPRCTP"),^TMP($J,"PRCPURS4")
62 Q
63 ;
64H S %=NOW_" PAGE "_PAGE,PAGE=PAGE+1 I PAGE'=2!(SCREEN) W @IOF
65 W $C(13),"COST TREND ANALYSIS FOR: ",$E(PRCP("IN"),1,20),?(80-$L(%)),%
66 W !?5,"CUM AVG CALCULATED FROM DATE RANGE: ",DATESDT," TO ",DATEEDT
67 S %="",$P(%,"-",81)="" W !,"DESCRIPTION",?38,"IM",?42,"OD",$J("UNIT/IS",9),$J("CUM AVG",9),$J(CURDT,9),$J("%CHANGE",9),!,%
68 Q
Note: See TracBrowser for help on using the repository browser.