source: FOIAVistA/tag/r/IFCAP-PRC-PRX--PRCA--PRCN/PRCPRISP.m@ 1582

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

initial load of FOIAVistA 6/30/08 version

File size: 4.8 KB
Line 
1PRCPRISP ;WISC/RFJ/DWA-inventory sales (primary) ;24 May 93
2 ;;5.1;IFCAP;**41**;Oct 20, 2000
3 ;Per VHA Directive 10-93-142, this routine should not be modified.
4 Q
5 ;
6 ;
7PRIMARY ; inventory sales for primary
8 N DATEEND,DATESTRT,DISTRALL,PRCPSUMM,X
9 K X S X(1)="The Inventory Sales Report will display all sales from the Primary to the Secondary inventory points. This report is sorted by description, the distribution point, and date issued." D DISPLAY^PRCPUX2(40,79,.X)
10 K X S X(1)="Select the DISTRIBUTION POINTS to display" D DISPLAY^PRCPUX2(2,40,.X)
11 D DISTRSEL^PRCPURS3(PRCP("I"))
12 I '$G(DISTRALL),'$O(^TMP($J,"PRCPURS3","YES",0)) W !,"*** NO DISTRIBUTION POINTS SELECTED !" D Q Q
13 K X S X(1)="Select the range of ISSUE DATES to display" W !! D DISPLAY^PRCPUX2(2,40,.X)
14 D DATESEL^PRCPURS2("Issue") I '$G(DATEEND) D Q Q
15 S PRCPSUMM=$$SUMMARY^PRCPURS0 I PRCPSUMM<0 D Q Q
16 W ! S %ZIS="Q" D ^%ZIS G:POP Q I $D(IO("Q")) D D ^%ZTLOAD K IO("Q"),ZTSK D Q Q
17 . S ZTDESC="Primary Inventory Sales Report",ZTRTN="DQ^PRCPRISP"
18 . S ZTSAVE("PRCP*")="",ZTSAVE("DATE*")="",ZTSAVE("DISTRALL")="",ZTSAVE("^TMP($J,""PRCPURS3"",")="",ZTSAVE("ZTREQ")="@"
19 W !!,"<*> please wait <*>"
20DQ ; queue starts here
21 N %,%H,%I,DA,DATA,DATE,DATEEDT,DATESDT,DESCR,DISTRNM,DISTRPT,ITEMDA,ITEMDATA,NOW,PAGE,PRCPDATA,PRCPFLAG,SCREEN,TOTALQ,TOTALQI,TOTALV,TOTALVI,TYPE,X,Y
22 K ^TMP($J,"PRCPRISP"),^TMP($J,"PRCPRISP TOT")
23 S DATE=DATESTRT-.01 F S DATE=$O(^PRCP(445.2,"AX",PRCP("I"),DATE)) Q:'DATE!(DATE>DATEEND) F TYPE="R","C","E","U","S" S DA=0 F S DA=$O(^PRCP(445.2,"AX",PRCP("I"),DATE,TYPE,DA)) Q:'DA D
24 . S DATA=$G(^PRCP(445.2,DA,0)) I DATA="" Q
25 . S ITEMDA=$P(DATA,"^",5),DESCR=$$DESCR^PRCPUX1(PRCP("I"),ITEMDA) S:DESCR="" DESCR=" "
26 . S DISTRPT=+$P(DATA,"^",18)
27 . I 'DISTRPT,'$G(DISTRALL) Q
28 . I $G(DISTRALL),$D(^TMP($J,"PRCPURS3","NO",DISTRPT)) Q
29 . I '$G(DISTRALL),'$D(^TMP($J,"PRCPURS3","YES",DISTRPT)) Q
30 . S DISTRNM=$$INVNAME^PRCPUX1(DISTRPT) S:DISTRNM="" DISTRNM=" "
31 . S $P(DATA,"^",7)=-$P(DATA,"^",7),$P(DATA,"^",23)=-$P(DATA,"^",23)
32 . I '$P(DATA,"^",23) S $P(DATA,"^",23)=$J($P(DATA,"^",7)*$P(DATA,"^",8),0,2)
33 . ;I $P(DATA,"^",23)<0 S $P(DATA,"^",23)=-$P(DATA,"^",23)
34 . S ^TMP($J,"PRCPRISP",$E(DESCR,1,10),ITEMDA,$E(DISTRNM,1,24),DATE,DA)=$P(DATA,"^",7)_"^"_$S('$P(DATA,"^",7):0,1:$J($P(DATA,"^",23)/$P(DATA,"^",7),0,3))_"^"_$P(DATA,"^",23)
35 ; print report
36 S Y=DATESTRT D DD^%DT S DATESDT=Y,Y=DATEEND D DD^%DT S DATEEDT=Y
37 D NOW^%DTC S Y=% D DD^%DT S NOW=Y,PAGE=1,SCREEN=$$SCRPAUSE^PRCPUREP U IO D H
38 S DESCR="" F S DESCR=$O(^TMP($J,"PRCPRISP",DESCR)) Q:DESCR=""!($G(PRCPFLAG)) S ITEMDA=0 F S ITEMDA=$O(^TMP($J,"PRCPRISP",DESCR,ITEMDA)) Q:'ITEMDA!($G(PRCPFLAG)) D
39 . I $G(ZTQUEUED),$$S^%ZTLOAD S PRCPFLAG=1 W !?10,"<<< TASKMANAGER JOB TERMINATED BY USER >>>" Q
40 . I $Y>(IOSL-6) D:SCREEN P^PRCPUREP Q:$D(PRCPFLAG) D H
41 . S ITEMDATA=$G(^PRCP(445,PRCP("I"),1,ITEMDA,0))
42 . W:'PRCPSUMM !,$E($$DESCR^PRCPUX1(PRCP("I"),ITEMDA),1,38),?39,"[",ITEMDA,"]"
43 . S (TOTALQI,TOTALVI)=0
44 . S DISTRPT="" F S DISTRPT=$O(^TMP($J,"PRCPRISP",DESCR,ITEMDA,DISTRPT)) Q:DISTRPT=""!($G(PRCPFLAG)) D
45 . . W:'PRCPSUMM !?15,$S(DISTRPT=" ":"<<NONE>>",1:DISTRPT)
46 . . S (TOTALQ,TOTALV)=0
47 . . S DATE=0 F S DATE=$O(^TMP($J,"PRCPRISP",DESCR,ITEMDA,DISTRPT,DATE)) Q:'DATE!($G(PRCPFLAG)) S DA=0 F S DA=$O(^TMP($J,"PRCPRISP",DESCR,ITEMDA,DISTRPT,DATE,DA)) Q:'DA!($G(PRCPFLAG)) S PRCPDATA=^(DA) D
48 . . . W:'PRCPSUMM ?40,$E(DATE,4,5),"/",$E(DATE,6,7),"/",$E(DATE,2,3),$J($P(PRCPDATA,"^"),10),$J($P(PRCPDATA,"^",2),10,3),$J($P(PRCPDATA,"^",3),12,2),!
49 . . . S TOTALQ=TOTALQ+$P(PRCPDATA,"^"),TOTALV=TOTALV+$P(PRCPDATA,"^",3)
50 . . . I $Y>(IOSL-6) D:SCREEN P^PRCPUREP Q:$D(PRCPFLAG) D H W !
51 . . I $G(PRCPFLAG) Q
52 . . S TOTALQI=TOTALQI+TOTALQ,TOTALVI=TOTALVI+TOTALV
53 . . S ^TMP($J,"PRCPRISP TOT",DISTRPT)=$G(^TMP($J,"PRCPRISP TOT",DISTRPT))+TOTALV
54 . . I 'PRCPSUMM W:$X>20 ! W ?27,"TOTALS BY DISTR. PT: ",$J(TOTALQ,10),$J(TOTALV,22,2)
55 . I $G(PRCPFLAG) Q
56 . W:'PRCPSUMM !?32,"TOTALS BY ITEM: ",$J(TOTALQI,10),$J(TOTALVI,22,2)
57 I $G(PRCPFLAG) D Q Q
58 I $Y>(IOSL-8) D:SCREEN P^PRCPUREP Q:$D(PRCPFLAG) D H
59 W !!,"TOTAL SALES TO DISTRIBUTION POINTS:"
60 S TOTALV=0,DISTRPT="" F S DISTRPT=$O(^TMP($J,"PRCPRISP TOT",DISTRPT)) Q:DISTRPT=""!($G(PRCPFLAG)) S %=$G(^(DISTRPT)) D
61 . W !?10,DISTRPT,?40,$J(%,20,2)
62 . S TOTALV=TOTALV+%
63 . I $Y>(IOSL-4) D:SCREEN P^PRCPUREP Q:$D(PRCPFLAG) D H
64 I $G(PRCPFLAG) D Q Q
65 W !?10,"TOTAL",?40,$J(TOTALV,20,2)
66 D END^PRCPUREP
67Q D ^%ZISC K ^TMP($J,"PRCPURS3"),^TMP($J,"PRCPRISP"),^TMP($J,"PRCPRISP TOT")
68 Q
69 ;
70H S %=NOW_" PAGE "_PAGE,PAGE=PAGE+1 I PAGE'=2!(SCREEN) W @IOF
71 W $C(13),"INVENTORY SALES FOR: ",$E(PRCP("IN"),1,20),?(80-$L(%)),%
72 W !?5,"INVENTORY SALES DATE RANGE: ",DATESDT," TO ",DATEEDT
73 S %="",$P(%,"-",81)=""
74 I PRCPSUMM W !?1,"*** ONLY SUMMARY OF SALES PRINTED ***",!,% Q
75 W !,"DESCRIPTION",?37,"DATE ISSUED",$J("QUANTITY",10),$J("SELL COST",10),$J("TOTAL VALUE",12),!,%
76 Q
Note: See TracBrowser for help on using the repository browser.