Home   Package List   Routine Alphabetical List   Global Alphabetical List   FileMan Files List   FileMan Sub-Files List   Package Component Lists   Package-Namespace Mapping  
Routine: ABMM2PV7

ABMM2PV7.m

Go to the documentation of this file.
ABMM2PV7 ;IHS/SD/SDR - MU Patient Volume EP Report ; 12 Feb 2014  3:32 PM
 ;;2.6;IHS 3P BILLING SYSTEM;**11,12,15**;NOV 12, 2009;Build 251
 ;IHS/SD/SDR - 2.6*15 - HEAT161159 - Changed PT LST to sort differently so there won't be duplicate vsts on pt lst.  Also added record indicator.
 ;IHS/SD/SDR - 2.6*15 - HEAT157235 - Code change to stop <UNDEF>ENROLL+39^ABMM2PV7
 ;IHS/SD/SDR - 2.6*15 - HEAT157688 - Code change to stop <UNDEF>OTHRVST+1^ABMM2PV7
 ;IHS/SD/SDR - 2.6*15 - HEAT156874 - Code for <SUBSCR>PTDATA+16^ABMM2PV7.  Occurs when no patient on visit.
 ;IHS/SD/SDR - 2.6*15 - HEAT183289 - Added tribal self-insured counters.
 ;
ZEROPD ;EP
 K ABMTRAMT
 I ABMY("RTYP")="GRP" D  Q
 .D CALCDTS^ABMM2PV1
 .S ABMDTFLG=0
 .S ABMP("BDT")=ABMP("BSDT")
 .F  D  Q:ABMDTFLG=1
 ..S ^XTMP("ABM-PVP2",$J,"PRV-NUM ZEROPD BILLS",ABMP("BDT"),ABMGRP,ABMVDFN,ABMP("BDFN"))=""
 ..S ^XTMP("ABM-PVP2",$J,"PRV-NUM ZEROPD DET",ABMP("BDT"),ABMGRP,ABMVDFN,ABMP("BDFN"))=""
 ..S ^XTMP("ABM-PVP2",$J,"PRV-VST",ABMP("BDT"),ABMVDFN)=""
 ..I ABMITYP="D"!($D(ABMI("INS",ABMINS))) S ^XTMP("ABM-PVP2",$J,"VISITS",ABMVDFN)=1
 ..E  S ^XTMP("ABM-PVP2",$J,"VISITS",ABMVDFN)=2
 ..I ABMY("RTYP")="GRP" D GPTDATA
 ..I ABMY("RTYP")="SEL" D PTDATA
 ..S X1=ABMP("BDT")
 ..S X2=1
 ..D C^%DTC
 ..I X>ABMP("BEDT") S ABMDTFLG=1 Q
 ..S ABMP("BDT")=X
 ;
 S ABMPIEN=0
 K ABMPRVC
 F  S ABMPIEN=$O(^AUPNVPRV("AD",ABMVDFN,ABMPIEN)) Q:'ABMPIEN  D
 .S ABMPRV=$$GET1^DIQ(9000010.06,ABMPIEN,".01","I")
 .Q:'$D(ABMPRVDR(ABMPRV))
 .;skip prv if on vst >1
 .Q:$D(ABMPRVC(ABMPRV))
 .S ABMPRVC(ABMPRV)=1
 .D CALCDTS^ABMM2PV1
 .S ABMDTFLG=0
 .S ABMP("BDT")=ABMP("BSDT")
 .F  D  Q:ABMDTFLG=1
 ..S ^XTMP("ABM-PVP2",$J,"PRV-NUM ZEROPD BILLS",ABMP("BDT"),ABMPRV,ABMGRP,ABMVDFN,ABMP("BDFN"))=""
 ..S ^XTMP("ABM-PVP2",$J,"PRV-NUM ZEROPD DET",ABMP("BDT"),ABMGRP,ABMVDFN,ABMP("BDFN"))=""
 ..S ^XTMP("ABM-PVP2",$J,"PRV-VST",ABMP("BDT"),ABMVDFN,ABMPRV)=""
 ..I ABMITYP="D"!($D(ABMI("INS",ABMINS))) S ^XTMP("ABM-PVP2",$J,"VISITS",ABMVDFN)=1
 ..E  S ^XTMP("ABM-PVP2",$J,"VISITS",ABMVDFN)=2
 ..;I ABMY("RTYP")="GRP" D GPTDATA
 ..I ABMY("RTYP")="SEL" D PTDATA
 ..S X1=ABMP("BDT")
 ..S X2=1
 ..D C^%DTC
 ..I X>ABMP("BEDT") S ABMDTFLG=1 Q
 ..S ABMP("BDT")=X
 Q
