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

ABMAROLL.m

Go to the documentation of this file.
  1. ABMAROLL ; IHS/ASDST/DMJ - A/R ROLL OVER ;
  1. ;;2.6;IHS 3P BILLING SYSTEM;;NOV 12, 2009
  1. ;Original;DMJ;
  1. ;
  1. ; IHS/DSD/LSL 03/30/98 - Don't complete a cancelled
  1. ; bill. This will cause errors on productivity
  1. ; report and previous payments of bills.
  1. ;
  1. ; IHS/DSD/DMJ 07/23/99 - NOIS PEB-0799-90049 Patch 3 #8
  1. ; Changed from the DIC("DR") method to updating each field
  1. ; individually. Apparently if one field in the string fails,
  1. ; fileman doesn't file anything.
  1. ;
  1. ; IHS/ASDS/SDH - 08/14/01 - V2.4 Patch 9 - NOIS NDA-1199-180065
  1. ; Modified routine to subtract refund instead of add (two negatives
  1. ; makes a positive)
  1. ;
  1. ; IHS/SD/SDR - 5/28/02 - V2.5 P2 - NOIS HQW-1201-100023
  1. ; Modified so that the export date will not be deleted anymore.
  1. ; This was causing problems with some reports not showing correct
  1. ; data because of this date missing.
  1. ;
  1. ; IHS/SD/SDR - 6/6/05 V2.5 p8
  1. ; Made LKUP and FILE published entry points per A/R
  1. ;
  1. ; IHS/SD/SDR - v2.5 p9 - IM19622
  1. ; Fixed so replacement insurer is checked when updating status
  1. ;
  1. ; IHS/SD/SDR - v2.5 p 13 - NO IM
  1. ;
  1. ; *********************************************************************
  1. ;
  1. START(X,ABM,Z,ZZ) ;EP - FROM A/R
  1. ;
  1. ; This routine is called from A/R ^BARROLL. The purpose is to
  1. ; file payment information into the Payment multiple of 3P BILL.
  1. ; After filing this data, the bill is marked as completed.
  1. ; Variables are then set in preparation of calling the Eligibility
  1. ; Checker. This is done to find other billable sources that have
  1. ; not yet been billed in relation to this claim. If other billable
  1. ; sources exist and the user holds the 3PB key, they are asked if
  1. ; the claim should be re-opened for future billing. Otherwise, the
  1. ; claim is automatically reopened.
  1. ; Rtn has been modified to work if called by either A/R 1.0 or 1.1
  1. ;
  1. ; Input: X = BILL INTERNAL ENTRY NUMBER^VISIT LOCATION
  1. ; ABM = PAYMENT ARRAY from 1.1
  1. ; TOTAL PAYMENT AMT FROM 1.0
  1. ; Z = BILL NAME from 1.1
  1. ; Not passed by 1.0
  1. ; ZZ = A/R MESSAGE
  1. ;
  1. S ABMP("BDFN")=+X ; IEN to 3PB BILL
  1. S ABMP("BILL")=$P(^ABMDBILL(DUZ(2),ABMP("BDFN"),0),"^",1) ; Bill #
  1. I '$D(Z) D ; Z UNDEF IFF rtn called by A/R 1.0
  1. .S ABMP("AR1.0")=""
  1. .S Y=ABM
  1. .K ABM
  1. .S ABM("AMT")=Y
  1. I $G(Z)]"",ABMP("BILL")'=Z D LKUP
  1. I 'ABMP("BDFN") D Q
  1. .W !,"Cannot locate bill ",Z," in 3P Bill file.",!
  1. D FILE ; File A/R data in payment multiple of 3P BILL
  1. D SET ; Set variables necessary for Eligibility Checker
  1. D REST ; Look for unused billable sources
  1. K ABM,ABMP,ABMA
  1. Q
  1. ;
  1. LKUP ; PEP - LOOK UP ABMP("BDFN")
  1. S ABMP("BDFN")=$O(^ABMDBILL(DUZ(2),"B",Z,0))
  1. Q:'ABMP("BDFN")
  1. S ABMP("BILL")=$P(^ABMDBILL(DUZ(2),ABMP("BDFN"),0),"^",1)
  1. Q
  1. ;
  1. FILE ; PEP - FILE PAYMENT INFORMATION
  1. ; OK for both 1.0 and 1.1
  1. ; The payment multiple will contain cumulative data about that bill
  1. ;
  1. ; 3PB field = A/R field
  1. ;
  1. ; Payment Amount = Payments + 3P Previous Payments + Payment
  1. ; Adjustments - Refunds
  1. ; Deductible = Deductible
  1. ; Co-Insurance = Co-pay
  1. ; Write Offs = Write Offs
  1. ; Non-covered = Non payments
  1. ; Penalties = Penalties
  1. ;
  1. I $D(ABMP("AR1.0")) D
  1. .S:'$D(^ABMDBILL(DUZ(2),ABMP("BDFN"),3)) ^(3,0)="^9002274.403D^^"
  1. E D
  1. .K ^ABMDBILL(DUZ(2),ABMP("BDFN"),3) ; Payment multiple
  1. .S ^ABMDBILL(DUZ(2),ABMP("BDFN"),3,0)="^9002274.403D^^"
  1. S DA(1)=ABMP("BDFN")
  1. S X=DT
  1. S DIC="^ABMDBILL(DUZ(2),DA(1),3,"
  1. S DIC(0)="L"
  1. K DD,DO D FILE^DICN
  1. S DA=+Y
  1. S DIE=DIC
  1. I $D(ABMP("AR1.0")) D
  1. .Q:Y<0
  1. .S DR=".02///"_ABM("AMT") D ^DIE
  1. I '$D(ABMP("AR1.0")) D
  1. .Q:Y<0
  1. .S ABM("NPAY")=+$G(ABM("PAY"))+$G(ABM("3P"))+$G(ABM("PCR"))+$G(ABM("RF"))
  1. .S DR=".02///"_ABM("NPAY") D ^DIE ;Payment Amount
  1. .I $G(ABM("DED")) S DR=".03///"_ABM("DED") D ^DIE ;Deductible
  1. .I $G(ABM("COP")) S DR=".04///"_ABM("COP") D ^DIE ; Co-Insurance
  1. .I $G(ABM("WO")) S DR=".06///"_ABM("WO") D ^DIE ; Write Offs
  1. .I $G(ABM("NP")) S DR=".07///"_ABM("NP") D ^DIE ; Non-covered
  1. .I $G(ABM("PEN")) S DR=".09///"_ABM("PEN") D ^DIE ; Penalties
  1. .I $G(ABM("PAY")) S DR=".1///"_ABM("PAY") D ^DIE ; A/R Payments
  1. .I $G(ABM("3P")) S DR=".11///"_ABM("3P") D ^DIE ; 3P Prev Payments
  1. .I $G(ABM("GRP")) S DR=".12///"_ABM("GRP") D ^DIE ; Grouper Allowance
  1. .I $G(ABM("RF")) S DR=".13///"_ABM("RF") D ^DIE ; A/R Refund
  1. .I $G(ABM("PCR")) S DR=".14///"_ABM("PCR") D ^DIE ; A/R Pymt Adjust
  1. D CBIL ; Close the bill
  1. Q
  1. CBIL ;
  1. ; EP for Closing Bill
  1. ; OK for both 1.0 and 1.1
  1. Q:$P(^ABMDBILL(DUZ(2),ABMP("BDFN"),0),U,4)="X" ; Q if cancelled bill
  1. ; Mark bill status "complete" (.04) and delete export number (.17)
  1. S DIE="^ABMDBILL(DUZ(2),"
  1. S DA=ABMP("BDFN")
  1. S DR=".04////C"
  1. D ^DIE
  1. K DR
  1. Q
  1. ;
  1. SET ;
  1. ; set up needed variables for Eligibility Checker
  1. S ABMP("PDFN")=$P(^ABMDBILL(DUZ(2),ABMP("BDFN"),0),"^",5) ; Patient
  1. S ABMP("INS")=$P(^ABMDBILL(DUZ(2),ABMP("BDFN"),0),"^",8) ; Active Ins
  1. S ABMP("VDT")=$P(^ABMDBILL(DUZ(2),ABMP("BDFN"),7),"^",1) ; Srv dt frm
  1. Q
  1. ;
  1. REST ;
  1. ; Quit if billed manually. . . no other sources to find
  1. I +ABMP("BILL")=$P(^ABMDBILL(DUZ(2),ABMP("BDFN"),0),U) Q
  1. ; Check to see if the claim has been cancelled.
  1. S ABMP("CDFN")=+ABMP("BILL")
  1. I '$D(^ABMDCLM(DUZ(2),ABMP("CDFN"),0)) W !,"CLAIM #",ABMP("CDFN")," HAS BEEN CANCELLED.",! Q
  1. N I
  1. S I=0,DA=0
  1. ;
  1. ; Loop through the insurer multiple, if the insurer is active and is
  1. ; the same as the active insurer, mark that insurer as complete.
  1. F S I=$O(^ABMDBILL(DUZ(2),ABMP("BDFN"),13,I)) Q:'I D
  1. .I $P(^ABMDBILL(DUZ(2),ABMP("BDFN"),13,I,0),"^",3)="I",$P(^(0),"^",1)=$P(^ABMDBILL(DUZ(2),ABMP("BDFN"),0),"^",8) S DA=I
  1. .I $P(^ABMDBILL(DUZ(2),ABMP("BDFN"),13,I,0),"^",3)="I",$P(^(0),"^",11)=$P(^ABMDBILL(DUZ(2),ABMP("BDFN"),0),"^",8) S DA=I
  1. I DA D
  1. .S DA(1)=ABMP("CDFN")
  1. .Q:'$D(^ABMDCLM(DUZ(2),DA(1),13,DA))
  1. .S DIE="^ABMDCLM("_DUZ(2)_","_DA(1)_",13,"
  1. .S DR=".03////C"
  1. .D ^DIE
  1. .K DR
  1. ; Quit if claim is already in edit status
  1. I $P(^ABMDCLM(DUZ(2),ABMP("CDFN"),0),"^",4)="E" D Q
  1. . W !,"Claim is already in edit status.",!
  1. ;
  1. UNBILL ;
  1. ; Look for additional sources that have not yet been billed
  1. W !!,"CHECKING FOR UNBILLED SOURCES.",!
  1. S (ABM("HIT"),ABM("CNT"))=0
  1. ; Eligibility checker. . .add any other insurers and prioritize
  1. D ELG^ABMDLCK("",.ABML,ABMP("PDFN"),ABMP("VDT"))
  1. N I
  1. S I=0
  1. ;
  1. ; Loop through insurers in order of priority and update the
  1. ; insurer multiple in 3P BILL w/ insurer and coverage data.
  1. F S I=$O(ABML(I)) Q:'I D
  1. .N J
  1. .S J=0
  1. .F S J=$O(ABML(I,J)) Q:'J D
  1. ..S ABM("PRI")=I
  1. ..S ABM("INS")=J
  1. ..D ADDCHK^ABMDE2E
  1. ;
  1. ; Determine if source (insurer) is billable
  1. ; Loop through insurer multiple in priority order (C x-ref), if the
  1. ; claim status is Pending, active, flagged or partial and patient is
  1. ; non-indian and insurer is billable. . .display as a billable
  1. ; source.
  1. S ABM=""
  1. F ABM("I")=1:1 S ABM=$O(^ABMDCLM(DUZ(2),ABMP("CDFN"),13,"C",ABM)) Q:'ABM D
  1. .S ABM("X")=$O(^ABMDCLM(DUZ(2),ABMP("CDFN"),13,"C",ABM,0))
  1. .I '$G(^ABMDCLM(DUZ(2),ABMP("CDFN"),13,ABM("X"),0)) K ^ABMDCLM(DUZ(2),ABMP("CDFN"),13,"C",ABM,ABM("X")) Q
  1. .I "PIFL"[$P(^ABMDCLM(DUZ(2),ABMP("CDFN"),13,ABM("X"),0),U,3) D
  1. ..S ABM("INSCO")=$P(^ABMDCLM(DUZ(2),ABMP("CDFN"),13,ABM("X"),0),"^",1)
  1. ..Q:$P($G(^AUTNINS(ABM("INSCO"),2)),U)="I"
  1. ..Q:$P($G(^AUTNINS(ABM("INSCO"),1)),U,7)=4
  1. ..W:ABM("CNT") !
  1. ..S ABM("CNT")=ABM("CNT")+1
  1. ..W ?18,"[",ABM("CNT"),"] ",$P(^AUTNINS(ABM("INSCO"),0),U)
  1. ..S ABM(ABM("CNT"))=ABM("X")
  1. ;
  1. ; No other billable sources so mark claim as complete
  1. I ABM("CNT")=0 D K ABM,ABMP Q
  1. .D CCLM ; mark claim as complete
  1. .W "NONE",!!,"Since there are no unbilled sources no further billing is possible."
  1. S ABM("HIT")=ABM(1)
  1. S Y=1 ; flag used for reopening a claim
  1. ; If user access to below option, ask to reopen claim
  1. ; Note that if this key name gets changed this code needs changing
  1. I $D(^XUSEC("ABMDZ EDIT CLAIM AND EXPORT",DUZ)) D
  1. .W !
  1. .S DIR(0)="Y"
  1. .S DIR("A")="Re-open claim for further billing? (Y/N)"
  1. .D ^DIR
  1. .K DIR
  1. .Q:$D(DIRUT)
  1. ; If answer is no, complete the claim
  1. I Y'=1 D CCLM K ABM,ABMP Q
  1. ; Else reopen the claim
  1. S DIE="^ABMDBILL(DUZ(2),"
  1. S DA=ABMP("BDFN")
  1. S DR=".24////"_Y
  1. D ^DIE
  1. D OCLM ; Open claim for editing
  1. S DA(1)=ABMP("CDFN")
  1. S DIE="^ABMDCLM("_DUZ(2)_","_DA(1)_",13,"
  1. S DA=ABM("HIT")
  1. S DR=".03////I"
  1. D ^DIE ; Make insurer status (multiple) active
  1. K ABM,ABMP
  1. Q
  1. ;
  1. ADD ;
  1. ; Add bill not currently in 3P BILL
  1. ; MAYBE WILL DO LATER
  1. Q
  1. ;
  1. OCLM ;
  1. ; Open claim for editing
  1. S DA=ABMP("CDFN")
  1. S DIE="^ABMDCLM("_DUZ(2)_","
  1. S DR=".04////O;.08////"_$P(^ABMDCLM(DUZ(2),ABMP("CDFN"),13,ABM("HIT"),0),U)
  1. D ^DIE
  1. ;put remark if billed insurer is tribal self-insured and Medicare insurer is next
  1. I $P($G(^ABMNINS(DUZ(2),ABMP("INS"),0)),U,11)="Y"&($P($G(^AUTNINS(ABM(1),2)),U)="R") D
  1. .K DIC,DIE,X,Y,DA
  1. .S DA(1)=ABMP("CDFN")
  1. .S DIC="^ABMDCLM("_DUZ(2)_","_DA(1)_",61,"
  1. .S DIC(0)="L"
  1. .S DIC("P")=$P(^DD(9002274.3,61,0),U,2)
  1. .S X="PT HAS TRIBAL SELF-FUNDED INSURANCE"
  1. .D ^DIC
  1. W !!,"Claim Number: ",+ABMP("BILL")," is now Open for Editing!",!
  1. Q
  1. ;
  1. CCLM ;
  1. ; Complete a claim
  1. S DA=ABMP("CDFN")
  1. S DIE="^ABMDCLM("_DUZ(2)_","
  1. S DR=".04////C"
  1. D ^DIE
  1. Q