RMPR5HQL ;HCIOFO/RVD - NPPD LINE USAGE REPORT ; 15 AUG 00
;;3.0;PROSTHETICS;**51,61**;Feb 09, 1996
;
DQ1 ;print PIP Report
;$O the ^TMP( global for all the records
;print all records based on the sort criteria given.
I IOST["C-" W @IOF
F RST=0:0 S RST=$O(^TMP($J,R5,RST)) Q:RST'>0 S RSTN=$$STN(RST),RPR=0 F RI=0:0 S RI=$O(^TMP($J,R5,RST,RI)) Q:$G(RFL) D:(RGRP'="")&(RGRP'=RI) SUMG1 Q:RI'>0 D
.D:RPR=0 HDRL
.S RGRP=RI
.S RNPGRP=RMARRAY(RI)
.S RJ=""
.F S RJ=$O(^TMP($J,R5,RST,RI,RJ)) Q:$G(RFL) D:(RLINE'="")&(RLINE'=RJ) SUML1 Q:(RJ="")!(RFL=1) D
..S RLINE=RJ,RNPLINE=$$NPLIN^RMPR5HQ5(RJ)
..I RGCNT=0 S RGCNT=RGCNT+1
..S RK="" F S RK=$O(^TMP($J,R5,RST,RI,RJ,RK)) Q:$G(RFL)!(RK="") D
...S RL=""
...F S RL=$O(^TMP($J,R5,RST,RI,RJ,RK,RL)) Q:$G(RFL)!(RL="") D
....I RLCNT=0 D GLN1
....S RLCNT=RLCNT+1
....S RDAT=^TMP($J,R5,RST,RI,RJ,RK,RL)
....S RMVA=$P(RDAT,U,1)
....S RMCOM=$P(RDAT,U,2)
....S RMUSE=$P(RDAT,U,3)
....S RMISU=$P(RDAT,U,4)
....S RMISN=$P(RDAT,U,5)
....S RMAVEN=$P(RDAT,U,6)
....S RMDLEN=$P(RDAT,U,7)
....S RMQOHU=$P(RDAT,U,8)
....S RMQOHN=$P(RDAT,U,9)
....S RMVALU=$P(RDAT,U,10)
....S RMVALN=$P(RDAT,U,11)
....S RMAVEU=$P(RDAT,U,12)
....S RMDLEU=$P(RDAT,U,13)
....;total for GROUP
....S RMTVAG=RMTVAG+RMVA
....S RMTCOMG=RMTCOMG+RMCOM
....S RMTUSEG=RMTUSEG+RMVA+RMCOM
....S RMTISUG=RMTISUG+RMISU
....S RMTISNG=RMTISNG+RMISN
....S RMTDLEG=RMTDLEG+RMDLEU+RMDLEN
....S RMTQOHUG=RMTQOHUG+RMQOHU
....S RMTQOHNG=RMTQOHNG+RMQOHN
....S RMTVALUG=RMTVALUG+RMVALU
....S RMTVALNG=RMTVALNG+RMVALN
....S RMGTOU=RMGTOU+RMVALU
....S RMGTON=RMGTON+RMVALN
....S RMGTIU=RMGTIU+RMISU
....S RMGTIN=RMGTIN+RMISN
....;total for line item
....S RMTVAL=RMTVAL+RMVA
....S RMTCOML=RMTCOML+RMCOM
....I (RMCOM'=""),$G(RMCOM) S RTUSELC=RTUSELC+RMCOM
....I (RMVA'=""),$G(RMVA) S RTUSELA=RTUSELA+RMVA
....S RMTISUL=RMTISUL+RMISU
....S RMTISNL=RMTISNL+RMISN
....S RMTQOHUL=RMTQOHUL+RMQOHU
....S RMTQOHNL=RMTQOHNL+RMQOHN
....S RMTVALUL=RMTVALUL+RMVALU
....S RMTVALNL=RMTVALNL+RMVALN
....S (RPRINT,RPR)=1
....I $Y+8>IOSL,IOST["C-" K DIR S DIR(0)="E" D ^DIR S:+Y'>0 RFL=1 Q:+Y'>0 W @IOF D HDRL,LBL1^RMPR5HQ2
....I $Y+8>IOSL,IOST'["C-" W @IOF D HDRL,LBL1^RMPR5HQ2
Q
;
HDRL ;print heading.
Q:$G(RFL)
S RMPAGE=RMPAGE+1
W !,"PROSTHETIC INVENTORY NPPD GROUP/LINE REPORT",?55,"Run Date: ",RMRDATE,?100,"Page: ",RMPAGE
W !,"STATION: ",$E(RSTN,1,20)
W ?32,RMBD," - ",RMED," [ ",RMCALDAY," calendar days ]"
Q
;
GLN1 ;print NPPD GROUP and LINE header.
Q:$G(RFL)
W !!,RNPGRP
D LBL1^RMPR5HQ2
Q
SUML1 ;
Q:$G(RFL)
W !,RLINE," ",RNPLINE
S:$G(RTUSELA) RTAVELA=RTUSELA/RMCALDAY
S:$G(RTUSELC) RTAVELC=RTUSELC/RMCALDAY
S:$G(RTUSELA) RTDLELA=RMTQOHUL/RTAVELA
S:$G(RTUSELC) RTDLELC=RMTQOHNL/RTAVELC
S RTDLELA=$S(RTDLELA>999:">999",1:$J(RTDLELA,5,0))
S RTDLELC=$S(RTDLELC>999:">999",1:$J(RTDLELC,5,0))
S:RMTQOHNL=0 RTDLELC=""
S:RMTQOHUL=0 RTDLELA=""
S:(RMTQOHNL>0)&(RMTCOML<1) RTDLELC=">"_RMCALDAY
S:(RMTQOHUL>0)&(RMTVAL<1) RTDLELA=">"_RMCALDAY
S RMTAVEG=RTAVELA+RTAVELC
;next 2 lines for used:
W !,?5,"(Used)",?26,$J(RMTVAL,5),?34,$J($FN(RMTISUL,",",2),6),?40,"|",?59,"|",?60,$J(RTUSELA,5),?67,"|",?71,$J(RTAVELA,5,2),?78,"|"
W ?81,$J(RMTQOHUL,5),?94,"|",?97,$J(RTDLELA,6),?103,"|",?103,$J($FN(RMTVALUL,",",2),11)
;next 2 lines for new:
W !,?5,"(New)",?40,"|",?41,$J(RMTCOML,4),?49,$J($FN(RMTISNL,",",2),9),?59,"|",?60,$J(RTUSELC,5),?67,"|",?71,$J(RTAVELC,5,2),?78,"|"
W ?87,$J(RMTQOHNL,6),?94,"|",?97,$J(RTDLELC,6),?103,"|",?116,$J($FN(RMTVALNL,",",2),11)
;
S (RMTVAL,RMTISUL,RMTCOML,RMTISNL,RMTUSEL,RMTAVEL,RMTQOHUL,RMTQOHNL,RMTVALUL,RMTVALNL)=0
S (RTUSELA,RTUSELC,RTDLELA,RTDLELC,RTAVELA,RTAVELC)=0
S (RNPLINE,RLINE)=""
Q
;
SUMG1 ;print summary total for NPPD GROUP
Q:$G(RFL)
W !,REQ
W !,?26,$J(RMTVAG,5),?34,$J($FN(RMTISUG,",",2),6),?40,"|",?41,$J(RMTCOMG,4),?49,$J($FN(RMTISNG,",",2),9),?59,"|",?60,$J(RMTUSEG,5),?67,"|",?78,"|"
W ?81,$J(RMTQOHUG,5),?87,$J(RMTQOHNG,6),?94,"|",?103,"|",?104,$J($FN(RMTVALUG,",",2),11),?116,$J($FN(RMTVALNG,",",2),11)
S (RMTVAG,RMTISUG,RMTCOMG,RMTISNG,RMTUSEG,RMTAVEG,RMTQOHUG,RMTQOHNG,RMTVALUG,RMTVALNG,RLCNT)=0
S (RNPGRP,RGRP)=""
Q
STN(RST) ;STATION FUNCTION
N Y,RS
S RS=$O(^RMPR(669.9,"C",RST,0)),Y=$P(^RMPR(669.9,RS,0),U,1)
Q Y
--- Routine Detail --- with STRUCTURED ROUTINE LISTING ---[H[J[2J[HRMPR5HQL 4358 printed Oct 16, 2024@18:33:47 Page 2
RMPR5HQL ;HCIOFO/RVD - NPPD LINE USAGE REPORT ; 15 AUG 00
+1 ;;3.0;PROSTHETICS;**51,61**;Feb 09, 1996
+2 ;
DQ1 ;print PIP Report
+1 ;$O the ^TMP( global for all the records
+2 ;print all records based on the sort criteria given.
+3 IF IOST["C-"
WRITE @IOF
+4 FOR RST=0:0
SET RST=$ORDER(^TMP($JOB,R5,RST))
if RST'>0
QUIT
SET RSTN=$$STN(RST)
SET RPR=0
FOR RI=0:0
SET RI=$ORDER(^TMP($JOB,R5,RST,RI))
if $GET(RFL)
QUIT
if (RGRP'="")&(RGRP'=RI)
DO SUMG1
if RI'>0
QUIT
Begin DoDot:1
+5 if RPR=0
DO HDRL
+6 SET RGRP=RI
+7 SET RNPGRP=RMARRAY(RI)
+8 SET RJ=""
+9 FOR
SET RJ=$ORDER(^TMP($JOB,R5,RST,RI,RJ))
if $GET(RFL)
QUIT
if (RLINE'="")&(RLINE'=RJ)
DO SUML1
if (RJ="")!(RFL=1)
QUIT
Begin DoDot:2
+10 SET RLINE=RJ
SET RNPLINE=$$NPLIN^RMPR5HQ5(RJ)
+11 IF RGCNT=0
SET RGCNT=RGCNT+1
+12 SET RK=""
FOR
SET RK=$ORDER(^TMP($JOB,R5,RST,RI,RJ,RK))
if $GET(RFL)!(RK="")
QUIT
Begin DoDot:3
+13 SET RL=""
+14 FOR
SET RL=$ORDER(^TMP($JOB,R5,RST,RI,RJ,RK,RL))
if $GET(RFL)!(RL="")
QUIT
Begin DoDot:4
+15 IF RLCNT=0
DO GLN1
+16 SET RLCNT=RLCNT+1
+17 SET RDAT=^TMP($JOB,R5,RST,RI,RJ,RK,RL)
+18 SET RMVA=$PIECE(RDAT,U,1)
+19 SET RMCOM=$PIECE(RDAT,U,2)
+20 SET RMUSE=$PIECE(RDAT,U,3)
+21 SET RMISU=$PIECE(RDAT,U,4)
+22 SET RMISN=$PIECE(RDAT,U,5)
+23 SET RMAVEN=$PIECE(RDAT,U,6)
+24 SET RMDLEN=$PIECE(RDAT,U,7)
+25 SET RMQOHU=$PIECE(RDAT,U,8)
+26 SET RMQOHN=$PIECE(RDAT,U,9)
+27 SET RMVALU=$PIECE(RDAT,U,10)
+28 SET RMVALN=$PIECE(RDAT,U,11)
+29 SET RMAVEU=$PIECE(RDAT,U,12)
+30 SET RMDLEU=$PIECE(RDAT,U,13)
+31 ;total for GROUP
+32 SET RMTVAG=RMTVAG+RMVA
+33 SET RMTCOMG=RMTCOMG+RMCOM
+34 SET RMTUSEG=RMTUSEG+RMVA+RMCOM
+35 SET RMTISUG=RMTISUG+RMISU
+36 SET RMTISNG=RMTISNG+RMISN
+37 SET RMTDLEG=RMTDLEG+RMDLEU+RMDLEN
+38 SET RMTQOHUG=RMTQOHUG+RMQOHU
+39 SET RMTQOHNG=RMTQOHNG+RMQOHN
+40 SET RMTVALUG=RMTVALUG+RMVALU
+41 SET RMTVALNG=RMTVALNG+RMVALN
+42 SET RMGTOU=RMGTOU+RMVALU
+43 SET RMGTON=RMGTON+RMVALN
+44 SET RMGTIU=RMGTIU+RMISU
+45 SET RMGTIN=RMGTIN+RMISN
+46 ;total for line item
+47 SET RMTVAL=RMTVAL+RMVA
+48 SET RMTCOML=RMTCOML+RMCOM
+49 IF (RMCOM'="")
IF $GET(RMCOM)
SET RTUSELC=RTUSELC+RMCOM
+50 IF (RMVA'="")
IF $GET(RMVA)
SET RTUSELA=RTUSELA+RMVA
+51 SET RMTISUL=RMTISUL+RMISU
+52 SET RMTISNL=RMTISNL+RMISN
+53 SET RMTQOHUL=RMTQOHUL+RMQOHU
+54 SET RMTQOHNL=RMTQOHNL+RMQOHN
+55 SET RMTVALUL=RMTVALUL+RMVALU
+56 SET RMTVALNL=RMTVALNL+RMVALN
+57 SET (RPRINT,RPR)=1
+58 IF $Y+8>IOSL
IF IOST["C-"
KILL DIR
SET DIR(0)="E"
DO ^DIR
if +Y'>0
SET RFL=1
if +Y'>0
QUIT
WRITE @IOF
DO HDRL
DO LBL1^RMPR5HQ2
+59 IF $Y+8>IOSL
IF IOST'["C-"
WRITE @IOF
DO HDRL
DO LBL1^RMPR5HQ2
End DoDot:4
End DoDot:3
End DoDot:2
End DoDot:1
+60 QUIT
+61 ;
HDRL ;print heading.
+1 if $GET(RFL)
QUIT
+2 SET RMPAGE=RMPAGE+1
+3 WRITE !,"PROSTHETIC INVENTORY NPPD GROUP/LINE REPORT",?55,"Run Date: ",RMRDATE,?100,"Page: ",RMPAGE
+4 WRITE !,"STATION: ",$EXTRACT(RSTN,1,20)
+5 WRITE ?32,RMBD," - ",RMED," [ ",RMCALDAY," calendar days ]"
+6 QUIT
+7 ;
GLN1 ;print NPPD GROUP and LINE header.
+1 if $GET(RFL)
QUIT
+2 WRITE !!,RNPGRP
+3 DO LBL1^RMPR5HQ2
+4 QUIT
SUML1 ;
+1 if $GET(RFL)
QUIT
+2 WRITE !,RLINE," ",RNPLINE
+3 if $GET(RTUSELA)
SET RTAVELA=RTUSELA/RMCALDAY
+4 if $GET(RTUSELC)
SET RTAVELC=RTUSELC/RMCALDAY
+5 if $GET(RTUSELA)
SET RTDLELA=RMTQOHUL/RTAVELA
+6 if $GET(RTUSELC)
SET RTDLELC=RMTQOHNL/RTAVELC
+7 SET RTDLELA=$SELECT(RTDLELA>999:">999",1:$JUSTIFY(RTDLELA,5,0))
+8 SET RTDLELC=$SELECT(RTDLELC>999:">999",1:$JUSTIFY(RTDLELC,5,0))
+9 if RMTQOHNL=0
SET RTDLELC=""
+10 if RMTQOHUL=0
SET RTDLELA=""
+11 if (RMTQOHNL>0)&(RMTCOML<1)
SET RTDLELC=">"_RMCALDAY
+12 if (RMTQOHUL>0)&(RMTVAL<1)
SET RTDLELA=">"_RMCALDAY
+13 SET RMTAVEG=RTAVELA+RTAVELC
+14 ;next 2 lines for used:
+15 WRITE !,?5,"(Used)",?26,$JUSTIFY(RMTVAL,5),?34,$JUSTIFY($FNUMBER(RMTISUL,",",2),6),?40,"|",?59,"|",?60,$JUSTIFY(RTUSELA,5),?67,"|",?71,$JUSTIFY(RTAVELA,5,2),?78,"|"
+16 WRITE ?81,$JUSTIFY(RMTQOHUL,5),?94,"|",?97,$JUSTIFY(RTDLELA,6),?103,"|",?103,$JUSTIFY($FNUMBER(RMTVALUL,",",2),11)
+17 ;next 2 lines for new:
+18 WRITE !,?5,"(New)",?40,"|",?41,$JUSTIFY(RMTCOML,4),?49,$JUSTIFY($FNUMBER(RMTISNL,",",2),9),?59,"|",?60,$JUSTIFY(RTUSELC,5),?67,"|",?71,$JUSTIFY(RTAVELC,5,2),?78,"|"
+19 WRITE ?87,$JUSTIFY(RMTQOHNL,6),?94,"|",?97,$JUSTIFY(RTDLELC,6),?103,"|",?116,$JUSTIFY($FNUMBER(RMTVALNL,",",2),11)
+20 ;
+21 SET (RMTVAL,RMTISUL,RMTCOML,RMTISNL,RMTUSEL,RMTAVEL,RMTQOHUL,RMTQOHNL,RMTVALUL,RMTVALNL)=0
+22 SET (RTUSELA,RTUSELC,RTDLELA,RTDLELC,RTAVELA,RTAVELC)=0
+23 SET (RNPLINE,RLINE)=""
+24 QUIT
+25 ;
SUMG1 ;print summary total for NPPD GROUP
+1 if $GET(RFL)
QUIT
+2 WRITE !,REQ
+3 WRITE !,?26,$JUSTIFY(RMTVAG,5),?34,$JUSTIFY($FNUMBER(RMTISUG,",",2),6),?40,"|",?41,$JUSTIFY(RMTCOMG,4),?49,$JUSTIFY($FNUMBER(RMTISNG,",",2),9),?59,"|",?60,$JUSTIFY(RMTUSEG,5),?67,"|",?78,"|"
+4 WRITE ?81,$JUSTIFY(RMTQOHUG,5),?87,$JUSTIFY(RMTQOHNG,6),?94,"|",?103,"|",?104,$JUSTIFY($FNUMBER(RMTVALUG,",",2),11),?116,$JUSTIFY($FNUMBER(RMTVALNG,",",2),11)
+5 SET (RMTVAG,RMTISUG,RMTCOMG,RMTISNG,RMTUSEG,RMTAVEG,RMTQOHUG,RMTQOHNG,RMTVALUG,RMTVALNG,RLCNT)=0
+6 SET (RNPGRP,RGRP)=""
+7 QUIT
STN(RST) ;STATION FUNCTION
+1 NEW Y,RS
+2 SET RS=$ORDER(^RMPR(669.9,"C",RST,0))
SET Y=$PIECE(^RMPR(669.9,RS,0),U,1)
+3 QUIT Y