RMPRPIQ5 ;HCIOFO/ODJ - INVENTORY REPORT - BUILD ^TMP SORT ARRAY ; 12/30/02 11:35
;;3.0;PROSTHETICS;**61,127**;Feb 09, 1996
;
;RVD patch #61 modified to read the new PIP files; 661.11, 661.6
; 661.7, 661.9
Q
;
; Start of Report build and print. Enter here after report params.
; entered by user (see RMPR5HQ4).
; Also called by TaskMan if report queued.
;
; Variables required
;
; RMPR("STA")
; RMPRSDT
; RMPREDT
; RMPRDET
; RMPRSEL
; {IO vars}
;
REPORT I $E(IOST)["C" W !!,"Processing report......."
D GEN(RMPRSDT,RMPREDT,RMPRDET,.RMPRSEL,RMPR("STA")) ;generate ^TMP sort array
D CALC^RMPR5HQ6 ;calculations
U IO D ^RMPR5HQ2 ;print report
D ^%ZISC
;K ^TMP($J,"RMPR5") ;make live after testing
N RMPR,RMPRSITE D KILL^XUSCLEAN
Q
;
; Entry point for national roll-up
NATION N RMPRSEL,RMPRDET,RMPRSTN,RMPRSDT,RMPREDT,X
S RMPRSTN="*"
S RMPRDET="H"
;D NOW^%DTC S RMPREDT=X S %H=%H-30 D YMD^%DTC S RMPRSDT=X
S RMPRSDT=RMPRPIP1,RMPREDT=RMPRPIP2
S RMPRSEL("*")=""
D GEN(RMPRSDT,RMPREDT,RMPRDET,.RMPRSEL,RMPRSTN)
D CALC^RMPR5HQ6 ;put calcs in TMP array
D MAIL^RMPR5HQ7 ;build ^TMP($J,"RMPR5A" array for mailing
Q
;
;
; Generate temporary index global ^TMP($J,"RMPR5"
; (as of 11/29/00 we use the 660 file, not 661.2)
;
GEN(STDT,ENDT,DETAIL,RMPRSEL,RMPRSTN) ;
N TNAM,FROM,EOF,DAT,HCDAT,HCPCIEN,NPGRP,NPLIN,S,HCPC,HCPCITEM
N OUPIEN,ITEM,ALLGRP,HCPCREF,SELECTED,STATION,QTY,STR,MULITEM
N ITMIEN,INVDT,SOURCE,ISCOST,PATIENT,COST
S TNAM="RMPR5" ;TMP global name
K ^TMP($J,TNAM)
D CURVAL(TNAM,RMPRSTN,.RMPRSEL,DETAIL)
;S FROM="" S:$G(STDT)'="*" FROM=STDT-1
S EOF=0,ENDT=ENDT+1
F RSDT=STDT:0 S RSDT=$O(^RMPR(661.6,"XSTD",RMPRSTN,3,RSDT)) Q:(RSDT>ENDT)!(RSDT="") D Q:EOF
.; I INVDT="" S EOF=1 Q
.; I ENDT'="*",INVDT>ENDT S EOF=1 Q
. S OUPIEN=0
. F S OUPIEN=$O(^RMPR(661.6,"XSTD",RMPRSTN,3,RSDT,OUPIEN)) Q:OUPIEN'>0 D
.. S S=$G(^RMPR(661.6,OUPIEN,0))
.. S PATIENT=$P(S,"^",2) Q:PATIENT=""
.. S QTY=+$P(S,"^",5) Q:QTY<1
.. S HCPC=$P(S,"^",1) Q:HCPC=""
.. S HCPCIEN=$O(^RMPR(661.1,"B",HCPC,0)) Q:HCPCIEN=""
.. S STATION=RMPRSTN Q:STATION=""
.. I RMPRSTN'="*",STATION'=RMPRSTN Q
.. Q:'$D(^TMP($J,TNAM,"Z",HCPCIEN))
.. Q:$P(^TMP($J,TNAM,"Z",HCPCIEN),"^",3)=1
.. S HCPCITEM=HCPC_"-"_$P(S,"^",11)
.. S ITEM=$P(HCPCITEM,"-",2)
.. S:ITEM="" ITEM="?"
.. S ISCOST=$P(S,"^",6)
..; S COST=$$PRECOST(OUPIEN,HCPCIEN,HCPCITEM,STATION)
..; I COST'="" S ISCOST=COST-ISCOST
..; S:COST="" ISCOST=QTY*$P(S,"^",5)
.. S R11=$O(^RMPR(661.11,"C",HCPCITEM,0))
.. S R11DAT=$G(^RMPR(661.11,R11,0))
.. S SOURCE=$P(R11DAT,"^",5)
.. S STR=^TMP($J,TNAM,"Z",HCPCIEN)
.. S NPGRP=$P(STR,"^",1)
.. S NPLIN=$P(STR,"^",2)
.. S HCPCREF=HCPC,$P(HCPCREF,"/",2)=HCPCIEN
.. I '$D(^TMP($J,TNAM,STATION,NPGRP,NPLIN,HCPCREF,ITEM)) D Q:'+QTY
... S:+QTY ^TMP($J,TNAM,STATION,NPGRP,NPLIN,HCPCREF,ITEM)=""
... Q
.. S ^TMP($J,TNAM,STATION,NPGRP,NPLIN,HCPCREF,ITEM,OUPIEN)=QTY_"^"_ISCOST_"^"_SOURCE
.. Q
. Q
Q
;
; Get total cost of item just prior to current issue
PRECOST(INVIEN,HCPCIEN,HCPCITEM,STATION) ;
N IEN,COST,STR,LOC
S COST=""
S IEN=INVIEN,RD=RMPRSDT
S RD=$O(^RMPR(661.9,"ASHID",RMPRSTN,HCPC,IEN,RD),-1)
Q:'$G(RD) S RIEN=$O(^RMPR(661.9,"ASHID",RMPRSTN,HCPC,IEN,RD,0))
S STR=^RMPR(661.9,RIEN,0)
S COST=$P(STR,"^",9)
Q COST
;
; Get QOH for HCPC
CURVAL(RMPRNAM,RMPRSTN,RMPRSEL,DETAIL) ;
N INVIEN,STR,IEN1,IEN2,LOCN,HCPCIEN,HCDAT,NPLIN,NPGRP,ALLGRP,SELECTED
N S,SOURCE,STATION,QOH,COST,HCPC,HCPCREF,ITEM
S ALLGRP=0 S:$O(RMPRSEL(""))="*" ALLGRP=1
S RH=""
F S RH=$O(^RMPR(661.9,"ASHID",RMPRSTN,RH)) Q:RH="" D
. S IEN1=0
. F S IEN1=$O(^RMPR(661.9,"ASHID",RMPRSTN,RH,IEN1)) Q:'+IEN1 D
.. S HCPCIEN=$O(^RMPR(661.1,"B",RH,0)) Q:HCPCIEN=""
.. I '$D(^TMP($J,RMPRNAM,"Z",HCPCIEN)) D
... S S=^RMPR(661.1,HCPCIEN,0)
... S NPLIN=$P(S,"^",7)
... S:NPLIN="" NPLIN="999 X"
... S NPGRP=$P(NPLIN," ",1) ;group num. is 1st set of digits of new line
... S STR=NPGRP
... S $P(STR,"^",2)=NPLIN
... S ^TMP($J,RMPRNAM,"Z",HCPCIEN)=STR
... Q
.. E D Q:$P(S,"^",3)=1
... S S=^TMP($J,RMPRNAM,"Z",HCPCIEN)
... S NPGRP=$P(S,"^",1)
... S NPLIN=$P(S,"^",2)
... Q
.. ;
.. ; Test if record matches selection criteria
.. ; (only needed if not all groups selected)
.. I 'ALLGRP D I 'SELECTED S $P(^TMP($J,RMPRNAM,"Z",HCPCIEN),"^",3)=1 Q
... S SELECTED=0
... I '$D(RMPRSEL(NPGRP)) Q
... I DETAIL="G" S SELECTED=1 Q
... I $O(RMPRSEL(NPGRP,""))="*" S SELECTED=1 Q
... I '$D(RMPRSEL(NPGRP,NPLIN)) Q
... I DETAIL="L" S SELECTED=1 Q
... I $O(RMPRSEL(NPGRP,NPLIN,""))="*" S SELECTED=1 Q
... I '$D(RMPRSEL(NPGRP,NPLIN,HCPCIEN)) Q
... S SELECTED=1
... Q
.. S RD=ENDT+1
.. S RD=$O(^RMPR(661.9,"ASHID",RMPRSTN,RH,IEN1,RD),-1) Q:RD="" S RIEN=$O(^RMPR(661.9,"ASHID",RMPRSTN,RH,IEN1,RD,""),-1) D
... Q:'$D(^RMPR(661.9,RIEN,0))
... S HCPC=RH,S=^RMPR(661.9,RIEN,0)
... S QOH=+$P(S,"^",8) Q:'QOH
... S COST=$P(S,"^",9)
... S ITEM=IEN1
... S RS=$O(^RMPR(661.11,"C",HCPC_"-"_ITEM,0)) Q:RS=""
... S SOURCE=$P($G(^RMPR(661.11,RS,0)),U,5)
... S HCPCREF=HCPC,$P(HCPCREF,"/",2)=HCPCIEN
... S S=$G(^TMP($J,RMPRNAM,RMPRSTN,NPGRP,NPLIN,HCPCREF,ITEM))
... I SOURCE="C" D
.... S $P(S,"^",9)=QOH+$P(S,"^",9)
.... S $P(S,"^",11)=COST+$P(S,"^",11)
.... Q
... E D
.... S $P(S,"^",8)=QOH+$P(S,"^",8)
.... S $P(S,"^",10)=COST+$P(S,"^",10)
.... Q
... S ^TMP($J,RMPRNAM,RMPRSTN,NPGRP,NPLIN,HCPCREF,ITEM)=S
... Q
.. Q
. Q
Q
;
; return item text string given HCPC and ITEM IENs to 661.11
; if null ITEMIEN passed the just return the HCPC short name text
GETITEM(HCPCIEN,ITEMIEN) ;
N STR,ITEMTXT
S ITEMTXT=""
I ITEMIEN="" D G GETITEMX
. S STR=$G(^RMPR(661.1,HCPCIEN,0))
. S ITEMTXT=$P(STR,"^",2)
. Q
S HCPC=$P($G(^RMPR(661.1,HCPCIEN,0)),U,1)
S STR=$G(^RMPR(661.11,"C",HCPC_"-"_ITEMIEN,0))
I STR="" D
. S ITEMTXT=$P(^RMPR(661.1,HCPCIEN,0),"^",2)
. Q
E D
. S ITEMTXT=$P(STR,"^",1)
. Q
S:ITEMTXT="" ITEMTXT="ITEM "_ITEMIEN
GETITEMX Q ITEMTXT
;
; return NPPD line text from line code (New lines only)
NPLIN(CODE) ;
N I,S,LINTXT
S LINTXT=""
F I=1:1 S S=$P($T(DES+I^RMPRN62),";;",2) Q:$E(S,1,3)="END" D Q:LINTXT'=""
. I $P(S,";",1)=CODE S LINTXT=$P(S,";",2)
. Q
Q LINTXT
--- Routine Detail --- with STRUCTURED ROUTINE LISTING ---[H[J[2J[HRMPRPIQ5 6340 printed Dec 13, 2024@02:36:11 Page 2
RMPRPIQ5 ;HCIOFO/ODJ - INVENTORY REPORT - BUILD ^TMP SORT ARRAY ; 12/30/02 11:35
+1 ;;3.0;PROSTHETICS;**61,127**;Feb 09, 1996
+2 ;
+3 ;RVD patch #61 modified to read the new PIP files; 661.11, 661.6
+4 ; 661.7, 661.9
+5 QUIT
+6 ;
+7 ; Start of Report build and print. Enter here after report params.
+8 ; entered by user (see RMPR5HQ4).
+9 ; Also called by TaskMan if report queued.
+10 ;
+11 ; Variables required
+12 ;
+13 ; RMPR("STA")
+14 ; RMPRSDT
+15 ; RMPREDT
+16 ; RMPRDET
+17 ; RMPRSEL
+18 ; {IO vars}
+19 ;
REPORT IF $EXTRACT(IOST)["C"
WRITE !!,"Processing report......."
+1 ;generate ^TMP sort array
DO GEN(RMPRSDT,RMPREDT,RMPRDET,.RMPRSEL,RMPR("STA"))
+2 ;calculations
DO CALC^RMPR5HQ6
+3 ;print report
USE IO
DO ^RMPR5HQ2
+4 DO ^%ZISC
+5 ;K ^TMP($J,"RMPR5") ;make live after testing
+6 NEW RMPR,RMPRSITE
DO KILL^XUSCLEAN
+7 QUIT
+8 ;
+9 ; Entry point for national roll-up
NATION NEW RMPRSEL,RMPRDET,RMPRSTN,RMPRSDT,RMPREDT,X
+1 SET RMPRSTN="*"
+2 SET RMPRDET="H"
+3 ;D NOW^%DTC S RMPREDT=X S %H=%H-30 D YMD^%DTC S RMPRSDT=X
+4 SET RMPRSDT=RMPRPIP1
SET RMPREDT=RMPRPIP2
+5 SET RMPRSEL("*")=""
+6 DO GEN(RMPRSDT,RMPREDT,RMPRDET,.RMPRSEL,RMPRSTN)
+7 ;put calcs in TMP array
DO CALC^RMPR5HQ6
+8 ;build ^TMP($J,"RMPR5A" array for mailing
DO MAIL^RMPR5HQ7
+9 QUIT
+10 ;
+11 ;
+12 ; Generate temporary index global ^TMP($J,"RMPR5"
+13 ; (as of 11/29/00 we use the 660 file, not 661.2)
+14 ;
GEN(STDT,ENDT,DETAIL,RMPRSEL,RMPRSTN) ;
+1 NEW TNAM,FROM,EOF,DAT,HCDAT,HCPCIEN,NPGRP,NPLIN,S,HCPC,HCPCITEM
+2 NEW OUPIEN,ITEM,ALLGRP,HCPCREF,SELECTED,STATION,QTY,STR,MULITEM
+3 NEW ITMIEN,INVDT,SOURCE,ISCOST,PATIENT,COST
+4 ;TMP global name
SET TNAM="RMPR5"
+5 KILL ^TMP($JOB,TNAM)
+6 DO CURVAL(TNAM,RMPRSTN,.RMPRSEL,DETAIL)
+7 ;S FROM="" S:$G(STDT)'="*" FROM=STDT-1
+8 SET EOF=0
SET ENDT=ENDT+1
+9 FOR RSDT=STDT:0
SET RSDT=$ORDER(^RMPR(661.6,"XSTD",RMPRSTN,3,RSDT))
if (RSDT>ENDT)!(RSDT="")
QUIT
Begin DoDot:1
+10 ; I INVDT="" S EOF=1 Q
+11 ; I ENDT'="*",INVDT>ENDT S EOF=1 Q
+12 SET OUPIEN=0
+13 FOR
SET OUPIEN=$ORDER(^RMPR(661.6,"XSTD",RMPRSTN,3,RSDT,OUPIEN))
if OUPIEN'>0
QUIT
Begin DoDot:2
+14 SET S=$GET(^RMPR(661.6,OUPIEN,0))
+15 SET PATIENT=$PIECE(S,"^",2)
if PATIENT=""
QUIT
+16 SET QTY=+$PIECE(S,"^",5)
if QTY<1
QUIT
+17 SET HCPC=$PIECE(S,"^",1)
if HCPC=""
QUIT
+18 SET HCPCIEN=$ORDER(^RMPR(661.1,"B",HCPC,0))
if HCPCIEN=""
QUIT
+19 SET STATION=RMPRSTN
if STATION=""
QUIT
+20 IF RMPRSTN'="*"
IF STATION'=RMPRSTN
QUIT
+21 if '$DATA(^TMP($JOB,TNAM,"Z",HCPCIEN))
QUIT
+22 if $PIECE(^TMP($JOB,TNAM,"Z",HCPCIEN),"^",3)=1
QUIT
+23 SET HCPCITEM=HCPC_"-"_$PIECE(S,"^",11)
+24 SET ITEM=$PIECE(HCPCITEM,"-",2)
+25 if ITEM=""
SET ITEM="?"
+26 SET ISCOST=$PIECE(S,"^",6)
+27 ; S COST=$$PRECOST(OUPIEN,HCPCIEN,HCPCITEM,STATION)
+28 ; I COST'="" S ISCOST=COST-ISCOST
+29 ; S:COST="" ISCOST=QTY*$P(S,"^",5)
+30 SET R11=$ORDER(^RMPR(661.11,"C",HCPCITEM,0))
+31 SET R11DAT=$GET(^RMPR(661.11,R11,0))
+32 SET SOURCE=$PIECE(R11DAT,"^",5)
+33 SET STR=^TMP($JOB,TNAM,"Z",HCPCIEN)
+34 SET NPGRP=$PIECE(STR,"^",1)
+35 SET NPLIN=$PIECE(STR,"^",2)
+36 SET HCPCREF=HCPC
SET $PIECE(HCPCREF,"/",2)=HCPCIEN
+37 IF '$DATA(^TMP($JOB,TNAM,STATION,NPGRP,NPLIN,HCPCREF,ITEM))
Begin DoDot:3
+38 if +QTY
SET ^TMP($JOB,TNAM,STATION,NPGRP,NPLIN,HCPCREF,ITEM)=""
+39 QUIT
End DoDot:3
if '+QTY
QUIT
+40 SET ^TMP($JOB,TNAM,STATION,NPGRP,NPLIN,HCPCREF,ITEM,OUPIEN)=QTY_"^"_ISCOST_"^"_SOURCE
+41 QUIT
End DoDot:2
+42 QUIT
End DoDot:1
if EOF
QUIT
+43 QUIT
+44 ;
+45 ; Get total cost of item just prior to current issue
PRECOST(INVIEN,HCPCIEN,HCPCITEM,STATION) ;
+1 NEW IEN,COST,STR,LOC
+2 SET COST=""
+3 SET IEN=INVIEN
SET RD=RMPRSDT
+4 SET RD=$ORDER(^RMPR(661.9,"ASHID",RMPRSTN,HCPC,IEN,RD),-1)
+5 if '$GET(RD)
QUIT
SET RIEN=$ORDER(^RMPR(661.9,"ASHID",RMPRSTN,HCPC,IEN,RD,0))
+6 SET STR=^RMPR(661.9,RIEN,0)
+7 SET COST=$PIECE(STR,"^",9)
+8 QUIT COST
+9 ;
+10 ; Get QOH for HCPC
CURVAL(RMPRNAM,RMPRSTN,RMPRSEL,DETAIL) ;
+1 NEW INVIEN,STR,IEN1,IEN2,LOCN,HCPCIEN,HCDAT,NPLIN,NPGRP,ALLGRP,SELECTED
+2 NEW S,SOURCE,STATION,QOH,COST,HCPC,HCPCREF,ITEM
+3 SET ALLGRP=0
if $ORDER(RMPRSEL(""))="*"
SET ALLGRP=1
+4 SET RH=""
+5 FOR
SET RH=$ORDER(^RMPR(661.9,"ASHID",RMPRSTN,RH))
if RH=""
QUIT
Begin DoDot:1
+6 SET IEN1=0
+7 FOR
SET IEN1=$ORDER(^RMPR(661.9,"ASHID",RMPRSTN,RH,IEN1))
if '+IEN1
QUIT
Begin DoDot:2
+8 SET HCPCIEN=$ORDER(^RMPR(661.1,"B",RH,0))
if HCPCIEN=""
QUIT
+9 IF '$DATA(^TMP($JOB,RMPRNAM,"Z",HCPCIEN))
Begin DoDot:3
+10 SET S=^RMPR(661.1,HCPCIEN,0)
+11 SET NPLIN=$PIECE(S,"^",7)
+12 if NPLIN=""
SET NPLIN="999 X"
+13 ;group num. is 1st set of digits of new line
SET NPGRP=$PIECE(NPLIN," ",1)
+14 SET STR=NPGRP
+15 SET $PIECE(STR,"^",2)=NPLIN
+16 SET ^TMP($JOB,RMPRNAM,"Z",HCPCIEN)=STR
+17 QUIT
End DoDot:3
+18 IF '$TEST
Begin DoDot:3
+19 SET S=^TMP($JOB,RMPRNAM,"Z",HCPCIEN)
+20 SET NPGRP=$PIECE(S,"^",1)
+21 SET NPLIN=$PIECE(S,"^",2)
+22 QUIT
End DoDot:3
if $PIECE(S,"^",3)=1
QUIT
+23 ;
+24 ; Test if record matches selection criteria
+25 ; (only needed if not all groups selected)
+26 IF 'ALLGRP
Begin DoDot:3
+27 SET SELECTED=0
+28 IF '$DATA(RMPRSEL(NPGRP))
QUIT
+29 IF DETAIL="G"
SET SELECTED=1
QUIT
+30 IF $ORDER(RMPRSEL(NPGRP,""))="*"
SET SELECTED=1
QUIT
+31 IF '$DATA(RMPRSEL(NPGRP,NPLIN))
QUIT
+32 IF DETAIL="L"
SET SELECTED=1
QUIT
+33 IF $ORDER(RMPRSEL(NPGRP,NPLIN,""))="*"
SET SELECTED=1
QUIT
+34 IF '$DATA(RMPRSEL(NPGRP,NPLIN,HCPCIEN))
QUIT
+35 SET SELECTED=1
+36 QUIT
End DoDot:3
IF 'SELECTED
SET $PIECE(^TMP($JOB,RMPRNAM,"Z",HCPCIEN),"^",3)=1
QUIT
+37 SET RD=ENDT+1
+38 SET RD=$ORDER(^RMPR(661.9,"ASHID",RMPRSTN,RH,IEN1,RD),-1)
if RD=""
QUIT
SET RIEN=$ORDER(^RMPR(661.9,"ASHID",RMPRSTN,RH,IEN1,RD,""),-1)
Begin DoDot:3
+39 if '$DATA(^RMPR(661.9,RIEN,0))
QUIT
+40 SET HCPC=RH
SET S=^RMPR(661.9,RIEN,0)
+41 SET QOH=+$PIECE(S,"^",8)
if 'QOH
QUIT
+42 SET COST=$PIECE(S,"^",9)
+43 SET ITEM=IEN1
+44 SET RS=$ORDER(^RMPR(661.11,"C",HCPC_"-"_ITEM,0))
if RS=""
QUIT
+45 SET SOURCE=$PIECE($GET(^RMPR(661.11,RS,0)),U,5)
+46 SET HCPCREF=HCPC
SET $PIECE(HCPCREF,"/",2)=HCPCIEN
+47 SET S=$GET(^TMP($JOB,RMPRNAM,RMPRSTN,NPGRP,NPLIN,HCPCREF,ITEM))
+48 IF SOURCE="C"
Begin DoDot:4
+49 SET $PIECE(S,"^",9)=QOH+$PIECE(S,"^",9)
+50 SET $PIECE(S,"^",11)=COST+$PIECE(S,"^",11)
+51 QUIT
End DoDot:4
+52 IF '$TEST
Begin DoDot:4
+53 SET $PIECE(S,"^",8)=QOH+$PIECE(S,"^",8)
+54 SET $PIECE(S,"^",10)=COST+$PIECE(S,"^",10)
+55 QUIT
End DoDot:4
+56 SET ^TMP($JOB,RMPRNAM,RMPRSTN,NPGRP,NPLIN,HCPCREF,ITEM)=S
+57 QUIT
End DoDot:3
+58 QUIT
End DoDot:2
+59 QUIT
End DoDot:1
+60 QUIT
+61 ;
+62 ; return item text string given HCPC and ITEM IENs to 661.11
+63 ; if null ITEMIEN passed the just return the HCPC short name text
GETITEM(HCPCIEN,ITEMIEN) ;
+1 NEW STR,ITEMTXT
+2 SET ITEMTXT=""
+3 IF ITEMIEN=""
Begin DoDot:1
+4 SET STR=$GET(^RMPR(661.1,HCPCIEN,0))
+5 SET ITEMTXT=$PIECE(STR,"^",2)
+6 QUIT
End DoDot:1
GOTO GETITEMX
+7 SET HCPC=$PIECE($GET(^RMPR(661.1,HCPCIEN,0)),U,1)
+8 SET STR=$GET(^RMPR(661.11,"C",HCPC_"-"_ITEMIEN,0))
+9 IF STR=""
Begin DoDot:1
+10 SET ITEMTXT=$PIECE(^RMPR(661.1,HCPCIEN,0),"^",2)
+11 QUIT
End DoDot:1
+12 IF '$TEST
Begin DoDot:1
+13 SET ITEMTXT=$PIECE(STR,"^",1)
+14 QUIT
End DoDot:1
+15 if ITEMTXT=""
SET ITEMTXT="ITEM "_ITEMIEN
GETITEMX QUIT ITEMTXT
+1 ;
+2 ; return NPPD line text from line code (New lines only)
NPLIN(CODE) ;
+1 NEW I,S,LINTXT
+2 SET LINTXT=""
+3 FOR I=1:1
SET S=$PIECE($TEXT(DES+I^RMPRN62),";;",2)
if $EXTRACT(S,1,3)="END"
QUIT
Begin DoDot:1
+4 IF $PIECE(S,";",1)=CODE
SET LINTXT=$PIECE(S,";",2)
+5 QUIT
End DoDot:1
if LINTXT'=""
QUIT
+6 QUIT LINTXT