source: FOIAVistA/trunk/r/DIETETICS-FH/FHNU11.m@ 1582

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

initial load of FOIAVistA 6/30/08 version

File size: 2.5 KB
Line 
1FHNU11 ; HISC/REL - Recipe Analysis ;3/10/95 12:17
2 ;;5.5;DIETETICS;;Jan 28, 2005
3T0 R !!,"Title of Recipe: ",TIT:DTIME G:'$T!("^"[TIT) KIL I TIT'?.ANP W *7," ??" G T0
4 I $L(TIT)>60!($L(TIT)<3)!(TIT?1P.E) W *7,!,"Answer must be 3-60 characters in length" G T0
5T1 R !!,"Number of Portions: ",POR:DTIME G:'$T!(POR["^") KIL I +POR'=POR!(POR<1)!(POR>1000) W *7,"Enter number from 1 to 1000" G T1
6D0 R !!,"Do you wish to use common units rather than grams? YES// ",YN:DTIME G:'$T!(YN["^") KIL S:YN="" YN="Y" S X=YN D TR^FH S YN=X
7 I $P("YES",YN,1)'="",$P("NO",YN,1)'="" W *7,!," Answer YES or NO" G D0
8 S TYP=$S(YN?1"N".E:"G",1:"C") S:TYP="G" UNIT="gm."
9 W !!!,"We will now build the ingredient list." K FHM
10D1 D ^FHNU7 I FFN'="" G D1
11D2 D LI
12D3 R !!,"Do you wish to edit this list? NO// ",YN:DTIME G:'$T!(YN["^") KIL S:YN="" YN="N" 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
13 G ED:YN?1"Y".E,KIL:'NM D ^FHNU12
14D4 R !,"Do you wish to analyze another Recipe? NO// ",YN:DTIME G:'$T!("^"[YN) KIL S:YN="" YN="N" S X=YN D TR^FH S YN=X G KIL:$P("NO",YN,1)="",T0:$P("YES",YN,1)="" W *7," Answer YES or NO" G D4
15KIL G KILL^XUSCLEAN
16LI W @IOF,!!,"Here is your final ingredient list:",! S NX=0,XT="",NM=0
17L1 S NX=$O(FHM(NX)) I NX="" W:'NM !?5,"No ingredients selected." Q
18 S XT=XT_NX_",",NM=NM+1,X=FHM(NX),AMT=+X S:TYP="C" UNIT=$P(X,",",2),WT=$P(X,",",3)
19 W !,$J(NM,4,0)," ",$P(^FHNU(NX,0),"^",1)," ",AMT," ",UNIT G L1
20ED G:'NM E4 R !!,"Do you wish to change any amounts? NO// ",YN:DTIME G:'$T!(YN["^") KIL S:YN="" YN="N" 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 ED
21 G:YN?1"N".E E2
22E1 R !,"Change item # : ",X:DTIME G KIL:'$T,E2:X="",ED:X["^" I X'?1N.N!(X<1)!(X>NM) W *7," Enter an item #." G E1
23 S X=$P(XT,",",X) I TYP="C" S UNIT=$P(FHM(X),",",2),WT=$P(FHM(X),",",3)
24 W " from ",(+FHM(X))," ",UNIT," to: " R Y:DTIME G KIL:'$T,E1:Y["^" I Y'?.N.1".".N!(Y'>0)!(Y>99999) W *7," Enter a number from 1 to 99999." G E1
25 W " ",UNIT S $P(FHM(X),",",1)=+Y G E1
26E2 R !!,"Do you wish to delete any items? NO// ",YN:DTIME G:'$T!(YN["^") KIL S:YN="" YN="N" 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 E2
27 G:YN?1"N".E E4
28E3 R !,"Delete item # : ",X:DTIME G KIL:'$T,E4:X="",ED:X["^" I X'?1N.N!(X<1)!(X>NM) W *7," Enter an item #." G E3
29 S X=$P(XT,",",X) K FHM(X) W " ... deleted" G E3
30E4 R !!,"Do you wish to add more ingredients? NO// ",YN:DTIME G:'$T!(YN["^") KIL S:YN="" YN="N" 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 E4
31 G D1:YN?1"Y".E,D3
Note: See TracBrowser for help on using the repository browser.