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

ACHSEOB6.m

Go to the documentation of this file.
ACHSEOB6 ; IHS/ITSC/PMF - PROCESS EOBRS (7/7) SUMMARY/ERROR REPORT ;
 ;;3.1;CONTRACT HEALTH MGMT SYSTEM;**13,18,22,23**;JUN 11,2001;Build 43
 ;ACHS*3.1*13 JVK/SET/ITSC 8/22/05 FIX CLOSING SLAVE DEV
 ;
START ;EP - From TaskMan.
 S ACHSSUM=0
 S ACHS("R")=$O(^ACHSEOBR(0)),ACHSPG=0
 G END:ACHS("R")=""
 D SITENAME
 S (ACHSFAC,ACHSOLD)="",ACHSEOIO=IO
 K ^TMP("ACHSEOB",$J)
 D BM^ACHSFU,NOW^ACHS
 S X=ACHSTIME,ACHSTERR=0,ACHSLP=1  ;ACHS*3.1*22;ADDED ACHSLP
 I ACHSRPT=1 S ACHSLP=0 W @IOF D HDR  ;ACHS*3.1*22;ADDED ACHSLP
 I ACHSRPT=2 S ACHSFAC=0 G PRNT2
 I ACHSISAO D AREA G END
 F  S ACHSFAC=$O(^ACHSEOBR(ACHSFAC)) Q:+ACHSFAC'=ACHSFAC  D  Q:$D(DUOUT)!$D(DTOUT)
 . ;ACHS*3.1*22 IHS.OIT.FCJ CHANGED NXT LINE TO START F LOOP TO ACHSLP VAR
 . F ACHSCTR(1)=ACHSLP:0 Q:$D(DUOUT)!$D(DTOUT)  S ACHSCTR(1)=$O(^ACHSEOBR(ACHSFAC,ACHSCTR(1))) Q:+ACHSCTR(1)'=ACHSCTR(1)  S ACHSOLD=$E(^ACHSEOBR(ACHSFAC,ACHSCTR(1)),1,18) D PRNT
 .Q
 Q:$D(DUOUT)!$D(DTOUT)          ;THIS USED TO BE A GOTO TO K^ACHSEOB5
 W !?10,"TOTAL AMOUNT THIS RUN:        ",?40
 S X=ACHSSUM
 D FMT^ACHS
 W !!!
 D RTRN^ACHS:ACHSRPT=2,FTR:ACHSRPT=1
 I ACHSRPT=1 D DCR
 ;ACHS*3.1*13 ADDED TO PREVENT HANG OF SLAVE DEVICE JVK/SET/ITSC 8/22/05
 D ^%ZISC
END ;
 I ACHSRPT=2 S ACHSRPT=1 G START
 Q
 ;
 ;
PRNT ;
 F ACHSCTR=ACHSCTR(1):1 Q:'$D(^ACHSEOBR(ACHSFAC,ACHSCTR))  S ACHSEOBR=$G(^ACHSEOBR(ACHSFAC,ACHSCTR)) Q:$E(ACHSEOBR,1,18)'=ACHSOLD  D PRT^ACHSEOBB
 I ACHSISAO Q:ACHSFAC'=ACHSFAC(1)
 I ACHSRPT=2,'$D(^ACHSEOBR("ER",ACHSFAC,ACHSCTR(1))) Q
 ;I ACHSRPT=2,$D(^ACHSEOBR("ER",ACHSFAC,ACHSCTR(1))) D ^ACHSEOB2 K ^TMP("ACHSEOB",$J) Q  ;ACHS*3.1*22
 ;ACHS*3.1*23 ADDED K ACHSEOBR ARRAY IN NXT LINE
 ;I ACHSRPT=2,$D(^ACHSEOBR("ER",ACHSFAC,ACHSCTR(1))) D:$P($G(ACHSMEDA),".",2)'="ICD" ^ACHSEOB2 K ^TMP("ACHSEOB",$J) Q  ;ACHS*3.1*22 DO NOT PRINT IF ICDFX
 I ACHSRPT=2,$D(^ACHSEOBR("ER",ACHSFAC,ACHSCTR(1))) D:$P($G(ACHSMEDA),".",2)'="ICD" ^ACHSEOB2 S X=ACHSEOBR K ^TMP("ACHSEOB",$J),ACHSEOBR S ACHSEOBR=X Q  ;ACHS*3.1*23 CLEAN UP VARS
 ;ACHS*3.1*23 TEST FOR DATA IN "B" REC
 ;I $D(^ACHSEOBR(ACHSFAC,ACHSCTR(1))) D W1 W ?34,ACHSEOBR("B",8) D COST W !
 I $D(^ACHSEOBR(ACHSFAC,ACHSCTR(1))),$D(ACHSEOBR("B",8)) D W1 W ?34,ACHSEOBR("B",8) D COST W !
