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

FHOMGP1.m

Go to the documentation of this file.
FHOMGP1 ;Hines OIFO/RTK PRINT GUEST MEALS LIST  ; 8/27/19 3:09pm
 ;;5.5;DIETETICS;**5,52**;Jan 28, 2005;Build 4
 ;
 W @IOF,!!?20,"G U E S T   M E A L S   L I S T"
EN ;
 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=""
 . S 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=""
 . S 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 ENDT=ENDT_.99
 D DEV,EN 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 LIST,^%ZISC,END Q
 S ZTRTN="LIST^FHOMGP1"
 S ZTSAVE("STDT")="",ZTSAVE("ENDT")="",ZTSAVE("FHDFN")=""
 S ZTSAVE("FHLBY")="",ZTSAVE("FHSELOC")="",ZTSAVE("FHSLCOM")="",ZTSAVE("FHSLPRO")=""
 S ZTDESC="Guest Meals Display" D ^%ZTLOAD
 D ^%ZISC K %ZIS,IOP
 D END Q
LIST ; First build data in ^TMP global
 K ^TMP($J) S NUM=0,EX="",FHPG=0
 F FHGMDT=STDT:0 S FHGMDT=$O(^FHPT("GM",FHGMDT)) Q:FHGMDT'>0!(FHGMDT>ENDT)  D
 .F FHDFN=0:0 S FHDFN=$O(^FHPT("GM",FHGMDT,FHDFN)) Q:FHDFN'>0  D
 ..S FHZN=$G(^FHPT(FHDFN,"GM",FHGMDT,0)),FHST=$P(FHZN,U,9) I FHST="C" Q
 ..D PATNAME^FHOMUTL
 ..S FHLOC=$P(FHZN,U,5) 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,FHGMDT,FHPTNM_"~"_FHDFN)=FHZN
 ..Q
 .Q
 ; Now display data from the ^TMP global
 I '$D(^TMP($J)) W !!,"THERE ARE CURRENTLY NO GUEST MEALS TO PRINT" Q
 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 FHGMDT=0:0 S FHGMDT=$O(^TMP($J,FHLSRT,FHGMDT)) Q:FHGMDT'>0!(EX=U)  D
 ..S FHPTN="" F  S FHPTN=$O(^TMP($J,FHLSRT,FHGMDT,FHPTN)) Q:FHPTN=""!(EX=U)  D
 ...S FHNODE=$G(^TMP($J,FHLSRT,FHGMDT,FHPTN)),FHLOC=$P(FHNODE,U,5)
 ...S FHLOCZN=$G(^FH(119.6,FHLOC,0))
 ...S FHRMBD=$P(FHNODE,U,11),FHRMBNM=""
 ...I FHRMBD'="" S FHRMBNM=$E($P($G(^DG(405.4,FHRMBD,0)),U,1),1,11)
 ...S FHDFN=$P(FHPTN,"~",2)  ;,FHLIST(NUM)=FHDFN_"^"_FHGMDT
 ...S FHCL=$P(FHNODE,U,2),FHML=$P(FHNODE,U,3),FHCH=$P(FHNODE,U,4)
 ...S FHSTAT=$P(FHNODE,U,9),NUM=NUM+1
 ...S FHCL=$S(FHCL="E":"EMP",FHCL="G":"GRAT",FHCL="O":"OOD",FHCL="P":"PAID",1:"VOL")
 ...S FHLOC=$E($P($G(^FH(119.6,FHLOC,0)),U,1),1,12)
 ...; S PAD=$S($L(NUM)=1:" ",1:"") W !,PAD,NUM
 ...D PATNAME^FHOMUTL W !,$E(FHPTNM,1,22)
 ...S FHD=$$FMTE^XLFDT(FHGMDT,"P") W ?22,$E(FHD,1,12)
 ...W ?36,FHLOC,?49,FHRMBNM,?62,FHML,?67,FHCL,?74,FHCH
 ...S FHLIST(NUM)=FHDFN_"^"_FHGMDT
 ...I $Y>(IOSL-4) D PG I EX=U Q
 ..Q
 .Q
 Q
END ;
 K DIR,ENDT,STDT,FHGMDT,FHML,FHCL,FHCH,FHSELOC,FHSLCOM,FHNODE,FHZN
 K FHSLPRO,FHPRD
 Q
PG ;
 ;Q:$O(^FHPT(FHDFN,"GM",FHGMDT))'>0
 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 !?5,"G U E S T   M E A L   L I S T"
 W !!?5,"LOCATION: ",$P(FHLSRT,"~",2)
 W !!,"Name",?22,"Date",?36,"Location",?49,"Room-Bed",?61,"Meal"
 W ?67,"Class",?74,"Charge"
 W !,"====================",?22,"============"
 W ?36,"============ ===========",?61,"====",?67,"=====",?74,"======"
 Q