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

ACHSDST.m

Go to the documentation of this file.
ACHSDST ; IHS/ITSC/PMF - DOCUMENT STATUS REPORT ;   [ 10/16/2001   8:16 AM ]
 ;;3.1;CONTRACT HEALTH MGMT SYSTEM;;JUN 11, 2001
 ;
 ;
TITLE ;;DOCUMENT STATUS
 S ACHSIO=IO
 K X2,X3
BDT ;
 S ACHSBDT=$$DATE^ACHS("B",$P($T(TITLE),";",3),"ISSUE")
 G K:$D(DUOUT)!$D(DTOUT)!(ACHSBDT<1)
EDT ;
 S ACHSEDT=$$DATE^ACHS("E",$P($T(TITLE),";",3),"ISSUE")
 G K:$D(DTOUT)!(ACHSEDT<1),BDT:$D(DUOUT)
 G:$$EBB^ACHS(ACHSBDT,ACHSEDT) EDT
TYPE ;
 W !!,"Which type of report?",!!,"  1.  OPEN DOCUMENTS only",!,"  2.  CLOSED DOCUMENTS only",!,"  3.  COMBINED list",!!,"  ENTER OPTION (1-3) 3//"
 D READ^ACHSFU
 I Y="" S Y=3
 G K:$D(DTOUT),Q:Y?1"?".E,BDT:$D(DUOUT)
 I "123"[Y&(Y>0)&(Y<4) S ACHSRPT=Y G DEV
 W !!,*7,"  Enter only a 1, 2, or 3"
 G TYPE
 ;
Q ;
 W !!,"Choice 1 - only open documents will be listed.",!,"Choice 2 - only documents which have been paid or cancelled will be listed.",!,"Choice 3 - open and closed documents will be listed together."
 G TYPE
 ;
DEV ;
 S %=$$PB^ACHS
 I %=U!$D(DTOUT)!$D(DUOUT) D K Q
 I %="B" D VIEWR^XBLM("PRINT^ACHSDST"),EN^XBVK("VALM"),K Q
 S %ZIS="OPQ"
 D ^%ZIS
 I POP D HOME^%ZIS G K
 G:'$D(IO("Q")) PRINT
 K IO("Q")
 I $D(IO("S"))!($E(IOST)'="P") W *7,!,"Please queue to system printers." D ^%ZISC G DEV
 S ZTRTN="PRINT^ACHSDST",ZTIO="",ZTDESC=$P($T(TITLE),";",3)_", Type "_ACHSRPT_", "_$$FMTE^XLFDT(ACHSBDT)_" to "_$$FMTE^XLFDT(ACHSEDT),ACHSQIO=ION_";"_IOST_";"_IOM_";"_IOSL
 F ACHS="ACHSQIO","ACHSBDT","ACHSEDT","ACHSRPT" S ZTSAVE(ACHS)=""
 D ^%ZTLOAD
 G:'$D(ZTSK) DEV
K ;
 K ACHS,ACHSIO,ACHSQIO,ACHSBDT,ACHSEDT,ACHSRPT,ZTIO,ZTSK
 D ^%ZISC
 Q
 ;
PRINT ;EP - From TaskMan.
 ;
 D FC^ACHSUF
 I $D(ACHSERR),ACHSERR=1 K ZTSK G KILL
 S (ACHSTOTP,ACHSCNX,ACHSOPEN,ACHSTOTP("$"),ACHSCNX("$"),ACHSOPEN("$"))=0
 S ACHST1=$$C^XBFUNC($S(ACHSRPT=1:"OPEN DOCUMENTS",ACHSRPT=2:"CLOSED DOCUMENTS",1:"OPEN AND CLOSED DOCUMENTS"),80),ACHST2=$$C^XBFUNC("For the period "_$$FMTE^XLFDT(ACHSBDT)_" through "_$$FMTE^XLFDT(ACHSEDT),80)
 D BRPT^ACHSFU
 D HDR
 S X3=0,ACHSBDT=ACHSBDT-1
A ; Main loop.
 S ACHSBDT=$O(^ACHSF(DUZ(2),"TB",ACHSBDT))
 G END:+ACHSBDT=0!(+ACHSBDT>ACHSEDT)
 S ACHSTYPE=""
B ;
 S ACHSTYPE=$O(^ACHSF(DUZ(2),"TB",ACHSBDT,ACHSTYPE))
 G A:ACHSTYPE="",B:ACHSTYPE'="I"
 S DA=0
C ;
 S DA=$O(^ACHSF(DUZ(2),"TB",ACHSBDT,ACHSTYPE,DA))
 G A:+DA=0,A:'$D(^ACHSF(DUZ(2),"D",DA,0)) S ACHSSTS=$S($P(^(0),U,12)=3:"P",$P(^(0),U,12)=4:"C",1:"OPEN")
 I ACHSRPT=1,"PC"[ACHSSTS G C
 I ACHSRPT=2,"PC"'[ACHSSTS G C
 S ACHSDOC1=$P(^ACHSF(DUZ(2),"D",DA,0),U),ACHSVPTR=$P(^(0),U,8),ACHSDOC2=$P(^(0),U,14),ACHS("$")=$P(^(0),U,9),ACHSTOS=$P(^(0),U,4),ACHSBLNK=+$P(^(0),U,3)
 G A:ACHSVPTR']"",A:'$D(^AUTTVNDR(ACHSVPTR,0)) S ACHSVNDR=$P(^(0),U) S ACHSEIN="" S:$D(^(11)) ACHSEIN=$P(^(11),U)_" "_$P(^(11),U,2)
 S ACHSDOC=ACHSDOC2_"-"_ACHSFC_"-"_ACHSDOC1
 K ACHSNAME
 S ACHS=$O(^ACHSF(DUZ(2),"TB",ACHSBDT,ACHSTYPE,DA,0))
 I +ACHS>0,$D(^ACHSF(DUZ(2),"D",DA,"T",ACHS,0)) S DFN=$P(^(0),U,3) I +DFN>0,$D(^DPT(DFN,0)) S ACHSNAME=$P(^(0),U)
 I '$D(ACHSNAME),ACHSBLNK S ACHSNAME=$S(ACHSBLNK=1:"* BLANKET",1:"* SPECIAL TRANS")
D ;
 G C:'$D(ACHSNAME)
 S:$D(^ACHSF(DUZ(2),"D",DA,"PA")) ACHS("$")=+^("PA")
 S:$D(^ACHSF(DUZ(2),"D",DA,"ZA")) ACHS("$")=+^("ZA")
E ; 
 I ACHSSTS="C" S ACHS("$")=0 F ACHS=0:0 S ACHS=$O(^ACHSF(DUZ(2),"D",DA,"T",ACHS)) Q:+ACHS=0  S ACHS("$")=+$P(^(ACHS,0),U,4)
 S ACHSDOS=""
 I $O(^ACHSF(DUZ(2),"TB",ACHSBDT,"P",DA,0)) S ACHSDOS=$P(^ACHSF(DUZ(2),"D",DA,"T",$O(^ACHSF(DUZ(2),"TB",ACHSBDT,"P",DA,0)),0),U,10)
 W $E(ACHSNAME,1,24),?25,$E(ACHSVNDR,1,26),?52,$E(ACHSBDT,4,7),$E(ACHSBDT,2,3)
 W:ACHSDOS]"" "/",$E(ACHSDOS,4,7)
 W ?64
 G P1:"PC"'[ACHSSTS
 W $S(ACHSSTS="P":"PAID",1:"CANCEL")
 S X=ACHS("$")
 D COMMA^%DTC
 W ?80-$L(X),X
 G P2
 ;
P1 ;
 I +ACHS("$")'=0 S X=ACHS("$") D COMMA^%DTC W ?80-$L(X),X
P2 ;
 W !,ACHSDOC,?25,ACHSEIN,?52,$S(ACHSTOS=1:"HOSPITAL",ACHSTOS=2:"DENTAL",ACHSTOS=3:"OUTPATIENT",1:"")
 I ACHSSTS="P" S ACHSTOTP=ACHSTOTP+1,ACHSTOTP("$")=ACHSTOTP("$")+ACHS("$") G P3
 I ACHSSTS="C" S ACHSCNX=ACHSCNX+1,ACHSCNX("$")=ACHSCNX("$")+ACHS("$") G P3
 S ACHSOPEN=ACHSOPEN+1,ACHSOPEN("$")=ACHSOPEN("$")+ACHS("$")
P3 ; Ask RTRN if EOP, do header, go main loop.
 W !!
 I $Y>ACHSBM D RTRN^ACHS G KILL:$D(DUOUT)!$D(DTOUT) D HDR
 G C
 ;
END ; Print totals, ask RTRN, write IOF.
 W !,$$REPEAT^XLFSTR("-",79),!
 S X2="2$",X3=14
 I ACHSTOTP S X=ACHSTOTP("$") D COMMA^%DTC W "TOTAL PAID DOCUMENTS:",$J(ACHSTOTP,11),?40,"TOTAL DOLLARS PAID:       ",X,!
 I ACHSCNX S X=ACHSCNX("$") D COMMA^%DTC W "TOTAL CANCELLED DOCUMENTS:",$J(ACHSCNX,6),?40,"TOTAL DOLLARS CANCELLED:  ",X,!
 I ACHSOPEN S X=ACHSOPEN("$") D COMMA^%DTC W "TOTAL OPEN DOCUMENTS:",$J(ACHSOPEN,11),?40,"TOTAL DOLLARS OPEN:       ",X
 D RTRN^ACHS
 W @IOF
KILL ; Do ERPT, kill vars, quit.
 I $D(ZTQUEUED) K ACHSFC
 D ERPT^ACHS
 K ACHSDOC,ACHSDOC1,ACHSDOC2,ACHSBLNK,ACHSCNX,ACHSDOS,ACHSTYPE,ACHSVNDR,ACHSEIN,ACHSOPEN,ACHSNAME,ACHSSTS,ACHSTOS,ACHSTOTP,ACHSVPTR
 K DA,DFN,X2,X3
 Q
 ;
HDR ; Print report header.
 S ACHSPG=ACHSPG+1
 W @IOF,!!,ACHSUSR,?71,"Page",$J(ACHSPG,3),!,$$C^XBFUNC("***  CONTRACT HEALTH MANAGEMENT SYSTEM  ***",80),!!,ACHSLOC,!?29,"DOCUMENT STATUS REPORT"
 I $D(ZTQUEUED) W ?77-$L(ZTSK),"(",ZTSK,")"
 W !,ACHSTIME,!,ACHST1,!,ACHST2,!!,"Patient Name",?25,"Provider of Service",?52,"Issue /DOS",!,"Document number",?25,"EIN Number",?52,"Type",?64,"Status",?73,"Amount",!,$$REPEAT^XLFSTR("=",79),!
 Q
 ;