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(LRGTOTS,U,2)=$P(LRGTOTS,U,2)+LRCPIGTU
S ^TMP("LR-WL",$J,"DIV","CP",LRIN,0)=LRGTOTS
Q
CC ;
S LRCAPNAM=$$WKLDNAME^LRCAPU(LRCC)
D BMPMANL^LRCAPMR1
S LRCTM=$S(LRCTMB=0:"",1:LRCTMB-.001),LRFIRST=1
F S LRCTM=$O(^LRO(64.1,LRIN,1,LRCDT,1,LRCC,1,LRCTM)) Q:(LRCTM>LRCTME)!(LRCTM="") D TM
Q
TM ;
Q:'($D(^LRO(64.1,LRIN,1,LRCDT,1,LRCC,1,LRCTM,0))#2)
S LRX=^(0)
S LRMA=$P(LRX,U,7)
I LRAA Q:'$D(LRAA(LRMA))
S LRUC=+$P(LRX,U,3),LRLDIV=$P(LRX,U,6),LRLSS=$P(LRX,U,8),LRSPEC=+$P(LRX,U,14)
S:'LRUC LRUC=1
S LRUW=+$P($G(^LAM(LRCC,0)),U,10),LRFIRST=0 S LRUWSP=+$P($G(^LAM(LRCC,5,LRSPEC,0)),U,2) S:LRUWSP LRUW=LRUWSP_"*" K LRUWSP
S LRWC=LRUC*LRUW
;
;
I +LRMA D
. S LRREC=$G(^LRO(68,LRMA,0))
. S LRMAA=$S($P(LRREC,U,11)]"":$P(LRREC,U,11),1:LRNDFN)
. S LRMAN=$S($P(LRREC,U)]"":$P(LRREC,U),1:LRNDFN)
. S LRMAN(LRMAA)=LRMAN
I '+LRMA S (LRMAA,LRMAN)=LRNDFN,LRMAN(LRMAA)=LRMAN
I +LRLSS D
. S LRREC=$G(^LRO(68,LRLSS,0))
. S LRLSSA=$S($P(LRREC,U,11)]"":$P(LRREC,U,11),1:LRNDFN)
. S LRLSSN=$S($P(LRREC,U)]"":$P(LRREC,U),1:LRNDFN)
. S LRLSSN(LRLSSA)=LRLSSN
I '+LRLSS S (LRLSSA,LRLSSN)=LRNDFN,LRLSSN(LRLSSA)=LRLSSN
;
;
I $D(^TMP("LR-WL",$J,"DIV",LRLDIV,LRIN,LRMAA,LRLSSA,LRCAPNAM))#2 S LRX=^(LRCAPNAM),LRX1=LRUC+$P(LRX,"^"),LRX2=LRWC+$P(LRX,"^",2),^(LRCAPNAM)=LRX1_"^"_LRX2_"^"_LRUW_"^"_LRCAPNUM
E S ^TMP("LR-WL",$J,"DIV",LRLDIV,LRIN,LRMAA,LRLSSA,LRCAPNAM)=LRUC_"^"_LRWC_"^"_LRUW_"^"_LRCAPNUM
I LRLDIV="AP" S LRAPIGT=LRAPIGT+LRWC,LRAPIGTU=LRAPIGTU+LRUC
E S LRCPIGT=LRCPIGT+LRWC,LRCPIGTU=LRCPIGTU+LRUC
I $D(^TMP("LR-WL",$J,"DIV",LRLDIV,LRIN,LRMAA,LRLSSA,0))#2 S LRX1=+$P(^(0),"^")+LRWC,LRX2=+$P(^(0),"^",2)+LRUC,^(0)=LRX1_"^"_LRX2
E S ^TMP("LR-WL",$J,"DIV",LRLDIV,LRIN,LRMAA,LRLSSA,0)=LRWC_"^"_LRUC
I $D(^TMP("LR-WL",$J,"AA",LRMAA,LRLSSA,0))#2 S LRX1=+$P(^(0),"^")+LRWC,LRX2=+$P(^(0),"^",2)+LRUC,^(0)=LRX1_"^"_LRX2
E S ^TMP("LR-WL",$J,"AA",LRMAA,LRLSSA,0)=LRWC_"^"_LRUC
Q
GTIN ;
S:LRGETIN LRIN=+$O(^LRO(64.1,LRIN))
S:LRIN LRINN=$S($D(^DIC(4,LRIN,0))#2:$P(^DIC(4,LRIN,0),U),1:LRNDFN)
S LRGETIN=1
Q
--- Routine Detail --- with STRUCTURED ROUTINE LISTING ---[H[J[2J[HLRCAPML1 3084 printed Oct 16, 2024@18:13:48 Page 2
LRCAPML1 ;SLC/AM/DALISC/FHS/J0 - WKLD COST REP BY MAJ SCTN; 2/6/91@16:04
+1 ;;5.2;LAB SERVICE;;Sep 27, 1994
EN ;
+1 DO INITMAN^LRCAPMR1
+2 SET LRGETIN=$SELECT(LRIN:0,1:1)
+3 FOR
DO BUILD
if (LREND)!('LRLOOP)!(LRBLDONE)
QUIT
+4 QUIT
BUILD ; BUILD DATA SUBSET IN ^TMP
+1 DO GTIN
+2 IF 'LRIN
SET LRBLDONE=1
QUIT
+3 DO GENCOM^LRCAPMR1
DO CAPCOM^LRCAPMR1
+4 SET (LRAPIGT,LRAPIGTU,LRCPIGT,LRCPIGTU)=0
+5 SET LRCDT=LRCDTB-1
+6 FOR
SET LRCDT=$ORDER(^LRO(64.1,LRIN,1,LRCDT))
if (LRCDT>LRCDTE)!(LRCDT<1)
QUIT
Begin DoDot:1
+7 DO DATCOM^LRCAPMR1
+8 if $EXTRACT(IOST,1,2)="C-"
WRITE "."
+9 SET LRCC=0
+10 FOR
SET LRCC=$ORDER(^LRO(64.1,LRIN,1,LRCDT,1,LRCC))
if (LRCC<1)
QUIT
DO CC
End DoDot:1
+11 SET LRGTOTS=$GET(^TMP("LR-WL",$JOB,0))
+12 SET $PIECE(LRGTOTS,U)=$PIECE(LRGTOTS,U)+LRAPIGT+LRCPIGT
+13 SET $PIECE(LRGTOTS,U,2)=$PIECE(LRGTOTS,U,2)+LRAPIGTU+LRCPIGTU
+14 SET ^TMP("LR-WL",$JOB,0)=LRGTOTS
+15 SET LRGTOTS=$GET(^TMP("LR-WL",$JOB,"DIV","AP",LRIN,0))
+16 SET $PIECE(LRGTOTS,U)=$PIECE(LRGTOTS,U)+LRAPIGT
+17 SET $PIECE(LRGTOTS,U,2)=$PIECE(LRGTOTS,U,2)+LRAPIGTU
+18 SET ^TMP("LR-WL",$JOB,"DIV","AP",LRIN,0)=LRGTOTS
+19 SET LRGTOTS=$GET(^TMP("LR-WL",$JOB,"DIV","CP",LRIN,0))
+20 SET $PIECE(LRGTOTS,U)=$PIECE(LRGTOTS,U)+LRCPIGT
+21 SET $PIECE(LRGTOTS,U,2)=$PIECE(LRGTOTS,U,2)+LRCPIGTU
+22 SET ^TMP("LR-WL",$JOB,"DIV","CP",LRIN,0)=LRGTOTS
+23 QUIT
CC ;
+1 SET LRCAPNAM=$$WKLDNAME^LRCAPU(LRCC)
+2 DO BMPMANL^LRCAPMR1
+3 SET LRCTM=$SELECT(LRCTMB=0:"",1:LRCTMB-.001)
SET LRFIRST=1
+4 FOR
SET LRCTM=$ORDER(^LRO(64.1,LRIN,1,LRCDT,1,LRCC,1,LRCTM))
if (LRCTM>LRCTME)!(LRCTM="")
QUIT
DO TM
+5 QUIT
TM ;
+1 if '($DATA(^LRO(64.1,LRIN,1,LRCDT,1,LRCC,1,LRCTM,0))#2)
QUIT
+2 SET LRX=^(0)
+3 SET LRMA=$PIECE(LRX,U,7)
+4 IF LRAA
if '$DATA(LRAA(LRMA))
QUIT
+5 SET LRUC=+$PIECE(LRX,U,3)
SET LRLDIV=$PIECE(LRX,U,6)
SET LRLSS=$PIECE(LRX,U,8)
SET LRSPEC=+$PIECE(LRX,U,14)
+6 if 'LRUC
SET LRUC=1
+7 SET LRUW=+$PIECE($GET(^LAM(LRCC,0)),U,10)
SET LRFIRST=0
SET LRUWSP=+$PIECE($GET(^LAM(LRCC,5,LRSPEC,0)),U,2)
if LRUWSP
SET LRUW=LRUWSP_"*"
KILL LRUWSP
+8 SET LRWC=LRUC*LRUW
+9 ;
+10 ;
+11 IF +LRMA
Begin DoDot:1
+12 SET LRREC=$GET(^LRO(68,LRMA,0))
+13 SET LRMAA=$SELECT($PIECE(LRREC,U,11)]"":$PIECE(LRREC,U,11),1:LRNDFN)
+14 SET LRMAN=$SELECT($PIECE(LRREC,U)]"":$PIECE(LRREC,U),1:LRNDFN)
+15 SET LRMAN(LRMAA)=LRMAN
End DoDot:1
+16 IF '+LRMA
SET (LRMAA,LRMAN)=LRNDFN
SET LRMAN(LRMAA)=LRMAN
+17 IF +LRLSS
Begin DoDot:1
+18 SET LRREC=$GET(^LRO(68,LRLSS,0))
+19 SET LRLSSA=$SELECT($PIECE(LRREC,U,11)]"":$PIECE(LRREC,U,11),1:LRNDFN)
+20 SET LRLSSN=$SELECT($PIECE(LRREC,U)]"":$PIECE(LRREC,U),1:LRNDFN)
+21 SET LRLSSN(LRLSSA)=LRLSSN
End DoDot:1
+22 IF '+LRLSS
SET (LRLSSA,LRLSSN)=LRNDFN
SET LRLSSN(LRLSSA)=LRLSSN
+23 ;
+24 ;
+25 IF $DATA(^TMP("LR-WL",$JOB,"DIV",LRLDIV,LRIN,LRMAA,LRLSSA,LRCAPNAM))#2
SET LRX=^(LRCAPNAM)
SET LRX1=LRUC+$PIECE(LRX,"^")
SET LRX2=LRWC+$PIECE(LRX,"^",2)
SET ^(LRCAPNAM)=LRX1_"^"_LRX2_"^"_LRUW_"^"_LRCAPNUM
+26 IF '$TEST
SET ^TMP("LR-WL",$JOB,"DIV",LRLDIV,LRIN,LRMAA,LRLSSA,LRCAPNAM)=LRUC_"^"_LRWC_"^"_LRUW_"^"_LRCAPNUM
+27 IF LRLDIV="AP"
SET LRAPIGT=LRAPIGT+LRWC
SET LRAPIGTU=LRAPIGTU+LRUC
+28 IF '$TEST
SET LRCPIGT=LRCPIGT+LRWC
SET LRCPIGTU=LRCPIGTU+LRUC
+29 IF $DATA(^TMP("LR-WL",$JOB,"DIV",LRLDIV,LRIN,LRMAA,LRLSSA,0))#2
SET LRX1=+$PIECE(^(0),"^")+LRWC
SET LRX2=+$PIECE(^(0),"^",2)+LRUC
SET ^(0)=LRX1_"^"_LRX2
+30 IF '$TEST
SET ^TMP("LR-WL",$JOB,"DIV",LRLDIV,LRIN,LRMAA,LRLSSA,0)=LRWC_"^"_LRUC
+31 IF $DATA(^TMP("LR-WL",$JOB,"AA",LRMAA,LRLSSA,0))#2
SET LRX1=+$PIECE(^(0),"^")+LRWC
SET LRX2=+$PIECE(^(0),"^",2)+LRUC
SET ^(0)=LRX1_"^"_LRX2
+32 IF '$TEST
SET ^TMP("LR-WL",$JOB,"AA",LRMAA,LRLSSA,0)=LRWC_"^"_LRUC
+33 QUIT
GTIN ;
+1 if LRGETIN
SET LRIN=+$ORDER(^LRO(64.1,LRIN))
+2 if LRIN
SET LRINN=$SELECT($DATA(^DIC(4,LRIN,0))#2:$PIECE(^DIC(4,LRIN,0),U),1:LRNDFN)
+3 SET LRGETIN=1
+4 QUIT