source: WorldVistAEHR/trunk/r/BAR_CODE_MED_ADMIN-ALPB-PSB/ALPBSP1.m@ 1710

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

initial load of WorldVistAEHR

File size: 3.8 KB
Line 
1ALPBSP1 ;OIFO-DALLAS MW,SED,KC-LIST AND SELECT PATIENT'S ORDERS ;01/01/03
2 ;;3.0;BAR CODE MED ADMIN;**8**;Mar 2004
3 ;
4 ; **NOTE: THIS ROUTINE IS CALLED BY A LIST MANAGER
5 ; PROTOCOL IN WHICH A PATIENT HAS ALREADY BEEN
6 ; SELECTED -- THIS ROUTINE SHOULD NOT BE RUN
7 ; DIRECTLY.
8 ;
9EN ; -- main entry point for ALPB PATIENT ORDERS
10 D EN^VALM("PSB SELECT ORDERS")
11 Q
12 ;
13HDR ; -- header code
14 I +$G(ALPBIEN)'>0 Q
15 S ALPBPT(0)=$G(^ALPB(53.7,ALPBIEN,0))
16 M ALPBPT(1)=^ALPB(53.7,ALPBIEN,1)
17 D HDR^ALPBFRM2(.ALPBPT,"A",0,.ALPBHDR)
18 S ALPBX=1
19 F S ALPBX=$O(ALPBHDR(ALPBX)) Q:'ALPBX D
20 .S VALMHDR(ALPBX-1)=ALPBHDR(ALPBX)
21 K ALPBHDR,ALPBPT,ALPBX
22 Q
23 ;
24INIT ; -- init variables and list array
25 I +$G(ALPBIEN)'>0 Q
26 K ALPBORDS,^TMP("ALPBORDS",$J)
27 D ORDS^ALPBUTL(ALPBIEN,"",.ALPBORDS)
28 K ALPBORDS("B")
29 I $G(ALPBLTYP)="" S ALPBLTYP="Active"
30 S ALPBX=0
31 F S ALPBX=$O(ALPBORDS(ALPBX)) Q:'ALPBX D
32 .I $G(ALPBORDS(ALPBX,2))="" S ALPBORDS(ALPBX,2)="XX"
33 .S ALPBORDS("B",ALPBORDS(ALPBX,2),ALPBORDS(ALPBX),ALPBX)=""
34 S ALPBLINE=0
35 S ALPBSTAT=""
36 F S ALPBSTAT=$O(ALPBORDS("B",ALPBSTAT)) Q:ALPBSTAT="" D
37 .S ALPBSTN=$$STAT2^ALPBUTL1(ALPBSTAT)
38 .I ALPBLTYP'="ALL"&(ALPBSTN'="Active") K ALPBSTN Q
39 .S ALPBORDN=""
40 .F S ALPBORDN=$O(ALPBORDS("B",ALPBSTAT,ALPBORDN)) Q:ALPBORDN="" D
41 ..S ALPBX=0
42 ..F S ALPBX=$O(ALPBORDS("B",ALPBSTAT,ALPBORDN,ALPBX)) Q:'ALPBX D
43 ...S ^TMP("ALPBORDS",$J,"B",ALPBORDN)=ALPBX
44 ...S ALPBLINE=ALPBLINE+1
45 ...S ALPBDATA=" "_ALPBORDN
46 ...S ALPBDATA=$$PAD^ALPBUTL(ALPBDATA,12)_ALPBSTN
47 ...S ALPBDATA=$$PAD^ALPBUTL(ALPBDATA,21)_ALPBORDS(ALPBX,1)
48 ...I +$G(ALPBORDS(ALPBX,3,0)) D
49 ....S ALPBDATA=$$PAD^ALPBUTL(ALPBDATA,26)_ALPBORDS(ALPBX,3,1)
50 ...I $G(ALPBORDS(ALPBX,4))'="" D
51 ....S ALPBY=$P(ALPBORDS(ALPBX,4),"^",1,3)
52 ....S ALPBY=$TR(ALPBY,"^"," ")
53 ....S ALPBDATA=ALPBDATA_" ("_ALPBY_")"
54 ....K ALPBY
55 ...S ^TMP("ALPBORDS",$J,ALPBLINE,0)=ALPBDATA
56 ...K ALPBDATA
57 ...S ALPBY=1
58 ...F S ALPBY=$O(ALPBORDS(ALPBX,3,ALPBY)) Q:'ALPBY D
59 ....S ALPBDATA=$$PAD^ALPBUTL($G(ALPBDATA),27)_ALPBORDS(ALPBX,3,ALPBY)
60 ....S ALPBLINE=ALPBLINE+1
61 ....S ^TMP("ALPBORDS",$J,ALPBLINE,0)=ALPBDATA
62 ....K ALPBDATA
63 ...K ALPBY
64 ..K ALPBX
65 .K ALPBORDN,ALPBSTN
66 S VALMCNT=ALPBLINE
67 I +$O(^TMP("ALPBORDS",$J,0))=0&(ALPBLTYP="Active") D
68 .S ALPBLTYP="ALL"
69 .S VALM("TITLE")="BCMAbu ALL Orders List"
70 .D INIT
71 .S VALMBCK="R"
72 K ALPBLINE,ALPBLTYP,ALPBORDS,ALPBSTAT
73 Q
74 ;
75HELP ; -- help code
76 S X="?" D DISP^XQORM1 W !!
77 Q
78 ;
79EXIT ; -- exit code
80 K ^TMP("ALPBORDS",$J)
81 Q
82 ;
83EXPND ; -- expand code
84 Q
85 ;
86SELORD ; select an order...
87 I '$D(^TMP("ALPBORDS",$J)) Q
88 S DIR(0)="FAO^1:45"
89 S DIR("A")="Select ORDER#: "
90 S DIR("A",1)="Select order number, more than one separated by a comma, or 'ALL': "
91 S DIR("B")="ALL"
92 S DIR("?")="Select order numbers from the list or 'ALL'."
93 S DIR("?",1)="Separate multiple order numbers with a comma."
94 D ^DIR K DIR
95 I $D(DIRUT) K DIRUT,DTOUT,X,Y Q
96 S ALPBOSEL=$$UP^XLFSTR($$STRIP^XLFSTR(Y," "))
97 I ALPBOSEL="ALL" D
98 .S I=0
99 .S ALPBOSEL=""
100 .F S ALPBOSEL=$O(^TMP("ALPBORDS",$J,"B",ALPBOSEL)) Q:ALPBOSEL="" D
101 ..S I=I+1
102 ..S ALPBOSEL(I)=^TMP("ALPBORDS",$J,"B",ALPBOSEL)
103 .S ALPBOSEL(0)=I
104 I ALPBOSEL'="ALL" D
105 .; make sure the input is separated by a comma...
106 .S ALPBOSEL=$$REPL^ALPBUTL2(ALPBOSEL,",")
107 .; parse out the user's input...
108 .F I=1:1 Q:$P(ALPBOSEL,",",I)="" D
109 ..I $G(^TMP("ALPBORDS",$J,"B",$P(ALPBOSEL,",",I)))="" Q
110 ..S ALPBOSEL(I)=^TMP("ALPBORDS",$J,"B",$P(ALPBOSEL,",",I))
111 I +$O(ALPBOSEL(0))=0 D Q
112 .W $C(7)
113 .W !,"Invalid selection."
114 .S DIR(0)="EA"
115 .S DIR("A")="Press <enter> to continue..."
116 .D ^DIR K DIR,DIRUT,DTOUT,X,Y
117 D EN^ALPBSP2
118 K ALPBOSEL
119 Q
120 ;
121SELALL ; set list type to ALL orders...
122 S ALPBLTYP="ALL"
123 S VALM("TITLE")="BCMAbu ALL Orders List"
124 D INIT
125 Q
126 ;
127SELACT ; set list type to Active orders...
128 S ALPBLTYP="Active"
129 S VALM("TITLE")="BCMAbu ACTIVE Orders List"
130 D INIT
131 Q
Note: See TracBrowser for help on using the repository browser.