source: WorldVistAEHR/trunk/r/IFCAP-PRC-PRX--PRCA--PRCN/PRCPRISW.m@ 1351

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

initial load of WorldVistAEHR

File size: 3.8 KB
Line 
1PRCPRISW ;WISC/RFJ-inventory sales (print whse) ;24 May 93
2 ;;5.1;IFCAP;;Oct 20, 2000
3 ;Per VHA Directive 10-93-142, this routine should not be modified.
4 Q
5 ;
6 ;
7PRINT ; print whse report
8 N %,%H,%I,DA,DATA,DATE,DATEEDT,DATESDT,DISTRNM,DISTRPT,ITEMDA,ITEMDATA,NOW,NSN,PAGE,PRCPDATA,PRCPFLAG,SCREEN,TOTALQ,TOTALQI,TOTALV,TOTALVI,TYPE,X,Y
9 K ^TMP($J,"PRCPRISR"),^TMP($J,"PRCPRISR TOT")
10 S DATE=DATESTRT-.01 F S DATE=$O(^PRCP(445.2,"AX",PRCP("I"),DATE)) Q:'DATE!(DATE>DATEEND) F TYPE="R","C","E" S DA=0 F S DA=$O(^PRCP(445.2,"AX",PRCP("I"),DATE,TYPE,DA)) Q:'DA D
11 . S DATA=$G(^PRCP(445.2,DA,0)) I DATA="" Q
12 . S ITEMDA=$P(DATA,"^",5),NSN=$$NSN^PRCPUX1(ITEMDA) S:NSN="" NSN=" "
13 . I $E(NSN,1,$L(PRCPSTRT))'=PRCPSTRT,$E(NSN,1,$L(PRCPEND))'=PRCPEND I NSN']PRCPSTRT!(PRCPEND']NSN) Q
14 . S DISTRPT=+$P(DATA,"^",18)
15 . I 'DISTRPT,'$G(DISTRALL) Q
16 . I $G(DISTRALL),$D(^TMP($J,"PRCPURS3","NO",DISTRPT)) Q
17 . I '$G(DISTRALL),'$D(^TMP($J,"PRCPURS3","YES",DISTRPT)) Q
18 . S DISTRNM=$$INVNAME^PRCPUX1(DISTRPT) S:DISTRNM="" DISTRNM=" "
19 . S $P(DATA,"^",7)=-$P(DATA,"^",7)
20 . I '$P(DATA,"^",23) S $P(DATA,"^",23)=$J($P(DATA,"^",7)*$P(DATA,"^",9),0,2)
21 . I $P(DATA,"^",23)<0 S $P(DATA,"^",23)=-$P(DATA,"^",23)
22 . S ^TMP($J,"PRCPRISR",NSN,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)
23 ; print report
24 S Y=DATESTRT D DD^%DT S DATESDT=Y,Y=DATEEND D DD^%DT S DATEEDT=Y
25 D NOW^%DTC S Y=% D DD^%DT S NOW=Y,PAGE=1,SCREEN=$$SCRPAUSE^PRCPUREP U IO D H
26 S NSN="" F S NSN=$O(^TMP($J,"PRCPRISR",NSN)) Q:NSN=""!($G(PRCPFLAG)) S ITEMDA=0 F S ITEMDA=$O(^TMP($J,"PRCPRISR",NSN,ITEMDA)) Q:'ITEMDA!($G(PRCPFLAG)) D
27 . I $G(ZTQUEUED),$$S^%ZTLOAD S PRCPFLAG=1 W !?10,"<<< TASKMANAGER JOB TERMINATED BY USER >>>" Q
28 . I $Y>(IOSL-6) D:SCREEN P^PRCPUREP Q:$D(PRCPFLAG) D H
29 . S ITEMDATA=$G(^PRCP(445,PRCP("I"),1,ITEMDA,0))
30 . W:'PRCPSUMM !,$TR(NSN,"-"),?15,$E($$DESCR^PRCPUX1(PRCP("I"),ITEMDA),1,23),?39,"[",ITEMDA,"]"
31 . S (TOTALQI,TOTALVI)=0
32 . S DISTRPT="" F S DISTRPT=$O(^TMP($J,"PRCPRISR",NSN,ITEMDA,DISTRPT)) Q:DISTRPT=""!($G(PRCPFLAG)) D
33 . . W:'PRCPSUMM !?15,$S(DISTRPT=" ":"<<NONE>>",1:DISTRPT)
34 . . S (TOTALQ,TOTALV)=0
35 . . S DATE=0 F S DATE=$O(^TMP($J,"PRCPRISR",NSN,ITEMDA,DISTRPT,DATE)) Q:'DATE!($G(PRCPFLAG)) S DA=0 F S DA=$O(^TMP($J,"PRCPRISR",NSN,ITEMDA,DISTRPT,DATE,DA)) Q:'DA!($G(PRCPFLAG)) S PRCPDATA=^(DA) D
36 . . . 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),!
37 . . . S TOTALQ=TOTALQ+$P(PRCPDATA,"^"),TOTALV=TOTALV+$P(PRCPDATA,"^",3)
38 . . . I $Y>(IOSL-6) D:SCREEN P^PRCPUREP Q:$D(PRCPFLAG) D H W !
39 . . I $G(PRCPFLAG) Q
40 . . S TOTALQI=TOTALQI+TOTALQ,TOTALVI=TOTALVI+TOTALV
41 . . S ^TMP($J,"PRCPRISR TOT",DISTRPT)=$G(^TMP($J,"PRCPRISR TOT",DISTRPT))+TOTALV
42 . . I 'PRCPSUMM W:$X>20 ! W ?27,"TOTALS BY DISTR. PT: ",$J(TOTALQ,10),$J(TOTALV,22,2)
43 . I $G(PRCPFLAG) Q
44 . W:'PRCPSUMM !?32,"TOTALS BY ITEM: ",$J(TOTALQI,10),$J(TOTALVI,22,2)
45 I $G(PRCPFLAG) Q
46 I $Y>(IOSL-8) D:SCREEN P^PRCPUREP Q:$D(PRCPFLAG) D H
47 W !!,"TOTAL SALES TO DISTRIBUTION POINTS:"
48 S TOTALV=0,DISTRPT="" F S DISTRPT=$O(^TMP($J,"PRCPRISR TOT",DISTRPT)) Q:DISTRPT=""!($G(PRCPFLAG)) S %=$G(^(DISTRPT)) D
49 . W !?10,DISTRPT,?40,$J(%,20,2)
50 . S TOTALV=TOTALV+%
51 . I $Y>(IOSL-4) D:SCREEN P^PRCPUREP Q:$D(PRCPFLAG) D H
52 I $G(PRCPFLAG) Q
53 W !?10,"TOTAL",?40,$J(TOTALV,20,2)
54 D END^PRCPUREP
55 Q
56 ;
57H S %=NOW_" PAGE "_PAGE,PAGE=PAGE+1 I PAGE'=2!(SCREEN) W @IOF
58 W $C(13),"INVENTORY SALES FOR: ",$E(PRCP("IN"),1,20),?(80-$L(%)),%
59 W !?5,"INVENTORY SALES DATE RANGE: ",DATESDT," TO ",DATEEDT
60 S %="",$P(%,"-",81)=""
61 I PRCPSUMM W !?1,"*** ONLY SUMMARY OF SALES PRINTED ***",!,% Q
62 W !,"NSN",?15,"DESCRIPTION",?37,"DATE ISSUED",$J("QUANTITY",10),$J("SELL COST",10),$J("TOTAL VALUE",12),!,%
63 Q
Note: See TracBrowser for help on using the repository browser.