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

ACHSEOBI.m

Go to the documentation of this file.
ACHSEOBI ; IHS/ITSC/PMF - EOBR RECONCILIATION ;  [ 10/16/2001   8:16 AM ]
 ;;3.1;CONTRACT HEALTH MGMT SYSTEM;;JUN 11, 2001
 ;
 S (ACHSFY,ACHSCNT,ACHSSUM,ACHSBBAL,ACHSEBAL,ACHSTOT,ACHSPG)=0,ACHSIO=IO,ACHSLOC=$$LOC^ACHS
 D NOW^ACHS
BEGIN ; Main process loop.
 S ACHSFY=$O(^ACHSEOBR("ACHSSUM",ACHSFY))
 G END:ACHSFY=""
 D SUMMARY,REPORT
 G BEGIN
 ;
END ; Kill vars, close device, quit.
 K ACHS1,ACHSACT0,ACHSFY,ACHSSUM,ACHSBBAL,ACHSEBAL,ACHSREG,ACHSTOT,ACHSADJ,ACHSAMT,ACHSDCR
 D ^%ZISC
 Q
 ;
SUMMARY ;
 D HDR,HDR3
 W !!
 S ACHSTOT(ACHSFY,"TOTALS")=0
 F ACHSTYPE="PAYMENTS","ADJUSTMENTS","INTERIM PAYMENTS" D
 . I $D(^ACHSEOBR("ACHSTOT",ACHSFY,ACHSTYPE)) D SB2 D
 .. W !?5,ACHSTYPE," DOCUMENTS",?46,$J(ACHS1,5),?57,$J(ACHS,11)
 .. I ACHSTYPE="INTERIM PAYMENTS" W "***" S ACHSIP=1
 ..Q
 .Q
 W !?46,"-----",?60,"--------------"
 S X=$P(ACHSTOT(ACHSFY,"TOTALS"),U)
 D COMMA^%DTC
 W !!?5,"TOTALS",?46,$J($P(ACHSTOT(ACHSFY,"TOTALS"),U,2),5),?57,$J(X,11)
 W:$D(ACHSIP) !!?5,"*** Interim Payments Not Reflected In Totals"
 K ACHSIP
 Q
 ;
REPORT ;
 D HDR,HDR1,HDR2
 S ACHSACTN=$G(^ACHS(9,DUZ(2),"RN")),X2=2,X3=12
 S ACHSRTOT(ACHSFY,"BBAL")=0,ACHSRTOT(ACHSFY,"+")=0,ACHSRTOT(ACHSFY,"-")=0,ACHSRTOT(ACHSFY,"TOT")=0,ACHSRTOT(ACHSFY,"RTOT")=0
 F I=1:1:7 S $P(^ACHSEOBR("ACHSSUM",ACHSFY,"TOT"),U,I)=$P(^ACHSEOBR("ACHSSUM",ACHSFY,"+"),U,I)+$P(^ACHSEOBR("ACHSSUM",ACHSFY,"-"),U,I)
 F K=1:1:7 W $E($P(ACHSACTN,U,K),1,18),?18 D SB1 W:K<7 !
 W !,"----------------"
 D HDR2
 W "TOTAL",?18 F I="BBAL","+","-","TOT"
 S X=ACHSRTOT(ACHSFY,I)
 D FMT
 S X=ACHSRTOT(ACHSFY,"RTOT")
 D FMT
 S ACHSACT0=$P(^ACHS(9,DUZ(2),"FY",ACHSFY,0),U,3)
 S X2="2$",X3=18,X=$P(^ACHS(9,DUZ(2),"FY",ACHSFY,0),U,2),ACHSACT1=X
 D COMMA^%DTC
 W !!!!!,"YEAR TO DATE ALLOWANCE: ",X,!?5,"OBLIGATED BALANCE: "
 S X=$J(ACHSACT0,1,2)
 D FMT
 W !?26,"---------------",!?3,"UNOBLIGATED BALANCE: ",?24
 S X=$J(ACHSACT1-ACHSACT0,1,2)
 D FMT
 H 5
 W @IOF
 Q
 ;
