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

ACHS3PPB.m

Go to the documentation of this file.
ACHS3PPB ; IHS/ITSC/TPF/PMF - PRINT CHS THIRD PARTY PAYMENT REPORT - INDIVIDUAL PAT ;  
 ;;3.1;CONTRACT HEALTH MGMT SYSTEM;**16**;JUN 11, 2001
 ;ACHS*3.1*16 IHS.OIT.FCJ FIXED LOOP AND EXIT PROBLEM
 ;
 D BRPT^ACHSFU
 S (ACHSOBL,ACHSOBLS,ACHSOBLT,ACHS3PP,ACHS3PPS,ACHS3PPT,ACHSDOCS)=0
 S (ACHSDOCT,ACHSIHSP,ACHSIHSS,ACHSIHST,C,ACHSPAGE,ACHS43ST,ACHS57ST)=0
 S (ACHS64ST,ACHS0ST,ACHS43T,ACHS57T,ACHS64T,ACHS0T)=0
 K ACHSPATP
P1 ;
 S ACHSPAT=""
 ;ACHS*3.1*16 IHS.OIT.FCJ ADDED DUOUT TEST TO NXT LINE
 F  S ACHSPAT=$O(^TMP("ACHS3PP",$J,ACHSPAT)) Q:ACHSPAT=""  D  G:$D(DUOUT) END
 .I $D(^TMP("ACHS3PP",$J,ACHSPAT,0)) D HEADER D NODATA
 .S ACHSPAGE=0
 .D HEADER
 .D GETPAT
 D TOTL    ;ACHS*3.1*16 IHS.OIT.FCJ ADDED LINE
 Q
GETPAT ;
 I '$D(ACHSPAT(0)) D
 .S ACHSPATP=$S($D(^DPT(ACHSPAT,0)):$P($G(^DPT(ACHSPAT,0)),U),1:"NO NAME")
 .S ACHSHRN=$S($D(^AUPNPAT(ACHSPAT,41,DUZ(2),0)):$P($G(^DPT(ACHSPAT,0)),U,2),1:"NO HRN")
 .D HEADER1
 D P2
 Q
 ;
P2 ;
 S ACHSDOC=""
 D HEADER2
 ;
 F  S ACHSDOC=$O(^TMP("ACHS3PP",$J,ACHSPAT,ACHSDOC)) Q:ACHSDOC=""  D
 .S Z=$G(^TMP("ACHS3PP",$J,ACHSPAT,ACHSDOC))
 .S D=$P(Z,U,1)
 .S ACHSIDT=$E(D,4,5)_"/"_$E(D,6,7)_"/"_$E(D,2,3)
 .S S=$P(Z,U,5)
 .S ACHSSERV=$S(S=1:"HOSP",S=2:"DENT",S=3:"OUTP",1:"UNKN")
 .S ACHSOBL=$P(Z,U,2)
 .S ACHS3PP=$P(Z,U,3)
 .S ACHSIHSP=$P(Z,U,4)
 .S C=C+1,ACHSDOCS=C
 .D PDATA
 D SUBTOTL   ;ACHS*3.1*16 IHS.OIT.FCJ REMOVED . AND CHANGED TO SUBTOTAL 
 Q
 ;
