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

ACHSUSC.m

Go to the documentation of this file.
ACHSUSC ; IHS/ITSC/PMF - DISPLAY DOCUMENT CANCEL/SUPPLEMENTAL INFO ;   [ 10/31/2003  12:13 PM ]
 ;;3.1;CONTRACT HEALTH MGMT SYSTEM;**6,17**;JUNE 11, 2001
 ;3.1*6 6/13/03 IHS/SET/FCJ 3RD PARTY NOT PRINTING
 ;
 I '$D(ACHSVIEW),$D(^ACHS(9,DUZ(2),"FY",ACHSCFY,"W",+ACHSFYWK(DUZ(2),ACHSCFY),0)),$P(^(0),U,2)=DT W !!,*7,"  The Register Has Been CLOSED." H 3 G END
A0 ;
 D ^ACHSUD                              ;SELECT DOCUMENT
 I $D(DUOUT)!$D(DTOUT)!'$D(ACHSDIEN) D END Q
 S ACHSTIEN=1
 K ACHSSIG
 D INIT^ACHSRP2                       ;INITIALIZE VARS  
 D ^ACHSAV                            ;INIT VARS, OPTS
 ;
A0A ;EP.
 S (S,C,A,A("DT"),ACHSIPP3,ACHSZC,ACHSZA,ACHSZA1,B)=""
 ;
 ;GET 'IHS PAYMENT AMOUNT' FROM INITIAL TRANSACTION
 S ACHSPAYA=$P($G(^ACHSF(DUZ(2),"D",ACHSDIEN,"T",1,0)),U,4)  ;'IHS PAYMENT AMOUNT'
 ;
A1 ;
 S (ACHSTR0,ACHSTTYP)=ACHSNOTF
 S ACHSTRAN=1   ;SKIP FIRST TRANSACTION ;ASSUME ITS INITIAL ?????
 F  S ACHSTRAN=$O(^ACHSF(DUZ(2),"D",ACHSDIEN,"T",ACHSTRAN)) Q:+ACHSTRAN=0  D
 .S ACHSTR0=$G(^ACHSF(DUZ(2),"D",ACHSDIEN,"T",ACHSTRAN,0))  ;TRAN 0 NODE
 .S ACHSTTYP=$P(ACHSTR0,U,2)           ;TRANSACTION TYPE
 .;
 .;ADD UP SUPP. 'IHS PAYMENT AMOUNTS' AND GET 'TRANSACTION DATES' 
 .I ACHSTTYP="S" S S=S+1 S A=A+$P(ACHSTR0,U,4) S A("DT")=A("DT")_" "_$E($P(ACHSTR0,U),4,5)_"-"_$E($P(ACHSTR0,U),6,7)_"-"_$E($P(ACHSTR0,U),2,3) Q
 .;
 .;ADD UP CANCEL 'IHS PAYMENT AMOUNTS'
 .I ACHSTTYP="C" S C=C+1 S B=B+$P(ACHSTR0,U,4) Q
 .;
 .;ADD UP ADJUSTMENT 'IHS PAYMENT AMOUNTS'
 .;ACHS*3.1*6 6/13/03 IHS/SET/FCJ 3RD PARTY NOT PRINTING
 .I ACHSTTYP="ZA" S ACHSZC=ACHSZC+1 S ACHSZA=ACHSZA+$P(ACHSTR0,U,4) S ACHSZA1=ACHSZA1+$P(ACHSTR0,U,8) Q  ;ACHS*3.1*6 6/13/03
 .;I ACHSTTYP="ZA" S ACHSZC=ACHSZC+1 S ACHSZA=ACHSZA+$P(ACHSTR0,U,4) S ACHSZA1=$P(^ACHSF(DUZ(2),"D",ACHSDIEN,"ZA"),U,4) Q  ;ACHS*3.1*6 6/13/03
 .I ACHSTTYP="IP" S ACHSIPP3=ACHSIPP3+$P(ACHSTR0,U,8) Q
 .;
 ;
B1 ;WRITE TOTALS FOUND ABOVE
 W !?4,"Initial Obligation",?30,$J(ACHSPAYA,8,2)
 ;
 W !?4,"Amount Canceled:",?30,$J("-"_B,8,2),?40,"(",C," Item",$S(C=1:"",1:"s"),")"
 W !?4,"Amount Of Supplements",?30,$J("+"_A,8,2),?40,"(",A("DT")," )"
 ;
