source: WorldVistAEHR/trunk/r/IFCAP-PRC-PRX--PRCA--PRCN/PRCPRDC0.m@ 1226

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

initial load of WorldVistAEHR

File size: 3.7 KB
RevLine 
[613]1PRCPRDC0 ;WISC/RFJ-dietetics cost report (cont) ;27 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 ;
7START ; called from prcprdie to print report
8 N DA,DATA,DATE,DATEEDT,DATESDT,FOOD,FOODDESC,ITEMDA,NOW,NSN,PAGE,PRCPFLAG,SCREEN,REF,TOTALFOO,TOTALINV,TOTALREF,TYPE
9 K ^TMP($J,"PRCPRDIET")
10 S INVPT=0 F S INVPT=$O(^TMP($J,"PRCPRDIE",INVPT)) Q:'INVPT S DATE=DATESTRT-.01 F S DATE=$O(^PRCP(445.2,"AX",INVPT,DATE)) Q:'DATE!(DATE>DATEEND) D
11 . F TYPE="R","C","E","RC" S DA=0 F S DA=$O(^PRCP(445.2,"AX",INVPT,DATE,TYPE,DA)) Q:'DA D
12 . . S DATA=$G(^PRCP(445.2,DA,0)) I DATA="" Q
13 . . S ITEMDA=$P(DATA,"^",5),NSN=$$NSN^PRCPUX1(ITEMDA),FOOD=$$FOOD^PRCPUX1(ITEMDA) S:NSN="" NSN=" " S:FOOD="" FOOD=" "
14 . . S REF=$P(DATA,"^",15) S:REF="" REF=" "
15 . . I '$P(DATA,"^",22) S $P(DATA,"^",22)=$J($P(DATA,"^",7)*$P(DATA,"^",9),0,2)
16 . . S ^TMP($J,"PRCPRDIET",INVPT,FOOD,REF,NSN,ITEMDA,DATE,DA)=$P(DATA,"^",6)_"^"_$P(DATA,"^",7)_"^"_$P(DATA,"^",22)
17 ; print report
18 S Y=DATESTRT D DD^%DT S DATESDT=Y,Y=DATEEND D DD^%DT S DATEEDT=Y
19 D NOW^%DTC S Y=% D DD^%DT S NOW=Y,PAGE=1,SCREEN=$$SCRPAUSE^PRCPUREP U IO
20 S INVPT=0 F S INVPT=$O(^TMP($J,"PRCPRDIET",INVPT)) Q:'INVPT!($G(PRCPFLAG)) D
21 . S PRCPIN=$$INVNAME^PRCPUX1(INVPT) D H
22 . S TOTALINV=0
23 . S FOOD="" F S FOOD=$O(^TMP($J,"PRCPRDIET",INVPT,FOOD)) Q:FOOD=""!($G(PRCPFLAG)) D
24 . . I $G(ZTQUEUED),$$S^%ZTLOAD S PRCPFLAG=1 W !?10,"<<< TASKMANAGER JOB TERMINATED BY USER >>>" Q
25 . . I $Y>(IOSL-6) D:SCREEN P^PRCPUREP Q:$D(PRCPFLAG) D H
26 . . S TOTALFOO=0
27 . . S FOODDESC=$P($G(^DD(441,20,0)),"^",3),FOODDESC=$S(FOOD=" ":"NO FOOD GROUP DESCRIPTION",1:$P($P(FOODDESC,";",FOOD),":",2))
28 . . W !!?5,"FOOD GROUP: ",$S(FOOD=" ":"X",1:FOOD)," (",$E(FOODDESC,1,50),")"
29 . . S REF="" F S REF=$O(^TMP($J,"PRCPRDIET",INVPT,FOOD,REF)) Q:REF=""!($G(PRCPFLAG)) D
30 . . . S TOTALREF=0
31 . . . S NSN="" F S NSN=$O(^TMP($J,"PRCPRDIET",INVPT,FOOD,REF,NSN)) Q:NSN=""!($G(PRCPFLAG)) S ITEMDA=0 F S ITEMDA=$O(^TMP($J,"PRCPRDIET",INVPT,FOOD,REF,NSN,ITEMDA)) Q:'ITEMDA!($G(PRCPFLAG)) D
32 . . . . S DATE=0 F S DATE=$O(^TMP($J,"PRCPRDIET",INVPT,FOOD,REF,NSN,ITEMDA,DATE)) Q:'DATE!($G(PRCPFLAG)) S DA=0 F S DA=$O(^TMP($J,"PRCPRDIET",INVPT,FOOD,REF,NSN,ITEMDA,DATE,DA)) Q:'DA!($G(PRCPFLAG)) S DATA=^(DA) D
33 . . . . . W !,$TR(NSN,"-"),?15,$E($$DESCR^PRCPUX1(INVPT,ITEMDA),1,15),?31,ITEMDA,?37,$J($P(DATA,"^"),8),$J($P(DATA,"^",2),8),$J($P(DATA,"^",3),10,2),$J(REF,7)
34 . . . . . W $J($E(DATE,4,5)_"-"_$E(DATE,6,7)_"-"_$E(DATE,2,3),10)
35 . . . . . S TOTALREF=TOTALREF+$P(DATA,"^",3)
36 . . . . . I $Y>(IOSL-6) D:SCREEN P^PRCPUREP Q:$D(PRCPFLAG) D H
37 . . . I $G(PRCPFLAG) Q
38 . . . W !,$J("SUBTOTAL REFERENCE NUMBER "_$S(REF=" ":"XXXXX",1:REF)_":",50),$J(TOTALREF,13,2)
39 . . . S TOTALFOO=TOTALFOO+TOTALREF
40 . . . I $Y>(IOSL-6) D:SCREEN P^PRCPUREP Q:$D(PRCPFLAG) D H
41 . . I $G(PRCPFLAG) Q
42 . . S %=$P($G(^DD(441,20,0)),"^",3),%=$S(FOOD=" ":"NO FOOD GROUP DESCRIPTION",1:$P($P(%,";",FOOD),":",2))
43 . . W !,$J("TOTAL FOOD GROUP "_$S(FOOD=" ":"X",1:FOOD)_" ("_$E(%,1,25)_"):",50),$J(TOTALFOO,13,2)
44 . . S TOTALINV=TOTALINV+TOTALFOO
45 . . I $Y>(IOSL-6) D:SCREEN P^PRCPUREP Q:$D(PRCPFLAG) D H
46 . I $G(PRCPFLAG) Q
47 . W !,$J("TOTALS FOR INVENTORY POINT:",50),$J(TOTALINV,13,2)
48 I '$G(PRCPFLAG) D END^PRCPUREP
49 Q
50 ;
51H S %=NOW_" PAGE "_PAGE,PAGE=PAGE+1 I PAGE'=2!(SCREEN) W @IOF
52 W $C(13),"DIETETIC COST REPORT FOR: ",$E(PRCPIN,1,20),?(80-$L(%)),%
53 W !?5,"ITEMS RECEIVED IN INVENTORY POINT BETWEEN DATES: ",DATESDT," to ",DATEEDT
54 S %="",$P(%,"-",81)="" W !,"NSN",?15,"DESCRIPTION",?31,"IM#",?37,$J("UNITS",8),$J("QTY",8),$J("TOTAL $",10),$J("REF#",7),$J("REC DT",10),!,%
55 Q
Note: See TracBrowser for help on using the repository browser.