PSOSPML1 ;BIRM/MFR - Export Batch Processing Listman Driver ;10/10/12
;;7.0;OUTPATIENT PHARMACY;**408,451,625**;DEC 1997;Build 42
;
N %DT,BATIEN,DIR,DIRUT,X,DIC,DTOUT,DUOUT,STATEIEN,PSOFROM,PSOTO,VALM,VALMCNT,VALMHDR,VALMBCK,VALMSG,PSOLSTLN
;
STA ; STATE prompt
K DIC W ! S DIC("A")="STATE: ",DIC="^DIC(5,"
S STATEIEN=$O(^PS(58.41,0)) S:STATEIEN DIC("B")=STATEIEN
S DIC(0)="AEQMZ" D ^DIC I X="^"!(Y<0) G EXIT
I +$$SPOK^PSOSPMUT(+Y)=-1 W !!,$P($$SPOK^PSOSPMUT(+Y),"^",2),$C(7) G STA
S STATEIEN=+Y
;
; - Ask for FROM DATE
S %DT(0)=-DT,%DT="AEP",%DT("A")="BATCH CREATED BEGIN DATE: "
W ! D ^%DT I Y<0!($D(DTOUT)) G EXIT
S PSOFROM=Y\1-.00001
;
; - Ask for TO DATE
K %DT S %DT(0)=PSOFROM+1\1,%DT="AEP",%DT("B")="TODAY",%DT("A")="BATCH CREATED END DATE: "
W ! D ^%DT I Y<0!($D(DTOUT)) G EXIT
S PSOTO=Y\1+.99999
;
D EN(STATEIEN,PSOFROM,PSOTO)
;
G EXIT
;
EN(STATEIEN,PSOFROM,PSOTO) ; Entry point
D EN^VALM("PSO SPMP BATCH PROCESSING")
D FULL^VALM1
Q
;
HDR ; - Builds the Header section
K VALMHDR
S VALMHDR(1)="State: "_$$GET1^DIQ(5,STATEIEN,.01)
S $E(VALMHDR(1),40)="Date Range: "_$$FMTE^XLFDT(PSOFROM+1\1,2)_" - "_$$FMTE^XLFDT(PSOTO\1,2)
D SETHDR()
Q
;
SETHDR() ; - Displays the Header Line
N HDR,ORD,POS
;
S HDR=" #",$E(HDR,7)="BATCH#",$E(HDR,15)="DATE/TIME CREATED",$E(HDR,34)="REL. DATE RANGE"
S $E(HDR,54)="TYPE",$E(HDR,66)="Rx's",$E(HDR,72)="EXPORTED?"
S $E(HDR,81)="" D INSTR^VALM1(IORVON_HDR_IOINORM,1,3)
Q
;
INIT ; Builds the Body section
N RXCNT,BATDT,I,LINE,TYPE,NODE0,RX,COUNT,DRUGIEN,DRUGNAM,DRUGDEA,DSPLINE,FILL
;
K ^TMP("PSOSPML1",$J) S (VALMCNT,LINE,RXCNT,COUNT,PSOLSTLN)=0
S BATDT=PSOFROM,BATIEN=0
F S BATDT=$O(^PS(58.42,"AD",BATDT)) Q:'BATDT!(BATDT>PSOTO) D
. F S BATIEN=$O(^PS(58.42,"AD",BATDT,BATIEN)) Q:'BATIEN D
. . S NODE0=$G(^PS(58.42,BATIEN,0))
. . I $P(NODE0,"^",2)'=STATEIEN Q
. . S COUNT=COUNT+1,RXCNT=$O(^PS(58.42,BATIEN,"RX",999999),-1)
. . S:'$G(RXCNT) RXCNT=0 ;Display '0' for # of RXs for Zero Report
. . S DSPLINE=$J(COUNT,4)_" "_$J(BATIEN,7),$E(DSPLINE,15)=$$FMTE^XLFDT(BATDT,"2Z")
. . S $E(DSPLINE,34)=$$FMTE^XLFDT($P(NODE0,"^",5)\1,"2Z")_"-"_$$FMTE^XLFDT($P(NODE0,"^",6)\1,"2Z")
. . I $P(NODE0,"^",3)="RX" S $E(DSPLINE,34,51)="SINGLE RX "
. . I $P(NODE0,"^",3)="VD",'$P(NODE0,"^",5) S $E(DSPLINE,34,51)="SINGLE RX "
. . S $E(DSPLINE,54)=$$GET1^DIQ(58.42,BATIEN,2)
. . S $E(DSPLINE,66)=$J(RXCNT,4),$E(DSPLINE,72)=$S($$GET1^DIQ(58.42,BATIEN,9,"I"):"YES",1:"NO")
. . D SETLN^PSOSPMU1("PSOSPML1",DSPLINE,0,0,0)
. . S ^TMP("PSOSPML1",$J,LINE,"BAT")=BATIEN
I '$D(^TMP("PSOSPML1",$J)) D
. D SETLN^PSOSPMU1("PSOSPML1","There are no export batches created within the date range selected.",0,0,0)
S VALMCNT=LINE
Q
;
SEL ;Process selection of one entry
N PSOSEL,XQORM,ORD,PSOTITLE,PSOLIS,XX,BAT
S PSOSEL=+$P(XQORNOD(0),"=",2) I 'PSOSEL S VALMSG="Invalid selection!",VALMBCK="R" Q
S BAT=+$G(^TMP("PSOSPML1",$J,PSOSEL,"BAT"))
I 'BAT S VALMSG="Invalid selection!",VALMBCK="R" Q
S PSOTITLE=VALM("TITLE")
W ?50,"Please wait..."
D ; Do used to preserve a few variables that could get overwritten
. N LINE,PSOTITLE,PSOFROM,PSOTO D EN^PSOSPML2(BAT)
S VALMBCK="R",VALM("TITLE")=$G(PSOTITLE)
D INIT
Q
;
MAN ; Manual Batch Export
D FULL^VALM1 S VALMBCK="R"
N %DT,DIR,DIRUT,X,DIC,DTOUT,DUOUT,BEGINDT,PSOBGDT,ENDDT,PSOENDDT,PSOERROR,SPOK
N RECTYPE,STATE,PSOQUIT,FILLTYPE
;
K DIC W ! S DIC("A")="STATE: ",DIC("S")="I $D(^PS(58.41,+Y,0))",DIC="^DIC(5,"
S:$G(STATEIEN) DIC("B")=STATEIEN
S DIC(0)="AEQMZ" D ^DIC I X="^"!(Y<0) G EXIT
S STATE=+Y
;
; - Ask for FROM DATE
; Note: The legislation allowing VA to report was published on 02/11/2013
S %DT(0)=3130211,%DT="AEP",%DT("A")="EXPORT BEGIN DATE: "
W ! D ^%DT I Y<0!($D(DTOUT)) Q
S BEGINDT=Y
;
; - Ask for TO DATE
K %DT S %DT(0)=BEGINDT\1,%DT="AEP",%DT("B")="TODAY",%DT("A")="EXPORT END DATE: "
W ! D ^%DT I Y<0!($D(DTOUT)) Q
S ENDDT=Y
;
S PSOQUIT=0,FILLTYPE=""
I $$GET1^DIQ(58.41,STATE,1,"I")="1995" D I PSOQUIT Q
. K DIR S DIR("A")="Rx Fill Type"
. S DIR("L",1)="Enter the Prescription Fill Type:"
. S DIR("L",2)=" "
. S DIR(0)="S^RL:RELEASED;RS:RETURNED TO STOCK"
. S DIR("L",3)=" RL RELEASED"
. S DIR("L")=" RS RETURNED TO STOCK"
. S DIR("B")="RL" D ^DIR I $D(DUOUT)!($D(DIRUT)) K DIRUT,DUOUT,DIR S PSOQUIT=1 Q
. S FILLTYPE=Y
;
S PSOQUIT=0,RECTYPE="N"
I FILLTYPE'="RS" D I PSOQUIT Q
. K DIR S DIR("A")="Record Type"
. S DIR("L",1)="Enter the type of record to be sent for released prescription fills:"
. S DIR("L",2)=" "
. S DIR(0)="S^N:NEW;R:REVISE"
. S DIR("L",3)=" N NEW"
. S DIR("L")=" R REVISE"
. S DIR("B")="NEW" D ^DIR I $D(DUOUT)!($D(DIRUT)) K DIRUT,DUOUT,DIR S PSOQUIT=1 Q
. S RECTYPE=Y
;
D EXPORT(STATE,BEGINDT,ENDDT,FILLTYPE,RECTYPE)
Q
;
EXPORT(STATE,FROMDATE,TODATE,FILLTYPE,RECTYPE,LIST) ; Export Release CS Rx's to the sate for date range
;Input: STATE - Pointer to the STATE file (#5)
; FROMDATE - Being Rx Release for Date Range
; TODATE - End Rx Release for Date Range
; FILLTYPE - Rx Fill Type (RL - Released / RS - Returned to Stock) - ASAP 1995 only
; RECTYPE - Record Type (N - New / R - Revise)
; LIST - array of IENs that represent PATIENT, DIVISION, PROVIDER, DRUG, or RX
N RXRLDT,ENDRLDT,XREF,RXCNT,RXIEN,RXFILL,FILL,SPOK,DIR,Y,X,DTOUT,DUOUT,BATCHIEN
N RTSDT,ENDRTSDT,RTSONLY,PSOMODE
;
S SPOK=$$SPOK^PSOSPMUT(STATE)
I $P(SPOK,"^")=-1 D Q
. W !!,$P(SPOK,"^",2),$C(7) D PAUSE^PSOSPMU1 Q
;
; The legislation allowing VA to report was published on 02/11/2013
I FROMDATE<3130211 S FROMDATE=3130211
;
; ASAP 1995 ONLY
S RTSONLY=0 I $$GET1^DIQ(58.41,STATE,1,"I")="1995",FILLTYPE="RS" S RTSONLY=1
;
; Gathering the prescriptions to be transmitted in the ^TMP("PSOSPMRX",$J) global
W !!,"Gathering CS prescription fills...(this may take a few minutes)"
K ^TMP("PSOSPMRX",$J) S RXCNT=$$GATHER^PSOSPMU1(STATE,FROMDATE-.1,TODATE+.24,RECTYPE,RTSONLY,.LIST)
;
I RXCNT'>0 D Q
. W !!,"There are no eligible prescriptions for the date range.",$C(7)
. D PAUSE^PSOSPMU1
E W !!,RXCNT," prescription fill(s) found for the date range."
I '$D(^TMP("PSOSPMRX",$J)) Q
;
S PSOQUIT=0
I 'RTSONLY!$$GET1^DIQ(58.41,STATE,12,"I") D I PSOQUIT Q
. K DIR W ! S DIR("A",1)="These prescription fills will be transmitted to the state of "_$$GET1^DIQ(5,STATE,.01)_"."
. S DIR("A",2)="",DIR("A")="Confirm",DIR(0)="Y",DIR("B")="N"
. D ^DIR I $G(DIRUT)!$G(DUOUT)!'Y S PSOQUIT=1 Q
. W ?40,"Please wait..."
;
; Return To Stock fills only
I RTSONLY,'$$GET1^DIQ(58.41,STATE,12,"I") D D ^%ZIS K %ZIS Q:POP U IO
. D EXMSG^PSOSPML2(1) W ! K %ZIS,IOP,POP,ZTSK S %ZIS="QM"
;
; The ^TMP("PSOSPMRX",$J) returned above will be used to build the batch
S BATCHIEN=$$BLDBAT^PSOSPMU1($S('RTSONLY:"MA",1:"VD"),FROMDATE,TODATE)
I $P(BATCHIEN,"^")=-1 D Q
. W !!,$P(BATCHIEN,"^",2),$C(7) D PAUSE^PSOSPMU1
;
S PSOMODE="EXPORT" I RTSONLY,'$$GET1^DIQ(58.41,STATE,12,"I") S PSOMODE="VIEW"
D EXPORT^PSOSPMUT(BATCHIEN,PSOMODE)
;
I RTSONLY,'$$GET1^DIQ(58.41,STATE,12,"I") D
. D ^%ZISC N DIE,DA,DR S DIE="^PS(58.42,",DA=BATCHIEN
. S DR="6///<Manual Web Upload>7////"_DUZ_";9///"_$$NOW^XLFDT()
. D ^DIE
;
D PAUSE^PSOSPMU1
Q:'$G(VALMCC)
D INIT,HDR
Q
;
EXIT ;
K ^TMP("PSOSPML1",$J)
Q
;
HELP ; Listman HELP entry-point
Q
--- Routine Detail --- with STRUCTURED ROUTINE LISTING ---[H[J[2J[HPSOSPML1 7500 printed Dec 13, 2024@02:35:02 Page 2
PSOSPML1 ;BIRM/MFR - Export Batch Processing Listman Driver ;10/10/12
+1 ;;7.0;OUTPATIENT PHARMACY;**408,451,625**;DEC 1997;Build 42
+2 ;
+3 NEW %DT,BATIEN,DIR,DIRUT,X,DIC,DTOUT,DUOUT,STATEIEN,PSOFROM,PSOTO,VALM,VALMCNT,VALMHDR,VALMBCK,VALMSG,PSOLSTLN
+4 ;
STA ; STATE prompt
+1 KILL DIC
WRITE !
SET DIC("A")="STATE: "
SET DIC="^DIC(5,"
+2 SET STATEIEN=$ORDER(^PS(58.41,0))
if STATEIEN
SET DIC("B")=STATEIEN
+3 SET DIC(0)="AEQMZ"
DO ^DIC
IF X="^"!(Y<0)
GOTO EXIT
+4 IF +$$SPOK^PSOSPMUT(+Y)=-1
WRITE !!,$PIECE($$SPOK^PSOSPMUT(+Y),"^",2),$CHAR(7)
GOTO STA
+5 SET STATEIEN=+Y
+6 ;
+7 ; - Ask for FROM DATE
+8 SET %DT(0)=-DT
SET %DT="AEP"
SET %DT("A")="BATCH CREATED BEGIN DATE: "
+9 WRITE !
DO ^%DT
IF Y<0!($DATA(DTOUT))
GOTO EXIT
+10 SET PSOFROM=Y\1-.00001
+11 ;
+12 ; - Ask for TO DATE
+13 KILL %DT
SET %DT(0)=PSOFROM+1\1
SET %DT="AEP"
SET %DT("B")="TODAY"
SET %DT("A")="BATCH CREATED END DATE: "
+14 WRITE !
DO ^%DT
IF Y<0!($DATA(DTOUT))
GOTO EXIT
+15 SET PSOTO=Y\1+.99999
+16 ;
+17 DO EN(STATEIEN,PSOFROM,PSOTO)
+18 ;
+19 GOTO EXIT
+20 ;
EN(STATEIEN,PSOFROM,PSOTO) ; Entry point
+1 DO EN^VALM("PSO SPMP BATCH PROCESSING")
+2 DO FULL^VALM1
+3 QUIT
+4 ;
HDR ; - Builds the Header section
+1 KILL VALMHDR
+2 SET VALMHDR(1)="State: "_$$GET1^DIQ(5,STATEIEN,.01)
+3 SET $EXTRACT(VALMHDR(1),40)="Date Range: "_$$FMTE^XLFDT(PSOFROM+1\1,2)_" - "_$$FMTE^XLFDT(PSOTO\1,2)
+4 DO SETHDR()
+5 QUIT
+6 ;
SETHDR() ; - Displays the Header Line
+1 NEW HDR,ORD,POS
+2 ;
+3 SET HDR=" #"
SET $EXTRACT(HDR,7)="BATCH#"
SET $EXTRACT(HDR,15)="DATE/TIME CREATED"
SET $EXTRACT(HDR,34)="REL. DATE RANGE"
+4 SET $EXTRACT(HDR,54)="TYPE"
SET $EXTRACT(HDR,66)="Rx's"
SET $EXTRACT(HDR,72)="EXPORTED?"
+5 SET $EXTRACT(HDR,81)=""
DO INSTR^VALM1(IORVON_HDR_IOINORM,1,3)
+6 QUIT
+7 ;
INIT ; Builds the Body section
+1 NEW RXCNT,BATDT,I,LINE,TYPE,NODE0,RX,COUNT,DRUGIEN,DRUGNAM,DRUGDEA,DSPLINE,FILL
+2 ;
+3 KILL ^TMP("PSOSPML1",$JOB)
SET (VALMCNT,LINE,RXCNT,COUNT,PSOLSTLN)=0
+4 SET BATDT=PSOFROM
SET BATIEN=0
+5 FOR
SET BATDT=$ORDER(^PS(58.42,"AD",BATDT))
if 'BATDT!(BATDT>PSOTO)
QUIT
Begin DoDot:1
+6 FOR
SET BATIEN=$ORDER(^PS(58.42,"AD",BATDT,BATIEN))
if 'BATIEN
QUIT
Begin DoDot:2
+7 SET NODE0=$GET(^PS(58.42,BATIEN,0))
+8 IF $PIECE(NODE0,"^",2)'=STATEIEN
QUIT
+9 SET COUNT=COUNT+1
SET RXCNT=$ORDER(^PS(58.42,BATIEN,"RX",999999),-1)
+10 ;Display '0' for # of RXs for Zero Report
if '$GET(RXCNT)
SET RXCNT=0
+11 SET DSPLINE=$JUSTIFY(COUNT,4)_" "_$JUSTIFY(BATIEN,7)
SET $EXTRACT(DSPLINE,15)=$$FMTE^XLFDT(BATDT,"2Z")
+12 SET $EXTRACT(DSPLINE,34)=$$FMTE^XLFDT($PIECE(NODE0,"^",5)\1,"2Z")_"-"_$$FMTE^XLFDT($PIECE(NODE0,"^",6)\1,"2Z")
+13 IF $PIECE(NODE0,"^",3)="RX"
SET $EXTRACT(DSPLINE,34,51)="SINGLE RX "
+14 IF $PIECE(NODE0,"^",3)="VD"
IF '$PIECE(NODE0,"^",5)
SET $EXTRACT(DSPLINE,34,51)="SINGLE RX "
+15 SET $EXTRACT(DSPLINE,54)=$$GET1^DIQ(58.42,BATIEN,2)
+16 SET $EXTRACT(DSPLINE,66)=$JUSTIFY(RXCNT,4)
SET $EXTRACT(DSPLINE,72)=$SELECT($$GET1^DIQ(58.42,BATIEN,9,"I"):"YES",1:"NO")
+17 DO SETLN^PSOSPMU1("PSOSPML1",DSPLINE,0,0,0)
+18 SET ^TMP("PSOSPML1",$JOB,LINE,"BAT")=BATIEN
End DoDot:2
End DoDot:1
+19 IF '$DATA(^TMP("PSOSPML1",$JOB))
Begin DoDot:1
+20 DO SETLN^PSOSPMU1("PSOSPML1","There are no export batches created within the date range selected.",0,0,0)
End DoDot:1
+21 SET VALMCNT=LINE
+22 QUIT
+23 ;
SEL ;Process selection of one entry
+1 NEW PSOSEL,XQORM,ORD,PSOTITLE,PSOLIS,XX,BAT
+2 SET PSOSEL=+$PIECE(XQORNOD(0),"=",2)
IF 'PSOSEL
SET VALMSG="Invalid selection!"
SET VALMBCK="R"
QUIT
+3 SET BAT=+$GET(^TMP("PSOSPML1",$JOB,PSOSEL,"BAT"))
+4 IF 'BAT
SET VALMSG="Invalid selection!"
SET VALMBCK="R"
QUIT
+5 SET PSOTITLE=VALM("TITLE")
+6 WRITE ?50,"Please wait..."
+7 ; Do used to preserve a few variables that could get overwritten
Begin DoDot:1
+8 NEW LINE,PSOTITLE,PSOFROM,PSOTO
DO EN^PSOSPML2(BAT)
End DoDot:1
+9 SET VALMBCK="R"
SET VALM("TITLE")=$GET(PSOTITLE)
+10 DO INIT
+11 QUIT
+12 ;
MAN ; Manual Batch Export
+1 DO FULL^VALM1
SET VALMBCK="R"
+2 NEW %DT,DIR,DIRUT,X,DIC,DTOUT,DUOUT,BEGINDT,PSOBGDT,ENDDT,PSOENDDT,PSOERROR,SPOK
+3 NEW RECTYPE,STATE,PSOQUIT,FILLTYPE
+4 ;
+5 KILL DIC
WRITE !
SET DIC("A")="STATE: "
SET DIC("S")="I $D(^PS(58.41,+Y,0))"
SET DIC="^DIC(5,"
+6 if $GET(STATEIEN)
SET DIC("B")=STATEIEN
+7 SET DIC(0)="AEQMZ"
DO ^DIC
IF X="^"!(Y<0)
GOTO EXIT
+8 SET STATE=+Y
+9 ;
+10 ; - Ask for FROM DATE
+11 ; Note: The legislation allowing VA to report was published on 02/11/2013
+12 SET %DT(0)=3130211
SET %DT="AEP"
SET %DT("A")="EXPORT BEGIN DATE: "
+13 WRITE !
DO ^%DT
IF Y<0!($DATA(DTOUT))
QUIT
+14 SET BEGINDT=Y
+15 ;
+16 ; - Ask for TO DATE
+17 KILL %DT
SET %DT(0)=BEGINDT\1
SET %DT="AEP"
SET %DT("B")="TODAY"
SET %DT("A")="EXPORT END DATE: "
+18 WRITE !
DO ^%DT
IF Y<0!($DATA(DTOUT))
QUIT
+19 SET ENDDT=Y
+20 ;
+21 SET PSOQUIT=0
SET FILLTYPE=""
+22 IF $$GET1^DIQ(58.41,STATE,1,"I")="1995"
Begin DoDot:1
+23 KILL DIR
SET DIR("A")="Rx Fill Type"
+24 SET DIR("L",1)="Enter the Prescription Fill Type:"
+25 SET DIR("L",2)=" "
+26 SET DIR(0)="S^RL:RELEASED;RS:RETURNED TO STOCK"
+27 SET DIR("L",3)=" RL RELEASED"
+28 SET DIR("L")=" RS RETURNED TO STOCK"
+29 SET DIR("B")="RL"
DO ^DIR
IF $DATA(DUOUT)!($DATA(DIRUT))
KILL DIRUT,DUOUT,DIR
SET PSOQUIT=1
QUIT
+30 SET FILLTYPE=Y
End DoDot:1
IF PSOQUIT
QUIT
+31 ;
+32 SET PSOQUIT=0
SET RECTYPE="N"
+33 IF FILLTYPE'="RS"
Begin DoDot:1
+34 KILL DIR
SET DIR("A")="Record Type"
+35 SET DIR("L",1)="Enter the type of record to be sent for released prescription fills:"
+36 SET DIR("L",2)=" "
+37 SET DIR(0)="S^N:NEW;R:REVISE"
+38 SET DIR("L",3)=" N NEW"
+39 SET DIR("L")=" R REVISE"
+40 SET DIR("B")="NEW"
DO ^DIR
IF $DATA(DUOUT)!($DATA(DIRUT))
KILL DIRUT,DUOUT,DIR
SET PSOQUIT=1
QUIT
+41 SET RECTYPE=Y
End DoDot:1
IF PSOQUIT
QUIT
+42 ;
+43 DO EXPORT(STATE,BEGINDT,ENDDT,FILLTYPE,RECTYPE)
+44 QUIT
+45 ;
EXPORT(STATE,FROMDATE,TODATE,FILLTYPE,RECTYPE,LIST) ; Export Release CS Rx's to the sate for date range
+1 ;Input: STATE - Pointer to the STATE file (#5)
+2 ; FROMDATE - Being Rx Release for Date Range
+3 ; TODATE - End Rx Release for Date Range
+4 ; FILLTYPE - Rx Fill Type (RL - Released / RS - Returned to Stock) - ASAP 1995 only
+5 ; RECTYPE - Record Type (N - New / R - Revise)
+6 ; LIST - array of IENs that represent PATIENT, DIVISION, PROVIDER, DRUG, or RX
+7 NEW RXRLDT,ENDRLDT,XREF,RXCNT,RXIEN,RXFILL,FILL,SPOK,DIR,Y,X,DTOUT,DUOUT,BATCHIEN
+8 NEW RTSDT,ENDRTSDT,RTSONLY,PSOMODE
+9 ;
+10 SET SPOK=$$SPOK^PSOSPMUT(STATE)
+11 IF $PIECE(SPOK,"^")=-1
Begin DoDot:1
+12 WRITE !!,$PIECE(SPOK,"^",2),$CHAR(7)
DO PAUSE^PSOSPMU1
QUIT
End DoDot:1
QUIT
+13 ;
+14 ; The legislation allowing VA to report was published on 02/11/2013
+15 IF FROMDATE<3130211
SET FROMDATE=3130211
+16 ;
+17 ; ASAP 1995 ONLY
+18 SET RTSONLY=0
IF $$GET1^DIQ(58.41,STATE,1,"I")="1995"
IF FILLTYPE="RS"
SET RTSONLY=1
+19 ;
+20 ; Gathering the prescriptions to be transmitted in the ^TMP("PSOSPMRX",$J) global
+21 WRITE !!,"Gathering CS prescription fills...(this may take a few minutes)"
+22 KILL ^TMP("PSOSPMRX",$JOB)
SET RXCNT=$$GATHER^PSOSPMU1(STATE,FROMDATE-.1,TODATE+.24,RECTYPE,RTSONLY,.LIST)
+23 ;
+24 IF RXCNT'>0
Begin DoDot:1
+25 WRITE !!,"There are no eligible prescriptions for the date range.",$CHAR(7)
+26 DO PAUSE^PSOSPMU1
End DoDot:1
QUIT
+27 IF '$TEST
WRITE !!,RXCNT," prescription fill(s) found for the date range."
+28 IF '$DATA(^TMP("PSOSPMRX",$JOB))
QUIT
+29 ;
+30 SET PSOQUIT=0
+31 IF 'RTSONLY!$$GET1^DIQ(58.41,STATE,12,"I")
Begin DoDot:1
+32 KILL DIR
WRITE !
SET DIR("A",1)="These prescription fills will be transmitted to the state of "_$$GET1^DIQ(5,STATE,.01)_"."
+33 SET DIR("A",2)=""
SET DIR("A")="Confirm"
SET DIR(0)="Y"
SET DIR("B")="N"
+34 DO ^DIR
IF $GET(DIRUT)!$GET(DUOUT)!'Y
SET PSOQUIT=1
QUIT
+35 WRITE ?40,"Please wait..."
End DoDot:1
IF PSOQUIT
QUIT
+36 ;
+37 ; Return To Stock fills only
+38 IF RTSONLY
IF '$$GET1^DIQ(58.41,STATE,12,"I")
Begin DoDot:1
+39 DO EXMSG^PSOSPML2(1)
WRITE !
KILL %ZIS,IOP,POP,ZTSK
SET %ZIS="QM"
End DoDot:1
DO ^%ZIS
KILL %ZIS
if POP
QUIT
USE IO
+40 ;
+41 ; The ^TMP("PSOSPMRX",$J) returned above will be used to build the batch
+42 SET BATCHIEN=$$BLDBAT^PSOSPMU1($SELECT('RTSONLY:"MA",1:"VD"),FROMDATE,TODATE)
+43 IF $PIECE(BATCHIEN,"^")=-1
Begin DoDot:1
+44 WRITE !!,$PIECE(BATCHIEN,"^",2),$CHAR(7)
DO PAUSE^PSOSPMU1
End DoDot:1
QUIT
+45 ;
+46 SET PSOMODE="EXPORT"
IF RTSONLY
IF '$$GET1^DIQ(58.41,STATE,12,"I")
SET PSOMODE="VIEW"
+47 DO EXPORT^PSOSPMUT(BATCHIEN,PSOMODE)
+48 ;
+49 IF RTSONLY
IF '$$GET1^DIQ(58.41,STATE,12,"I")
Begin DoDot:1
+50 DO ^%ZISC
NEW DIE,DA,DR
SET DIE="^PS(58.42,"
SET DA=BATCHIEN
+51 SET DR="6///<Manual Web Upload>7////"_DUZ_";9///"_$$NOW^XLFDT()
+52 DO ^DIE
End DoDot:1
+53 ;
+54 DO PAUSE^PSOSPMU1
+55 if '$GET(VALMCC)
QUIT
+56 DO INIT
DO HDR
+57 QUIT
+58 ;
EXIT ;
+1 KILL ^TMP("PSOSPML1",$JOB)
+2 QUIT
+3 ;
HELP ; Listman HELP entry-point
+1 QUIT