RMPFEA3 ;DDC/KAW-AUTOQUEUE MANAGER FOR TRANSMISSION BATCHES [ 06/16/95 3:06 PM ]
;;2.0;REMOTE ORDER/ENTRY SYSTEM;;JUN 16, 1995
;; input: RMPFBT
;;output: None
;;Set queue time if transmission parameter set to auto-queue
Q:'$D(RMPFBT) Q:$P(RMPFSYS,U,3)'="A"
S TM=$P(RMPFSYS,U,4) I TM="" S TM=.22
S X="NOW",%DT="T" D ^%DT
S A="."_$P(TM,".",2),B="."_$P(Y,".",2),ZTDTH=$P(DT,".",1)_A
I A-B<0 S X1=$P(DT,".",1),X2=1 D C^%DTC S ZTDTH=$P(X,".",1)_A
QUE S ZTIO="",ZTDESC="AUTO-QUEUE ROES TRANSMISSION",ZTSAVE("RMPFBT")=""
S ZTSAVE("RMPFSTAP")="",ZTSAVE("RMPFMENU")="",ZTSAVE("RMPFSYS")=""
S ZTRTN="CLOSE^RMPFEB" D ^%ZTLOAD
S $P(^RMPF(791812,RMPFBT,0),U,10)=ZTSK
END K TM,X,Y,A,B,ZTDTH,ZTIO,ZTDESC,ZTSAVE,ZTRTN,ZTSK Q
REQUE ;;Reschedule the closing and transmission of a batch
;; input: RMPFBT
;;output: None
Q:'$D(RMPFBT) Q:'$D(^RMPF(791812,RMPFBT,0)) S ZTSK=$P(^(0),U,10)
I 'ZTSK W !!,$C(7),"*** THIS BATCH HAS NOT BEEN SCHEDULED FOR TRANSMISSION ***" G REQUEE
S X="NOW",%DT="T" D ^%DT S ZTDTH=Y D REQ^%ZTLOAD
I ZTSK(0)'=1 W !!,"*** TASK NOT REQUEUED ***"
REQUEE K X,Y,ZTSK Q
EMER ;;Queue or requeue emergency batch
;; input: RMPFBT,RMPFCAT
;;output: None
W !!,"This order has a delivery category of: "
W $S(RMPFCAT="E":"EMERGENCY",1:"PRIORITY")
W !!,"Do you wish to close the open batch and transmit now? YES// "
D READ Q:$D(RMPFOUT)
EMER1 I $D(RMPFQUT) W !!,"Enter a <Y> or <RETURN> to close and transmit the batch immediately",!?7,"an <N> to leave the batch for later transmission." G EMER
S:Y="" Y="Y" S Y=$E(Y,1) I "YyNn"'[Y S RMPFQUT="" G EMER1
G EMERE:"Yy"'[Y
I $P(^RMPF(791812,RMPFBT,0),U,10) D REQUE^RMPFEA3 G EMERE
D CLOSE^RMPFEB
EMERE Q
READ K RMPFOUT,RMPFQUT
R Y:DTIME I '$T W $C(7) R Y:5 G READ:Y="." S:'$T Y=U
I Y?1"^".E S (RMPFOUT,Y)="" Q
S:Y?1"?".E (RMPFQUT,Y)=""
Q
--- Routine Detail --- with STRUCTURED ROUTINE LISTING ---[H[J[2J[HRMPFEA3 1853 printed Oct 16, 2024@18:36:47 Page 2
RMPFEA3 ;DDC/KAW-AUTOQUEUE MANAGER FOR TRANSMISSION BATCHES [ 06/16/95 3:06 PM ]
+1 ;;2.0;REMOTE ORDER/ENTRY SYSTEM;;JUN 16, 1995
+2 ;; input: RMPFBT
+3 ;;output: None
+4 ;;Set queue time if transmission parameter set to auto-queue
+5 if '$DATA(RMPFBT)
QUIT
if $PIECE(RMPFSYS,U,3)'="A"
QUIT
+6 SET TM=$PIECE(RMPFSYS,U,4)
IF TM=""
SET TM=.22
+7 SET X="NOW"
SET %DT="T"
DO ^%DT
+8 SET A="."_$PIECE(TM,".",2)
SET B="."_$PIECE(Y,".",2)
SET ZTDTH=$PIECE(DT,".",1)_A
+9 IF A-B<0
SET X1=$PIECE(DT,".",1)
SET X2=1
DO C^%DTC
SET ZTDTH=$PIECE(X,".",1)_A
QUE SET ZTIO=""
SET ZTDESC="AUTO-QUEUE ROES TRANSMISSION"
SET ZTSAVE("RMPFBT")=""
+1 SET ZTSAVE("RMPFSTAP")=""
SET ZTSAVE("RMPFMENU")=""
SET ZTSAVE("RMPFSYS")=""
+2 SET ZTRTN="CLOSE^RMPFEB"
DO ^%ZTLOAD
+3 SET $PIECE(^RMPF(791812,RMPFBT,0),U,10)=ZTSK
END KILL TM,X,Y,A,B,ZTDTH,ZTIO,ZTDESC,ZTSAVE,ZTRTN,ZTSK
QUIT
REQUE ;;Reschedule the closing and transmission of a batch
+1 ;; input: RMPFBT
+2 ;;output: None
+3 if '$DATA(RMPFBT)
QUIT
if '$DATA(^RMPF(791812,RMPFBT,0))
QUIT
SET ZTSK=$PIECE(^(0),U,10)
+4 IF 'ZTSK
WRITE !!,$CHAR(7),"*** THIS BATCH HAS NOT BEEN SCHEDULED FOR TRANSMISSION ***"
GOTO REQUEE
+5 SET X="NOW"
SET %DT="T"
DO ^%DT
SET ZTDTH=Y
DO REQ^%ZTLOAD
+6 IF ZTSK(0)'=1
WRITE !!,"*** TASK NOT REQUEUED ***"
REQUEE KILL X,Y,ZTSK
QUIT
EMER ;;Queue or requeue emergency batch
+1 ;; input: RMPFBT,RMPFCAT
+2 ;;output: None
+3 WRITE !!,"This order has a delivery category of: "
+4 WRITE $SELECT(RMPFCAT="E":"EMERGENCY",1:"PRIORITY")
+5 WRITE !!,"Do you wish to close the open batch and transmit now? YES// "
+6 DO READ
if $DATA(RMPFOUT)
QUIT
EMER1 IF $DATA(RMPFQUT)
WRITE !!,"Enter a <Y> or <RETURN> to close and transmit the batch immediately",!?7,"an <N> to leave the batch for later transmission."
GOTO EMER
+1 if Y=""
SET Y="Y"
SET Y=$EXTRACT(Y,1)
IF "YyNn"'[Y
SET RMPFQUT=""
GOTO EMER1
+2 if "Yy"'[Y
GOTO EMERE
+3 IF $PIECE(^RMPF(791812,RMPFBT,0),U,10)
DO REQUE^RMPFEA3
GOTO EMERE
+4 DO CLOSE^RMPFEB
EMERE QUIT
READ KILL RMPFOUT,RMPFQUT
+1 READ Y:DTIME
IF '$TEST
WRITE $CHAR(7)
READ Y:5
if Y="."
GOTO READ
if '$TEST
SET Y=U
+2 IF Y?1"^".E
SET (RMPFOUT,Y)=""
QUIT
+3 if Y?1"?".E
SET (RMPFQUT,Y)=""
+4 QUIT