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

ORDD41.m

Go to the documentation of this file.
  1. ORDD41 ;slc/KCM,MKB-Build menus in XUTL (file 101.41) ;10:36 AM 11 Feb 1999
  1. ;;3.0;ORDER ENTRY/RESULTS REPORTING;**4,46,57**;Dec 17, 1997
  1. SET(DLG) ; -- create dialog menu in ^XUTL("XQORM")
  1. Q:$D(^ORD(101.41,DLG,0))[0 Q:$P(^(0),U,4)'="M"
  1. N ITM,POS,COL,ROW,XQORM,TXT,PTR,X,R,C
  1. S (POS,COL,ROW)=0,XQORM=DLG_";ORD(101.41,"
  1. F S POS=$O(^ORD(101.41,DLG,10,"B",POS)) Q:POS="" S ITM=0 D
  1. . F S ITM=$O(^ORD(101.41,DLG,10,"B",POS,ITM)) Q:ITM'>0 D
  1. . . S X=$G(^ORD(101.41,DLG,10,ITM,0)),PTR=$P(X,U,2)
  1. . . S TXT=$S($L($P(X,U,4)):$P(X,U,4),PTR:$P($G(^ORD(101.41,+PTR,0)),U,2),1:""),TXT=$TR(TXT,",=;-"," ") Q:'$L(TXT)
  1. . . S ^XUTL("XQORM",XQORM,POS,0)=ITM_U_PTR_U_TXT_U_$P(X,U,3)_U_$TR($P(X,U,5),"120","OH")
  1. . . S:$P(POS,".",2)>COL COL=$P(POS,".",2) Q:'PTR Q:$P(X,U,5)
  1. . . S ^XUTL("XQORM",XQORM,"B",$$UP(TXT),POS)="" ;text
  1. . . S:$L($P(X,U,3)) ^XUTL("XQORM",DLG_";ORD(101.41,","B",$$UP($P(X,U,3)),POS)=1 ;mnemonic
  1. . S:$P(POS,".")>ROW ROW=$P(POS,".") ;hold last row
  1. F R=1:1:ROW F C=1:1:COL S POS=R_"."_C S:'$D(^XUTL("XQORM",XQORM,POS,0)) ^(0)="^^ ^^O" ;blank
  1. S X=$H,^XUTL("XQORM",DLG_";ORD(101.41,",0)=X,^("COL")=COL
  1. S ^ORD(101.41,DLG,99)=X
  1. Q
  1. ;
  1. KILL(DLG) ; -- Cleanup ^XUTL("XQORM")
  1. K ^XUTL("XQORM",DLG_";ORD(101.41,")
  1. Q
  1. ;
  1. UP(X) ;Convert X to upper case
  1. Q $TR(X,"abcdefghijklmnopqrstuvwxyz","ABCDEFGHIJKLMNOPQRSTUVWXYZ")
  1. ;
  1. REDO ; -- Rebuild menu in ^XUTL when changed
  1. I $D(^ORD(101.41,DA,0)) S ^(99)=$H
  1. Q
  1. ;
  1. REDOM ; -- Rebuild menu(s) in ^XUTL when DISPLAY TEXT changed
  1. N X,MENU S X=$H
  1. I $D(^ORD(101.41,DA,0)) S ^(99)=X
  1. S MENU=0 F S MENU=$O(^ORD(101.41,"AD",DA,MENU)) Q:MENU'>0 I $D(^ORD(101.41,MENU,0)) S ^(99)=X
  1. Q
  1. ;
  1. REDOX ; -- Rebuild menu in ^XUTL when ITEMS changed
  1. I $D(^ORD(101.41,+$G(DA(1)),0)) S ^(99)=$H
  1. Q
  1. ;
  1. TREE ; -- Ck menu tree to ensure new item is not an ancestor
  1. ; Input Xform for Item field #2 of Items subfile #101.412
  1. ; expecting DA, DA(1), X from FileMan
  1. N ORDDA,ORDD S ORDDA=DA(1)
  1. K:X=ORDDA X D TREE1
  1. Q
  1. TREE1 ; -- Look for X in ancestors
  1. F ORDD=0:0 Q:'$D(X) S ORDD=$O(^ORD(101.41,"AD",ORDDA,ORDD)) Q:ORDD'>0 K:X=ORDD X Q:'$D(X) D TREE2
  1. Q
  1. TREE2 ; -- Back up another level
  1. N ORDDA S ORDDA=ORDD N ORDD D TREE1
  1. Q
  1. ;
  1. LIST(MENU) ; -- List items on MENU for ?-help in editor
  1. N XQORM,TXT,POS,LCNT,QUIT,ITEM S (LCNT,QUIT)=0,TXT=""
  1. S XQORM=+$G(MENU)_";"_$J Q:'$D(^XUTL("XQORM",XQORM))
  1. F S TXT=$O(^XUTL("XQORM",XQORM,"B",TXT)) Q:TXT="" D Q:QUIT
  1. . S POS=0 F S POS=$O(^XUTL("XQORM",XQORM,"B",TXT,POS)) Q:POS'>0 Q:^(POS) D Q:QUIT
  1. . . S ITEM=$G(^XUTL("XQORM",XQORM,POS,0)),LCNT=LCNT+1
  1. . . I LCNT>(IOSL-2) R !,"Press <return> to continue ...",X:DTIME S LCNT=0 I X["^" S QUIT=1 Q
  1. . . W !?3,$P(ITEM,U,4),?10,$P(ITEM,U,3),$S($P(ITEM,U,2):" ["_$P($G(^ORD(101.41,+$P(ITEM,U,2),0)),U)_"]",1:"")
  1. Q
  1. ;
  1. LOCK(MENU) ; -- Lock [and rebuild?] Order Dialog menu
  1. N OK,XQORM S OK=1,XQORM=+MENU_";ORD(101.41,"
  1. I $S('XQORM:1,'$D(^ORD(101.41,+MENU,0)):1,1:0) S OK="0^Invalid menu." G LKQ
  1. I $D(^XUTL("XQORM",XQORM,0)),$P(^XUTL("XQORM",XQORM,0),U)'=$P($G(^ORD(101.41,+MENU,99)),U) D REBLD(+MENU)
  1. I '$D(^XUTL("XQORM",XQORM,0)) D REBLD(+MENU,.OK) G:'OK LKQ
  1. L +^XUTL("XQORM",XQORM,"XQORM PROTECT",$J):10 E S OK="0^Can't access menu at this time - try again later."
  1. LKQ Q OK
  1. ;
  1. UNLOCK(MENU) ; -- Unlock Order Dialog menu
  1. L -^XUTL("XQORM",+MENU_";ORD(101.41,","XQORM PROTECT",$J)
  1. Q
  1. ;
  1. REBLD(MENU,RES) ; -- Lock, rebuild Order Dialog menu
  1. N XQORM,DIE,DA,DR
  1. S XQORM=+MENU_";ORD(101.41,",DIE="^ORD(101.41,",DA=+MENU,DR="99///"_$H
  1. L +(^XUTL("XQORM",XQORM),^ORD(101.41,+MENU)):5 E S RES="0^Can't access menu at this time - try again later." Q
  1. D ^DIE S RES=1
  1. L -(^XUTL("XQORM",XQORM),^ORD(101.41,+MENU))
  1. Q