VistA-FOIAVistA/r/PROSTHETICS-RMPR-RMPO-RMPS/RMPRCOR.m

29 lines
859 B
Mathematica

RMPRCOR ;PHX/HPL - RECALCULATES TOTAL HOURS FOR LAB JOB FOR FILE 660 ;03/12/96
;;3.0;PROSTHETICS;**2**;Feb 09, 1996
Q
DOIT ;LOOPS THROUGH FILE 660, USES "C" X-REFF IN FILE 664.3 TO FIND
;THE HOURS FOR THE TRANSACTION, AND ADDS THEM UP BY $ORDERING THROUGH
;THE "C" X-REFF FOR FILE 664.3 THEN STORES THE RESULTS IN FILE 660
LKAT660 ;$ORDER THROUGH FILE 660
S LP=0,RLP=0
F S THRS=0,LP=$O(^RMPR(660,LP)) Q:LP'>0 D
.Q:'$D(^RMPR(660,LP,"LB"))
.S RMPRDA=+LP
.D SM6643
.S $P(^RMPR(660,RMPRDA,"LB"),U,6)=THRS
G EXIT
Q
SM6643 ;$ORDER THROUGH FILE 664.3
F S RLP=$O(^RMPR(664.3,"C",LP,RLP)) Q:RLP'>0 D
.S RDA=+RLP
.S RMLP=0 D SUMIT
Q
SUMIT ;SUM THE ENTRIES
N HRS
S RMLP=$O(^RMPR(664.3,RDA,1,RMLP)) Q:RMLP'>0 S RMDA=+RMLP S HRS=$P(^RMPR(664.3,RDA,1,RMDA,0),U,2),THRS=THRS+HRS
Q
EXIT ;COMMON EXIT
K LP,RLP,RMLP
W !,"DONE RECALCULATING !"
H 5 Q