RMPRPI05 ;HIN/RVD-PRINT INVENTORY BALANCE BY LOCATION ;3/8/05 11:26
;;3.0;PROSTHETICS;**61**;Feb 09, 1996
; DBIA #10090 - Read Access to entire file #4.
; DBIA #10096 - Access to all %ZOSF nodes.
;
D DIV4^RMPRSIT I $D(Y),(Y<0) Q
S X="NOW" D ^%DT D DD^%DT S RMDAT=Y
;
EN K ^TMP($J),RMPRI,RMPRFLG S RMPREND=0 D HOME^%ZIS
S DIC="^RMPR(661.5,",DIC(0)="AEQ"
S DIC("S")="I $P(^RMPR(661.5,+Y,0),U,2)=RMPR(""STA"")"
;
EN1 R !!,"Enter 'ALL' for all Locations or 'RETURN' to select individual Locations: ",RMENTER:DTIME G:$D(DTOUT)!$D(DUOUT)!(RMENTER="^") EXIT1
G:RMENTER["?" EN1
S X=RMENTER X ^%ZOSF("UPPERCASE") S RMENTER=Y
I RMENTER="ALL" S RMPRI="*" G CONT
W ! F RML=1:1 S DIC("A")="Select Location "_RML_": " D ^DIC G:$D(DTOUT)!(X["^")!(X=""&(RML=1)) EXIT1 Q:X="" D
.S RMLOCI=+Y
.I $D(RMPRI(RMLOCI)) W $C(7)," ??",?40,"..Duplicate Location" S RML=RML-1 Q
.S RMPRI(RMLOCI)=""
;
CONT G:'$D(RMPRI) EXIT1 S %ZIS="MQ" K IOP D ^%ZIS G:POP EXIT1
I '$D(IO("Q")) U IO G PRINT
K IO("Q") S ZTDESC="PROSTHETIC INVENTORY LOCATION SUMMARY"
S ZTRTN="PRINT^RMPRPI05",ZTIO=ION,ZTSAVE("RMPRI(")="",ZTSAVE("RMPRI")=""
S ZTSAVE("RMPR(""STA"")")="",ZTSAVE("RMDAT")="",ZTSAVE("RMPR(")=""
D ^%ZTLOAD W:$D(ZTSK) !,"REQUEST QUEUED!" H 1 G EXIT1
;
PRINT I $E(IOST)["C" W !!,"Processing report....."
;
;call API
;input variables:
; RM = any subscript to be used
; RS = rmpr("sta")
; RMPRI = rmpri(location array)
;
S RS=RMPR("STA"),RM="RM"
;S RMCHK=$$LBAL^RMPRPI02(RM,RS,.RMPRI)
;I RMCHK W !!,"***Error in API RMPRPI02 !!!!",!! G EXIT
D PROC^RMPRPI02(RM,RS,.RMPRI)
;
S RMPAGE=1,RMPREND=0
I '$D(^TMP($J,"RM")) D NONE G EXIT
W:$E(IOST)["C" @IOF
D HEAD,WRI
G EXIT
;
;write/print report
;rl = Location
;rh = HCPCS
;j = Item
;k = Date
;
WRI S RL=""
F S RL=$O(^TMP($J,"RM",RL)) Q:(RL="")!(RMPREND) K RMPRFLG S RH="",RLF=RL F S RH=$O(^TMP($J,"RM",RL,RH)) Q:(RH="")!(RMPREND) S J=0 D
.F S J=$O(^TMP($J,"RM",RL,RH,J)) Q:(J'>0)!(RMPREND) S K=0 F S K=$O(^TMP($J,"RM",RL,RH,J,K)) Q:(K'>0)!(RMPREND) D
..S RM3=^TMP($J,"RM",RL,RH,J,K)
..S RMIT=J
..S RMDTE=" "
..S:K'=1 RMDTE=$E(K,4,5)_"/"_$E(K,6,7)_"/"_$E(K,2,3)
..S (RMAST,RMUNI)=""
..S RMROR=$P(RM3,U,7)
..S RMQTY=$P(RM3,U,1)
..S RMCOS=$P(RM3,U,3)
..S RMVAL=$P(RM3,U,2)
..S RMVEN=$P(RM3,U,4)
..S RMIDE=$P(RM3,U,5)
..S RMUNI=$P(RM3,U,8)
..S RMSOR=$P(RM3,U,9)
..S:RMROR>RMQTY RMAST="*"
..S:RMQTY="" RMQTY=0
..S RLO=RL
..I '$D(RMPRFLG) D HEAD1
..S RMIDE=$E(RMIDE,1,24)
..W !,RH_"-"_RMIT,?10,RMIDE,?35,RMSOR,?37,$E(RMVEN,1,6),?44,RMDTE,?54,RMUNI,?56,$J(RMQTY,4)
..W ?61,$J(RMCOS,8,2),?69,$J($FN(RMVAL,",",2),10)
..S RMPRFLG=1
..I $E(IOST)["C",($Y>(IOSL-7)) S DIR(0)="E" D ^DIR S:$D(DTOUT)!(Y=0) RMPREND=1 Q:RMPREND W @IOF D HEAD,HEAD1 Q
..I $Y>(IOSL-6) W @IOF D HEAD,HEAD1 Q
W !,RMPR("L"),!,"<End of Report>"
Q
;
HEAD W !,"*** PROSTHETICS INVENTORY BALANCE BY LOCATION ***"
W ?68,"PAGE: ",RMPAGE
W !,"Run Date: ",RMDAT,?30,"station: ",$E($P($G(^DIC(4,RS,0)),U,1),1,20)
S RMPAGE=RMPAGE+1
Q
;
HEAD1 I $E(IOST)["C",($Y>(IOSL-7)) S DIR(0)="E" D ^DIR S:$D(DTOUT)!(Y=0) RMPREND=1 Q:RMPREND W @IOF D HEAD
I $E(IOST)'["C",($Y>(IOSL-6)) W @IOF D HEAD
W !,RMPR("L")
W !,"Location: ",RLO
W !,?52,"UNIT"
W !,?45,"DATE",?53,"OF",?65,"UNIT",?74,"TOTAL"
W !,"HCPCS",?10,"ITEM",?33,"SRC",?37,"VENDOR"
W ?45,"RECVD",?52,"ISSUE",?58,"QTY",?65,"COST",?74,"VALUE"
W !,"-----",?10,"----",?33,"---",?37,"------"
W ?45,"-----",?52,"-----",?58,"---",?65,"----",?73,"------"
S RMPRFLG=1
Q
;
EXIT I $E(IOST)["C",'RMPREND W ! S DIR(0)="E" D ^DIR
;
EXIT1 D ^%ZISC
N RMPR,RMPRSITE D KILL^XUSCLEAN
K ^TMP($J)
Q
;
NONE ;
W:$E(IOST)["C" @IOF
D HEAD
W !!,"NO DATA !!!!"
Q
--- Routine Detail --- with STRUCTURED ROUTINE LISTING ---[H[J[2J[HRMPRPI05 3786 printed Oct 16, 2024@18:36:37 Page 2
RMPRPI05 ;HIN/RVD-PRINT INVENTORY BALANCE BY LOCATION ;3/8/05 11:26
+1 ;;3.0;PROSTHETICS;**61**;Feb 09, 1996
+2 ; DBIA #10090 - Read Access to entire file #4.
+3 ; DBIA #10096 - Access to all %ZOSF nodes.
+4 ;
+5 DO DIV4^RMPRSIT
IF $DATA(Y)
IF (Y<0)
QUIT
+6 SET X="NOW"
DO ^%DT
DO DD^%DT
SET RMDAT=Y
+7 ;
EN KILL ^TMP($JOB),RMPRI,RMPRFLG
SET RMPREND=0
DO HOME^%ZIS
+1 SET DIC="^RMPR(661.5,"
SET DIC(0)="AEQ"
+2 SET DIC("S")="I $P(^RMPR(661.5,+Y,0),U,2)=RMPR(""STA"")"
+3 ;
EN1 READ !!,"Enter 'ALL' for all Locations or 'RETURN' to select individual Locations: ",RMENTER:DTIME
if $DATA(DTOUT)!$DATA(DUOUT)!(RMENTER="^")
GOTO EXIT1
+1 if RMENTER["?"
GOTO EN1
+2 SET X=RMENTER
XECUTE ^%ZOSF("UPPERCASE")
SET RMENTER=Y
+3 IF RMENTER="ALL"
SET RMPRI="*"
GOTO CONT
+4 WRITE !
FOR RML=1:1
SET DIC("A")="Select Location "_RML_": "
DO ^DIC
if $DATA(DTOUT)!(X["^")!(X=""&(RML=1))
GOTO EXIT1
if X=""
QUIT
Begin DoDot:1
+5 SET RMLOCI=+Y
+6 IF $DATA(RMPRI(RMLOCI))
WRITE $CHAR(7)," ??",?40,"..Duplicate Location"
SET RML=RML-1
QUIT
+7 SET RMPRI(RMLOCI)=""
End DoDot:1
+8 ;
CONT if '$DATA(RMPRI)
GOTO EXIT1
SET %ZIS="MQ"
KILL IOP
DO ^%ZIS
if POP
GOTO EXIT1
+1 IF '$DATA(IO("Q"))
USE IO
GOTO PRINT
+2 KILL IO("Q")
SET ZTDESC="PROSTHETIC INVENTORY LOCATION SUMMARY"
+3 SET ZTRTN="PRINT^RMPRPI05"
SET ZTIO=ION
SET ZTSAVE("RMPRI(")=""
SET ZTSAVE("RMPRI")=""
+4 SET ZTSAVE("RMPR(""STA"")")=""
SET ZTSAVE("RMDAT")=""
SET ZTSAVE("RMPR(")=""
+5 DO ^%ZTLOAD
if $DATA(ZTSK)
WRITE !,"REQUEST QUEUED!"
HANG 1
GOTO EXIT1
+6 ;
PRINT IF $EXTRACT(IOST)["C"
WRITE !!,"Processing report....."
+1 ;
+2 ;call API
+3 ;input variables:
+4 ; RM = any subscript to be used
+5 ; RS = rmpr("sta")
+6 ; RMPRI = rmpri(location array)
+7 ;
+8 SET RS=RMPR("STA")
SET RM="RM"
+9 ;S RMCHK=$$LBAL^RMPRPI02(RM,RS,.RMPRI)
+10 ;I RMCHK W !!,"***Error in API RMPRPI02 !!!!",!! G EXIT
+11 DO PROC^RMPRPI02(RM,RS,.RMPRI)
+12 ;
+13 SET RMPAGE=1
SET RMPREND=0
+14 IF '$DATA(^TMP($JOB,"RM"))
DO NONE
GOTO EXIT
+15 if $EXTRACT(IOST)["C"
WRITE @IOF
+16 DO HEAD
DO WRI
+17 GOTO EXIT
+18 ;
+19 ;write/print report
+20 ;rl = Location
+21 ;rh = HCPCS
+22 ;j = Item
+23 ;k = Date
+24 ;
WRI SET RL=""
+1 FOR
SET RL=$ORDER(^TMP($JOB,"RM",RL))
if (RL="")!(RMPREND)
QUIT
KILL RMPRFLG
SET RH=""
SET RLF=RL
FOR
SET RH=$ORDER(^TMP($JOB,"RM",RL,RH))
if (RH="")!(RMPREND)
QUIT
SET J=0
Begin DoDot:1
+2 FOR
SET J=$ORDER(^TMP($JOB,"RM",RL,RH,J))
if (J'>0)!(RMPREND)
QUIT
SET K=0
FOR
SET K=$ORDER(^TMP($JOB,"RM",RL,RH,J,K))
if (K'>0)!(RMPREND)
QUIT
Begin DoDot:2
+3 SET RM3=^TMP($JOB,"RM",RL,RH,J,K)
+4 SET RMIT=J
+5 SET RMDTE=" "
+6 if K'=1
SET RMDTE=$EXTRACT(K,4,5)_"/"_$EXTRACT(K,6,7)_"/"_$EXTRACT(K,2,3)
+7 SET (RMAST,RMUNI)=""
+8 SET RMROR=$PIECE(RM3,U,7)
+9 SET RMQTY=$PIECE(RM3,U,1)
+10 SET RMCOS=$PIECE(RM3,U,3)
+11 SET RMVAL=$PIECE(RM3,U,2)
+12 SET RMVEN=$PIECE(RM3,U,4)
+13 SET RMIDE=$PIECE(RM3,U,5)
+14 SET RMUNI=$PIECE(RM3,U,8)
+15 SET RMSOR=$PIECE(RM3,U,9)
+16 if RMROR>RMQTY
SET RMAST="*"
+17 if RMQTY=""
SET RMQTY=0
+18 SET RLO=RL
+19 IF '$DATA(RMPRFLG)
DO HEAD1
+20 SET RMIDE=$EXTRACT(RMIDE,1,24)
+21 WRITE !,RH_"-"_RMIT,?10,RMIDE,?35,RMSOR,?37,$EXTRACT(RMVEN,1,6),?44,RMDTE,?54,RMUNI,?56,$JUSTIFY(RMQTY,4)
+22 WRITE ?61,$JUSTIFY(RMCOS,8,2),?69,$JUSTIFY($FNUMBER(RMVAL,",",2),10)
+23 SET RMPRFLG=1
+24 IF $EXTRACT(IOST)["C"
IF ($Y>(IOSL-7))
SET DIR(0)="E"
DO ^DIR
if $DATA(DTOUT)!(Y=0)
SET RMPREND=1
if RMPREND
QUIT
WRITE @IOF
DO HEAD
DO HEAD1
QUIT
+25 IF $Y>(IOSL-6)
WRITE @IOF
DO HEAD
DO HEAD1
QUIT
End DoDot:2
End DoDot:1
+26 WRITE !,RMPR("L"),!,"<End of Report>"
+27 QUIT
+28 ;
HEAD WRITE !,"*** PROSTHETICS INVENTORY BALANCE BY LOCATION ***"
+1 WRITE ?68,"PAGE: ",RMPAGE
+2 WRITE !,"Run Date: ",RMDAT,?30,"station: ",$EXTRACT($PIECE($GET(^DIC(4,RS,0)),U,1),1,20)
+3 SET RMPAGE=RMPAGE+1
+4 QUIT
+5 ;
HEAD1 IF $EXTRACT(IOST)["C"
IF ($Y>(IOSL-7))
SET DIR(0)="E"
DO ^DIR
if $DATA(DTOUT)!(Y=0)
SET RMPREND=1
if RMPREND
QUIT
WRITE @IOF
DO HEAD
+1 IF $EXTRACT(IOST)'["C"
IF ($Y>(IOSL-6))
WRITE @IOF
DO HEAD
+2 WRITE !,RMPR("L")
+3 WRITE !,"Location: ",RLO
+4 WRITE !,?52,"UNIT"
+5 WRITE !,?45,"DATE",?53,"OF",?65,"UNIT",?74,"TOTAL"
+6 WRITE !,"HCPCS",?10,"ITEM",?33,"SRC",?37,"VENDOR"
+7 WRITE ?45,"RECVD",?52,"ISSUE",?58,"QTY",?65,"COST",?74,"VALUE"
+8 WRITE !,"-----",?10,"----",?33,"---",?37,"------"
+9 WRITE ?45,"-----",?52,"-----",?58,"---",?65,"----",?73,"------"
+10 SET RMPRFLG=1
+11 QUIT
+12 ;
EXIT IF $EXTRACT(IOST)["C"
IF 'RMPREND
WRITE !
SET DIR(0)="E"
DO ^DIR
+1 ;
EXIT1 DO ^%ZISC
+1 NEW RMPR,RMPRSITE
DO KILL^XUSCLEAN
+2 KILL ^TMP($JOB)
+3 QUIT
+4 ;
NONE ;
+1 if $EXTRACT(IOST)["C"
WRITE @IOF
+2 DO HEAD
+3 WRITE !!,"NO DATA !!!!"
+4 QUIT