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

RMPR5HQH.m

Go to the documentation of this file.
RMPR5HQH ;HCIOFO/RVD - HCPCS USAGE REPORT  ; 15 AUG 00
 ;;3.0;PROSTHETICS;**51**;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^RMPR5HQL(RST),RPR=0 F RI=0:0 S RI=$O(^TMP($J,R5,RST,RI)) Q:$G(RFL)  Q:RI'>0  D
 .D:RPR=0 HDRH
 .S RNPGRP=RMARRAY(RI)
 .S RJ=""
 .F  S RJ=$O(^TMP($J,R5,RST,RI,RJ)) Q:$G(RFL)  D:(RLINE'="")&(RLINE'=RJ) SUML1^RMPR5HQ2 Q:RJ=""  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)  D:(RHCPC'="")&(RHCPC'=RK)&(RLCNT'=0) SUMH1 Q:RK=""  D
 ...S RHCPC=RK
 ...S RL=""
 ...F  S RL=$O(^TMP($J,R5,RST,RI,RJ,RK,RL)) Q:$G(RFL)!(RL="")  D
 ....S RHCPC=$P(RK,"/",1)
 ....S RMHCDA=$P(RK,"/",2)
 ....S RNPITEM=$P($G(^RMPR(661.1,RMHCDA,0)),U,2)
 ....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 HCPCS
 ....S RMTVAH=RMTVAH+RMVA
 ....S RMTCOMH=RMTCOMH+RMCOM
 ....S RMTISUH=RMTISUH+RMISU
 ....S RMTISNH=RMTISNH+RMISN
 ....I (RMCOM'=""),$G(RMCOM) S RTUSEHC=RTUSEHC+RMCOM
 ....I (RMVA'=""),$G(RMVA) S RTUSEHA=RTUSEHA+RMVA
 ....S RMTQOHUH=RMTQOHUH+RMQOHU
 ....S RMTQOHNH=RMTQOHNH+RMQOHN
 ....S RMTVALUH=RMTVALUH+RMVALU
 ....S RMTVALNH=RMTVALNH+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
 ....;S RMTUSEL=RMTUSEL+RMUSE
 ....S:RMVA'="" RMTUSELU=RMTUSELU+RMVA
 ....S:RMCOM'="" RMTUSELN=RMTUSELN+RMCOM
 ....S RMTISUL=RMTISUL+RMISU
 ....S RMTAVELU=RMTAVELU+RMAVEU
 ....S RMTAVELN=RMTAVELN+RMAVEN
 ....S RMTDLEL=RMTDLEL+RMDLEU+RMDLEN
 ....S RMTISNL=RMTISNL+RMISN
 ....S RMTQOHUL=RMTQOHUL+RMQOHU
 ....S RMTQOHNL=RMTQOHNL+RMQOHN
 ....S RMTVALUL=RMTVALUL+RMVALU
 ....S RMTVALNL=RMTVALNL+RMVALN
 ....S (RPRINT,RPR)=1
 Q
 ;
HDRH ;print heading.
 Q:$G(RFL)
 S RMPAGE=RMPAGE+1
 W !,"PROSTHETIC INVENTORY HCPCS SUMMARY REPORT",?50,"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 !!,RJ," ",RNPLINE," [ ",RNPGRP," ]"
 D LBL1^RMPR5HQ2
 Q
 ;
SUMH1 ;
 Q:$G(RFL)
 S:$G(RTUSEHC) RTAVEHC=RTUSEHC/RMCALDAY
 S:$G(RTAVEHC) RTDLEHC=RMTQOHNH/RTAVEHC
 S:$G(RTUSEHA) RTAVEHA=RTUSEHA/RMCALDAY
 S:$G(RTAVEHA) RTDLEHA=RMTQOHUH/RTAVEHA
 S RTDLEHA=$S(RTDLEHA>999:">999",1:$J(RTDLEHA,6,0))
 S RTDLEHC=$S(RTDLEHC>999:">999",1:$J(RTDLEHC,6,0))
 S:RMTQOHNH=0 RTDLEHC=""
 S:RMTQOHUH=0 RTDLEHA=""
 S:(RMTQOHNH>0)&(RMTCOMH<1) RTDLEHC=">"_RMCALDAY
 S:(RMTQOHUH>0)&(RMTVAH<1) RTDLEHA=">"_RMCALDAY
 S RMTAVEL=RTAVEHA+RTAVEHC
 ;next 2 lines for used:
 W !,RHCPC,?10,$E(RNPITEM,1,10),"(Used)",?26,$J(RMTVAH,5),?34,$J($FN(RMTISUH,",",2),6),?40,"|",?59,"|",?60,$J(RTUSEHA,5),?67,"|",?71,$J(RTAVEHA,5,2),?78,"|"
 W ?81,$J(RMTQOHUH,5),?94,"|",?97,$J(RTDLEHA,6),?103,"|",?104,$J($FN(RMTVALUH,",",2),11)
 ;next 2 lines for new:
 W !,RHCPC,?10,$E(RNPITEM,1,10),"(New)",?40,"|",?41,$J(RMTCOMH,4),?49,$J($FN(RMTISNH,",",2),9),?59,"|",?60,$J(RTUSEHC,5),?67,"|",?71,$J(RTAVEHC,5,2),?78,"|"
 W ?87,$J(RMTQOHNH,6),?94,"|",?97,$J(RTDLEHC,6),?103,"|",?116,$J($FN(RMTVALNH,",",2),11)
 S 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 HDRH,LBL1^RMPR5HQ2
 I $Y+8>IOSL,IOST'["C-" W @IOF D HDRH,LBL1^RMPR5HQ2
 S (RMTVAH,RMTISUH,RMTCOMH,RMTISNH,RMTUSEH,RMTAVEH,RMTQOHUH,RMTQOHNH,RMTVALUH,RMTVALNH,RHCNT)=0
 S (RTUSEHA,RTUSEHC,RTDLEHA,RTDLEHC,RTAVEHA,RTAVEHC)=0
 Q