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

ABMMUPV1.m

Go to the documentation of this file.
ABMMUPV1 ;IHS/SD/SDR - MU Patient Volume EP Report ;
 ;;2.6;IHS 3P BILLING SYSTEM;**7,8,10,11,12**;NOV 12, 2009;Build 187
 ;
COMPUTE ;EP - gather data report
 I ABMY("90")="B" D  Q
 .S X1=ABMY("SDT")
 .S X2=89
 .D C^%DTC
 .S (ABMY("EDT"),ABMP("EDT"))=X
 .D VISITS
 .D BILLS
 .D CALC^ABMMUPV2
 .D PRINT^ABMMUPV3
 ;
 I ABMY("90")="C" D VISITS,BILLS,CALC^ABMMUPV2,PRINT^ABMMUPV3 Q
 ;
 S (ABMY("SDT"),ABMP("SDT"))=(ABMY("QYR")-1700)_"0101"
 S X1=ABMP("SDT")
 S X2=89
 D C^%DTC
 S ABMP("EDT")=X
 D VISITS
 D BILLS
 D CALC^ABMMUPV2
 ;start new abm*2.6*8
 I ABMY("RTYP")="SEL" D
 .S ABMPRV=0
 .F  S ABMPRV=$O(ABMPRVDR(ABMPRV)) Q:'ABMPRV  D
 ..I +$G(^XTMP("ABM-PVP",$J,"PRV TOP",ABMPRV))>29.99 K ABMPRVDR(ABMPRV)
 I ABMY("RTYP")="GRP",(+$G(^XTMP("ABM-PVP",$J,"PRV TOP"))>29.99) D PRINT^ABMMUPV3 Q
 I ABMY("RTYP")="SEL",'$D(ABMPRVDR) D PRINT^ABMMUPV3 Q
 ;end new abm*2.6*8
 S ABMQFLG=0
 F  D  Q:ABMQFLG=1
 .S X1=ABMP("SDT")
 .S X2=1
 .D C^%DTC
 .S ABMP("SDT")=X
 .S ABMDFLG=1
 .S X1=ABMP("SDT")
 .S X2=89
 .D C^%DTC
 .S ABMP("EDT")=X
 .I ABMP("EDT")>((ABMY("QYR")-1700)_"1231")!(ABMP("EDT")>DT) S ABMQFLG=1 Q
 .K ^XTMP("ABM-PVP",$J,"VISITS")
 .D VISITS
 .D BILLS
 .D CALC^ABMMUPV2
 .;start new abm*2.6*8
 .I ABMY("RTYP")="SEL" D
 ..S ABMPRV=0
 ..F  S ABMPRV=$O(ABMPRVDR(ABMPRV)) Q:'ABMPRV  D
 ...I +$G(^XTMP("ABM-PVP",$J,"PRV TOP",ABMPRV))>29.99 K ABMPRVDR(ABMPRV)
 .I ABMY("RTYP")="SEL",'$D(ABMPRVDR) Q
 .I ABMY("RTYP")="GRP",(+$G(^XTMP("ABM-PVP",$J,"PRV TOP"))>29.99)
 .;end new abm*2.6*8
 D PRINT^ABMMUPV3
 K ABMY("EDT")
 Q
