77 lines
2.9 KiB
Mathematica
77 lines
2.9 KiB
Mathematica
LRCAPML1 ;SLC/AM/DALISC/FHS/J0 - WKLD COST REP BY MAJ SCTN; 2/6/91@16:04
|
|
;;5.2;LAB SERVICE;;Sep 27, 1994
|
|
EN ;
|
|
D INITMAN^LRCAPMR1
|
|
S LRGETIN=$S(LRIN:0,1:1)
|
|
F D BUILD Q:(LREND)!('LRLOOP)!(LRBLDONE)
|
|
Q
|
|
BUILD ; BUILD DATA SUBSET IN ^TMP
|
|
D GTIN
|
|
I 'LRIN S LRBLDONE=1 Q
|
|
D GENCOM^LRCAPMR1,CAPCOM^LRCAPMR1
|
|
S (LRAPIGT,LRAPIGTU,LRCPIGT,LRCPIGTU)=0
|
|
S LRCDT=LRCDTB-1
|
|
F S LRCDT=$O(^LRO(64.1,LRIN,1,LRCDT)) Q:(LRCDT>LRCDTE)!(LRCDT<1) D
|
|
. D DATCOM^LRCAPMR1
|
|
. W:$E(IOST,1,2)="C-" "."
|
|
. S LRCC=0
|
|
. F S LRCC=$O(^LRO(64.1,LRIN,1,LRCDT,1,LRCC)) Q:(LRCC<1) D CC
|
|
S LRGTOTS=$G(^TMP("LR-WL",$J,0))
|
|
S $P(LRGTOTS,U)=$P(LRGTOTS,U)+LRAPIGT+LRCPIGT
|
|
S $P(LRGTOTS,U,2)=$P(LRGTOTS,U,2)+LRAPIGTU+LRCPIGTU
|
|
S ^TMP("LR-WL",$J,0)=LRGTOTS
|
|
S LRGTOTS=$G(^TMP("LR-WL",$J,"DIV","AP",LRIN,0))
|
|
S $P(LRGTOTS,U)=$P(LRGTOTS,U)+LRAPIGT
|
|
S $P(LRGTOTS,U,2)=$P(LRGTOTS,U,2)+LRAPIGTU
|
|
S ^TMP("LR-WL",$J,"DIV","AP",LRIN,0)=LRGTOTS
|
|
S LRGTOTS=$G(^TMP("LR-WL",$J,"DIV","CP",LRIN,0))
|
|
S $P(LRGTOTS,U)=$P(LRGTOTS,U)+LRCPIGT
|
|
S $P(LRGTO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