DVBAB54 ;ALB/VM - CAPRI ADMISSION REPORT ; 3/5/12 11:31am
;;2.7;AMIE;**35,149,179,185**;Apr 10, 1995;Build 18
;Per VHA Directive 2004-038, this routine should not be modified.
;
;Input: ZMSG - Output Array for SC Veteran Admission report (By Ref)
; BDATE - Beginning date for eport (FM Format)
; EDATE - Ending date for report (FM Format)
; DVBADLMTR - Indicates if report should be delimited (Optional)
; CAPRI currently executes RPC by each day in
; date range, so DVBADLMTR should equal the
; final EDATE in range so that XTMP global
; can be killed.
;Output: ^TMP("DVBAR",$J) contains delimited/non-delimited SC Veteran Admission report
STRT(ZMSG,BDATE,EDATE,DVBADLMTR) ;ENTER HERE
N DVBAFNLDTE,MA1,DVBATMP
S DVBABCNT=0,RO="N",RONUM=0
S DVBAFNLDTE=$S(+$G(DVBADLMTR):+$P(DVBADLMTR,"."),1:0)
S DVBADLMTR=$S('+$G(DVBADLMTR):"",1:"^")
K ^TMP($J) G TERM
SET Q:'$D(^DPT(DA,0)) S DFN=DA,DVBASC="" D SC^DVBAVDPT Q:DVBASC'="Y" Q:CFLOC'=RONUM&(RO="Y")&(CFLOC'=0)&(CFLOC'=376) S MA1=$P(MA,".",1),^TMP($J,MA1,XCN,CFLOC,MB,DA)=MA
Q
;
PRINTB S ADMDT=$P(DATA,U),DFN=DA D ADM^DVBAVDPT
;W:(IOST?1"C-".E)!($D(DVBAON2)) @IOF
;W !!!,?(80-$L(HEAD)\2),HEAD,!,?(80-$L(HEAD1)\2),HEAD1,!!
S:ADMDT]"" ADMDT=$E(ADMDT,4,5)_"/"_$E(ADMDT,6,7)_"/"_$E(ADMDT,2,3) S:DCHGDT]"" DCHGDT=$E(DCHGDT,4,5)_"/"_$E(DCHGDT,6,7)_"/"_$E(DCHGDT,2,3)
;create delimited/non-delimited report
D:($G(DVBADLMTR)'="") PRINTD
D:($G(DVBADLMTR)="") PRINTND
S DVBAON2=""
Q
;
PRINTND ;create non-delimited admission report
S ^TMP("DVBAR",$J,DVBABCNT)="",DVBABCNT=DVBABCNT+1
S ^TMP("DVBAR",$J,DVBABCNT)="",DVBABCNT=DVBABCNT+1
S ^TMP("DVBAR",$J,DVBABCNT)=" Patient Name: "_PNAM,DVBABCNT=DVBABCNT+1
S ^TMP("DVBAR",$J,DVBABCNT)=" Claim No: "_CNUM,DVBABCNT=DVBABCNT+1
S ^TMP("DVBAR",$J,DVBABCNT)=" Claim Folder Loc: "_CFLOC,DVBABCNT=DVBABCNT+1
S ^TMP("DVBAR",$J,DVBABCNT)=" Social Sec No: "_SSN,DVBABCNT=DVBABCNT+1
S ^TMP("DVBAR",$J,DVBABCNT)=" Admission Date: "_ADMDT,DVBABCNT=DVBABCNT+1
S ^TMP("DVBAR",$J,DVBABCNT)=" Admitting Diagnosis: "_DIAG,DVBABCNT=DVBABCNT+1
S ^TMP("DVBAR",$J,DVBABCNT)=" Discharge Date: "_DCHGDT,DVBABCNT=DVBABCNT+1
S ^TMP("DVBAR",$J,DVBABCNT)=" Bed Service: "_BEDSEC,DVBABCNT=DVBABCNT+1
S ^TMP("DVBAR",$J,DVBABCNT)=" Recv A&A?: "_$S(RCVAA=0:"NO",RCVAA=1:"YES",1:"Not specified"),DVBABCNT=DVBABCNT+1
S ^TMP("DVBAR",$J,DVBABCNT)=" Pension?: "_$S(RCVPEN=0:"NO",RCVPEN=1:"YES",1:"Not specified"),DVBABCNT=DVBABCNT+1
;D ELIG^DVBAVDPT
ELIG S ELIG=DVBAELIG,INCMP=""
I ELIG]"" S ELIG=ELIG_" ("_$S(DVBAELST="P":"Pend Ver",DVBAELST="R":"Pend Re-verif",DVBAELST="V":"Verified",1:"Not Verified")_")"
I $D(^DPT(DA,.29)) S INCMP=$S($P(^(.29),U,12)=1:"Incompetent",1:"")
S ^TMP("DVBAR",$J,DVBABCNT)=" Eligibility data: "_ELIG_$S(((ELIG]"")&(INCMP]"")):", ",1:""),DVBABCNT=DVBABCNT+1
I $X>60 S ^TMP("DVBAR",$J,DVBABCNT)=INCMP,DVBABCNT=DVBABCNT+1
;Q
;***VM-OUT*I IOST?1"C-".E W *7,!,"Press RETURN to continue or ""^"" to stop " R ANS:DTIME S:ANS=U!('$T) QUIT=1 I '$T S DVBAQUIT=1
Q
;
PRINTD ;create delimited admission report
N ELIG,INCMP,X,X1,X2,X3
D:('$D(^XTMP("DVBA_SCADMSSN_RPT"_$J,0))) COLHDR
S ^TMP("DVBAR",$J,DVBABCNT)=PNAM_DVBADLMTR_CNUM_DVBADLMTR_CFLOC_DVBADLMTR_SSN_DVBADLMTR_ADMDT_DVBADLMTR
S ^TMP("DVBAR",$J,DVBABCNT)=^TMP("DVBAR",$J,DVBABCNT)_DIAG_DVBADLMTR_DCHGDT_DVBADLMTR_BEDSEC_DVBADLMTR
S ^TMP("DVBAR",$J,DVBABCNT)=^TMP("DVBAR",$J,DVBABCNT)_$S(RCVAA=0:"NO",RCVAA=1:"YES",1:"Not specified")_DVBADLMTR
S ^TMP("DVBAR",$J,DVBABCNT)=^TMP("DVBAR",$J,DVBABCNT)_$S(RCVPEN=0:"NO",RCVPEN=1:"YES",1:"Not specified")_DVBADLMTR
S ELIG=DVBAELIG,INCMP=""
I ELIG]"" S ELIG=ELIG_" ("_$S(DVBAELST="P":"Pend Ver",DVBAELST="R":"Pend Re-verif",DVBAELST="V":"Verified",1:"Not Verified")_")"
I $D(^DPT(DA,.29)) S INCMP=$S($P(^(.29),U,12)=1:"Incompetent",1:"")
S ^TMP("DVBAR",$J,DVBABCNT)=^TMP("DVBAR",$J,DVBABCNT)_ELIG_$S(((ELIG]"")&(INCMP]"")):", ",1:"")_INCMP
;
S DVBATMP=^TMP("DVBAR",$J,DVBABCNT)
S X=$P(DVBATMP,DVBADLMTR,4)
I $L(X)'>9 S X=""""_$E("000000000",1,9-$L(X))_X_"""",X1=$E(X,1,4),X2=$E(X,5,6),X3=$E(X,7,11),X=X1_"-"_X2_"-"_X3
I $E(X,10,10)'?.N S X=""""_$E("0000000000",1,10-$L(X))_X_"""",X1=$E(X,1,4),X2=$E(X,5,6),X3=$E(X,7,12),X=X1_"-"_X2_"-"_X3
S $P(DVBATMP,DVBADLMTR,4)=X
S X=$P(DVBATMP,DVBADLMTR,2)
S X=$C(160)_X
S $P(DVBATMP,DVBADLMTR,2)=X
F I=1:1:$L(DVBATMP,DVBADLMTR) I $P(DVBATMP,DVBADLMTR,I)["," S $P(DVBATMP,DVBADLMTR,I)=""""_$P(DVBATMP,DVBADLMTR,I)_""""
S DVBATMP=$TR(DVBATMP,DVBADLMTR,",")
S ^TMP("DVBAR",$J,DVBABCNT)=DVBATMP
;
S DVBABCNT=DVBABCNT+1
Q
;
PRINT K MA S QUIT=""
S MA="" F G=0:0 S MA=$O(^TMP($J,MA)) Q:MA=""!(QUIT=1) S XCN="" F M=0:0 S XCN=$O(^TMP($J,MA,XCN)) Q:XCN=""!(QUIT=1) S CFLOC="" F J=0:0 S CFLOC=$O(^TMP($J,MA,XCN,CFLOC)) Q:CFLOC=""!(QUIT=1) D PRINT1
Q
PRINT1 S ADM="" F K=0:0 S ADM=$O(^TMP($J,MA,XCN,CFLOC,ADM)) Q:ADM=""!(QUIT=1) S DA="" F L=0:0 S DA=$O(^TMP($J,MA,XCN,CFLOC,ADM,DA)) Q:DA=""!(QUIT=1) S DATA=^(DA) D PRINTB
Q
;
TERM ;D HOME^%ZIS K NOASK
;
;W @IOF,!,"VARO SERVICE-CONNECTED ADMISSION REPORT" D NOPARM^DVBAUTL2 G:$D(DVBAQUIT) KILL^DVBAUTIL
S DTAR=^DVB(396.1,1,0),FDT(0)=$E(DT,4,5)_"-"_$E(DT,6,7)_"-"_$E(DT,2,3)
S HEAD="SERVICE-CONNECTED ADMISSION REPORT",HEAD1="FOR "_$P(DTAR,U,1)_" ON "_FDT(0)
;W !,HEAD1
;W !!,"Please enter dates for search, oldest date first, most recent date last.",!!,"Last report was run on " S Y=$P(DTAR,U,8) X ^DD("DD") W Y,!!
;D DATE^DVBAUTIL
;G:X=""!(Y<0) KILL
;S %ZIS="Q" D ^%ZIS K %ZIS G:POP KILL^DVBAUTIL
;
;I $D(IO("Q")) S ZTRTN="DEQUE^DVBASCRP",ZTIO=ION,NOASK=1,ZTDESC="AMIE SC ADMISSION REPORT" F I="FDT(0)","HEAD","HEAD1","BDATE","EDATE","TYPE","RO","RONUM","NOASK" S ZTSAVE(I)=""
;I $D(IO("Q")) D ^%ZTLOAD W:$D(ZTSK) !!,"Request queued.",!! G KILL
;
GO S MA=BDATE F J=0:0 S MA=$O(^DGPM("AMV1",MA)) Q:$P(MA,".")>EDATE!(MA="") F DA=0:0 S DA=$O(^DGPM("AMV1",MA,DA)) Q:DA="" F MB=0:0 S MB=$O(^DGPM("AMV1",MA,DA,MB)) Q:MB="" D SET W:'$D(NOASK) "."
I '$D(^TMP($J)) S ^TMP("DVBAR",$J,DVBABCNT)="No data found for parameters entered." H 2 G KILL
D PRINT K:(DVBAFNLDTE=$P(EDATE,".")) ^XTMP("DVBA_SCADMSSN_RPT"_$J,0)
I $D(DVBAQUIT) K DVBAON2 D:$D(ZTQUEUED) KILL^%ZTLOAD G KILL^DVBAUTIL
;
KILL K:(DVBAFNLDTE=$P(EDATE,".")) ^XTMP("DVBA_SCADMSSN_RPT"_$J,0)
S ZMSG=$NA(^TMP("DVBAR",$J))
D:$D(ZTQUEUED) KILL^%ZTLOAD D ^%ZISC S X=8 K DVBAON2 G FINAL^DVBAUTIL
;
DEQUE K ^TMP($J) G GO
;
COLHDR ;Column header for delimited report
N DVBADLMTR
S DVBADLMTR=","
S ^TMP("DVBAR",$J,DVBABCNT)="Patient Name"_DVBADLMTR_"Claim No"_DVBADLMTR_"Claim Folder Loc"_DVBADLMTR
S ^TMP("DVBAR",$J,DVBABCNT)=(^TMP("DVBAR",$J,DVBABCNT))_"Social Sec No"_DVBADLMTR_"Admission Date"_DVBADLMTR
S ^TMP("DVBAR",$J,DVBABCNT)=(^TMP("DVBAR",$J,DVBABCNT))_"Admitting Diagnosis"_DVBADLMTR_"Discharge Date"_DVBADLMTR
S ^TMP("DVBAR",$J,DVBABCNT)=(^TMP("DVBAR",$J,DVBABCNT))_"Bed Service"_DVBADLMTR_"Recv A&A?"_DVBADLMTR
S ^TMP("DVBAR",$J,DVBABCNT)=(^TMP("DVBAR",$J,DVBABCNT))_"Pension?"_DVBADLMTR_"Eligibility Data"
S DVBABCNT=DVBABCNT+1
;set global entry so header is only created once for job ($J)
S ^XTMP("DVBA_SCADMSSN_RPT"_$J,0)=DT_U_DT
Q
--- Routine Detail --- with STRUCTURED ROUTINE LISTING ---[H[J[2J[HDVBAB54 7404 printed Nov 22, 2024@16:50:41 Page 2
DVBAB54 ;ALB/VM - CAPRI ADMISSION REPORT ; 3/5/12 11:31am
+1 ;;2.7;AMIE;**35,149,179,185**;Apr 10, 1995;Build 18
+2 ;Per VHA Directive 2004-038, this routine should not be modified.
+3 ;
+4 ;Input: ZMSG - Output Array for SC Veteran Admission report (By Ref)
+5 ; BDATE - Beginning date for eport (FM Format)
+6 ; EDATE - Ending date for report (FM Format)
+7 ; DVBADLMTR - Indicates if report should be delimited (Optional)
+8 ; CAPRI currently executes RPC by each day in
+9 ; date range, so DVBADLMTR should equal the
+10 ; final EDATE in range so that XTMP global
+11 ; can be killed.
+12 ;Output: ^TMP("DVBAR",$J) contains delimited/non-delimited SC Veteran Admission report
STRT(ZMSG,BDATE,EDATE,DVBADLMTR) ;ENTER HERE
+1 NEW DVBAFNLDTE,MA1,DVBATMP
+2 SET DVBABCNT=0
SET RO="N"
SET RONUM=0
+3 SET DVBAFNLDTE=$SELECT(+$GET(DVBADLMTR):+$PIECE(DVBADLMTR,"."),1:0)
+4 SET DVBADLMTR=$SELECT('+$GET(DVBADLMTR):"",1:"^")
+5 KILL ^TMP($JOB)
GOTO TERM
SET if '$DATA(^DPT(DA,0))
QUIT
SET DFN=DA
SET DVBASC=""
DO SC^DVBAVDPT
if DVBASC'="Y"
QUIT
if CFLOC'=RONUM&(RO="Y")&(CFLOC'=0)&(CFLOC'=376)
QUIT
SET MA1=$PIECE(MA,".",1)
SET ^TMP($JOB,MA1,XCN,CFLOC,MB,DA)=MA
+1 QUIT
+2 ;
PRINTB SET ADMDT=$PIECE(DATA,U)
SET DFN=DA
DO ADM^DVBAVDPT
+1 ;W:(IOST?1"C-".E)!($D(DVBAON2)) @IOF
+2 ;W !!!,?(80-$L(HEAD)\2),HEAD,!,?(80-$L(HEAD1)\2),HEAD1,!!
+3 if ADMDT]""
SET ADMDT=$EXTRACT(ADMDT,4,5)_"/"_$EXTRACT(ADMDT,6,7)_"/"_$EXTRACT(ADMDT,2,3)
if DCHGDT]""
SET DCHGDT=$EXTRACT(DCHGDT,4,5)_"/"_$EXTRACT(DCHGDT,6,7)_"/"_$EXTRACT(DCHGDT,2,3)
+4 ;create delimited/non-delimited report
+5 if ($GET(DVBADLMTR)'="")
DO PRINTD
+6 if ($GET(DVBADLMTR)="")
DO PRINTND
+7 SET DVBAON2=""
+8 QUIT
+9 ;
PRINTND ;create non-delimited admission report
+1 SET ^TMP("DVBAR",$JOB,DVBABCNT)=""
SET DVBABCNT=DVBABCNT+1
+2 SET ^TMP("DVBAR",$JOB,DVBABCNT)=""
SET DVBABCNT=DVBABCNT+1
+3 SET ^TMP("DVBAR",$JOB,DVBABCNT)=" Patient Name: "_PNAM
SET DVBABCNT=DVBABCNT+1
+4 SET ^TMP("DVBAR",$JOB,DVBABCNT)=" Claim No: "_CNUM
SET DVBABCNT=DVBABCNT+1
+5 SET ^TMP("DVBAR",$JOB,DVBABCNT)=" Claim Folder Loc: "_CFLOC
SET DVBABCNT=DVBABCNT+1
+6 SET ^TMP("DVBAR",$JOB,DVBABCNT)=" Social Sec No: "_SSN
SET DVBABCNT=DVBABCNT+1
+7 SET ^TMP("DVBAR",$JOB,DVBABCNT)=" Admission Date: "_ADMDT
SET DVBABCNT=DVBABCNT+1
+8 SET ^TMP("DVBAR",$JOB,DVBABCNT)=" Admitting Diagnosis: "_DIAG
SET DVBABCNT=DVBABCNT+1
+9 SET ^TMP("DVBAR",$JOB,DVBABCNT)=" Discharge Date: "_DCHGDT
SET DVBABCNT=DVBABCNT+1
+10 SET ^TMP("DVBAR",$JOB,DVBABCNT)=" Bed Service: "_BEDSEC
SET DVBABCNT=DVBABCNT+1
+11 SET ^TMP("DVBAR",$JOB,DVBABCNT)=" Recv A&A?: "_$SELECT(RCVAA=0:"NO",RCVAA=1:"YES",1:"Not specified")
SET DVBABCNT=DVBABCNT+1
+12 SET ^TMP("DVBAR",$JOB,DVBABCNT)=" Pension?: "_$SELECT(RCVPEN=0:"NO",RCVPEN=1:"YES",1:"Not specified")
SET DVBABCNT=DVBABCNT+1
+13 ;D ELIG^DVBAVDPT
ELIG SET ELIG=DVBAELIG
SET INCMP=""
+1 IF ELIG]""
SET ELIG=ELIG_" ("_$SELECT(DVBAELST="P":"Pend Ver",DVBAELST="R":"Pend Re-verif",DVBAELST="V":"Verified",1:"Not Verified")_")"
+2 IF $DATA(^DPT(DA,.29))
SET INCMP=$SELECT($PIECE(^(.29),U,12)=1:"Incompetent",1:"")
+3 SET ^TMP("DVBAR",$JOB,DVBABCNT)=" Eligibility data: "_ELIG_$SELECT(((ELIG]"")&(INCMP]"")):", ",1:"")
SET DVBABCNT=DVBABCNT+1
+4 IF $X>60
SET ^TMP("DVBAR",$JOB,DVBABCNT)=INCMP
SET DVBABCNT=DVBABCNT+1
+5 ;Q
+6 ;***VM-OUT*I IOST?1"C-".E W *7,!,"Press RETURN to continue or ""^"" to stop " R ANS:DTIME S:ANS=U!('$T) QUIT=1 I '$T S DVBAQUIT=1
+7 QUIT
+8 ;
PRINTD ;create delimited admission report
+1 NEW ELIG,INCMP,X,X1,X2,X3
+2 if ('$DATA(^XTMP("DVBA_SCADMSSN_RPT"_$JOB,0)))
DO COLHDR
+3 SET ^TMP("DVBAR",$JOB,DVBABCNT)=PNAM_DVBADLMTR_CNUM_DVBADLMTR_CFLOC_DVBADLMTR_SSN_DVBADLMTR_ADMDT_DVBADLMTR
+4 SET ^TMP("DVBAR",$JOB,DVBABCNT)=^TMP("DVBAR",$JOB,DVBABCNT)_DIAG_DVBADLMTR_DCHGDT_DVBADLMTR_BEDSEC_DVBADLMTR
+5 SET ^TMP("DVBAR",$JOB,DVBABCNT)=^TMP("DVBAR",$JOB,DVBABCNT)_$SELECT(RCVAA=0:"NO",RCVAA=1:"YES",1:"Not specified")_DVBADLMTR
+6 SET ^TMP("DVBAR",$JOB,DVBABCNT)=^TMP("DVBAR",$JOB,DVBABCNT)_$SELECT(RCVPEN=0:"NO",RCVPEN=1:"YES",1:"Not specified")_DVBADLMTR
+7 SET ELIG=DVBAELIG
SET INCMP=""
+8 IF ELIG]""
SET ELIG=ELIG_" ("_$SELECT(DVBAELST="P":"Pend Ver",DVBAELST="R":"Pend Re-verif",DVBAELST="V":"Verified",1:"Not Verified")_")"
+9 IF $DATA(^DPT(DA,.29))
SET INCMP=$SELECT($PIECE(^(.29),U,12)=1:"Incompetent",1:"")
+10 SET ^TMP("DVBAR",$JOB,DVBABCNT)=^TMP("DVBAR",$JOB,DVBABCNT)_ELIG_$SELECT(((ELIG]"")&(INCMP]"")):", ",1:"")_INCMP
+11 ;
+12 SET DVBATMP=^TMP("DVBAR",$JOB,DVBABCNT)
+13 SET X=$PIECE(DVBATMP,DVBADLMTR,4)
+14 IF $LENGTH(X)'>9
SET X=""""_$EXTRACT("000000000",1,9-$LENGTH(X))_X_""""
SET X1=$EXTRACT(X,1,4)
SET X2=$EXTRACT(X,5,6)
SET X3=$EXTRACT(X,7,11)
SET X=X1_"-"_X2_"-"_X3
+15 IF $EXTRACT(X,10,10)'?.N
SET X=""""_$EXTRACT("0000000000",1,10-$LENGTH(X))_X_""""
SET X1=$EXTRACT(X,1,4)
SET X2=$EXTRACT(X,5,6)
SET X3=$EXTRACT(X,7,12)
SET X=X1_"-"_X2_"-"_X3
+16 SET $PIECE(DVBATMP,DVBADLMTR,4)=X
+17 SET X=$PIECE(DVBATMP,DVBADLMTR,2)
+18 SET X=$CHAR(160)_X
+19 SET $PIECE(DVBATMP,DVBADLMTR,2)=X
+20 FOR I=1:1:$LENGTH(DVBATMP,DVBADLMTR)
IF $PIECE(DVBATMP,DVBADLMTR,I)[","
SET $PIECE(DVBATMP,DVBADLMTR,I)=""""_$PIECE(DVBATMP,DVBADLMTR,I)_""""
+21 SET DVBATMP=$TRANSLATE(DVBATMP,DVBADLMTR,",")
+22 SET ^TMP("DVBAR",$JOB,DVBABCNT)=DVBATMP
+23 ;
+24 SET DVBABCNT=DVBABCNT+1
+25 QUIT
+26 ;
PRINT KILL MA
SET QUIT=""
+1 SET MA=""
FOR G=0:0
SET MA=$ORDER(^TMP($JOB,MA))
if MA=""!(QUIT=1)
QUIT
SET XCN=""
FOR M=0:0
SET XCN=$ORDER(^TMP($JOB,MA,XCN))
if XCN=""!(QUIT=1)
QUIT
SET CFLOC=""
FOR J=0:0
SET CFLOC=$ORDER(^TMP($JOB,MA,XCN,CFLOC))
if CFLOC=""!(QUIT=1)
QUIT
DO PRINT1
+2 QUIT
PRINT1 SET ADM=""
FOR K=0:0
SET ADM=$ORDER(^TMP($JOB,MA,XCN,CFLOC,ADM))
if ADM=""!(QUIT=1)
QUIT
SET DA=""
FOR L=0:0
SET DA=$ORDER(^TMP($JOB,MA,XCN,CFLOC,ADM,DA))
if DA=""!(QUIT=1)
QUIT
SET DATA=^(DA)
DO PRINTB
+1 QUIT
+2 ;
TERM ;D HOME^%ZIS K NOASK
+1 ;
+2 ;W @IOF,!,"VARO SERVICE-CONNECTED ADMISSION REPORT" D NOPARM^DVBAUTL2 G:$D(DVBAQUIT) KILL^DVBAUTIL
+3 SET DTAR=^DVB(396.1,1,0)
SET FDT(0)=$EXTRACT(DT,4,5)_"-"_$EXTRACT(DT,6,7)_"-"_$EXTRACT(DT,2,3)
+4 SET HEAD="SERVICE-CONNECTED ADMISSION REPORT"
SET HEAD1="FOR "_$PIECE(DTAR,U,1)_" ON "_FDT(0)
+5 ;W !,HEAD1
+6 ;W !!,"Please enter dates for search, oldest date first, most recent date last.",!!,"Last report was run on " S Y=$P(DTAR,U,8) X ^DD("DD") W Y,!!
+7 ;D DATE^DVBAUTIL
+8 ;G:X=""!(Y<0) KILL
+9 ;S %ZIS="Q" D ^%ZIS K %ZIS G:POP KILL^DVBAUTIL
+10 ;
+11 ;I $D(IO("Q")) S ZTRTN="DEQUE^DVBASCRP",ZTIO=ION,NOASK=1,ZTDESC="AMIE SC ADMISSION REPORT" F I="FDT(0)","HEAD","HEAD1","BDATE","EDATE","TYPE","RO","RONUM","NOASK" S ZTSAVE(I)=""
+12 ;I $D(IO("Q")) D ^%ZTLOAD W:$D(ZTSK) !!,"Request queued.",!! G KILL
+13 ;
GO SET MA=BDATE
FOR J=0:0
SET MA=$ORDER(^DGPM("AMV1",MA))
if $PIECE(MA,".")>EDATE!(MA="")
QUIT
FOR DA=0:0
SET DA=$ORDER(^DGPM("AMV1",MA,DA))
if DA=""
QUIT
FOR MB=0:0
SET MB=$ORDER(^DGPM("AMV1",MA,DA,MB))
if MB=""
QUIT
DO SET
if '$DATA(NOASK)
WRITE "."
+1 IF '$DATA(^TMP($JOB))
SET ^TMP("DVBAR",$JOB,DVBABCNT)="No data found for parameters entered."
HANG 2
GOTO KILL
+2 DO PRINT
if (DVBAFNLDTE=$PIECE(EDATE,"."))
KILL ^XTMP("DVBA_SCADMSSN_RPT"_$JOB,0)
+3 IF $DATA(DVBAQUIT)
KILL DVBAON2
if $DATA(ZTQUEUED)
DO KILL^%ZTLOAD
GOTO KILL^DVBAUTIL
+4 ;
KILL if (DVBAFNLDTE=$PIECE(EDATE,"."))
KILL ^XTMP("DVBA_SCADMSSN_RPT"_$JOB,0)
+1 SET ZMSG=$NAME(^TMP("DVBAR",$JOB))
+2 if $DATA(ZTQUEUED)
DO KILL^%ZTLOAD
DO ^%ZISC
SET X=8
KILL DVBAON2
GOTO FINAL^DVBAUTIL
+3 ;
DEQUE KILL ^TMP($JOB)
GOTO GO
+1 ;
COLHDR ;Column header for delimited report
+1 NEW DVBADLMTR
+2 SET DVBADLMTR=","
+3 SET ^TMP("DVBAR",$JOB,DVBABCNT)="Patient Name"_DVBADLMTR_"Claim No"_DVBADLMTR_"Claim Folder Loc"_DVBADLMTR
+4 SET ^TMP("DVBAR",$JOB,DVBABCNT)=(^TMP("DVBAR",$JOB,DVBABCNT))_"Social Sec No"_DVBADLMTR_"Admission Date"_DVBADLMTR
+5 SET ^TMP("DVBAR",$JOB,DVBABCNT)=(^TMP("DVBAR",$JOB,DVBABCNT))_"Admitting Diagnosis"_DVBADLMTR_"Discharge Date"_DVBADLMTR
+6 SET ^TMP("DVBAR",$JOB,DVBABCNT)=(^TMP("DVBAR",$JOB,DVBABCNT))_"Bed Service"_DVBADLMTR_"Recv A&A?"_DVBADLMTR
+7 SET ^TMP("DVBAR",$JOB,DVBABCNT)=(^TMP("DVBAR",$JOB,DVBABCNT))_"Pension?"_DVBADLMTR_"Eligibility Data"
+8 SET DVBABCNT=DVBABCNT+1
+9 ;set global entry so header is only created once for job ($J)
+10 SET ^XTMP("DVBA_SCADMSSN_RPT"_$JOB,0)=DT_U_DT
+11 QUIT