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

LRARCPTS.m

Go to the documentation of this file.
LRARCPTS ; IHS/DIR/AAB - ARCHIVED TREATING SPECIALTY WORKLOAD REPORT : ; [ 5/30/95 ]
 ;;5.2;LR;**1002**;JUN 01, 1998
 ;;5.2;LAB SERVICE;**59**;Aug 31, 1995
 ;same as LRCAPTS except archived wkld file
EN ;
 ;Check for lab archival activity in archived status
 S LRART=64.1,LRARC=0 S LRARC=$O(^LAB(95.11,"O",2,LRART,LRARC))
 I LRARC="" D ERROR
 ; GET THE PARAMETERS
TS K LRAA S (LRSUMM,LRLOOP,LREND)=0 W !!?10,"Would you like the report in PTF Treating Specialty " S %=2 D YN^DICN G CLEAN:%<0,TS:%=0 S:%=1 LRPTF=1
 D ^LRARCMR I LRIN=-1!(LRIN="") S LREND=1 G CLEAN
 I $G(LREND) G CLEAN
 I $D(IO("Q")) D LOAD G CLEAN
 I IO'=IO(0) S IOP=ION D ^%ZIS I POP W !,"Device is busy  Try later",! G CLEAN
 U IO
QUE ;
 I $D(ZTQUEUED) S ZTREQ="@" K ^TMP($J)
 S LREND=0,LRNDFN="UNDEFINED" I LRIN=0 S LRLOOP=1 D GTIN G:LRIN=0 CLEAN
 S LRCTSX=$S($L($G(^DIC(45.7,+$P(^LAB(69.9,1,0),U,19),0))):$P(^(0),U),1:"AMBULATORY CARE")
TOP ;
 S LRPAGE=1
SUM ; DO SUMMATION IN UTILITY
 S (LRUC,LRWC,LRGT,LRGTU)=0
 S LRCDT=LRCDTB-1 F  S LRCDT=$O(^LAR(64.19999,LRIN,1,"B",LRCDT)) Q:(LRCDT>LRCDTE)!(LRCDT<1)  D
 . S LRCDTN=0,LRCDTN=$O(^LAR(64.19999,LRIN,1,"B",LRCDT,LRCDTN))
 . W:$E(IOST,1)="C" "."
 . S LRCC=0 F  S LRCC=$O(^LAR(64.19999,LRIN,1,LRCDTN,1,"B",LRCC)) Q:(LRCC="")  D CC
 S ^TMP($J,"LRAR-WL",0)=LRGT_"^"_LRGTU
PRN ; PRINT THE REPORT
 D EN^LRARCTS1
CLEAN ;
 K DIC,^TMP($J,"LRAR-WL")
 K LRANS,LRCC,LRCCN,LRCCZ,LRCDT,LRCDTN,LRCTM,LRCW,LRFIRST,LRGT,LRQC,LRRPT,LRST,LRSTD
 K LRTC,LRTS,LRTSN,LRTRN,LRUC,LRUW,LRWC,LRX,X,Y,LRCAPN,LRPAGE,LRGTU,LRSTU
 K DX,DY,LRX1,LRX2
 I '$G(LREND),$G(LRLOOP) D GTIN G:LRIN TOP
 D KILLALL^LRARCU
 D:'$D(ZTQUEUED) ^%ZISC
 Q
LOAD ;
 S ZTIO=ION,ZTRTN="QUE^LRARCPTS",ZTDESC="TREATING SPECIALTY ARCHIVED WORKLOAD REPORT"
 S ZTSAVE("LR*")="" D ^%ZTLOAD
 Q
CC ;
 S LRCCN=0,LRCCN=$O(^LAR(64.19999,LRIN,1,LRCDTN,1,"B",LRCC,LRCCN))
 S LRCCZ=$P(^LAR(64.19999,LRIN,1,LRCDTN,1,LRCCN,0),U)
 S:$E(LRCCZ)="+" LRCCZ=$E(LRCCZ,2,99)
 S LRCAPNUM=$$WKLDCODE^LRARCU(LRCCZ)
 S LRCAPNAM=$$WKLDNAME^LRARCU(LRCAPIFN)
 Q:'$D(^LAM(LRCAPIFN,0))#2
 S LRCCX=$P($P($G(^LAM(LRCAPIFN,0)),U,2),".") Q:'LRCCX!(LRCCX=89341)!(LRCCX=89343)
 S LRCTM=$S(LRCTMB=0:"",1:LRCTMB-.001),LRFIRST=1
 F  S LRCTM=$O(^LAR(64.19999,LRIN,1,LRCDTN,1,LRCCN,1,"B",LRCTM)) Q:(LRCTM>LRCTME)!(LRCTM="")  S LRCTMN=0,LRCTMN=$O(^LAR(64.19999,LRIN,1,LRCDTN,1,LRCCN,1,"B",LRCTM,LRCTMN)) D TM
 Q
