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

ACHSC6P.m

Go to the documentation of this file.
ACHSC6P ; IHS/ITSC/PMF - PRINT EXPENDITURE LIST BY PATIENT/COMMUNITY ;   [ 10/16/2001   8:16 AM ]
 ;;3.1;CONTRACT HEALTH MGMT SYSTEM;;JUN 11, 2001
 ;
 ;
 S $P(^TMP("ACHSC6",$J,0),U,1,2)="^ACHSC6P"
 I $D(ACHSQIO) F  S IOP=ACHSQIO D ^%ZIS Q:'POP  H 30
 K ^TMP("ACHSC6",$J,0,"ACHSQIO")
 S ACHSLOC=$$LOC^ACHS
 S ACHSTY="CHS EXPENDITURE REPORT BY "_$S(ACHSRPT=2:"COMMUNITY",ACHSRPT=5:"TRIBE",1:"PATIENT")
 D CITYST
 S ACHST1=$$FMTE^XLFDT(ACHSBDT)_" Thru "_$$FMTE^XLFDT(ACHSEDT)
 I '$D(ACHSTIME) D NOW^ACHS
 U IO
 D COMP
 D BM^ACHSFU
Z ;
 S ACHSPG=0
 D HDR
 D HDR2:ACHSRPT'=4
 S (ACHSPTCT,ACHSTN43,ACHSESDA("T43"),ACHSTN57,ACHSTOA,ACHSTN64,ACHSESDA("T64"))=0
 S (ACHST64("$"),ACHST57("$"),ACHST43("$"),ACHSGTOT("$"),ACHST3P("$"))=0
 S ACHSNAME=""
A1 ;
 S ACHSNAME=$O(^TMP("ACHSC6",$J,"P",ACHSNAME))
 G A2:ACHSNAME=""
 S ACHSPTCT=ACHSPTCT+1
 S (DFN,ACHSCOMN,ACHSN43,ACHSN64,ACHSESDA(43),ACHSESDA(64))=""
 S (ACHST43,ACHST64,ACHSN57,ACHST57,ACHST573,ACHST643,ACHST433)=""
 I $D(^TMP("ACHSC6",$J,"P",ACHSNAME,43)) D
 .S X=$G(^TMP("ACHSC6",$J,"P",ACHSNAME,43))
 .S DFN=$P(X,U)
 .S ACHSCOMN=$P(X,U,2)
 .S ACHSN43=$P(X,U,3)
 .S ACHSESDA(43)=$P(X,U,4)
 .S ACHST43=$P(X,U,5)
 .S ACHST433=$P(X,U,6)
 ;
 I $D(^TMP("ACHSC6",$J,"P",ACHSNAME,64)) D
 .S X=$G(^TMP("ACHSC6",$J,"P",ACHSNAME,64))
 .S DFN=$P(X,U)
 .S ACHSCOMN=$P(X,U,2)
 .S ACHSN64=$P(X,U,3)
 .S ACHSESDA(64)=$P(X,U,4)
 .S ACHST64=$P(X,U,5)
 .S ACHST643=$P(X,U,6)
 ;
 I $D(^TMP("ACHSC6",$J,"P",ACHSNAME,57)) D
 .S X=$G(^TMP("ACHSC6",$J,"P",ACHSNAME,57))
 .S DFN=$P(X,U)
 .S ACHSCOMN=$P(X,U,2)
 .S ACHSN57=$P(X,U,3)
 .S ACHST57=$P(X,U,5)
 .S ACHST573=$P(X,U,6)
 ;
 S ACHSTT3P=ACHST573+ACHST433+ACHST643
 S ACHSTOA=ACHST43+ACHST64+ACHST57+ACHSTT3P
 ;
 I ACHSRPT=1 S ACHSDOB="" I DFN S ACHSDOB=$P($G(^DPT(DFN,0)),U,3),ACHSDOB=$E(ACHSDOB,4,5)_"-"_$E(ACHSDOB,6,7)_"-"_($E(ACHSDOB,1,3)+1700)
WRITE ;
 G:ACHSRPT=4 RPT4
 I $Y>ACHSBM D RTRN^ACHS G A2:$G(ACHSQUIT) D HDR,HDR2
 W !,$E(ACHSNAME_$J("",32),1,32),$J($FN(+ACHSN43,",",0),7),$J($FN(+ACHSESDA(43),",",0),8),$J($FN(ACHST43,",",2),12)
 W $J($FN(+ACHSN64,",",0),7),$J($FN(+ACHSESDA(64),",",0),9),$J($FN(ACHST64,",",2),12),$J($FN(+ACHSN57,",",0),7)
 W $J($FN(ACHST57,",",2),12),$J($FN(ACHSTT3P,",",2),12),$J($FN(ACHSTOA,",",2),14)
 W:ACHSRPT=1 !,ACHSDOB,"  ",ACHSCOMN
