source: WorldVistAEHR/trunk/r/OUTPATIENT_PHARMACY-PSO-APSP-HUIP/PSOBPSRP.m@ 1704

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

initial load of WorldVistAEHR

File size: 3.2 KB
Line 
1PSOBPSRP ;BHM/LE - Ignored Rejects Report ;03/01/07
2 ;;7.0;OUTPATIENT PHARMACY;**260**;13 Feb 97;Build 84
3 ;
4EN N PSOSD,PSOED,PSOST,PSOSRT,PSOAPT,PSODRUG,PSODIV,PSODRG,PSOST,PSOOC,PSOU,PSOUSER,PSOAPT,I,Y
5 N OK,X,C,%DT,PSOSIT
6 ;
7DIV ; - Ask for Division
8 D SEL^PSOREJU1("DIVISION","^PS(59,",.PSODIV,$$GET1^DIQ(59,+$G(PSOSITE),.01)) Q:$G(PSODIV)="^"
9 I $G(PSODIV)="ALL" S PSOSIT=1 K PSODIV
10 ;
11BEGD ; - Ask for FROM DATE DOCUMENTED
12 S %DT(0)=-DT,%DT="AEP",%DT("A")="BEGIN REJECT DATE: "
13 W ! D ^%DT I Y<0!($D(DTOUT)) G END
14 S PSOSD=Y\1-.00001
15 ;
16ENDT ; - Ask for TO DATE DOCUMENTED
17 S %DT(0)=PSOSD+1\1,%DT("A")="END REJECT DATE: "
18 W ! D ^%DT I Y<0!($D(DTOUT)) G END
19 S PSOED=Y\1+.99999
20 ;
21SORT ; - Ask for SORT BY
22 K DIR S DIR("B")="PATIENT" D HL1("A")
23SORT1 S PSOSRT="",(PSOAPT)=1,(PSOST,PSOOC)="B"
24 S DIR("A")="SORT BY",DIR(0)="FO" D HL1("?")
25 W ! D ^DIR K DIR I $D(DIRUT) G END
26 ;
27 S OK=1,C=15 W !
28 F I=1:1:$L(Y,",") D
29 . S X=$P(Y,",",I) S:X'?.N X=$$TRNS(X) I PSOSRT[X Q
30 . W !?(C-10),$S(I=1:"SORT BY ",1:"THEN BY ") S C=C+5
31 . I X<1!(X>3) W X,"???",$C(7) S OK=0 Q
32 . W $P("PATIENT^DRUG^USER","^",X)
33 . S PSOSRT=PSOSRT_","_X
34 I 'OK S DIR("B")=Y G SORT1
35 S $E(PSOSRT)=""
36 ;
37 S OK=1
38 F I=1:1:$L(PSOSRT,",") D I 'OK Q
39 . S X=$P(PSOSRT,",",I) D @("SRT"_X)
40 I 'OK S DIR("B")="PATIENT" G SORT1
41 ;
42DEV W ! K %ZIS,IOP,POP,ZTSK S %ZIS="QM" D ^%ZIS K %ZIS I POP G END
43 ;If user didn't select a particular sort, assume all values for that sort
44 S:'$G(PSOAPT)&('$D(PSOPT)) PSOAPT=1
45 S:'$G(PSODRUG)&('$D(PSODRG)) PSODRUG=1
46 S:'$G(PSOUSER)&('$D(PSOU)) PSOUSER=1
47 ;
48 I $D(IO("Q")) D G END
49 . N G K IO("Q"),ZTIO,ZTSAVE,ZTDTH,ZTSK
50 . S ZTRTN="EN^PSOBPSR1",ZTDESC="Ignored Rejects Report"
51 . F G="PSOSD","PSOED","PSOSRT","PSOPT","PSODRG" S:$D(@G) ZTSAVE(G)=""
52 . F G="PSOST","PSOOC","PSOAPT","PSODRUG","PSOUSER","PSOSIT" S:$D(@G) ZTSAVE(G)=""
53 . S:$D(PSOPT) ZTSAVE("PSOPT(")="" S:$D(PSODRG) ZTSAVE("PSODRG(")=""
54 . S:$D(PSOU) ZTSAVE("PSOU(")="" S:$D(PSODIV) ZTSAVE("PSODIV(")=""
55 . D ^%ZTLOAD W:$D(ZTSK) !,"Report is Queued to print!" K ZTSK
56 ;
57 G EN^PSOBPSR1
58 ;
59END Q
60 ;
61HL1(S) ; - Help for the SORT BY prompt
62 S DIR(S,1)=" Enter the SORT field(s) for this Report:"
63 S DIR(S,2)=" "
64 S DIR(S,3)=" 1 - PATIENT"
65 S DIR(S,4)=" 2 - DRUG"
66 S DIR(S,5)=" 3 - USER"
67 S DIR(S,6)=" "
68 S DIR(S,7)=" Or any combination of the above, separated by comma,"
69 S DIR(S,8)=" as in these examples:"
70 S DIR(S,9)=" "
71 S DIR(S,10)=" 2,1 - BY PATIENT, THEN DRUG"
72 S DIR(S,11)=" 3,1,2 - BY USER, THEN BY PATIENT, THEN BY DRUG"
73 S DIR(S,12)=" "
74 S DIR(S)=" "
75 Q
76 ;
77SRT1 ; - Selection of PATIENTS to print on the Report
78 K PSOPT S PSOAPT=0
79 D SEL^PSOREJU1("PATIENT","^DPT(",.PSOPT) I $G(PSOPT)="^" S OK=0 Q
80 I $G(PSOPT)="ALL" S PSOAPT=1 K PSOPT
81 Q
82 ;
83SRT2 ; - Selection of Drugs to print on the Report
84 K PSODRG S PSODRUG=0
85 D SEL^PSOREJU1("DRUG","^PSDRUG(",.PSODRG) I $G(PSODRG)="^" S OK=0 Q
86 I $G(PSODRG)="ALL" S PSODRUG=1 K PSODRG
87 Q
88 ;
89SRT3 ; - Selection of Users to print on the Report
90 K PSOU S PSOUSER=0
91 D SEL^PSOREJU1("USER","^VA(200,",.PSOU) I $G(PSOU)="^" S OK=0 Q
92 I $G(PSOU)="ALL" S PSOUSER=1 K PSOU
93 Q
94 ;
95TRNS(X) ; - Translates Alpha into the corresponding Sorting Code
96 N L,UPX S L=$L(X),UPX=$$UP^XLFSTR(X)
97 I $E("PATIENT",1,L)=UPX Q 1
98 I $E("DRUG",1,L)=UPX Q 2
99 I $E("USER",1,L)=UPX Q 3
100 Q X
101 ;
Note: See TracBrowser for help on using the repository browser.