source: FOIAVistA/trunk/r/DIETETICS-FH/FHMTK1C.m@ 1800

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

initial load of FOIAVistA 6/30/08 version

File size: 4.6 KB
Line 
1FHMTK1C ; HISC/NCA/RVD - Print Tray Tickets ;4/13/95 13:45
2 ;;5.5;DIETETICS;;Jan 28, 2005
3PRT ; Print 3 person per page
4START I $G(TABREC)="YES" QUIT
5 S TL=0 D CHKH
6 W !! S TL=TL+2 F N1=1:1:3 D
7 .I 'MFLG S MEALDT=$S(MEAL="B":"Breakfast",MEAL="N":"Noon",1:"Evening")_" "_MDT
8 .E S MEALDT=$S(N1=1:"Breakfast",N1=2:"Noon",1:"Evening")_" "_MDT
9 .I '$D(MM(0,N1)) Q
10 .S MMMDT=$P(MM(0,N1),U,7) I MMMDT'="" S MEALDT=$S(MMMDT="B":"Breakfast",MMMDT="N":"Noon",1:"Evening")_" "_MDT
11 .S MEALDT=$J("",40-$L(MEALDT)\2)_MEALDT
12 .I $D(MM(0,N1)) W ?$S(N1=1:2,N1=2:45,1:88),MEALDT
13 .Q
14 W ! S TL=TL+1 F N1=1:1 Q:'$D(PP(N1)) W ! S TL=TL+1 F NBR=1:1:3 I $D(PP(N1,NBR)) W ?$S(NBR=1:2,NBR=2:45,1:88),PP(N1,NBR)
15 ;W ! S TL=TL+1 F N1=1:1 Q:'$D(PP(N1)) W ! S TL=TL+1
16 W ! S TL=TL+1
17 F N1=1:1 Q:'$D(MM(N1)) D:(TL+2)'<($S(FHBOT="Y":LN-5,1:LN-3)) NXT W !! S TL=TL+2 F NBR=1:1:3 I $D(MM(N1,NBR)) W ?$S(NBR=1:2,NBR=2:45,1:88),MM(N1,NBR)
18 I TL<LN F L1=TL:1:$S(FHBOT="Y":LN-2,1:LN) W !
19 I FHBOT="Y" D HEAD W @IOF Q
20 E D FOOT
21 W @IOF Q
22NXT ; Print Next Page
23 W !! S TL=TL+2 F NM=1:1:3 I $D(MM(0,NM)) W ?$S(NM=1:12,NM=2:57,1:100),"(More Items Next Pg)"
24 I TL<LN F L1=TL:1:$S(FHBOT="Y":LN-2,1:LN) W !
25 I FHBOT="Y" D HEAD W @IOF G N1
26 E D FOOT
27N1 W @IOF S TL=0 D CHKH
28 W !! S TL=TL+2 F XX=1:1:3 D
29 .I 'MFLG S MEALDT=$S(MEAL="B":"Breakfast",MEAL="N":"Noon",1:"Evening")_" "_MDT
30 .E S MEALDT=$S(XX=1:"Breakfast",XX=2:"Noon",1:"Evening")_" "_MDT
31 .I '$D(MM(0,XX)) Q
32 .S MMMDT=$P(MM(0,XX),U,7) I MMMDT'="" S MEALDT=$S(MMMDT="B":"Breakfast",MMMDT="N":"Noon",1:"Evening")_" "_MDT
33 .S MEALDT=$J("",40-$L(MEALDT)\2)_MEALDT
34 .I $D(MM(0,XX)) W ?$S(XX=1:2,XX=2:45,1:88),MEALDT," (Cont.)"
35 .W ! S TL=TL+1 Q
36 Q
37CHKH ; Check whether name header should be on bottom
38 I FHBOT="Y" W ! S TL=TL+1 D FOOT W ! S TL=TL+1 Q
39 E D HEAD
40 Q
41HEAD F NM=1:1:3 W ! S TL=TL+1 F NBR=1:1:3 S X=$P($G(MM(0,NBR)),"^",NM) I X'="" D
42 .S S1=$S(NBR=1:2,NBR=2:45,1:88) I NM=1 W ?S1,X Q
43 .W ?(S1+38-$L(X)),X Q
44 Q
45FOOT W ! S TL=TL+1 F NBR=1:1:3 S S1=$S(NBR=1:2,NBR=2:45,1:88) W:$D(MM(0,NBR)) ?S1,HD
46 Q
47LIST ; Print Tabulated Recipe List for Service Points
48 S PG=0 I 'MFLG D L1 Q
49 F MEAL="B","N","E" D L1
50 D:SUM SUM Q
51 Q
52L1 S:LS(MEAL)<80 LS(MEAL)=80 S MEALDT=$S(MEAL="B":"Breakfast",MEAL="N":"Noon",1:"Evening")_" "_MDT,PG=PG+1
53 W:$E(IOST,1,2)="C-" @IOF W !,HD,!!!?(LS(MEAL)-42\2),"T A B U L A T E D R E C I P E L I S T",?(LS(MEAL)-8),"Page ",PG
54 W !!?(LS(MEAL)-$L(MEALDT)\2),MEALDT,!!,$S(ALL:"ALL",FHP:$P($G(^FH(119.73,FHP,0)),"^",1),1:$P($G(^FH(119.6,+W1,0)),"^",1)),!
55 W !!,"R E C I P E S",?29
56 S X="" F S X=$O(DP(MEAL,X)) Q:X="" F K=0:0 S K=$O(DP(MEAL,X,K)) Q:K="" W $P(DP(MEAL,X,K),"^",1)
57 W " Total",!
58 S X8="" F S X8=$O(^TMP($J,"CTR",MEAL,X8)) Q:X8="" W !!,$P(X8,"~",3),?31 D PRO
59 S TOT=0 W !!!,"TOTAL RECIPES",?31 S X="" F S X=$O(DP(MEAL,X)) Q:X="" D
60 .F K=0:0 S K=$O(DP(MEAL,X,K)) Q:K<1 D
61 ..S Z=$G(P(MEAL,X,K)),TOT=TOT+Z
62 ..I 'Z W $J("",8)_" " Q
63 ..;W $S(Z#1>0:$J(Z,8,1),1:$J(Z,6)_" ")_" " Q
64 ..W $S(Z#1>0:$J(Z,8,2),1:$J(Z,8))_" " Q
65 .Q
66 ;W $S(TOT#1>0:$J(TOT,9,1),1:$J(TOT,7)) W:MFLG @IOF Q
67 W $S(TOT#1>0:$J(TOT,9,2),1:$J(TOT,9)) W:MFLG @IOF Q
68PRO S FTOT=0,X="" F S X=$O(DP(MEAL,X)) Q:X="" D
69 .F K=0:0 S K=$O(DP(MEAL,X,K)) Q:K<1 D
70 ..S Z=$G(^TMP($J,"CTR",MEAL,X8,K)),FTOT=FTOT+Z,P(MEAL,X,K)=P(MEAL,X,K)+Z
71 ..I 'Z W $J("",8)_" " Q
72 ..;W $S(Z#1>0:$J(Z,8,1),1:$J(Z,6)_" ")_" " Q
73 ..W $S(Z#1>0:$J(Z,8,2),1:$J(Z,8))_" " Q
74 .Q
75 ;W $S(FTOT#1>0:$J(FTOT,9,1),1:$J(FTOT,7)_" ")
76 W $S(FTOT#1>0:$J(FTOT,9,2),1:$J(FTOT,9)_" ")
77 Q
78SUM S:SL<80 SL=80 S MEALDT="All Meals "_MDT S PG=0 D HDR
79 S X8="" F S X8=$O(^TMP($J,"TOT",X8)) Q:X8="" D
80 .I $Y>LN W @IOF D HDR
81 .W !!,$P(X8,"~",3),?31 D PR1 Q
82 S TOT=0 W !!!,"TOTAL RECIPES",?31 S X="" F S X=$O(TP(X)) Q:X="" D
83 .F K=0:0 S K=$O(TP(X,K)) Q:K<1 D
84 ..S Z=$G(T1(X,K)),TOT=TOT+Z
85 ..I 'Z W $J("",8)_" " Q
86 ..;W $S(Z#1>0:$J(Z,8,1),1:$J(Z,6)_" ")_" " Q
87 ..W $S(Z#1>0:$J(Z,8,2),1:$J(Z,8))_" " Q
88 .Q
89 ;W $S(TOT#1>0:$J(TOT,9,1),1:$J(TOT,7)) Q
90 W $S(TOT#1>0:$J(TOT,9,2),1:$J(TOT,9)) Q
91PR1 S FTOT=0,X="" F S X=$O(TP(X)) Q:X="" D
92 .F K=0:0 S K=$O(TP(X,K)) Q:K<1 D
93 ..S Z=$G(^TMP($J,"TOT",X8,K)),FTOT=FTOT+Z,T1(X,K)=T1(X,K)+Z
94 ..I 'Z W $J("",8)_" " Q
95 ..;W $S(Z#1>0:$J(Z,8,1),1:$J(Z,6)_" ")_" " Q
96 ..W $S(Z#1>0:$J(Z,8,2),1:$J(Z,8))_" " Q
97 .Q
98 ;W $S(FTOT#1>0:$J(FTOT,9,1),1:$J(FTOT,7)_" ")
99 W $S(FTOT#1>0:$J(FTOT,9,2),1:$J(FTOT,9)_" ")
100 Q
101HDR ; Consolidated Recipe List Heading
102 S PG=PG+1 W !,HD,!!!?(SL-48\2),"C O N S O L I D A T E D R E C I P E L I S T",?(SL-8),"Page ",PG
103 W !!?(SL-$L(MEALDT)\2),MEALDT,!!,$S(ALL:"ALL",FHP:$P($G(^FH(119.73,FHP,0)),"^",1),1:$P($G(^FH(119.6,+W1,0)),"^",1)),!
104 W !!,"R E C I P E S",?29
105 S X="" F S X=$O(TP(X)) Q:X="" F K=0:0 S K=$O(TP(X,K)) Q:K="" W $P(TP(X,K),"^",1)
106 W " Total",! Q
Note: See TracBrowser for help on using the repository browser.