Home   Package List   Routine Alphabetical List   Global Alphabetical List   FileMan Files List   FileMan Sub-Files List   Package Component Lists   Package-Namespace Mapping  
Routine: FHOMRL1

FHOMRL1.m

Go to the documentation of this file.
FHOMRL1 ;Hines OIFO/RTK OUTPATIENT MEALS RECURRING MEALS LIST  ;1/25/05  11:35
 ;;5.5;DIETETICS;**1,5**;Dec 22, 2004;Build 53
 ;
 W @IOF,!!?20,"R E C U R R I N G   M E A L S   L I S T"
START S (FHSELOC,FHSLCOM,FHSLPRO)=""
 W !! K DIR S DIR("A")="Print by LOCATION, COMM OFFICE, PRODUCTION FACILITY or ALL: "
 S DIR(0)="SAO^A:ALL;C:COMM OFFICE;L:LOCATION;P:PROD FACILITY" D ^DIR
 Q:$D(DIRUT)  S FHLBY=Y
 I FHLBY="L" W ! D OUTLOC^FHOMUTL Q:FHLOC=""  S FHSELOC=FHLOC,FHLOC=""
 I FHLBY="C" D  Q:FHSLCOM=""
 .W ! K DIC S DIC=119.73,DIC("A")="Select Communication Office: "
 .S DIC(0)="AEQZ" D ^DIC Q:$D(DUOUT)  I Y=-1 S FHSLCOM="" Q
 .S FHSLCOM=+Y
 I FHLBY="P" D  Q:FHSLPRO=""
 .W ! K DIC S DIC=119.71,DIC("A")="Select Production Facility: "
 .S DIC(0)="AEQZ" D ^DIC Q:$D(DUOUT)  I Y=-1 S FHSLPRO="" Q
 .S FHSLPRO=+Y
 W ! D STDATE^FHOMUTL I STDT="" Q
 W ! D ENDATE^FHOMUTL I ENDT="" Q
 S X1=STDT,X2=-1 D C^%DTC S STDT=X
 D DEV,START
 Q
DEV ;get device and set up queue
 W ! K %ZIS,IOP S %ZIS="Q" D ^%ZIS Q:POP
 I '$D(IO("Q")) U IO D DISP,^%ZISC,END Q
 S ZTRTN="DISP^FHOMRL1"
 S ZTSAVE("STDT")="",ZTSAVE("ENDT")="",ZTSAVE("FHDFN")=""
 S ZTSAVE("FHLBY")="",ZTSAVE("FHSELOC")="",ZTSAVE("FHSLCOM")="",ZTSAVE("FHSLPRO")=""
 S ZTDESC="Outpatient Meals Recurring Meals List" D ^%ZTLOAD
 D ^%ZISC K %ZIS,IOP
 D END Q
 Q