P0 ;
 S ACHS="",ACHSER1=0
 F  S ACHS=$O(^ACHSEOBR("ER",ACHSFAC,ACHSCTR(1),ACHS)) Q:ACHS=""  D
 . S ACHSER=$P($T(@ACHS^ACHSEOBG),";",4),ACHSDESC=$P($T(@ACHS^ACHSEOBG),";",3)
 . I ACHSER="E" S ACHSSUM=ACHSSUM-ACHSCOST
 . F I=1:1 S ACHSEDAT=$P(^ACHSEOBR("ER",ACHSFAC,ACHSCTR(1),ACHS),U,I) Q:(ACHSEDAT="")&(I>1)  W ?29,ACHSER_ACHS,?34,ACHSDESC W:ACHSEDAT]"" ?55,"(",ACHSEDAT,")" W ! S ACHSER1=1 Q:ACHSEDAT=""
P1 ;
 I ACHSRPT=2 D RTRN^ACHS
 K ^TMP("ACHSEOB",$J),ACHSEOBR
 I ACHSRPT=1,$Y>(ACHSBM-4) D FTR I '$D(DUOUT),'$D(DTOUT) D HDR
 S ACHSCTR(1)=$S($D(^ACHSEOBR(ACHSFAC,ACHSCTR)):ACHSCTR-1,1:ACHSCTR)
 Q
 ;
W1 ;
 ;ACHS*3.1*22 ADDED TEST FOR DATA BELOW
 W:$D(ACHSEOBR("A")) $J(+ACHSEOBR("A",8),5),?6,ACHSEOBR("A",14)," ",$E(ACHSEOBR("A",12),2,12)," "," ",ACHSEOBR("C",13)," "," "," ",ACHSEOBR("A",15)," "
 Q
 ;
COST ;
 ;ACHS*3.1*23 CHG "E" TO VAR ACHSREJ FOR REC E OR J
 S ACHSREJ=$S($D(ACHSEOBR("E")):"E",$D(ACHSEOBR("J")):"J",1:"")
 W ?70,$J($FN(+$E(ACHSEOBR(ACHSREJ,8),1,7)_"."_$E(ACHSEOBR(ACHSREJ,8),8,9),",",2),8)
 S ACHSCOST=$E(ACHSEOBR(ACHSREJ,8),1,7)_"."_$E(ACHSEOBR(ACHSREJ,8),8,9)
 S ACHSSUM=ACHSSUM+ACHSCOST
 Q
 ;
PRNT2 ;
 S ACHSFAC=$O(^ACHSEOBR("ER",ACHSFAC))
 G END:ACHSFAC=""
 W @IOF
 S ACHSCTR(1)=0
PRNT2A ;
 S ACHSCTR(1)=$O(^ACHSEOBR("ER",ACHSFAC,ACHSCTR(1)))
 G PRNT2:ACHSCTR(1)=""
 S ACHSOLD=$E(^ACHSEOBR(ACHSFAC,ACHSCTR(1)),1,18)
 D PRNT,RTRN^ACHS
 Q:$D(DUOUT)!$D(DTOUT)       ;USED TO BE G K^ACHSEOB5
 G PRNT2A
 ;