SB1 ;
 S X=$P(^ACHSEOBR("ACHSBBAL",ACHSFY),U,K)
 S ACHSRTOT(ACHSFY,"BBAL")=ACHSRTOT(ACHSFY,"BBAL")+X
 D FMT
 F ACHSX="+","-","TOT" S X=$P(^ACHSEOBR("ACHSSUM",ACHSFY,ACHSX),U,K) S ACHSRTOT(ACHSFY,ACHSX)=ACHSRTOT(ACHSFY,ACHSX)+X D FMT
 S X=$P(^ACHSEOBR("ACHSBBAL",ACHSFY),U,K)+$P(^ACHSEOBR("ACHSSUM",ACHSFY,"TOT"),U,K)
 S ACHSRTOT(ACHSFY,"RTOT")=ACHSRTOT(ACHSFY,"RTOT")+X
 D FMT
 Q
 ;
SB2 ;
 S ACHS=$P(^ACHSEOBR("ACHSTOT",ACHSFY,ACHSTYPE),U),ACHS1=$P(^ACHSEOBR("ACHSTOT",ACHSFY,ACHSTYPE),U,2)
 I ACHSTYPE="INTERIM PAYMENTS" S X=ACHS D COMMA^%DTC S ACHS=X Q
 S $P(ACHSTOT(ACHSFY,"TOTALS"),U,2)=$P(ACHSTOT(ACHSFY,"TOTALS"),U,2)+ACHS1,$P(ACHSTOT(ACHSFY,"TOTALS"),U)=$P(ACHSTOT(ACHSFY,"TOTALS"),U)+ACHS
 S X=ACHS
 D COMMA^%DTC
 S ACHS=X
 Q
 ;
HDR ;
 U ACHSIO
 W @IOF
 S ACHSPG=ACHSPG+1
 W @IOF,?80-$L(ACHSLOC)/2,ACHSLOC,!,ACHSTIME,?25,"CHS EOBR RECONCILIATION",?72,"PAGE ",ACHSPG,!?33,ACHSFY,!!
 Q
 ;
HDR1 ;
 W !!?4,"REGISTER",?20,"BEGINNING",?32,"INCREASED",?45,"DECREASED",?58,"NET",?71,"ENDING",!?21,"BALANCE",?34,"AMOUNT",?46,"AMOUNT",?59,"CHANGE",?71,"BALANCE",!,"----------------"
 Q
 ;
HDR2 ;
 W ?18,"------------",?32,"----------",?44,"----------",?56,"----------",?68,"-----------",!
 Q
 ;
HDR3 ;EP.
 W !!!?7,"Type Document",?40,"No. Documents",?61,"Obligations",!?5,"----------------",?40,"--------------",?60,"--------------"
 Q
 ;
FMT ; 
 I '+X,'+$P(X,".",2) S X=$J("",X3) W X S X=0 Q
 D COMMA^%DTC
 W X
 S X=0
 Q
 ;
SET ;EP
 S ACHSFY=$O(ACHSSUM(ACHSFY))
 Q:ACHSFY=""
 S:$D(ACHSBBAL(ACHSFY)) ^ACHSEOBR("ACHSBBAL",ACHSFY)=ACHSBBAL(ACHSFY)
 S:$D(ACHSSUM(ACHSFY)) ^ACHSEOBR("ACHSSUM",ACHSFY)=ACHSSUM(ACHSFY)
 S:$D(ACHSSUM(ACHSFY,"+")) ^ACHSEOBR("ACHSSUM",ACHSFY,"+")=ACHSSUM(ACHSFY,"+")
 S:$D(ACHSSUM(ACHSFY,"-")) ^ACHSEOBR("ACHSSUM",ACHSFY,"-")=ACHSSUM(ACHSFY,"-")
 F I="PAYMENTS","ADJUSTMENTS","INTERIM PAYMENTS" S:$D(ACHSTOT(ACHSFY,I)) ^ACHSEOBR("ACHSTOT",ACHSFY,I)=ACHSTOT(ACHSFY,I)
 G SET
 ;