DISP ; First build data in ^TMP global
 K ^TMP($J) S EX="",FHPG=0
 F FHXRDT=STDT:0 S FHXRDT=$O(^FHPT("RM",FHXRDT)) Q:FHXRDT'>0!(FHXRDT>ENDT)!(EX=U)  D
 .F FHDFN=0:0 S FHDFN=$O(^FHPT("RM",FHXRDT,FHDFN)) Q:FHDFN'>0!(EX=U)  D
 ..F FHRM=0:0 S FHRM=$O(^FHPT("RM",FHXRDT,FHDFN,FHRM)) Q:FHRM'>0!(EX=U)  D
 ...S FHZN=$G(^FHPT(FHDFN,"OP",FHRM,0)),FHST=$P(FHZN,U,15) I FHST="C" Q
 ...D PATNAME^FHOMUTL
 ...S FHLOC=$P(FHZN,U,3) Q:FHLOC=""  I FHLBY="L",FHSELOC'=FHLOC Q
 ...S FHCOMM=$P($G(^FH(119.6,FHLOC,0)),U,8) I FHLBY="C",FHSLCOM'=FHCOMM Q
 ...S FHPRD=$P($G(^FH(119.73,FHCOMM,0)),U,4) I FHLBY="P",FHSLPRO'=FHPRD Q
 ...S FHPRORD=$P($G(^FH(119.6,FHLOC,0)),U,4) I FHPRORD="" S FHPRORD=99
 ...S FHPRORD=$S(FHPRORD<1:99,FHPRORD<10:"0"_FHPRORD,1:FHPRORD)
 ...S FHLOCNM=$P($G(^FH(119.6,FHLOC,0)),U,1)
 ...S ^TMP($J,FHPRORD_"~"_FHLOCNM,FHXRDT,FHPTNM_"~"_FHRM_"~"_FHDFN)=FHZN
 ...Q
 ..Q
 .Q
 ; Now display data from the ^TMP global
 S FHLSRT="" F  S FHLSRT=$O(^TMP($J,FHLSRT)) Q:FHLSRT=""!(EX=U)  D
 .D:FHPG>0&(IOST?1"C".E) PG Q:EX=U
 .D HDR S FHPG=FHPG+1
 .F FHXRDT=0:0 S FHXRDT=$O(^TMP($J,FHLSRT,FHXRDT)) Q:FHXRDT'>0!(EX=U)  D
 ..S FHPTN="" F  S FHPTN=$O(^TMP($J,FHLSRT,FHXRDT,FHPTN)) Q:FHPTN=""!(EX=U)  D
 ...S FHZN=$G(^TMP($J,FHLSRT,FHXRDT,FHPTN)),FHLOC=$P(FHZN,U,3)
 ...S FHLOCZN=$G(^FH(119.6,FHLOC,0)),FHRNUM=$P(FHPTN,"~",2)
 ...S FHRMBD=$P(FHZN,U,18),FHRMBNM=""
 ...I FHRMBD'="" S FHRMBNM=$E($P($G(^DG(405.4,FHRMBD,0)),U,1),1,14)
 ...S FHDFN=$P(FHPTN,"~",3)
 ...W ! S DTP=FHXRDT D DTP^FH W DTP
 ...W ?11,$E($P(FHPTN,"~",1),1,19)
 ...W ?32,$P(FHZN,U,4)
 ...S FHSRV=$P(FHLOCZN,U,10)
 ...S FHSPT=$S(FHSRV["T":$P(FHLOCZN,U,5),FHSRV["C":$P(FHLOCZN,U,6),1:"")
 ...S FHSRVPT="" I FHSPT'="" S FHSRVPT=$P($G(^FH(119.72,FHSPT,0)),U,1)
 ...W ?36,$E(FHSRVPT,1,11),?48,FHRMBNM
 ...I $P($G(^FH(119.6,FHLOC,1)),U,4)="Y" D DIETPAT^FHOMRR1 W ?64,$E(FHDIETP,1,16)
 ...I $P($G(^FH(119.6,FHLOC,1)),U,4)'="Y" S FHDPTR=$P(FHZN,U,2) Q:FHDPTR=""  W ?64,$E($P($G(^FH(111,FHDPTR,0)),U,1),1,16)
 ...I $Y>(IOSL-4) D PG I EX=U Q
 Q
PG ;
 I IOST?1"C".E W ! K DIR S DIR(0)="E" D ^DIR I 'Y S EX=U Q
 D HDR Q
HDR ;
 W:$Y @IOF
 W !?25,"R E C U R R I N G   M E A L   L I S T"
 W !!?5,"LOCATION: ",$P(FHLSRT,"~",2)
 W !!,"Date",?11,"Patient Name",?31,"Meal",?36,"Service Pnt"
 W ?48,"Room-Bed",?64,"Diet Ordered"
 W !,"=========",?11,"===================",?31,"===="
 W ?36,"===========",?48,"==============",?64,"================"
 Q
END ;
 K ENDT,FHXRDT,FHRM,FHST,FHSLCOM,FHSLPRO,FHZN,STDT Q