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

IBARXMO1.m

Go to the documentation of this file.
  1. IBARXMO1 ;LEX/WRC - PHARMACY CO-PAY CAP ;10/23/03
  1. ;;2.0;INTEGRATED BILLING;**259**;21-MAR-94
  1. ;
  1. CALDT ;
  1. ;set dates min/max and calendar year
  1. S IBMIN=3011231
  1. D NOW^%DTC S IBCENYR=$E(X,1,3),IBCENYR=IBCENYR-1,IBMAX=IBCENYR_1231
  1. S DIR(0)="DOA^"_IBMIN_":"_IBMAX_":AEP^K:X'?2.4N X",DIR("A")="Enter the Two or Four Digit Calendar Year: "
  1. D ^DIR K DIR
  1. I Y<1 D KIL Q
  1. S IBCENYR=$E(Y,1,3),IBSMYR=IBCENYR_"0100",IBEMYR=IBCENYR_1231
  1. ;
  1. ZIS S %IS="Q" D ^%ZIS
  1. K %H,%T I POP=1 D KIL Q
  1. I '$D(IO("Q")) U IO D STRT Q
  1. S ZTRTN="STRT^IBARXMO1",ZTIO=ION,ZTSAVE("IBSMYR")="",ZTSAVE("IBEMYR")=""
  1. D ^%ZTLOAD
  1. W:$D(ZTSK) !,"Request Queued!",!,"Task Number: "_ZTSK,!
  1. D KIL Q
  1. ;
  1. STRT ;
  1. ;-set the annual billing cap in variable IBY
  1. S IBD=IBEMYR,IBP=2 D CAP^IBARXMC(IBD,IBP,.IBM,.IBY,.IBF,.IBT)
  1. S IBSITE=$P($$SITE^VASITE,"^",3) ;get the site's station number
  1. S (IBTNBOC,IBTV,IBTVC,IBAB,IBANB,IBA5,IBB5,IBA3)=0
  1. S IBDFN=0
  1. F S IBDFN=$O(^IBAM(354.71,"AD",IBDFN)) Q:'IBDFN D
  1. . S IBP=$$PRIORITY^IBARXMU(IBDFN)
  1. . I IBP<2!(IBP>6) Q
  1. . D IB350R
  1. . S IBTRDT=IBSMYR-1,IBTIEN=""
  1. . F S IBTRDT=$O(^IBAM(354.71,"AD",IBDFN,IBTRDT)) Q:IBTRDT=""!(IBTRDT>IBEMYR)!($D(IBSLESS)) D
  1. .. F S IBTIEN=$O(^IBAM(354.71,"AD",IBDFN,IBTRDT,IBTIEN)) Q:IBTIEN="" D
  1. ... S IBTREC=$G(^IBAM(354.71,IBTIEN,0))
  1. ... I $P(IBTREC,"^",4)'="",($D(^TMP("IBARXMO1",$J,$P(IBTREC,"^",4)))) Q ;ignore charge because "co-pay" cancellation (status=11) not in 354.71
  1. ... S IBTSTA=$E($P(IBTREC,"^",1),1,3) ;get the orginating station
  1. ... I IBTSTA<+IBSITE S IBSLESS=1 Q ;if the vet was billed at a 'lesser site', don't count him here
  1. ... I IBTSTA=+IBSITE S IBSSITE=1 ;vet was billed at this site, so vet can be counted at this site
  1. ... S IBAB=IBAB+$P(IBTREC,"^",11) ;increment the total amount billed to the vet
  1. ... I IBAB=IBY!(IBAB>IBY),('$D(IBMRK)) S IBMRK=$P(IBTREC,"^",3) ;if the vet hit or exceeded the cap for the first time, set the date that occurred
  1. ... S IBANB=IBANB+$P(IBTREC,"^",12) ;increment the total amount not billed
  1. . I $D(IBSLESS) D RESET Q ;vet to be counted at the 'lesser site'
  1. . I '$D(IBSSITE) D RESET Q ;vet wasn't billed here at least once in the timeframe
  1. . I IBAB<.01 D RESET Q ;vet wasn't billed
  1. . S IBTNBOC=IBTNBOC+IBANB ;increment 'Amount Above Cap'
  1. . S IBTV=IBTV+1 ;increment 'Veterans Billed the Co-payment'
  1. . I IBAB<IBY D D RESET Q ;if vet didn't reach the cap
  1. .. S IBA5=IBA5+IBAB ;increment the amounts billed to vets not reaching cap
  1. .. S IBB5=IBB5+1 ;increment # vets not reaching cap
  1. . I $D(IBMRK) S X1=IBMRK,X2=IBSMYR D ^%DTC S IBA3=IBA3+X ;calculate running total of time rquired by vet to reach the cap
  1. . S IBTVC=IBTVC+1 ;increment 'Veterans Reaching the Cap'
  1. . D RESET
  1. S IBAVGD=$S('IBTVC:0,1:IBA3/IBTVC) ;calculate 'Average Days Reaching Cap'
  1. S IBAVGBUC=$S('IBB5:0,1:IBA5/IBB5) ;calculate 'Average Billed to Those Not Reaching Cap'
  1. D PRINT
  1. ;
  1. KIL I $D(ZTQUEUED) S ZTREQ="@"
  1. E D ^%ZISC
  1. ;
  1. K %DT,IBSMYR,Y,IBEMYR,%IS,IBD,IBP,IBM,IBY,IBT,IBSITE,IBTNBOC,IBTV,IBTVC,IBAB,IBANB,IBA5,IBB5,IBA3,IBDFN,IBMRK,IBAVGD,IBAVGBUC,IBTRDT,IBTIEN,IBTREC,IBTSTA,X,IBPSMYR,IBPEMYR
  1. K DIR,POP,IBF,IBMIN,IBMAX,IBCENYR,IB350STD,IB350IEN,IB350R,X1,X2,X3,ZTIO,ZTQUEUED,ZTRTN,ZTSAVE,ZTSK
  1. K ^TMP("IBARXMO1",$J)
  1. Q
  1. ;
  1. RESET ;
  1. S (IBAB,IBANB)=0
  1. K IBMRK,IBSLESS,IBSSITE
  1. Q
  1. ;
  1. PRINT ;
  1. I $E(IOST,1,2)="C-" W @IOF,*13
  1. S IBSMYR=$E(IBSMYR,1,5)_"01"
  1. S Y=IBSMYR D DD^%DT S IBPSMYR=Y
  1. S Y=IBEMYR D DD^%DT S IBPEMYR=Y
  1. W !,?26,"FACILITY PHARMACY CO-PAY CAP"
  1. W !,?32,"SUMMARY REPORT"
  1. W !,?23,IBPSMYR," THROUGH ",IBPEMYR
  1. D NOW^%DTC S Y=X D DD^%DT W !,?29,"RUN DATE: ",Y,!!
  1. W !,"Total Vets Billed:" S X=IBTV,X2=0,X3=20 D COMMA^%DTC W ?50,X
  1. W !,"Total Vets At or Above the Cap:" S X=IBTVC,X2=0,X3=20 D COMMA^%DTC W ?50,X
  1. W !,"Average Number of Days to Reach Cap:" S X=IBAVGD,X2=0,X3=20 D COMMA^%DTC W ?50,X
  1. W !,"Average Amount Charged to Those Not Reaching Cap:" S X=IBAVGBUC,X2="2$",X3=20 D COMMA^%DTC W ?50,X
  1. W !,"Potential Billable Amount:" S X=IBTNBOC,X2="2$",X3=20 D COMMA^%DTC W ?50,X
  1. I $E(IOST,1,2)="C-" W !! S DIR(0)="E" D ^DIR
  1. Q
  1. IB350R ;
  1. ;build array of "co-pay" cancellations (status=11) not in 354.71
  1. ;
  1. K ^TMP("IBARXMO1",$J)
  1. S IB350STD=IBSMYR
  1. F S IB350STD=$O(^IB("APTDT",IBDFN,IB350STD)) Q:IB350STD=""!(IB350STD>IBEMYR) D
  1. . S IB350IEN=""
  1. . F S IB350IEN=$O(^IB("APTDT",IBDFN,IB350STD,IB350IEN)) Q:'IB350IEN D
  1. .. S IB350R=$G(^IB(IB350IEN,0))
  1. .. I $P(IB350R,"^",5)'=11 Q
  1. .. I $P(IB350R,"^",9)'="" S ^TMP("IBARXMO1",$J,$P(IB350R,"^",9))=""
  1. Q