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

ACHSCHF.m

Go to the documentation of this file.
ACHSCHF ; IHS/ITSC/TPF/PMF - C H E F REIMBURSEMENT SEARCHES ;   
 ;;3.1;CONTRACT HEALTH MGMT SYSTEM;**15,16**;JUN 11, 2001
 ;ACHS*3.1*15 12.15.2009 IHS/OIT/FCJ ADDED COMMENTS RE-ARRANGED PRINT AND ADDED TOTALS
 ;ACHS*3.1*16 11.09.2009 IHS.OIT.FCJ CHANGES FOR BLANKET PRINTING AND AMENDMENT TOTALS
 ;
 S ACHSIO=IO,ACHSTODA=+$$PARM^ACHS(2,27)
TODA ; Input total obl/disbursement amt.
 S Y(1)="   CHEF reimbursement requests will be printed for patients whose obligation",Y="   OR paid amounts exceeds this amount."
 S ACHSTODA=$$DIR^XBDIR("N","Enter TOTAL OBLIGATION/DISBURSEMENT AMOUNT on which to report",ACHSTODA,"",.Y,"",2)
 G:$D(DUOUT)!$D(DTOUT) K
 W !?5,"$",$FN(ACHSTODA,",",2)
BDT ; Input begin date.
 S ACHSBDT=$$DATE^ACHS("B","CHEF by Date of Service")
 G TODA:$D(DUOUT),K:$D(DTOUT)!(ACHSBDT<1)
EDT ; Input End date.
 S ACHSEDT=$$DATE^ACHS("E","CHEF by Date of Service")
 G K:$D(DTOUT)!(ACHSEDT<1),BDT:$D(DUOUT),BDT:$$EBB^ACHS(ACHSBDT,ACHSEDT)
B ; Input type of service.
 W !!,"TYPE of service:"
 S ACHSTOS=$P($G(^DD(9002080.01,3,0)),U,3)
 F ACHS=1:1 S ACHS(ACHS)=$P(ACHSTOS,";",ACHS) Q:ACHS(ACHS)=""  W ?20,$P(ACHS(ACHS),":",1),"   ",$P(ACHS(ACHS),":",2),!
 W !,"Select TYPE of service (1 - ",ACHS-1,"  'A' = 'ALL') ALL // "
 D READ^ACHSFU
 Q:$D(DTOUT)
 S:Y="" Y="A"
 G BDT:$D(DUOUT),B3:Y="A"
 I ($E(Y)="?")!(Y<1)!(Y>(ACHS-1)) W !!,"Enter an ""A"" to view documents for all types of service,",!,"otherwise, enter a number from 1 to ",ACHS-1,".",! G B
B3 ;
 S ACHSRPT=$S(Y="A":"ALL",1:+Y)
DEV ; Select device/ztload.
 S %ZIS="OPQ"
 D ^%ZIS,SLV^ACHSFU:$D(IO("S"))
 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^ACHSCHF",ZTDESC="CHS C H E F "_ACHSRPT_" Report, "_$$FMTE^XLFDT(ACHSBDT)_" to "_$$FMTE^XLFDT(ACHSEDT)_"."
 F %="ACHSBDT","ACHSEDT","ACHSRPT","ACHSTODA" S ZTSAVE(%)=""
 D ^%ZTLOAD
 G:'$D(ZTSK) DEV
 K ZTSK
 G K
 ;
START ;EP - From TaskMan.
 K ^TMP("ACHSCHF",$J)
 D FC^ACHSUF
 I $G(ACHSERR)=1 G K
 S ACHS("_")="",$P(ACHS("_"),"_",80)="",ACHSTAB=0
 S ACHST2=$$C^XBFUNC("For the period "_$$FMTE^XLFDT(ACHSBDT)_" through "_$$FMTE^XLFDT(ACHSEDT),80)
 S ACHSTOS=$P($G(^DD(9002080.01,3,0)),U,3),ACHSSTS=$P($G(^DD(9002080.01,11,0)),U,3),X2="2$",X3=0,ACHST3=$$C^XBFUNC($S(ACHSRPT:$P($P(ACHSTOS,";",ACHSRPT),":",2)_" documents ONLY",1:"All Documents")_", $"_$FN(ACHSTODA,",",2)_" Threshold",80)
 D BRPT^ACHSFU,WAIT^DICD:'$D(ZTQUEUED)
 S ACHSLOC=$$LOC^ACHS
 X:$D(IO("S")) ACHSPPO
 S ACHSTRAN=""
 G TRAN
 ;
DATE ;
 S ACHSBDT=$O(^ACHSF(DUZ(2),"TB",ACHSBDT))
 G PRINT:ACHSBDT=""!(ACHSBDT>ACHSEDT)
 S ACHSTRAN=""