B2 ;
 S ACHSBAL=$P($G(^ACHSF(DUZ(2),"D",ACHSDIEN,0)),U,9)
 W !?30,"--------",!,"CURRENT OBLIGATION BALANCE",?30,$J(ACHSBAL,8,2)
 ;
 ;IF WHAT?????
 ;I (C+ACHSZC+ACHSIPP3)
 ;!($D(^ACHSF(DUZ(2),"D",ACHSDIEN,"IP")))
 ;!($D(^ACHSF(DUZ(2),"D",ACHSDIEN,"PA")))
 W ?46,"(IHS)",?52,"(3rd PARTY)"
 ;
 ;IF WE HAVE AND ENTRY IN THE INTERIM PAYMENT NODE
 I $D(^ACHSF(DUZ(2),"D",ACHSDIEN,"IP")) D
 .S ACHSIPP=$P(^ACHSF(DUZ(2),"D",ACHSDIEN,"IP"),U) ;'INTERIM PAYMENT TOTAL'
 .S ACHSIPN=$P(^ACHSF(DUZ(2),"D",ACHSDIEN,"IP"),U,2) ;# OF INTERIM PAYMENTS
 .S ACHSIPDT=$P(^ACHSF(DUZ(2),"D",ACHSDIEN,"IP"),U,3) ;LAST INTERIM PAYMENT DATE
 .S ACHSIPDT=$E(ACHSIPDT,4,5)_"/"_$E(ACHSIPDT,6,7)_"/"_$E(ACHSIPDT,2,3)
 ;
 ;IF WE HAVE AN ENTRY IN THE PAYMENT NODE
 I $D(^ACHSF(DUZ(2),"D",ACHSDIEN,"PA")),$D(ACHSIPP) W !?5,$S(ACHSIPN<2:" ",1:""),ACHSIPN W " Interim Payment",$S(ACHSIPN<2:"",1:"s") W " for a Total of:",$$FMT(ACHSIPP),$$FMT(ACHSIPP3) G B2A
 ;
 ;
 I $D(^ACHSF(DUZ(2),"D",ACHSDIEN,"IP")),$D(ACHSIPP) W !?5,$S(ACHSIPN<2:" ",1:""),ACHSIPN," Interim Payment",$S(ACHSIPN<2:"",1:"s")," for a Total of:",$$FMT(ACHSIPP),$$FMT(ACHSIPP3),", as of ",ACHSIPDT
 ;
B2A ;
 G BC:+$P(ACHSDOC0,U,12)=4 ;'STATUS' = CANCELED
 ;
 ;GO THROUGH THE TRANSACTIONS AGAIN AND GET PAYMENTS
 S R=0,X=""
 ;
B3 ;
 S R=$O(^ACHSF(DUZ(2),"D",ACHSDIEN,"T",R)) G B4:R="" I '$D(^(R,0)) G B4
 S X=$P(^ACHSF(DUZ(2),"D",ACHSDIEN,"T",R,0),U,2)
 I X'="P" G B3
B4 ;
 I X'="P" K ACHSIPP,ACHSIPN,ACHSIPDT D END Q
 G B5:'$D(^ACHSF(DUZ(2),"D",ACHSDIEN,"ZA"))
 I ACHSZC W !?17,"Amount of Adjustments:",$$FMT(ACHSZA),$$FMT(ACHSZA1)," (",ACHSZC," Item",$S(ACHSZC=1:"",1:"s"),")"
B5 ;
 S Y=$$DOC^ACHS("PA",3),ACHS(1)=$$DOC^ACHS("PA",6),ACHS(2)=$$DOC^ACHS("PA",5)
 W !?9,"FINAL PAYMENT ON ",$$FMTE^XLFDT(Y),":",$$FMT(ACHS(1)),$$FMT(ACHS(2))
 I $$PARM^ACHS(0,8)="Y",$L($$DOC^ACHS(2,2)) W !?31,"CHECK #:",$J($$DOC^ACHS(2,2),12)
 ;ACHS*3.1*17 2/1/2010 OIT.IHS.FCJ ADDED NXT LINE TO PRINT THE PRINT DATE OF CHECK
 I $$PARM^ACHS(0,8)="Y",$L($$DOC^ACHS(2,3)) S Y=$$DOC^ACHS(2,3) W !?9,"DATE CHECK WAS ISSUED: ",$$FMTE^XLFDT(Y)
 S ACHSDOCT=$$DOC^ACHS("PA",1)    ;'TOTAL PAYMENT AMOUNT'
 I $D(^ACHSF(DUZ(2),"D",ACHSDIEN,"ZA")) S ACHSDOCT=$P(^("ZA"),U)
 W !?24,"TOTAL PAYMENTS:",$$FMT(ACHSDOCT),$$FMT(ACHS(2)+ACHSZA1+ACHSIPP3)
 K X2,X3
 G:'$D(^ACHSF(DUZ(2),"D",ACHSDIEN,"PA")) C1
 I +ACHSZC=0,$$DOC^ACHS("PA",4)="I" G C1
 G ENDA:'$D(ACHSADJ),END
 ;
BC ;
 S X="",R=0
BC5 ;
 S R=$O(^ACHSF(DUZ(2),"D",ACHSDIEN,"T",R)) G BC6:R="",BC6:'$D(^(R,0)) S X=$P(^(0),U,2)
 I X'="C" G BC5
BC6 ;
 I X'="C" G ENDA
 W *7,!!,"DOCUMENT CANCELLED ON  ",$$FMTE^XLFDT($P(^ACHSF(DUZ(2),"D",ACHSDIEN,"T",R,0),U)),", Reason: ",$$EXTSET^XBFUNC(9002080.01,63,$$DOC^ACHS(2,8))
 G ENDA
 ;
C1 ;
 Q:$D(ACHSVIEW)
 W:$Y<20 !
 I $$DIR^XBDIR("Y","Is This The Correct Document","YES","","","",1)
 G END:$D(DTOUT),ENDA:$D(DUOUT)
ENDA ;
 K ACHSIPP,ACHSIPN,ACHSIPD
 Q:$D(ACHSDVEW)
 G A0
 ;
END ;
 K ACHSZA,ACHSZC
 Q
 ;
FMT(X) ;
 Q $J("",12-$L($FN(X,",",2)))_$FN(X,",",2)