source: WorldVistAEHR/trunk/r/INPATIENT_MEDICATIONS-PSJ-PSIV-PSG--PSGW/PSGL.m@ 1150

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

initial load of WorldVistAEHR

File size: 5.3 KB
RevLine 
[613]1PSGL ;BIR/CML3-LABEL PRINT/REPRINT ;25 SEP 97 / 7:41 AM
2 ;;5.0; INPATIENT MEDICATIONS ;**31,111**;16 DEC 97
3 ;
4 ; Reference to ^PS(55 is supported by DBIA# 2191
5 ;
6 N PSGPTMP,PSJNEW,PPAGE,PSGEFN S PSJNEW=1
7 D ENCV^PSGSETU Q:$D(XQUIT) K PSGLSTOP S %=1 F PSGTOL=1,3 I $O(^PS(53.41,PSGTOL,1,0)) D ENACL^PSGL0
8 G:%<0 DONE
9CHK ;
10 I '$O(^PS(53.41,2,1,DUZ,1,0)) G ASK
11 F W !!,"You have unprinted new labels. Do you want them now" S %=1 D YN^DICN Q:% D CHKM^PSGLH
12 G:%<0 DONE I %=1 D ENNL^PSGL0 G ASK
13 F W !!,"Will you want them later" S %=1 D YN^DICN Q:% D LM^PSGLH
14 G:%<0 DONE I %=2 S DIK="^PS(53.41,2,1,",DA=DUZ,DA(1)=2 D ^DIK
15 ;
16ASK ;
17 S PSGSSH="LBL" F D ^PSGSEL Q:"^"[PSGSS K PSGLWD,PSGLWG S PSGPTMP=0,PPAGE=1 D @PSGSS Q:+Y'>0 K ZTSAVE,IO("Q") S POP=0,Y=1 D:PSGSS'="P" DT Q:Y'>0 D:PSGSS'="P" DEV Q:POP!$D(IO("Q")) D @("EN"_PSGSS) D ^%ZISC
18 ;
19DONE ;
20 D ENKV^PSGSETU K CF,DFN,NG,OD,ON,PSGCNT,PSGLMT,PSGODDD,PSGOL,PSGON,PSGOP,PSGORD,PSGODT,PSGSS,PSGPL1,PSGPL2,PSGPL3,PSGSSH,PSIVREA,PSJON,PSJOL,PSJORD,PSJIVOF,PSJOCNT,PSJON,RF,QO,QS,QSD,Q1,Q2,WG,ZTSAVE
21 K ORPV,ORSTOP,ORSTRT,ORSTS,P17 Q
22 ;
23DEV ;
24 K ZTSK,%ZIS,IOP,IO("Q") S PSGION=ION,%ZIS="Q",%ZIS("A")="Label Printing Device: ",%ZIS("B")=$P(PSJSYSL,"^",2) W ! D ^%ZIS K %ZIS I POP S IOP=PSGION D ^%ZIS K IOP S POP=1 W !?3,"(No device chosen for label print.)" Q
25 D EN2^PSGLBA S POP=0 Q:'$D(IO("Q"))
26 S ZTDESC="UD LABEL PRINT",PSGTIR=$S(PSGSS'="P":"EN"_PSGSS,1:"ENPLP")_"^PSGL" I PSGSS="G" F X="PSGLBLD","PSGLWG","PSGLWGN" S ZTSAVE(X)=""
27 I PSGSS="W" F X="PSGLBLD","PSGLWD","PSGLWDN" S ZTSAVE(X)=""
28 I PSGSS="P" F X="PSGP","PSGP(0)","PSJPAGE","PSJPDOB","PSJPDX","PSJPRB","PSJPSEX","PSJPSSN","PSJPWD","PSJPWDN","PSGODDD","PSGODDD(","VA(""PID"")","VA(""BID"")","^TMP(""PSJON"",$J," S ZTSAVE(X)=""
29 W ! D ENTSK^PSGTI W !,"Labels ",$S($D(ZTSK):"",1:"NOT "),"queued!"
30 Q
31 ;
32G ;
33 K DIC S DIC="^PS(57.5,",DIC(0)="QEAMIZ",DIC("A")="Select WARD GROUP: " W ! D ^DIC K DIC D Q
34 . I X="^OTHER" S (PSGLWG,PSGLWGN)="^OTHER",Y=1 Q
35 . I Y>0 S PSGLWG=+Y,PSGLWGN=Y(0,0)
36 ;
37W ;
38 K DIC S DIC="^DIC(42,",DIC(0)="QEAMIZ",DIC("A")="Select WARD: " W ! D ^DIC K DIC S:Y>0 PSGLWD=+Y,PSGLWDN=Y(0,0) Q
39 ;
40P ;
41 K PSJPR D ^PSJP S Y=PSGP Q
42 ;
43C ;
44 K DIR S DIR(0)="FAO",DIR("A")="Select CLINIC: "
45 S DIR("?")="^D CDIC^PSGVBW" W ! D ^DIR
46CDIC ;
47 K DIC S DIC="^SC(",DIC(0)="QEMIZ" D ^DIC K DIC S:+Y>0 CL=+Y
48 W:X["?" !!,"Enter the clinic you want to use to select patients for processing.",!
49 Q
50L ;
51 K DIR S DIR(0)="FAO",DIR("A")="Select CLINIC GROUP: "
52 S DIR("?")="^D LDIC^PSGVBW" W ! D ^DIR
53LDIC ;
54 K DIC S DIC="^PS(57.8,",DIC(0)="QEMI" D ^DIC K DIC S:+Y>0 CG=+Y
55 W:X["?" !!,"Enter the name of the clinic group you want to use to select patients for processing."
56 Q
57ENG ;
58 F PSGLWD=0:0 S PSGLWD=$O(^PS(57.5,"AC",PSGLWG,PSGLWD)) Q:'PSGLWD S PSGLWDN=$P($G(^DIC(42,PSGLWD,0)),"^") D ENW1
59 Q
60 ;
61ENW ;
62 S PSGLWG=$O(^PS(57.5,"AB",PSGLWD,0)),PSGLWGN="" I PSGLWG,$D(^PS(57.5,PSGLWG,0)),$P(^(0),"^")]"" S PSGLWG=$P(^(0),"^")
63 ;
64ENW1 ;
65 D NOW^%DTC S PSGDT=% U IO F PSGOP=0:0 S (DFN,PSGOP,PSGP)=$O(^DPT("CN",PSGLWDN,PSGOP)) Q:'PSGOP D IWP
66 Q
67IWP ;
68 N PSJFIRST,PSJACND S (PSJACND,PSJFIRST)=1 K PSJACNWP D ^PSJAC,ENPVSET^PSGLPI
69 F QSD=PSGLAD:0 S QSD=$O(^PS(55,PSGOP,5,"AUS",QSD)) Q:'QSD F ON=0:0 S ON=$O(^PS(55,PSGOP,5,"AUS",QSD,ON)) Q:'ON D
70 .I PSJFIRST,$P(PSJSYSW0,U,18) D ENHEDER^PSGLPI S PSJFIRST=0
71 .I $D(^PS(55,PSGOP,5,ON,7)),+^(7)'<PSGLBLD S PSGORD=ON_"A" D ^PSGLOI,KL
72 F ON=0:0 S ON=$O(^PS(53.1,"AC",PSGOP,ON)) Q:'ON D
73 .I PSJFIRST,$P(PSJSYSW0,U,18) D ENHEDER^PSGLPI S PSJFIRST=0
74 .I $D(^PS(53.1,ON,7)),+^(7)'<PSGLBLD S PSGORD=ON_"N" D ^PSGLOI,KL
75 Q
76 ;
77ENL S CL="" F S CL=$O(^PS(57.8,"AD",CG,CL)) Q:CL="" D ENC
78 Q
79ENC ;
80 K ^TMP("PSJCI",$J)
81 S STDTE=0 F S STDTE=$O(^PS(55,"AUDC",STDTE)) Q:'STDTE S CLINIC=0 F S CLINIC=$O(^PS(55,"AUDC",STDTE,CLINIC)) Q:'CLINIC D
82 . S JDFN=0 F S JDFN=$O(^PS(55,"AUDC",STDTE,CLINIC,JDFN)) Q:'JDFN S ^TMP("PSJCI",$J,JDFN)=""
83 S DFN="" F S DFN=$O(^TMP("PSJCI",$J,DFN)) Q:'DFN S (PSGOP,PSGP)=DFN D IWP
84 Q
85ENP ;
86 ;D ENL^PSJO3 Q:"^N"[PSJOL S PSJOS=$P(PSJSYSP0,"^",11),PSGLPF=1 D ^PSJO K PSGLPF Q:'PSJON S PSGLMT=PSJON
87 D ENL^PSJO3 Q:"^N"[PSJOL S PSJOS=$P(PSJSYSP0,"^",11) D ^PSJO K PSGLPF Q:'PSJON S PSGLMT=PSJON
88 F R !!,"Select orders for labels: ",X:DTIME W:'$T $C(7) S:'$T X="^" Q:"^"[X D Q:$D(X)
89 .I X?2."?" D H2^PSGON K X Q
90 .I X?1."?" W !!?2,"Select the orders for which you want labels printed." K X Q
91 .I X="A" D AADR^PSJUTL K X Q
92 .I X'?1."?" D ^PSGON W:'$D(X) $C(7)," ??" Q
93 I "^"[X K ^TMP("PSJON",$J) Q
94 D DEV I POP!$D(IO("Q")) K ^TMP("PSJON",$J) Q
95 ;
96ENPLP ;
97 D NOW^%DTC S PSGDT=+$E(%,1,12),(DFN,PSGOP)=PSGP D:$D(ZTSK) ^PSJAC D ENPVSET^PSGLPI U IO
98 N PSJFIRST S PSJFIRST=1 F PSGPL1=1:1:PSGODDD F PSGPL2=1:1 S PSGPL3=$P(PSGODDD(PSGPL1),",",PSGPL2) Q:'PSGPL3 S (PSGORD,PSJORD)=^TMP("PSJON",$J,PSGPL3) D
99 .I PSJFIRST,$P(PSJSYSW0,U,18) D ENHEDER^PSGLPI S PSJFIRST=0
100 .I PSGORD["V" D EN^PSIVUDL(DFN,PSGORD,PSGLWD_U_PSGLWDN,PSGLRB),KL Q
101 .I PSGORD'["P" D ^PSGLOI,KL Q
102 .S X=$P($G(^PS(53.1,+PSGORD,0)),"^",4) I X="F" D EN^PSIVUDL(DFN,PSGORD,PSGLWD_U_PSGLWDN,PSGLRB),KL Q
103 .D ^PSGLOI,KL
104 Q
105 ;
106DT ;
107 F K %DT S %DT="ET",%DT(0)="-NOW" R !!,"Enter label start date: ",X:DTIME D:X?1."?" DTM^PSGLH D ^%DT K %DT I Y>0!("^"[X) S PSGLBLD=Y,ZTSAVE("PSGLBLD")="" Q
108 W:Y'>0 $C(7),!?3,"(No date selected for label print.)" Q
109 ;
110KL ; kill other label records for the same order
111 S QS=$S(PSGORD["V":3,PSGORD["N":2,1:1) K ^PS(53.41,2,1,DUZ,1,PSGOP,1,QS,+PSGORD)
112 Q
Note: See TracBrowser for help on using the repository browser.