source: FOIAVistA/trunk/r/ORDER_ENTRY_RESULTS_REPORTING-OR-OCX--ORRC--ORRJ/ORCHTAB.m@ 1015

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

initial load of FOIAVistA 6/30/08 version

File size: 3.8 KB
Line 
1ORCHTAB ;SLC/MKB-Build Chart tab listings ;05:58 PM 23 Aug 2000
2 ;;3.0;ORDER ENTRY/RESULTS REPORTING;**27,72,68,94**;Dec 17, 1997
3EN ; -- rebuild ORTAB listing
4 N CONTEXT,DEFCXT,LCNT,NUM,ORTITLE,ORCAPTN,ORMENU,ORACTNS,ORCHANGE,Z,ORMAX,ORRM
5 S CONTEXT=$S($P($G(^TMP("OR",$J,ORTAB,0)),U,4):"",1:$P($G(^(0)),U,3))
6 S (LCNT,NUM)=0,ORMAX=40 K ^TMP("OR",$J,ORTAB)
7 D EN^ORCHTAB1 ; rebuild ORTAB via CONTEXT
8 I 'LCNT S LCNT=1,^TMP("OR",$J,ORTAB,1,0)=" "_$$PAD("No data available.",40)_"|"
9 S ^TMP("OR",$J,ORTAB,0)=LCNT_U_NUM_U_CONTEXT_U_$G(DEFCXT),^("TITLE")=$G(ORTITLE),^("RM")=$S($G(ORRM):ORRM,1:240)
10 I $D(ORCHANGE) S Z=$O(^ORD(101,"B",ORCHANGE,0)) S:Z ^TMP("OR",$J,ORTAB,"CHANGE")=Z_";ORD(101,"
11 I $D(ORACTNS),NUM S Z=$O(^ORD(101,"B",ORACTNS,0)) S:Z ^TMP("OR",$J,ORTAB,"#")=Z_"^1:"_NUM
12 I $D(ORMENU) S Z=$O(^ORD(101,"B",ORMENU,0)) S:Z ^TMP("OR",$J,ORTAB,"MENU")=Z_";ORD(101,"
13 I $D(ORCAPTN) M ^TMP("OR",$J,ORTAB,"CAPTION")=ORCAPTN
14 Q
15 ;
16SUBHDR(X) ; -- add subheader X to listing
17 S LCNT=LCNT+1,^TMP("OR",$J,ORTAB,LCNT,0)=" "_$$PAD(X,40)_"|"
18 D SETVIDEO(LCNT,6,$L(X),IOUON,IOUOFF)
19 S ^TMP("OR",$J,ORTAB,"HDR",X)=LCNT
20 Q
21 ;
22ADD ; -- add item to listing
23 N FIRST,LINES,I
24 S LCNT=LCNT+1,NUM=NUM+1,FIRST=LCNT,LINES=+$G(ORTX)
25 S:+$G(DATA)>LINES LINES=+DATA
26 S ^TMP("OR",$J,ORTAB,"IDX",NUM)=ID_U_FIRST_U_LINES_U_$G(ORIFN)
27 S ^TMP("OR",$J,ORTAB,LCNT,0)=$$PAD(NUM,5)_$$PAD($G(ORTX(1)),40)_"| "_$G(DATA(1))
28 F I=2:1:LINES S LCNT=LCNT+1,^TMP("OR",$J,ORTAB,LCNT,0)=" "_$$PAD($G(ORTX(I)),40)_"| "_$G(DATA(I))
29 D:$L(ID) SETVIDEO(FIRST,1,5,IOINHI,IOINORM) ; hilite selectable items
30 K ORTX
31 Q
32 ;
33LINE ; -- add line X with DATA to listing
34 S LCNT=LCNT+1,^TMP("OR",$J,ORTAB,LCNT,0)=" "_$$PAD(X,40)_"| "_$G(DATA)
35 Q
36 ;
37BLANK ; -- add blank line
38 S LCNT=LCNT+1,^TMP("OR",$J,ORTAB,LCNT,0)=$$REPEAT^XLFSTR(" ",45)_"|"
39 Q
40 ;
41SETVIDEO(LINE,COL,WIDTH,ON,OFF) ; -- set video attributes
42 S ^TMP("OR",$J,ORTAB,"VIDEO",LINE,COL,WIDTH)=ON
43 S ^TMP("OR",$J,ORTAB,"VIDEO",LINE,COL+WIDTH,0)=OFF
44 Q
45 ;
46PAD(X,WIDTH) ; -- returns X padded with spaces to total WIDTH
47 N Y S Y=X_$$REPEAT^XLFSTR(" ",WIDTH-$L(X))
48 Q Y
49 ;
50DATE(X) ;
51 N D,Y S D=$P(X,".") I D="" Q ""
52 I 'D Q $E($$FTDATE^ORCD(D),1,8) ; free text date
53 S Y=$E(D,4,5)_"/"_$E(D,6,7)_"/"_$E(D,2,3)
54 Q Y
55 ;
56DATETIME(X,LF) ;
57 N D,T,Y,YR,TM I X="" Q ""
58 I X'>0 S X=$$FTDT(X) Q:X'?7N.1".".6N X ;free text date/time
59 S D=$P(X,"."),T=$P(X,".",2) I D="" Q ""
60 S Y=$E(D,4,5)_"/"_$E(D,6,7),YR=1700+$E(D,1,3),TM=""
61 I T S:$L(T)<4 T=T_$E("0000",1,4-$L(T)) S TM=$E(T,1,2)_":"_$E(T,3,4)
62 I '$G(LF) S Y=Y_"/"_$E(YR,3,4)_$S(T:" "_TM,1:"") ;not Order Long Format
63 E S Y=Y_$S(X'<($$NOW^XLFDT-10000):" "_TM,LF=1:" "_YR,1:"/"_$E(YR,3,4))
64 Q Y
65 ;
66FTDT(X) ; -- Return free text date for use in Tab displays
67 N Y,%DT S X=$$UP^XLFSTR(X)
68 Q:"NOW"[X "NOW" I X?1"NOW+"1.N.E Q X
69 I "NOON"[X Q "NOON"
70 I $E("MIDNIGHT",1,$L(X))[X Q "MIDNIGHT"
71 I (X="AM")!(X="NEXT")!(X="CLOSEST") Q X
72 I X="NEXTA" Q "NEXT"
73 I $E(X)="T" D Q Y
74 . N X1,X2 S X1=$P(X,"@"),X2=$P(X,"@",2)
75 . S Y=$S(X1="T":"TODAY",1:X1)_" "_X2
76 S %DT="TX" D ^%DT
77 Q Y
78 ;
79LNAMEF(X) ; -- Returns user X name as LNAME,F
80 N LN,FN,Y S X=$P($G(^VA(200,+X,0)),U) Q:X="" "UNKNOWN"
81 S LN=$P(X,","),FN=$P(X,",",2) S:$E(FN)=" " FN=$E(FN,2,99)
82 S Y=$E(LN,1,8)_","_$E(FN)
83 Q Y
84 ;
85TXT ; -- Add text in X to ORTX() up to ORMAX width
86 N I,Y S:'$G(ORTX) ORTX=1,ORTX(1)="" S Y=$L(ORTX(ORTX))
87 I $L(ORTX(ORTX)_" "_X)'>ORMAX S ORTX(ORTX)=ORTX(ORTX)_$S(Y:" ",1:"")_X Q
88 F I=1:1:$L(X," ") S:$L(ORTX(ORTX)_" "_$P(X," ",I))>ORMAX ORTX=ORTX+1,Y=0 S ORTX(ORTX)=$G(ORTX(ORTX))_$S(Y:" ",1:"")_$P(X," ",I),Y=1
89 Q
90 ;
91ACCESS() ; -- Does user have menu tree access to CPRS?
92 I '$L($T(ACCESS^XQCHK)) Q 1 ;Can't check - allow access
93 N OROK,ORTYP,OROPT S OROK=0
94 F ORTYP="WARD CLERK","NURSE","CLINICIAN" D Q:OROK
95 . S OROPT=+$$FIND1^DIC(19,"","QX","OR OE/RR MENU "_ORTYP) Q:OROPT'>0
96 . S:$$ACCESS^XQCHK(DUZ,OROPT)>0 OROK=1
97 Q OROK
Note: See TracBrowser for help on using the repository browser.