TRAN ; Process transaction.
 S ACHSTRAN=$O(^ACHSF(DUZ(2),"TB",ACHSBDT,ACHSTRAN))
 G DATE:ACHSTRAN=""
 S ACHSDIEN=0
DIEN ;
 S ACHSDIEN=$O(^ACHSF(DUZ(2),"TB",ACHSBDT,ACHSTRAN,ACHSDIEN))
 G:ACHSDIEN="" TRAN
 I ACHSRPT'="ALL",$$DOC^ACHS(0,4)'=ACHSRPT G DIEN
 F ACHSTIEN=0:0 S ACHSTIEN=$O(^ACHSF(DUZ(2),"TB",ACHSBDT,ACHSTRAN,ACHSDIEN,ACHSTIEN)) Q:ACHSTIEN=""  Q:'$D(^ACHSF(DUZ(2),"D",ACHSDIEN,"T",ACHSTIEN,0))  I $P($G(^ACHSF(DUZ(2),"D",ACHSDIEN,0)),U,22) D SET
 G DIEN
 ;
SET ;EP - Set work values. 
 S DFN=$$DOC^ACHS(0,22)
 S ACHSTRA0=$G(^ACHSF(DUZ(2),"D",ACHSDIEN,"T",ACHSTIEN,0))
 S ^TMP("ACHSCHF",$J,DFN,ACHSDIEN,ACHSTIEN,ACHSTRAN)=$P($G(^ACHSF(DUZ(2),"D",ACHSDIEN,"T",ACHSTIEN,0)),U,4)_U_$P(^(0),U,12)_U_$P(^(0),U,8)
 I '$D(^TMP("ACHSCHF",$J,DFN,0))!($D(^(0))=10) S ^(0)=""
 I "IS"[ACHSTRAN S $P(^TMP("ACHSCHF",$J,DFN,0),U)=$P($G(^TMP("ACHSCHF",$J,DFN,0)),U)+$P($G(^ACHSF(DUZ(2),"D",ACHSDIEN,"T",ACHSTIEN,0)),U,4) Q
 I "C"[ACHSTRAN S $P(^TMP("ACHSCHF",$J,DFN,0),U)=$P($G(^TMP("ACHSCHF",$J,DFN,0)),U)-$P($G(^ACHSF(DUZ(2),"D",ACHSDIEN,"T",ACHSTIEN,0)),U,4) Q
 S $P(^TMP("ACHSCHF",$J,DFN,0),U,2)=$P($G(^TMP("ACHSCHF",$J,DFN,0)),U,2)+$P($G(^ACHSF(DUZ(2),"D",ACHSDIEN,"T",ACHSTIEN,0)),U,4)
 Q
SETBS ;EP -Set work values for blankets and SLO  ;ACHS*3.1*16 11.9.2009 IHS.OIT.FCJ
 S DFN=$P(^ACHSCHEF(DUZ(2),1,ACHSCHEF,0),U,2)
 I '$D(^TMP("ACHSCHF",$J,DFN,0))!($D(^(0))=10) S ^(0)=""
 S ACHSPROV=$P(^ACHSF(DUZ(2),"D",ACHSDIEN,0),U,8)
 ;IF DOS IS PROVIDED THEN THE CONTRACT CAN BE TESTED FOR BY UNCOMMENTING NXT LINE AND 3 LINE DOWN
 ;D ^ACHSUCN
 S ACHSPROV=$E($P($G(^AUTTVNDR(ACHSPROV,0)),U),1,17)
 ;I $G(C) S ACHSPROV="*"_$E(ACHSPROV,1,16)
 S ^TMP("ACHSCHF",$J,DFN,"BLK",ACHS)=^ACHSCHEF(DUZ(2),1,ACHSCHEF,3,ACHS,0)
 S $P(^TMP("ACHSCHF",$J,DFN,"BLK",ACHS),U,5)=ACHSPROV
 S $P(^TMP("ACHSCHF",$J,DFN,0),U)=$P($G(^TMP("ACHSCHF",$J,DFN,0)),U)+$P($G(^ACHSCHEF(DUZ(2),1,ACHSCHEF,3,ACHS)),U,3)
 Q
 ;
PRINT ;
 S DFN=0
P1 ;
 S DFN=$O(^TMP("ACHSCHF",$J,DFN))
 G:'DFN END
 I $P($G(^TMP("ACHSCHF",$J,DFN,0)),U)<ACHSTODA,$P($G(^TMP("ACHSCHF",$J,DFN,0)),U,2)<ACHSTODA G P1
 D HDR
 ;ACHS*3.1*15 12.15.2009 IHS/OIT/FCJ ADDED ACHS("IPD") TO NXT LINE
 S (ACHSDIEN,ACHS("TAO"),ACHS("PD"),ACHS("IPD"))=0
P2 ;
 S ACHSDIEN=$O(^TMP("ACHSCHF",$J,DFN,ACHSDIEN))
 ;ACHS*3.1*16 11.9.2009 IHS.OIT.FCJ MODIFIED NXT LINE TO PRINT BLANKET/SLO INFO
 I 'ACHSDIEN D PAT G END:$G(ACHSQUIT),P1
 S ACHSDOCR=$G(^ACHSF(DUZ(2),"D",ACHSDIEN,0))
 S (ACHSTIEN,ACHSTAO,ACHSPD,ACHSP3RD)=0,ACHSDOS=""
P3 ;
 S ACHSTIEN=$O(^TMP("ACHSCHF",$J,DFN,ACHSDIEN,ACHSTIEN))
 I 'ACHSTIEN D POSUM G P2
 S ACHSTRAN=$O(^TMP("ACHSCHF",$J,DFN,ACHSDIEN,ACHSTIEN,""))
 I ACHSTRAN="P" S ACHSDOS=$$FMTE^XLFDT($P($G(^ACHSF(DUZ(2),"D",ACHSDIEN,"T",ACHSTIEN,0)),U,10))
 I "IS"[ACHSTRAN S ACHSTAO=ACHSTAO+$P($G(^TMP("ACHSCHF",$J,DFN,ACHSDIEN,ACHSTIEN,ACHSTRAN)),U)
 I "C"[ACHSTRAN S ACHSTAO=ACHSTAO-$P($G(^TMP("ACHSCHF",$J,DFN,ACHSDIEN,ACHSTIEN,ACHSTRAN)),U)
 I "IS"'[ACHSTRAN S ACHSPD=ACHSPD+$P($G(^TMP("ACHSCHF",$J,DFN,ACHSDIEN,ACHSTIEN,ACHSTRAN)),U)
 I "C"[ACHSTRAN S ACHSPD=ACHSPD-$P($G(^TMP("ACHSCHF",$J,DFN,ACHSDIEN,ACHSTIEN,ACHSTRAN)),U)
 S ACHSP3RD=ACHSP3RD+$P($G(^TMP("ACHSCHF",$J,DFN,ACHSDIEN,ACHSTIEN,ACHSTRAN)),U,3)
 G P3
 ;
END ; Ask RTRN, write IOF. 
 W @IOF
K ;EP - Kill vars, do ERPT, quit.
 D EN^XBVK("ACHS"),^ACHSVAR
 ;ACHS*3.1*15 12.15.2009 IHS/OIT/FCJ ADDED ACHS("IPD") TO NXT LINE ACHS*3.1*16 ADDED ACHS,ACHSPCNT
 K DA,DFN,DR,ACHS("IPD"),ACHS,ACHSPCNT
 K ^TMP("ACHSCHF",$J)
 D ERPT^ACHS,KILL^AUPNPAT
 Q
 ;
HDR ;
 S Y=DFN
 D ^AUPNPAT
 W @IOF,!,ACHS("*"),!,$$C^XBFUNC("CATASTROPHIC HEALTH EMERGENCY FUND REIMBURSEMENT SEARCH"),!,ACHS("*"),!,ACHSTIME,!,ACHST2,!,ACHST3,!,ACHS("*")
 W !!,$P($G(^DPT(DFN,0)),U),!,$S(SEX="F":"Female",SEX="M":"Male",1:"<sex missing>"),", born ",$$FMTE^XLFDT(DOB),", SSN: ",SSN,", HRN: ",$$HRN^ACHS(DFN,DUZ(2))
 D EN^ACHSRP31
H ;EP
 ;ACHS*3.1*15 12.15.2009 IHS/OIT/FCJ CHANGED NXT LINE COLUMNS
 W !,"|13. PROVIDER",?18,"|14. DOS",?31,"|15. P.O. #",?43,"|16. OBL",?54,"|17. PAID",?65,"|18. DATE PD",?78,"|"
 W !,"|-----------------",?18,"|------------",?31,"|-----------",?43,"|----------",?54,"|----------",?65,"|------------|"
 Q
 ;
POSUM ;EP - Add one PO.
 S ACHSPROV=$P(ACHSDOCR,U,8),ACHSEDOS=DT,ACHSACO=""
 D ^ACHSUCN
 S ACHSPROV=$E($P($G(^AUTTVNDR(ACHSPROV,0)),U),1,17)
 I $G(C) S ACHSPROV="*"_$E(ACHSPROV,1,16)
 S ACHSPO=$P(ACHSDOCR,U,14)_"-"_ACHSFC_"-"_$P(ACHSDOCR,U)  ;ACHS*3.1*16 11.09.2009 IHS.OIT.FCJ
 S ACHSDTP=$P($G(^ACHSF(DUZ(2),"D",ACHSDIEN,"PA")),U,3)    ;ACHS*3.1*16 11.09.2009 IHS.OIT.FCJ
POSUM2 ;EP - FOR BLANKETS AND SLO   ;ACHS*3.1*16 11.09.2009 IHS.OIT.FCJ
 W !,"|",ACHSPROV
 ;ACHS*3.1*16 11.09.2009 IHS.OIT.FCJ CHANGED NXT LINE TO PRNT ACHSPO INSTEAD OF $P(ACHSDOCR,U,14),"-",ACHSFC,"-",$P(ACHSDOCR,U)
 W ?18,"|",ACHSDOS,?31,"|",ACHSPO,?43,"|",$J($FN(ACHSTAO,",",2),10),?54,"|",$J($FN(ACHSPD,",",2),10)
 ;ACHS*3.1*16 11.09.2009 IHS.OIT.FCJ CHANGED NXT LINE TO PRNT ACHSDTP INSTEAD OF $P($G(^ACHSF(DUZ(2),"D",ACHSDIEN,"PA")
 W ?65,"|",$$FMTE^XLFDT(ACHSDTP),?78,"|"
 S ACHS("TAO")=ACHS("TAO")+ACHSTAO,ACHS("PD")=ACHS("PD")+ACHSPD
 ;ACHS*3.1*15 12.15.2009 IHS/OIT/FCJ ADDED NXT LINE FOR TOTAL IHS PAID
 S ACHS("IPD")=ACHS("IPD")+$S(ACHSPD=0:ACHSTAO,1:ACHSPD)
 K ACHSPROV,ACHSEDOS,ACHSACO,C
 Q
 ;
PAT ;EP -  Print summary patient info.
 ;ACHS*3.1*15 12.15.2009 IHS/OIT/FCJ CHANGED NXT SECTION TO PRINT SUBTOTALS AND CHANGED FIELD NUMBERS
 W !,"|",$$REPEAT^XLFSTR("-",42),"|==========|==========|------------",?78,"|",!,"|19. SUB-TOTALS",$$REPEAT^XLFSTR(".",28),?43,"|",$J($FN(ACHS("TAO"),",",2),10),?54,"|",$J($FN(ACHS("PD"),",",2),10),?65,"|",?78,"|"
 W !,"|------------------------------------------",?43,"|----------",?54,"|----------",?65,"|------------|"
 W !,"|20. TOTAL IHS COSTS",$$REPEAT^XLFSTR(".",23),?43,"|",?54,"|",$J($FN(ACHS("IPD"),",",2),10),?65,"|",?78,"|"
 W !,"|21. LESS THRESHOLD",$$REPEAT^XLFSTR(".",24),?43,"|",?54,"|",$J($FN(ACHSTODA,",",2),10),?65,"|",?78,"|"
 W !,"|22. NET ELIGIBLE FROM FUND",$$REPEAT^XLFSTR(".",16),?43,"|",?54,"|",$J($FN(ACHS("IPD")-ACHSTODA,",",2),10),?65,"|",?78,"|"
 ;ACHS*3.1*16 11.9.2009 IHS.OIT.FCJ 2 NEW LINES TO PRT % REQUESTED AMT, MOD LINE 23 TO ADD AMENDMENT PAID AND NEW LINE 24 FOR PENDING AMENDMENTS,ADDED ACHSTOTA AND ACHSTOTR TO LINE 25
 S:'$G(ACHSPCNT) ACHSPCNT=1
 W !,"|22.a PERCENT OF LINE 22 TO BE REIMBURSED",$$REPEAT^XLFSTR(".",2),?43,"|",?54,"|",$J($FN(ACHSPCNT*((ACHS("IPD")-ACHSTODA)),",",2),10),?65,"|",?78,"|"
 W !,"|23. LESS ADVANCES TO DATE",$$REPEAT^XLFSTR(".",17),"|",?54,"|",$J($FN(($G(ACHSTOTL)+$G(ACHSTOTR)),",",2),10),?65,"|",?78,"|"
 W !,"|24. LESS AMENDMENTS PENDING PAYMENT",$$REPEAT^XLFSTR(".",7),"|",?54,"|",$J($FN($G(ACHSTOTA),",",2),10),?65,"|",?78,"|"
 W !,"|25. TOTAL REQUESTED AMOUNT",$$REPEAT^XLFSTR(".",16),?20,"|",?54,"|",$J($FN(ACHSPCNT*(ACHS("IPD")-ACHSTODA)-$G(ACHSTOTL)-$G(ACHSTOTA)-$G(ACHSTOTR),",",2),10),?65,"|",?78,"|"
 ;W !,"|25. TOTAL REQUESTED AMOUNT",$$REPEAT^XLFSTR(".",16),?20,"|",?54,"|",$J($FN(ACHS("TAO")-$G(ACHSTODA)-$G(ACHSTOTL),",",2),10),?65,"|",?78,"|"
 D RTRN^ACHS
 Q
 ;