- ABMECS ; IHS/ASDST/DMJ - ELECTRONIC CLAIMS SUBMISSION ;
- ;;2.6;IHS Third Party Billing System;**2,6,10,19**;NOV 12, 2009;Build 300
- ;Original;DMJ;01/02/96 4:18 PM
- ;
- ; This routine is called from the EMC Create a Batch Menu option.
- ; It will show you a summary of bills ready to export grouped by
- ; bill type and export type. The user is asked to select one
- ; group. An entry is then made in 3P TX STATUS file and a file
- ; is created in unix as specified by the user.
- ;
- ; IHS/ASDS/DMJ - 03/01/01 - V2.4 Patch 9 - NOIS HQW-0301-100010 - Modified to accommodate new Envoy electronic format
- ; IHS/ASDS/DMJ - 01/03/02 - V2.4 Patch 10 - NOIS NDA-1201-180141 - Modified code to calculate submission number differently as
- ; Medicare saves the numbers for up to a year.
- ; IHS/ASDS/SDR - 01/16/02 - V2.4 Patch 10 - NOIS XAA-0800-200136 - Modified so as not to combine different export modes
- ; into one file
- ; IHS/SD/SDR - v2.5 p8 - IM13650 - Set ABMAPOK so the trigger on Bill Status field gets executed
- ; to update A/R.
- ; IHS/SD/SDR - abm*2.6*2 - 5PMS10005 - Populate EXPORT NUMBER RE-EXPORT mult
- ; IHS/SD/SDR - abm*2.6*6 - 5010 - Added clearinghouse code
- ;IHS/SD/SDR - 2.6*19 - HEAT138428 - Made change to stop programming error <UNDEF>START+24^ABMEF31, <UNDEF>START+24^ABMEF32, <UNDEF>START+24^ABMEF33
- ; ********************************************************************
- START ;
- K ABME,ABMER
- ; Display summary of bills ready to export and ask user to select
- ; one group. The ABMER array and ABMSEQ are undefined going into
- ; EMCREAT^ABMECDSP but are needed upon return.
- D EMCREAT^ABMECDSP(.ABMER,.ABMSEQ)
- Q:'+$G(ABMSEQ) ; Quit if no group selected.
- ;start old code abm*2.6*6 5010
- ;S DIR(0)="Y"
- ;S DIR("A")="Proceed"
- ;S DIR("B")="YES"
- ;D ^DIR
- ;K DIR
- ;I Y'=1 K ABME Q
- ;end old code 5010
- K ABMGCN ;abm*2.6*6 5010
- I $D(^TMP($J,"S-CH",ABMSEQ)) D CHFILE Q ;abm*2.6*6 5010
- D FILE ; Make entry in 3P TX STATUS and create a file
- S DIR(0)="E"
- D ^DIR
- K DIR
- K ABMER,ABMP,ABMSEQ
- Q
- ;
- ;start new code abm*2.6*6 5010
- CHFILE ;
- S ABMER("CNT")=0,ABMER("LAST")=0
- S ABMCH=$P(ABMER(ABMSEQ),U)
- ;start old abm*2.6*19 IHS/SD/SDR HEAT138428
- ;S ABMINS("IEN")=0
- ;F S ABMINS("IEN")=$O(^TMP($J,"S-CH",ABMSEQ,ABMCH,ABMINS("IEN"))) Q:'(ABMINS("IEN")) S ABMER("LAST")=+$G(ABMER("LAST"))+1
- ;S ABMINS("IEN")=0
- ;F S ABMINS("IEN")=$O(^TMP($J,"S-CH",ABMSEQ,ABMCH,ABMINS("IEN"))) Q:'(ABMINS("IEN")) D
- ;.;S ABMITYP=$P(^AUTNINS(ABMINS("IEN"),2),U) ; Insurance type
- ;.S ABMITYP=$$GET1^DIQ(9999999.181,$$GET1^DIQ(9999999.18,ABMINS("IEN"),".211","I"),1,"I") ; Insurance type ;abm*2.6*10 HEAT73780
- ;.S ABMVTYPE=$P(ABMER(ABMSEQ),U,2) ; Visit type
- ;.S ABMEXP=$P(ABMER(ABMSEQ),U,3) ; export type
- ;.; Loop through locations in TMP global created by EMCREAT^ABMECDSP
- ;.S ABMLOC=""
- ;.F S ABMLOC=$O(^TMP($J,"D",ABMINS("IEN"),ABMLOC)) Q:ABMLOC="" D
- ;..Q:$D(^TMP($J,"D",ABMINS("IEN"),ABMLOC,ABMVTYPE))<2
- ;..;S ABMER("CNT")=+$G(ABMER("CNT"))+1 ;abm*2.6*@@ IHS/SD/SDR HEAT138428
- ;..S ABMER("CNT")=+$G(ABMER("LAST")) ;abm*2.6*@@ IHS/SD/SDR HEAT138428
- ;..D NEWB ; Create a new batch in 3P TX STATUS
- ;..I $G(Y)<0 D MSG^ABMERUTL("Could not enter batch in 3P TX STATUS file.") Q
- ;..; Add bill to detail in 3P TX STATUS for this batch
- ;..S ^ABMDTXST(DUZ(2),DA(1),2,0)="^9002274.61P^^"
- ;..S ABMAPOK=1
- ;..S ABMDA=0
- ;..F S ABMDA=$O(^TMP($J,"D",ABMINS("IEN"),ABMLOC,ABMVTYPE,ABMEXP,ABMDA)) Q:'+ABMDA D
- ;...S X=ABMDA
- ;...S DIC="^ABMDTXST(DUZ(2),DA(1),2,"
- ;...S DIC(0)="LXNE"
- ;...S DINUM=X
- ;...K DD,DO D FILE^DICN
- ;...Q:+Y<0
- ;...S DA=+Y
- ;...S DIE="^ABMDTXST(DUZ(2),DA(1),2,"
- ;...S ABMAPRV=$O(^ABMDBILL(DUZ(2),ABMDA,41,"C","A",0))
- ;...S:ABMAPRV ABMAPRV=$P(^ABMDBILL(DUZ(2),ABMDA,41,ABMAPRV,0),U)
- ;...I ABMAPRV D
- ;....S DR=".02///`"_ABMAPRV
- ;....D ^DIE
- ;....K ABMAPRV
- ;...S ABMSBR=$$SBR^ABMUTLP(ABMDA)
- ;...S DR=".03///"_ABMSBR
- ;...D ^DIE
- ;...K ABMSBR
- ;...S DIE="^ABMDBILL(DUZ(2),"
- ;...S DA=ABMDA
- ;...S DR=".04////B;.16////A"_$S($P($G(^ABMDBILL(DUZ(2),ABMDA,1)),U,7)="":";.17////"_ABMP("XMIT"),1:"")
- ;...S ABMREX("BDFN")=ABMDA
- ;...D ^DIE
- ;..K ABMAPOK
- ;..; Write record (Create EMC unix file)
- ;..D @("^ABMEF"_$P(ABMER(ABMSEQ),U,3))
- ;..I $G(POP) D
- ;...S DIE="^ABMDTXST(DUZ(2),"
- ;...S DA=ABMP("XMIT")
- ;...S DR=".14///NOPEN"
- ;...D ^DIE
- ;end new code 5010
- ;end old start new abm*2.6*19 IHS/SD/SDR HEAT138428
- S ABMER("LAST")=0
- S ABMLOC="",ABMLOCSV=""
- ;F S ABMLOC=$O(^TMP($J,"FILE",ABMLOC)) Q:ABMLOC="" S ABMER("LAST")=+$G(ABMER("LAST"))+1
- F S ABMLOC=$O(^TMP($J,"FILE",ABMLOC)) Q:ABMLOC="" D
- .S ABMINS=0
- .F S ABMINS=$O(^TMP($J,"FILE",ABMLOC,ABMINS)) Q:'ABMINS D
- ..S ABMVTYP=0,ABMVTYPS=0
- ..F S ABMVTYP=$O(^TMP($J,"FILE",ABMLOC,ABMINS,ABMVTYP)) Q:'ABMVTYP D
- ...S ABMEXP=0,ABMEXPSV=0
- ...F S ABMEXP=$O(^TMP($J,"FILE",ABMLOC,ABMINS,ABMVTYP,ABMEXP)) Q:'ABMEXP D
- ....I (ABMLOCSV'=ABMLOC)!(ABMVTYPS'=ABMVTYPE)!(ABMEXPSV'=ABMEXP) S ABMER(ABMLOC,"LAST")=+$G(ABMER(ABMLOC,"LAST"))+1
- ....S ABMLOCSV=ABMLOC,ABMVTYPS=ABMVTYPE,ABMEXPSV=ABMEXP
- ;
- S ABMLOC=""
- S ABMLOCSV=""
- F S ABMLOC=$O(^TMP($J,"FILE",ABMLOC)) Q:ABMLOC="" D
- .S ABMER("CNT")=0
- .S ABMER("LAST")=$G(ABMER(ABMLOC,"LAST"))
- .S ABMINS("IEN")=0
- .F S ABMINS("IEN")=$O(^TMP($J,"FILE",ABMLOC,ABMINS("IEN"))) Q:'ABMINS("IEN") D
- ..S ABMITYP=$$GET1^DIQ(9999999.181,$$GET1^DIQ(9999999.18,ABMINS("IEN"),".211","I"),1,"I") ; Insurance type
- ..S ABMVTYPE=0,ABMVTYPS=0
- ..F S ABMVTYPE=$O(^TMP($J,"FILE",ABMLOC,ABMINS("IEN"),ABMVTYPE)) Q:'ABMVTYPE D
- ...S ABMEXP=0,ABMEXPSV=0
- ...F S ABMEXP=$O(^TMP($J,"FILE",ABMLOC,ABMINS("IEN"),ABMVTYPE,ABMEXP)) Q:'ABMEXP D
- ....Q:$D(^TMP($J,"D",ABMINS("IEN"),ABMLOC,ABMVTYPE))<2
- ....S ABMER("CNT")=+$G(ABMER("CNT"))+1
- ....I (ABMLOCSV'=ABMLOC)!(ABMVTYPS'=ABMVTYPE)!(ABMEXPSV'=ABMEXP) D NEWB ; Create a new batch in 3P TX STATUS
- ....S ABMLOCSV=ABMLOC,ABMVTYPS=ABMVTYPE,ABMEXPSV=ABMEXP
- ....I $G(Y)<0 D MSG^ABMERUTL("Could not enter batch in 3P TX STATUS file.") Q
- ....; Add bill to detail in 3P TX STATUS for this batch
- ....S ^ABMDTXST(DUZ(2),DA(1),2,0)="^9002274.61P^^"
- ....S ABMAPOK=1
- ....S ABMDA=0
- ....F S ABMDA=$O(^TMP($J,"D",ABMINS("IEN"),ABMLOC,ABMVTYPE,ABMEXP,ABMDA)) Q:'+ABMDA D
- .....S X=ABMDA
- .....S DIC="^ABMDTXST(DUZ(2),DA(1),2,"
- .....S DIC(0)="LXNE"
- .....S DINUM=X
- .....K DD,DO D FILE^DICN
- .....Q:+Y<0
- .....S DA=+Y
- .....S DIE="^ABMDTXST(DUZ(2),DA(1),2,"
- .....S ABMAPRV=$O(^ABMDBILL(DUZ(2),ABMDA,41,"C","A",0))
- .....S:ABMAPRV ABMAPRV=$P(^ABMDBILL(DUZ(2),ABMDA,41,ABMAPRV,0),U)
- .....I ABMAPRV D
- ......S DR=".02///`"_ABMAPRV
- ......D ^DIE
- ......K ABMAPRV
- .....S ABMSBR=$$SBR^ABMUTLP(ABMDA)
- .....S DR=".03///"_ABMSBR
- .....D ^DIE
- .....K ABMSBR
- .....S DIE="^ABMDBILL(DUZ(2),"
- .....S DA=ABMDA
- .....S DR=".04////B;.16////A"_$S($P($G(^ABMDBILL(DUZ(2),ABMDA,1)),U,7)="":";.17////"_ABMP("XMIT"),1:"")
- .....S ABMREX("BDFN")=ABMDA
- .....D ^DIE
- ....K ABMAPOK
- ....; Write record (Create EMC unix file)
- ....D @("^ABMEF"_$P(ABMER(ABMSEQ),U,3))
- ....I $G(POP) D
- .....S DIE="^ABMDTXST(DUZ(2),"
- .....S DA=ABMP("XMIT")
- .....S DR=".14///NOPEN"
- .....D ^DIE
- ;end new abm*2.6*19 IHS/SD/SDR HEAT138428
- S DIR(0)="E"
- D ^DIR
- K DIR
- K ABMER,ABMP,ABMSEQ
- Q
- FILE ;
- ; File bills to 3P TX STATUS FILE
- S ABMER("CNT")=1,ABMER("LAST")=1 ;abm*2.6*6 5010
- S ABMINS("IEN")=$P(ABMER(ABMSEQ),U) ; Active Insurer IEN
- ;S ABMITYP=$P(^AUTNINS(ABMINS("IEN"),2),U) ; Insurance type ;abm*2.6*10 HEAT73780
- S ABMITYP=$$GET1^DIQ(9999999.181,$$GET1^DIQ(9999999.18,ABMINS("IEN"),".211","I"),1,"I") ; Insurance type ;abm*2.6*10 HEAT73780
- S ABMVTYPE=$P(ABMER(ABMSEQ),U,2) ; Visit type
- S ABMEXP=$P(ABMER(ABMSEQ),U,3) ; export type
- ; Loop through locations in TMP global created by EMCREAT^ABMECDSP
- S ABMLOC=""
- F S ABMLOC=$O(^TMP($J,"D",ABMINS("IEN"),ABMLOC)) Q:ABMLOC="" D
- .Q:$D(^TMP($J,"D",ABMINS("IEN"),ABMLOC,ABMVTYPE))<2
- .K ABMGCN ;abm*2.6*6
- .D NEWB ; Create a new batch in 3P TX STATUS
- .I $G(Y)<0 D MSG^ABMERUTL("Could not enter batch in 3P TX STATUS file.") Q
- .; Add bill to detail in 3P TX STATUS for this batch
- .S ^ABMDTXST(DUZ(2),DA(1),2,0)="^9002274.61P^^"
- .S ABMAPOK=1
- .S ABMDA=0
- .F S ABMDA=$O(^TMP($J,"D",ABMINS("IEN"),ABMLOC,ABMVTYPE,ABMEXP,ABMDA)) Q:'+ABMDA D
- ..S X=ABMDA
- ..S DIC="^ABMDTXST(DUZ(2),DA(1),2,"
- ..S DIC(0)="LXNE"
- ..S DINUM=X
- ..K DD,DO D FILE^DICN
- ..Q:+Y<0
- ..S DA=+Y
- ..S DIE="^ABMDTXST(DUZ(2),DA(1),2,"
- ..S ABMAPRV=$O(^ABMDBILL(DUZ(2),ABMDA,41,"C","A",0))
- ..S:ABMAPRV ABMAPRV=$P(^ABMDBILL(DUZ(2),ABMDA,41,ABMAPRV,0),U)
- ..I ABMAPRV D
- ...S DR=".02///`"_ABMAPRV
- ...D ^DIE
- ...K ABMAPRV
- ..S ABMSBR=$$SBR^ABMUTLP(ABMDA)
- ..S DR=".03///"_ABMSBR
- ..D ^DIE
- ..K ABMSBR
- ..S DIE="^ABMDBILL(DUZ(2),"
- ..S DA=ABMDA
- ..;S DR=".04////B;.16////A;.17////"_ABMP("XMIT") ;abm*2.6*2 5PMS10005
- ..S DR=".04////B;.16////A"_$S($P($G(^ABMDBILL(DUZ(2),ABMDA,1)),U,7)="":";.17////"_ABMP("XMIT"),1:"") ;abm*2.6*2 5PMS10005
- ..S ABMREX("BDFN")=ABMDA ;abm*2.6*3
- ..D ^DIE
- ..;D BILLSTAT^ABMDREEX(DUZ(2),ABMDA,ABMP("XMIT"),"O",$P($G(^ABMDTXST(DUZ(2),ABMP("XMIT"),1)),U,6)) ;abm*2.6*2 5PMS10005
- .K ABMAPOK
- .; Write record (Create EMC unix file)
- .D @("^ABMEF"_$P(ABMER(ABMSEQ),U,3))
- .I $G(POP) D
- ..S DIE="^ABMDTXST(DUZ(2),"
- ..S DA=ABMP("XMIT")
- ..S DR=".14///NOPEN"
- ..D ^DIE
- Q
- ;
- NEWB ;
- ; Create a new batch (Make entry in 3P TX STATUS)
- D NOW^%DTC
- S X=%
- S DIC="^ABMDTXST(DUZ(2),"
- S DIC(0)="LX"
- S DLAYGO=9002274.6
- K DD,DO D FILE^DICN
- K DLAYGO
- Q:Y<0
- S ABMP("XMIT")=+Y
- S DIE=DIC
- S DA=+Y
- S DR=".02///"_$P(ABMER(ABMSEQ),U,3)_";.04///`"_ABMINS("IEN")_";.03///"_ABMITYP_";.05////"_DUZ_";.09///"_$P(ABMER(ABMSEQ),U,4)_";.11///"_$J($P(ABMER(ABMSEQ),U,5),1,2)
- S DR=DR_";.17////"_$$FMT^ABMERUTL(ABMER("CNT"),"4NR") ;abm*2.6*6 5010
- D ^DIE
- ;S DR=".16///"_$$NSN^ABMERUTL D ^DIE ;abm*2.6*3 5PMS10005#2
- D GCNMULT^ABMERUTL("O",$S(($G(ABMREX("BILLSELECT"))!($G(ABMREX("BATCHSELECT")))):"1",1:"")) ;abm*2.6*3 5PMS10005#2
- S DA(1)=DA
- W !,"ENTRY CREATED IN 3P TX STATUS FILE."
- W !,"LOCATION: ",ABMLOC
- ;W !,"VISIT TYPE: ",$P(^ABMDVTYP(ABMVTYPE,0),U),! ;abm*2.6*2 5PMS10005
- W:$G(ABMVTYPE) !,"VISIT TYPE: ",$P(^ABMDVTYP(ABMVTYPE,0),U),! ;abm*2.6*2 5PMS10005
- Q
- ABMECS ; IHS/ASDST/DMJ - ELECTRONIC CLAIMS SUBMISSION ;
- +1 ;;2.6;IHS Third Party Billing System;**2,6,10,19**;NOV 12, 2009;Build 300
- +2 ;Original;DMJ;01/02/96 4:18 PM
- +3 ;
- +4 ; This routine is called from the EMC Create a Batch Menu option.
- +5 ; It will show you a summary of bills ready to export grouped by
- +6 ; bill type and export type. The user is asked to select one
- +7 ; group. An entry is then made in 3P TX STATUS file and a file
- +8 ; is created in unix as specified by the user.
- +9 ;
- +10 ; IHS/ASDS/DMJ - 03/01/01 - V2.4 Patch 9 - NOIS HQW-0301-100010 - Modified to accommodate new Envoy electronic format
- +11 ; IHS/ASDS/DMJ - 01/03/02 - V2.4 Patch 10 - NOIS NDA-1201-180141 - Modified code to calculate submission number differently as
- +12 ; Medicare saves the numbers for up to a year.
- +13 ; IHS/ASDS/SDR - 01/16/02 - V2.4 Patch 10 - NOIS XAA-0800-200136 - Modified so as not to combine different export modes
- +14 ; into one file
- +15 ; IHS/SD/SDR - v2.5 p8 - IM13650 - Set ABMAPOK so the trigger on Bill Status field gets executed
- +16 ; to update A/R.
- +17 ; IHS/SD/SDR - abm*2.6*2 - 5PMS10005 - Populate EXPORT NUMBER RE-EXPORT mult
- +18 ; IHS/SD/SDR - abm*2.6*6 - 5010 - Added clearinghouse code
- +19 ;IHS/SD/SDR - 2.6*19 - HEAT138428 - Made change to stop programming error <UNDEF>START+24^ABMEF31, <UNDEF>START+24^ABMEF32, <UNDEF>START+24^ABMEF33
- +20 ; ********************************************************************
- START ;
- +1 KILL ABME,ABMER
- +2 ; Display summary of bills ready to export and ask user to select
- +3 ; one group. The ABMER array and ABMSEQ are undefined going into
- +4 ; EMCREAT^ABMECDSP but are needed upon return.
- +5 DO EMCREAT^ABMECDSP(.ABMER,.ABMSEQ)
- +6 ; Quit if no group selected.
- IF '+$GET(ABMSEQ)
- QUIT
- +7 ;start old code abm*2.6*6 5010
- +8 ;S DIR(0)="Y"
- +9 ;S DIR("A")="Proceed"
- +10 ;S DIR("B")="YES"
- +11 ;D ^DIR
- +12 ;K DIR
- +13 ;I Y'=1 K ABME Q
- +14 ;end old code 5010
- +15 ;abm*2.6*6 5010
- KILL ABMGCN
- +16 ;abm*2.6*6 5010
- IF $DATA(^TMP($JOB,"S-CH",ABMSEQ))
- DO CHFILE
- QUIT
- +17 ; Make entry in 3P TX STATUS and create a file
- DO FILE
- +18 SET DIR(0)="E"
- +19 DO ^DIR
- +20 KILL DIR
- +21 KILL ABMER,ABMP,ABMSEQ
- +22 QUIT
- +23 ;
- +24 ;start new code abm*2.6*6 5010
- CHFILE ;
- +1 SET ABMER("CNT")=0
- SET ABMER("LAST")=0
- +2 SET ABMCH=$PIECE(ABMER(ABMSEQ),U)
- +3 ;start old abm*2.6*19 IHS/SD/SDR HEAT138428
- +4 ;S ABMINS("IEN")=0
- +5 ;F S ABMINS("IEN")=$O(^TMP($J,"S-CH",ABMSEQ,ABMCH,ABMINS("IEN"))) Q:'(ABMINS("IEN")) S ABMER("LAST")=+$G(ABMER("LAST"))+1
- +6 ;S ABMINS("IEN")=0
- +7 ;F S ABMINS("IEN")=$O(^TMP($J,"S-CH",ABMSEQ,ABMCH,ABMINS("IEN"))) Q:'(ABMINS("IEN")) D
- +8 ;.;S ABMITYP=$P(^AUTNINS(ABMINS("IEN"),2),U) ; Insurance type
- +9 ;.S ABMITYP=$$GET1^DIQ(9999999.181,$$GET1^DIQ(9999999.18,ABMINS("IEN"),".211","I"),1,"I") ; Insurance type ;abm*2.6*10 HEAT73780
- +10 ;.S ABMVTYPE=$P(ABMER(ABMSEQ),U,2) ; Visit type
- +11 ;.S ABMEXP=$P(ABMER(ABMSEQ),U,3) ; export type
- +12 ;.; Loop through locations in TMP global created by EMCREAT^ABMECDSP
- +13 ;.S ABMLOC=""
- +14 ;.F S ABMLOC=$O(^TMP($J,"D",ABMINS("IEN"),ABMLOC)) Q:ABMLOC="" D
- +15 ;..Q:$D(^TMP($J,"D",ABMINS("IEN"),ABMLOC,ABMVTYPE))<2
- +16 ;..;S ABMER("CNT")=+$G(ABMER("CNT"))+1 ;abm*2.6*@@ IHS/SD/SDR HEAT138428
- +17 ;..S ABMER("CNT")=+$G(ABMER("LAST")) ;abm*2.6*@@ IHS/SD/SDR HEAT138428
- +18 ;..D NEWB ; Create a new batch in 3P TX STATUS
- +19 ;..I $G(Y)<0 D MSG^ABMERUTL("Could not enter batch in 3P TX STATUS file.") Q
- +20 ;..; Add bill to detail in 3P TX STATUS for this batch
- +21 ;..S ^ABMDTXST(DUZ(2),DA(1),2,0)="^9002274.61P^^"
- +22 ;..S ABMAPOK=1
- +23 ;..S ABMDA=0
- +24 ;..F S ABMDA=$O(^TMP($J,"D",ABMINS("IEN"),ABMLOC,ABMVTYPE,ABMEXP,ABMDA)) Q:'+ABMDA D
- +25 ;...S X=ABMDA
- +26 ;...S DIC="^ABMDTXST(DUZ(2),DA(1),2,"
- +27 ;...S DIC(0)="LXNE"
- +28 ;...S DINUM=X
- +29 ;...K DD,DO D FILE^DICN
- +30 ;...Q:+Y<0
- +31 ;...S DA=+Y
- +32 ;...S DIE="^ABMDTXST(DUZ(2),DA(1),2,"
- +33 ;...S ABMAPRV=$O(^ABMDBILL(DUZ(2),ABMDA,41,"C","A",0))
- +34 ;...S:ABMAPRV ABMAPRV=$P(^ABMDBILL(DUZ(2),ABMDA,41,ABMAPRV,0),U)
- +35 ;...I ABMAPRV D
- +36 ;....S DR=".02///`"_ABMAPRV
- +37 ;....D ^DIE
- +38 ;....K ABMAPRV
- +39 ;...S ABMSBR=$$SBR^ABMUTLP(ABMDA)
- +40 ;...S DR=".03///"_ABMSBR
- +41 ;...D ^DIE
- +42 ;...K ABMSBR
- +43 ;...S DIE="^ABMDBILL(DUZ(2),"
- +44 ;...S DA=ABMDA
- +45 ;...S DR=".04////B;.16////A"_$S($P($G(^ABMDBILL(DUZ(2),ABMDA,1)),U,7)="":";.17////"_ABMP("XMIT"),1:"")
- +46 ;...S ABMREX("BDFN")=ABMDA
- +47 ;...D ^DIE
- +48 ;..K ABMAPOK
- +49 ;..; Write record (Create EMC unix file)
- +50 ;..D @("^ABMEF"_$P(ABMER(ABMSEQ),U,3))
- +51 ;..I $G(POP) D
- +52 ;...S DIE="^ABMDTXST(DUZ(2),"
- +53 ;...S DA=ABMP("XMIT")
- +54 ;...S DR=".14///NOPEN"
- +55 ;...D ^DIE
- +56 ;end new code 5010
- +57 ;end old start new abm*2.6*19 IHS/SD/SDR HEAT138428
- +58 SET ABMER("LAST")=0
- +59 SET ABMLOC=""
- SET ABMLOCSV=""
- +60 ;F S ABMLOC=$O(^TMP($J,"FILE",ABMLOC)) Q:ABMLOC="" S ABMER("LAST")=+$G(ABMER("LAST"))+1
- +61 FOR
- SET ABMLOC=$ORDER(^TMP($JOB,"FILE",ABMLOC))
- IF ABMLOC=""
- QUIT
- Begin DoDot:1
- +62 SET ABMINS=0
- +63 FOR
- SET ABMINS=$ORDER(^TMP($JOB,"FILE",ABMLOC,ABMINS))
- IF 'ABMINS
- QUIT
- Begin DoDot:2
- +64 SET ABMVTYP=0
- SET ABMVTYPS=0
- +65 FOR
- SET ABMVTYP=$ORDER(^TMP($JOB,"FILE",ABMLOC,ABMINS,ABMVTYP))
- IF 'ABMVTYP
- QUIT
- Begin DoDot:3
- +66 SET ABMEXP=0
- SET ABMEXPSV=0
- +67 FOR
- SET ABMEXP=$ORDER(^TMP($JOB,"FILE",ABMLOC,ABMINS,ABMVTYP,ABMEXP))
- IF 'ABMEXP
- QUIT
- Begin DoDot:4
- +68 IF (ABMLOCSV'=ABMLOC)!(ABMVTYPS'=ABMVTYPE)!(ABMEXPSV'=ABMEXP)
- SET ABMER(ABMLOC,"LAST")=+$GET(ABMER(ABMLOC,"LAST"))+1
- +69 SET ABMLOCSV=ABMLOC
- SET ABMVTYPS=ABMVTYPE
- SET ABMEXPSV=ABMEXP
- End DoDot:4
- End DoDot:3
- End DoDot:2
- End DoDot:1
- +70 ;
- +71 SET ABMLOC=""
- +72 SET ABMLOCSV=""
- +73 FOR
- SET ABMLOC=$ORDER(^TMP($JOB,"FILE",ABMLOC))
- IF ABMLOC=""
- QUIT
- Begin DoDot:1
- +74 SET ABMER("CNT")=0
- +75 SET ABMER("LAST")=$GET(ABMER(ABMLOC,"LAST"))
- +76 SET ABMINS("IEN")=0
- +77 FOR
- SET ABMINS("IEN")=$ORDER(^TMP($JOB,"FILE",ABMLOC,ABMINS("IEN")))
- IF 'ABMINS("IEN")
- QUIT
- Begin DoDot:2
- +78 ; Insurance type
- SET ABMITYP=$$GET1^DIQ(9999999.181,$$GET1^DIQ(9999999.18,ABMINS("IEN"),".211","I"),1,"I")
- +79 SET ABMVTYPE=0
- SET ABMVTYPS=0
- +80 FOR
- SET ABMVTYPE=$ORDER(^TMP($JOB,"FILE",ABMLOC,ABMINS("IEN"),ABMVTYPE))
- IF 'ABMVTYPE
- QUIT
- Begin DoDot:3
- +81 SET ABMEXP=0
- SET ABMEXPSV=0
- +82 FOR
- SET ABMEXP=$ORDER(^TMP($JOB,"FILE",ABMLOC,ABMINS("IEN"),ABMVTYPE,ABMEXP))
- IF 'ABMEXP
- QUIT
- Begin DoDot:4
- +83 IF $DATA(^TMP($JOB,"D",ABMINS("IEN"),ABMLOC,ABMVTYPE))<2
- QUIT
- +84 SET ABMER("CNT")=+$GET(ABMER("CNT"))+1
- +85 ; Create a new batch in 3P TX STATUS
- IF (ABMLOCSV'=ABMLOC)!(ABMVTYPS'=ABMVTYPE)!(ABMEXPSV'=ABMEXP)
- DO NEWB
- +86 SET ABMLOCSV=ABMLOC
- SET ABMVTYPS=ABMVTYPE
- SET ABMEXPSV=ABMEXP
- +87 IF $GET(Y)<0
- DO MSG^ABMERUTL("Could not enter batch in 3P TX STATUS file.")
- QUIT
- +88 ; Add bill to detail in 3P TX STATUS for this batch
- +89 SET ^ABMDTXST(DUZ(2),DA(1),2,0)="^9002274.61P^^"
- +90 SET ABMAPOK=1
- +91 SET ABMDA=0
- +92 FOR
- SET ABMDA=$ORDER(^TMP($JOB,"D",ABMINS("IEN"),ABMLOC,ABMVTYPE,ABMEXP,ABMDA))
- IF '+ABMDA
- QUIT
- Begin DoDot:5
- +93 SET X=ABMDA
- +94 SET DIC="^ABMDTXST(DUZ(2),DA(1),2,"
- +95 SET DIC(0)="LXNE"
- +96 SET DINUM=X
- +97 KILL DD,DO
- DO FILE^DICN
- +98 IF +Y<0
- QUIT
- +99 SET DA=+Y
- +100 SET DIE="^ABMDTXST(DUZ(2),DA(1),2,"
- +101 SET ABMAPRV=$ORDER(^ABMDBILL(DUZ(2),ABMDA,41,"C","A",0))
- +102 IF ABMAPRV
- SET ABMAPRV=$PIECE(^ABMDBILL(DUZ(2),ABMDA,41,ABMAPRV,0),U)
- +103 IF ABMAPRV
- Begin DoDot:6
- +104 SET DR=".02///`"_ABMAPRV
- +105 DO ^DIE
- +106 KILL ABMAPRV
- End DoDot:6
- +107 SET ABMSBR=$$SBR^ABMUTLP(ABMDA)
- +108 SET DR=".03///"_ABMSBR
- +109 DO ^DIE
- +110 KILL ABMSBR
- +111 SET DIE="^ABMDBILL(DUZ(2),"
- +112 SET DA=ABMDA
- +113 SET DR=".04////B;.16////A"_$SELECT($PIECE($GET(^ABMDBILL(DUZ(2),ABMDA,1)),U,7)="":";.17////"_ABMP("XMIT"),1:"")
- +114 SET ABMREX("BDFN")=ABMDA
- +115 DO ^DIE
- End DoDot:5
- +116 KILL ABMAPOK
- +117 ; Write record (Create EMC unix file)
- +118 DO @("^ABMEF"_$PIECE(ABMER(ABMSEQ),U,3))
- +119 IF $GET(POP)
- Begin DoDot:5
- +120 SET DIE="^ABMDTXST(DUZ(2),"
- +121 SET DA=ABMP("XMIT")
- +122 SET DR=".14///NOPEN"
- +123 DO ^DIE
- End DoDot:5
- End DoDot:4
- End DoDot:3
- End DoDot:2
- End DoDot:1
- +124 ;end new abm*2.6*19 IHS/SD/SDR HEAT138428
- +125 SET DIR(0)="E"
- +126 DO ^DIR
- +127 KILL DIR
- +128 KILL ABMER,ABMP,ABMSEQ
- +129 QUIT
- FILE ;
- +1 ; File bills to 3P TX STATUS FILE
- +2 ;abm*2.6*6 5010
- SET ABMER("CNT")=1
- SET ABMER("LAST")=1
- +3 ; Active Insurer IEN
- SET ABMINS("IEN")=$PIECE(ABMER(ABMSEQ),U)
- +4 ;S ABMITYP=$P(^AUTNINS(ABMINS("IEN"),2),U) ; Insurance type ;abm*2.6*10 HEAT73780
- +5 ; Insurance type ;abm*2.6*10 HEAT73780
- SET ABMITYP=$$GET1^DIQ(9999999.181,$$GET1^DIQ(9999999.18,ABMINS("IEN"),".211","I"),1,"I")
- +6 ; Visit type
- SET ABMVTYPE=$PIECE(ABMER(ABMSEQ),U,2)
- +7 ; export type
- SET ABMEXP=$PIECE(ABMER(ABMSEQ),U,3)
- +8 ; Loop through locations in TMP global created by EMCREAT^ABMECDSP
- +9 SET ABMLOC=""
- +10 FOR
- SET ABMLOC=$ORDER(^TMP($JOB,"D",ABMINS("IEN"),ABMLOC))
- IF ABMLOC=""
- QUIT
- Begin DoDot:1
- +11 IF $DATA(^TMP($JOB,"D",ABMINS("IEN"),ABMLOC,ABMVTYPE))<2
- QUIT
- +12 ;abm*2.6*6
- KILL ABMGCN
- +13 ; Create a new batch in 3P TX STATUS
- DO NEWB
- +14 IF $GET(Y)<0
- DO MSG^ABMERUTL("Could not enter batch in 3P TX STATUS file.")
- QUIT
- +15 ; Add bill to detail in 3P TX STATUS for this batch
- +16 SET ^ABMDTXST(DUZ(2),DA(1),2,0)="^9002274.61P^^"
- +17 SET ABMAPOK=1
- +18 SET ABMDA=0
- +19 FOR
- SET ABMDA=$ORDER(^TMP($JOB,"D",ABMINS("IEN"),ABMLOC,ABMVTYPE,ABMEXP,ABMDA))
- IF '+ABMDA
- QUIT
- Begin DoDot:2
- +20 SET X=ABMDA
- +21 SET DIC="^ABMDTXST(DUZ(2),DA(1),2,"
- +22 SET DIC(0)="LXNE"
- +23 SET DINUM=X
- +24 KILL DD,DO
- DO FILE^DICN
- +25 IF +Y<0
- QUIT
- +26 SET DA=+Y
- +27 SET DIE="^ABMDTXST(DUZ(2),DA(1),2,"
- +28 SET ABMAPRV=$ORDER(^ABMDBILL(DUZ(2),ABMDA,41,"C","A",0))
- +29 IF ABMAPRV
- SET ABMAPRV=$PIECE(^ABMDBILL(DUZ(2),ABMDA,41,ABMAPRV,0),U)
- +30 IF ABMAPRV
- Begin DoDot:3
- +31 SET DR=".02///`"_ABMAPRV
- +32 DO ^DIE
- +33 KILL ABMAPRV
- End DoDot:3
- +34 SET ABMSBR=$$SBR^ABMUTLP(ABMDA)
- +35 SET DR=".03///"_ABMSBR
- +36 DO ^DIE
- +37 KILL ABMSBR
- +38 SET DIE="^ABMDBILL(DUZ(2),"
- +39 SET DA=ABMDA
- +40 ;S DR=".04////B;.16////A;.17////"_ABMP("XMIT") ;abm*2.6*2 5PMS10005
- +41 ;abm*2.6*2 5PMS10005
- SET DR=".04////B;.16////A"_$SELECT($PIECE($GET(^ABMDBILL(DUZ(2),ABMDA,1)),U,7)="":";.17////"_ABMP("XMIT"),1:"")
- +42 ;abm*2.6*3
- SET ABMREX("BDFN")=ABMDA
- +43 DO ^DIE
- +44 ;D BILLSTAT^ABMDREEX(DUZ(2),ABMDA,ABMP("XMIT"),"O",$P($G(^ABMDTXST(DUZ(2),ABMP("XMIT"),1)),U,6)) ;abm*2.6*2 5PMS10005
- End DoDot:2
- +45 KILL ABMAPOK
- +46 ; Write record (Create EMC unix file)
- +47 DO @("^ABMEF"_$PIECE(ABMER(ABMSEQ),U,3))
- +48 IF $GET(POP)
- Begin DoDot:2
- +49 SET DIE="^ABMDTXST(DUZ(2),"
- +50 SET DA=ABMP("XMIT")
- +51 SET DR=".14///NOPEN"
- +52 DO ^DIE
- End DoDot:2
- End DoDot:1
- +53 QUIT
- +54 ;
- NEWB ;
- +1 ; Create a new batch (Make entry in 3P TX STATUS)
- +2 DO NOW^%DTC
- +3 SET X=%
- +4 SET DIC="^ABMDTXST(DUZ(2),"
- +5 SET DIC(0)="LX"
- +6 SET DLAYGO=9002274.6
- +7 KILL DD,DO
- DO FILE^DICN
- +8 KILL DLAYGO
- +9 IF Y<0
- QUIT
- +10 SET ABMP("XMIT")=+Y
- +11 SET DIE=DIC
- +12 SET DA=+Y
- +13 SET DR=".02///"_$PIECE(ABMER(ABMSEQ),U,3)_";.04///`"_ABMINS("IEN")_";.03///"_ABMITYP_";.05////"_DUZ_";.09///"_$PIECE(ABMER(ABMSEQ),U,4)_";.11///"_$JUSTIFY($PIECE(ABMER(ABMSEQ),U,5),1,2)
- +14 ;abm*2.6*6 5010
- SET DR=DR_";.17////"_$$FMT^ABMERUTL(ABMER("CNT"),"4NR")
- +15 DO ^DIE
- +16 ;S DR=".16///"_$$NSN^ABMERUTL D ^DIE ;abm*2.6*3 5PMS10005#2
- +17 ;abm*2.6*3 5PMS10005#2
- DO GCNMULT^ABMERUTL("O",$SELECT(($GET(ABMREX("BILLSELECT"))!($GET(ABMREX("BATCHSELECT")))):"1",1:""))
- +18 SET DA(1)=DA
- +19 WRITE !,"ENTRY CREATED IN 3P TX STATUS FILE."
- +20 WRITE !,"LOCATION: ",ABMLOC
- +21 ;W !,"VISIT TYPE: ",$P(^ABMDVTYP(ABMVTYPE,0),U),! ;abm*2.6*2 5PMS10005
- +22 ;abm*2.6*2 5PMS10005
- IF $GET(ABMVTYPE)
- WRITE !,"VISIT TYPE: ",$PIECE(^ABMDVTYP(ABMVTYPE,0),U),!
- +23 QUIT