VistA-WorldVistAEHR/r/DIETETICS-FH/FHOMGR1.m

56 lines
2.3 KiB
Mathematica

FHOMGR1 ;Hines OIFO/RTK GUEST MEALS REQUEST MEAL ;4/17/03 09:45
;;5.5;DIETETICS;**5**;Jan 28, 2005;Build 53
;
D NOW^%DTC S STDT=X,FHDSDT=$$FMTE^XLFDT(STDT,"P") W !!,FHDSDT
S FHMSG1="G" D ^FHOMDPA I FHDFN="" Q
I '$D(^FHPT(FHDFN,0)) W !!,"UNKNOWN SELECTION !" Q
CLASS ;Prompt for classification
W ! K DIR,DIC S DIR("A")="Select Classification: "
S DIR(0)="SAO^E:Employee;G:Gratuitous;O:OOD;P:Paid;V:Volunteer"
D ^DIR I $D(DIRUT) D EXMSG^FHOMUTL Q
I Y'=-1 S FHCLASS=Y
LOC ;Prompt for location
D OUTLOC^FHOMUTL I FHLOC="" D EXMSG^FHOMUTL Q
W ! D RMBED^FHOMUTL
S FHCOMM=$P($G(^FH(119.6,FHLOC,0)),U,8)
MEAL ;Prompt for meal
K DIR,DIC S DIR("A")="Select Meal: "
S DIR(0)="SAO^B:Breakfast;N:Noon;E:Evening"
D ^DIR I $D(DIRUT) D EXMSG^FHOMUTL Q
I Y'=-1 S FHMEAL=Y
DIET ;Stuff diet
S FHDIET=$P($G(^FH(119.9,1,0)),U,2)
I FHDIET="" W !!,"NO DEFAULT OUTPATIENT DIET SET!!",! Q
CHARGE ;Get charge
S FHCHAR=""
S F=$S(FHCLASS="E":12,FHCLASS="P":13,FHCLASS="O":14,FHCLASS="V":15,1:16)
S FHYN=$P($G(^FH(119.9,1,0)),U,F) I FHYN'="Y" W ! D SET1 Q
S F=$S(FHCLASS="E":21,FHCLASS="P":24,FHCLASS="O":27,FHCLASS="V":30,1:33)
S FHP=F+$S(FHMEAL="B":0,FHMEAL="N":1,1:2)
S FHCHAR=$P($G(^FH(119.9,1,0)),U,FHP)
W !!,"Payment amount = $",FHCHAR,!
SET1 K DIR S DIR("A")="Is this correct?: ",DIR(0)="YA",DIR("B")="Y" D ^DIR
S CONT=Y I CONT'=1 D EXMSG^FHOMUTL Q
S FHGML=1 D SMGM^FHOMRO2 I SKIP=1 Q
SETNODE ;
S MLT=$S(FHMEAL="B":".08",FHMEAL="N":".13",1:".18")
S STDTIM=STDT_MLT
I $D(^FHPT(FHDFN,"GM","B",STDTIM)),$P($G(^FHPT(FHDFN,"GM",STDTIM,0)),U,9)'="C" D MESSAGE Q
S DA(1)=FHDFN,DA=STDTIM,DIK="^FHPT("_DA(1)_",""GM""," D ^DIK ;delete if there is a previous canceled GM for this date/meal
S Y=STDTIM K DIC,DO S DA(1)=FHDFN,DIC="^FHPT("_DA(1)_",""GM"","
S DIC(0)="L",DIC("P")=$P(^DD(115,18,0),U,2),X=+Y,DINUM=X
D FILE^DICN I Y=-1 Q
K DIE S DA(1)=FHDFN,DIE="^FHPT("_DA(1)_",""GM"","
S DA=+Y,FHDA=DA
S DR="1////^S X=FHCLASS;2////^S X=FHMEAL;3////^S X=FHCHAR;4////^S X=FHLOC;4.5////^S X=FHRMBD;5////^S X=FHDIET"
D ^DIE,OKMSG^FHOMUTL
S FHZN=$G(^FHPT(FHDFN,"GM",FHDA,0))
S FHACT="O",FHOPTY="G",FHOPDT=STDT D SETGM^FHOMRO2 ;set event
Q
MESSAGE ;
D PATNAME^FHOMUTL S FHPREDT=$$FMTE^XLFDT(STDT,"P")
W !!?3,FHPTNM," ALREADY HAS A "
W $S(FHMEAL="B":"BREAKFAST",FHMEAL="N":"NOON",1:"EVENING")
W " GUEST MEAL ORDERED FOR ",FHPREDT
Q