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

ADEPLBL.m

Go to the documentation of this file.
ADEPLBL ; IHS/HQT/MJL  - PRINT MAILING LABELS FROM SORT TEMPLATE ;07:21 PM  [ 03/24/1999   9:04 AM ]
 ;;6.0;ADE;;APRIL 1999
TEMP ;EP
 ;------->ENTER HERE TO SELECT SEARCH TEMPLATE
 K DUOUT,DTOUT,POP D TEMPL G:Y<1 END G START
FILE ;EP
 ;------->ENTER HERE TO SELECT SPECIFIC PATIENT NAMES
 D ^ADEPLBL1 I $D(DUOUT)!($D(DTOUT)) G END
START ;------->GET POINTER FILE INFO
 D POINT
 ;------->GET LABEL SIZE
 D SIZE
 I $D(DUOUT)!($D(DTOUT)) G END
 ;------->TEST LABEL
 D TLAB
 I $D(POP),POP G END
 I $D(DUOUT)!($D(DTOUT)) G END
 ;------->SELECT DEVICE
 D DEV
 G:POP END
 I $D(IO("Q")) K IO("Q") G END
 I $D(DUOUT)!($D(DTOUT)) G END
ZTM ;EP
 ;------->PRINT LABELS (TASKMAN ENTRY)
 D PRINT
 ;------->END
