source: FOIAVistA/trunk/r/DIETETICS-FH/FHREC2.m@ 1416

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

initial load of FOIAVistA 6/30/08 version

File size: 2.3 KB
Line 
1FHREC2 ; HISC/REL - Adjust Recipe ;4/28/95 09:45
2 ;;5.5;DIETETICS;;Jan 28, 2005
3EN1 ; Adjust Recipe - R1 = Recipe File No., S1 = No. Portions
4 S R0=^FH(114,R1,0),P1=$P(R0,"^",2) Q:P1<1!(S1<1)
5 D DISP D LN S N=0,MUL=S1/P1 W !
6N1 S N=$O(^FH(114,R1,"I",N)) G:N<1 N2 S X=^(N,0),I2=+$P(X,"^",1),Y=$P(X,"^",2)*MUL
7 S Y(0)=$G(^FHING(I2,0)),UNT=$P(Y(0),"^",16) D EN2^FHREC1
8 W !!,$P(Y(0),"^",1),?60,Y G N1
9N2 F K=0:0 S K=$O(^FH(114,R1,"R",K)) Q:K<1 S Y(0)=^(K,0) I +Y(0) W !!,"*",$P(^FH(114,+Y(0),0),"^",1),?60,$J(MUL*$P(Y(0),"^",2),0,0)," Portions"
10 D LN W ! F K=0:0 S K=$O(^FH(114,R1,"X",K)) Q:K<1 W !,^(K,0)
11 D LN W ! Q:$G(^FH(114,R1,"DBX",0))=""
12 S P="" W !,"Diabetic Exchange: "
13 F K=0:0 S K=$O(^FH(114,R1,"DBX",K)) Q:K<1 S Z=^(K,0) S:P'="" P=P_", " S Z1=$S($P(Z,"^",2):$P(Z,"^",2),1:1)_" "_$P($G(^FH(114.1,+Z,0)),"^",1) D:$L(P)+$L(Z1)'<60 EX S P=P_Z1
14 W:P'="" ?19,P,!
15 D LN W ! Q
16EX W ?19,P S P="" W !
17 Q
18DISP W:PG @IOF W !?25,"A D J U S T E D R E C I P E",?71,$E(DTP,1,9)
19 S N=$P(R0,"^",1) W !!?(80-$L(N)\2),N
20 W !!,"Portion Size: ",$P(R0,"^",3),?40,"No. Portions: ",S1
21 W !,"Prep. Time: ",$P(R0,"^",4),?40,"Srv. Utensil: " S Z=$P(R0,"^",6) I Z W $P(^FH(114.3,Z,0),"^",1)
22 W !,"Equipment: " S N=$O(^FH(114,R1,"E",0)) I N>0 S Z=^(N,0) W $P(^FH(114.4,Z,0),"^",1)
23 W ?40,"Category: " S Z=$P(R0,"^",7) I Z W $P(^FH(114.1,Z,0),"^",1)
24 I N>0 F N=N:0 S N=$O(^FH(114,R1,"E",N)) Q:N<1 S Z=^(N,0) W !?14,$P(^FH(114.4,Z,0),"^",1)
25 Q
26LN W !!,"- - - - - - - - - - - - - - - - - - - - - - - - - - -" Q
27EN2 ; Print adjusted recipe
28 S X="T",%DT="X" D ^%DT K %DT S DTP=Y D DTP^FH
29 K DIC S DIC="^FH(114,",DIC(0)="AEQM" W ! D ^DIC K DIC G KIL:"^"[X!$D(DTOUT),EN2:Y<1 S R1=+Y
30R0 R !!,"Number of Portions: ",S1:DTIME G KIL:'$T!("^"[S1) I +S1'=S1!(S1<1)!(S1>5000) W *7," Enter a number from 1 to 5000" G R0
31 W ! K IOP,%ZIS S %ZIS("A")="Select Printer: ",%ZIS="MQ" D ^%ZIS K %ZIS,IOP G:POP KIL
32 I $D(IO("Q")) S FHPGM="R1^FHREC2",FHLST="R1^S1^DTP" D EN2^FH G EN2
33 U IO D R1 D ^%ZISC K %ZIS,IOP G EN2
34R1 ; Entry Point to Print adjusted recipe
35 K R F K1=0:0 S K1=$O(^FH(114,R1,"R",K1)) Q:K1<1 S Y=^(K1,0) D R2
36 S PG=0 D EN1 S PG=1
37 F R1=0:0 S R1=$O(R(R1)) Q:R1="" S S1=R(R1) D EN1
38 Q
39R2 S MUL=$P(^FH(114,R1,0),"^",2) Q:'MUL S MUL=S1/MUL
40 S P1=$P(Y,"^",2)*MUL S:'$D(R(+Y)) R(+Y)=0 S R(+Y)=R(+Y)+P1 Q
41KIL G KILL^XUSCLEAN
Note: See TracBrowser for help on using the repository browser.