HDR ;
 U IO
 S ACHSPG=ACHSPG+1
 W ACHSTIME,?28,"CHS EOBR PROCESSING REPORT",?67,"PAGE ",$J(ACHSPG,3),!,?24,"for Documents Paid on: ",$$FMTE^XLFDT(ACHSEOBD),!,?40-(($L(ACHS("SITE"))+4)\2),"for ",ACHS("SITE"),!
HDR2 ;
 W !!,"COUNT SITE   P.O. NUMBER P-T CODE DESCRIPTION or PATIENT",?70,"IHS COST",!,"----- ------ ----------- --- ---- ------------------------------",?70,"--------",!!
 Q
 ;
SITENAME ;
 S ACHS("SITE")=$P(^DIC(4,ACHS("R"),0),U,1)
 Q
 ;
FTR ; Print footer, do EOP, TOP.
 W !,"'COUNT' appears at the upper right of the EOBR.",!,"If 'CODE' begins with 'E', the P.O. was not processed.",!,"If 'CODE' begins with 'W', the P.O. was processed but needs further attention.",!
 D RTRN^ACHS
 Q:$D(DUOUT)!$D(DTOUT)
 W @IOF
 Q
 ;
AREA ;
 S (ACHSFAC,ACHSCTR,ACHSCTR(1),ACHSFAC(1))=0
AREA1 ;
 S ACHSFAC=$O(^ACHSEOBR(ACHSFAC))
 Q:+ACHSFAC'=ACHSFAC
 Q:ACHSFAC=""
 S ACHS("R")=ACHSFAC
 D SITENAME
 I ACHSFAC'=ACHSFAC(1),ACHSFAC(1)'=0 D FTR Q:$D(DUOUT)!$D(DTOUT)  D HDR
AREA2 ;
 S ACHSCTR(1)=$O(^ACHSEOBR(ACHSFAC,ACHSCTR(1)))
 G AREA1:ACHSCTR(1)=""
 S ACHSOLD=$E(^ACHSEOBR(ACHSFAC,ACHSCTR(1)),1,18),ACHSFAC(1)=ACHSFAC
 D PRNT
 Q:$D(DUOUT)!$D(DTOUT)       ;USED TO BE G K^ACHSEOB5
 G AREA2
 ;
DCR ; Print Begin/End values of DCRs
 N %,B,E,N,R,X,Y
 S N=$G(^ACHS(9,DUZ(2),"RN")),Y=0
 F  S Y=$O(^ACHSEOBR("DCR",Y)) Q:'Y  D  Q:$G(ACHSQUIT)
 . I '$D(^ACHSEOBR("DCR",Y,"E")) S ^ACHSEOBR("DCR",Y,"E")=$G(^ACHSEOBR("DCR",Y,"B"))
 . I $G(^ACHSEOBR("DCR",Y,"B"))=$G(^ACHSEOBR("DCR",Y,"E")) Q
 . S B=$G(^ACHSEOBR("DCR",Y,"B"))
 . S E=$G(^ACHSEOBR("DCR",Y,"E"))
 . W !!,Y," Registers",?29,"Before",?45,"After",?59,"Change"
 . W !,$$R(20),?22,$$R(13),?37,$$R(13),?52,$$R(13)
 . F %=1:1:7 S R=$P(N,U,%)_$$REPEAT^XLFSTR(".",20) W !,$E(R,1,20),$J($FN($P(B,U,%),",",2),15),$J($FN($P(E,U,%),",",2),15),$J($FN($P(B,U,%)-$P(E,U,%),",",2),15)
 . D RTRN
 .Q
 Q
 ;
R(A) ;
 Q $$REPEAT^XLFSTR("-",A)
 ;
RTRN ;
 N %,B,E,N,R,X,Y
 D RTRN^ACHS
 Q