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

BKMVPG.m

Go to the documentation of this file.
BKMVPG ;PRXM/HC/ALA - PROVIDER GUIDELINES LISTMAN ; 06-APR-2006
 ;;2.1;HIV MANAGEMENT SYSTEM;;Feb 07, 2011
EN ; -- main entry point for BKMV GUIDELINES
 D EN^VALM("BKMV GUIDELINES")
 Q
 ;
HDR ; -- header code
 S WIDTH=80   ; Report width - 80 columns
 S END="*** END OF REPORT ***"
 K VALMHDR
 N HDRSTR,DA,IENS,BKMI,BKM,BKMSUB,BKMSUB1,BKMSUB2
 S BKMI=0
 S HDRSTR1=" "_$$GET1^DIQ(200,DUZ_",","1","E")
 S DA=$G(DUZ(2)),IENS=$$IENS^DILF(.DA),HDRSTR2=$$GET1^DIQ(4,IENS,.01,"E")
 S BKMI=BKMI+1
 S VALMHDR(BKMI)=HDRSTR1_" "_$$PAD^BKMIXX4("","<"," ",(WIDTH-$L(HDRSTR1))-$L(HDRSTR2)\2)_HDRSTR2
 ;
 ; Subheaders - parse if too long
 S (BKMSUB1,BKMSUB2)=""
 S BKMSUB=$P($G(^BKM(90453,BKMGL,0)),U)
 I BKMSUB'="" D
 . S BKM=$L(BKMSUB)\2
 . I $E(BKMSUB,BKM)=" " S BKMSUB1=$E(BKMSUB,1,BKM),BKMSUB2=$E(BKMSUB,BKM+1,$L(BKMSUB))
 . I $L(BKMSUB)'>50 S BKMSUB1=BKMSUB,BKMSUB2=""
 . I $L(BKMSUB)>50 D
 . . F BKM=40:1:$L(BKMSUB) Q:$E(BKMSUB,BKM)=" "  D
 . .. I $E(BKMSUB,BKM)=" " S BKMSUB1=$E(BKMSUB,1,BKM),BKMSUB2=$E(BKMSUB,BKM+1,$L(BKMSUB))
 . S:BKMSUB1="" BKMSUB1=BKMSUB
 . ;
 . S BKMI=BKMI+1
 . S VALMHDR(BKMI)=$$PAD^BKMIXX4("","<"," ",$L(HDRSTR1))_$$PAD^BKMIXX4("","<"," ",(WIDTH-$L(HDRSTR1))-$L(BKMSUB1)\2)_BKMSUB1
 . I BKMSUB2'="" D
 . . S BKMI=BKMI+1
 . . S VALMHDR(BKMI)=$$PAD^BKMIXX4("","<"," ",WIDTH-$L(BKMSUB2)\2)_BKMSUB2
 . S BKMSUB=0 F  S BKMSUB=$O(^BKM(90453,BKMGL,4,BKMSUB)) Q:'BKMSUB  D
 . . S BKMSUB1=$G(^BKM(90453,BKMGL,4,BKMSUB,0))
 . . S BKMI=BKMI+1
 . . S VALMHDR(BKMI)=$$PAD^BKMIXX4("","<"," ",WIDTH-$L(BKMSUB1)\2)_BKMSUB1
 S HDRSTR="",$P(HDRSTR,"-",79)=""
 S BKMI=BKMI+1
 S VALMHDR(BKMI)=HDRSTR
 Q
 ;
INIT ; -- init variables and list array
 S VALMCNT=0,WIDTH=80
 D HNOTE
 D RSRC
 D BODY
 ;S VALMCNT=30
 Q
 ;
HELP ; -- help code
 S X="?" D DISP^XQORM1 W !!
 Q
 ;
EXIT ; -- exit code
 K ^TMP("BKMVPG",$J),^UTILITY($J,"W")
 D CLEAN^VALM10
 D CLEAR^VALM1
 S VALMBCK="R"
 K HDRSTR1,HDRSTR2
 Q
 ;
EXPND ; -- expand code
 Q
 ;
