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

ACHSRP31.m

Go to the documentation of this file.
ACHSRP31 ; IHS/ITSC/PMF - PRINT CHS (43 & 64) FORMS (2/2) ;
 ;;3.1;CONTRACT HEALTH MGMT SYSTEM;**13,27**;JUN 11,2001;Build 43
 ;ACHS*3.1*13 11/22/06 IHS/OIT/FCJ PRT POLICY # & COV FR CORRECT FILES
 ;ACHS*3.1*27 11.14.17 IHS.OIT.FCJ CHANGE FOR NEW MEDICARE NUMBER
 ;
 I $$PARM^ACHS(2,16)'="Y" W !!!!
 ;
EN ;EP - From CHEF report.
 I $G(DFN)="" W !!,"DFN variable MUST be defined when entering this routine!!" Q
 ;
 W !!?ACHSTAB,"Type of Coverage",?30,"Policy #",?55,"Cov. type EligDt TermDt",!?ACHSTAB,"----------------",?30,"--------",?55,"--------- ------ ------"
 ;
 ;LETS LOOK AT POSSIBLE MEDICARE COVERAGE
MCR ;
 G:'$D(^AUPNMCR(DFN)) MCD
 ;G MCD:'$P($G(^AUPNMCR(DFN,0)),U,3) ;ACHS*3.1*27 NEW NUMBER STORED IN PAT REG
 ;S X=$J("",ACHSTAB)_$P($G(^AUTNINS($P($G(^AUPNMCR(DFN,0)),U,2),0)),U)
 I $P($G(^AUPNMCR(DFN,0),"UNDEFINED"),U,2)'="" D
 .S X=$J("",ACHSTAB)_$P($G(^AUTNINS($P($G(^AUPNMCR(DFN,0)),U,2),0)),U)
 E  S X=$J("",ACHSTAB)
 S X=X_$J("",30-$L(X))
 ;ACHS*3.1*27 MODIFIED NXT SECTION FOR NEW MBI AND CHECK FOR "D" COVERAGE AND ELIG DATES
 S ACHSMBI=$$GETMBI^AUPNMBI(DFN,DT,0)
 I +ACHSMBI<1 S ACHSMBI=$P(^AUPNMCR(DFN,0),U,3) I $P(^(0),U,4),$D(^AUTTMCS($P(^(0),U,4),0)) S ACHSMBI=ACHSMBI_$P(^(0),U)
 ;GO THRU 'MEDICARE ELIGIBLE' FILE
 S I=0
 F  S I=$O(^AUPNMCR(DFN,11,I)) Q:+I=0  D
 .I $G(ACHSEDOS) Q:ACHSEDOS<$P($G(^AUPNMCR(DFN,11,I,0)),U)
 .I $G(ACHSEDOS),$P($G(^AUPNMCR(DFN,11,I,0)),U,2)'="" Q:ACHSEDOS>$P($G(^AUPNMCR(DFN,11,I,0)),U,2)
 .W !,X
 .I $P($G(^AUPNMCR(DFN,11,I,0)),U,3)?1"D" W $P($G(^AUPNMCR(DFN,11,I,0)),U,6)     ;COVERAGE TYPE OF "D"
 .E  W ACHSMBI
 .W ?60,$P($G(^AUPNMCR(DFN,11,I,0)),U,3)          ;'COVERAGE TYPE'
 .W ?65,$$MDY($P($G(^AUPNMCR(DFN,11,I,0)),U))     ;'ELIG. DATE'
 .W ?72,$$MDY($P($G(^AUPNMCR(DFN,11,I,0)),U,2))   ;'ELIG. END DATE'
 ;
 ;LETS LOOK AT POSSIBLE MEDICAID COVERAGE
