GMRYRP1 ;HIRMFO/YH-TMP FOR PATIENT INTAKE/OUTPUT REPORTS-1 ;2/28/91
;;4.0;Intake/Output;;Apr 25, 1997
STARTD ;CALCULATE START DATE AND END DATE FOR REPORTS
I +$P(GMRSTRT,".",2)>0 G FINDT
I GMRNIT>2000 S X1=+$E(GMRSTRT,1,7),X2=-1 D C^%DTC K %DTC S GMRSTRT=X
S GMRSTRT=GMRSTRT_"."_GMRNIT
FINDT ;
I +$P(GMRFIN,".",2)>0 G NEXT
S GHR=$E(GMRNIT,1,2),GMIN=$E(GMRNIT,3,4)
I +GMIN=0 S GHR=GHR-1,GHR=$S(GHR<10:"0"_GHR,1:GHR),GMRFIN=GMRFIN_"."_GHR_"59" G NEXT
I +GMIN=1 S GMRFIN=GMRFIN_"."_"2400" G NEXT
S GMIN=GMIN-1,GMIN=$S(GMIN<10:"0"_GMIN,1:GMIN),GMRFIN=GMRFIN_"."_GHR_GMIN
NEXT ;
S GDTFIN=+$E(GMRFIN,1,7),GDTSTRT=GDTFIN
I GMRNIT>2000 S X1=GDTFIN,X2=-1 D C^%DTC K %DT S GDTSTRT=X
S X1=GDTFIN,X2=-1 D C^%DTC K %DT S GLASTDT=X S X1=GDTSTRT,X2=1 D C^%DTC K %DT S GNXTDT=X
Q
DATE ;ENTER START DATE AND END DATE FOR PATIENT INTAKE/OUTPUT REPORT
S %DT("A")="Enter start DATE for this report: ",%DT("B")="T-3",%DT="AETX" D ^%DT K %DT S:+Y'>0 GMROUT=1 Q:GMROUT S GMRSTRT=+Y
S %DT("A")="Go to DATE: ",%DT="AETXS",%DT("B")="NOW" D ^%DT K %DT S:+Y'>0 GMROUT=1 Q:GMROUT S (X1,GMRFIN)=+Y Q:GMRFIN=GMRSTRT S X2=GMRSTRT D ^%DTC
I X<0!(X=0&(((+("."_$P(GMRFIN,".",2))*10000)-((+("."_$P(GMRSTRT,".",2))*10000)))'>0)) W !,?5,"ENDING DATE needs to be greater than STARTING DATE",!,?5,$C(7),"Please reenter!!!" G DATE
Q
ITEM ;CONCATENATE INTAKE ITEM AND VOLUME AS TEXT FOR PRINT
Q:'$D(^GMR(126,DA(1),II,DA,1,0))
F GI=0:0 S GI=$O(^GMR(126,DA(1),II,DA,1,GI)) Q:GI'>0 I $D(^GMRD(126.8,+$P(^GMR(126,DA(1),II,DA,1,GI,0),"^"),0)) D
.S GITEM=GITEM_$P(^GMRD(126.8,+$P(^GMR(126,DA(1),II,DA,1,GI,0),"^"),0),"^")_" "_$P(^GMR(126,DA(1),II,DA,1,GI,0),"^",2)_" mls "_$S($P(^(0),"^",3)'="":" * "_$P(^(0),"^",3)_" ",1:"")
K GI Q
GMRYRP1 ;HIRMFO/YH-TMP FOR PATIENT INTAKE/OUTPUT REPORTS-1 ;2/28/91
+1 ;;4.0;Intake/Output;;Apr 25, 1997
STARTD ;CALCULATE START DATE AND END DATE FOR REPORTS
+1 IF +$PIECE(GMRSTRT,".",2)>0
GOTO FINDT
+2 IF GMRNIT>2000
SET X1=+$EXTRACT(GMRSTRT,1,7)
SET X2=-1
DO C^%DTC
KILL %DTC
SET GMRSTRT=X
+3 SET GMRSTRT=GMRSTRT_"."_GMRNIT
FINDT ;
+1 IF +$PIECE(GMRFIN,".",2)>0
GOTO NEXT
+2 SET GHR=$EXTRACT(GMRNIT,1,2)
SET GMIN=$EXTRACT(GMRNIT,3,4)
+3 IF +GMIN=0
SET GHR=GHR-1
SET GHR=$SELECT(GHR<10:"0"_GHR,1:GHR)
SET GMRFIN=GMRFIN_"."_GHR_"59"
GOTO NEXT
+4 IF +GMIN=1
SET GMRFIN=GMRFIN_"."_"2400"
GOTO NEXT
+5 SET GMIN=GMIN-1
SET GMIN=$SELECT(GMIN<10:"0"_GMIN,1:GMIN)
SET GMRFIN=GMRFIN_"."_GHR_GMIN
NEXT ;
+1 SET GDTFIN=+$EXTRACT(GMRFIN,1,7)
SET GDTSTRT=GDTFIN
+2 IF GMRNIT>2000
SET X1=GDTFIN
SET X2=-1
DO C^%DTC
KILL %DT
SET GDTSTRT=X
+3 SET X1=GDTFIN
SET X2=-1
DO C^%DTC
KILL %DT
SET GLASTDT=X
SET X1=GDTSTRT
SET X2=1
DO C^%DTC
KILL %DT
SET GNXTDT=X
+4 QUIT
DATE ;ENTER START DATE AND END DATE FOR PATIENT INTAKE/OUTPUT REPORT
+1 SET %DT("A")="Enter start DATE for this report: "
SET %DT("B")="T-3"
SET %DT="AETX"
DO ^%DT
KILL %DT
IF +Y'>0
SET GMROUT=1
IF GMROUT
QUIT
SET GMRSTRT=+Y
+2 SET %DT("A")="Go to DATE: "
SET %DT="AETXS"
SET %DT("B")="NOW"
DO ^%DT
KILL %DT
IF +Y'>0
SET GMROUT=1
IF GMROUT
QUIT
SET (X1,GMRFIN)=+Y
IF GMRFIN=GMRSTRT
QUIT
SET X2=GMRSTRT
DO ^%DTC
+3 IF X<0!(X=0&(((+("."_$PIECE(GMRFIN,".",2))*10000)-((+("."_$PIECE(GMRSTRT,".",2))*10000)))'>0))
WRITE !,?5,"ENDING DATE needs to be greater than STARTING DATE",!,?5,$CHAR(7),"Please reenter!!!"
GOTO DATE
+4 QUIT
ITEM ;CONCATENATE INTAKE ITEM AND VOLUME AS TEXT FOR PRINT
+1 IF '$DATA(^GMR(126,DA(1),II,DA,1,0))
QUIT
+2 FOR GI=0:0
SET GI=$ORDER(^GMR(126,DA(1),II,DA,1,GI))
IF GI'>0
QUIT
IF $DATA(^GMRD(126.8,+$PIECE(^GMR(126,DA(1),II,DA,1,GI,0),"^"),0))
Begin DoDot:1
+3 SET GITEM=GITEM_$PIECE(^GMRD(126.8,+$PIECE(^GMR(126,DA(1),II,DA,1,GI,0),"^"),0),"^")_" "_$PIECE(^GMR(126,DA(1),II,DA,1,GI,0),"^",2)_" mls "_$SELECT($PIECE(^(0),"^",3)'="":" * "_$PIECE(^(0),"^",3)_" ",1:"")
End DoDot:1
+4 KILL GI
QUIT