HNOTE ;Header note
 NEW BKMHF,BKMLINE,DIWF,DIWR,DIWL,BKMTOTLN
 K ^UTILITY($J,"W")
 Q:'$D(^BKM(90453,BKMGL,3,0))
 S BKMHF=0 F  S BKMHF=$O(^BKM(90453,BKMGL,3,BKMHF)) Q:'BKMHF  D
 . I $P(^BKM(90453,BKMGL,3,BKMHF,0),U)'="H" Q
 . S DIWF="I6",DIWR=75,DIWL=6
 . S BKMLINE=0 F  S BKMLINE=$O(^BKM(90453,BKMGL,3,BKMHF,1,BKMLINE)) Q:'BKMLINE  D
 .. S X=^BKM(90453,BKMGL,3,BKMHF,1,BKMLINE,0) D ^DIWP
 S BKMTOTLN=0
 F  S BKMTOTLN=$O(^UTILITY($J,"W",6,BKMTOTLN)) Q:'BKMTOTLN  D
 . S VALMCNT=VALMCNT+1,^TMP("BKMVPG",$J,VALMCNT,0)=^UTILITY($J,"W",6,BKMTOTLN,0)
 K ^UTILITY($J,"W")
 Q
 ;
RSRC ;Resources print
 NEW BKMR,BKMRP
 K ^UTILITY($J,"W")
 Q:'$D(^BKM(90453,BKMGL,1,0))
 S BKMR=0 F  S BKMR=$O(^BKM(90453,BKMGL,1,BKMR)) Q:'BKMR  D
 . S DIWF="N",DIWR=80,DIWL=0
 . S X=^BKM(90453,BKMGL,1,BKMR,0)
 . S X=$$PAD^BKMIXX4("","<"," ",WIDTH-$L(X)\2)_X D ^DIWP
 S BKMTOTLN=0
 F  S BKMTOTLN=$O(^UTILITY($J,"W",0,BKMTOTLN)) Q:'BKMTOTLN  D
 . S VALMCNT=VALMCNT+1,^TMP("BKMVPG",$J,VALMCNT,0)=^UTILITY($J,"W",0,BKMTOTLN,0)
 K ^UTILITY($J,"W")
 Q
 ;
BODY ;  BODY OF GUIDELINES
 NEW BKMAC,BKMEN,BKMENHDR,BKMINDNT,BKMNWPG,BKMFIRSC
 S BKMAC=0 F  S BKMAC=$O(^BKM(90453,BKMGL,2,"AC",BKMAC)) Q:'BKMAC  D
 . S BKMEN=$O(^BKM(90453,BKMGL,2,"AC",BKMAC,0))
 . S BKMENHDR=$P(^BKM(90453,BKMGL,2,BKMEN,0),U,1)
 . S BKMINDNT=$P(^BKM(90453,BKMGL,2,BKMEN,0),U,2)*2
 . ; Build ^UTILITY($J,"W") here
 . D BFORM(BKMINDNT,BKMENHDR)
 Q
 ;
BFORM(BKMIND,BKMHDRT) ;PRINT TEXT BODY
 NEW BKMLINE,X,Y,BKMTOTLN,BKMI
 K ^UTILITY($J,"W")
 S DIWF="N",DIWR=77,DIWL=6
 S BKMLINE=0 F  S BKMLINE=$O(^BKM(90453,BKMGL,2,BKMEN,1,BKMLINE)) Q:'BKMLINE  D
 . S X=^BKM(90453,BKMGL,2,BKMEN,1,BKMLINE,0) D ^DIWP
 S VALMCNT=VALMCNT+1,^TMP("BKMVPG",$J,VALMCNT,0)=$$PAD^BKMIXX4("","<"," ",BKMIND)_BKMHDRT
 S BKMTOTLN=0
 F  S BKMTOTLN=$O(^UTILITY($J,"W",6,BKMTOTLN)) Q:'BKMTOTLN  D
 . S VALMCNT=VALMCNT+1,^TMP("BKMVPG",$J,VALMCNT,0)=$$PAD^BKMIXX4("","<"," ",5)_^UTILITY($J,"W",6,BKMTOTLN,0)
 K ^UTILITY($J,"W")
 Q