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

ACHS3PP2.m

Go to the documentation of this file.
ACHS3PP2 ; IHS/ITSC/PMF - PRINT CHS THIRD PARTY PAYMENT REPORT - INDIVIDUAL PAT ;    [ 10/16/2001   8:16 AM ]
 ;;3.1;CONTRACT HEALTH MGMT SYSTEM;;JUN 11, 2001
 ;
 ;TPF THIS IS A REWRITE OF ACHSPPB
 ;CALLED FROM ACHS3PP1
 ;
 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
 ;
 ;BEGIN INDIV. PATIENT LOOP
 S ACHSPAT=""
 F  S ACHSPAT=$O(^TMP("ACHS3PP",$J,ACHSPAT)) Q:ACHSPAT=""  D
 .S ACHSPAGE=0
 .D:'$O(^TMP("ACHS3PP",$J,ACHSPAT,0)) HEADER,NODATA
 .D HEADER
 .D GETPAT
 D TOTL
 Q
GETPAT ;
 ;I '$D(ACHSPAT(0))
 ;
 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(^AUPNPAT(ACHSPAT,41,DUZ(2),0)),U,2),1:"NO HRN") D HEADER1
 D HEADER2
 ;
 S ACHSDOC=0
 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),ACHSIDT=$E(D,4,5)_"/"_$E(D,6,7)_"/"_$E(D,2,3)
 .S S=$P(Z,U,5),ACHSSERV=$S(S=1:"HOSP",S=2:"DENT",S=3:"OUTP",1:"UNKN")
 .S ACHSOBL=$P(Z,U,2),ACHS3PP=$P(Z,U,3),ACHSIHSP=$P(Z,U,4)
 .S C=C+1,ACHSDOCS=C
PDATA .;Print the Data 
 .I ACHSRTYP["D" D DETAIL
 .;
 .I IOST["P-"&($Y>56) D HEADER
 .I IOST["C-",'$D(IO("S")),$Y>24 D HEADER D
 ..I '$$DIR^XBDIR("E") D END Q
 ..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
 D SUBTOTL
 Q
 ;
DETAIL ;DETAIL LINE
 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)
 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 !! I '$$DIR^XBDIR("E") D END Q
 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 !! I '$$DIR^XBDIR("E") D END Q
 Q
 ;
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)
 S ACHSPATP=$P(ACHSPATP,",",2)_" "_$P(ACHSPATP,",",1)
 W !!!,"NO DATA FOR SPECIFIED FISCAL YEAR FOR ",ACHSPATP
 K ^TMP("ACHS3PP",$J,ACHSPAT)
 W !!!!
 D:'$$DIR^XBDIR("E") END
 I $D(^TMP("ACHS3PP",$J)) Q
 D:IOST["C-"&'$D(IO("S")) ^ACHS3PP5
 Q
 ;