1 | PRCPRQDR ;WISC/RFJ-quantity distribution report (option, whse) ;10 Jun 93
|
---|
2 | V ;;5.1;IFCAP;**1**;Oct 20, 2000
|
---|
3 | ;Per VHA Directive 10-93-142, this routine should not be modified.
|
---|
4 | D ^PRCPUSEL Q:'$G(PRCP("I"))
|
---|
5 | I PRCP("DPTYPE")="P" D PRIMARY^PRCPRQDP Q
|
---|
6 | I PRCP("DPTYPE")="S" D SECONDY^PRCPRQDP Q
|
---|
7 | ;
|
---|
8 | ; quantity distribution report for whse
|
---|
9 | N PRCPEND,PRCPSTRT,X
|
---|
10 | K X S X(1)="The Quantity Distribution Report will display all sales from the Warehouse to the Primary inventory points. This report is sorted by NSN and date issued."
|
---|
11 | D DISPLAY^PRCPUX2(40,79,.X)
|
---|
12 | ;
|
---|
13 | K X S X(1)="Select the range of NSNs to display"
|
---|
14 | W !! D DISPLAY^PRCPUX2(2,40,.X)
|
---|
15 | D NSNSEL^PRCPURS0
|
---|
16 | I '$D(PRCPSTRT) Q
|
---|
17 | ;
|
---|
18 | W ! S %ZIS="Q" D ^%ZIS
|
---|
19 | G:POP Q
|
---|
20 | I $D(IO("Q")) D D ^%ZTLOAD K IO("Q"),ZTSK D Q Q
|
---|
21 | . S ZTDESC="Quantity Distribution Report",ZTRTN="DQ^PRCPRQDR"
|
---|
22 | . S ZTSAVE("PRCP*")="",ZTSAVE("ZTREQ")="@"
|
---|
23 | W !!,"<*> please wait <*>"
|
---|
24 | ;
|
---|
25 | DQ ; queue starts here
|
---|
26 | N %,%H,%I,COUNT,CURRENT,DA,DATA,DATE,DATEDAT,DATEEDT,DATESDT,DATESTRT,H,ITEMDA,ITEMDATA,L,NOW,NSN,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"
|
---|
29 | S X1=$E(DT,1,5)_"15"
|
---|
30 | S X2=-375
|
---|
31 | D C^%DTC S (DATESTRT,Y)=$E(X,1,5)_"00"
|
---|
32 | D DD^%DT S DATEDAT($E(X,1,5))=$P(Y," ")_$E(X,2,3)
|
---|
33 | S DATE=$E(DATESTRT,1,5)_"15"
|
---|
34 | F S X1=DATE,X2=30 D Q:$E(X,1,5)'<$E(CURRENT,1,5) S DATE=$E(X,1,5)_"15"
|
---|
35 | . D C^%DTC S Y=$E(X,1,5)_"00"
|
---|
36 | . D DD^%DT
|
---|
37 | . S DATEDAT($E(X,1,5))=$P(Y," ")_$E(X,2,3)
|
---|
38 | K ^TMP($J,"PRCPRQDR")
|
---|
39 | ;
|
---|
40 | S DATE=DATESTRT-.01
|
---|
41 | F S DATE=$O(^PRCP(445.2,"AX",PRCP("I"),DATE)) Q:'DATE!($E(DATE,1,5)>$E(CURRENT,1,5)) F TYPE="R","C","E" S DA=0 F S DA=$O(^PRCP(445.2,"AX",PRCP("I"),DATE,TYPE,DA)) Q:'DA D
|
---|
42 | . S DATA=$G(^PRCP(445.2,DA,0)) I DATA="" Q
|
---|
43 | . S ITEMDA=$P(DATA,"^",5),NSN=$$NSN^PRCPUX1(ITEMDA) S:NSN="" NSN=" "
|
---|
44 | . I $E(NSN,1,$L(PRCPSTRT))'=PRCPSTRT,$E(NSN,1,$L(PRCPEND))'=PRCPEND I NSN']PRCPSTRT!(PRCPEND']NSN) Q
|
---|
45 | . S $P(DATA,"^",7)=-$P(DATA,"^",7)
|
---|
46 | . I '$P(DATA,"^",23) S $P(DATA,"^",23)=$J($P(DATA,"^",7)*$P(DATA,"^",9),0,2)
|
---|
47 | . I $P(DATA,"^",23)<0 S $P(DATA,"^",23)=-$P(DATA,"^",23)
|
---|
48 | . S %=$G(^TMP($J,"PRCPRQDR",NSN,ITEMDA,$E(DATE,1,5)))
|
---|
49 | . S ^TMP($J,"PRCPRQDR",NSN,ITEMDA,$E(DATE,1,5))=($P(DATA,"^",7)+$P(%,"^"))_"^"_($P(DATA,"^",23)+$P(%,"^",2))
|
---|
50 | ; print report
|
---|
51 | S Y=DATESTRT D DD^%DT S DATESDT=Y,Y=DT D DD^%DT S DATEEDT=Y
|
---|
52 | D NOW^%DTC S Y=% D DD^%DT S NOW=Y
|
---|
53 | S PAGE=1,SCREEN=$$SCRPAUSE^PRCPUREP U IO D H
|
---|
54 | S NSN=""
|
---|
55 | F S NSN=$O(^TMP($J,"PRCPRQDR",NSN)) Q:NSN=""!($G(PRCPFLAG)) S ITEMDA=0 F S ITEMDA=$O(^TMP($J,"PRCPRQDR",NSN,ITEMDA)) Q:'ITEMDA!($G(PRCPFLAG)) D
|
---|
56 | . I $G(ZTQUEUED),$$S^%ZTLOAD S PRCPFLAG=1 W !?10,"<<< TASKMANAGER JOB TERMINATED BY USER >>>" Q
|
---|
57 | . I $Y>(IOSL-8) D:SCREEN P^PRCPUREP Q:$D(PRCPFLAG) D H
|
---|
58 | . S ITEMDATA=$G(^PRCP(445,PRCP("I"),1,ITEMDA,0))
|
---|
59 | . W !!,$TR(NSN,"-")
|
---|
60 | . W ?15,$E($$DESCR^PRCPUX1(PRCP("I"),ITEMDA),1,18)
|
---|
61 | . W ?34,ITEMDA
|
---|
62 | . W ?39,$J($$UNIT^PRCPUX1(PRCP("I"),ITEMDA,"/"),7)
|
---|
63 | . W $J($P(ITEMDATA,"^",10),6)
|
---|
64 | . W $J($P(ITEMDATA,"^",4),7)
|
---|
65 | . W $J($P(ITEMDATA,"^",23),7)
|
---|
66 | . W $J($P(ITEMDATA,"^",11),7)
|
---|
67 | . W $J($P(ITEMDATA,"^",9),7)
|
---|
68 | . S (H(0),H(1),Q(0),Q(1),V(0),V(1))=""
|
---|
69 | . S (COUNT,DATE,L,TOTALC,TOTALQ,TOTALV)=0
|
---|
70 | . F S DATE=$O(DATEDAT(DATE)) Q:'DATE S PRCPDATA=$G(^TMP($J,"PRCPRQDR",NSN,ITEMDA,DATE)) D
|
---|
71 | . . S QTY=+$P(PRCPDATA,"^") I QTY=0 S QTY="..."
|
---|
72 | . . S VALUE=$J($P(PRCPDATA,"^",2),0,2) I VALUE="0.00" S VALUE="..."
|
---|
73 | . . I TOTALC'=12 S TOTALQ=TOTALQ+$P(PRCPDATA,"^"),TOTALV=TOTALV+$P(PRCPDATA,"^",2),TOTALC=TOTALC+1
|
---|
74 | . . S H(L)=H(L)_$J(DATEDAT(DATE),10),Q(L)=Q(L)_$J(QTY,10),V(L)=V(L)_$J(VALUE,10),COUNT=COUNT+1
|
---|
75 | . . I COUNT=6 S L=1,COUNT=0
|
---|
76 | . S H(1)=H(1)_$J("AVG",10),Q(1)=Q(1)_$J(TOTALQ/TOTALC,10,0),V(1)=V(1)_$J(TOTALV/TOTALC,10,2)
|
---|
77 | . W !,H(0),?79,"^",!,Q(0),?79,"|",!,V(0),?79,"v",!,H(1),!,Q(1),!,V(1)
|
---|
78 | I $G(PRCPFLAG) D Q Q
|
---|
79 | D END^PRCPUREP
|
---|
80 | Q D ^%ZISC K ^TMP($J,"PRCPRQDR")
|
---|
81 | Q
|
---|
82 | ;
|
---|
83 | H S %=NOW_" PAGE "_PAGE,PAGE=PAGE+1 I PAGE'=2!(SCREEN) W @IOF
|
---|
84 | W $C(13),"QUANTITY DISTRIBUTION REPORT FOR: ",$E(PRCP("IN"),1,20),?(80-$L(%)),%
|
---|
85 | W !?5,"QUANTITY DISTRIBUTION DATE RANGE: ",DATESDT," TO ",DATEEDT
|
---|
86 | S %="",$P(%,"-",81)=""
|
---|
87 | W !?46,$J("STAND",6),$J("OPT",7),$J("TEMP",7),$J("EMER",7),$J("NORM",7),!,"NSN",?15,"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)
|
---|
88 | W !,%
|
---|
89 | Q
|
---|