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

IBDF10C.m

Go to the documentation of this file.
  1. IBDF10C ;ALB/CJM - ENCOUNTER FORM - (shift block contents - continued) ;APRIL 22,1993
  1. ;;3.0;AUTOMATED INFO COLLECTION SYS;;APR 24, 1997
  1. ;
  1. MAX(TYPE,WAY,MAX,TOP,BOTTOM,LEFT,RIGHT) ;returns the maximum allowable shift
  1. ;
  1. N VERT,AREASIZE,IBY,IBX,SIZE,NODE
  1. S VERT=$S("UD"[WAY:1,1:0)
  1. S AREASIZE=$S(VERT:$S(TYPE="B":IBFORM("HT"),1:IBBLK("H")),1:$S(TYPE="B":IBFORM("WIDTH"),1:IBBLK("W")))
  1. D @TYPE
  1. I TYPE'="B",IBBLK("BOX")=1 S MAX=MAX-1
  1. S:MAX<0 MAX=0
  1. Q MAX
  1. E ;
  1. D D
  1. D S
  1. D T
  1. D L
  1. D M
  1. D H
  1. Q
  1. D ;
  1. N SUB,FLD
  1. S FLD="" F S FLD=$O(^IBE(357.5,"C",IBBLK,FLD)) Q:'FLD D
  1. .S NODE=$G(^IBE(357.5,FLD,0)) Q:NODE=""
  1. .S IBY=$P(NODE,"^",11),IBX=$P(NODE,"^",10) I $$INRANGE^IBDF10A(IBX,IBY,TOP,BOTTOM,LEFT,RIGHT) D
  1. ..S SIZE=$S(VERT:$P(NODE,"^",12),1:$S($L($P(NODE,"^",6))>$P(NODE,"^",14):$L($P(NODE,"^",6)),1:$P(NODE,"^",14)))
  1. ..D COMPARE
  1. .S SUB=0 F S SUB=$O(^IBE(357.5,FLD,2,SUB)) Q:'SUB D
  1. ..S NODE=$G(^IBE(357.5,FLD,2,SUB,0)) Q:NODE=""
  1. ..S IBX=$P(NODE,"^",4),IBY=$P(NODE,"^",5) I $$INRANGE^IBDF10A(IBX,IBY,TOP,BOTTOM,LEFT,RIGHT) D
  1. ...S SIZE=$S(VERT:1,1:$L($P(NODE,"^",1)))
  1. ...D COMPARE
  1. ..S IBX=$P(NODE,"^",7),IBY=$P(NODE,"^",6) I $$INRANGE^IBDF10A(IBX,IBY,TOP,BOTTOM,LEFT,RIGHT) D
  1. ...S SIZE=$S(VERT:1,1:$P(NODE,"^",8))
  1. ...D COMPARE
  1. Q
  1. ;
  1. M ;shift multiple choice field
  1. N SUB,FLD
  1. S FLD="" F S FLD=$O(^IBE(357.93,"C",IBBLK,FLD)) Q:'FLD D
  1. .S NODE=$G(^IBE(357.93,FLD,0)) Q:NODE=""
  1. .S IBY=$P(NODE,"^",4),IBX=$P(NODE,"^",3) I $$INRANGE^IBDF10A(IBX,IBY,TOP,BOTTOM,LEFT,RIGHT) D
  1. ..S SIZE=$S(VERT:1,1:$L($P(NODE,"^",2)))
  1. ..D COMPARE
  1. .S SUB=0 F S SUB=$O(^IBE(357.93,FLD,1,SUB)) Q:'SUB D
  1. ..S NODE=$G(^IBE(357.93,FLD,1,SUB,0)) Q:NODE=""
  1. ..S IBX=$P(NODE,"^",2),IBY=$P(NODE,"^",3) I $$INRANGE^IBDF10A(IBX,IBY,TOP,BOTTOM,LEFT,RIGHT) D
  1. ...S SIZE=$S(VERT:1,1:$L($P(NODE,"^",1)))
  1. ...D COMPARE
  1. ..S IBX=$P(NODE,"^",6),IBY=$P(NODE,"^",7) I $$INRANGE^IBDF10A(IBX,IBY,TOP,BOTTOM,LEFT,RIGHT) D
  1. ...S SIZE=$S(VERT:1,1:3)
  1. ...D COMPARE
  1. Q
  1. ;
  1. H ;shift hand print fields
  1. N SUB,FLD
  1. S FLD="" F S FLD=$O(^IBE(359.94,"C",IBBLK,FLD)) Q:'FLD D
  1. .S NODE=$G(^IBE(359.94,FLD,0)) Q:NODE=""
  1. .S IBY=$P(NODE,"^",4),IBX=$P(NODE,"^",3) I $$INRANGE^IBDF10A(IBX,IBY,TOP,BOTTOM,LEFT,RIGHT) D
  1. ..I VERT S SIZE=2
  1. ..I 'VERT S SIZE=$L($P(NODE,"^",2))+1 S NODE=$G(^IBE(359.1,$P(NODE,"^",10),0)) S SIZE=SIZE+($P(NODE,"^",6)*$S(IBFORM("WIDTH")>96:4,1:3)) I $L($P(NODE,"^",11)) S SIZE=SIZE+(2*$L($P(NODE,"^",11)))
  1. ..D COMPARE
  1. Q
  1. ;
  1. S ;
  1. ;just let the user do what he wants - lists automatically resize themselves to fit the block
  1. Q
  1. T ;
  1. N TXT
  1. S TXT="" F S TXT=$O(^IBE(357.8,"C",IBBLK,TXT)) Q:'TXT D
  1. .S NODE=$G(^IBE(357.8,TXT,0)) Q:NODE=""
  1. .S IBY=$P(NODE,"^",4),IBX=$P(NODE,"^",3) I $$INRANGE^IBDF10A(IBX,IBY,TOP,BOTTOM,LEFT,RIGHT) D
  1. ..S SIZE=$S(VERT:$P(NODE,"^",6),1:$P(NODE,"^",5))
  1. ..D COMPARE
  1. Q
  1. L ;
  1. N LINE
  1. S LINE="" F S LINE=$O(^IBE(357.7,"C",IBBLK,LINE)) Q:'LINE D
  1. .S NODE=$G(^IBE(357.7,LINE,0)) Q:NODE=""
  1. .S IBY=$P(NODE,"^",3),IBX=$P(NODE,"^",2) I $$INRANGE^IBDF10A(IBX,IBY,TOP,BOTTOM,LEFT,RIGHT) D
  1. ..S SIZE=$S(((($P(NODE,"^",4)="V")&VERT)!(($P(NODE,"^",4)="H")&'VERT)):$P(NODE,"^",5),1:1)
  1. ..D COMPARE
  1. Q
  1. B ;
  1. N BLOCK
  1. S BLOCK="" F S BLOCK=$O(^IBE(357.1,"C",IBFORM,BLOCK)) Q:'BLOCK D
  1. .S NODE=$G(^IBE(357.1,BLOCK,0)) Q:NODE=""
  1. .S SIZE=$S(VERT:$P(NODE,"^",7),1:$P(NODE,"^",6)),IBX=$P(NODE,"^",5),IBY=$P(NODE,"^",4)
  1. .I $$INRANGE^IBDF10A(IBX,IBY,TOP,BOTTOM,LEFT,RIGHT) D COMPARE
  1. ;..I WAY="R" S:(IBFORM("WIDTH")-(IBX+WIDTH))<MAX MAX=(IBFORM("WIDTH")-(IBX+WIDTH)) Q
  1. ;..I WAY="L" S:IBX<MAX MAX=IBX Q
  1. ;..I WAY="D" S:(IBFORM("HT")-(IBY+HT))<MAX MAX=(IBFORM("HT")-(IBY+HT)) Q
  1. ;..I WAY="U" S:IBY<MAX MAX=IBY Q
  1. Q
  1. COMPARE ;
  1. I WAY="R" S:(AREASIZE-(IBX+SIZE))<MAX MAX=(AREASIZE-(IBX+SIZE)) Q
  1. I WAY="L" S:IBX<MAX MAX=IBX Q
  1. I WAY="D" S:(AREASIZE-(IBY+SIZE))<MAX MAX=(AREASIZE-(IBY+SIZE)) Q
  1. I WAY="U" S:IBY<MAX MAX=IBY Q
  1. Q