MCD ;
 G RRE:'$D(^AUPNMCD("B",DFN))
 K ^TMP("ACHSRP31",$J,"MCD")
 F I=0:0 S I=$O(^AUPNMCD("B",DFN,I)) Q:'I  F JJ=0:0 S JJ=$O(^AUPNMCD(I,11,JJ)) Q:'JJ  D
 .S ^TMP("ACHSRP31",$J,"MCD",9999999-JJ)=$G(^AUPNMCD(I,11,JJ,0))
 .S $P(^TMP("ACHSRP31",$J,"MCD",9999999-JJ),U,4,6)=$P($G(^AUPNMCD(I,0)),U,2,4)
 ;
 S JJ=0,DAT=""
 F ACHS=1:1:4 S JJ=$O(^TMP("ACHSRP31",$J,"MCD",JJ)) Q:'JJ  I $P(^TMP("ACHSRP31",$J,"MCD",JJ),U,6)]"",$D(^DIC(5,$P(^(JJ),U,6),0)) S $P(^TMP("ACHSRP31",$J,"MCD",JJ),U,6)=$P(^(0),U,2)
 S I=0
 ;ACHS*3.1*27 REWROTE TO TST FOR ELIG DATES
 F ACHS=1:1:4 S I=$O(^TMP("ACHSRP31",$J,"MCD",I)) Q:'I  D
 .S DAT=^TMP("ACHSRP31",$J,"MCD",I)
 .I $G(ACHSEDOS) Q:ACHSEDOS<($P(DAT,U))
 .I $G(ACHSEDOS),$P(DAT,U,2)'="" Q:ACHSEDOS>($P(DAT,U,2))
 .W !?ACHSTAB,$P(^AUTNINS($P(DAT,U,4),0),U)
 .W ?30,$P(DAT,U,5),$P(DAT,U,6),?60,$P(DAT,U,3),?65,$$MDY($P(DAT,U)),?72,$$MDY($P(DAT,U,2))
 K ^TMP("ACHSRP31",$J,"MCD")
RRE ;
 G PVT:'$D(^AUPNRRE(DFN,0))
 ;ACHS*3.1*27 REWROTE TO TST FOR ELIG DATES AND PRINT MBI
 ;******LOOP THRU RAILROAD ELIGIBLE FILE
 S ACHSMBI=$$GETMBI^AUPNMBI(DFN,DT,0)
 I +ACHSMBI<1 D
 .S ACHSMBI=""
 .S:$P($G(^AUPNRRE(DFN,0)),U,3)'="" ACHSMBI=$P(^AUTTRRP($P(^AUPNRRE(DFN,0),U,3),0),U)
 .S ACHSMBI=ACHSMBI_$P($G(^AUPNRRE(DFN,0)),U,4)  ;PRNT PREFIX FOR OLD NUMBER
 S I=0
 F  S I=$O(^AUPNRRE(DFN,11,I)) Q:I'?1N.N  D
 .S DAT=^AUPNRRE(DFN,11,I,0)
 .I $G(ACHSEDOS) Q:ACHSEDOS<$P(DAT,U)
 .I $G(ACHSEDOS),$P(DAT,U,2)'="" Q:ACHSEDOS>($P(DAT,U,2))
 .W !?ACHSTAB
 .W:$P($G(^AUPNRRE(DFN,0)),U,2)'="" $P($G(^AUTNINS($P(^AUPNRRE(DFN,0),U,2),0)),U),?30
 .W ACHSMBI
 .W ?60,$P(DAT,U,3),?65,$$MDY($P(DAT,U)),?72,$$MDY($P(DAT,U,2))
PVT ;
 G END:'$D(^AUPNPRVT(DFN,11))
 S I=0
PVT1 ;
 ;****LOOP THRU PRIVATE INSURANCE
 ;ACHS*3.1*27 REWROTE TO TEST FOR ELIG DATES
 F  S I=$O(^AUPNPRVT(DFN,11,I)) G:I'?1N.N END D
 .I $G(ACHSEDOS) Q:ACHSEDOS<$P(^AUPNPRVT(DFN,11,I,0),U,6)
 .I $G(ACHSEDOS),$P(^AUPNPRVT(DFN,11,I,0),U,7)'="" Q:ACHSEDOS>($P(^(0),U,7))
 .S ACHSINS=^AUPNPRVT(DFN,11,I,0)
 .W !?ACHSTAB,$E($P(^AUTNINS($P(ACHSINS,U),0),U),1,26)
 .I $P(ACHSINS,U,8),$D(^AUPN3PPH($P(ACHSINS,U,8),0)) D
 ..S I2=$P(^AUPNPRVT(DFN,11,I,0),U,8)
 ..W ?30,$P(^AUPN3PPH(I2,0),U,4)," "
 ..I $P(^AUPN3PPH(I2,0),U,5) D
 ...S X=$P(^AUTTPIC($P(^AUPN3PPH(I2,0),U,5),0),U)
 ...W ?64-$L(X),$E(X,1,64-$X)
 .W ?65,$$MDY($P(^AUPNPRVT(DFN,11,I,0),U,6)),?72,$$MDY($P(^(0),U,7))
 ;
 ;
END ;
 K I,I2,JJ,ACHSINS,DAT
 Q
 ;
MDY(X) ;
 Q $E(X,4,7)_$E(X,2,3)
 ;