RPT4 ;
 S ACHSTN43=ACHSTN43+ACHSN43
 S ACHSTN64=ACHSTN64+ACHSN64
 S ACHSESDA("T43")=ACHSESDA("T43")+ACHSESDA(43)
 S ACHSESDA("T64")=ACHSESDA("T64")+ACHSESDA(64)
 S ACHST43("$")=ACHST43("$")+ACHST43
 S ACHST64("$")=ACHST64("$")+ACHST64
 S ACHST57("$")=ACHST57("$")+ACHST57
 S ACHSTN57=ACHSTN57+ACHSN57
 S ACHSGTOT("$")=ACHSGTOT("$")+ACHSTOA
 S ACHST3P("$")=ACHST3P("$")+ACHSTT3P
 G A1
 ;
A2 ;
 I ACHSRPT'=4 D TOTAL^ACHSC6P2,RTRN^ACHS,HDR
 D TOT^ACHSC6P2,RTRN^ACHS
 W:$D(ACHS("PRINT",10)) @(ACHS("PRINT",10))
 W @IOF
 D ^%ZISC
 G KILL^ACHSC6P2
 ;
HDR ;
 S ACHSPG=ACHSPG+1
 W @IOF,!!
 I ACHSRPT'=4 W $$REPEAT^XLFSTR("*",132)
 I ACHSRPT'=4 W !,$$C^XBFUNC(ACHSLOC,132),!,ACHSTIME,?132-$L(ACHSTY)/2,ACHSTY,?122,"Page:",$J(ACHSPG,4),!,$$C^XBFUNC(ACHSCITY,132),!,$$C^XBFUNC(ACHST1,132),!,$$REPEAT^XLFSTR("*",132)
 W !!,$S(ACHSRPT1=1:"Inpatient",ACHSRPT1=3:"Outpatient",ACHSRPT1=2:"Dental",1:"All") W " Expenditures for ",ACHSLOC," for Paid",!,"Authorizations issued Between ",ACHST1
 Q
 ;
HDR2 ;
 W !!,$S(ACHSRPT=2:"Community",ACHSRPT=5:"Tribe",1:"Patient"),?36,"#",?43,"# 43",?52,"Total",?63,"#",?71,"# 64 ",?82,"Total",?91,"#",?98,"Total",?112,"Total",?125,"Total",!
 W:ACHSRPT=1 "Dob    Community"
 W ?35,"43's",?43,"Days",?52,"43 Dol",?62,"64's",?72,"Wkl",?82,"64 Dol",?90,"57's",?99,"57 Dol",?110,"3rd Party",?126,"Dol",!,$$REPEAT^XLFSTR("=",132)
 Q
 ;
COMP ;EP. Compressed print for printer.
 I $D(ACHSIO),ACHSIO=IO S X=132 X ^%ZOSF("RM")
 K ACHS("PRINT")
 S:$D(^%ZIS(2,IOST(0),12.1)) ACHS("PRINT",16)=$G(^%ZIS(2,IOST(0),12.1)) ; Code for compressed print.
 I $P($G(^%ZIS(2,IOST(0),5)),U)'="" S ACHS("PRINT",10)=$P($G(^%ZIS(2,IOST(0),5)),U) ; Code for standard print.
 I $D(ACHS("PRINT",16)),$D(ACHS("PRINT",10)) S IOP=IO_";132" U IO W @ACHS("PRINT",16) ; Set for compressed print.
 Q
 ;
CITYST ;EP.
 S ACHSCITY=""
 I $D(^AUTTLOC(DUZ(2),0)) S ACHSCITY=$P($G(^AUTTLOC(DUZ(2),0)),U,13)_", "_$P($G(^DIC(5,+$P($G(^AUTTLOC(DUZ(2),0)),U,14),0)),U) Q
 I $D(^DIC(4,DUZ(2),1))#2 S ACHSCITY=$P($G(^DIC(4,DUZ(2),1)),U,3)_", "_$P($G(^DIC(5,+$P($G(^DIC(4,DUZ(2),0)),U,2),0)),U)
 Q
 ;