GRPBILL ;EP
 ;S ABMBILLF=1  ;abm*2.6*15
 D CALCDTS^ABMM2PV1
 S ABMDTFLG=0
 S ABMP("BDT")=ABMP("BSDT")
 F  D  Q:ABMDTFLG=1
 .S ^XTMP("ABM-PVP2",$J,"PRV-NUM PD BILLS",ABMP("BDT"),ABMGRP,ABMVDFN,ABMP("BDFN"))=""
 .S ^XTMP("ABM-PVP2",$J,"PRV-NUM PD DET",ABMP("BDT"),ABMGRP,ABMVDFN,ABMP("BDFN"))=ABMTRAMT
 .;S ABMBILLF=1  ;abm*2.6*15
 .S ^XTMP("ABM-PVP2",$J,"PRV ENC CNT",ABMP("BDT"),ABMVLOC,ABMGRP)=+$G(^XTMP("ABM-PVP2",$J,"PRV ENC CNT",ABMP("BDT"),ABMVLOC,ABMGRP))+1
 .S ^XTMP("ABM-PVP2",$J,"PRV ENC CNT",ABMP("BDT"),ABMGRP)=+$G(^XTMP("ABM-PVP2",$J,"PRV ENC CNT",ABMP("BDT"),ABMGRP))+1
 .S ^XTMP("ABM-PVP2",$J,"PRV-VST",ABMP("BDT"),ABMVDFN)=""
 .I ABMITYP="D"!($D(ABMI("INS",ABMINS))) S ABMBILLF=1,^XTMP("ABM-PVP2",$J,"VISITS",ABMVDFN)=1
 .I (ABMCNT#1000&(IOST["C")) W "."
 .S ABMCNT=+$G(ABMCNT)+1
 .D GPTDATA
 .S X1=ABMP("BDT")
 .S X2=1
 .D C^%DTC
 .I X>ABMP("BEDT") S ABMDTFLG=1 Q
 .S ABMP("BDT")=X
 S DUZ(2)=ABMHOLD
 I +$G(ABMFOUND)=1 D GRPOTHVS  ;chk for other vsts on DOS to mark as pd
 Q
GRPOTHVS ;EP
 S ABMDOS=ABMP("VDT")
 F  S ABMDOS=$O(^XTMP("ABM-PVP2",$J,"PT VSTS",ABMPT,ABMDOS)) Q:'ABMDOS!($P(ABMDOS,".")>$P(ABMDOSSV,"."))  D
 .S ABMVCHK=0
 .F  S ABMVCHK=$O(^XTMP("ABM-PVP2",$J,"PT VSTS",ABMPT,ABMDOS,ABMVCHK)) Q:'ABMVCHK  D
 ..Q:^XTMP("ABM-PVP2",$J,"VISITS",ABMVCHK)=1  ;already cnted this vst
 ..D CALCDTS^ABMM2PV1
 ..S ABMDTFLG=0
 ..S ABMP("BDT")=ABMP("BSDT")
 ..F  D  Q:ABMDTFLG=1
 ...S ^XTMP("ABM-PVP2",$J,"PRV-NUM PD",ABMP("BDT"))=+$G(^XTMP("ABM-PVP2",$J,"PRV-NUM PD",ABMP("BDT")))+1
 ...S ^XTMP("ABM-PVP2",$J,"PRV-NUM PD",ABMP("BDT"),ABMVLOC)=+$G(^XTMP("ABM-PVP2",$J,"PRV-NUM PD",ABMP("BDT"),ABMVLOC))+1
 ...S ^XTMP("ABM-PVP2",$J,"PRV-NUM PD",ABMP("BDT"),ABMGRP)=+$G(^XTMP("ABM-PVP2",$J,"PRV-NUM PD",ABMP("BDT"),ABMGRP))+1
 ...S ^XTMP("ABM-PVP2",$J,"PRV-NUM PD",ABMP("BDT"),ABMVLOC,ABMGRP)=+$G(^XTMP("ABM-PVP2",$J,"PRV-NUM PD",ABMP("BDT"),ABMVLOC,ABMGRP))+1
 ...I (ABMCNT#1000&(IOST["C")) W "."
 ...S ABMCNT=+$G(ABMCNT)+1
 ...S ABMVSAVE=ABMVDFN
 ...S ABMVDFN=ABMVCHK
 ...D GPTDATA
 ...S ABMVDFN=ABMVSAVE
 ...S X1=ABMP("BDT")
 ...S X2=1
 ...D C^%DTC
 ...I X>ABMP("BEDT") S ABMDTFLG=1 Q
 ...S ABMP("BDT")=X
 ..S ^XTMP("ABM-PVP2",$J,"VISITS",ABMVCHK)=1
 Q
OTHERVST ;EP
 S (ABMDOS,ABMDOSSV)=$P($G(^ABMDBILL(DUZ(2),ABMP("BDFN"),7)),U)  ;abm*2.6*15 HEAT157688
 F  S ABMDOS=$O(^XTMP("ABM-PVP2",$J,"PT VSTS",ABMPT,ABMDOS)) Q:'ABMDOS!($P(ABMDOS,".")>$P(ABMDOSSV,"."))  D
 .S ABMVCHK=0
 .F  S ABMVCHK=$O(^XTMP("ABM-PVP2",$J,"PT VSTS",ABMPT,ABMDOS,ABMVCHK)) Q:'ABMVCHK  D
 ..Q:(ABMVDFN=ABMVCHK)
 ..Q:^XTMP("ABM-PVP2",$J,"VISITS",ABMVCHK)=1  ;already cnted this vst
 ..;Q:^XTMP("ABM-PVP2",$J,"VISITS",ABMVCHK)=2  ;already cnted this vst
 ..S ABMPIEN=0
 ..K ABMPRVC
 ..F  S ABMPIEN=$O(^AUPNVPRV("AD",ABMVCHK,ABMPIEN)) Q:'ABMPIEN  D
 ...S ABMPRV=$$GET1^DIQ(9000010.06,ABMPIEN,.01,"I")
 ...Q:'$D(ABMPRVDR(ABMPRV))
 ...;skip prv if on vst >1
 ...Q:$D(ABMPRVC(ABMPRV))
 ...S ABMPRVC(ABMPRV)=1
 ...D CALCDTS^ABMM2PV1
 ...S ABMDTFLG=0
 ...S ABMP("BDT")=ABMP("BSDT")
 ...F  D  Q:ABMDTFLG=1
 ....I $D(^XTMP("ABM-PVP2",$J,"PRV-VST",ABMP("BDT"),ABMVCHK,ABMPRV)) S ABMDTFLG=1 Q
 ....S ^XTMP("ABM-PVP2",$J,"PRV-NUM PD",ABMP("BDT"),ABMPRV)=+$G(^XTMP("ABM-PVP2",$J,"PRV-NUM PD",ABMP("BDT"),ABMPRV))+1
 ....S ^XTMP("ABM-PVP2",$J,"PRV-NUM PD",ABMP("BDT"),ABMPRV,ABMVLOC)=+$G(^XTMP("ABM-PVP2",$J,"PRV-NUM PD",ABMP("BDT"),ABMPRV,ABMVLOC))+1
 ....S ^XTMP("ABM-PVP2",$J,"VISITS",ABMVCHK)=1
 ....S ^XTMP("ABM-PVP2",$J,"PRV-NUM PD",ABMP("BDT"),ABMGRP)=+$G(^XTMP("ABM-PVP2",$J,"PRV-NUM PD",ABMP("BDT"),ABMGRP))+1
 ....I ABMY("RTYP")="GRP" D GPTDATA
 ....I ABMY("RTYP")="SEL" D PTDATA
 ....S X1=ABMP("BDT")
 ....S X2=1
 ....D C^%DTC
 ....I X>ABMDOS S ABMDTFLG=1 Q
 ....S ABMP("BDT")=X
 Q
GPTDATA ;EP
 D GPTDATA^ABMM2P11  ;abm*2.6*15 split routine due to size
 Q
PTDATA ;EP
 D PTDATA^ABMM2P11  ;abm*2.6*15 split routine due to size
 Q
ENROLL ;EP
 K ABMBILLN,ABMTRAMT,ABMTRIEN,ABMDX,ABMITYP,ABMP("VDFN"),ABMINS
 K ABMABILN,ABMADJT,ABMARACT,ABMCBAMT,ABMTRIEN,ABMTRTYP,ABMOINS,ABMPNM,ABMSAV,ABMVLOC,ABMPT,ABMDX,ABMDXIEN,ABMDXPRI
 S ABMVDFN=0
 F  S ABMVDFN=$O(^XTMP("ABM-PVP2",$J,"VISITS",ABMVDFN)) Q:'ABMVDFN  D
 .K ABMRIND  ;abm*2.6*15 HEAT161159
 .Q:(+$G(^XTMP("ABM-PVP2",$J,"VISITS",ABMVDFN))=1)  ;MCD/CHIP bill was found for vst
 .K ABML
 .S ABMPT=$$GET1^DIQ(9000010,ABMVDFN,".05","I")
 .S (ABMP("VDT"),ABMVDT,ABMSDT)=$P($$GET1^DIQ(9000010,ABMVDFN,".01","I"),".")
 .S ABMVLOC=$$GET1^DIQ(9000010,ABMVDFN,".06","I")
 .S ABMNPI=$S($P($$NPI^XUSNPI("Organization_ID",ABMVLOC),U)>0:$P($$NPI^XUSNPI("Organization_ID",ABMVLOC),U),1:"")  ;abm*2.6*15 added
 .S ABMTIN=$$GET1^DIQ(9999999.06,ABMVLOC,".21","E")  ;abm*2.6*15 added
 .;
 .D ELIG^ABMM2PV8
 .;
 .I ABMY("RTYP")="GRP" D GENROLL Q
 .K ABMPRVC
 .S ABMPIEN=0
 .F  S ABMPIEN=$O(^AUPNVPRV("AD",ABMVDFN,ABMPIEN)) Q:'ABMPIEN  D
 ..S ABMPRV=$$GET1^DIQ(9000010.06,ABMPIEN,.01,"I")
 ..Q:'$D(ABMPRVDR(ABMPRV))
 ..Q:$D(ABMPRVC(ABMPRV))
 ..S ABMPRVC(ABMPRV)=1
 ..D CALCDTS^ABMM2PV1
 ..S ABMDTFLG=0
 ..S ABMP("BDT")=ABMP("BSDT")
 ..F  D  Q:ABMDTFLG=1
 ...I ABMP("VDT")<ABMP("BSDT") S ABMDTFLG=1 Q  ;vst is before 90-day window
 ...;start new abm*2.6*15 uncomp care
 ...I '$D(ABML) D
 ....S ^XTMP("ABM-PVP2",$J,"PRV-NUM UNCOMP",ABMP("BDT"),ABMPRV,"UNCOMP")=+$G(^XTMP("ABM-PVP2",$J,"PRV-NUM UNCOMP",ABMP("BDT"),ABMPRV,"UNCOMP"))+1
 ....S ^XTMP("ABM-PVP2",$J,"PRV-NUM UNCOMP",ABMP("BDT"),ABMPRV,ABMVLOC,"UNCOMP")=+$G(^XTMP("ABM-PVP2",$J,"PRV-NUM UNCOMP",ABMP("BDT"),ABMPRV,ABMVLOC,"UNCOMP"))+1
 ....S ^XTMP("ABM-PVP2",$J,"PRV-NUM UNCOMP",ABMP("BDT"),ABMPRV,ABMVLOC)=+$G(^XTMP("ABM-PVP2",$J,"PRV-NUM UNCOMP",ABMP("BDT"),ABMPRV,ABMVLOC))+1
 ...;end new abm*2.6*15
 ...I (+$G(ABML("MCD"))=0&(+$G(ABML("CHIP"))=0))&(+$G(ABML("OTHR"))=1) D
 ....Q:+$G(^XTMP("ABM-PVP2",$J,"VISITS",ABMVDFN))=2  ;counted as pd; cnting here would be duplicate
 ....S ^XTMP("ABM-PVP2",$J,"PRV-NUM OELIG",ABMP("BDT"),ABMPRV,ABMGRP)=+$G(^XTMP("ABM-PVP2",$J,"PRV-NUM OELIG",ABMP("BDT"),ABMPRV,ABMGRP))+1
 ....S ^XTMP("ABM-PVP2",$J,"PRV-NUM OELIG",ABMP("BDT"),ABMPRV,ABMVLOC,ABMGRP)=+$G(^XTMP("ABM-PVP2",$J,"PRV-NUM OELIG",ABMP("BDT"),ABMPRV,ABMVLOC,ABMGRP))+1
 ....S ^XTMP("ABM-PVP2",$J,"PRV-NUM OELIG",ABMP("BDT"),ABMGRP,ABMVLOC)=+$G(^XTMP("ABM-PVP2",$J,"PRV-NUM OELIG",ABMP("BDT"),ABMGRP,ABMVLOC))+1
 ....S ^XTMP("ABM-PVP2",$J,"PRV-NUM OELIG",ABMP("BDT"),ABMGRP)=+$G(^XTMP("ABM-PVP2",$J,"PRV-NUM OELIG",ABMP("BDT"),ABMGRP))+1
 ....S ^XTMP("ABM-PVP2",$J,"TEST","ENR",ABMP("BDT"),ABMVDFN)=""
 ...I (+$G(ABML("MCD"))=1!(+$G(ABML("CHIP"))=1)) D
 ....F ABMGRP="MCD","CHIP" D
 .....I +$G(ABML(ABMGRP))'=1 Q
 .....I ABMGRP="MCD",((+$G(ABML("MCD"))=1)&(+$G(ABML("CHIP"))=1)) Q
 .....I +$G(^XTMP("ABM-PVP2",$J,"VISITS",ABMVDFN))=2 D
 ......;start old abm*2.6*15 HEAT157235
 ......;I $D(^XTMP("ABM-PVP2",$J,"PRV-NUM ZEROPD",ABMP("BDT"))) D
 ......;.S ^XTMP("ABM-PVP2",$J,"PRV-NUM ZEROPD",ABMP("BDT"),ABMPRV,ABMVLOC,"OTHR")=^XTMP("ABM-PVP2",$J,"PRV-NUM ZEROPD",ABMP("BDT"),ABMPRV,ABMVLOC,"OTHR")-1
 ......;.S ^XTMP("ABM-PVP2",$J,"PRV-NUM ZEROPD",ABMP("BDT"),ABMPRV,"OTHR")=^XTMP("ABM-PVP2",$J,"PRV-NUM ZEROPD",ABMP("BDT"),ABMPRV,"OTHR")-1
 ......;I '$D(^XTMP("ABM-PVP2",$J,"PRV-NUM ZEROPD",ABMP("BDT"))) D
 ......;.S ^XTMP("ABM-PVP2",$J,"PRV-NUM PD",ABMP("BDT"),ABMPRV,ABMVLOC,"OTHR")=^XTMP("ABM-PVP2",$J,"PRV-NUM PD",ABMP("BDT"),ABMPRV,ABMVLOC,"OTHR")-1
 ......;.S ^XTMP("ABM-PVP2",$J,"PRV-NUM PD",ABMP("BDT"),ABMPRV,"OTHR")=^XTMP("ABM-PVP2",$J,"PRV-NUM PD",ABMP("BDT"),ABMPRV,"OTHR")-1
 ......;end old start new HEAT157235
 ......I $D(^XTMP("ABM-PVP2",$J,"PRV-NUM ZEROPD",ABMP("BDT"))) D
 .......S ^XTMP("ABM-PVP2",$J,"PRV-NUM ZEROPD",ABMP("BDT"),ABMPRV,ABMVLOC,"OTHR")=+$G(^XTMP("ABM-PVP2",$J,"PRV-NUM ZEROPD",ABMP("BDT"),ABMPRV,ABMVLOC,"OTHR"))-1
 .......S ^XTMP("ABM-PVP2",$J,"PRV-NUM ZEROPD",ABMP("BDT"),ABMPRV,"OTHR")=+$G(^XTMP("ABM-PVP2",$J,"PRV-NUM ZEROPD",ABMP("BDT"),ABMPRV,"OTHR"))-1
 ......I '$D(^XTMP("ABM-PVP2",$J,"PRV-NUM ZEROPD",ABMP("BDT"))) D
 .......S ^XTMP("ABM-PVP2",$J,"PRV-NUM PD",ABMP("BDT"),ABMPRV,ABMVLOC,"OTHR")=+$G(^XTMP("ABM-PVP2",$J,"PRV-NUM PD",ABMP("BDT"),ABMPRV,ABMVLOC,"OTHR"))-1
 .......S ^XTMP("ABM-PVP2",$J,"PRV-NUM PD",ABMP("BDT"),ABMPRV,"OTHR")=+$G(^XTMP("ABM-PVP2",$J,"PRV-NUM PD",ABMP("BDT"),ABMPRV,"OTHR"))-1
 ......;end new HEAT157235
 .....;start new abm*2.6*15 HEAT161159
 .....S ABMINS=0
 .....F  S ABMINS=$O(ABMILST(ABMINS)) Q:'ABMINS  D
 ......I ABMGRP="MCD"!(ABMGRP="CHIP")!($D(ABMI("INS",ABMINS))) S ABMRIND="ENR"
 .....;end new HEAT161159
 .....S ^XTMP("ABM-PVP2",$J,"PRV ENC CNT",ABMP("BDT"),ABMPRV,ABMVLOC,ABMGRP)=+$G(^XTMP("ABM-PVP2",$J,"PRV ENC CNT",ABMP("BDT"),ABMPRV,ABMVLOC,ABMGRP))+1
 .....S ^XTMP("ABM-PVP2",$J,"PRV ENC CNT",ABMP("BDT"),ABMPRV,ABMGRP)=+$G(^XTMP("ABM-PVP2",$J,"PRV ENC CNT",ABMP("BDT"),ABMPRV,ABMGRP))+1
 .....S ^XTMP("ABM-PVP2",$J,"PRV-NUM ENR",ABMP("BDT"),ABMPRV,ABMGRP)=+$G(^XTMP("ABM-PVP2",$J,"PRV-NUM ENR",ABMP("BDT"),ABMPRV,ABMGRP))+1
 .....S ^XTMP("ABM-PVP2",$J,"PRV ENC CNT",ABMP("BDT"),ABMPRV,ABMGRP)=+$G(^XTMP("ABM-PVP2",$J,"PRV ENC CNT",ABMP("BDT"),ABMPRV,ABMGRP))+1
 .....S ^XTMP("ABM-PVP2",$J,"PRV-NUM ENR",ABMP("BDT"),ABMPRV,ABMVLOC,ABMGRP)=+$G(^XTMP("ABM-PVP2",$J,"PRV-NUM ENR",ABMP("BDT"),ABMPRV,ABMVLOC,ABMGRP))+1
 .....S ^XTMP("ABM-PVP2",$J,"PRV-NUM ENR",ABMP("BDT"),ABMGRP,ABMVLOC)=+$G(^XTMP("ABM-PVP2",$J,"PRV-NUM ENR",ABMP("BDT"),ABMGRP,ABMVLOC))+1
 .....S ^XTMP("ABM-PVP2",$J,"PRV-NUM ENR",ABMP("BDT"),ABMGRP)=+$G(^XTMP("ABM-PVP2",$J,"PRV-NUM ENR",ABMP("BDT"),ABMGRP))+1
 .....;I +$G(^XTMP("ABM-PVP2",$J,"VISITS",ABMVDFN))'=2 D PTDATA  ;abm*2.6*15
 .....D PTDATA  ;abm*2.6*15
 .....S ^XTMP("ABM-PVP2",$J,"VISITS",ABMVDFN)=1
 ...;start new abm*2.6*15 HEAT183289
 ...;I +$G(^XTMP("ABM-PVP2",$J,"VISITS",ABMVDFN))=0,($G(ABMTSI)="Y"),(+$G(ABMICNT)=1) D  ;abm*2.6*15
 ...I +$G(^XTMP("ABM-PVP2",$J,"VISITS",ABMVDFN))'=1,($G(ABMTSI)="Y"),(+$G(ABMICNT)=1) D  ;abm*2.6*15
 ....S ^XTMP("ABM-PVP2",$J,"PRV-NUM TRIBSI",ABMP("BDT"),ABMPRV,ABMVLOC,"TRIBSI")=+$G(^XTMP("ABM-PVP2",$J,"PRV-NUM TRIBSI",ABMP("BDT"),ABMPRV,ABMVLOC,"TRIBSI"))+1
 ....S ^XTMP("ABM-PVP2",$J,"PRV-NUM TRIBSI",ABMP("BDT"),ABMPRV,"TRIBSI")=+$G(^XTMP("ABM-PVP2",$J,"PRV-NUM TRIBSI",ABMP("BDT"),ABMPRV,"TRIBSI"))+1
 ....S ^XTMP("ABM-PVP2",$J,"PRV-NUM TRIBSI",ABMP("BDT"),ABMGRP,ABMVLOC,"TRIBSI")=+$G(^XTMP("ABM-PVP2",$J,"PRV-NUM TRIBSI",ABMP("BDT"),ABMGRP,ABMVLOC,"TRIBSI"))+1
 ....S ^XTMP("ABM-PVP2",$J,"PRV-NUM TRIBSI",ABMP("BDT"),ABMVLOC,"TRIBSI")=+$G(^XTMP("ABM-PVP2",$J,"PRV-NUM TRIBSI",ABMP("BDT"),ABMVLOC,"TRIBSI"))+1
 ...;end new HEAT183289
 ...S X1=ABMP("BDT")
 ...S X2=1
 ...D C^%DTC
 ...I X>ABMP("BEDT") S ABMDTFLG=1 Q
 ...S ABMP("BDT")=X
 Q
GENROLL ;EP	
 D GENROLL^ABMM2P11  ;abm*2.6*15 split routine due to size
 Q
PRIMPOV ;
 S ABMDXPRI=+$O(^ABMDBILL(ABMDUZ2,ABMP("BDFN"),17,"C",0))
 S:ABMDXPRI'=0 ABMDXIEN=+$O(^ABMDBILL(ABMDUZ2,ABMP("BDFN"),17,"C",ABMDXPRI,0))
 Q:ABMDXIEN=0
 S ABMDX=$P($$DX^ABMCVAPI($P($G(^ABMDBILL(ABMDUZ2,ABMP("BDFN"),17,ABMDXIEN,0)),U),ABMSDT),U,2)
 Q