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

IBDFGRP.m

Go to the documentation of this file.
IBDFGRP ;ALB/MAF - GROUP COPY - 7/25/95
 ;;3.0;AUTOMATED INFO COLLECTION SYS;;APR 24, 1997
 N NEWLIST,NEWBLOCK
 S NEWLIST=IBLIST,NEWBLOCK=IBBLK
 N IBBLK,TOP,BOT,IBLIST,IBFORM
 S VALMBCK="R"
 S IBBLK=$$SELECT2()
 Q:'IBBLK
 ;
 S DIC("S")="I $P(^(0),U,11)=$P($G(^IBE(357.2,+NEWLIST,0)),U,11)" D SELECT^IBDF3 K DIC
 ;
 I '$G(IBLIST) W !!,"Block does not contain same type of selection list '"_$P($G(^IBE(357.6,+$P($G(^IBE(357.2,+NEWLIST,0)),U,11),0)),U)_"'.",! D PAUSE^IBDFU5
 ;
 I IBLIST D EN^VALM("IBDF QUICK GRP COPY")
 Q
 ;
INIT ; -- init variables and list array
 N IBDCNT,IBDCNT1
 K ^TMP("GRP",$J),^TMP("GRPIDX",$J),IBDFHDR D KILL^VALM10()
 ;
 ;  -- Set up arrays for new and old selection list definitions in
 ;     in file 357.2.  Used to match data with the right subcolum #
 ;     when copying selection lists to a form.
 ;
 ;        - IBDFNEW(SUBCOLUM #) = TYPE OF DATA ..5th piece  (text or code)
 ;        - IBDFOLD(SUBCOLUM #) = TYPE OF DATA..5th piece  (text or code)
 D
 .N K,NODE
 .S (IBDFNEW,IBDFOLD)=0
 .I $D(IBLIST) S K=0 D
 ..F  S K=$O(^IBE(357.2,IBLIST,2,K)) Q:'K  S NODE=$G(^IBE(357.2,IBLIST,2,K,0)),IBDFOLD(+NODE)=+$P(NODE,"^",5)
 ..Q
 .I $D(NEWLIST) S NODE="",K=0 D
 ..F  S K=$O(^IBE(357.2,NEWLIST,2,K)) Q:'K  S NODE=$G(^IBE(357.2,NEWLIST,2,K,0)),IBDFNEW(+NODE)=+$P(NODE,"^",5)
 ..Q
 S (IBDCNT,IBDCNT1,VALMCNT)=0
 S IBDLSTNM=$P(^IBE(357.2,IBLIST,0),"^",1) D INTER D
 .S IBLSNODE=$G(^IBE(357.2,IBLIST,0))
 .I $D(IBDFAR) F IBDFX=0:0 S IBDFX=$O(@(IBDFAR_"("_IBDFX_")")) Q:'IBDFX  S IBDFARR=$G(@(IBDFAR_"("_IBDFX_")")) D:$P(IBDFARR,"^",1)="" HEADER D:$P(IBDFARR,"^",1)]"" SETARR
 Q:$$LSTDESCR^IBDFU1(.IBLIST) 1
 S IBRTN=IBLIST("RTN")
 D RTNDSCR^IBDFU1B(.IBRTN)
 Q
 ;
SETARR ;  -- Set up Listman array
 N IBDFNODE
 S IBDFNODE=IBDFARR
 S IBDFSEL=$P(IBDFNODE,"^",4)
 S IBDCNT=IBDCNT+1,VALMCNT=VALMCNT+1
 S X=""
 S IBDFVAL=$P(IBDFNODE,"^",1)
 S X=$$SETSTR^VALM1(IBDFVAL,X,7,7)
 S IBDFVAL=$P(IBDFNODE,"^",6)
 S X=$$SETSTR^VALM1(IBDFVAL,X,16,5)
 S IBDFVAL=$P(IBDFNODE,"^",2)
 S X=$$SETSTR^VALM1(IBDFVAL,X,23,40)
 S IBDFVAL=$P(^IBE(357.4,$P(IBDFNODE,"^",5),0),"^",1)
 S X=$$SETSTR^VALM1(IBDFVAL,X,64,15)
TMP ; -- Set up TMP Array
 S ^TMP("GRP",$J,IBDCNT,0)=X,^TMP("GRP",$J,"IDX",VALMCNT,IBDCNT1)=IBDFSEL
 S ^TMP("GRPIDX",$J,IBDCNT1)=VALMCNT_"^"_$P(IBDFARR,"^",3)_"^"_$P(IBDFARR,"^",4)_"^"_$P(IBDFARR,"^",5) ;_"^"_IBDFX_"^"_$P(IBDFTMP,"^",4)_"^"_$P(IBDFTMP,"^",5)_"^"_$P(IBDFTMP,"^",1)_"^"_$P(IBDFTMP,"^",2)
 Q
 S IBDCNT1=IBDCNT1+1
 S IBDCNT=IBDCNT+1,VALMCNT=VALMCNT+1
 S X=""
 S IBDVAL=$S($P(IBDFARR,"^",2)]"":$P(IBDFARR,"^",2),1:"BLANK")
 S IBDFHDR(IBDVAL)=IBDCNT1_"^"_$P(IBDFARR,"^",5)
 S IBDFSEL=$P(IBDFARR,"^",5)
 S X=$$SETSTR^VALM1(IBDCNT1_")",X,1,5) D TMP
 S X="",IBDCNT=IBDCNT+1,VALMCNT=VALMCNT+1
 S IBDVAL=$P(IBDFARR,"^",6)
 S X=$$SETSTR^VALM1(IBDVAL,X,16,5)
 S IBDVAL=$P(IBDFARR,"^",2)
 S IBDVAL1=$L(IBDVAL) S IBDVAL1=(80-IBDVAL1)/2 S IBDVAL1=IBDVAL1\1 S X=$$SETSTR^VALM1(" ",X,22,IBDVAL1)
 S X=$$SETSTR^VALM1(IBDVAL,X,IBDVAL1,25) D TMP,CNTRL^VALM10(VALMCNT,1,80,IOINHI,IOINORM,0)
 S X="",IBDCNT=IBDCNT+1,VALMCNT=VALMCNT+1
 S X=$$SETSTR^VALM1(" ",X,1,3) D TMP
 Q
INTER ;  -- Find Package interface for selection list
 K IBARRY S IBDFAR="IBARRY",IBDFINT=$P($G(^IBE(357.2,IBLIST,0)),"^",11),IBDFINT(1)=$P(^IBE(357.6,IBDFINT,0),"^",1) D GETLST^IBDFQSL2(IBFORM,IBBLK,IBLIST,.IBDFINT,"IBARRY",1)
 Q
HELP ; -- help code
 S X="?" D DISP^XQORM1 W !!
 Q
 ;
EXIT ; -- exit code
 K IBARRY,IBDFAR,IBDFARR,IBDFHDR,IBDFINT,IBDFSEL,IBDFVAL,IBDFX,IBDLSTNM,IBDVAL,IBDVAL1,IBLIST,IBRTN,IEN,IBLSNODE,DIC,IBGRP,NODE,IBDFNEW,IBDFOLD
 K ^TMP("SEL",$J),^TMP("SELIDX",$J)
 Q
 ;
EXPND ; -- expand code
 Q
 ;
GRPCOPY ;  -- COPY GROUP
 N IBDVALM,GRP,VALMY,FROM,TO,IBDFCPYE
 S IBDFCPYF=1
 S (FROM,TO)="357.4"
 S VALMBCK=""
 D EN^VALM2($G(XQORNOD(0)))
 I $O(VALMY(0)) D
 .S IBDVALM=0
 .D FULL^VALM1 S VALMBCK="R"
 .F IBDVALM=0:0 S IBDVALM=$O(VALMY(IBDVALM)) Q:'IBDVALM  S (DA,GRP)=$P($G(^TMP("GRPIDX",$J,IBDVALM)),"^",4) D COPYGRP^IBDFU2A(GRP,IBLIST,NEWLIST,NEWBLOCK,FROM,TO)
 K IBDFCPYF
 Q
SELECT2() ;allows the user to select a form, then a block from it
 S IBBLK=""
 S IBFORM=$$SLCTFORM^IBDFU4(0)
 I IBFORM D
 .W !!,"NOW CHOOSE THE BLOCK TO COPY!",!
 .S IBBLK=$$SLCTBLK^IBDFU8(IBFORM,IOSL)
 Q IBBLK