source: FOIAVistA/trunk/r/DIETETICS-FH/FHPRI1.m@ 1169

Last change on this file since 1169 was 628, checked in by George Lilly, 15 years ago

initial load of FOIAVistA 6/30/08 version

File size: 1.9 KB
Line 
1FHPRI1 ; HISC/REL - Find Recipes with Ingredient ;4/27/93 13:31
2 ;;5.5;DIETETICS;;Jan 28, 2005
3 S (DIC,DIE)="^FHING(",DIC(0)="AEQM" W ! D ^DIC K DIC G KIL:U[X!$D(DTOUT),FHPRI1:Y<1 S FHX1=+Y
4L0 W ! K IOP,%ZIS S %ZIS("A")="Select LIST Printer: ",%ZIS="MQ" D ^%ZIS K %ZIS,IOP G:POP KIL
5 I $D(IO("Q")) S FHPGM="Q1^FHPRI1",FHLST="FHX1" D EN2^FH G KIL
6 U IO D Q1 D ^%ZISC K %ZIS,IOP G KIL
7Q1 ; Print Recipes with selected Ingredient
8 K ^TMP($J) D NOW^%DTC S DTP=% D DTP^FH
9 F R1=0:0 S R1=$O(^FH(114,R1)) Q:R1<1 F I1=0:0 S I1=$O(^FH(114,R1,"I",I1)) Q:I1<1 S X=$G(^FH(114,R1,"I",I1,0)) I +X=FHX1 S ^TMP($J,"R",R1)=$P(X,"^",2)
10 F M1=0:0 S M1=$O(^FH(116.1,M1)) Q:M1<1 F I1=0:0 S I1=$O(^FH(116.1,M1,"RE",I1)) Q:I1<1 S R1=+$G(^FH(116.1,M1,"RE",I1,0)) I $D(^TMP($J,"R",R1)) S ^TMP($J,"R",R1,"M",M1)="" D Q2
11 S X2=^FHING(FHX1,0),N1=$P(X2,"^",1),UNT=$P(X2,"^",16)
12 S PG=0,LN="",$P(LN,"-",80)="" D HDR
13 F R1=0:0 S R1=$O(^TMP($J,"R",R1)) Q:R1<1 S Y=^(R1) D P0
14 W ! Q
15Q2 F C1=0:0 S C1=$O(^FH(116,C1)) Q:C1<1 F D1=0:0 S D1=$O(^FH(116,C1,"DA",D1)) Q:D1<1 D Q3
16 Q
17Q3 S X=$G(^FH(116,C1,"DA",D1,0)) Q:X=""
18 F K1=1:1:3 S Z=$P(X,"^",K1+1) I Z,$D(^TMP($J,"R",R1,"M",Z)) S ^TMP($J,"R",R1,"M",Z,"C",C1_"~"_D1_"~"_K1)=""
19 Q
20P0 D:$Y>(IOSL-6) HDR S R2=^FH(114,R1,0) D EN2^FHREC1
21 W !,$P(R2,"^",1),?32,$J($P(R2,"^",2),5),?45,Y
22 F M1=0:0 S M1=$O(^TMP($J,"R",R1,"M",M1)) Q:M1<1 S X=$P($G(^FH(116.1,M1,0)),"^",1) I X'="" D:$Y>(IOSL-6) HDR W !?3,"Meal: ",X D P1
23 Q
24P1 S A1="" F C1=0:0 S A1=$O(^TMP($J,"R",R1,"M",M1,"C",A1)) Q:A1="" D P2
25 Q
26P2 S C1=+A1,D1=$P(A1,"~",2),K1=$P(A1,"~",3) D:$Y>(IOSL-6) HDR
27 W !?6,"Cycle: ",$P(^FH(116,C1,0),"^",1),", Day ",D1,", ",$S(K1=1:"Breakfast",K1=2:"Noon",1:"Evening") Q
28HDR W:'($E(IOST,1,2)'="C-"&'PG) @IOF S PG=PG+1 W !,DTP,?24,"I N G R E D I E N T U S A G E",?73,"Page ",PG
29 W !!?(80-$L(N1)\2),N1
30 W !!,"Recipe",?30,"# Portions",?45,"Amount",!,LN Q
31KIL K ^TMP($J) G KILL^XUSCLEAN
Note: See TracBrowser for help on using the repository browser.