VistA-WorldVistAEHR/r/VOLUNTARY_TIMEKEEPING-ABSV/ABSVLBL.m

87 lines
3.3 KiB
Mathematica
Raw Permalink Normal View History

2009-11-29 13:37:14 -05:00
ABSVLBL ;VAMC ALTOONA/CTB - GENERIC LABEL PRINTING ROUTINE ;1/12/01 8:05 PM
V ;;4.0;VOLUNTARY SERVICE;**4,7,10,12,13,18,23**;JULY 6, 1994
;GIVEN LIST OF RECORDS IN ^TMP($J,"VLABEL",N)=DA
;PRINT MULTI COLUMN LABEL
;NLABEL=NUMBER OF LABELS/ROW
;NLINES=NUMBER OF LINES/LABEL
;NPAGE=NUMBER OF LABELS/PAGE
;LOFFSET=LEFT OFFSET
;DIC=GLOBAL REFERENCE OF FILE
;DR=FIELD NUMBERS TO BE INCLUDED IN LABEL
;BLANKS=NUMBER OF BLANK LABELS
GENERIC D BEGIN(0) QUIT
MINUTES D BEGIN(20) QUIT
CERT D BEGIN(21) QUIT
NATREP D BEGIN(22) QUIT
AJR D BEGIN(23) QUIT
ALL D BEGIN(24) QUIT
AFFIL D BEGIN(25) QUIT
DIRECT D BEGIN(30) QUIT
QUIT
BEGIN(TYPE) K ^TMP($J,"VLABEL")
N COL,COLL,COUNT,ABSVX,BLANKS,B,DIJ,DIC,DIPASS,DISYS,DP,IOP,NODE,P,POP,OUT,X,ABSVTERM,PRT,LASER,LABELDIC,LABELDR,LOFFSET,NCOL,NEXT,NLABEL,NLINES,NNPAGE,NPAGE,NSETS,PARAMS,TOFFSET1,TOFFSET2,Y
S ABSVTERM=IO
D ^ABSVSITE Q:'%
I TYPE=0 S TYPE=$$VOL^ABSVLBL3 Q:'TYPE
I TYPE=30 S TYPE=$$DIR^ABSVLBL3 Q:'TYPE
S DIC=503338.1,DIC(0)="AQEMNZ",DIC("A")="Select Label Type: " D ^DIC
I Y<0 S X=" Cannot proceed without type of label. Option terminated." D MSG^ABSVQ QUIT
K DIC
S PARAMS=Y(0),LASER=$P(PARAMS,"^",9)
D @(TYPE_"^ABSVLBL3") Q:'$D(BY)
S $P(PARAMS,"^",10)=0
S DIR(0)="NA^1:90:0",DIR("A")="Select the number of labels/individual: ",DIR("B")=1,DIR("?")="Enter the number of labels per set."
D ^DIR K DIR
I Y["^" QUIT
S $P(PARAMS,"^",11)=+Y
I Y>1 D I $G(OUT) K OUT QUIT
. S DIR(0)="SO^1:COLLATED;2:UNCOLLATED"
. S DIR("A")="Collated/Uncollated",DIR("B")="COLLATED",DIR("?")="^D SETOFCDS^ABSVU2" D ^DIR
. K DIR
. I $$DIR^ABSVU2 S OUT=1 QUIT
. S $P(PARAMS,"^",12)=+Y
. QUIT
S X=($P(PARAMS,"^",2)*$P(PARAMS,"^",3))-1
S:X<0 X=0
I $P(PARAMS,"^",2)>1 D
. S DIR(0)="NA^0:"_X_":0",DIR("A")="Skip used labels of first page: ",DIR("B")=0,DIR("?")="Enter the number of labels on the first page that have already been used."
. D ^DIR K DIR
. Q:Y["^" S $P(PARAMS,"^",10)=Y
. QUIT
S %ZIS("A")="Please Select Label Device: ",%ZIS="QD" D ^%ZIS I POP D HOME^%ZIS QUIT
I 'LASER D ALIGN I '% S IOP=ION D ^%ZISC
I $D(IO("Q")) D I '$D(DQTIME) S X=" <Option Terminated>*" D MSG^ABSVQ QUIT
. K DQTIME
. S %DT="AER",%DT("A")="Select Date/Time to Print: ",%DT("B")="NOW"
. D ^%DT
. Q:Y<0
. X ^DD("DD")
. S DQTIME=Y
. QUIT
S IOP=$S($D(IO("Q")):"Q;",1:"")_ION D ^%ZISC
DQ I '$D(FLDS) S FLDS=""
S DHIT="S COUNT=$G(COUNT)+1,^TMP($J,""VLABEL"",COUNT)=D0",DHD="@@"
S DIOBEG="W ! K ^TMP($J,""VLABEL""),^TMP($J,""XVLABEL"")",DIOEND="D LABEL^ABSVLBL2(LABELDIC,LABELDR,PARAMS)"
D EN1^DIP
D ^%ZISC
QUIT
ALIGN ;align labels in the printer
NEW ABSVXA,ABSVXB,LX
A1 S ABSVXA="DO YOU NEED TO CHECK THE ALIGNMENT OF THE LABELS IN THE PRINTER",ABSVXB="",%=2
U ABSVTERM D Q:%'=1
. D ^ABSVYN
. I %<1 S X=" <Option Terminated>*" D MSG^ABSVQ S %=0 QUIT
. I %=2 QUIT
U ABSVTERM W !!,"Please load the labels and align."
U ABSVTERM D ENCON^ABSVQ
I $D(IO("Q")) S IOP=ION_";"_IOST_";"_IOM_";"_IOSL,ZTRTN="DQALIGN^ABSVLBL",ZTDTH=$H D ^%ZTLOAD I 1 K IOP
E U IO(0) D DQALIGN
U ABSVTERM S ABSVXA="ARE LABELS ALIGNED CORRECTLY",ABSVXB="",%=2 D ^ABSVYN
I %<0 S IOP=ION U IO(0) W @IOF QUIT
I %=2 G A1
QUIT
DQALIGN S X="",$P(X,"X",36)="" U IO W !,X,!,X,!,X,!,X,!!
QUIT
AWARD S DIC="^ABS(503330,",L=0,FR="?",TO="?",(BY,FLDS)="[ABSV POTENTIAL AWARD LIST]" D EN1^DIP
QUIT