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

OCXODSP1.m

Go to the documentation of this file.
OCXODSP1 ;SLC/RJS,CLA -  Rule Display (Display a Rule) ;3/26/01  15:03
 ;;3.0;ORDER ENTRY/RESULTS REPORTING;**32,105**;Dec 17,1997
 ;;  ;;ORDER CHECK EXPERT version 1.01 released OCT 29,1998
 ;
EN(OCXD0,OCXTAB,OCXRM) ;
 ;
 N OCXD1,OCXD,OCXRD,OCXE,OCXSUB
 ;
 S OCXTAB=+$G(OCXTAB) S:'$G(OCXD0) OCXD0=+$$DIC("^OCXS(860.2,","AEMQ") Q:'OCXD0
 ;
 S OCXRD="" D DIQ("^OCXS(860.2,",OCXD0,.OCXRD)
 F OCXSUB="C","R" S OCXD1=0 F  S OCXD1=$O(^OCXS(860.2,OCXD0,OCXSUB,OCXD1)) Q:'OCXD1  D
 .S OCXD(0)=OCXD0,OCXD=OCXD1 D DIQ("^OCXS(860.2,"_OCXD0_","""_OCXSUB_""",",.OCXD,.OCXRD)
 ;
 W !
 W ! D FIELD("Rule:",$G(OCXRD(860.2,OCXD0,.01,"E"))_" ("_$G(OCXRD(860.2,OCXD0,.02,"E"),"ACTIVE")_" Status)",OCXTAB,OCXRM)
 ;
 S OCXD1=0 F  S OCXD1=$O(OCXRD(860.21,OCXD1)) Q:'OCXD1  D
 .N OUTSTR,OCXE
 .W !
 .W ! D FIELD("Rule Element Label:",$G(OCXRD(860.21,OCXD1,.01,"E")),OCXTAB,OCXRM)
 .I $G(OCXRD(860.21,OCXD1,.02,"I")) D  Q
 ..W ! D FIELD("           Expression:",$G(OCXRD(860.21,OCXD1,2,"E")),OCXTAB,OCXRM)
 ..I ($G(OCXRD(860.21,OCXD1,2,"E"))["|") D
 ...N PTR,EXPVAL,DFLD
 ...S EXPVAL=$G(OCXRD(860.21,OCXD1,2,"E")) F PTR=2:2:$L(EXPVAL,"|") S DFLD=$P(EXPVAL,"|",PTR) D GETDF(DFLD)
 .;
 .S OUTSTR=$G(OCXRD(860.21,OCXD1,1,"E"))
 .W ! D FIELD("              Element:",OUTSTR,OCXTAB,OCXRM)
 .S OCXE=+$G(OCXRD(860.21,OCXD1,1,"I")) I +OCXE D EN^OCXODSP2(OCXE,OCXTAB+OCXOFF,OCXRM)
 ;
 S OCXD1=0 F  S OCXD1=$O(OCXRD(860.22,OCXD1)) Q:'OCXD1  D
 .N EXPVAL,DFLD,PTR S DFLD=""
 .W !
 .W ! D FIELD("Relation Expression:",$G(OCXRD(860.22,OCXD1,1,"E")),OCXTAB,OCXRM)
 .I $D(OCXRD(860.22,OCXD1,2,"E")) W ! D FIELD("            Order Check:",$G(OCXRD(860.22,OCXD1,2,"E")),OCXTAB,OCXRM)
 .I $D(OCXRD(860.22,OCXD1,3,"E")) W ! D FIELD("           Notification:",$G(OCXRD(860.22,OCXD1,3,"E")),OCXTAB,OCXRM)
 .I $D(OCXRD(860.22,OCXD1,4,"E")) W ! D FIELD("          Report Device:",$G(OCXRD(860.22,OCXD1,4,"E")),OCXTAB,OCXRM)
 .I $D(OCXRD(860.22,OCXD1,5,"E")) W ! D FIELD("   Notification Message:",$G(OCXRD(860.22,OCXD1,5,"E")),OCXTAB,OCXRM)
 .I $D(OCXRD(860.22,OCXD1,6,"E")) W ! D FIELD("    Order Check Message:",$G(OCXRD(860.22,OCXD1,6,"E")),OCXTAB,OCXRM)
 .I $D(OCXRD(860.22,OCXD1,7,"E")) W ! D FIELD("        Schedule Action:",$G(OCXRD(860.22,OCXD1,7,"E")),OCXTAB,OCXRM)
 .I $D(OCXRD(860.22,OCXD1,8,"E")) W ! D FIELD("     Schedule Frequency:",$G(OCXRD(860.22,OCXD1,8,"E")),OCXTAB,OCXRM)
 .I $D(OCXRD(860.22,OCXD1,9,"E")) W ! D FIELD("           Execute Code:",$G(OCXRD(860.22,OCXD1,9,"E")),OCXTAB,OCXRM)
 .I ($G(OCXRD(860.22,OCXD1,5,"E"))["|") S EXPVAL=$G(OCXRD(860.22,OCXD1,5,"E")) F PTR=2:2:$L(EXPVAL,"|") S DFLD=$P(EXPVAL,"|",PTR) S:$L(DFLD) DFLD(DFLD)=""
 .I ($G(OCXRD(860.22,OCXD1,6,"E"))["|") S EXPVAL=$G(OCXRD(860.22,OCXD1,6,"E")) F PTR=2:2:$L(EXPVAL,"|") S DFLD=$P(EXPVAL,"|",PTR) S:$L(DFLD) DFLD(DFLD)=""
 .S DFLD="" F  S DFLD=$O(DFLD(DFLD)) Q:'$L(DFLD)  D GETDF(DFLD)
 ;
 Q
 ;
 ;
GETDF(DFLD) ;
 ;
 N DFLDN,DCONT,DELEM,DELEMN
 I (DFLD[".") D  Q
 .S DELEM=$P(DFLD,".",1),DFLD=$P(DFLD,".",2)
 .S DFLDN=$O(^OCXS(860.4,"C",DFLD,0))
 .I 'DFLDN S DFLDN=0 F  S DFLDN=$O(^OCXS(860.4,"B",$E(DFLD,1,30),DFLDN)) Q:'DFLDN  Q:($P(^OCXS(860.4,DFLDN,0),U,1)=DFLD)
 .S DELEMN=0 F  S DELEMN=$O(OCXRD(860.21,DELEMN)) Q:'DELEMN  Q:(OCXRD(860.21,DELEMN,.01,"E")=DELEM)
 .Q:'DELEMN  S DELEM=+$G(OCXRD(860.21,DELEMN,1,"I")) Q:'DELEM
 .S DCONT=+$P($G(^OCXS(860.3,DELEM,0)),U,2) Q:'DCONT
 .D EN^OCXODSP3(DFLDN,OCXTAB+OCXOFF,OCXRM,DCONT)
 ;
 I '(DFLD[".") D
 .S DFLDN=$O(^OCXS(860.4,"C",DFLD,0))
 .I 'DFLDN S DFLDN=0 F  S DFLDN=$O(^OCXS(860.4,"B",$E(DFLD,1,30),DFLDN)) Q:'DFLDN  Q:($P(^OCXS(860.4,DFLDN,0),U,1)=DFLD)
 .S DELEMN=0 F  S DELEMN=$O(OCXRD(860.21,DELEMN)) Q:'DELEMN  D
 ..S DELEM=+$G(OCXRD(860.21,DELEMN,1,"I")) Q:'DELEM
 ..S DCONT=+$P($G(^OCXS(860.3,DELEM,0)),U,2) Q:'DCONT
 ..S DCONT(DCONT)=""
 .S DCONT=0 F  S DCONT=$O(DCONT(DCONT)) Q:'DCONT  D EN^OCXODSP3(DFLDN,OCXTAB+OCXOFF,OCXRM,DCONT)
 ;
 Q
 ;
FIELD(TITLE,STRING,TAB,MARGIN) ;
 ;
 W ?TAB,TITLE
 ;
 N PTR,SUBSTR,STRLEN
 ;
 S STRLEN=MARGIN-($L(TITLE)+TAB)-5
 S SUBSTR="" F PTR=1:1:$L(STRING," ") D
 .I ($L(SUBSTR)>STRLEN) W ?(TAB+$L(TITLE)+1),SUBSTR W:$L($P(STRING," ",PTR+1)) ! S SUBSTR=""
 .S:$L(SUBSTR) SUBSTR=SUBSTR_" " S SUBSTR=SUBSTR_$P(STRING," ",PTR)
 W:$L(SUBSTR) ?(TAB+$L(TITLE)+1),SUBSTR
 Q
 ;
DIC(OCXDIC,OCXDIC0,OCXDICA,OCXX,OCXDICS,OCXDR) ;
 ;
 N DIC,X,Y
 S DIC=$G(OCXDIC) Q:'$L(DIC) -1
 S DIC(0)=$G(OCXDIC0) S:$L($G(OCXX)) X=OCXX
 S:$L($G(OCXDICS)) DIC("S")=OCXDICS
 S:$L($G(OCXDICA)) DIC("A")=OCXDICA
 S:$L($G(OCXDR)) DIC("DR")=OCXDR
 D ^DIC Q:(Y<1) 0 Q Y
 ;
 ;
DIQ(DIC,DA,OCXARY) ;
 ;
 N DR,DIQ S DR=".01:99999",DIQ="OCXARY(",DIQ(0)="IEN" D EN^DIQ1
 Q
 ;