TM ;
 Q:'($D(^LAR(64.19999,LRIN,1,LRCDTN,1,LRCCN,1,LRCTMN,0))#2)  S LRX=^(0),LRUC=+$P(LRX,"^",3),LRX1=^(1),LRX2=^(2),LRTSN=$P(LRX1,"^",5)
 I $O(LRAA("@"))]"" D  Q:'LRAACK
 . I $P(LRX,U,5)'="",$D(LRAAX($P(LRX,U,5))) S LRAACK=1
 . I $P(LRX,U,6)'="",$D(LRAAX($P(LRX,U,6))) S LRAACK=1
 . I $P(LRX2,U,4)'="",$D(LRAAX($P(LRX2,U,4))) S LRAACK=1
 . S LRAACK=0
 S:'LRUC LRUC=1
 I LRFIRST S LRUW=+$P($G(^LAM(LRCAPIFN,0)),U,10),LRFIRST=0
 S LRWC=LRUC*LRUW
 ; UTILITY($J,"LRARWL",TS,CC)=UNIT CNT^WEIGHTED CNT^UNIT WT^CC NUM
 S LRCCNX=$S($P($G(^LAM(LRCAPIFN,0)),"^",2)]"":$P(^LAM(LRCAPIFN,0),"^",2),1:LRNDFN)
 S LRCAPN=$S($P($G(^LAM(LRCAPIFN,0)),"^",1)]"":$$WKLDNAME^LRARCU(LRCAPIFN),1:LRNDFN)
 I $P(LRX1,U,7)'["W" S LRTSN=$S($P(LRX1,U,9)]"":$P(LRX1,U,9),1:LRNDFN)
 S LRTSN=$S($L(LRTSN):LRTSN,1:LRCTSX)
 I $D(^TMP($J,"LRAR-WL",LRTSN,LRCAPN))#2 S LRX=^(LRCAPN),LRXX1=LRUC+$P(LRX,"^"),LRXX2=LRWC+$P(LRX,"^",2),^(LRCAPN)=LRXX1_"^"_LRXX2_"^"_LRUW_"^"_LRCCNX
 I '($D(^TMP($J,"LRAR-WL",LRTSN,LRCAPN))#2) S ^(LRCAPN)=LRUC_"^"_LRWC_"^"_LRUW_"^"_LRCCNX
 S LRGT=LRGT+LRWC,LRGTU=LRGTU+LRUC
 I $D(^TMP($J,"LRAR-WL",LRTSN,0))#2 S LRXX1=+$P(^(0),"^")+LRWC,LRXX2=+$P(^(0),"^",2)+LRUC,^(0)=LRXX1_"^"_LRXX2
 I '($D(^TMP($J,"LRAR-WL",LRTSN,0))#2) S ^(0)=LRWC_"^"_LRUC
 Q
GTIN ;
 S LRIN=+$O(^LAR(64.19999,LRIN))
 S:LRIN LRINN=$S($D(^LAR(64.19999,LRIN,0)):$P(^LAR(64.19999,LRIN,0),"^"),1:LRNDFN)
 Q
PTFTS ;Get the PTF treating specialty name.
 S LRTSN=$P($G(^DIC(42.4,+$P($G(^DIC(45.7,+$P($G(^SC(+$P(LRX,U,21),0)),U,20),0)),U,2),0)),U)
 ;S LRTSN=$S(+$P(+$G(^DIC(42,+$G(^SC(+$P(LRX,U,21),0)),0)),U,12):$P(^(0),U),1:LRNDFN)
 Q
ERROR W !!,$C(7),"This file does not have an archival activity with the status of archived."
 W !,"Therefore this file may be incomplete if archiving is still in progress."
 W !!
 Q