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

ADERVURD.m

Go to the documentation of this file.
ADERVURD ;IHS/ITSC/TPF - READ NEW RVUS FROM FILE AND PLACE INTO ADA CODE FILE 8/27/2003 12:50:16 PM
 ;;6.0;ADE;**15**;JAN 01, 2004
 S U="^"
ASK W @IOF
 K DIR
 S DIR("B")=$G(^XTV(8989.3,1,"DEV"))
 S DIR(0)="FO",DIR("A")="Enter the directory path for the RVU Code update file "
 S DIR("?")="/usr/mydir or c:\pub\"
 S ERROR=0
 D ^DIR
 I $D(DIRUT) D EXIT Q
 I Y=""!(Y=U)!(Y=(U_U)) D EXIT Q
 S XBDIR=X
 K DIR
 D FNAME
 I $G(XBFN)="" G ASK
 D RDFILE(XBDIR,XBFN)
 I ERROR G ASK
 D PLACE
 D EXIT
 G ASK
 Q
 ; pull up a file into the TMP global for display
RDFILE(XBDIR,XBFN,XBNODE) ;
 S ERROR=0
 I '$D(XBHDR) S XBHDR=""
 N Y,X,I
 S Y=$$OPEN^%ZISH(XBDIR,XBFN,"R")
 I POP W !,*7,"CANNOT OPEN (OR ACCESS) FILE '",XBDIR,XBFN,"'." S Y=$$DIR^XBDIR("E") S ERROR=1 Q
 K ^TMP("ADERVURD",$J)
 U 0 W !!,"READING FROM FILE "
 F I=1:1 U IO R X:DTIME S X=$TR(X,$C(9),U) Q:X=""  S ^TMP("ADERVURD",$J,I,0)=X U 0 W "." Q:$$STATUS^%ZISH=-1
 U 0 W !,I," RECORDS READ"
 D CLOSE^%ZISH()
 Q
 ;PUT DATA INTO ADA CODE FILE
PLACE ;
 W !!,"ADDING RVU INFO TO 'ADA CODE' FILE"
 S RECORD=1
 F  S RECORD=$O(^TMP("ADERVURD",$J,RECORD)) Q:RECORD=""  D
 .S ADACODE=$TR($P(^TMP("ADERVURD",$J,RECORD,0),U),"D")
 .Q:$E(ADACODE,1,2)="IH"  ;USER DEFINED SKIP FOR NOW
 .S RVU=$P(^TMP("ADERVURD",$J,RECORD,0),U,5)     ;GET RELATIVE VALUE UNIT
 .S ADANLC=$P(^TMP("ADERVURD",$J,RECORD,0),U,4)  ;GET NEW LEVEL OF SERVICE (CARE)
 .S ADADESCR=$P(^TMP("ADERVURD",$J,RECORD,0),U,2)
 .D ADDTOFIL(ADACODE,RVU,ADADESCR,ADANLC)  ;ADD TO THE FILE
 I $D(^TMP("ADERVURD","EXCEPTIONS",$J)) D EXCEPTRP  ;DO EXCEPTION REPORT
 Q
 ;CLEAN UP
EXIT K ADACODE,ADADESCR,ADAIEN,DA,DIE,DR,ERROR,I,MSG,RECORD,RVU,CENTER,LINE,ADANLC
 K ^TMP("ADERVURD",$J)
 I $D(^TMP("ADERVURD","EXCEPTIONS",$J)) K ^TMP("ADERVURD","EXCEPTIONS",$J) W !!,"EXCEPTION FILE HAS BEEN DELETED!"
 Q
 ;
 ;ADD TO THE ADAD CODE FILE
