source: FOIAVistA/trunk/r/IFCAP-PRC-PRX--PRCA--PRCN/PRCPRQDP.m@ 1590

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

initial load of FOIAVistA 6/30/08 version

File size: 4.5 KB
Line 
1PRCPRQDP ;WISC/RFJ-quantity distribution report (primary) ;10 Jun 93
2V ;;5.1;IFCAP;**1**;Oct 20, 2000
3 ;Per VHA Directive 10-93-142, this routine should not be modified.
4 Q
5 ;
6 ;
7PRIMARY ; quantity distribution report for primary
8SECONDY ; quantity distribution report for secondary
9 N PRCPALLI,X
10 K X
11 S X(1)="The Quantity Distribution Report displays all sales from the Primary to the Secondary inventory points."
12 I PRCP("DPTYPE")="S" S X(1)="The Quantity Distribution Report lists all sales from a supply station to a recipient."
13 S X(1)=X(1)_" This report is sorted by description and date issued."
14 D DISPLAY^PRCPUX2(40,79,.X)
15 ;
16 K X S X(1)="Select the Items to display" W !! D DISPLAY^PRCPUX2(2,40,.X)
17 D ITEMSEL^PRCPURS4
18 I '$G(PRCPALLI),'$O(^TMP($J,"PRCPURS4",0)) Q
19 ;
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="Quantity Distribution Report",ZTRTN="DQ^PRCPRQDP"
22 . S ZTSAVE("PRCP*")="",ZTSAVE("^TMP($J,""PRCPURS4"",")="",ZTSAVE("ZTREQ")="@"
23 W !!,"<*> please wait <*>"
24 ;
25DQ ; queue starts here
26 N %,%H,%I,COUNT,CURRENT,DA,DATA,DATE,DATEDAT,DATEEDT,DATESDT,DATESTRT,DESCR,H,ITEMDA,ITEMDATA,L,NOW,PAGE,PRCPDATA,PRCPFLAG,Q,QTY,SCREEN,TOTALC,TOTALQ,TOTALV,TYPE,V,VALUE,X,Y
27 K DATEDAT
28 S CURRENT=$E(DT,1,5)_"00",X1=$E(DT,1,5)_"15",X2=-375
29 D C^%DTC S (DATESTRT,Y)=$E(X,1,5)_"00"
30 D DD^%DT S DATEDAT($E(X,1,5))=$P(Y," ")_$E(X,2,3)
31 S DATE=$E(DATESTRT,1,5)_"15"
32 F S X1=DATE,X2=30 D Q:$E(X,1,5)'<$E(CURRENT,1,5) S DATE=$E(X,1,5)_"15"
33 . D C^%DTC S Y=$E(X,1,5)_"00"
34 . D DD^%DT S DATEDAT($E(X,1,5))=$P(Y," ")_$E(X,2,3)
35 K ^TMP($J,"PRCPRQDP")
36 S DATE=DATESTRT-.01
37 F S DATE=$O(^PRCP(445.2,"AX",PRCP("I"),DATE)) Q:'DATE!($E(DATE,1,5)>$E(CURRENT,1,5)) D SELECT
38 G PRINT
39 ;
40SELECT I PRCP("DPTYPE")="P" F TYPE="R","C","E" D COMPILE
41 I PRCP("DPTYPE")="S" F TYPE="U" D COMPILE
42 Q
43 ;
44COMPILE S DA=0 F S DA=$O(^PRCP(445.2,"AX",PRCP("I"),DATE,TYPE,DA)) Q:'DA D
45 . S DATA=$G(^PRCP(445.2,DA,0)) I DATA="" Q
46 . S ITEMDA=$P(DATA,"^",5)
47 . I '$G(PRCPALLI),'$D(^TMP($J,"PRCPURS4",ITEMDA)) Q
48 . S DESCR=$E($$DESCR^PRCPUX1(PRCP("I"),ITEMDA),1,33) S:DESCR="" DESCR=" "
49 . S $P(DATA,"^",7)=-$P(DATA,"^",7),$P(DATA,"^",23)=-$P(DATA,"^",23)
50 . I '$P(DATA,"^",23) S $P(DATA,"^",23)=$J($P(DATA,"^",7)*$P(DATA,"^",9),0,2)
51 . S %=$G(^TMP($J,"PRCPRQDP",DESCR,ITEMDA,$E(DATE,1,5)))
52 . S ^TMP($J,"PRCPRQDP",DESCR,ITEMDA,$E(DATE,1,5))=($P(DATA,"^",7)+$P(%,"^"))_"^"_($P(DATA,"^",23)+$P(%,"^",2))
53 Q
54 ;
55 ; print report
56PRINT S Y=DATESTRT D DD^%DT S DATESDT=Y,Y=DT D DD^%DT S DATEEDT=Y
57 D NOW^%DTC S Y=% D DD^%DT S NOW=Y
58 S PAGE=1,SCREEN=$$SCRPAUSE^PRCPUREP U IO D H
59 S DESCR="" F S DESCR=$O(^TMP($J,"PRCPRQDP",DESCR)) Q:DESCR=""!($G(PRCPFLAG)) S ITEMDA=0 F S ITEMDA=$O(^TMP($J,"PRCPRQDP",DESCR,ITEMDA)) Q:'ITEMDA!($G(PRCPFLAG)) D
60 . I $G(ZTQUEUED),$$S^%ZTLOAD S PRCPFLAG=1 W !?10,"<<< TASKMANAGER JOB TERMINATED BY USER >>>" Q
61 . I $Y>(IOSL-8) D:SCREEN P^PRCPUREP Q:$D(PRCPFLAG) D H
62 . S ITEMDATA=$G(^PRCP(445,PRCP("I"),1,ITEMDA,0))
63 . W !!,DESCR,?34,ITEMDA
64 . W ?39,$J($$UNIT^PRCPUX1(PRCP("I"),ITEMDA,"/"),7)
65 . W $J($P(ITEMDATA,"^",10),6)
66 . W $J($P(ITEMDATA,"^",4),7)
67 . W $J($P(ITEMDATA,"^",23),7)
68 . W $J($P(ITEMDATA,"^",11),7)
69 . W $J($P(ITEMDATA,"^",9),7)
70 . S (H(0),H(1),Q(0),Q(1),V(0),V(1))=""
71 . S (COUNT,DATE,L,TOTALC,TOTALQ,TOTALV)=0
72 . F S DATE=$O(DATEDAT(DATE)) Q:'DATE S PRCPDATA=$G(^TMP($J,"PRCPRQDP",DESCR,ITEMDA,DATE)) D
73 . . S QTY=+$P(PRCPDATA,"^") I QTY=0 S QTY="..."
74 . . S VALUE=$J($P(PRCPDATA,"^",2),0,2) I VALUE="0.00" S VALUE="..."
75 . . I TOTALC'=12 S TOTALQ=TOTALQ+$P(PRCPDATA,"^"),TOTALV=TOTALV+$P(PRCPDATA,"^",2),TOTALC=TOTALC+1
76 . . S H(L)=H(L)_$J(DATEDAT(DATE),10)
77 . . S Q(L)=Q(L)_$J(QTY,10)
78 . . S V(L)=V(L)_$J(VALUE,10)
79 . . S COUNT=COUNT+1
80 . . I COUNT=6 S L=1,COUNT=0
81 . S H(1)=H(1)_$J("AVG",10)
82 . S Q(1)=Q(1)_$J(TOTALQ/TOTALC,10,0)
83 . S V(1)=V(1)_$J(TOTALV/TOTALC,10,2)
84 . W !,H(0),?79,"^",!,Q(0),?79,"|",!,V(0),?79,"v",!,H(1),!,Q(1),!,V(1)
85 I $G(PRCPFLAG) D Q Q
86 D END^PRCPUREP
87 ;
88Q D ^%ZISC K ^TMP($J,"PRCPRQDP"),^TMP($J,"PRCPURS4")
89 Q
90 ;
91H S %=NOW_" PAGE "_PAGE,PAGE=PAGE+1 I PAGE'=2!(SCREEN) W @IOF
92 W $C(13),"QUANTITY DISTRIBUTION REPORT FOR: ",$E(PRCP("IN"),1,20),?(80-$L(%)),%
93 W !?5,"QUANTITY DISTRIBUTION DATE RANGE: ",DATESDT," TO ",DATEEDT
94 S %="",$P(%,"-",81)=""
95 W !?46,$J("STAND",6),$J("OPT",7),$J("TEMP",7),$J("EMER",7),$J("NORM",7),!,"DESCRIPTION",?34,"MI#",?39,$J("UNIT/IS",7),$J("REOPT",6),$J("REOPT",7),$J("S.LVL",7),$J("S.LVL",7),$J("S.LVL",7)
96 W !,%
97 Q
Note: See TracBrowser for help on using the repository browser.