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

LA7SRPT4.m

Go to the documentation of this file.
  1. LA7SRPT4 ;DALOI/JDB - SCT OVERRIDE REPORT ;03/07/12 09:38
  1. ;;5.2;AUTOMATED LAB INSTRUMENTS;**74**;Sep 27, 1994;Build 229
  1. ;
  1. Q
  1. ;
  1. EN ;
  1. ; Prompts for #62.48 entry, device, then branches
  1. N QUE,RTN,R6248,DIC,DTOUT,DUOUT,POP,X,Y,HASSCT,LASEL,ZTSAVE
  1. S HASSCT=0
  1. D Q:'HASSCT ;
  1. . ; any SCT Overrides on file?
  1. . N R6248
  1. . S R6248=0
  1. . F S R6248=$O(^LAHM(62.48,R6248)) Q:'R6248 D Q:HASSCT ;
  1. . . Q:'$D(^LAHM(62.48,R6248,"SCT"))
  1. . . S HASSCT=1
  1. . Q:HASSCT
  1. . W !," No SCT Overrides on file."
  1. ;
  1. S R6248=0
  1. S DIC=62.48
  1. S DIC("S")="I $D(^(""SCT""))"
  1. S X=$$SELECT^LRUTIL(.DIC,.LASEL,"MESSAGE CONFIGURATION",10,0,0,1)
  1. K DIC
  1. ; If LASEL=1 then "ALL" was selected
  1. I X<1 I X'="*" Q
  1. I $D(DTOUT)!$D(DUOUT) Q
  1. S RTN="MAIN^LA7SRPT4("_R6248_")"
  1. I $D(LRSEL)>1 S ZTSAVE("LASEL")=""
  1. S QUE=$$QUE^LRUTIL(RTN,"SCT OVERRIDE",.ZTSAVE)
  1. I QUE Q
  1. D MAIN(R6248)
  1. D HOME^%ZIS
  1. Q
  1. ;
  1. MAIN(R6248) ;
  1. ; Setup variables, branch, print footer, perform cleanup.
  1. ; Expects LASEL array from EN (used with VAUTOMA) to pick
  1. ; multiple #62.48s (passed in sym tbl for queuing)
  1. ;
  1. ; Inputs
  1. ; R6248 : #62.48 IEN
  1. N STOP,PGDATA
  1. S R6248=$G(R6248)
  1. U IO
  1. S STOP=0
  1. S PGDATA("RPTDT")=$$NOW^XLFDT() ;Report Date
  1. S PGDATA("PGNUM")=1 ;Page Number
  1. S PGDATA("BM")=0 ;Bottom Margin (lines from bottom)
  1. S PGDATA("HDR")="D HDR^LA7SRPT4" ;Header exec code
  1. S PGDATA("FTR")="D FTR^LA7SRPT4" ; Footer exec code
  1. D HDR^LA7SRPT4
  1. I R6248 D SCTOVER(R6248,.STOP)
  1. I 'R6248 D LOOP(.STOP,.LASEL)
  1. ; Write last footer if needed
  1. I 'STOP I '$G(PGDATA("WFTR")) D ;
  1. . I $G(PGDATA("FTR"))="" Q
  1. . I $E($G(IOST),1,2)'="C-" D ;
  1. . . N I,BM
  1. . . S BM=$G(PGDATA("BM"))
  1. . . F I=$Y+1:1:($G(IOSL,60)-BM-1) W !
  1. . X PGDATA("FTR")
  1. I $D(ZTQUEUED) S ZTREQ="@"
  1. I 'STOP I $E(IOST,1,2)="C-" D MORE^LRUTIL()
  1. D ^%ZISC
  1. Q
  1. ;
  1. LOOP(STOP,SEL) ;
  1. ; Inputs
  1. ; STOP : <byref> see Outputs below
  1. ; SEL : <byref> Array of #62.48s to display
  1. ; Outputs
  1. ; STOP : Tracks if user has stopped display
  1. N R6248,NODE
  1. ;S R6248=0
  1. S NODE="^LAHM(62.48,""B"")"
  1. ;F S R6248=$O(^LAHM(62.48,"B",R6248)) Q:'R6248 D Q:STOP ;
  1. F S NODE=$Q(@NODE) Q:NODE="" Q:$QS(NODE,2)'="B" D Q:STOP ;
  1. . S R6248=$QS(NODE,4)
  1. . Q:'$D(^LAHM(62.48,R6248,"SCT"))
  1. . I $D(SEL)>1 I '$D(SEL(R6248)) Q
  1. . D SCTOVER(R6248,.STOP)
  1. . D NP(.STOP) Q:STOP
  1. . I $O(^LAHM(62.48,R6248)) W ! D NP(.STOP) Q:STOP W !
  1. . D NP(.STOP) Q:STOP
  1. Q
  1. ;
  1. SCTOVER(R6248,STOP) ;
  1. ; Displays SCT override info for a MSG CFG (#62.48)
  1. ; Inputs
  1. ; R6248 : #62.48 IEN
  1. ; STOP : <byref> see Outputs below
  1. ; Outputs
  1. ; STOP : Tracks if user has stopped display
  1. N R62482,R61,R62,D62482,SPECS,SAMPS,TMPNM,SCT,SCT1,SCTOVR,SCTCODES
  1. N FSIZE,NODE,I,X,REC,NM,DATA,MSIZE,POS
  1. N DIERR,LAIEN,LAFLDS,POP
  1. N IOUON,IOUOFF
  1. S MSIZE(1)=IOM-42 ;max field length (2+2+SCT(18)+2+SCT(18))
  1. S R6248=$G(R6248)
  1. S STOP=$G(STOP)
  1. S TMPNM="LA7SRPT4"
  1. S X="IOUON;IOUOFF"
  1. D ;
  1. . N %ZIS
  1. . D ENDR^%ZISS
  1. ;
  1. D GETFLDS^LA7SRPT1(62.48,R6248_",",".01",.DATA)
  1. D NP(.STOP) Q:STOP
  1. W !,"Message Configuration: ",DATA(.01,"E")
  1. D NP(.STOP) Q:STOP
  1. I '$D(^LAHM(62.48,R6248,"SCT")) D Q ;
  1. . D NP(.STOP) Q:STOP
  1. . W !?5,"No SCT Overrides on file."
  1. . D NP(.STOP) Q:STOP
  1. ;
  1. D NP(.STOP) Q:STOP
  1. W !
  1. D NP(.STOP) Q:STOP
  1. S LAFLDS=".01;.02"
  1. S R62482=0
  1. F S R62482=$O(^LAHM(62.48,R6248,"SCT",R62482)) Q:'R62482 D ;
  1. . K D62482
  1. . S LAIEN=R62482_","_R6248_","
  1. . D GETFLDS^LA7SRPT1(62.482,LAIEN,LAFLDS,.D62482)
  1. . Q:'$D(D62482)
  1. . S (R61,R62)=0
  1. . S X=D62482(.01,"I")
  1. . I X["LAB(61," D ;
  1. . . S R61=$P(X,";",1)
  1. . I X["LAB(62," D ;
  1. . . S R62=$P(X,";",1)
  1. . I 'R61 I 'R62 Q
  1. . S X=$G(D62482(.02,"E"))
  1. . I R61 S SPECS(R61)=X
  1. . I R62 S SAMPS(R62)=X
  1. . ;setup TMP
  1. . K ^TMP($J,TMPNM)
  1. . I $D(SPECS) D BLDTMP(61,.SPECS)
  1. . I $D(SAMPS) D BLDTMP(62,.SAMPS)
  1. I '$D(^TMP($J,TMPNM)) Q
  1. ;
  1. ; ^TMP($J,TMPNM,FILE#,.01,REC)=SCT Code
  1. ; find max length in specimens
  1. S FSIZE(1)=12 ;spec/sample
  1. S FSIZE(1)=12+29
  1. S FSIZE(2)=8 ;SCT code
  1. S NODE="^TMP($J,TMPNM,61)"
  1. F S NODE=$Q(@NODE) Q:NODE="" Q:$QS(NODE,3)'=61 Q:$QS(NODE,2)'=TMPNM D ;
  1. . S NM=$QS(NODE,4) ;.01 field (sample or topog)
  1. . S REC=$QS(NODE,5)
  1. . S X=" ["_REC_"]"
  1. . S I=$L(NM_X)
  1. . I I>FSIZE(1) S FSIZE(1)=I
  1. ;
  1. ; find max length in samples
  1. S NODE="^TMP($J,TMPNM,62)"
  1. F S NODE=$Q(@NODE) Q:NODE="" Q:$QS(NODE,3)'=62 Q:$QS(NODE,2)'=TMPNM D ;
  1. . S NM=$QS(NODE,4) ;.01 field (sample or topog)
  1. . S REC=$QS(NODE,5)
  1. . S X=" ["_REC_"]"
  1. . S I=$L(NM_X)
  1. . I I>FSIZE(1) S FSIZE(1)=I
  1. ;
  1. ; Print Specimens header
  1. S NODE="^TMP($J,TMPNM,61)"
  1. I $D(@NODE) D ;
  1. . D NP(.STOP) Q:STOP
  1. . W !?2 D UL(1)
  1. . W "Specimen [Topography file #61]"
  1. . S DISP(1)=FSIZE(1)
  1. . I DISP(1)>MSIZE(1) S DISP(1)=MSIZE(1)
  1. . W ?2+DISP(1)+2,"VA SCT",?2+DISP(1)+2+18+2,"Non-VA SCT"
  1. . D UL(0)
  1. . D NP(.STOP) Q:STOP
  1. ;
  1. ; Print specimens
  1. S NODE="^TMP($J,TMPNM,61)"
  1. F S NODE=$Q(@NODE) Q:NODE="" Q:$QS(NODE,3)'=61 Q:$QS(NODE,2)'=TMPNM D Q:STOP ;
  1. . S NM=$QS(NODE,4)
  1. . S REC=$QS(NODE,5)
  1. . S SCT=@NODE
  1. . I SCT'="" S SCTCODES(" "_SCT)=""
  1. . S SCTOVR=SPECS(REC)
  1. . I SCTOVR'="" S SCTCODES(" "_SCTOVR)=""
  1. . S X=" ["_REC_"]"
  1. . I $L(NM_X)>MSIZE(1) D ;
  1. . . S NM=$E(NM,1,MSIZE(1)-$L(X)-3)_"..."
  1. . S NM=NM_X
  1. . S DISP(1)=FSIZE(1)
  1. . I DISP(1)>MSIZE(1) S DISP(1)=MSIZE(1)
  1. . D NP(.STOP) Q:STOP
  1. . W !?2,NM
  1. . W ?2+DISP(1)+2,SCT,?2+DISP(1)+2+18+2,SCTOVR
  1. . D NP(.STOP) Q:STOP
  1. ;
  1. ; Print samples header
  1. S NODE="^TMP($J,TMPNM,62)"
  1. I $D(@NODE) D ;
  1. . I $D(^TMP($J,TMPNM,61)) D NP(.STOP) Q:STOP W !
  1. . D NP(.STOP) Q:STOP
  1. . W !?2
  1. . D UL(1)
  1. . W "Sample [Collection Sample file #62]"
  1. . S DISP(1)=FSIZE(1)
  1. . I DISP(1)>MSIZE(1) S DISP(1)=MSIZE(1)
  1. . W ?2+DISP(1)+2,"VA SCT",?2+DISP(1)+2+18+2,"Non-VA SCT"
  1. . D UL(0)
  1. . D NP(.STOP) Q:STOP
  1. ;
  1. ; Print samples
  1. F S NODE=$Q(@NODE) Q:NODE="" Q:$QS(NODE,3)'=62 Q:$QS(NODE,2)'=TMPNM D Q:STOP ;
  1. . S NM=$QS(NODE,4)
  1. . S REC=$QS(NODE,5)
  1. . S SCT=@NODE
  1. . I SCT'="" S SCTCODES(" "_SCT)=""
  1. . S SCTOVR=SAMPS(REC)
  1. . I SCTOVR'="" S SCTCODES(" "_SCTOVR)=""
  1. . S X=" ["_REC_"]"
  1. . I $L(NM_X)>MSIZE(1) D ;
  1. . . S NM=$E(NM,1,MSIZE(1)-$L(X)-3)_"..."
  1. . S NM=NM_X
  1. . S DISP(1)=FSIZE(1)
  1. . I DISP(1)>MSIZE(1) S DISP(1)=MSIZE(1)
  1. . D NP(.STOP) Q:STOP
  1. . W !?2,NM
  1. . W ?2+DISP(1)+2,SCT,?2+DISP(1)+2+18+2,SCTOVR
  1. . D NP(.STOP) Q:STOP
  1. ;
  1. ; Display SCT code legend
  1. I 'STOP I $D(SCTCODES) D ;
  1. . S SCT=""
  1. . F S SCT=$O(SCTCODES(SCT)) Q:SCT="" D Q:STOP ;
  1. . . S X=$$TRIM^XLFSTR(SCT,"L"," ")
  1. . . S I=$L(X)
  1. . . I FSIZE(2)<I S FSIZE(2)=I
  1. . ;
  1. . D NP(.STOP) Q:STOP
  1. . W !
  1. . D NP(.STOP) Q:STOP
  1. . S POS=0
  1. . W !?POS
  1. . D UL(1)
  1. . W "SCT Code"
  1. . S POS=POS+FSIZE(2)+2
  1. . W ?POS,"SCT Preferred Term"
  1. . D UL(0)
  1. . S SCT=""
  1. . F S SCT=$O(SCTCODES(SCT)) Q:SCT="" D Q:STOP ;
  1. . . S SCT1=$$TRIM^XLFSTR(SCT,"L"," ")
  1. . . D NP(.STOP) Q:STOP
  1. . . S POS=0
  1. . . W !?POS,SCT1
  1. . . S X=$$GETPREF^LRSCT(SCT1)
  1. . . S POS=POS+FSIZE(2)+2
  1. . . W ?POS
  1. . . D WRAP^LA7SRPT1(X,POS+1,0,.STOP,.PGDATA)
  1. . . D NP(.STOP)
  1. . . Q:STOP
  1. . ;
  1. ;
  1. K ^TMP($J,TMPNM)
  1. D UL(0)
  1. Q
  1. ;
  1. HDR ;
  1. ; Header
  1. ; Expects PGDATA array
  1. ; private method
  1. N STR,RPTDT,PGNUM
  1. S RPTDT=$G(PGDATA("RPTDT"))
  1. I RPTDT="" D ;
  1. . S RPTDT=$$NOW^XLFDT()
  1. . S PGDATA("RPTDT")=RPTDT
  1. S PGNUM=$G(PGDATA("PGNUM"))
  1. I PGNUM<1 D ;
  1. . S PGNUM=1
  1. . S PGDATA("PGNUM")=PGNUM
  1. ;
  1. W !,"MESSAGE CONFIGURATION SCT OVERRIDES "
  1. S STR="Printed "_$$FMTE^XLFDT(RPTDT,"M")
  1. S STR=STR_" Page "_$G(PGNUM,1)
  1. W ?IOM-$L(STR)-2,STR
  1. W !,$$REPEAT^XLFSTR("=",IOM)
  1. Q
  1. ;
  1. FTR ;
  1. Q
  1. ;
  1. NP(STOP) ;
  1. ; Convenience method
  1. D NP^LRUTIL(.STOP,.PGDATA)
  1. Q
  1. ;
  1. BLDTMP(FILE,IN) ;
  1. ; Builds ^TMP($J,TMPNM,FILE,.01,IEN)=SCT Code
  1. ; private method
  1. ; Inputs
  1. ; FILE : File # (61, 62)
  1. ; IN :<byref> data array IN(IEN)=SCT Code
  1. N REC,DATA,FLDS,TMPNM,F01,F20
  1. S FILE=$G(FILE)
  1. S TMPNM="LA7SRPT4"
  1. S FLDS=".01;20"
  1. S REC=""
  1. F S REC=$O(IN(REC)) Q:'REC D ;
  1. . K DATA
  1. . D GETFLDS^LA7SRPT1(FILE,REC_",",FLDS,.DATA)
  1. . Q:'$D(DATA)
  1. . S F01=DATA(.01,"E")
  1. . S F20=$G(DATA(20,"E"))
  1. . S ^TMP($J,TMPNM,FILE,F01,REC)=F20
  1. Q
  1. ;
  1. UL(I) ;
  1. ; Underline On/Off
  1. ; private method
  1. ; Inputs
  1. ; I I=1 turns on underline I=0 turns off underline
  1. I $G(IOUON)'="" I $G(IOUOFF)'="" D ;
  1. . W:'I IOUOFF
  1. . W:I IOUON
  1. Q