ORWORDG ; SLC/KCM/JLI - Organize display groups;11:25 AM 11 Mar 1998 3/2/02 4PM
;;3.0;ORDER ENTRY/RESULTS REPORTING;**10,141**;Dec 17, 1997
;
MAPSEQ(Y) ; similar to GRPSEQB, for 32bit
N C,I,X
D GRPSEQ(.X)
S C=0,I=0
F S I=$O(X(I)) Q:I="" S C=C+1,Y(C)=I_"="_X(I)_U_$P(^ORD(100.98,I,0),U,2)
Q
GRPSEQB(Y) ;
; Call GRPSEQ, format for broker:
; Y(n)=Ptr to Display Group ^ Sequence ^ Top Level Display Group Name
N C,I,X
D GRPSEQ(.X)
S C=0,I=0
F S I=$O(X(I)) Q:I="" S C=C+1,Y(C)=I_U_X(I)
Q
GRPSEQ(BYGRP) ;
; Expanded list of display groups with sequence as value
N I,ORY,TOPINFO
D GETLST^XPAR(.ORY,"ALL","ORWOR CATEGORY SEQUENCE")
S I=0 F S I=$O(ORY(I)) Q:I="" D
. S BYGRP($P(ORY(I),U,2))=$P(ORY(I),U,1)_U_$P(^ORD(100.98,$P(ORY(I),U,2),0),U,2)
S I=0 F S I=$O(BYGRP(I)) Q:I="" S TOPINFO=BYGRP(I) D EXPAND(I)
Q
EXPAND(GROUP) ;
; (used by GRPSEQ)
N I,CHILD
S I=0 F S I=$O(^ORD(100.98,GROUP,1,I)) Q:I<1 D
. S CHILD=$P(^ORD(100.98,GROUP,1,I,0),"^",1)
. I '$D(BYGRP(CHILD)) S BYGRP(CHILD)=TOPINFO D EXPAND(CHILD)
Q
ALLTREE(LST) ; Return the tree for all display groups
N ROOT,ILST
S ILST=0,ROOT=$O(^ORD(100.98,"B","ALL",0))
S ILST=ILST+1,LST(ILST)=ROOT_U_"ALL SERVICES^0^+"
D LSTCHLD(ROOT)
Q
LSTCHLD(PARENT) ; list descendends of this node (recursive)
N CHILD,I
S I=0 F S I=$O(^ORD(100.98,PARENT,1,I)) Q:'I D
. S CHILD=+^ORD(100.98,PARENT,1,I,0)
. S ILST=ILST+1,LST(ILST)=CHILD_U_$P(^ORD(100.98,CHILD,0),U)_U_PARENT
. I $D(^ORD(100.98,CHILD,1))>1 D
. . S LST(ILST)=LST(ILST)_"^+"
. . D LSTCHLD(CHILD)
Q
REVSTS(LST) ; Return the status flags available for review orders
;N I,X,T S ILST=0
;F I=1:1 S T="ORDSTS+"_I_"^ORCHANG2" S X=$T(@T) Q:$P(X,";",4)="ZZZZ" D
;. S ILST=ILST+1,LST(ILST)=$P(X,";",3)_U_$P(X,";",4)
D STSLST^ORCHANG2(.LST)
Q
IEN(VAL,X) ; Return IEN for a display group
S VAL=$O(^ORD(100.98,"B",X,0))
Q
ORWORDG ; SLC/KCM/JLI - Organize display groups;11:25 AM 11 Mar 1998 3/2/02 4PM
+1 ;;3.0;ORDER ENTRY/RESULTS REPORTING;**10,141**;Dec 17, 1997
+2 ;
MAPSEQ(Y) ; similar to GRPSEQB, for 32bit
+1 NEW C,I,X
+2 DO GRPSEQ(.X)
+3 SET C=0
SET I=0
+4 FOR
SET I=$ORDER(X(I))
IF I=""
QUIT
SET C=C+1
SET Y(C)=I_"="_X(I)_U_$PIECE(^ORD(100.98,I,0),U,2)
+5 QUIT
GRPSEQB(Y) ;
+1 ; Call GRPSEQ, format for broker:
+2 ; Y(n)=Ptr to Display Group ^ Sequence ^ Top Level Display Group Name
+3 NEW C,I,X
+4 DO GRPSEQ(.X)
+5 SET C=0
SET I=0
+6 FOR
SET I=$ORDER(X(I))
IF I=""
QUIT
SET C=C+1
SET Y(C)=I_U_X(I)
+7 QUIT
GRPSEQ(BYGRP) ;
+1 ; Expanded list of display groups with sequence as value
+2 NEW I,ORY,TOPINFO
+3 DO GETLST^XPAR(.ORY,"ALL","ORWOR CATEGORY SEQUENCE")
+4 SET I=0
FOR
SET I=$ORDER(ORY(I))
IF I=""
QUIT
Begin DoDot:1
+5 SET BYGRP($PIECE(ORY(I),U,2))=$PIECE(ORY(I),U,1)_U_$PIECE(^ORD(100.98,$PIECE(ORY(I),U,2),0),U,2)
End DoDot:1
+6 SET I=0
FOR
SET I=$ORDER(BYGRP(I))
IF I=""
QUIT
SET TOPINFO=BYGRP(I)
DO EXPAND(I)
+7 QUIT
EXPAND(GROUP) ;
+1 ; (used by GRPSEQ)
+2 NEW I,CHILD
+3 SET I=0
FOR
SET I=$ORDER(^ORD(100.98,GROUP,1,I))
IF I<1
QUIT
Begin DoDot:1
+4 SET CHILD=$PIECE(^ORD(100.98,GROUP,1,I,0),"^",1)
+5 IF '$DATA(BYGRP(CHILD))
SET BYGRP(CHILD)=TOPINFO
DO EXPAND(CHILD)
End DoDot:1
+6 QUIT
ALLTREE(LST) ; Return the tree for all display groups
+1 NEW ROOT,ILST
+2 SET ILST=0
SET ROOT=$ORDER(^ORD(100.98,"B","ALL",0))
+3 SET ILST=ILST+1
SET LST(ILST)=ROOT_U_"ALL SERVICES^0^+"
+4 DO LSTCHLD(ROOT)
+5 QUIT
LSTCHLD(PARENT) ; list descendends of this node (recursive)
+1 NEW CHILD,I
+2 SET I=0
FOR
SET I=$ORDER(^ORD(100.98,PARENT,1,I))
IF 'I
QUIT
Begin DoDot:1
+3 SET CHILD=+^ORD(100.98,PARENT,1,I,0)
+4 SET ILST=ILST+1
SET LST(ILST)=CHILD_U_$PIECE(^ORD(100.98,CHILD,0),U)_U_PARENT
+5 IF $DATA(^ORD(100.98,CHILD,1))>1
Begin DoDot:2
+6 SET LST(ILST)=LST(ILST)_"^+"
+7 DO LSTCHLD(CHILD)
End DoDot:2
End DoDot:1
+8 QUIT
REVSTS(LST) ; Return the status flags available for review orders
+1 ;N I,X,T S ILST=0
+2 ;F I=1:1 S T="ORDSTS+"_I_"^ORCHANG2" S X=$T(@T) Q:$P(X,";",4)="ZZZZ" D
+3 ;. S ILST=ILST+1,LST(ILST)=$P(X,";",3)_U_$P(X,";",4)
+4 DO STSLST^ORCHANG2(.LST)
+5 QUIT
IEN(VAL,X) ; Return IEN for a display group
+1 SET VAL=$ORDER(^ORD(100.98,"B",X,0))
+2 QUIT