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

IBDF10.m

Go to the documentation of this file.
  1. IBDF10 ;ALB/CJM - ENCOUNTER FORM - (shift block contents) ;APRIL 22,1993
  1. ;;3.0;AUTOMATED INFO COLLECTION SYS;;APR 24, 1997
  1. ;
  1. SHIFT(TYPE) ;shifts contents of blocks - prompts user for what to shift (unless TYPE is defined), and how much to shift
  1. ;assumes IBBLK is defined unless TYPE="B"
  1. N AMOUNT,WAY,QUIT,TOP,BOTTOM,LEFT,RIGHT,HT,WIDTH,MAX
  1. S QUIT=0,VALMBCK="R"
  1. I '$D(TYPE) N TYPE D TYPE
  1. I $D(TYPE),"EDSLTMH"[TYPE S HT=IBBLK("H"),WIDTH=IBBLK("W")
  1. I $G(TYPE)="B" S HT=IBFORM("HT"),WIDTH=IBFORM("WIDTH")
  1. D:'QUIT DIRECTN
  1. D RE^VALM4
  1. D:'QUIT RANGE(HT,WIDTH)
  1. S:'QUIT MAX=$S(WAY="U":$S(BOTTOM:BOTTOM,1:HT),WAY="D":HT-TOP-1,WAY="L":$S(RIGHT:RIGHT,1:WIDTH),1:WIDTH-LEFT-1)
  1. S:'QUIT MAX=$$MAX^IBDF10C(TYPE,WAY,MAX,TOP,BOTTOM,LEFT,RIGHT)
  1. D:'QUIT AMOUNT(MAX)
  1. D:('QUIT)&($G(AMOUNT)>0) @TYPE
  1. S VALMBCK="R"
  1. Q
  1. TYPE ;asks user for what should be shifted
  1. D TYPEHELP
  1. K DIR S DIR(0)="SB^E:Everything;D:Display Fields;S:Selection Lists;L:Lines;T:Text Areas;M:Multiple Choice Fields;H:Hand Print Fields",DIR("A")="What should be shifted?",DIR("B")="Everything"
  1. S DIR("?")="^D TYPEHELP^IBDF10"
  1. D ^DIR K DIR I (Y=-1)!$D(DIRUT) S QUIT=1 Q
  1. S TYPE=Y
  1. Q
  1. TYPEHELP ;help for TYPE
  1. W !!,"You can choose what should be shifted. Select one of the following:",!," [E]verything, [D]isplay fields, [S]election lists, [L]ines, [T]ext areas,",!," [M]ultiple choice fields, [H]and print fields"
  1. Q
  1. DIRECTN ;asks user for direction of shift - returns WAY
  1. S DIR(0)="SB^U:UP;D:DOWN;L:LEFT;R:RIGHT",DIR("A")="Shift UP, DOWN, LEFT, or RIGHT?",DIR("B")="DOWN",DIR("?")="Which direction should the shift be in?"
  1. D ^DIR K DIR I (Y=-1)!$D(DIRUT) S QUIT=1 Q
  1. S WAY=Y
  1. Q
  1. AMOUNT(MAX) ;now ask user how far to shift - returns AMOUNT
  1. ;MAX is the maxium shift allowed
  1. S DIR(0)="N^0:"_MAX_":0"
  1. S DIR("A")="Shift how far "_$S(WAY="U":"up in rows",WAY="D":"down in rows",WAY="R":"to the right in columns",1:"to the left in columns")_"?"
  1. D ^DIR K DIR I (Y=-1)!$D(DIRUT) S QUIT=1 Q
  1. S AMOUNT=Y
  1. Q
  1. RANGE(HT,WIDTH) ;asks the user for the range - returns TOP,BOTTOM,LEFT,RIGHT
  1. N I
  1. K DIR
  1. ;get TOP
  1. S DIR("A")="What is the top-most row to shift?"
  1. S DIR(0)="N^1:"_HT_":0",DIR("B")=1
  1. D ^DIR K DIR I (Y=-1)!$D(DIRUT) S QUIT=1 Q
  1. S TOP=Y
  1. ;now get BOTTOM
  1. S DIR("A")="What is the bottom-most row to shift? (optional)",DIR("?",1)="Enter the lowest row that the shift should effect.",DIR("?")="Enter nothing to shift everything below the top-most row that you specified."
  1. K DIR("B")
  1. S DIR(0)="NO^"_TOP_":"_HT_":0"
  1. D ^DIR K DIR I (Y=-1)!$D(DTOUT)!$D(DUOUT) S QUIT=1 Q
  1. S BOTTOM=Y
  1. ;get LEFT
  1. S DIR("A")="What is the left-most column to shift?"
  1. S DIR(0)="N^1:"_WIDTH_":0",DIR("B")=1
  1. D ^DIR K DIR I (Y=-1)!$D(DIRUT) S QUIT=1 Q
  1. S LEFT=Y
  1. ;now get RIGHT
  1. S DIR("A")="What is the right-most column to shift? (optional)"
  1. S DIR("?",1)="Enter the right-most column that the shift should effect.",DIR("?")="Enter nothing to shift everything to the right of the left-most column that you specified."
  1. K DIR("B")
  1. S DIR(0)="NO^"_LEFT_":"_WIDTH_":0"
  1. D ^DIR K DIR I (Y=-1)!$D(DTOUT)!$D(DUOUT) S QUIT=1 Q
  1. S RIGHT=Y
  1. ;now change TOP,BOTTOM,LEFT,RIGHT to their internal values
  1. ;(BOTTOM or RIGHT)="" has special meaning - means shift without limit
  1. S TOP=TOP-1,LEFT=LEFT-1
  1. S:BOTTOM>0 BOTTOM=BOTTOM-1
  1. S:RIGHT>0 RIGHT=RIGHT-1
  1. Q
  1. E ;shift everything
  1. D FLDS^IBDF10A(WAY,AMOUNT,TOP,BOTTOM,LEFT,RIGHT)
  1. D LSTS^IBDF10B(WAY,AMOUNT,TOP,BOTTOM,LEFT,RIGHT)
  1. D TXT^IBDF10A(WAY,AMOUNT,TOP,BOTTOM,LEFT,RIGHT)
  1. D LINES^IBDF10A(WAY,AMOUNT,TOP,BOTTOM,LEFT,RIGHT)
  1. D MFLDS^IBDF10A(WAY,AMOUNT,TOP,BOTTOM,LEFT,RIGHT)
  1. D HFLDS^IBDF10A(WAY,AMOUNT,TOP,BOTTOM,LEFT,RIGHT)
  1. Q
  1. D ;shift data fields
  1. D FLDS^IBDF10A(WAY,AMOUNT,TOP,BOTTOM,LEFT,RIGHT)
  1. Q
  1. M ;shift multiple choice fields
  1. D MFLDS^IBDF10A(WAY,AMOUNT,TOP,BOTTOM,LEFT,RIGHT)
  1. Q
  1. H ;shift hand print fields
  1. D HFLDS^IBDF10A(WAY,AMOUNT,TOP,BOTTOM,LEFT,RIGHT)
  1. Q
  1. S ;shift selection lists
  1. D LSTS^IBDF10B(WAY,AMOUNT,TOP,BOTTOM,LEFT,RIGHT)
  1. Q
  1. T ;shift text areas
  1. D TXT^IBDF10A(WAY,AMOUNT,TOP,BOTTOM,LEFT,RIGHT)
  1. Q
  1. L ;shift lines
  1. D LINES^IBDF10A(WAY,AMOUNT,TOP,BOTTOM,LEFT,RIGHT)
  1. Q
  1. B ;shift blocks
  1. D BLOCKS^IBDF10A(WAY,AMOUNT,TOP,BOTTOM,LEFT,RIGHT)
  1. Q