END K ADEAD1,ADEAD2,ADECNT,ADEDFN,ADEDIC,ADEFLD,ADEFN,ADEGL,ADEIOP,ADEJ,ADENAM,ADEPN,ADESIZ,ADETEM,ADEX,ADEY,^ADEUTL("ADEPLBL",$J)
 ;^ADEUTL("ADEPLBL", is a transient working global
 K ADELKPRN,ADELKDAT,Y,DIC,DIR,DR,DUOUT,DTOUT,ADELKERR
 D ^%ZISC
 I $D(ZTQUEUED) S ZTREQ="@"
 Q
 ;
SIZE S:$D(^ADEUTL("ADEPLBL","SIZE")) ADESIZ=^ADEUTL("ADEPLBL","SIZE")
 S:'$D(ADESIZ) ADESIZ=9
 S DIR(0)="NA^4:20:0"
 S DIR("A")="Enter Number of Lines on Blank Mailing Label: "
 S DIR("B")=ADESIZ
 S DIR("?")="Enter the size (in horizontal lines) of the mailing label"
 D ^DIR
 I $D(DTOUT)!($D(DUOUT)) Q
 S ADESIZ=X
 S ^ADEUTL("ADEPLBL","SIZE")=ADESIZ ;^ADEUTL("ADEPLBL" is transient
 Q
TEMPL K Y,DIC S DIC="^DIBT(",DIC(0)="AEQZ"
 S DIC("S")="D SCRN^ADEPLBL"
 D ^DIC
 Q:Y<1
 S ADETEM=+Y,ADEFN=$P(Y(0),U,4)
 Q
POINT I ADEFN=9000001 S ADEFLD=".01",ADEPN="0;1",ADEGL="^AUPNPAT(" Q
 S ADEFLD=$O(^DD(9000001,0,"PT",ADEFN,0))
 S ADEPN=$P(^DD(ADEFN,ADEFLD,0),U,4)
 S ADEGL=^DIC(ADEFN,0,"GL")
 Q
DEV K POP
 W !!,"Ready to print mailing labels for patient names stored in the "
 W !,$P(^DIBT(ADETEM,0),U)," Search Template"
 I $D(^DD(ADEFN,0,"NM")),$O(^DD(ADEFN,0,"NM",0))]"" W " of the ",$O(^DD(ADEFN,0,"NM",0))," File.",!
 E  W ".",!
 W "Make sure labels are lined up on printer.",!
 S %ZIS="PQ" D ^%ZIS
 I $D(DUOUT)!($D(DTOUT)) W !,?5,"--Try Later" Q
 I $D(IO("Q"))&(($D(IO("S")))!($E(IOST)'="P")) W *7,!,"Please queue to system printers." K IO("Q") D ^%ZISC G DEV
 I $D(IO("Q")) D QUE
 Q
QUE X ^%ZOSF("UCI") S ZTRTN="ZTM^ADEPLBL",ZTUCI=Y,ZTDESC="Print Mailing Labels"
 F ADEX="ADETEM","ADEFLD","ADEPN","ADEGL","ADESIZ" S ZTSAVE(ADEX)=""
 D ^%ZTLOAD
 K ZTDESC,ZTRTN,ZTSAVE,ZTSK,ZTUCI
 Q
PRINT U IO
 K ^ADEUTL("ADEPLBL",$J)
 S ADEX=0
 F ADEY=0:0 S ADEX=$O(^DIBT(ADETEM,1,ADEX)) Q:'+ADEX  D P2
 Q
P2 S ADEDFN=ADEGL_ADEX_","_+ADEPN_")"
 S ADEDFN=$P(@ADEDFN,U,$P(ADEPN,";",2))
 Q:'$D(^DPT(ADEDFN,0))
 Q:$D(^ADEUTL("ADEPLBL",$J,ADEDFN))
 S ^ADEUTL("ADEPLBL",$J,ADEDFN)=""
 S (ADENAM,ADEAD1,ADEAD2)=""
 S DA=ADEDFN,DIC=2
 S DR=.01 K ADELKPRN D ^ADEDCLK S:$D(ADELKPRN) ADENAM=$P(ADELKPRN,",",2)_" "_$P(ADELKPRN,",") ;IHS/HMW **2**
 S DR=.111 K ADELKPRN D ^ADEDCLK S:$D(ADELKPRN) ADEAD1=ADELKPRN
 S DR=.114 K ADELKPRN D ^ADEDCLK S:$D(ADELKPRN) ADEAD2=ADELKPRN
 S DR=.115 K ADELKDAT D ^ADEDCLK I $D(ADELKDAT),ADELKDAT]"" S ADEAD2=ADEAD2_", "_$P(^DIC(5,ADELKDAT,0),U,2) ;IHS/HMW **2**
 S DR=.116 K ADELKPRN D ^ADEDCLK S:$D(ADELKPRN) ADEAD2=ADEAD2_"  "_ADELKPRN
 W ADENAM,!,ADEAD1,!,ADEAD2,!
 F ADEJ=4:1:ADESIZ W ! ;W "LINE ",ADEJ,":",!
 Q
SCRN ;EP
 ;SCREEN FOR USER SEARCH TEMPLATES ON FILES WITH POINTER TO PATIENT FILE
 I $P(^DIBT(Y,0),U,4)]"" S ADEFN=$P(^DIBT(Y,0),U,4)
 E  Q
 I $P(^DIBT(Y,0),U,5)=DUZ
 E  Q
 I $D(^DIBT(Y,1))
 E  Q
 I ADEFN=9000001!($D(^DD(9000001,0,"PT",ADEFN)))
 Q
TLAB K DUOUT,DTOUT
 W !!,"Do you want to print a test label"
TL1 S %=1 D YN^DICN
 G:%=1 TL2
 I %Y["?" W !?5,"Answer Yes or No" G TLAB
 I %Y[U S DUOUT=1
 Q
TL2 W !,"Line up labels on printer and select Device",!
 K POP S %ZIS="P" D ^%ZIS Q:POP  Q:$D(DUOUT)!($D(DTOUT))
 U IO
 W "LINE 1: NAME",!,"LINE 2: STREET ADDRESS",!,"LINE 3: CITY, STATE  ZIP",!
 F ADEJ=4:1:ADESIZ W "LINE ",ADEJ,":",!
 D ^%ZISC ;equivalent of a CR here
TL3 W !!,"Print another test label"
 S %=1 D YN^DICN
 I %=1 D SIZE Q:$D(DUOUT)!($D(DTOUT))  G TL2
 I %Y["?" W !?5,"Answer Yes or NO" G TL3
 I %Y[U S DUOUT=1 Q
 Q