VISITS ;
 S ABMSDT=ABMP("SDT")
 S ABMEDT=ABMP("EDT")+.999999
 ;start new abm*2.6*8
 S ABMINS=0,ABMOINS="NO BILL"
 S ABMITYP="X"
 ;end new abm*2.6*8
 F  S ABMSDT=$O(^AUPNVSIT("B",ABMSDT)) Q:'ABMSDT!(ABMSDT>ABMEDT)  D
 .S ABMVDFN=0
 .F  S ABMVDFN=$O(^AUPNVSIT("B",ABMSDT,ABMVDFN)) Q:'ABMVDFN  D
 ..S ABMSCAT=$$GET1^DIQ(9000010,ABMVDFN,.07,"I")  ;service cat
 ..S ABMCLNC=$$GET1^DIQ(9000010,ABMVDFN,.08,"I")  ;clinic
 ..Q:"^39^D1^D2^76^63^51^52^72^22^42^54^57^66^71^77^B5^C6^"[("^"_$$GET1^DIQ(40.7,$$GET1^DIQ(9000010,ABMVDFN,.08,"I"),1,"E")_"^")&(ABMY("RTYP")="SEL")  ;exclude clinics  ;abm*2.6*8
 ..S ABMPT=$$GET1^DIQ(9000010,ABMVDFN,.05,"I")  ;patient
 ..;if SEL report type, service cat MUST be S,O,R, or (A w/clinic'=30)
 ..I "^H^I^C^T^N^E^D^X^R^"[("^"_ABMSCAT_"^") Q  ;abm*2.6*8
 ..I (ABMSCAT="A")&(ABMCLNC=30) Q  ;abm*2.6*8
 ..S ABMVLOC=$$GET1^DIQ(9000010,ABMVDFN,.06,"I")
 ..Q:ABMVLOC=""  ;abm*2.6*8
 ..I ($$GET1^DIQ(9000010,ABMVLOC,.12)'="")&(ABMSDT>$$GET1^DIQ(9000010,ABMVLOC,.12,"I")&($$GET1^DIQ(9000010,ABMVLOC,1111,"I")'="R")) Q
 ..Q:'$D(ABMF(ABMVLOC))  ;not a selected location
 ..I ABMY("RTYP")="GRP" D GRPVST Q  ;abm*2.6*8
 ..S ABMPIEN=0
 ..K ABMPRVC  ;abm*2.6*12 HEAT124020
 ..F  S ABMPIEN=$O(^AUPNVPRV("AD",ABMVDFN,ABMPIEN)) Q:'ABMPIEN  D
 ...S ABMPRV=$$GET1^DIQ(9000010.06,ABMPIEN,.01,"I")
 ...Q:'$D(ABMPRVDR(ABMPRV))
 ...;start new abm*2.6*12 HEAT124020
 ...;skip provider if on visit more than once
 ...Q:$D(ABMPRVC(ABMPRV))
 ...S ABMPRVC(ABMPRV)=1
 ...;end new HEAT124020
 ...;I $D(^ABMMUPRM(1,1,"B",ABMVLOC)) S ABMFQ=$O(^ABMMUPRM(1,1,"B",ABMVLOC,0)) I $$GET1^DIQ(200,ABMPRV,53.5,"E")="PHYSICIAN ASSISTANT",$P($G(^ABMMUPRM(1,1,ABMFQ,0)),U,2)'=1 Q
 ...S ^XTMP("ABM-PVP",$J,"PRV-DENOM",ABMP("SDT"),ABMPRV)=+$G(^XTMP("ABM-PVP",$J,"PRV-DENOM",ABMP("SDT"),ABMPRV))+1
 ...S ^XTMP("ABM-PVP",$J,"PRV-DENOM",ABMP("SDT"),ABMPRV,ABMVLOC)=+$G(^XTMP("ABM-PVP",$J,"PRV-DENOM",ABMP("SDT"),ABMPRV,ABMVLOC))+1
 ...S ^XTMP("ABM-PVP",$J,"PT VSTS",ABMPT,ABMSDT,ABMVDFN)=""  ;list of visits by patient,DOS
 ...S ^XTMP("ABM-PVP",$J,"VISITS",ABMVDFN)=""  ;list of visits to check for pymt
 ...S ^XTMP("ABM-PVP",$J,"VISIT CNT")=+$G(^XTMP("ABM-PVP",$J,"VISIT CNT"))+1  ;count of visits
 ...S ^XTMP("ABM-PVP",$J,"ALL VISITS",ABMVDFN)=""  ;list of all visits looked at
 ...S ^XTMP("ABM-PVP",$J,"ALL VISIT CNT")=+$G(^XTMP("ABM-PVP",$J,"ALL VISIT CNT"))+1  ;count of all visits
 ...I (^XTMP("ABM-PVP",$J,"ALL VISIT CNT")#1000&(IOST["C")) W "." U 0 W "."
 ...K ABMITYP
 ...D PTDATA
 Q
 ;start new abm*2.6*8
GRPVST ;
 S ABMPIEN=0
 K ABMPRVC  ;abm*2.6*12 HEAT124020
 F  S ABMPIEN=$O(^AUPNVPRV("AD",ABMVDFN,ABMPIEN)) Q:'ABMPIEN  D
 .S ABMPRV=$$GET1^DIQ(9000010.06,ABMPIEN,.01,"I")
 .;start new abm*2.6*12 HEAT124020
 .;skip provider if on visit more than once
 .Q:$D(ABMPRVC(ABMPRV))
 .S ABMPRVC(ABMPRV)=1
 .;end new HEAT124020
 .S ABMPRVCL=+$$GET1^DIQ(200,ABMPRV,53.5,"I")
 .I ABMPRVCL=0 S ABMPRV("O",ABMPRV)=""
 .I ABMPRVCL'=0 D
 ..I '$D(^ABMMUPRM(1,2,"B",ABMPRVCL)) S ABMPRV("O",ABMPRV)=""
 ..I $$GET1^DIQ(7,ABMPRVCL,9999999.01,"E")=11 D
 ...I '$D(^ABMMUPRM(1,1,"B",ABMVLOC)) S ABMPRV("O",ABMPRV)=""
 ...I $D(^ABMMUPRM(1,1,"B",ABMVLOC)) D
 ....S ABMVIEN=$O(^ABMMUPRM(1,1,"B",ABMVLOC,0))
 ....I $P($G(^ABMMUPRM(1,1,ABMVIEN,0)),U,2)=1 S ABMPRV("E",ABMPRV)=""
 ....I $P($G(^ABMMUPRM(1,1,ABMVIEN,0)),U,2)'=1 S ABMPRV("O",ABMPRV)=""
 ..I $$GET1^DIQ(7,ABMPRVCL,9999999.01,"E")'=11,$D(^ABMMUPRM(1,2,"B",ABMPRVCL)) S ABMPRV("E",ABMPRV)=""
 ;I $D(^ABMMUPRM(1,1,"B",ABMVLOC)) S ABMFQ=$O(^ABMMUPRM(1,1,"B",ABMVLOC,0)) I $$GET1^DIQ(200,ABMPRV,53.5,"E")="PHYSICIAN ASSISTANT",$P($G(^ABMMUPRM(1,1,ABMFQ,0)),U,2)'=1 Q
 S ^XTMP("ABM-PVP",$J,"PRV-DENOM",ABMP("SDT"))=+$G(^XTMP("ABM-PVP",$J,"PRV-DENOM",ABMP("SDT")))+1
 S ^XTMP("ABM-PVP",$J,"PRV-DENOM",ABMP("SDT"),ABMVLOC)=+$G(^XTMP("ABM-PVP",$J,"PRV-DENOM",ABMP("SDT"),ABMVLOC))+1
 S ^XTMP("ABM-PVP",$J,"PT VSTS",ABMPT,ABMSDT,ABMVDFN)=""  ;list of visits by patient,DOS
 S ^XTMP("ABM-PVP",$J,"VISITS",ABMVDFN)=""  ;list of visits to check for pymt
 S ^XTMP("ABM-PVP",$J,"VISIT CNT")=+$G(^XTMP("ABM-PVP",$J,"VISIT CNT"))+1  ;count of visits
 S ^XTMP("ABM-PVP",$J,"ALL VISITS",ABMVDFN)=""  ;list of all visits looked at
 S ^XTMP("ABM-PVP",$J,"ALL VISIT CNT")=+$G(^XTMP("ABM-PVP",$J,"ALL VISIT CNT"))+1  ;count of all visits
 I (^XTMP("ABM-PVP",$J,"ALL VISIT CNT")#1000&(IOST["C")) W "." U 0 W "."
 K ABMITYP
 D GPTDATA
 Q
 ;end new abm*2.6*8
BILLS ;EP
 S ABMCNT=0
 S ABMDUZ2=0
 S ABMFOUND=0
 F  S ABMDUZ2=$O(^ABMDBILL(ABMDUZ2)) Q:'ABMDUZ2  D
 .Q:'$D(^ABMDBILL(ABMDUZ2,0))  ;abm*2.6*11 HEAT96914
 .S ABMVDFN=0
 .F  S ABMVDFN=$O(^XTMP("ABM-PVP",$J,"VISITS",ABMVDFN)) Q:'ABMVDFN  D
 ..S ABMBILLF=0  ;abm*2.6*8 HEAT47191
 ..Q:($G(^XTMP("ABM-PVP",$J,"VISITS",ABMVDFN))=1)  ;already counted this vst on report
 ..Q:'$D(^ABMDBILL(ABMDUZ2,"AV",ABMVDFN))  ;visit not under this DUZ(2)
 ..S ABMP("BDFN")=0
 ..;F  S ABMP("BDFN")=$O(^ABMDBILL(ABMDUZ2,"AV",ABMVDFN,ABMP("BDFN"))) Q:'ABMP("BDFN")  ;abm*2.6*8 HEAT47191
 ..F  S ABMP("BDFN")=$O(^ABMDBILL(ABMDUZ2,"AV",ABMVDFN,ABMP("BDFN"))) Q:'ABMP("BDFN")  D  Q:ABMBILLF  ;abm*2.6*8 HEAT47191
 ...S (ABMBILLN,ABMSAV)=$P($G(^ABMDBILL(ABMDUZ2,ABMP("BDFN"),0)),U)
 ...I $P($G(^ABMDBILL(ABMDUZ2,ABMP("BDFN"),0)),U,4)="X" Q
 ...S ABMVLOC=$P($G(^ABMDBILL(ABMDUZ2,ABMP("BDFN"),0)),U,3)
 ...S ABMINS=$P($G(^ABMDBILL(ABMDUZ2,ABMP("BDFN"),0)),U,8)
 ...S ABMPT=$P($G(^ABMDBILL(ABMDUZ2,ABMP("BDFN"),0)),U,5)
 ...S (ABMBILLN,ABMSAV)=$P($G(^ABMDBILL(ABMDUZ2,ABMP("BDFN"),0)),U)
 ...S ABMBILLN=+ABMBILLN_" "  ;abm*2.6*10 HEAT86634
 ...S ABMSAV=+ABMSAV  ;abm*2.6*11 HEAT89722
 ...;F  S ABMBILLN=$O(^BARBL(ABMPAR,"B",ABMBILLN)) Q:$G(ABMBILLN)=""!(ABMBILLN'[ABMSAV)  D  ;abm*2.6*8 HEAT47191
 ...F  S ABMBILLN=$O(^BARBL(ABMPAR,"B",ABMBILLN)) Q:$G(ABMBILLN)=""!(ABMBILLN'[ABMSAV)  D  Q:ABMBILLF  ;abm*2.6*8 HEAT47191
 ....S ABMARIEN=0
 ....S ABMHOLD=DUZ(2)
 ....S DUZ(2)=ABMPAR
 ....;F  S ABMARIEN=$O(^BARBL(DUZ(2),"B",ABMBILLN,ABMARIEN)) Q:'ABMARIEN  D  ;abm*2.6*8 HEAT47191
 ....F  S ABMARIEN=$O(^BARBL(DUZ(2),"B",ABMBILLN,ABMARIEN)) Q:'ABMARIEN  D   Q:ABMBILLF  ;abm*2.6*8 HEAT47191
 .....S ABMARACT=$$GET1^DIQ(90050.01,ABMARIEN_",",3,"I")     ;A/R BILL, A/R ACCOUNT
 .....S D0=ABMARACT
 .....S ABMITYP=$$VALI^BARVPM(8)   ;GET 'VIP INSURER TYPE' CODE
 .....S ABMGRP=$S(ABMITYP="D":"MCD",ABMITYP="K":"CHIP",1:"OTHR")
 .....S ABMABILN=$P($G(^BARBL(DUZ(2),ABMARIEN,0)),U)
 .....S ABMTRIEN=0
 .....;F  S ABMTRIEN=$O(^BARTR(DUZ(2),"AC",ABMARIEN,ABMTRIEN)) Q:'ABMTRIEN  D  ;abm*2.6*8 HEAT47191
 .....F  S ABMTRIEN=$O(^BARTR(DUZ(2),"AC",ABMARIEN,ABMTRIEN)) Q:'ABMTRIEN  D  Q:ABMBILLF  ;abm*2.6*8 HEAT47191
 ......S ABMTRTYP=$P($G(^BARTR(DUZ(2),ABMTRIEN,1)),U)
 ......S ABMADJT=$P($G(^BARTR(DUZ(2),ABMTRIEN,1)),U,3)  ;abm*2.6*8
 ......;I "^40^113^114^121^132^137^138^139^"'[("^"_ABMTRTYP_"^") Q  ;payment or payment credit  ;abm*2.6*8
 ......I (ABMTRTYP'=40)&("^113^114^121^132^137^138^139^"'[("^"_ABMADJT_"^")) Q  ;payment or payment credit  ;abm*2.6*8
 ......I ($$GET1^DIQ(90050.03,ABMTRIEN,3.5))<(.01) Q  ;don't count 0 pymts or reversals
 ......I ABMY("RTYP")="GRP" D GRPBILL Q  ;abm*2.6*8
 ......S ABMPIEN=0
 ......;F  S ABMPIEN=$O(^ABMDBILL(ABMDUZ2,ABMP("BDFN"),41,ABMPIEN)) Q:'ABMPIEN  D
 ......;.S ABMPRV=$P($G(^ABMDBILL(ABMDUZ2,ABMP("BDFN"),41,ABMPIEN,0)),U)
 ......;F  S ABMPIEN=$O(^AUPNVPRV("AD",ABMVDFN,ABMPIEN)) Q:'ABMPIEN  D  ;abm*2.6*8 HEAT47191
 ......F  S ABMPIEN=$O(^AUPNVPRV("AD",ABMVDFN,ABMPIEN)) Q:'ABMPIEN  D  Q:ABMBILLF  ;abm*2.6*8 HEAT47191
 .......S ABMPRV=$$GET1^DIQ(9000010.06,ABMPIEN,".01","I")
 .......Q:'$D(ABMPRVDR(ABMPRV))
 .......;I $D(^ABMMUPRM(1,1,"B",ABMVLOC)) S ABMFQ=$O(^ABMMUPRM(1,1,"B",ABMVLOC,0)) I $$GET1^DIQ(200,ABMPRV,53.5,"E")="PHYSICIAN ASSISTANT",$P($G(^ABMMUPRM(1,1,ABMFQ,0)),U,2)'=1 Q
 .......I ABMITYP="D"!((ABMITYP="K")&$D(^ABMMUPRM(1,1,"B",ABMVLOC))) D
 ........S ^XTMP("ABM-PVP",$J,"PRV-NUM",ABMP("SDT"),ABMPRV)=+$G(^XTMP("ABM-PVP",$J,"PRV-NUM",ABMP("SDT"),ABMPRV))+1
 ........S ^XTMP("ABM-PVP",$J,"PRV-NUM",ABMP("SDT"),ABMPRV,ABMVLOC)=+$G(^XTMP("ABM-PVP",$J,"PRV-NUM",ABMP("SDT"),ABMPRV,ABMVLOC))+1
 ........S ABMBILLF=1  ;abm*2.6*11 HEAT89722
 .......S ^XTMP("ABM-PVP",$J,"PRV ENC CNT",ABMP("SDT"),ABMPRV,ABMVLOC,ABMGRP)=+$G(^XTMP("ABM-PVP",$J,"PRV ENC CNT",ABMP("SDT"),ABMPRV,ABMVLOC,ABMGRP))+1
 .......S ^XTMP("ABM-PVP",$J,"PRV ENC CNT",ABMP("SDT"),ABMPRV,ABMGRP)=+$G(^XTMP("ABM-PVP",$J,"PRV ENC CNT",ABMP("SDT"),ABMPRV,ABMGRP))+1
 .......S ^XTMP("ABM-PVP",$J,"PRV-VST",ABMVDFN,ABMPRV)="",^XTMP("ABM-PVP",$J,"VISITS",ABMVDFN)=1
 .......;S ABMBILLF=1  ;abm*2.6*8 HEAT47191  ;abm*2.6*11 HEAT89722
 .......I (ABMCNT#1000&(IOST["C")) W "."
 .......S ABMCNT=+$G(ABMCNT)+1
 .......D PTDATA
 .....S DUZ(2)=ABMHOLD
 ...I +$G(ABMFOUND)=1 D OTHERVST  ;check for other visits on DOS to mark as paid
 Q
 ;start new abm*2.6*8
GRPBILL ;
 Q:($G(^XTMP("ABM-PVP",$J,"VISITS",ABMVDFN))=1)  ;abm*2.6*8
 I ABMITYP="D"!((ABMITYP="K")&$D(^ABMMUPRM(1,1,"B",ABMVLOC))) D
 .S ^XTMP("ABM-PVP",$J,"PRV-NUM",ABMP("SDT"))=+$G(^XTMP("ABM-PVP",$J,"PRV-NUM",ABMP("SDT")))+1
 .S ^XTMP("ABM-PVP",$J,"PRV-NUM",ABMP("SDT"),ABMVLOC)=+$G(^XTMP("ABM-PVP",$J,"PRV-NUM",ABMP("SDT"),ABMVLOC))+1
 S ^XTMP("ABM-PVP",$J,"PRV ENC CNT",ABMP("SDT"),ABMVLOC,ABMGRP)=+$G(^XTMP("ABM-PVP",$J,"PRV ENC CNT",ABMP("SDT"),ABMVLOC,ABMGRP))+1
 S ^XTMP("ABM-PVP",$J,"PRV ENC CNT",ABMP("SDT"),ABMGRP)=+$G(^XTMP("ABM-PVP",$J,"PRV ENC CNT",ABMP("SDT"),ABMGRP))+1
 S ^XTMP("ABM-PVP",$J,"PRV-VST",ABMVDFN)="",^XTMP("ABM-PVP",$J,"VISITS",ABMVDFN)=1
 S ^XTMP("ABM-PVP",$J,"PRV-VST",ABMVDFN)="",^XTMP("ABM-PVP",$J,"VISITS",ABMVDFN)=1
 I (ABMCNT#1000&(IOST["C")) W "."
 S ABMCNT=+$G(ABMCNT)+1
 D GPTDATA
 S DUZ(2)=ABMHOLD
 I +$G(ABMFOUND)=1 D GRPOTHVS  ;check for other visits on DOS to mark as paid
 Q
GRPOTHVS ;
 S ABMPT=$P($G(^ABMDBILL(DUZ(2),ABMP("BDFN"),0)),U,5)
 S (ABMDOS,ABMDOSSV)=$P($G(^ABMDBILL(DUZ(2),ABMP("BDFN"),7)),U)
 F  S ABMDOS=$O(^XTMP("ABM-PVP",$J,"PT VSTS",ABMPT,ABMDOS)) Q:'ABMDOS!($P(ABMDOS,".")>$P(ABMDOSSV,"."))  D
 .S ABMVCHK=0
 .F  S ABMVCHK=$O(^XTMP("ABM-PVP",$J,"PT VSTS",ABMPT,ABMDOS,ABMVCHK)) Q:'ABMVCHK  D
 ..Q:^XTMP("ABM-PVP",$J,"VISITS",ABMVCHK)=1  ;already counted this visit
 ..S ^XTMP("ABM-PVP",$J,"PRV-NUM",ABMP("SDT"))=+$G(^XTMP("ABM-PVP",$J,"PRV-NUM",ABMP("SDT")))+1
 ..S ^XTMP("ABM-PVP",$J,"PRV-NUM",ABMP("SDT"),ABMVLOC)=+$G(^XTMP("ABM-PVP",$J,"PRV-NUM",ABMP("SDT"),ABMVLOC))+1
 ..S ^XTMP("ABM-PVP",$J,"VISITS",ABMVCHK)=1
 Q
 ;end new abm*2.6*8
OTHERVST ;EP
 S ABMPT=$P($G(^ABMDBILL(DUZ(2),ABMP("BDFN"),0)),U,5)
 S (ABMDOS,ABMDOSSV)=$P($G(^ABMDBILL(DUZ(2),ABMP("BDFN"),7)),U)
 F  S ABMDOS=$O(^XTMP("ABM-PVP",$J,"PT VSTS",ABMPT,ABMDOS)) Q:'ABMDOS!($P(ABMDOS,".")>$P(ABMDOSSV,"."))  D
 .S ABMVCHK=0
 .F  S ABMVCHK=$O(^XTMP("ABM-PVP",$J,"PT VSTS",ABMPT,ABMDOS,ABMVCHK)) Q:'ABMVCHK  D
 ..Q:^XTMP("ABM-PVP",$J,"VISITS",ABMVCHK)=1  ;already counted this visit
 ..S ABMPIEN=0
 ..F  S ABMPIEN=$O(^AUPNVPRV("AD",ABMVCHK,ABMPIEN)) Q:'ABMPIEN  D
 ...S ABMPRV=$$GET1^DIQ(9000010.06,ABMPIEN,.01,"I")
 ...Q:'$D(ABMPRVDR(ABMPRV))
 ...Q:$D(^XTMP("ABM-PVP",$J,"PRV-VST",ABMVCHK,ABMPRV))
 ...S ^XTMP("ABM-PVP",$J,"PRV-NUM",ABMP("SDT"),ABMPRV)=+$G(^XTMP("ABM-PVP",$J,"PRV-NUM",ABMP("SDT"),ABMPRV))+1
 ...S ^XTMP("ABM-PVP",$J,"PRV-NUM",ABMP("SDT"),ABMPRV,ABMVLOC)=+$G(^XTMP("ABM-PVP",$J,"PRV-NUM",ABMP("SDT"),ABMPRV,ABMVLOC))+1
 ...S ^XTMP("ABM-PVP",$J,"VISITS",ABMVCHK)=1
 Q
GPTDATA ;EP
 S ABMPNM=$$GET1^DIQ(2,ABMPT,.01,"E")
 I +$G(ABMINS) S ABMOINS=$$GET1^DIQ(9999999.18,ABMINS,.01,"E")
 S:$G(ABMITYP)="" ABMITYP="X"
 S:$G(ABMTRIEN)="" ABMTRIEN="NOT PAID"
 S ABMREC=ABMVDFN_U_ABMPT_U_$P(ABMTRIEN,".")_U_$S(ABMITYP="D"!((ABMITYP="K")&$D(^ABMMUPRM(1,1,"B",ABMVLOC))):"*",1:"")
 S ^XTMP("ABM-PVP",$J,"PT LST",ABMP("SDT"),ABMVLOC,ABMITYP,ABMOINS,$P(ABMPNM,","),$P(ABMPNM,",",2),$P($G(^AUPNVSIT(ABMVDFN,0)),U),ABMVDFN)=ABMREC
 I ($G(ABMTRIEN)'="NOT PAID"),$D(^XTMP("ABM-PVP",$J,"PT LST",ABMP("SDT"),ABMVLOC,"X","NO BILL",$P(ABMPNM,","),$P(ABMPNM,",",2),$P($G(^AUPNVSIT(ABMVDFN,0)),U),ABMVDFN)) D
 .K ^XTMP("ABM-PVP",$J,"PT LST",ABMP("SDT"),ABMVLOC,"X","NO BILL",$P(ABMPNM,","),$P(ABMPNM,",",2),$P($G(^AUPNVSIT(ABMVDFN,0)),U),ABMVDFN)
 Q
PTDATA ;EP
 S ABMPNM=$$GET1^DIQ(2,ABMPT,.01,"E")
 I +$G(ABMINS) S ABMOINS=$$GET1^DIQ(9999999.18,ABMINS,.01,"E")
 I +$G(ABMARACT) S ABMARACT=$$GET1^DIQ(90050.01,ABMARIEN_",",3,"E")  ;A/R BILL, A/R ACCOUNT  ;abm*2.6*11 HEAT89722
 S:$G(ABMITYP)="" ABMITYP="X"
 S:$G(ABMTRIEN)="" ABMTRIEN="NOT PAID"
 S ABMREC=ABMVDFN_U_ABMPT_U_$P(ABMTRIEN,".")_U_$S(ABMITYP="D"!((ABMITYP="K")&$D(^ABMMUPRM(1,1,"B",ABMVLOC))):"*",1:"")
 ;S ^XTMP("ABM-PVP",$J,"PT LST",ABMP("SDT"),ABMPRV,ABMVLOC,ABMITYP,ABMOINS,$P(ABMPNM,","),$P(ABMPNM,",",2),$P($G(^AUPNVSIT(ABMVDFN,0)),U),ABMVDFN)=ABMREC  ;abm*2.6*11 HEAT89722
 S ^XTMP("ABM-PVP",$J,"PT LST",ABMP("SDT"),ABMPRV,ABMVLOC,ABMITYP,$S($G(ABMARACT)'="":ABMARACT,1:ABMOINS),$P(ABMPNM,","),$P(ABMPNM,",",2),$P($G(^AUPNVSIT(ABMVDFN,0)),U),ABMVDFN)=ABMREC  ;abm*2.6*11 HEAT89722
 I ($G(ABMTRIEN)'="NOT PAID"),$D(^XTMP("ABM-PVP",$J,"PT LST",ABMP("SDT"),ABMPRV,ABMVLOC,"X","NO BILL",$P(ABMPNM,","),$P(ABMPNM,",",2),$P($G(^AUPNVSIT(ABMVDFN,0)),U),ABMVDFN)) D
 .K ^XTMP("ABM-PVP",$J,"PT LST",ABMP("SDT"),ABMPRV,ABMVLOC,"X","NO BILL",$P(ABMPNM,","),$P(ABMPNM,",",2),$P($G(^AUPNVSIT(ABMVDFN,0)),U),ABMVDFN)
 Q