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

ACHSDSF.m

Go to the documentation of this file.
ACHSDSF ; IHS/ITSC/PMF - DOC STATUS REPORT BY FY (1/2) - FORMAT & DEVICE ;   [ 10/16/2001   8:16 AM ]
 ;;3.1;CONTRACT HEALTH MGMT SYSTEM;;JUN 11, 2001
 ;
 S ACHSIO=IO
FYSEL ; Select fiscal year for report.      
 S ACHSFY=$$FYSEL^ACHS
 G:$D(DUOUT)!$D(DTOUT) K
 S %=$$FY^ACHSVAR($E(ACHSFY,3,4)),ACHSBDT=$P(%,U),ACHSEDT=$P(%,U,2)
 I ACHSEDT>DT S ACHSEDT=DT
TYPE ; Select type of report.
 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,FYSEL:$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^ACHSDSF"),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^ACHSDSF",ZTDESC="CHS Document Status, Type "_ACHSRPT_", "_$$FMTE^XLFDT(ACHSBDT)_" to "_$$FMTE^XLFDT(ACHSEDT),ZTIO=ION_";"_IOST_";"_IOM_";"_IOSL
 F %="ACHSBDT","ACHSEDT","ACHSFY","ACHSRPT" S ZTSAVE(%)=""
 D ^%ZTLOAD
 G:'$D(ZTSK) DEV
K ;
 D EN^XBVK("ACHS"),^ACHSVAR
 K 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,HDR
 S X3=0,ACHSDNU=1_($E(ACHSFY,4))_"00000"
A ; Main loop. Check end date.
 S ACHSDNU=$O(^ACHSF(DUZ(2),"D","B",ACHSDNU))
 G END:ACHSDNU="",END:$E(ACHSDNU,2)'=$E(ACHSFY,4)
 S ACHSDIEN=""
B ; Get IEN.
 S ACHSDIEN=$O(^ACHSF(DUZ(2),"D","B",ACHSDNU,ACHSDIEN))
 G A:ACHSDIEN=""
C ; 
 G A:'$D(^ACHSF(DUZ(2),"D",ACHSDIEN,0)) S ACHSSTS=$S($P(^(0),U,12)=3:"P",$P(^(0),U,12)=4:"C",1:"OPEN")
 I ACHSRPT=1,"PC"[ACHSSTS G B
 I ACHSRPT=2,"PC"'[ACHSSTS G B
 S ACHSDOC1=$P(^ACHSF(DUZ(2),"D",ACHSDIEN,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),ACHSDDT=$P(^(0),U,2),ACHS("$PCAN")=0
 G B:ACHSVPTR']"",B:'$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 DFN=$P(^ACHSF(DUZ(2),"D",ACHSDIEN,0),U,22)
 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")
 G B:'$D(ACHSNAME)
 S:$D(^ACHSF(DUZ(2),"D",ACHSDIEN,"PA")) ACHS("$")=+^("PA")
 S:$D(^ACHSF(DUZ(2),"D",ACHSDIEN,"ZA")) ACHS("$")=+^("ZA")
 ; I ACHSSTS="C" S ACHS("$")=0
 F ACHS=0:0 S ACHS=$O(^ACHSF(DUZ(2),"D",ACHSDIEN,"T",ACHS)) Q:+ACHS=0  D
 . S ACHSDOS=$P(^ACHSF(DUZ(2),"D",ACHSDIEN,"T",ACHS,0),U,10)
 . I $P(^ACHSF(DUZ(2),"D",ACHSDIEN,"T",ACHS,0),U,2)="C",$P(^(0),U,5)="F" S ACHS("$")=$P(^(0),U,4)
 . I $P(^ACHSF(DUZ(2),"D",ACHSDIEN,"T",ACHS,0),U,2)="C",$P(^(0),U,5)="P" S ACHS("$PCAN")=ACHS("$PCAN")+$P(^(0),U,4)
 .Q
 W $E(ACHSNAME,1,24),?25,$E(ACHSVNDR,1,26),?52,$E(ACHSDDT,4,7),$E(ACHSDDT,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 ; Open doc amt.
 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 ACHS("$PCAN") W ?64,"P-CAN" S X=$FN(ACHS("$PCAN"),",",2) W ?79-$L(X),X
 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("$")
 I ACHS("$PCAN") S ACHSCNX("$")=ACHSCNX("$")+ACHS("$PCAN")
P3 ; End of transaction.
 W !!
 I $Y>ACHSBM D RTRN^ACHS G KILL:$D(DUOUT)!$D(DTOUT) D HDR
 G B
 ;
END ; Print totals.
 W !,$$REPEAT^XLFSTR("-",80),!
 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
 I ACHSCNX W !,"NOTE: Partial Cancels are not included in count, but ARE included in $."
 D RTRN^ACHS
 W @IOF
KILL ; Do ERPT, kill vars, quit.
 D ERPT^ACHS
 K ACHSDDT,ACHSDNU,ACHSDOC,ACHSDOC1,ACHSDOC2,ACHSBLNK,ACHSCNX,ACHSDOS,ACHSTYPE,ACHSVNDR,ACHSEIN,ACHSOPEN,ACHSNAME,ACHSSTS,ACHSTOS,ACHSTOTP,ACHSVPTR,ACHSDIEN,DFN,X2,X3,ACHSFY
 Q
 ;
HDR ; Doc status rpt header.
 S ACHSPG=ACHSPG+1
 W @IOF,!,ACHSUSR,?71,"Page",$J(ACHSPG,3),!,$$C^XBFUNC("***  CONTRACT HEALTH MANAGEMENT SYSTEM  ***",80),!,ACHSLOC,!,$$C^XBFUNC("DOCUMENT STATUS REPORT, FY "_ACHSFY,80)
 I $D(ZTQUEUED),$G(ZTSK) 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("=",80),!
 Q
 ;