source: WorldVistAEHR/trunk/r/AUTOMATED_INFO_COLLECTION_SYS-IBD/IBDF9E.m@ 762

Last change on this file since 762 was 613, checked in by George Lilly, 15 years ago

initial load of WorldVistAEHR

File size: 3.2 KB
Line 
1IBDF9E ;ALB/CJM - ENCOUNTER FORM (create/edit/delete text areas);MARCH 20, 1993
2 ;;3.0;AUTOMATED INFO COLLECTION SYS;;APR 24, 1997
3TEXT ;Create, Edit, or Delete a text area on a block
4 S VALMBCK="R"
5 K DIR S DIR("?")="You can add text areas to the block, or edit or delete a text area already there."
6 S DIR("B")="C",DIR(0)="SB^C:Create;E:Edit;D:Delete",DIR("A")="[C]reate , [D]elete, or [E]dit a text area"
7 D ^DIR K DIR I $D(DIRUT)!(Y<0) Q
8 D @$S(Y="C":"NEWTEXT",Y="E":"EDITTEXT",Y="D":"DLTTEXT",1:"")
9 S VALMBCK="R"
10 Q
11EDITTEXT ;expects IBBLK to be defined
12 N IBTEXT,IBDELETE
13 ;IBDELETE is used in the imput template
14 D FULL^VALM1
15 D SELECT
16 I IBTEXT D
17 .D RE^VALM4
18 .K DIE,DA S DIE=357.8,DA=IBTEXT,DR="[IBDF EDIT TEXT AREA]",DIE("NO^")="BACKOUTOK" D ^DIE K DIE,DR,DA
19 .D UNCMPBLK^IBDF19(IBBLK),IDXBLOCK^IBDFU4
20 Q
21SELECT ;select a text area on the block
22 S IBTEXT=0
23 Q:'$G(IBBLK)
24 I '$O(^IBE(357.8,"C",IBBLK,0)) W !,"There is no text area!" D PAUSE^IBDFU5 Q
25AGAIN S DIC="^IBE(357.8,",DIC(0)="EFQ",DIC("B")="",D="C",X=IBBLK
26 D IX^DIC K DIC
27 S:+Y>0 IBTEXT=+Y
28 I 'IBTEXT,'$D(DTOUT),'$D(DUOUT) K DIR S DIR(0)="Y",DIR("A")="No text area selected! Try again",DIR("B")="YES" D ^DIR K DIR I '$D(DIRUT),Y=1 G AGAIN
29 Q
30DLTTEXT ;delete a text area - expects IBBLK to be defined
31 N IBTEXT
32 D FULL^VALM1
33 D SELECT
34 I IBTEXT D
35 .Q:'$$RUSURE^IBDFU5($P($G(^IBE(357.8,IBTEXT,0)),"^"))
36 .D DLTTEXT^IBDFU3(357.8,IBBLK,IBTEXT)
37 .D UNCMPBLK^IBDF19(IBBLK),IDXBLOCK^IBDFU4
38 Q
39NEWTEXT ;adds a new text area, expects IBBLK to be defined
40 N NAME,IBTEXT,NODE,IBDELETE,DLAYGO
41 ;IBDELETE - a flag used in the input template to indicate if the input template was completed - if returns 1 delete the record
42 S NAME=$$NEWNAME Q:NAME=-1
43 K DIC,DIE,DD,D0,DINUM S DIC="^IBE(357.8,",DIC(0)="FL",X=NAME,DLAYGO=357.8
44 D FILE^DICN K DIC,DIE,DA
45 S IBTEXT=$S(+Y<0:"",1:+Y)
46 I 'IBTEXT D
47 .W !,"Unable to create a text area!" D PAUSE^IBDFU5
48 I IBTEXT D
49 .K DIE,DA S DIE=357.8,DA=IBTEXT,DR="[IBDF EDIT TEXT AREA]",DIE("NO^")="BACKOUTOK" D ^DIE K DIE,DR,DA
50 .I IBDELETE K DA S DIK="^IBE(357.8,",DA=IBTEXT D ^DIK K DIK Q
51 .D UNCMPBLK^IBDF19(IBBLK),IDXBLOCK^IBDFU4
52 Q
53NEWNAME() ;
54 K DIR S DIR(0)="357.8,.01A",DIR("A")="New Text Area Name: ",DIR("B")=""
55 D ^DIR K DIR I $D(DIRUT) Q -1
56 Q Y
57FORMAT ;formats the word-processing field of IBTEXT
58 N W,HT,NODE,COUNT,LINE
59 S NODE=$G(^IBE(357.8,IBTEXT,0))
60 S W=$P(NODE,"^",5),HT=$P(NODE,"^",6)
61 D FORMAT^IBDFU6("^IBE(357.8,IBTEXT,1)",W) ;creates formated version at ^UTILITY($J,"W",1)
62 K ^IBE(357.8,IBTEXT,1)
63 I $G(^UTILITY($J,"W",1))>HT W !,"WARNING! The text area is too small to display all of the text." D PAUSE^IBDFU5
64 S (COUNT,NUM)=0 F S NUM=$O(^UTILITY($J,"W",1,NUM)) Q:'NUM S LINE=$G(^(NUM,0)) D
65 .;I $L(LINE)>W W !,"WARNING! The word "_LINE_" is being truncated",!,"because it is too long." D PAUSE^IBDFU5
66 .S ^IBE(357.8,IBTEXT,1,NUM,0)=$E(LINE,1,W)
67 .S COUNT=COUNT+1
68 S ^IBE(357.8,IBTEXT,1,0)="^^"_COUNT_"^"_COUNT_"^"_DT_"^^^^"
69 K ^UTILITY($J,"W")
70 Q
71MAXHT() ;returns the maximum ht. of IBTEXT text area fits in the block IBBLK
72 N NODE,Y
73 S NODE=$G(^IBE(357.8,IBTEXT,0)) S Y=$P(NODE,"^",4)
74 Q ((1+$$MAXY^IBDFU1B)-Y)
75 Q
76MAXW() ;returns the maximum width of IBTEXT text area fits in the block IBBLK
77 N NODE,X
78 S NODE=$G(^IBE(357.8,IBTEXT,0)) S X=$P(NODE,"^",3)
79 Q ((1+$$MAXX^IBDFU1B)-X)
Note: See TracBrowser for help on using the repository browser.