FHLABEL ; HISC/RTK - Laser label sheet build and display;9/27/02 9:25
;;5.5;DIETETICS;;Jan 28, 2005
LAB ;
S FHCOL=$S(LAB=3:3,1:2)
I LABSTART>1 F FHLABST=1:1:(LABSTART-1)*FHCOL D S LABSTART=1
.I LAB=3 S (PCL1,PCL2,PCL3,PCL4,PCL5,PCL6)="" D LL3^FHLABEL
.I LAB=4 S (PCL1,PCL2,PCL3,PCL4,PCL5,PCL6,PCL7,PCL8)="" D LL4^FHLABEL
.Q
S FHTAB=$S(LAB=3:24,1:37)
S BIDX1=BID_$E(" ",1,12-$L(BID))_X1,BXLN=$L(BIDX1)
S N1=$E(N1,1,FHTAB-$L(W1)),DTP=$E(DTP,1,9)
S FLG=0,(LS,LS2)="" I LAB>2 F D=1:1:5 D Q:FLG=1
.S P=$P(Y,", ",D) I P="" S FLG=1 Q
.S TL=$L(LS)+$L(P)+1,NUM=$S(LAB=3:26,1:38)
.I TL<NUM S LS=LS_P_","
.I TL>(NUM-1) S LS2=LS2_P_","
S LNA=N1_$J(W1,FHTAB+1-$L(N1)),LNB=BIDX1_$J(R1,FHTAB+1-$L(BIDX1))
S LNC=$S(LS2="":$E(LS,1,$L(LS)-1),1:LS)
S LND=$E(LS2,1,$L(LS2)-1)
I LAB=3 S PCL1="",PCL2=LNA,PCL3=LNB,PCL4=LNC,PCL5=$E(LND,1,25),PCL6=DTP D LL3 Q
I LAB=4 S (PCL1,PCL2,PCL8)="",PCL3=LNA,PCL4=LNB,PCL5=LNC,PCL6=$E(LND,1,38),PCL7=DTP D LL4 Q
Q
LL3 ;LASER LABEL PRINT - AVERY 5160
S COUNT=COUNT+1 I COUNT>1,COUNT#3=1 S LINE=LINE+6
S ^TMP($J,"DL3",LINE)=$G(^TMP($J,"DL3",LINE))_PCL1_U
S ^TMP($J,"DL3",LINE+1)=$G(^TMP($J,"DL3",LINE+1))_PCL2_U
S ^TMP($J,"DL3",LINE+2)=$G(^TMP($J,"DL3",LINE+2))_PCL3_U
S ^TMP($J,"DL3",LINE+3)=$G(^TMP($J,"DL3",LINE+3))_PCL4_U
S ^TMP($J,"DL3",LINE+4)=$G(^TMP($J,"DL3",LINE+4))_PCL5_U
S ^TMP($J,"DL3",LINE+5)=$G(^TMP($J,"DL3",LINE+5))_PCL6_U
Q
LL4 ;LASER LABEL PRINT - AVERY 5162
S COUNT=COUNT+1 I COUNT>1,COUNT#2=1 S LINE=LINE+8
S ^TMP($J,"DL4",LINE)=$G(^TMP($J,"DL4",LINE))_PCL1_U
S ^TMP($J,"DL4",LINE+1)=$G(^TMP($J,"DL4",LINE+1))_PCL2_U
S ^TMP($J,"DL4",LINE+2)=$G(^TMP($J,"DL4",LINE+2))_PCL3_U
S ^TMP($J,"DL4",LINE+3)=$G(^TMP($J,"DL4",LINE+3))_PCL4_U
S ^TMP($J,"DL4",LINE+4)=$G(^TMP($J,"DL4",LINE+4))_PCL5_U
S ^TMP($J,"DL4",LINE+5)=$G(^TMP($J,"DL4",LINE+5))_PCL6_U
S ^TMP($J,"DL4",LINE+6)=$G(^TMP($J,"DL4",LINE+6))_PCL7_U
S ^TMP($J,"DL4",LINE+7)=$G(^TMP($J,"DL4",LINE+7))_PCL8_U
Q
DPLL ;
I LAB=3 D DPLL3 Q
I LAB=4 D DPLL4 Q
Q
DPLL3 ;
S COUNT=0 W !! F FHLL=1:6 Q:'$D(^TMP($J,"DL3",FHLL)) D
.S COUNT=COUNT+1
.I COUNT=11 W @IOF,!! S COUNT=1
.S LINE1=^TMP($J,"DL3",FHLL),LINE2=^TMP($J,"DL3",FHLL+1)
.S LINE3=^TMP($J,"DL3",FHLL+2),LINE4=^TMP($J,"DL3",FHLL+3)
.S LINE5=^TMP($J,"DL3",FHLL+4),LINE6=^TMP($J,"DL3",FHLL+5)
.F L=LINE1,LINE2,LINE3,LINE4,LINE5,LINE6 D
..W !,$P(L,U,1),?27,$P(L,U,2),?55,$P(L,U,3)
Q
DPLL4 ;
S COUNT=0 W !!!! F FHLL=1:8 Q:'$D(^TMP($J,"DL4",FHLL)) D
.S COUNT=COUNT+1
.I COUNT=8 W @IOF,!!!! S COUNT=1
.S LINE1=^TMP($J,"DL4",FHLL),LINE2=^TMP($J,"DL4",FHLL+1)
.S LINE3=^TMP($J,"DL4",FHLL+2),LINE4=^TMP($J,"DL4",FHLL+3)
.S LINE5=^TMP($J,"DL4",FHLL+4),LINE6=^TMP($J,"DL4",FHLL+5)
.S LINE7=^TMP($J,"DL4",FHLL+6),LINE8=^TMP($J,"DL4",FHLL+7)
.F L=LINE1,LINE2,LINE3,LINE4,LINE5,LINE6,LINE7,LINE8 D
..W !,$P(L,U,1),?42,$P(L,U,2)
Q
FHLABEL ; HISC/RTK - Laser label sheet build and display;9/27/02 9:25
+1 ;;5.5;DIETETICS;;Jan 28, 2005
LAB ;
+1 SET FHCOL=$SELECT(LAB=3:3,1:2)
+2 IF LABSTART>1
FOR FHLABST=1:1:(LABSTART-1)*FHCOL
Begin DoDot:1
+3 IF LAB=3
SET (PCL1,PCL2,PCL3,PCL4,PCL5,PCL6)=""
DO LL3^FHLABEL
+4 IF LAB=4
SET (PCL1,PCL2,PCL3,PCL4,PCL5,PCL6,PCL7,PCL8)=""
DO LL4^FHLABEL
+5 QUIT
End DoDot:1
SET LABSTART=1
+6 SET FHTAB=$SELECT(LAB=3:24,1:37)
+7 SET BIDX1=BID_$EXTRACT(" ",1,12-$LENGTH(BID))_X1
SET BXLN=$LENGTH(BIDX1)
+8 SET N1=$EXTRACT(N1,1,FHTAB-$LENGTH(W1))
SET DTP=$EXTRACT(DTP,1,9)
+9 SET FLG=0
SET (LS,LS2)=""
IF LAB>2
FOR D=1:1:5
Begin DoDot:1
+10 SET P=$PIECE(Y,", ",D)
IF P=""
SET FLG=1
QUIT
+11 SET TL=$LENGTH(LS)+$LENGTH(P)+1
SET NUM=$SELECT(LAB=3:26,1:38)
+12 IF TL<NUM
SET LS=LS_P_","
+13 IF TL>(NUM-1)
SET LS2=LS2_P_","
End DoDot:1
IF FLG=1
QUIT
+14 SET LNA=N1_$JUSTIFY(W1,FHTAB+1-$LENGTH(N1))
SET LNB=BIDX1_$JUSTIFY(R1,FHTAB+1-$LENGTH(BIDX1))
+15 SET LNC=$SELECT(LS2="":$EXTRACT(LS,1,$LENGTH(LS)-1),1:LS)
+16 SET LND=$EXTRACT(LS2,1,$LENGTH(LS2)-1)
+17 IF LAB=3
SET PCL1=""
SET PCL2=LNA
SET PCL3=LNB
SET PCL4=LNC
SET PCL5=$EXTRACT(LND,1,25)
SET PCL6=DTP
DO LL3
QUIT
+18 IF LAB=4
SET (PCL1,PCL2,PCL8)=""
SET PCL3=LNA
SET PCL4=LNB
SET PCL5=LNC
SET PCL6=$EXTRACT(LND,1,38)
SET PCL7=DTP
DO LL4
QUIT
+19 QUIT
LL3 ;LASER LABEL PRINT - AVERY 5160
+1 SET COUNT=COUNT+1
IF COUNT>1
IF COUNT#3=1
SET LINE=LINE+6
+2 SET ^TMP($JOB,"DL3",LINE)=$GET(^TMP($JOB,"DL3",LINE))_PCL1_U
+3 SET ^TMP($JOB,"DL3",LINE+1)=$GET(^TMP($JOB,"DL3",LINE+1))_PCL2_U
+4 SET ^TMP($JOB,"DL3",LINE+2)=$GET(^TMP($JOB,"DL3",LINE+2))_PCL3_U
+5 SET ^TMP($JOB,"DL3",LINE+3)=$GET(^TMP($JOB,"DL3",LINE+3))_PCL4_U
+6 SET ^TMP($JOB,"DL3",LINE+4)=$GET(^TMP($JOB,"DL3",LINE+4))_PCL5_U
+7 SET ^TMP($JOB,"DL3",LINE+5)=$GET(^TMP($JOB,"DL3",LINE+5))_PCL6_U
+8 QUIT
LL4 ;LASER LABEL PRINT - AVERY 5162
+1 SET COUNT=COUNT+1
IF COUNT>1
IF COUNT#2=1
SET LINE=LINE+8
+2 SET ^TMP($JOB,"DL4",LINE)=$GET(^TMP($JOB,"DL4",LINE))_PCL1_U
+3 SET ^TMP($JOB,"DL4",LINE+1)=$GET(^TMP($JOB,"DL4",LINE+1))_PCL2_U
+4 SET ^TMP($JOB,"DL4",LINE+2)=$GET(^TMP($JOB,"DL4",LINE+2))_PCL3_U
+5 SET ^TMP($JOB,"DL4",LINE+3)=$GET(^TMP($JOB,"DL4",LINE+3))_PCL4_U
+6 SET ^TMP($JOB,"DL4",LINE+4)=$GET(^TMP($JOB,"DL4",LINE+4))_PCL5_U
+7 SET ^TMP($JOB,"DL4",LINE+5)=$GET(^TMP($JOB,"DL4",LINE+5))_PCL6_U
+8 SET ^TMP($JOB,"DL4",LINE+6)=$GET(^TMP($JOB,"DL4",LINE+6))_PCL7_U
+9 SET ^TMP($JOB,"DL4",LINE+7)=$GET(^TMP($JOB,"DL4",LINE+7))_PCL8_U
+10 QUIT
DPLL ;
+1 IF LAB=3
DO DPLL3
QUIT
+2 IF LAB=4
DO DPLL4
QUIT
+3 QUIT
DPLL3 ;
+1 SET COUNT=0
WRITE !!
FOR FHLL=1:6
IF '$DATA(^TMP($JOB,"DL3",FHLL))
QUIT
Begin DoDot:1
+2 SET COUNT=COUNT+1
+3 IF COUNT=11
WRITE @IOF,!!
SET COUNT=1
+4 SET LINE1=^TMP($JOB,"DL3",FHLL)
SET LINE2=^TMP($JOB,"DL3",FHLL+1)
+5 SET LINE3=^TMP($JOB,"DL3",FHLL+2)
SET LINE4=^TMP($JOB,"DL3",FHLL+3)
+6 SET LINE5=^TMP($JOB,"DL3",FHLL+4)
SET LINE6=^TMP($JOB,"DL3",FHLL+5)
+7 FOR L=LINE1,LINE2,LINE3,LINE4,LINE5,LINE6
Begin DoDot:2
+8 WRITE !,$PIECE(L,U,1),?27,$PIECE(L,U,2),?55,$PIECE(L,U,3)
End DoDot:2
End DoDot:1
+9 QUIT
DPLL4 ;
+1 SET COUNT=0
WRITE !!!!
FOR FHLL=1:8
IF '$DATA(^TMP($JOB,"DL4",FHLL))
QUIT
Begin DoDot:1
+2 SET COUNT=COUNT+1
+3 IF COUNT=8
WRITE @IOF,!!!!
SET COUNT=1
+4 SET LINE1=^TMP($JOB,"DL4",FHLL)
SET LINE2=^TMP($JOB,"DL4",FHLL+1)
+5 SET LINE3=^TMP($JOB,"DL4",FHLL+2)
SET LINE4=^TMP($JOB,"DL4",FHLL+3)
+6 SET LINE5=^TMP($JOB,"DL4",FHLL+4)
SET LINE6=^TMP($JOB,"DL4",FHLL+5)
+7 SET LINE7=^TMP($JOB,"DL4",FHLL+6)
SET LINE8=^TMP($JOB,"DL4",FHLL+7)
+8 FOR L=LINE1,LINE2,LINE3,LINE4,LINE5,LINE6,LINE7,LINE8
Begin DoDot:2
+9 WRITE !,$PIECE(L,U,1),?42,$PIECE(L,U,2)
End DoDot:2
End DoDot:1
+10 QUIT