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

ABMM2P12.m

Go to the documentation of this file.
ABMM2P12 ;IHS/SD/SDR - MU Patient Volume EP Report ; 20 Feb 2014  6:04 AM
 ;;2.6;IHS 3P BILLING SYSTEM;**15**;NOV 12, 2009;Build 251
 ;IHS/SD/SDR - 2.6*15 - HEAT161159 - Removed DEMO,PATIENT from report.  Also added record indicator.
 ;IHS/SD/SDR - 2.6*15 - HEAT156874 - fix for programming error <SUBSCR>OTHERVST+23^ABMM2PV7.  Flag wasn't getting reset from previous visit where it was looking for
 ;  other visits on the same DOS.
 ;IHS/SD/SDR - 2.6*15 - HEAT171490 - Added code to put visit location NPI and TIN on patient list.  Also added record indicator to label visits on pt list
 ;  as to what grouping they were counted in.
 ;IHS/SD/SDR - 2.6*15 - HEAT174501 - Added primary provider NPI to group report.
 ;
ARBILLS ;
 K ABMTRIEN
 S ABMBILLN=+ABMBILLN_" "
 S ABMSAV=+ABMSAV
 F  S ABMBILLN=$O(^BARBL(ABMPAR,"B",ABMBILLN)) Q:$G(ABMBILLN)=""!(ABMBILLN'[ABMSAV)  D  Q:ABMBILLF
 .S ABMARIEN=0
 .S ABMHOLD=DUZ(2)
 .S DUZ(2)=ABMPAR
 .F  S ABMARIEN=$O(^BARBL(DUZ(2),"B",ABMBILLN,ABMARIEN)) Q:'ABMARIEN  D   Q:ABMBILLF
 ..S ABMCBAMT=$$GET1^DIQ(90050.01,ABMARIEN_",",15,"I")  ;Current Bill Amount
 ..S ABMARACT=$$GET1^DIQ(90050.01,ABMARIEN_",",3,"I")  ;A/R BILL, A/R ACCOUNT
 ..I +$$GET1^DIQ(90050.02,ABMARACT,".01","I")'=ABMINS Q  ;abm*2.6*15  Only look at A/R bills with 3P Bill insurer
 ..S D0=ABMARACT
 ..S ABMITYP=$$VALI^BARVPM(8)   ;GET 'VIP INSURER TYPE' CODE
 ..I ABMITYP="FPL" S ABMITYP="P"  ;change FPL to P abm*2.6*15 HEAT161159
 ..I "^I^N^"[("^"_ABMITYP_"^") Q
 ..;S ABMTSI=$P($G(^ABMNINS(DUZ(2),ABMINS,0)),U,11)  ;abm*2.6*15 HEAT183289
 ..S ABMGRP=$S(ABMITYP="D":"MCD",($D(ABMI("INS",ABMINS))):"CHIP",1:"OTHR")
 ..;I ABMTSI="Y"&($G(ABMFQHC)=1) S ABMGRP="TRIBSI"  ;abm*2.6*15 HEAT183289
 ..S ABMABILN=$P($G(^BARBL(DUZ(2),ABMARIEN,0)),U)
 ..;I "^MCD^CHIP^"'[("^"_ABMGRP_"^") Q
 ..;S ^XTMP("ABM-PVP2",$J,"VISITS",ABMVDFN)=1
 ..I "^MCD^CHIP^"[("^"_ABMGRP_"^") S ^XTMP("ABM-PVP2",$J,"VISITS",ABMVDFN)=1
 ..I "^MCD^CHIP^"'[("^"_ABMGRP_"^") S ^XTMP("ABM-PVP2",$J,"VISITS",ABMVDFN)=2
 ..;
 ..D CALCDTS^ABMM2PV1
 ..S ABMDTFLG=0
 ..S ABMP("BDT")=ABMP("BSDT")
 ..F  D  Q:ABMDTFLG=1
 ...I (ABMCNT#1000&(IOST["C")) W "."
 ...S ABMCNT=+$G(ABMCNT)+1
 ...I ABMY("RTYP")="SEL" D
 ....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
 ......I ABMP("VDT")<ABMP("BSDT") S ABMDTFLG=1 Q  ;vst is before 90-day  ;abm*2.6*12 HEAT141419
 ......D PTDATA^ABMM2PV1
 ......S X1=ABMP("BDT")
 ......S X2=1
 ......D C^%DTC
 ......I X>ABMP("BEDT") S ABMDTFLG=1 Q
 ......S ABMP("BDT")=X
 ...I ABMY("RTYP")="GRP" D GPTDATA^ABMM2PV1
 ...S X1=ABMP("BDT")
 ...S X2=1
 ...D C^%DTC
 ...I X>ABMP("BEDT") S ABMDTFLG=1 Q
 ...S ABMP("BDT")=X
 ..;I "^I^N^"[($$GET1^DIQ(9999999.181,$$GET1^DIQ(9999999.18,ABMINS,".211","I"),1,"I")) Q
 ..D TRANS
 .S DUZ(2)=ABMHOLD
 Q
TRANS ;
 S ABMTRIEN=0
 F  S ABMTRIEN=$O(^BARTR(DUZ(2),"AC",ABMARIEN,ABMTRIEN)) Q:'ABMTRIEN  D  Q:ABMBILLF
 .S ABMTRTYP=$P($G(^BARTR(DUZ(2),ABMTRIEN,1)),U)
 .S ABMADJT=$P($G(^BARTR(DUZ(2),ABMTRIEN,1)),U,3)
 .I (ABMTRTYP'=40)&("^113^114^121^132^137^138^139^"'[("^"_ABMADJT_"^")) D ZEROPD^ABMM2PV1 Q  ;pymt or pymt credit
 .I ABMTRTYP=49 Q  ;skip BILL NEW
 .I $P($G(^BARTR(DUZ(2),ABMTRIEN,0)),U,7)=1 Q  ;msg trans
 .S ABMTRAMT=$$GET1^DIQ(90050.03,ABMTRIEN,3.5)  ;debit-credit field
 .I ABMTRAMT<(.01) Q  ;don't count 0 pymts or reversals
 .I ABMY("RTYP")="GRP" D GRPBILL^ABMM2PV1 Q
 .S ABMPIEN=0
 .K ABMPRVC
 .F  S ABMPIEN=$O(^AUPNVPRV("AD",ABMVDFN,ABMPIEN)) Q:'ABMPIEN  D  Q:ABMBILLF
 ..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 PD BILLS",ABMP("BDT"),ABMPRV,ABMGRP,ABMVDFN,ABMP("BDFN"))=""
 ...S ^XTMP("ABM-PVP2",$J,"PRV-NUM PD DET",ABMP("BDT"),ABMPRV,ABMGRP,ABMVDFN,ABMP("BDFN"))=ABMTRAMT
 ...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-VST",ABMP("BDT"),ABMVDFN,ABMPRV)=""
 ...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 PTDATA^ABMM2PV1
 ...S X1=ABMP("BDT")
 ...S X2=1
 ...D C^%DTC
 ...I X>ABMP("BEDT") S ABMDTFLG=1 Q
 ...S ABMP("BDT")=X
 Q