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

IBOTRR.m

Go to the documentation of this file.
  1. IBOTRR ;ALB/ARH - ROI EXPIRING REPORT ; 08-JAN-2013
  1. ;;2.0;INTEGRATED BILLING;**458**;21-MAR-94;Build 4
  1. ;;Per VHA Directive 2004-038, this routine should not be modified.
  1. ;
  1. EN ;get parameters then run the report
  1. D HOME^%ZIS N DIR,DIRUT,DUOUT,X,Y,IBBDT,IBEDT,IBEXCEL
  1. W !!,"ROI Special Consent Report - Find ROIs about to expire",!
  1. ;
  1. D DATE^IBOUTL I IBBDT=""!(IBEDT="") Q
  1. ;
  1. W !!,"ROI's that expire between "_$$FMTE^XLFDT(IBBDT,2)_" and "_$$FMTE^XLFDT(IBEDT,2)_" will be included on the report.",!
  1. ;
  1. ; Determine whether to gather data for Excel report
  1. S DIR("?")="Enter Yes to capture the report on the screen for transfer to Excel."
  1. S DIR(0)="Y",DIR("B")="NO",DIR("A")="Do you want to capture report data for an Excel document" D ^DIR K DIR I $D(DIRUT) G EXIT
  1. S IBEXCEL=0 I Y=1 S IBEXCEL=1 W !,"Enter '0;80;999' at the 'DEVICE:' prompt.",!
  1. ;
  1. DEV ;get the device
  1. S %ZIS="QM",%ZIS("A")="OUTPUT DEVICE: " D ^%ZIS G:POP EXIT
  1. I $D(IO("Q")) S ZTRTN="RPT^IBOTRR",ZTSAVE("IB*")="",ZTDESC="IB ROI Expires" D ^%ZTLOAD K IO("Q") G EXIT
  1. U IO
  1. ;
  1. RPT ;find, save, and print the data that satisfies the search parameters
  1. ;entry point for tasked jobs
  1. ;
  1. K ^TMP($J,"IBOTRR")
  1. ;
  1. D SORT,PRINT
  1. ;
  1. EXIT ;clean up and quit
  1. K ^TMP($J,"IBOTRR") Q:$D(ZTQUEUED)
  1. D ^%ZISC
  1. Q
  1. ;
  1. SORT ; sort report - get all ROIs that will expire in Patient and Effective Date order
  1. N DFN,IBRFN,IBR0,IBPAT,IBB,IBE K ^TMP($J,"IBOTRR")
  1. ;
  1. S DFN=0 F S DFN=$O(^IBT(356.26,"C",DFN)) Q:'DFN D
  1. .S IBRFN=0 F S IBRFN=$O(^IBT(356.26,"C",DFN,IBRFN)) Q:'IBRFN D
  1. .. S IBR0=$G(^IBT(356.26,IBRFN,0))
  1. .. S IBB=+$P(IBR0,U,4),IBE=+$P(IBR0,U,5),IBPAT=$P($G(^DPT(+$P(IBR0,U,2),0)),U,1)
  1. .. ;
  1. .. I IBE'<IBBDT,IBE'>IBEDT S ^TMP($J,"IBOTRR",IBPAT,$P(IBR0,U,4),IBRFN)=""
  1. ;
  1. Q
  1. ;
  1. PRINT ;print the report from the temp sort file to the appropriate device
  1. N IBPGN,IBLN,IBQUIT,IBPAT,IBB,IBRFN,IBR0
  1. S IBPGN=0,IBQUIT=0 D HDR Q:IBQUIT
  1. ;
  1. S IBPAT="" F S IBPAT=$O(^TMP($J,"IBOTRR",IBPAT)) Q:IBPAT="" D Q:IBQUIT
  1. . S IBB="" F S IBB=$O(^TMP($J,"IBOTRR",IBPAT,IBB)) Q:IBB="" D Q:IBQUIT
  1. .. S IBRFN=0 F S IBRFN=$O(^TMP($J,"IBOTRR",IBPAT,IBB,IBRFN)) Q:'IBRFN D Q:$$LNCHK(2)
  1. ... S IBR0=$G(^IBT(356.26,IBRFN,0))
  1. ... I +$G(IBEXCEL) W !,IBPAT,U,$$FMTE^XLFDT($P(IBR0,U,4)),U,$$FMTE^XLFDT($P(IBR0,U,5)) S IBLN=1 Q
  1. ... W !,IBPAT,?36,$$FMTE^XLFDT($P(IBR0,U,4)),?53,$$FMTE^XLFDT($P(IBR0,U,5)) S IBLN=IBLN+1
  1. ;
  1. I 'IBQUIT D PAUSE
  1. Q
  1. LNCHK(LNS) ; check if new page is needed
  1. I 'IBQUIT,IBLN>(IOSL-LNS) D PAUSE I 'IBQUIT D HDR
  1. Q IBQUIT
  1. ;
  1. HDR ;print the report header
  1. N IBNOW,IBI
  1. I +$G(IBEXCEL) W !,"Patient^Effective^Expires" S IBLN=1 Q
  1. ;
  1. S IBQUIT=$$STOP Q:IBQUIT S IBPGN=IBPGN+1,IBLN=7
  1. S IBNOW=$$FMTE^XLFDT($$NOW^XLFDT,2),IBNOW=$P(IBNOW,"@",1)_" "_$P($P(IBNOW,"@",2),":",1,2)
  1. I IBPGN>1!($E(IOST,1,2)["C-") W @IOF
  1. ;
  1. W !,"ROI Special Consent To Expire ",$$FMTE^XLFDT(IBBDT)," - ",$$FMTE^XLFDT(IBEDT),?(IOM-30),IBNOW,?(IOM-8),"PAGE ",IBPGN,!
  1. W !,"Patient",?36,"Effective",?53,"Expires",!
  1. S IBI="",$P(IBI,"-",IOM+1)="" W IBI
  1. Q
  1. ;
  1. PAUSE ;pause at end of screen if beeing displayed on a terminal
  1. Q:$E(IOST,1,2)'["C-" N DIR,DUOUT,DTOUT,DIRUT W !
  1. S DIR(0)="E" D ^DIR K DIR
  1. I $D(DUOUT)!($D(DIRUT)) S IBQUIT=1
  1. Q
  1. ;
  1. STOP() ;determine if user has requested the queued report to stop
  1. I $D(ZTQUEUED),$$S^%ZTLOAD S ZTSTOP=1 K ZTREQ I +$G(IBPGN) W !,"***TASK STOPPED BY USER***"
  1. Q +$G(ZTSTOP)