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

FHLABEL.m

Go to the documentation of this file.
FHLABEL ; HISC/RTK - Laser label sheet build and display;9/27/02  9:25
 ;;5.5;DIETETICS;**34**;Jan 28, 2005;Build 2
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 BIDALG=BID_$S(ALG="":"",1:" *ALG")
 S BIDX1=BIDALG_$E("          ",1,12-$L(BIDALG))_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