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

ACHSDSU.m

Go to the documentation of this file.
ACHSDSU ; IHS/ITSC/PMF - DOCUMENT SUMMARY REPORT ;    [ 10/16/2001   8:16 AM ]
 ;;3.1;CONTRACT HEALTH MGMT SYSTEM;;JUN 11, 2001
 ;
TITLE ;;CHS DOCUMENT SUMMARY
 ;
BDT ;
 S ACHSBDT=$$DATE^ACHS("B",$P($T(TITLE),";",3))
 I $D(DTOUT)!$D(DUOUT)!(ACHSBDT<1) D K Q
EDT ;
 S ACHSEDT=$$DATE^ACHS("E",$P($T(TITLE),";",3))
 I $D(DTOUT)!(ACHSEDT<1) D K Q
 G BDT:$D(DUOUT)
 G:$$EBB^ACHS(ACHSBDT,ACHSEDT) BDT
 S ACHSIO=IO
DEV ;
 S %=$$PB^ACHS
 I %=U!$D(DTOUT)!$D(DUOUT) D K Q
 I %="B" D VIEWR^XBLM("START^ACHSDSU"),EN^XBVK("VALM"),K Q
 S %ZIS="OPQ"
 D ^%ZIS
 I POP D HOME^%ZIS G K
 G:'$D(IO("Q")) START
 K IO("Q")
 I $D(IO("S"))!($E(IOST)'="P") W *7,!,"Please queue to system printers." D ^%ZISC G DEV
 S ZTRTN="START^ACHSDSU",ZTIO="",ZTDESC=$P($T(TITLE),";",3)_", "_$$FMTE^XLFDT(ACHSBDT)_" to "_$$FMTE^XLFDT(ACHSEDT)_".",ACHSQIO=ION_";"_IOST_";"_IOM_";"_IOSL
 F ACHS="ACHSQIO","ACHSBDT","ACHSEDT" S ZTSAVE(ACHS)=""
 D ^%ZTLOAD
 G:'$D(ZTSK) DEV
K ;
 D ^%ZISC
 K DTOUT,DUOUT,ZTIO,ZTSK
 D EN^XBVK("ACHS"),^ACHSVAR
 Q
 ;
START ;EP - TaskMan.
 K ^TMP($J,"ACHSDSU")
 S ACHSCHS=""
 D ^ACHSUF
 S ^TMP($J,"ACHSDSU","TRAN")=0,^TMP($J,"ACHSDSU","TOTAL")=0,ACHSTRDT=ACHSBDT-1,ACHSTY=""
A1 ;
 S ACHSTRDT=$O(^ACHSF(DUZ(2),"TB",ACHSTRDT))
 I ACHSTRDT>ACHSEDT D END Q
 I ACHSTRDT="" D END Q
 S ACHSACT=""
A2 ;
 S ACHSACT=$O(^ACHSF(DUZ(2),"TB",ACHSTRDT,ACHSACT))
 G A1:ACHSACT=""
 S ACHSDIEN=""
A3 ;
 S ACHSDIEN=$O(^ACHSF(DUZ(2),"TB",ACHSTRDT,ACHSACT,ACHSDIEN))
 G A2:ACHSDIEN=""
 G A3:'$D(^ACHSF(DUZ(2),"D",ACHSDIEN,0))
 S ACHSDOCR=$G(^ACHSF(DUZ(2),"D",ACHSDIEN,0)),ACHSACN=""
 S N=$P(ACHSDOCR,U,6),O=$P(ACHSDOCR,U,7),ACHSDEST=$S($P(ACHSDOCR,U,17)="I":"IHS",$P(ACHSDOCR,U,17)="":"IHS",1:"FISCAL AGENT")
 K ACHSBLKF
 I $D(^ACHSF(DUZ(2),"D",ACHSDIEN,"BT")) S ACHSBLKF=""
 S R=$P(ACHSDOCR,U,19),ACHSADS=ACHSTRDT_U_$P(ACHSDIEN,U)_U_R_U_$P(ACHSDOCR,U,8)_U
 S ACHSX=$P(ACHSDOCR,U,14)
 D FYCVT^ACHSFU
 S ACHSACFY=ACHSY
A4 ;
 S ACHSACN=$O(^ACHSF(DUZ(2),"TB",ACHSTRDT,ACHSACT,ACHSDIEN,ACHSACN))
 G A3:ACHSACN=""
 G A4:'$D(^ACHSF(DUZ(2),"D",ACHSDIEN,"T",ACHSACN,0))
 S ACHSTRAN=$G(^ACHSF(DUZ(2),"D",ACHSDIEN,"T",ACHSACN,0))
 S:$D(^ACHSF(DUZ(2),"D",ACHSDIEN,0)) ACHSACD=$P($G(^ACHSF(DUZ(2),"D",ACHSDIEN,0)),U)
 S ACHSSET=0,X=$P(ACHSTRAN,U,2),DFN=$P(ACHSTRAN,U,3),Y=$P(ACHSTRAN,U,5),A=$P(ACHSTRAN,U,4),T=X,O=A
 I X="C"&(Y="P") S T="D"
 I T'="P" S A=0 G A5
 G A6:'$D(^ACHSF(DUZ(2),"D",ACHSDIEN,"PA")) S O=$G(^ACHSF(DUZ(2),"D",ACHSDIEN,"PA")),A=$P(O,U),O=$P(O,U,2)
 I 'O G A6
A5 ;
 S ACHSTS=DFN_U_T_U_O_U_A_U_$P(ACHSTRAN,U,10),ACHSSET=1
A6 ;
 I ACHSSET S ^TMP($J,"ACHSDSU",ACHSACFY,ACHSACD,ACHSDIEN,ACHSACN)=ACHSADS_ACHSTS,ACHSTY=ACHSACT S:ACHSTY="C" O="-"_O
 I ACHSSET S ^TMP($J,"ACHSDSU","TRAN")=$G(^TMP($J,"ACHSDSU","TRAN"))+1,^TMP($J,"ACHSDSU","TOTAL")=$G(^TMP($J,"ACHSDSU","TOTAL"))+O
 ;
 ;WHY IS "ZA" TYPE IGNORED?????
 S ACHSTY=$S(ACHSTY="I":"INITIAL",ACHSTY="P":"PAYMENT",ACHSTY="S":"SUPPLEMENTAL",ACHSTY="IP":"INTERIM PAYMENT",1:"CANCEL")
 ;
 I ACHSSET,$D(ACHSTY) S:'$D(^TMP($J,"ACHSDSU",ACHSTY)) ^TMP($J,"ACHSDSU",ACHSTY)=0 S X=$G(^TMP($J,"ACHSDSU",ACHSTY)),$P(X,U)=$P(X,U)+1,$P(X,U,2)=$P(X,U,2)+O,^TMP($J,"ACHSDSU",ACHSTY)=X
 S:'$D(^TMP($J,"ACHSDSU",ACHSDEST)) ^TMP($J,"ACHSDSU",ACHSDEST)=0
 S ^TMP($J,"ACHSDSU",ACHSDEST)=$G(^TMP($J,"ACHSDSU",ACHSDEST))+1
 G A4
 ;
END ; Kill routine vars, print.
 K ACHSDEST,ACHSDOCR,ACHSTRAN,ACHSTRDT,ACHSTS,ACHSX,ACHSY
 D BRPT^ACHSFU                 ;
 S (ACHSACFY,ACHSPG)=0,ACHS=""
 D ^ACHSUF                     ;CHECK DATA INTEGRITY   HE,HE,HE
 S ACHSLOC=$$C^XBFUNC($$LOC^ACHS,80),ACHST1=$$C^XBFUNC($$FMTE^XLFDT(ACHSBDT)_" Thru "_$$FMTE^XLFDT(ACHSEDT))
 K ACHSSUM
 F ACHS=1:1:7 S ACHSSUM(ACHS)=""
 S ACHSACFY=0
 U IO
FY ;
 S ACHSACFY=$O(^TMP($J,"ACHSDSU",ACHSACFY))
 I ACHSACFY<1 D HDR,SUM,RGSTRS G KILL
 D HDR,HDR1^ACHSODP
 S ACHSACD="",ACHSDIEN=0,ACHSDPFX=$E(ACHSACFY,4)_"-"_ACHSFC_"-"
CODE ;
 S ACHSACD=$O(^TMP($J,"ACHSDSU",ACHSACFY,ACHSACD))
 I ACHSACD="" D RTRN^ACHS G KILL:$D(DUOUT)!$D(DTOUT),FY
 S ACHSDIEN=0
DOC ;
 S ACHSDIEN=$O(^TMP($J,"ACHSDSU",ACHSACFY,ACHSACD,ACHSDIEN))
 G CODE:ACHSDIEN<1
 S ACHSTN=0
TRANS ;
 S ACHSTN=$O(^TMP($J,"ACHSDSU",ACHSACFY,ACHSACD,ACHSDIEN,ACHSTN)) G DOC:ACHSTN<1 S ACHSACS=$G(^TMP($J,"ACHSDSU",ACHSACFY,ACHSACD,ACHSDIEN,ACHSTN))
 I $Y>ACHSBM D RTRN^ACHS G KILL:$D(DUOUT)!$D(DTOUT) D HDR,HDR1^ACHSODP
 D ^ACHSODP1
 G TRANS
 ;
KILL ;
 W @IOF
 K ZTSK
 D ERPT^ACHS
 K B,C,DFN,L,N,O,S,T
 D EN^XBVK("ACHS"),^ACHSVAR:'$D(ZTQUEUED)
 Q
 ;
HDR ;
 S ACHSPG=ACHSPG+1
 W @IOF,!,ACHSLOC,!?26,"CHS DOCUMENT SUMMARY REPORT",?71,"Page",$J(ACHSPG,4),!,ACHSTIME,!,ACHST1,!!
 Q
 ;
SUM ;
 D HDR2^ACHSODP
 S ACHSCT=0,X2="2$",X3=15
 F ACHSTYPE="INITIAL","SUPPLEMENTAL","CANCEL","PAYMENT","INTERIM PAYMENT" D
 . W !?5,ACHSTYPE," DOCUMENTS"
 . I $D(^TMP($J,"ACHSDSU",ACHSTYPE)) S X=$P(^(ACHSTYPE),U,2),ACHSCT=ACHSCT+X D COMMA^%DTC W ?43,$J($P(^TMP($J,"ACHSDSU",ACHSTYPE),U),6),?60,X
 .Q
 S X=ACHSCT
 D COMMA^%DTC
 W !?43,"________",?62,"_____________",!!?5,"TOTALS",?44,$J(^TMP($J,"ACHSDSU","TRAN"),5),?60,X
 W !!!?5,"FISCAL AGENT DOCUMENTS:",$S($D(^TMP($J,"ACHSDSU","FISCAL AGENT")):$J(^("FISCAL AGENT"),5),1:"    0"),!?14,"IHS DOCUMENTS:",$S($D(^TMP($J,"ACHSDSU","IHS")):$J(^("IHS"),5),1:"    0"),!
 D RTRN^ACHS
 Q
 ;
RGSTRS ;
 D HDR,SB2^ACHSODP2
 S ACHSACTN=$S($D(^ACHS(9,DUZ(2),"RN")):^("RN"),1:""),X2=2,X3=12
 F ACHS=1:1:7 S $P(ACHSSUM(ACHS),U,3)=$P(ACHSSUM(ACHS),U)-$P(ACHSSUM(ACHS),U,2)
 F ACHSX1=1:1:7 W !,$E($P(ACHSACTN,U,ACHSX1),1,20),?30 D SB1 W:ACHSX1<7 !
 W !
 D S21^ACHSODP2
 W !,"TOTAL",?30
 S X=0
 F ACHSX=1,2,3 F ACHS=1:1:7 S X=X+$P(ACHSSUM(ACHS),U,ACHSX) I ACHS=7 W $J($FN(X,",",2),12) S ACHSACTO=X,X=0
 W $J($FN(ACHSACTO,",",2),12),!!!?1,"Obligated Balance For Period: ",$J("$"_$FN(ACHSACTO,",",2),14)
 K ACHSX1,X2
 D RTRN^ACHS
 Q
 ;
SB1 ;
 F ACHSX=1,2,3,3 W $J($FN($P(ACHSSUM(ACHSX1),U,ACHSX),",",2),12)
 Q
 ;