ADDTOFIL(ADACODE,RVU,ADADESCR,ADANLC) ;
 W "."
 S XREF="BA"
 S ADAIEN=$O(^AUTTADA("BA",ADACODE_" ",""))
 I ADAIEN="" D EXCEPT("ENTRY FOR "_ADACODE_" NOT FOUND USING "_XREF_" X-REF",ADACODE,ADADESCR)
 S XREF="B"
 S ADAIEN=$O(^AUTTADA("B",ADACODE,""))
 I ADAIEN="" D EXCEPT("INTERNAL ENTRY NUMBER NOT FOUND USING X-REF "_XREF_" FOR ADA CODE "_ADACODE_". RVU HAS NOT BEEN ENTERED INTO FILE",ADACODE,ADADESCR) Q
 I $D(^AUTTADA(ADAIEN,0))'=1 D EXCEPT("MISSING ZERO NODE WITH ENTRY FOR "_ADAIEN_" X-REF EXISTS BUT ZERO NODE DOES NOT",ADAIEN,ADADESCR) Q
 D UPDATE(ADAIEN,RVU,ADANLC)
 Q
 ;ADD RVU TO ENTRY
UPDATE(ADAIEN,RVU,ADANLC) ;
 ;UPDATE RVU AND LEVEL OF SERVICE
 S DIE="^AUTTADA("
 S DA=ADAIEN
 S DR=".05///^S X=ADANLC;501///^S X=RVU"
 D ^DIE
 K DIE
 Q
 ;REPORT/PROCESS EXCEPTION 
EXCEPT(MSG,ADACODE,ADADESCR) ;
 S ^TMP("ADERVURD","EXCEPTIONS",$J,ADACODE)=MSG_U_ADADESCR
 ;W !,MSG
 Q
 ;FOLLOWING CODE BORROWED WITH PERMISSION FROM ROUTINE BAREDIUT
FNAME ;
 ; Select a file (directory can be pre-loaded into XBDIR)
 K DIR
 ;
FNAME1 ;
 S XBFN=""
 S DIR(0)="FO^1:15"
 S DIR("A")="File Name "
 D ^DIR
 K DIR
 Q:$G(DTOUT)
 Q:Y["^"
 Q:Y=""
 I Y?.N,$D(XBFL(Y)) S DIR("B")=XBFL(Y) G FNAME1
 I Y["*" D  G FNAME
 . K XBFL
 . S X=$$LIST^%ZISH(XBDIR,Y,.XBFL)
 . F XBI=1:1 Q:'$D(XBFL(XBI))  W !?5,XBI,?10,XBFL(XBI) I '(XBI#20) R X:DTIME
 S XBFN=Y
 Q
 ;EXCEPTION REPORT
EXCEPTRP ;
 W !,"EXCEPTIONS HAVE BEEN FOUND"
 K DIR
 S DIR(0)="Y"
 S DIR("A")="VIEW EXCEPTION REPORT(Y/N)"
 S DIR("B")="N"
 D ^DIR
 Q:'Y
 S $P(LINE,"*",IOM+1)=""
 D ^%ZIS Q:POP
 U IO
 D HDR
 S ADACODE=""
 F  S ADACODE=$O(^TMP("ADERVURD","EXCEPTIONS",$J,ADACODE)) Q:ADACODE=""  D
 .S ADADESCR=$P(^TMP("ADERVURD","EXCEPTIONS",$J,ADACODE),U,2)
 .W !!,ADACODE,?10,ADADESCR
 .I $Y>(IOSL-4),IOST'[("C-") D HDR Q
 .I $Y>(IOSL-4) D RETURN,HDR
 I IOST[("C-") D RETURN
 W @IOF
 D ^%ZISC
 Q
HDR ;
 W @IOF
 S X="EXCEPTION REPORT"
 S CENTER=(IOM-$L(X))\2
 W !,?CENTER,X
 S X="THE FOLLOWING ADA CODES WERE NOT FOUND IN FILE #9999999.31"
 S CENTER=(IOM-$L(X))\2
 W !,?CENTER,X
 W !!,"ADA CODE",?10,"DESCRIPTION"
 W !,LINE
 Q
RETURN ;EP - Press return to continue
 N DIR
 S DIR(0)="FAO^1:1",DIR("A")="Press 'Return' to continue... "
 W !! D ^DIR
 K DIR,X,Y,DTOUT,DUOUT,DIRUT,DIROUT
 Q