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

FHNO21.m

Go to the documentation of this file.
FHNO21 ; HISC/REL/NCA - Print Feeding Labels ;8/26/94  12:01 
 ;;5.5;DIETETICS;**5,8**;Jan 28, 2005;Build 28
 S DTP=DT\1 D DTP^FH S DTE=DTP_" "_TIM_$S(TIM=10:"AM",1:"PM")
 S S1=$S(LAB=1:6,1:9),S2=LAB=2*5+33
 K N F L=0:0 S L=$O(^FH(118,L)) Q:L<1  S Y=^(L,0),N1=$P(Y,"^",1),^TMP($J,"I",$E(N1,1,26)_","_L)=L I '$D(^FH(118,L,"I")) S N(L)=$P(Y,"^",1,2)
 S LNOD="" F  S LNOD=$O(^TMP($J,"L",LNOD)) Q:LNOD=""  D P2
 Q
P2 S PNOD="",N1=0 K C F  S PNOD=$O(^TMP($J,"L",LNOD,PNOD)) Q:PNOD=""  S Y2=^(PNOD) D P3
 ;I LAB<3 D P5 Q
 Q
P3 S N1=N1+1
 S FHDFN=$P(PNOD,"~",3),WRD=$P(Y2,"^",10)
 D PATNAME^FHOMUTL I FHPTNM="" Q
 S ALG="" D ALG^FHCLN
 S NAM=FHPTNM,IS=$P(Y2,"^",9)
 ;S NAM=$P(^DPT(DFN,0),"^",1),IS=$P(Y2,"^",9) D PID^FHDPA
 I LAB>2 D LL Q
 I $P(FHPAR,"^",4)="Y" G P4
 W !,$E(NAM,1,S2-$L(WRD)),?(S2+2-$L(WRD)),$E(WRD,3,99),!?$S(LAB=1:3,1:0),FHBID,$S(ALG="":"",1:" *ALG") W:IS'="" ?(S2-22),"*NURSE" W ?(S2-15),DTE S LN=2 I LAB=2 W !! S LN=4
 F L=1:2:7 S Z=$P(Y2,"^",L) I Z'="" D
 .S Q=$P(Y2,"^",L+1) S:'Q Q=1
 .W !,$J(Q,2)," "
 .W $S($D(N(Z)):$P(N(Z),"^",1),$D(^FH(118,+Z,0)):$P(^(0),"^",1),1:"")
 .S LN=LN+1 S:'$D(C(Z)) C(Z)=0 S C(Z)=C(Z)+Q
 .Q
 I LN<S1 F L=LN+1:1:S1 W !
 Q
P4 S ALG="" D ALG^FHCLN
 F L=1:2:7 S Z=$P(Y2,"^",L) I Z'="",$S($D(N(Z)):$P(N(Z),"^",2),$D(^FH(118,+Z,0)):$P(^(0),"^",2),1:"")'="N" D
 .S Q=$P(Y2,"^",L+1) S:'Q Q=1
 .W !,$E(NAM,1,S2-$L(WRD)),?(S2+2-$L(WRD)),$E(WRD,3,99),!,FHBID,$S(ALG="":"",1:" *ALG")
 .W:IS'="" ?11,"*NURSE"
 .W ?(S2-15),DTE,!!,$J(Q,2)," "
 .W $S($D(N(Z)):$P(N(Z),"^",1),$D(^FH(118,+Z,0)):$P(^(0),"^",1),1:""),!!
 .W:LAB=2 !!!
 .S:'$D(C(Z)) C(Z)=0 S C(Z)=C(Z)+Q
 .Q
 Q
P5 S Y=$S(XX="S":$P($G(^FH(119.74,D1,0)),"^",1),1:$P($G(^FH(119.6,W1,0)),"^",1))
 W !?3,"**** INGREDIENTS LIST ****",!!?(33-$L(Y)\2),Y,!?9,DTE,!! S LN=6
 S A1="" F K=0:0 S A1=$O(^TMP($J,"I",A1)) Q:A1=""  S L=^(A1) I $D(C(L)),C(L) W !,$S($D(N(L)):$P(N(L),"^",1),$D(^FH(118,+L,0)):$P(^(0),"^",1),1:""),?28,$J(C(L),5,0) S LN=LN+1
P6 W !!?4,"**** PATIENTS = ",N1," ****",! S LN=LN+3
 S LN=LN#S1 I LN F L=LN+1:1:S1 W !
 Q
LL ;
 D ALG^FHCLN
 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^FHLABE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