source: WorldVistAEHR/trunk/r/DIETETICS-FH/FHADR1.m@ 701

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

initial load of WorldVistAEHR

File size: 3.4 KB
Line 
1FHADR1 ; HISC/NCA - Dietetic Facility Profile ;1/23/98 15:03
2 ;;5.5;DIETETICS;;Jan 28, 2005
3EN1 ; Enter/Edit Facility Data and Specialized Medical Programs
4 S (FLG1,FLG2)=0 D YR G:'PRE KIL
5 D GET G:Y<1 KIL S FHX1=+Y
6 S ST=$G(^DIC(4,+FHX1,0)) Q:ST=""
7 S X1=PRE,X2=-356 D C^%DTC S OLD=$E(X,1,4)_"400" I '$D(^FH(117.3,PRE,0)) D S1
8E1 W ! K DIR S DIR(0)="YAO",DIR("A")="Enter/Edit Facility Data? " D ^DIR G:$D(DIRUT)!($D(DIROUT)) KIL
9 I 'Y K Y G E2
10 S FLG1=1 D:FLG1 EDIT S FLG1=0
11E2 W ! K DIR S DIR(0)="YAO",DIR("A")="Enter/Edit Specialized Medical Programs? "
12 D ^DIR I $D(DIRUT)!($D(DIROUT)) G KIL
13 I 'Y K Y S OLD=PRE D SET G KIL
14 S FLG2=1 D:FLG2 EDIT
15 S OLD=PRE D SET
16KIL G KILL^XUSCLEAN
17EDIT ; Edit the Fields
18 K DIC,DIE W ! S DIE="^FH(117.3,",DA=PRE
19 L +^FH(117.3,PRE,0):0 I '$T W !?5,"Another user is editing this entry." G KIL
20 I '$D(^FH(117.3,PRE,0)) D
21 .S $P(^FH(117.3,PRE,0),"^",1)=PRE,^FH(117.3,"B",PRE,PRE)=""
22 .S Z=$G(^FH(117.3,0)),$P(^FH(117.3,0),"^",3,4)=PRE_"^"_($P(Z,"^",4)+1)
23 .S ZZ=$P($G(^FH(117.3,OLD,0)),"^",2,13)
24 .I ZZ="" S $P(ZZ,"^",2,3)=$P(ST,"^",7)_"^"_$P($G(^DIC(4,+FHX1,"DIV")),"^",1)
25 .S $P(^FH(117.3,PRE,0),"^",2,13)=ZZ
26 .Q
27 S DR=$S(FLG1:"2:11;13;51//Y;S:X'=""Y"" Y="""";52",1:"12;W !;53//Y;S:X'=""Y"" Y=""@1"";54;@1;55//Y;S:X'=""Y"" Y="""";56:57")
28 D ^DIE L -^FH(117.3,PRE,0) K DA,DIC,DIE,DR,Z,ZZ Q
29SET ; Set all three quarters with the Facility Profile Data
30 F QTR=2:1:4 S PRE=$E(OLD,1,4)_QTR_"00" D S1
31 Q
32S1 ; Process Storage of Facility Profile Data
33 Q:'$D(^FH(117.3,OLD,0))
34 I '$D(^FH(117.3,PRE,0)) S $P(^FH(117.3,PRE,0),"^",1)=PRE,^FH(117.3,"B",PRE,PRE)="",Z=$G(^FH(117.3,0)),$P(^FH(117.3,0),"^",3,4)=PRE_"^"_($P(Z,"^",4)+1)
35 S $P(^FH(117.3,PRE,0),"^",2,26)=$P($G(^FH(117.3,OLD,0)),"^",2,26)
36 F TIT="AREA","DELV","SPEC" D
37 .I $O(^FH(117.3,OLD,TIT,0))>0 K ^FH(117.3,PRE,TIT) D
38 ..I '$D(^FH(117.3,PRE,TIT,0)) S ^(0)=$S(TIT="AREA":"^117.356S^^",TIT="DELV":"^117.313P^^",1:"^117.312P^^")
39 ..F K1=0:0 S K1=$O(^FH(117.3,OLD,TIT,K1)) Q:K1<1 S L1=$G(^(K1,0)) D
40 ...S ^FH(117.3,PRE,TIT,K1,0)=L1,^FH(117.3,PRE,TIT,"B",+L1,K1)=""
41 ...S Z=$G(^FH(117.3,PRE,TIT,0)),$P(^FH(117.3,PRE,TIT,0),"^",3,4)=K1_"^"_($P(Z,"^",4)+1)
42 ...Q
43 ..Q
44 .Q
45 Q
46GET ; Get the Facility Data from Institution file
47 D SITE^FH
48 K DIC S DIC="^DIC(4,",DIC(0)="AEMQ",DIC("A")="Enter Station Number: ",DIC("B")=SITE(1),D="D"
49 W ! D MIX^DIC1 K DIC,SITE Q:"^"[X!($D(DTOUT)) Q:Y<1
50 Q
51QR ; Read in Qtr and Year
52 S (PRE,QTR)=0 D NOW^%DTC S NOW=%\1
53 ;S YR=$E(NOW,2,3),S1=$E(NOW,4,5),QTR=$S(S1<4:1,S1<7:2,S1<10:3,1:4)
54 S YR=$E(NOW,1,3)+1700,S1=$E(NOW,4,5),QTR=$S(S1<4:1,S1<7:2,S1<10:3,1:4)
55Q1 K %DT W !!,"Enter Qtr/Yr: "_QTR_"/"_YR_"// " R X:DTIME Q:'$T!(X["^")
56 I X="" S X=$E(NOW,1,3)_"0"_QTR_"00"
57 D ^%DT
58 I $E(Y,6,7) W *7,?28," Do Not Enter Dates." G Q1
59 ;I $E(Y,4,5)<1!($E(Y,4,5)>4)!($E(Y,1,3)>$E(NOW,1,3)) W *7," Answer Qtr 1-4 and Yr as Qtr/Yr.",!?28," Yr CANNOT be greater than now." G Q1
60 I $E(Y,4,5)<1!($E(Y,4,5)>4)!($E(Y,1,3)>$E(NOW,1,3)) D G Q1
61 .W *7," Answer Qtr 1-4 and Yr as 4 digit year, ie 2001."
62 .W !?28," Example: 4/2001 for 4th quarter, year 2001."
63 .W !?28," Yr CANNOT be greater than now."
64 I $E(Y,4,5)>QTR&($E(Y,1,3)=$E(NOW,1,3)) W *7," Qtr/Yr must not be greater than default." G Q1
65 S YR=$E(Y,2,3),QTR=$E(Y,5),PRE=$E(Y,1,5)_"00" Q
66YR ; Read in the Year
67 W ! K %DT S PRE="",%DT="AEP",%DT("A")="Enter YR: "
68 D ^%DT S:$D(DTOUT) X="^" Q:U[X G:Y<1 YR
69 I $E(Y,1,3)>$E(DT,1,3) W *7," Do Not Enter Future Year." G YR
70 I $E(Y,4,7)>0 W *7," Enter Year Only." G YR
71 S Y=$E(Y,1,3)_"0100",PRE=Y Q
Note: See TracBrowser for help on using the repository browser.