PDATA ;Prints Data 
 I ACHSRTYP["D" D
 . W !?1,ACHSDOC,?22,ACHSSERV,?30,ACHSIDT,?40
 . S X=ACHSOBL,X2=2
 . D COMMA^%DTC
 . W $J(X,12),?53
 . S X=ACHSIHSP,X2=2
 . D COMMA^%DTC
 . W $J(X,12),?65
 . S X=ACHS3PP,X2=2
 . D COMMA^%DTC
 . W $J(X,11)
 ;
 I IOST["P-"&($Y>56) D HEADER
 I IOST["C-",'$D(IO("S")),$Y>24 G END:'$$DIR^XBDIR("E") D HEADER
 S ACHSOBLS=ACHSOBLS+ACHSOBL,ACHS3PPS=ACHS3PPS+ACHS3PP,ACHSIHSS=ACHSIHSS+ACHSIHSP
 I ACHSSER=4 D
 . S:S=1 ACHS43ST=ACHS43ST+1
 . S:S=2 ACHS57ST=ACHS57ST+1
 . S:S=3 ACHS64ST=ACHS64ST+1
 . I S'=1&(S'=2)&(S'=3) S ACHS0ST=ACHS0ST+1
 ;
 S ACHSFLG=1
 Q
 ;
SUBTOTL ;
 W !,$$REPEAT^XLFSTR("-",80),!?1,"SUBTOTAL",?4,$J(ACHSDOCS,4)
 S X=ACHSOBLS,X2="2$"
 D COMMA^%DTC
 W ?40,$J(X,12)
 S X=ACHSIHSS,X2="2$"
 D COMMA^%DTC
 W ?53,$J(X,12)
 S X=ACHS3PPS,X2="2$"
 D COMMA^%DTC
 W ?65,$J(X,12)
 ;
 I ACHSOBLS>0&(ACHSIHSS>0) W !! S Z=(ACHSIHSS/ACHSOBLS)*100 W "PERCENTAGES OF PAYMENT TO OBLIGATED",?59,$E(Z,1,5)_"%"
 ;
 I ACHSOBLS>0&(ACHS3PPS>0) S X=(ACHS3PPS/ACHSOBLS)*100 W ?71,$E(X,1,5)_"%"
 ;
 I ACHSSER=4 W !?5,"*HOSP - ",ACHS43ST,"*",?25,"*DENT - ",ACHS57ST,"*",?45,"*OUTP - ",ACHS64ST,"*",?65,"*UNKN - ",ACHS0ST,"*"
 ;
 S ACHS43T=ACHS43T+ACHS43ST,ACHS57T=ACHS57T+ACHS57ST,ACHS64T=ACHS64T+ACHS64ST,ACHS0T=ACHS0T+ACHS0ST
 ;
 S ACHSOBLT=ACHSOBLT+ACHSOBLS,ACHSIHST=ACHSIHST+ACHSIHSS,ACHS3PPT=ACHS3PPT+ACHS3PPS,ACHSDOCT=ACHSDOCT+ACHSDOCS
 ;
 K DIR
 I IOST["C-",'$D(IO("S")) W !! G END:'$$DIR^XBDIR("E")
 S (C,ACHSOBLS,ACHSIHSS,ACHS3PPS,ACHSDOCS,ACHSFLG,ACHS43ST,ACHS57ST,ACHS64ST,ACHS0ST)=0
 Q
 ;
TOTL ;
 W !!!!,$$REPEAT^XLFSTR("=",80),!!?1,"TOTAL",?9,$J(ACHSDOCT,4)
 S X=ACHSOBLT,X2="2$"
 D COMMA^%DTC
 W ?40,$J(X,12)
 S X=ACHSIHST,X2="2$"
 D COMMA^%DTC
 W ?53,$J(X,12)
 S X=ACHS3PPT,X2="2$"
 D COMMA^%DTC
 W ?65,$J(X,12)
 ;
 I ACHSOBLT>0&(ACHSIHST>0) W !! S Z=(ACHSIHST/ACHSOBLT)*100 W "PERCENTAGES OF PAYMENT TO OBLIGATED",?59,$E(Z,1,5)_"%"
 ;
 I ACHSOBLT>0&(ACHS3PPT>0) S X=(ACHS3PPT/ACHSOBLT)*100 W ?71,$E(X,1,5)_"%"
 ;
 I ACHSSER=4 W !?5,"*HOSP - ",ACHS43T,"*",?25,"*DENT - ",ACHS57T,"*",?45,"*OUTP - ",ACHS64T,"*",?65,"*UNKN - ",ACHS0T,"*"
 ;
 K DIR
 I IOST["C-",'$D(IO("S")) W !! G END:'$$DIR^XBDIR("E")
END ;Close device, kill variables, quit
 D ^%ZISC
 S:$D(ZTQUEUED) ZTREQ="@"
 K ACHS3PP,ACHS3PPS,ACHS3PPT,ACHSDAT,ACHSDOC,ACHSDOCS,ACHSDOCT
 K ACHSHRN,ACHSIDT,ACHSIHSP,ACHSIHSS,ACHSIHST,ACHSQIO
 K ACHSOBL,ACHSOBLS,ACHSOBLT,ACHSPAT,ACHSSERV,ACHSTIM,ACHSUSR,C,Z,S,D,P
 K ACHSFLG,ACHSOST,ACHSOT,ACHS43ST,ACHS43T,ACHS57ST,ACHS57T
 K ACHS64ST,ACHS64,ACHSPAGE,DIR,I,X,X2,Y,^TMP("ACHS3PP",$J)
 Q
 ;
 U IO
 W @IOF
 S ACHSPAGE=ACHSPAGE+1
 S Y=$$HTE^XLFDT($H),ACHSDAT=$P(Y,"@",1),ACHSTIM=$P(Y,"@",2)
 W !,"*",ACHSDAT
 S X=$$LOC^ACHS
 W ?((80/2)-($L(X)/2)),X
 W ?71,ACHSTIM,"*",!,"*User: ",ACHSUSR,?70,"Device:",IO,"*"
 W !!
 S X="3rd Party Payment Report - Page "
 W ?((80/2)-($L(X)/2)),X_ACHSPAGE
 W !
 S X="For FISCAL YEAR: "
 W ?((80/2)-($L(X)/2)),X_ACHSFY
 W !,$$REPEAT^XLFSTR("*",80)
 Q
 ;
HEADER1 ;
 W !!?5,"PATIENT NAME: ",ACHSPATP,?62,"CHART#: ",ACHSHRN
 Q
 ;
HEADER2 ;
 W !!?1,"DOCUMENT #"
 W:ACHSRTYP["D" ?22,"SERV",?30,"ISSUE DT"
 W ?42,"$ OBLIGD $",?55,"$ IHS PMT $",?69,"$ 3P PMT $"
 Q
 ;
NODATA ;
 S ACHSPATP=$P($G(^DPT(ACHSPAT,0)),U,1),ACHSPATP=$P(ACHSPATP,",",2)_" "_$P(ACHSPATP,",",1)
 W !!!,"NO DATA FOR SPECIFIED FISCAL YEAR FOR ",ACHSPATP
 K ^TMP("ACHS3PP",$J,ACHSPAT)
 W !!!!
 I '$$DIR^XBDIR("E") D END Q
 D:IOST["C-"&'$D(IO("S")) ^ACHS3PPQ
 Q
 ;