source: WorldVistAEHR/trunk/r/DIETETICS-FH/FHNU12.m@ 738

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

initial load of WorldVistAEHR

File size: 2.0 KB
Line 
1FHNU12 ; HISC/REL - Recipe Analysis Output ;2/23/00 12:36
2 ;;5.5;DIETETICS;;Jan 28, 2005
3 K A,B F K=1:1:66 S A(K)=0,B(K)=0
4 S NX=0,SUM=0
5D1 S NX=$O(FHM(NX)) I NX="" G D2
6 S AMT=+FHM(NX) I TYP="C" S WT=$P(FHM(NX),",",3),AMT=AMT*WT
7 S SUM=SUM+AMT
8 S AMT=AMT/100,Y=$G(^FHNU(NX,1)) F K=1:1:20 S Z1=$P(Y,"^",K) I Z1'="" S A(K)=Z1*AMT+A(K),B(K)=B(K)+1
9 S Y=$G(^FHNU(NX,2)) F K=21:1:38 S Z1=$P(Y,"^",K-20) I Z1'="" S A(K)=Z1*AMT+A(K),B(K)=B(K)+1
10 S Y=$G(^FHNU(NX,3)) F K=39:1:56 S Z1=$P(Y,"^",K-38) I Z1'="" S A(K)=Z1*AMT+A(K),B(K)=B(K)+1
11 S Y=$G(^FHNU(NX,4)) F K=57:1:66 S Z1=$P(Y,"^",K-56) I Z1'="" S A(K)=Z1*AMT+A(K),B(K)=B(K)+1
12 G D1
13D2 Q:'SUM S PW=+$J(SUM/POR,0,2),SUM=SUM/100,ANS="" F K=1:1:66 S:B(K) A(K)=A(K)/SUM,A(K)=+$J(A(K),0,3)
14 W @IOF,!?23,"--- Analysis of Recipe Portion ---",!!?(80-$L(TIT)\2),TIT,!
15 S SUM=PW/100 F K=1:1:34 S Y=$T(COM+K^FHNU6),Z1=$P(Y,";",3) D LST
16 D PSE Q:ANS="^" F K=35:1:70 S Y=$T(COM+K^FHNU6),Z1=$P(Y,";",3) D LST
17 W !!,"Grams/Portion: ",PW
18D3 R !!,"Do you wish to STORE this recipe in FOOD NUTRIENT File? ",YN:DTIME G FIN:'$T!("^"[YN) S X=YN D TR^FH S YN=X I $P("YES",YN,1)'="",$P("NO",YN,1)'="" W *7," Answer YES or NO" G D3
19 G FIN:YN?1"N".E
20 K DIC,DD,DO,DINUM S (DIC,DIE)="^FHNU(",DIC(0)="L",DLAYGO=112,X=TIT D FILE^DICN K DIC,DLAYGO G:Y<1 FIN
21 S DA=+Y,DR=".01;2//^S X=""svg."";3//^S X=PW;4;4.2;S:X="""" Y=98;4.4;98;99" W ! S:$D(^XUSEC("FHMGR",DUZ)) DIDEL=112 D ^DIE K DIE,DIDEL,DR G:'$D(DA) FIN
22 S (Z1,Z2,Z3,Z4)="" F K=1:1:20 S:B(K) $P(Z1,"^",K)=A(K)
23 F K=21:1:38 S:B(K) $P(Z2,"^",K-20)=A(K)
24 F K=39:1:56 S:B(K) $P(Z3,"^",K-38)=A(K)
25 F K=57:1:66 S:B(K) $P(Z4,"^",K-56)=A(K)
26 S ^FHNU(DA,1)=Z1,^(2)=Z2 S:Z3'="" ^FHNU(DA,3)=Z3 S:Z4'="" ^FHNU(DA,4)=Z4
27FIN W ! K DA,A,B,T1,Z1,Z2,Z3,Z4 Q
28LST W:K#2 ! Q:'Z1 S T1=$S(K#2:0,1:42)
29 W ?T1,$P(Y,";",4)," (",B(Z1),")" I B(Z1) W ?(T1+21),$J(A(Z1)*SUM,7,$P(Y,";",6))," ",$P(Y,";",5)
30 Q
31PSE I IOST?1"C-".E R !!,"Press RETURN to Continue ",X:DTIME W ! S:'$T!(X["^") ANS="^" Q:ANS="^" I "^"'[X W !,"Enter a RETURN to Continue." G PSE
32 Q
Note: See TracBrowser for help on using the repository browser.