ABMMUPV4 ;IHS/SD/SDR - MU Patient Volume EP Report ;
;;2.6;IHS 3P BILLING SYSTEM;**8**;NOV 12, 2009
;
GRPPRT ;EP
I ABMY("RFMT")="P" D PATIENT Q
I +$G(^XTMP("ABM-PVP",$J,"PRV TOP"))>29.99 S ABMPMET=1 D MET Q
D NOTMET
K ^XTMP("ABM-PVP",$J)
Q
MET ;
S ABM("PG")=1
S ABMSDT=$P($G(^XTMP("ABM-PVP",$J,"PRV TOP")),U,2)
D HDR^ABMMUPV3
D MHDR^ABMMUPV3
I $Y+5>IOSL D HD^ABMMUPV3 Q:(IOST["C")&((+$G(Y)=0)!($D(DIRUT)!$D(DIROUT)!$D(DTOUT)!$D(DUOUT)))
S ABMVLOC=0
F S ABMVLOC=$O(^XTMP("ABM-PVP",$J,"PRV-DENOM",ABMSDT,ABMVLOC)) Q:'ABMVLOC D
.I $Y+5>IOSL D HD^ABMMUPV3 Q:(IOST["C")&((+$G(Y)=0)!($D(DIRUT)!$D(DIROUT)!$D(DTOUT)!$D(DUOUT)))
.F ABM=1:1:80 W "-"
.S ABMLOC=$$GET1^DIQ(9999999.06,ABMVLOC,.02,"E")
.W !,"Patient Volume "_ABMLOC_": "_+$P($G(^XTMP("ABM-PVP",$J,"PRV PERCENT",ABMSDT,ABMVLOC)),U)_"%"
.W !!,"Total Patient Encounters "_ABMLOC_": ",?60,$J(+$G(^XTMP("ABM-PVP",$J,"PRV-DENOM",ABMSDT,ABMVLOC)),8)
.W !,"Total Paid Medicaid Encounters "_ABMLOC_": ",?60,$J(+$G(^XTMP("ABM-PVP",$J,"PRV ENC CNT",ABMSDT,ABMVLOC,"MCD")),8)
.W !,"Total Paid Kidscare/Chip Encounters "_ABMLOC_": ",?60,$J(+$G(^XTMP("ABM-PVP",$J,"PRV ENC CNT",ABMSDT,ABMVLOC,"CHIP")),8)
.W !,"Total Paid Other Encounters "_ABMLOC_": ",?60,$J(+$G(^XTMP("ABM-PVP",$J,"PRV ENC CNT",ABMSDT,ABMVLOC,"OTHR")),8),!
;
W !
F ABM=1:1:80 W "-"
W !,"Patient Volume all calculated Facilities: ",+$P($G(^XTMP("ABM-PVP",$J,"PRV TOP")),U)_"%"
W !!,"Total Patient Encounters All Facilities Total: ",?60,$J(+$G(^XTMP("ABM-PVP",$J,"PRV-DENOM",ABMSDT)),8)
W !,"Total Paid Medicaid Encounters All Facilities Total: ",?60,$J(+$G(^XTMP("ABM-PVP",$J,"PRV ENC CNT",ABMSDT,"MCD")),8)
W !,"Total Paid Kidscare/Chip Encounters All Facilities Total: ",?60,$J(+$G(^XTMP("ABM-PVP",$J,"PRV ENC CNT",ABMSDT,"CHIP")),8)
W !,"Total Paid Other Encounters All Facilities Total: ",?60,$J(+$G(^XTMP("ABM-PVP",$J,"PRV ENC CNT",ABMSDT,"OTHR")),8)
W !
Q
NOTMET ;EP
S ABMCNT=0
K ABMLN
S ABMSDT=$P($G(^XTMP("ABM-PVP",$J,"PRV TOP")),U,2)
;
I +$G(ABMY("TVDTS"))'=0 D
.S ABMCNT=0
.S ABMDT=0
.F S ABMDT=$O(^XTMP("ABM-PVP",$J,"PRV PERCENT",ABMDT)) Q:'ABMDT D
..S ABMPRC($G(^XTMP("ABM-PVP",$J,"PRV PERCENT",ABMDT)),ABMCNT)=ABMDT
.S ABMP=""
.S ABMSAV=ABMCNT-ABMY("TVDTS")
.F S ABMP=$O(ABMPRC(ABMP)) Q:ABMP="" D
..S ABMCNT=0,ABMC=0
..F S ABMCNT=$O(ABMPRC(ABMP,ABMCNT)) Q:'ABMCNT D Q:(ABMC=ABMSAV)
...K ^XTMP("ABM-PVP",$J,"PRV PERCENT",$G(ABMPRC(ABMP,ABMCNT))),ABMP("PRV")
...S ABMC=ABMC+1
;
S ABM("PG")=1
S ABMSDT=$P($G(^XTMP("ABM-PVP",$J,"PRV TOP")),U,2)
I +ABMSDT=0 S ABMSDT=ABMY("SDT")
D HDR^ABMMUPV3
W !,"The Patient Volume Threshold (30% for EPs, or 20% for Pediatricians) was not"
W !,"met for the MU Qualification year."
W !,"Details for the volumes that were achieved are provided for your information.",!
W !,"Highest Patient Volume Met: ",+$P($G(^XTMP("ABM-PVP",$J,"PRV TOP")),U)_"%"
W !,"First Day Highest Patient Volume Achieved: ",$$SDT^ABMDUTL(ABMSDT)
W !!,"Patient Volume for the Qualification Year was calculated using the Medicaid"
W !,$S(+$G(ABMFQHC)=1:"/Needy Individual",1:"")_" calculation method."
;
S ABMTHPV=0
S:ABMSDT ABMTHPV=+$G(^XTMP("ABM-PVP",$J,"PRV-DENOM",ABMSDT))
S ABMMHPV=0
S:ABMSDT ABMMHPV=+$G(^XTMP("ABM-PVP",$J,"PRV-NUM",ABMSDT))
W !!,"Total Patient Encounters of First Highest Patient Volume Period: ",ABMTHPV,!
S ABMU("TXT")="Total Medicaid"_$S(+$G(ABMFQHC)=1:"/Needy Individual",1:"")
S ABMU("TXT")=ABMU("TXT")_" Encounters of First Highest Patient Volume Period: "_ABMMHPV
S ABMU("LM")=0,ABMU("RM")=80,ABMU("LNG")=80
D ^ABMDWRAP
D NMHDR^ABMMUPV3
;
S ABMSDT=0,ABMCNT=0
F S ABMSDT=$O(^XTMP("ABM-PVP",$J,"PRV-DENOM",ABMSDT)) Q:'ABMSDT D
.;
.;start old code abm*2.6*8 NOHEAT
.;S X1=ABMSDT
.;S X2=89
.;D C^%DTC
.;S ABMEDT=X
.;end old code start new code
.I +$G(ABMY("EDT"))=0 D
..S X1=ABMSDT
..S X2=89
..D C^%DTC
..S ABMEDT=X
.I +$G(ABMY("EDT"))'=0 S ABMEDT=ABMY("EDT")
.;end new code
.S ABMCNT=ABMCNT+1
.S ABMLN(ABMCNT)=$TR($P($$MDT^ABMDUTL(ABMSDT),"-",1,2),"-"," ")_" - "_$TR($P($$MDT^ABMDUTL(ABMEDT),"-",1,2),"-"," ") ;report period
.S $P(ABMLN(ABMCNT),U,2)=$J($G(^XTMP("ABM-PVP",$J,"PRV PERCENT",ABMSDT)),3)_"%" ;rate
.S $P(ABMLN(ABMCNT),U,3)=$J(+$G(^XTMP("ABM-PVP",$J,"PRV-DENOM",ABMSDT)),6) ;denominator
.S $P(ABMLN(ABMCNT),U,4)=$J(+$G(^XTMP("ABM-PVP",$J,"PRV-NUM",ABMSDT)),6) ;numerator
S ABMCUTOF=$S(ABMCNT#2=1:(ABMCNT+1)\2,1:ABMCNT\2)
S ABMMCNT=1
F ABMCUTOF=(ABMCUTOF+1):1:ABMCNT D
.S ABMLN(ABMMCNT)=ABMLN(ABMMCNT)_U_ABMLN(ABMCUTOF)
.K ABMLN(ABMCUTOF)
.S ABMMCNT=+$G(ABMMCNT)+1
S ABMCNT=0
F S ABMCNT=$O(ABMLN(ABMCNT)) Q:'ABMCNT D Q:(IOST["C")&((+$G(Y)=0)!($D(DIRUT)!$D(DIROUT)!$D(DTOUT)!$D(DUOUT)))
.I $Y+5>IOSL D HD^ABMMUPV3,NMHDR^ABMMUPV3 Q:(IOST["C")&((+$G(Y)=0)!($D(DIRUT)!$D(DIROUT)!$D(DTOUT)!$D(DUOUT)))
.S ABMPD=$P(ABMLN(ABMCNT),U)
.S ABMRT=$P(ABMLN(ABMCNT),U,2)
.S ABMDEN=$P(ABMLN(ABMCNT),U,3)
.S ABMNUM=$P(ABMLN(ABMCNT),U,4)
.S ABMPD2=$P(ABMLN(ABMCNT),U,5)
.S ABMRT2=$P(ABMLN(ABMCNT),U,6)
.S ABMDEN2=$P(ABMLN(ABMCNT),U,7)
.S ABMNUM2=$P(ABMLN(ABMCNT),U,8)
.W !,ABMPD,?16,ABMRT,?21,ABMDEN,?29,ABMNUM,?40,ABMPD2,?56,ABMRT2,?63,ABMDEN2,?71,ABMNUM2
Q
PATIENT ;EP
S ABM("PG")=1
S ABMSDT=$P($G(^XTMP("ABM-PVP",$J,"PRV TOP")),U,2)
D HDR^ABMMUPV3
Q:ABMSDT=""
S ABMVLOC=0
F S ABMVLOC=$O(^XTMP("ABM-PVP",$J,"PT LST",ABMSDT,ABMVLOC)) Q:'ABMVLOC D Q:(IOST["C")&((+$G(Y)=0)!($D(DIRUT)!$D(DIROUT)!$D(DTOUT)!$D(DUOUT)))
.D PTHDR^ABMMUPV3
.S ABMITYP=""
.F S ABMITYP=$O(^XTMP("ABM-PVP",$J,"PT LST",ABMSDT,ABMVLOC,ABMITYP)) Q:ABMITYP="" D Q:(IOST["C")&((+$G(Y)=0)!($D(DIRUT)!$D(DIROUT)!$D(DTOUT)!$D(DUOUT)))
..S ABMINS=""
..F S ABMINS=$O(^XTMP("ABM-PVP",$J,"PT LST",ABMSDT,ABMVLOC,ABMITYP,ABMINS)) Q:ABMINS="" D Q:(IOST["C")&((+$G(Y)=0)!($D(DIRUT)!$D(DIROUT)!$D(DTOUT)!$D(DUOUT)))
...S ABMPTL=""
...F S ABMPTL=$O(^XTMP("ABM-PVP",$J,"PT LST",ABMSDT,ABMVLOC,ABMITYP,ABMINS,ABMPTL)) Q:ABMPTL="" D Q:(IOST["C")&((+$G(Y)=0)!($D(DIRUT)!$D(DIROUT)!$D(DTOUT)!$D(DUOUT)))
....S ABMPTF=""
....F S ABMPTF=$O(^XTMP("ABM-PVP",$J,"PT LST",ABMSDT,ABMVLOC,ABMITYP,ABMINS,ABMPTL,ABMPTF)) Q:ABMPTF="" D Q:(IOST["C")&((+$G(Y)=0)!($D(DIRUT)!$D(DIROUT)!$D(DTOUT)!$D(DUOUT)))
.....S ABMVDT=0
.....F S ABMVDT=$O(^XTMP("ABM-PVP",$J,"PT LST",ABMSDT,ABMVLOC,ABMITYP,ABMINS,ABMPTL,ABMPTF,ABMVDT)) Q:'ABMVDT D Q:(IOST["C")&((+$G(Y)=0)!($D(DIRUT)!$D(DIROUT)!$D(DTOUT)!$D(DUOUT)))
......S ABMVDFN=0
......F S ABMVDFN=$O(^XTMP("ABM-PVP",$J,"PT LST",ABMSDT,ABMVLOC,ABMITYP,ABMINS,ABMPTL,ABMPTF,ABMVDT,ABMVDFN)) Q:'ABMVDFN D Q:(IOST["C")&((+$G(Y)=0)!($D(DIRUT)!$D(DIROUT)!$D(DTOUT)!$D(DUOUT)))
.......S ABMPT=$P($G(^XTMP("ABM-PVP",$J,"PT LST",ABMSDT,ABMVLOC,ABMITYP,ABMINS,ABMPTL,ABMPTF,ABMVDT,ABMVDFN)),U,2)
.......S ABMTRIEN=$P($G(^XTMP("ABM-PVP",$J,"PT LST",ABMSDT,ABMVLOC,ABMITYP,ABMINS,ABMPTL,ABMPTF,ABMVDT,ABMVDFN)),U,3)
.......S IENS=ABMVLOC_","_ABMPT_","
.......S ABMHRN=$$GET1^DIQ(9000001.41,IENS,.02)
.......W !,$E(ABMPTL_", "_ABMPTF,1,16) ;pt name
.......W ?18,ABMHRN ;HRN
.......W ?25,$E($$GET1^DIQ(9000010,ABMVDFN,.07,"E"),1,3) ;Category
.......W ?29,$E($$GET1^DIQ(9000010,ABMVDFN,.08,"E"),1,8) ;clinic
.......W ?39,$S(ABMITYP="X":"",1:ABMITYP) ;insurer type
.......W ?42,$S(ABMINS="NO BILL":"NOT BILLED",1:$E(ABMINS,1,10)) ;insurer
.......W ?53,$$CDT^ABMDUTL(ABMVDT) ;visit date
.......W ?70,$S(+ABMTRIEN:$$SDTO^ABMDUTL(ABMTRIEN),1:"") ;dt paid
.......I $P($G(^XTMP("ABM-PVP",$J,"PT LST",ABMSDT,ABMVLOC,ABMITYP,ABMINS,ABMPTL,ABMPTF,ABMVDT,ABMVDFN)),U,4)'="" W ?79,$P(^(ABMVDFN),U,4)
.......I $Y+5>IOSL D HD^ABMMUPV3,PTHDR^ABMMUPV3 Q:(IOST["C")&((+$G(Y)=0)!($D(DIRUT)!$D(DIROUT)!$D(DTOUT)!$D(DUOUT)))
Q
ABMMUPV4 ;IHS/SD/SDR - MU Patient Volume EP Report ;
+1 ;;2.6;IHS 3P BILLING SYSTEM;**8**;NOV 12, 2009
+2 ;
GRPPRT ;EP
+1 IF ABMY("RFMT")="P"
DO PATIENT
QUIT
+2 IF +$GET(^XTMP("ABM-PVP",$JOB,"PRV TOP"))>29.99
SET ABMPMET=1
DO MET
QUIT
+3 DO NOTMET
+4 KILL ^XTMP("ABM-PVP",$JOB)
+5 QUIT
MET ;
+1 SET ABM("PG")=1
+2 SET ABMSDT=$PIECE($GET(^XTMP("ABM-PVP",$JOB,"PRV TOP")),U,2)
+3 DO HDR^ABMMUPV3
+4 DO MHDR^ABMMUPV3
+5 IF $Y+5>IOSL
DO HD^ABMMUPV3
IF (IOST["C")&((+$GET(Y)=0)!($DATA(DIRUT)!$DATA(DIROUT)!$DATA(DTOUT)!$DATA(DUOUT)))
QUIT
+6 SET ABMVLOC=0
+7 FOR
SET ABMVLOC=$ORDER(^XTMP("ABM-PVP",$JOB,"PRV-DENOM",ABMSDT,ABMVLOC))
IF 'ABMVLOC
QUIT
Begin DoDot:1
+8 IF $Y+5>IOSL
DO HD^ABMMUPV3
IF (IOST["C")&((+$GET(Y)=0)!($DATA(DIRUT)!$DATA(DIROUT)!$DATA(DTOUT)!$DATA(DUOUT)))
QUIT
+9 FOR ABM=1:1:80
WRITE "-"
+10 SET ABMLOC=$$GET1^DIQ(9999999.06,ABMVLOC,.02,"E")
+11 WRITE !,"Patient Volume "_ABMLOC_": "_+$PIECE($GET(^XTMP("ABM-PVP",$JOB,"PRV PERCENT",ABMSDT,ABMVLOC)),U)_"%"
+12 WRITE !!,"Total Patient Encounters "_ABMLOC_": ",?60,$JUSTIFY(+$GET(^XTMP("ABM-PVP",$JOB,"PRV-DENOM",ABMSDT,ABMVLOC)),8)
+13 WRITE !,"Total Paid Medicaid Encounters "_ABMLOC_": ",?60,$JUSTIFY(+$GET(^XTMP("ABM-PVP",$JOB,"PRV ENC CNT",ABMSDT,ABMVLOC,"MCD")),8)
+14 WRITE !,"Total Paid Kidscare/Chip Encounters "_ABMLOC_": ",?60,$JUSTIFY(+$GET(^XTMP("ABM-PVP",$JOB,"PRV ENC CNT",ABMSDT,ABMVLOC,"CHIP")),8)
+15 WRITE !,"Total Paid Other Encounters "_ABMLOC_": ",?60,$JUSTIFY(+$GET(^XTMP("ABM-PVP",$JOB,"PRV ENC CNT",ABMSDT,ABMVLOC,"OTHR")),8),!
End DoDot:1
+16 ;
+17 WRITE !
+18 FOR ABM=1:1:80
WRITE "-"
+19 WRITE !,"Patient Volume all calculated Facilities: ",+$PIECE($GET(^XTMP("ABM-PVP",$JOB,"PRV TOP")),U)_"%"
+20 WRITE !!,"Total Patient Encounters All Facilities Total: ",?60,$JUSTIFY(+$GET(^XTMP("ABM-PVP",$JOB,"PRV-DENOM",ABMSDT)),8)
+21 WRITE !,"Total Paid Medicaid Encounters All Facilities Total: ",?60,$JUSTIFY(+$GET(^XTMP("ABM-PVP",$JOB,"PRV ENC CNT",ABMSDT,"MCD")),8)
+22 WRITE !,"Total Paid Kidscare/Chip Encounters All Facilities Total: ",?60,$JUSTIFY(+$GET(^XTMP("ABM-PVP",$JOB,"PRV ENC CNT",ABMSDT,"CHIP")),8)
+23 WRITE !,"Total Paid Other Encounters All Facilities Total: ",?60,$JUSTIFY(+$GET(^XTMP("ABM-PVP",$JOB,"PRV ENC CNT",ABMSDT,"OTHR")),8)
+24 WRITE !
+25 QUIT
NOTMET ;EP
+1 SET ABMCNT=0
+2 KILL ABMLN
+3 SET ABMSDT=$PIECE($GET(^XTMP("ABM-PVP",$JOB,"PRV TOP")),U,2)
+4 ;
+5 IF +$GET(ABMY("TVDTS"))'=0
Begin DoDot:1
+6 SET ABMCNT=0
+7 SET ABMDT=0
+8 FOR
SET ABMDT=$ORDER(^XTMP("ABM-PVP",$JOB,"PRV PERCENT",ABMDT))
IF 'ABMDT
QUIT
Begin DoDot:2
+9 SET ABMPRC($GET(^XTMP("ABM-PVP",$JOB,"PRV PERCENT",ABMDT)),ABMCNT)=ABMDT
End DoDot:2
+10 SET ABMP=""
+11 SET ABMSAV=ABMCNT-ABMY("TVDTS")
+12 FOR
SET ABMP=$ORDER(ABMPRC(ABMP))
IF ABMP=""
QUIT
Begin DoDot:2
+13 SET ABMCNT=0
SET ABMC=0
+14 FOR
SET ABMCNT=$ORDER(ABMPRC(ABMP,ABMCNT))
IF 'ABMCNT
QUIT
Begin DoDot:3
+15 KILL ^XTMP("ABM-PVP",$JOB,"PRV PERCENT",$GET(ABMPRC(ABMP,ABMCNT))),ABMP("PRV")
+16 SET ABMC=ABMC+1
End DoDot:3
IF (ABMC=ABMSAV)
QUIT
End DoDot:2
End DoDot:1
+17 ;
+18 SET ABM("PG")=1
+19 SET ABMSDT=$PIECE($GET(^XTMP("ABM-PVP",$JOB,"PRV TOP")),U,2)
+20 IF +ABMSDT=0
SET ABMSDT=ABMY("SDT")
+21 DO HDR^ABMMUPV3
+22 WRITE !,"The Patient Volume Threshold (30% for EPs, or 20% for Pediatricians) was not"
+23 WRITE !,"met for the MU Qualification year."
+24 WRITE !,"Details for the volumes that were achieved are provided for your information.",!
+25 WRITE !,"Highest Patient Volume Met: ",+$PIECE($GET(^XTMP("ABM-PVP",$JOB,"PRV TOP")),U)_"%"
+26 WRITE !,"First Day Highest Patient Volume Achieved: ",$$SDT^ABMDUTL(ABMSDT)
+27 WRITE !!,"Patient Volume for the Qualification Year was calculated using the Medicaid"
+28 WRITE !,$SELECT(+$GET(ABMFQHC)=1:"/Needy Individual",1:"")_" calculation method."
+29 ;
+30 SET ABMTHPV=0
+31 IF ABMSDT
SET ABMTHPV=+$GET(^XTMP("ABM-PVP",$JOB,"PRV-DENOM",ABMSDT))
+32 SET ABMMHPV=0
+33 IF ABMSDT
SET ABMMHPV=+$GET(^XTMP("ABM-PVP",$JOB,"PRV-NUM",ABMSDT))
+34 WRITE !!,"Total Patient Encounters of First Highest Patient Volume Period: ",ABMTHPV,!
+35 SET ABMU("TXT")="Total Medicaid"_$SELECT(+$GET(ABMFQHC)=1:"/Needy Individual",1:"")
+36 SET ABMU("TXT")=ABMU("TXT")_" Encounters of First Highest Patient Volume Period: "_ABMMHPV
+37 SET ABMU("LM")=0
SET ABMU("RM")=80
SET ABMU("LNG")=80
+38 DO ^ABMDWRAP
+39 DO NMHDR^ABMMUPV3
+40 ;
+41 SET ABMSDT=0
SET ABMCNT=0
+42 FOR
SET ABMSDT=$ORDER(^XTMP("ABM-PVP",$JOB,"PRV-DENOM",ABMSDT))
IF 'ABMSDT
QUIT
Begin DoDot:1
+43 ;
+44 ;start old code abm*2.6*8 NOHEAT
+45 ;S X1=ABMSDT
+46 ;S X2=89
+47 ;D C^%DTC
+48 ;S ABMEDT=X
+49 ;end old code start new code
+50 IF +$GET(ABMY("EDT"))=0
Begin DoDot:2
+51 SET X1=ABMSDT
+52 SET X2=89
+53 DO C^%DTC
+54 SET ABMEDT=X
End DoDot:2
+55 IF +$GET(ABMY("EDT"))'=0
SET ABMEDT=ABMY("EDT")
+56 ;end new code
+57 SET ABMCNT=ABMCNT+1
+58 ;report period
SET ABMLN(ABMCNT)=$TRANSLATE($PIECE($$MDT^ABMDUTL(ABMSDT),"-",1,2),"-"," ")_" - "_$TRANSLATE($PIECE($$MDT^ABMDUTL(ABMEDT),"-",1,2),"-"," ")
+59 ;rate
SET $PIECE(ABMLN(ABMCNT),U,2)=$JUSTIFY($GET(^XTMP("ABM-PVP",$JOB,"PRV PERCENT",ABMSDT)),3)_"%"
+60 ;denominator
SET $PIECE(ABMLN(ABMCNT),U,3)=$JUSTIFY(+$GET(^XTMP("ABM-PVP",$JOB,"PRV-DENOM",ABMSDT)),6)
+61 ;numerator
SET $PIECE(ABMLN(ABMCNT),U,4)=$JUSTIFY(+$GET(^XTMP("ABM-PVP",$JOB,"PRV-NUM",ABMSDT)),6)
End DoDot:1
+62 SET ABMCUTOF=$SELECT(ABMCNT#2=1:(ABMCNT+1)\2,1:ABMCNT\2)
+63 SET ABMMCNT=1
+64 FOR ABMCUTOF=(ABMCUTOF+1):1:ABMCNT
Begin DoDot:1
+65 SET ABMLN(ABMMCNT)=ABMLN(ABMMCNT)_U_ABMLN(ABMCUTOF)
+66 KILL ABMLN(ABMCUTOF)
+67 SET ABMMCNT=+$GET(ABMMCNT)+1
End DoDot:1
+68 SET ABMCNT=0
+69 FOR
SET ABMCNT=$ORDER(ABMLN(ABMCNT))
IF 'ABMCNT
QUIT
Begin DoDot:1
+70 IF $Y+5>IOSL
DO HD^ABMMUPV3
DO NMHDR^ABMMUPV3
IF (IOST["C")&((+$GET(Y)=0)!($DATA(DIRUT)!$DATA(DIROUT)!$DATA(DTOUT)!$DATA(DUOUT)))
QUIT
+71 SET ABMPD=$PIECE(ABMLN(ABMCNT),U)
+72 SET ABMRT=$PIECE(ABMLN(ABMCNT),U,2)
+73 SET ABMDEN=$PIECE(ABMLN(ABMCNT),U,3)
+74 SET ABMNUM=$PIECE(ABMLN(ABMCNT),U,4)
+75 SET ABMPD2=$PIECE(ABMLN(ABMCNT),U,5)
+76 SET ABMRT2=$PIECE(ABMLN(ABMCNT),U,6)
+77 SET ABMDEN2=$PIECE(ABMLN(ABMCNT),U,7)
+78 SET ABMNUM2=$PIECE(ABMLN(ABMCNT),U,8)
+79 WRITE !,ABMPD,?16,ABMRT,?21,ABMDEN,?29,ABMNUM,?40,ABMPD2,?56,ABMRT2,?63,ABMDEN2,?71,ABMNUM2
End DoDot:1
IF (IOST["C")&((+$GET(Y)=0)!($DATA(DIRUT)!$DATA(DIROUT)!$DATA(DTOUT)!$DATA(DUOUT)))
QUIT
+80 QUIT
PATIENT ;EP
+1 SET ABM("PG")=1
+2 SET ABMSDT=$PIECE($GET(^XTMP("ABM-PVP",$JOB,"PRV TOP")),U,2)
+3 DO HDR^ABMMUPV3
+4 IF ABMSDT=""
QUIT
+5 SET ABMVLOC=0
+6 FOR
SET ABMVLOC=$ORDER(^XTMP("ABM-PVP",$JOB,"PT LST",ABMSDT,ABMVLOC))
IF 'ABMVLOC
QUIT
Begin DoDot:1
+7 DO PTHDR^ABMMUPV3
+8 SET ABMITYP=""
+9 FOR
SET ABMITYP=$ORDER(^XTMP("ABM-PVP",$JOB,"PT LST",ABMSDT,ABMVLOC,ABMITYP))
IF ABMITYP=""
QUIT
Begin DoDot:2
+10 SET ABMINS=""
+11 FOR
SET ABMINS=$ORDER(^XTMP("ABM-PVP",$JOB,"PT LST",ABMSDT,ABMVLOC,ABMITYP,ABMINS))
IF ABMINS=""
QUIT
Begin DoDot:3
+12 SET ABMPTL=""
+13 FOR
SET ABMPTL=$ORDER(^XTMP("ABM-PVP",$JOB,"PT LST",ABMSDT,ABMVLOC,ABMITYP,ABMINS,ABMPTL))
IF ABMPTL=""
QUIT
Begin DoDot:4
+14 SET ABMPTF=""
+15 FOR
SET ABMPTF=$ORDER(^XTMP("ABM-PVP",$JOB,"PT LST",ABMSDT,ABMVLOC,ABMITYP,ABMINS,ABMPTL,ABMPTF))
IF ABMPTF=""
QUIT
Begin DoDot:5
+16 SET ABMVDT=0
+17 FOR
SET ABMVDT=$ORDER(^XTMP("ABM-PVP",$JOB,"PT LST",ABMSDT,ABMVLOC,ABMITYP,ABMINS,ABMPTL,ABMPTF,ABMVDT))
IF 'ABMVDT
QUIT
Begin DoDot:6
+18 SET ABMVDFN=0
+19 FOR
SET ABMVDFN=$ORDER(^XTMP("ABM-PVP",$JOB,"PT LST",ABMSDT,ABMVLOC,ABMITYP,ABMINS,ABMPTL,ABMPTF,ABMVDT,ABMVDFN))
IF 'ABMVDFN
QUIT
Begin DoDot:7
+20 SET ABMPT=$PIECE($GET(^XTMP("ABM-PVP",$JOB,"PT LST",ABMSDT,ABMVLOC,ABMITYP,ABMINS,ABMPTL,ABMPTF,ABMVDT,ABMVDFN)),U,2)
+21 SET ABMTRIEN=$PIECE($GET(^XTMP("ABM-PVP",$JOB,"PT LST",ABMSDT,ABMVLOC,ABMITYP,ABMINS,ABMPTL,ABMPTF,ABMVDT,ABMVDFN)),U,3)
+22 SET IENS=ABMVLOC_","_ABMPT_","
+23 SET ABMHRN=$$GET1^DIQ(9000001.41,IENS,.02)
+24 ;pt name
WRITE !,$EXTRACT(ABMPTL_", "_ABMPTF,1,16)
+25 ;HRN
WRITE ?18,ABMHRN
+26 ;Category
WRITE ?25,$EXTRACT($$GET1^DIQ(9000010,ABMVDFN,.07,"E"),1,3)
+27 ;clinic
WRITE ?29,$EXTRACT($$GET1^DIQ(9000010,ABMVDFN,.08,"E"),1,8)
+28 ;insurer type
WRITE ?39,$SELECT(ABMITYP="X":"",1:ABMITYP)
+29 ;insurer
WRITE ?42,$SELECT(ABMINS="NO BILL":"NOT BILLED",1:$EXTRACT(ABMINS,1,10))
+30 ;visit date
WRITE ?53,$$CDT^ABMDUTL(ABMVDT)
+31 ;dt paid
WRITE ?70,$SELECT(+ABMTRIEN:$$SDTO^ABMDUTL(ABMTRIEN),1:"")
+32 IF $PIECE($GET(^XTMP("ABM-PVP",$JOB,"PT LST",ABMSDT,ABMVLOC,ABMITYP,ABMINS,ABMPTL,ABMPTF,ABMVDT,ABMVDFN)),U,4)'=""
WRITE ?79,$PIECE(^(ABMVDFN),U,4)
+33 IF $Y+5>IOSL
DO HD^ABMMUPV3
DO PTHDR^ABMMUPV3
IF (IOST["C")&((+$GET(Y)=0)!($DATA(DIRUT)!$DATA(DIROUT)!$DATA(DTOUT)!$DATA(DUOUT)))
QUIT
End DoDot:7
IF (IOST["C")&((+$GET(Y)=0)!($DATA(DIRUT)!$DATA(DIROUT)!$DATA(DTOUT)!$DATA(DUOUT)))
QUIT
End DoDot:6
IF (IOST["C")&((+$GET(Y)=0)!($DATA(DIRUT)!$DATA(DIROUT)!$DATA(DTOUT)!$DATA(DUOUT)))
QUIT
End DoDot:5
IF (IOST["C")&((+$GET(Y)=0)!($DATA(DIRUT)!$DATA(DIROUT)!$DATA(DTOUT)!$DATA(DUOUT)))
QUIT
End DoDot:4
IF (IOST["C")&((+$GET(Y)=0)!($DATA(DIRUT)!$DATA(DIROUT)!$DATA(DTOUT)!$DATA(DUOUT)))
QUIT
End DoDot:3
IF (IOST["C")&((+$GET(Y)=0)!($DATA(DIRUT)!$DATA(DIROUT)!$DATA(DTOUT)!$DATA(DUOUT)))
QUIT
End DoDot:2
IF (IOST["C")&((+$GET(Y)=0)!($DATA(DIRUT)!$DATA(DIROUT)!$DATA(DTOUT)!$DATA(DUOUT)))
QUIT
End DoDot:1
IF (IOST["C")&((+$GET(Y)=0)!($DATA(DIRUT)!$DATA(DIROUT)!$DATA(DTOUT)!$DATA(DUOUT)))
QUIT
+34 QUIT