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

ABMTALL2.m

Go to the documentation of this file.
ABMTALL2 ; IHS/SD/SDR - Monthly tally report - 8/19/2005 1:28:34 PM
 ;;2.6;IHS 3P BILLING SYSTEM;;NOV 12, 2009
 ;
TRANS ;EP
 ; for checking Transaction File data parameters
 Q:'$D(^BARTR(DUZ(2),ABMTRIEN,0))          ; No data
 K ABMTR
 S ABMTR(0)=$G(^BARTR(DUZ(2),ABMTRIEN,0))  ; A/R Transaction 0 node
 S ABMTR(1)=$G(^BARTR(DUZ(2),ABMTRIEN,1))  ; A/R Transaction 1 node
 S ABMTR("T")=$P(ABMTR(1),U)            ; Transaction type
 S ABMTR("DT")=$P(ABMTR(0),U)           ; Transaction date/time
 S ABMTR("B")=$P(ABMTR(0),U,14)         ; A/R Collection batch IEN
 S:ABMTR("B")="" ABMTR("B")="No Collection Batch"
 S ABMTR("IT")=$P(ABMTR(0),U,15)        ; A/R Collection batch item
 S:ABMTR("IT")="" ABMTR("IT")="No Collection Batch Item"
 S ABMTR("AR")=$P(ABMTR(0),U,13)        ; Entry by  (AR Clerk)
 S:ABMTR("AR")="" ABMTR("AR")=9999999
 S:'$D(ABMY("AR")) ABMTR("AR")=0
 S ABMTR("CR-DB")=$$GET1^DIQ(90050.03,ABMTRIEN,3.5)
 S ABM=$P(ABMTR(0),U,4)                  ; A/R Bill IEN
 I $D(ABMY("BATCH")),ABMTR("T")=100 S ABM("UN-ALLOCATED",ABMTR("IT"))=$G(ABM("UN-ALLOCATED",ABMTR("IT")))+ABMTR("CR-DB")_U_DUZ(2)
 Q:'+ABM                                 ; No bill for transaction
 Q:'$D(^BARBL(DUZ(2),ABM))           ; Trans points to non-existent bill
 S ABM(0)=$G(^BARBL(DUZ(2),ABM,0))       ; A/R Bill 0 node
 S ABM(10)=$G(^BARBL(DUZ(2),ABM,1))      ; A/R Bill 1 node
 S ABMTR("I")=$P(ABM(0),U,3)             ; A/R Account
 S ABMTR("L")=$P(ABM(10),U,8)            ; Visit location
 S ABM("PV")=$P(ABM(10),U,13)            ; Provider (New Person)
 S ABM("V")=$P(ABM(10),U,14)             ; Visit type (3P Visit Type)
 S ABM("C")=$P(ABM(10),U,12)             ; Clinic  (Clinic Stop File)
 S ABM("DS")=$$GET1^DIQ(90050.01,ABM,23)   ; Discharge Service (#)
 I ABMTR("I")]"" D
 . S D0=ABMTR("I")
 . S ABMTR("BI")=$$VALI^BARVPM(8)     ; Insurer Type
 I $G(ABMTR("BI"))=""  S ABMTR("BI")="No Billing Entity"
 I ABMTR("BI")'="No Billing Entity" D
 . S ABMTR("ALL")="O"                             ; Other Allow Cat
 . I ABMTR("BI")="R" S ABMTR("ALL")="R" Q           ; Medicare Allow Cat
 . I ABMTR("BI")="D" S ABMTR("ALL")="D" Q           ; Medicaid Allow Cat
 . I ABMTR("BI")="K" S ABMTR("ALL")="K" Q           ; CHIPS Allow Cat
 . I ",F,M,H,P,"[(","_ABMTR("BI")_",") S ABMTR("ALL")="P" Q  ; Private
 I $G(ABMTR("ALL"))=""  S ABMTR("ALL")="No Allowance Category"
 Q:ABMTR("L")=""!(ABMTR("I")="")!(ABMTR("DT")="")
 Q
OUTPUT ; EP
 S ABMCATS=$P($G(^DD(9000010,.07,0)),U,3)  ;GET THE SERVICE CATEGORIES
 S ABMTAB=";"
 F ABMPKG="PCC","TPB","BAR" D
 .I ABMPKG="PCC" D VHDB
 .I ABMPKG="TPB" D THDB
 .I ABMPKG="BAR" D BHDB
 .S (ABMVLS,ABMCLNS,ABMSTDTS,ABMCLMSS,ABMVTYPS)=""
 .S ABMVL=0
 .F  S ABMVL=$O(^TMP("ABM-TALLY",$J,ABMPKG,ABMVL)) Q:+ABMVL=0  D
 ..S ABMCLN=0
 ..F  S ABMCLN=$O(^TMP("ABM-TALLY",$J,ABMPKG,ABMVL,ABMCLN)) Q:+ABMCLN=0  D
 ...S ABMVTYP=0
 ...F  S ABMVTYP=$O(^TMP("ABM-TALLY",$J,ABMPKG,ABMVL,ABMCLN,ABMVTYP)) Q:ABMVTYP=""  D
 ....S ABMSTODT=0
 ....F  S ABMSTODT=$O(^TMP("ABM-TALLY",$J,ABMPKG,ABMVL,ABMCLN,ABMVTYP,ABMSTODT)) Q:+ABMSTODT=0  D
 .....I ABMPKG="PCC" D PCCOUT
 .....I ABMPKG="TPB" D TPBOUT
 .....I ABMPKG="BAR" D BAROUT
 .I ABMPKG="PCC" W !,ABMTAB_ABMTAB_ABMTAB_ABMTAB_ABMTAB_"TOTAL VISITS "_+$G(^TMP("ABM-TALLY",$J,"VTOT")),!
 .I ABMPKG="TPB" W !,ABMTAB_ABMTAB_ABMTAB_ABMTAB_ABMTAB_ABMTAB_ABMTAB_"TOTAL CLAIMS "_+$G(^TMP("ABM-TALLY",$J,"CTOT")),!
 .I ABMPKG="BAR" D
 ..W !,ABMTAB_ABMTAB_ABMTAB_ABMTAB_ABMTAB_ABMTAB_ABMTAB_"TOTAL BILLS "_+$G(^TMP("ABM-TALLY",$J,"BTOT"))_ABMTAB
 ..W $J($G(^TMP("ABM-TALLY",$J,"TBILLED")),15,2)_ABMTAB
 ..W $J($G(^TMP("ABM-TALLY",$J,"TCBILLED")),15,2)_ABMTAB
 ..W $J($G(^TMP("ABM-TALLY",$J,"TPAY")),15,2)_ABMTAB
 ..W $J($G(^TMP("ABM-TALLY",$J,"TADJ")),15,2)_ABMTAB
 ..W $J($G(^TMP("ABM-TALLY",$J,"TREF")),15,2)
 Q
PCCOUT ;
 S ABMCLMS=""
 F  S ABMCLMS=$O(^TMP("ABM-TALLY",$J,ABMPKG,ABMVL,ABMCLN,ABMVTYP,ABMSTODT,ABMCLMS)) Q:ABMCLMS=""  D
 .W !,$S(ABMVL'=ABMVLS:$P($G(^DIC(4,ABMVL,0)),U),1:"")_ABMTAB
 .S ABMVLS=ABMVL
 .W $S(ABMCLNS'=ABMCLN:$P($G(^DIC(40.7,ABMCLN,0)),U),ABMCLN=99999:"NO CLINIC ENTERED IN PCC",1:"")_ABMTAB
 .S ABMCLNS=ABMCLN
 .W $S(ABMVTYPS'=ABMVTYP:$$GETSVCAT^ABMTALLY(ABMVTYP),1:"")_ABMTAB
 .S ABMVTYPS=ABMVTYP
 .W $TR($TR($P($$MDT^ABMDUTL(ABMSTODT),"-",2,3)," "),"-"," ")_ABMTAB
 .W $S(ABMCLMS="NOCLM":"VISITS THAT DIDN'T GENERATE A CLAIM",1:"VISITS THAT GENERATED A CLAIM")_ABMTAB
 .W $G(^TMP("ABM-TALLY",$J,ABMPKG,ABMVL,ABMCLN,ABMVTYP,ABMSTODT,ABMCLMS))
 Q
TPBOUT ;
 S ABMCLMS=""
 F  S ABMCLMS=$O(^TMP("ABM-TALLY",$J,ABMPKG,ABMVL,ABMCLN,ABMVTYP,ABMSTODT,ABMCLMS)) Q:ABMCLMS=""  D
 .S ABMITYP=""
 .F  S ABMITYP=$O(^TMP("ABM-TALLY",$J,ABMPKG,ABMVL,ABMCLN,ABMVTYP,ABMSTODT,ABMCLMS,ABMITYP)) Q:ABMITYP=""  D
 ..S ABMINS=""
 ..F  S ABMINS=$O(^TMP("ABM-TALLY",$J,ABMPKG,ABMVL,ABMCLN,ABMVTYP,ABMSTODT,ABMCLMS,ABMITYP,ABMINS)) Q:ABMINS=""  D
 ...W !,$S(ABMVL'=ABMVLS:$P($G(^DIC(4,ABMVL,0)),U),1:"")_ABMTAB
 ...S ABMVLS=ABMVL
 ...W $S(ABMCLNS'=ABMCLN:$P($G(^DIC(40.7,ABMCLN,0)),U),1:"")_ABMTAB
 ...S ABMCLNS=ABMCLN
 ...W $S(ABMVTYPS'=ABMVTYP:$P($G(^ABMDVTYP(ABMVTYP,0)),U),1:"")_ABMTAB
 ...S ABMVTYPS=ABMVTYP
 ...W $TR($TR($P($$MDT^ABMDUTL(ABMSTODT),"-",2,3)," "),"-"," ")_ABMTAB
 ...W $S(ABMCLMS="E":"EDIT Mode",ABMCLMS="R":"Claim Rejected",ABMCLMS="U":"Billed",ABMCLMS="C":"Claim Completed",ABMCLMS="F":"Flagged as Billable",ABMCLMS="X":"Cancelled",1:"Pending")_ABMTAB
 ...W $P($P($P(^DD(9999999.18,.21,0),U,3),";"_ABMITYP_":",2),";")_ABMTAB
 ...W ABMINS_ABMTAB
 ...W $G(^TMP("ABM-TALLY",$J,ABMPKG,ABMVL,ABMCLN,ABMVTYP,ABMSTODT,ABMCLMS,ABMITYP,ABMINS))
 Q
BAROUT ;
 S ABMBLST=""
 F  S ABMBLST=$O(^TMP("ABM-TALLY",$J,ABMPKG,ABMVL,ABMCLN,ABMVTYP,ABMSTODT,ABMBLST)) Q:ABMBLST=""  D
 .S ABMITYP=""
 .F  S ABMITYP=$O(^TMP("ABM-TALLY",$J,ABMPKG,ABMVL,ABMCLN,ABMVTYP,ABMSTODT,ABMBLST,ABMITYP)) Q:ABMITYP=""  D
 ..S ABMINS=""
 ..F  S ABMINS=$O(^TMP("ABM-TALLY",$J,ABMPKG,ABMVL,ABMCLN,ABMVTYP,ABMSTODT,ABMBLST,ABMITYP,ABMINS)) Q:ABMINS=""  D
 ...W !,$S(ABMVL'=ABMVLS:$P($G(^DIC(4,ABMVL,0)),U),1:"")_ABMTAB
 ...S ABMVLS=ABMVL
 ...W $S(ABMCLNS'=ABMCLN:$P($G(^DIC(40.7,ABMCLN,0)),U),1:"")_ABMTAB
 ...S ABMCLNS=ABMCLN
 ...W $S(ABMVTYPS'=ABMVTYP:$P($G(^ABMDVTYP(ABMVTYP,0)),U),1:"")_ABMTAB
 ...S ABMVTYPS=ABMVTYP
 ...W $TR($TR($P($$MDT^ABMDUTL(ABMSTODT),"-",2,3)," "),"-"," ")_ABMTAB
 ...W ABMBLST_ABMTAB
 ...W ABMITYP_ABMTAB
 ...W ABMINS_ABMTAB
 ...W $G(^TMP("ABM-TALLY",$J,ABMPKG,ABMVL,ABMCLN,ABMVTYP,ABMSTODT,ABMBLST,ABMITYP,ABMINS))_ABMTAB
 ...W $J($G(^TMP("ABM-TALLY",$J,"BAR-BILLED",ABMVL,ABMCLN,ABMVTYP,ABMSTODT,ABMBLST,ABMITYP,ABMINS)),15,2)_ABMTAB
 ...W $J($G(^TMP("ABM-TALLY",$J,"BAR-CBILLED",ABMVL,ABMCLN,ABMVTYP,ABMSTODT,ABMBLST,ABMITYP,ABMINS)),15,2)_ABMTAB
 ...W $J($G(^TMP("ABM-TALLY",$J,"PAYMENT",ABMVL,ABMCLN,ABMVTYP,ABMSTODT,ABMBLST,ABMITYP,ABMINS)),15,2)_ABMTAB
 ...W $J($G(^TMP("ABM-TALLY",$J,"ADJUST",ABMVL,ABMCLN,ABMVTYP,ABMSTODT,ABMBLST,ABMITYP,ABMINS)),15,2)_ABMTAB
 ...W $J($G(^TMP("ABM-TALLY",$J,"REFUND",ABMVL,ABMCLN,ABMVTYP,ABMSTODT,ABMBLST,ABMITYP,ABMINS)),15,2)
 Q
HD D PAZ^ABMDRUTL Q:$D(DTOUT)!$D(DUOUT)!$D(DIROUT)
VHDB ;
 W !,"PCC data from Visit file"
 W !,"Visit Location"_ABMTAB_"Clinic"_ABMTAB_"Service Cat"_ABMTAB_"Date"_ABMTAB_"with/without claim"_ABMTAB_"Total"
 Q
THDB ;
 W !,"Third Party Billing data from the 3P Claim Data file"
 W !,"Visit Location"_ABMTAB_"Clinic"_ABMTAB_"Visit Type"_ABMTAB_"Date"_ABMTAB_"Claim Status"_ABMTAB_"Insurer Type"_ABMTAB_"Insurer"_ABMTAB_"Total"
 Q
BHDB ;
 W !,"Accounts Receivable data from the A/R Bill/IHS file"
 W !,"Visit Location"_ABMTAB_"Clinic"_ABMTAB_"Visit Type"_ABMTAB_"Date"_ABMTAB_"Bill Status"_ABMTAB
 W "Insurer Type"_ABMTAB_"Insurer"_ABMTAB_"Total"_ABMTAB_"Billed"_ABMTAB_"Outstanding"_ABMTAB
 W "Payments"_ABMTAB_"Adjustments"_ABMTAB_"Refunds"
 Q