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

APCLBRH2.m

Go to the documentation of this file.
APCLBRH2 ; IHS/CMI/LAB - process billing report holders ;
 ;;2.0;IHS PCC SUITE;**8**;MAY 14, 2009;Build 2
 ;
START ;
 S APCLBT=$H,APCLJOB=$J
 S (DFN,APCLTOT)=0 K ^XTMP("APCLBRH",APCLJOB,APCLBT)
 D XTMP^APCLOSUT("APCLBRH","PCC - PATS WITH 3RD PARTY")
 D @APCLPROC
 S APCLET=$H
 Q
 ;
MCRA ;
 F  S DFN=$O(^AUPNMCR(DFN)) Q:DFN'=+DFN  I '$$DEMO^APCLUTL(DFN,$G(APCLDEMO)) D MCRA2
 Q
MCRA2 ;
 Q:'$D(^AUPNMCR(DFN,11))
 Q:'$D(^AUPNPAT(DFN,41,APCLSU,0))
 Q:'$D(^DPT(DFN,0))
 Q:$$DEMO^APCLUTL(DFN,$G(APCLDEMO))
 I $D(^DPT(DFN,.35)),$P(^(.35),U)]"",$P(^(.35),U)<APCLACE Q
 S APCLPN=$P(^DPT(DFN,0),U)
 S APCLMDFN=0 F  S APCLMDFN=$O(^AUPNMCR(DFN,11,APCLMDFN)) Q:APCLMDFN'=+APCLMDFN  D MCRA3
 Q:'$D(^XTMP("APCLBRH",APCLJOB,APCLBT,APCLPN))
 S APCLTOT=APCLTOT+1
 K APCLPN
 Q
 ;
MCRA3 ;
 Q:APCLVAL'[$P(^AUPNMCR(DFN,11,APCLMDFN,0),U,3)
 Q:$P(^AUPNMCR(DFN,11,APCLMDFN,0),U)>APCLACE
 I $P(^AUPNMCR(DFN,11,APCLMDFN,0),U,2)]"",$P(^(0),U,2)<APCLACE Q
 S ^XTMP("APCLBRH",APCLJOB,APCLBT,APCLPN,DFN,APCLMDFN)=""
 Q
 ;
PI ;
 F  S DFN=$O(^AUPNPRVT(DFN)) Q:DFN'=+DFN  I '$$DEMO^APCLUTL(DFN,$G(APCLDEMO)) D PI2
 Q
PI2 ;
 Q:'$D(^AUPNPAT(DFN,41,APCLSU))
 I $D(^DPT(DFN,.35)),$P(^(.35),U)]"",$P(^(.35),U)<APCLACE Q
 Q:'$D(^AUPNPRVT(DFN,11))
 S APCLPN=$P(^DPT(DFN,0),U)
 S APCLMDFN=0 F  S APCLMDFN=$O(^AUPNPRVT(DFN,11,APCLMDFN)) Q:APCLMDFN'=+APCLMDFN  D PI3
 Q:'$D(^XTMP("APCLBRH",APCLJOB,APCLBT,APCLPN))
 S APCLTOT=APCLTOT+1
 K APCLPN
 Q
PI3 ;
 Q:$P(^AUPNPRVT(DFN,11,APCLMDFN,0),U)=""
 S APCLNAME=$P(^AUPNPRVT(DFN,11,APCLMDFN,0),U) Q:APCLNAME=""
 S APCLNAME=$P(^AUTNINS(APCLNAME,0),U) I APCLNAME["AHCCCS" Q
 Q:$P(^AUPNPRVT(DFN,11,APCLMDFN,0),U,6)>APCLACE
 I $P(^AUPNPRVT(DFN,11,APCLMDFN,0),U,7)]"",$P(^(0),U,7)<APCLACE Q
 S ^XTMP("APCLBRH",APCLJOB,APCLBT,APCLPN,DFN,APCLMDFN)=""
 Q
 ;
MCD ;
 F  S DFN=$O(^AUPNMCD("B",DFN)) Q:DFN'=+DFN  I '$$DEMO^APCLUTL(DFN,$G(APCLDEMO))  D MCD2
 Q
MCD2 ;
 Q:'$D(^AUPNPAT(DFN,41,APCLSU))
 I $D(^DPT(DFN,.35)),$P(^(.35),U)]"",$P(^(.35),U)<APCLACE Q
 S APCLPN=$P(^DPT(DFN,0),U)
 S APCLMDFN=0 S APCLMDFN=$O(^AUPNMCD("B",DFN,APCLMDFN)) Q:APCLMDFN'=+APCLMDFN  D MCD3
 Q:'$D(^XTMP("APCLBRH",APCLJOB,APCLBT,APCLPN))
 S APCLTOT=APCLTOT+1
 K APCLPN
 Q
MCD3 ;
 Q:'$D(^AUPNMCD(APCLMDFN,11))
 S APCLNDFN=0 F  S APCLNDFN=$O(^AUPNMCD(APCLMDFN,11,APCLNDFN)) Q:APCLNDFN'=+APCLNDFN  S APCLR=^AUPNMCD(APCLMDFN,11,APCLNDFN,0) D MCD4
 Q
MCD4 ;
 Q:APCLNDFN>APCLACE
 I $P(APCLR,U,2)]"",$P(APCLR,U,2)<APCLACE Q
 S ^XTMP("APCLBRH",APCLJOB,APCLBT,APCLPN,DFN,APCLMDFN,APCLNDFN)=""
 Q