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

LRCAPMA1.m

Go to the documentation of this file.
LRCAPMA1 ;SLC/AM/DALISC/FHS/J0  -  WKLD REPORT BY MAJ SCTN; 2/6/91
 ;;5.2;LAB SERVICE;**105,119**;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 (LRAPICGT,LRAPIIGT,LRAPIOGT,LRAPINGT)=0
 S (LRCPICGT,LRCPIIGT,LRCPIOGT,LRCPINGT)=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)+LRAPICGT+LRCPICGT
 S $P(LRGTOTS,U,2)=$P(LRGTOTS,U,2)+LRAPIIGT+LRCPIIGT
 S $P(LRGTOTS,U,3)=$P(LRGTOTS,U,3)+LRAPIOGT+LRCPIOGT
 S $P(LRGTOTS,U,4)=$P(LRGTOTS,U,4)+LRAPINGT+LRCPINGT
 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)+LRAPICGT
 S $P(LRGTOTS,U,2)=$P(LRGTOTS,U,2)+LRAPIIGT
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 . 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 D
 . S $P(^(LRCAPNAM),U,LRTYP)=$P(^TMP("LR-WL",$J,"DIV",LRLDIV,LRIN,LRMAA,LRLSSA,LRCAPNAM),U,LRTYP)+LRUC
 E  D
 . S $P(^TMP("LR-WL",$J,"DIV",LRLDIV,LRIN,LRMAA,LRLSSA,LRCAPNAM),U,LRTYP)=LRUC
 . S $P(^TMP("LR-WL",$J,"DIV",LRLDIV,LRIN,LRMAA,LRLSSA,LRCAPNAM),U,5)=LRCAPNUM
 I LRLDIV="AP" D
 . S LRGT=$S(LRTYP=1:"LRAPICGT",LRTYP=2:"LRAPIIGT",LRTYP=3:"LRAPIOGT",1:"LRAPINGT")
 . S @LRGT=@LRGT+LRUC
 E  D
 . S LRGT=$S(LRTYP=1:"LRCPICGT",LRTYP=2:"LRCPIIGT",LRTYP=3:"LRCPIOGT",1:"LRCPINGT")
 . S @LRGT=@LRGT+LRUC
 I $D(^TMP("LR-WL",$J,"DIV",LRLDIV,LRIN,LRMAA,LRLSSA,0))#2 D
 . S $P(^(0),U,LRTYP)=$P(^TMP("LR-WL",$J,"DIV",LRLDIV,LRIN,LRMAA,LRLSSA,0),U,LRTYP)+LRUC
 E  D
 . S $P(^TMP("LR-WL",$J,"DIV",LRLDIV,LRIN,LRMAA,LRLSSA,0),U,LRTYP)=LRUC
 I $D(^TMP("LR-WL",$J,"AA",LRMAA,LRLSSA,0))#2 D
 . S $P(^(0),U,LRTYP)=$P(^TMP("LR-WL",$J,"AA",LRMAA,LRLSSA,0),U,LRTYP)+LRUC
 E  D
 . S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