Home   Package List   Routine Alphabetical List   Global Alphabetical List   FileMan Files List   FileMan Sub-Files List   Package Component Lists   Package-Namespace Mapping  
Routine: PRCPRDC0

PRCPRDC0.m

Go to the documentation of this file.
PRCPRDC0 ;WISC/RFJ-dietetics cost report (cont)                     ;27 May 93
 ;;5.1;IFCAP;;Oct 20, 2000
 ;Per VHA Directive 10-93-142, this routine should not be modified.
 Q
 ;
 ;
START ;  called from prcprdie to print report
 N DA,DATA,DATE,DATEEDT,DATESDT,FOOD,FOODDESC,ITEMDA,NOW,NSN,PAGE,PRCPFLAG,SCREEN,REF,TOTALFOO,TOTALINV,TOTALREF,TYPE
 K ^TMP($J,"PRCPRDIET")
 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
 .   F TYPE="R","C","E","RC" S DA=0 F  S DA=$O(^PRCP(445.2,"AX",INVPT,DATE,TYPE,DA)) Q:'DA  D
 .   .   S DATA=$G(^PRCP(445.2,DA,0)) I DATA="" Q
 .   .   S ITEMDA=$P(DATA,"^",5),NSN=$$NSN^PRCPUX1(ITEMDA),FOOD=$$FOOD^PRCPUX1(ITEMDA) S:NSN="" NSN=" " S:FOOD="" FOOD=" "
 .   .   S REF=$P(DATA,"^",15) S:REF="" REF=" "
 .   .   I '$P(DATA,"^",22) S $P(DATA,"^",22)=$J($P(DATA,"^",7)*$P(DATA,"^",9),0,2)
 .   .   S ^TMP($J,"PRCPRDIET",INVPT,FOOD,REF,NSN,ITEMDA,DATE,DA)=$P(DATA,"^",6)_"^"_$P(DATA,"^",7)_"^"_$P(DATA,"^",22)
 ;  print report
 S Y=DATESTRT D DD^%DT S DATESDT=Y,Y=DATEEND D DD^%DT S DATEEDT=Y
 D NOW^%DTC S Y=% D DD^%DT S NOW=Y,PAGE=1,SCREEN=$$SCRPAUSE^PRCPUREP U IO
 S INVPT=0 F  S INVPT=$O(^TMP($J,"PRCPRDIET",INVPT)) Q:'INVPT!($G(PRCPFLAG))  D
 .   S PRCPIN=$$INVNAME^PRCPUX1(INVPT) D H
 .   S TOTALINV=0
 .   S FOOD="" F  S FOOD=$O(^TMP($J,"PRCPRDIET",INVPT,FOOD)) Q:FOOD=""!($G(PRCPFLAG))  D
 .   .   I $G(ZTQUEUED),$$S^%ZTLOAD S PRCPFLAG=1 W !?10,"<<< TASKMANAGER JOB TERMINATED BY USER >>>" Q
 .   .   I $Y>(IOSL-6) D:SCREEN P^PRCPUREP Q:$D(PRCPFLAG)  D H
 .   .   S TOTALFOO=0
 .   .   S FOODDESC=$P($G(^DD(441,20,0)),"^",3),FOODDESC=$S(FOOD=" ":"NO FOOD GROUP DESCRIPTION",1:$P($P(FOODDESC,";",FOOD),":",2))
 .   .   W !!?5,"FOOD GROUP: ",$S(FOOD=" ":"X",1:FOOD),"  (",$E(FOODDESC,1,50),")"
 .   .   S REF="" F  S REF=$O(^TMP($J,"PRCPRDIET",INVPT,FOOD,REF)) Q:REF=""!($G(PRCPFLAG))  D
 .   .   .   S TOTALREF=0
 .   .   .   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
 .   .   .   .   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
 .   .   .   .   .   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)
 .   .   .   .   .   W $J($E(DATE,4,5)_"-"_$E(DATE,6,7)_"-"_$E(DATE,2,3),10)
 .   .   .   .   .   S TOTALREF=TOTALREF+$P(DATA,"^",3)
 .   .   .   .   .   I $Y>(IOSL-6) D:SCREEN P^PRCPUREP Q:$D(PRCPFLAG)  D H
 .   .   .   I $G(PRCPFLAG) Q
 .   .   .   W !,$J("SUBTOTAL REFERENCE NUMBER "_$S(REF=" ":"XXXXX",1:REF)_":",50),$J(TOTALREF,13,2)
 .   .   .   S TOTALFOO=TOTALFOO+TOTALREF
 .   .   .   I $Y>(IOSL-6) D:SCREEN P^PRCPUREP Q:$D(PRCPFLAG)  D H
 .   .   I $G(PRCPFLAG) Q
 .   .   S %=$P($G(^DD(441,20,0)),"^",3),%=$S(FOOD=" ":"NO FOOD GROUP DESCRIPTION",1:$P($P(%,";",FOOD),":",2))
 .   .   W !,$J("TOTAL FOOD GROUP "_$S(FOOD=" ":"X",1:FOOD)_" ("_$E(%,1,25)_"):",50),$J(TOTALFOO,13,2)
 .   .   S TOTALINV=TOTALINV+TOTALFOO
 .   .   I $Y>(IOSL-6) D:SCREEN P^PRCPUREP Q:$D(PRCPFLAG)  D H
 .   I $G(PRCPFLAG) Q
 .   W !,$J("TOTALS FOR INVENTORY POINT:",50),$J(TOTALINV,13,2)
 I '$G(PRCPFLAG) D END^PRCPUREP
 Q
 ;
H S %=NOW_"  PAGE "_PAGE,PAGE=PAGE+1 I PAGE'=2!(SCREEN) W @IOF
 W $C(13),"DIETETIC COST REPORT FOR: ",$E(PRCPIN,1,20),?(80-$L(%)),%
 W !?5,"ITEMS RECEIVED IN INVENTORY POINT BETWEEN DATES: ",DATESDT," to ",DATEEDT
 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),!,%
 Q