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
--- Routine Detail --- with STRUCTURED ROUTINE LISTING ---[H[J[2J[HPRCPRDC0 3877 printed Dec 13, 2024@02:14:43 Page 2
PRCPRDC0 ;WISC/RFJ-dietetics cost report (cont) ;27 May 93
+1 ;;5.1;IFCAP;;Oct 20, 2000
+2 ;Per VHA Directive 10-93-142, this routine should not be modified.
+3 QUIT
+4 ;
+5 ;
START ; called from prcprdie to print report
+1 NEW DA,DATA,DATE,DATEEDT,DATESDT,FOOD,FOODDESC,ITEMDA,NOW,NSN,PAGE,PRCPFLAG,SCREEN,REF,TOTALFOO,TOTALINV,TOTALREF,TYPE
+2 KILL ^TMP($JOB,"PRCPRDIET")
+3 SET INVPT=0
FOR
SET INVPT=$ORDER(^TMP($JOB,"PRCPRDIE",INVPT))
if 'INVPT
QUIT
SET DATE=DATESTRT-.01
FOR
SET DATE=$ORDER(^PRCP(445.2,"AX",INVPT,DATE))
if 'DATE!(DATE>DATEEND)
QUIT
Begin DoDot:1
+4 FOR TYPE="R","C","E","RC"
SET DA=0
FOR
SET DA=$ORDER(^PRCP(445.2,"AX",INVPT,DATE,TYPE,DA))
if 'DA
QUIT
Begin DoDot:2
+5 SET DATA=$GET(^PRCP(445.2,DA,0))
IF DATA=""
QUIT
+6 SET ITEMDA=$PIECE(DATA,"^",5)
SET NSN=$$NSN^PRCPUX1(ITEMDA)
SET FOOD=$$FOOD^PRCPUX1(ITEMDA)
if NSN=""
SET NSN=" "
if FOOD=""
SET FOOD=" "
+7 SET REF=$PIECE(DATA,"^",15)
if REF=""
SET REF=" "
+8 IF '$PIECE(DATA,"^",22)
SET $PIECE(DATA,"^",22)=$JUSTIFY($PIECE(DATA,"^",7)*$PIECE(DATA,"^",9),0,2)
+9 SET ^TMP($JOB,"PRCPRDIET",INVPT,FOOD,REF,NSN,ITEMDA,DATE,DA)=$PIECE(DATA,"^",6)_"^"_$PIECE(DATA,"^",7)_"^"_$PIECE(DATA,"^",22)
End DoDot:2
End DoDot:1
+10 ; print report
+11 SET Y=DATESTRT
DO DD^%DT
SET DATESDT=Y
SET Y=DATEEND
DO DD^%DT
SET DATEEDT=Y
+12 DO NOW^%DTC
SET Y=%
DO DD^%DT
SET NOW=Y
SET PAGE=1
SET SCREEN=$$SCRPAUSE^PRCPUREP
USE IO
+13 SET INVPT=0
FOR
SET INVPT=$ORDER(^TMP($JOB,"PRCPRDIET",INVPT))
if 'INVPT!($GET(PRCPFLAG))
QUIT
Begin DoDot:1
+14 SET PRCPIN=$$INVNAME^PRCPUX1(INVPT)
DO H
+15 SET TOTALINV=0
+16 SET FOOD=""
FOR
SET FOOD=$ORDER(^TMP($JOB,"PRCPRDIET",INVPT,FOOD))
if FOOD=""!($GET(PRCPFLAG))
QUIT
Begin DoDot:2
+17 IF $GET(ZTQUEUED)
IF $$S^%ZTLOAD
SET PRCPFLAG=1
WRITE !?10,"<<< TASKMANAGER JOB TERMINATED BY USER >>>"
QUIT
+18 IF $Y>(IOSL-6)
if SCREEN
DO P^PRCPUREP
if $DATA(PRCPFLAG)
QUIT
DO H
+19 SET TOTALFOO=0
+20 SET FOODDESC=$PIECE($GET(^DD(441,20,0)),"^",3)
SET FOODDESC=$SELECT(FOOD=" ":"NO FOOD GROUP DESCRIPTION",1:$PIECE($PIECE(FOODDESC,";",FOOD),":",2))
+21 WRITE !!?5,"FOOD GROUP: ",$SELECT(FOOD=" ":"X",1:FOOD)," (",$EXTRACT(FOODDESC,1,50),")"
+22 SET REF=""
FOR
SET REF=$ORDER(^TMP($JOB,"PRCPRDIET",INVPT,FOOD,REF))
if REF=""!($GET(PRCPFLAG))
QUIT
Begin DoDot:3
+23 SET TOTALREF=0
+24 SET NSN=""
FOR
SET NSN=$ORDER(^TMP($JOB,"PRCPRDIET",INVPT,FOOD,REF,NSN))
if NSN=""!($GET(PRCPFLAG))
QUIT
SET ITEMDA=0
FOR
SET ITEMDA=$ORDER(^TMP($JOB,"PRCPRDIET",INVPT,FOOD,REF,NSN,ITEMDA))
if 'ITEMDA!($GET(PRCPFLAG))
QUIT
Begin DoDot:4
+25 SET DATE=0
FOR
SET DATE=$ORDER(^TMP($JOB,"PRCPRDIET",INVPT,FOOD,REF,NSN,ITEMDA,DATE))
if 'DATE!($GET(PRCPFLAG))
QUIT
SET DA=0
FOR
SET DA=$ORDER(^TMP($JOB,"PRCPRDIET",INVPT,FOOD,REF,NSN,ITEMDA,DATE,DA))
if 'DA!($GET(PRCPFLAG))
QUIT
SET DATA=^(DA)
Begin DoDot:5
+26 WRITE !,$TRANSLATE(NSN,"-"),?15,$EXTRACT($$DESCR^PRCPUX1(INVPT,ITEMDA),1,15),?31,ITEMDA,?37,$JUSTIFY($PIECE(DATA,"^"),8),$JUSTIFY($PIECE(DATA,"^",2),8),$JUSTIFY($PIECE(DATA,"^",3),10,2),$JUSTIFY(R
EF,7)
+27 WRITE $JUSTIFY($EXTRACT(DATE,4,5)_"-"_$EXTRACT(DATE,6,7)_"-"_$EXTRACT(DATE,2,3),10)
+28 SET TOTALREF=TOTALREF+$PIECE(DATA,"^",3)
+29 IF $Y>(IOSL-6)
if SCREEN
DO P^PRCPUREP
if $DATA(PRCPFLAG)
QUIT
DO H
End DoDot:5
End DoDot:4
+30 IF $GET(PRCPFLAG)
QUIT
+31 WRITE !,$JUSTIFY("SUBTOTAL REFERENCE NUMBER "_$SELECT(REF=" ":"XXXXX",1:REF)_":",50),$JUSTIFY(TOTALREF,13,2)
+32 SET TOTALFOO=TOTALFOO+TOTALREF
+33 IF $Y>(IOSL-6)
if SCREEN
DO P^PRCPUREP
if $DATA(PRCPFLAG)
QUIT
DO H
End DoDot:3
+34 IF $GET(PRCPFLAG)
QUIT
+35 SET %=$PIECE($GET(^DD(441,20,0)),"^",3)
SET %=$SELECT(FOOD=" ":"NO FOOD GROUP DESCRIPTION",1:$PIECE($PIECE(%,";",FOOD),":",2))
+36 WRITE !,$JUSTIFY("TOTAL FOOD GROUP "_$SELECT(FOOD=" ":"X",1:FOOD)_" ("_$EXTRACT(%,1,25)_"):",50),$JUSTIFY(TOTALFOO,13,2)
+37 SET TOTALINV=TOTALINV+TOTALFOO
+38 IF $Y>(IOSL-6)
if SCREEN
DO P^PRCPUREP
if $DATA(PRCPFLAG)
QUIT
DO H
End DoDot:2
+39 IF $GET(PRCPFLAG)
QUIT
+40 WRITE !,$JUSTIFY("TOTALS FOR INVENTORY POINT:",50),$JUSTIFY(TOTALINV,13,2)
End DoDot:1
+41 IF '$GET(PRCPFLAG)
DO END^PRCPUREP
+42 QUIT
+43 ;
H SET %=NOW_" PAGE "_PAGE
SET PAGE=PAGE+1
IF PAGE'=2!(SCREEN)
WRITE @IOF
+1 WRITE $CHAR(13),"DIETETIC COST REPORT FOR: ",$EXTRACT(PRCPIN,1,20),?(80-$LENGTH(%)),%
+2 WRITE !?5,"ITEMS RECEIVED IN INVENTORY POINT BETWEEN DATES: ",DATESDT," to ",DATEEDT
+3 SET %=""
SET $PIECE(%,"-",81)=""
WRITE !,"NSN",?15,"DESCRIPTION",?31,"IM#",?37,$JUSTIFY("UNITS",8),$JUSTIFY("QTY",8),$JUSTIFY("TOTAL $",10),$JUSTIFY("REF#",7),$JUSTIFY("REC DT",10),!,%
+4 QUIT