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

BRNRU.m

Go to the documentation of this file.
  1. BRNRU ; IHS/OIT/LJF - ROI REPORTING UTILITY DRIVER
  1. ;;2.0;RELEASE OF INFO SYSTEM;*1*;APR 10, 2003
  1. ;IHS/OIT/LJF 10/19/2007 PATCH 1 Added this routine series and function to patch 1
  1. ; Main logic and code borrowed from PCC VGEN
  1. ;
  1. NEW BRNBD,BRNED,BRNBDD,BRNEDD,BRNQUIT,BRNPCNT,BRNDCNT,BRNPREV,BRNRPT,BRNSORT,X
  1. NEW BRNSORV,BRNSPAG,BRNCTYP,BRNTCW,BRNCNTL
  1. S (BRNPTCT,BRNPCNT,BRNRCNT)=0 ;BRNPCCT = # of patients; BRNRCNT = # of disclosures
  1. ;
  1. ;date range selection
  1. S X="DATE RANGE SELECTION" W !!?((80-$L(X))/2),X,!!
  1. BD ;get beginning date
  1. S BRNBD=$$READ^BRNU("D^:DT:DP","Enter Beginning Request Date for search") Q:BRNBD<1
  1. ;get ending date
  1. S BRNED=$$READ^BRNU("D^:DT:DP","Enter Ending Request Date for search") I BRNED<1 D BD Q
  1. S BRNED=BRNED_.2359
  1. S BRNBDD=$$FMTE^XLFDT(BRNBD,"D"),BRNEDD=$$FMTE^XLFDT(BRNED,"D") ;external format for dates
  1. ;
  1. ; use previous report or not
  1. S BRNPREV=0 D PREV ;check if a previous report will be used, if not create a temporary shell
  1. I $D(BRNQUIT) D DEL Q ;if user quit, delete any shell that was created
  1. I BRNPREV=0 D NEW Q ;if new, build report, select title and print device then quit
  1. ;
  1. D TITLE^BRNRU3 I $D(BRNQUIT) Q ;otherwise, update title for previously used report
  1. D ZIS ;call print device
  1. Q
  1. ;
  1. NEW ; prev defined report not used; build new one
  1. N1 K ^BRNRPT(BRNRPT,11) S BRNCNTL="S" D ^BRNRU2 I $D(BRNQUIT) D DEL Q ;ask screening questions
  1. N2 K ^BRNRPT(BRNRPT,12) S BRNTCW=0 D COUNT^BRNRU3 I $D(BRNQUIT) K BRNQUIT G N1 ;ask for type of report
  1. D TITLE^BRNRU3 I $D(BRNQUIT) K BRNQUIT G N2 ;select title for report
  1. D SAVE^BRNRU3,ZIS ;ask to save report and select print device
  1. Q
  1. ;
  1. PREV ;called to selelct previous report or create a new temporary one
  1. W !!
  1. S Y=$$READ^BRNU("Y","Do you want to use a PREVIOUSLY DEFINED REPORT","NO") I Y=0 D BUILD Q
  1. I Y'=1 S BRNQUIT=1 Q
  1. S DIC="^BRNRPT(",DIC("S")="I $P(^(0),U,2)",DIC(0)="AEQ",DIC("A")="REPORT NAME: ",D="C" D IX^DIC K DIC,DA,DR
  1. I Y=-1 S BRNQUIT=1 Q
  1. S BRNRPT=+Y,BRNPREV=1,BRNTCW=0
  1. ;--- set up sorting and report control variables
  1. S BRNSORT=$P(^BRNRPT(BRNRPT,0),U,7) ;sort item
  1. S BRNSORV=$P(^BRNRPT(BRNRPT,0),U,8) ;sort text
  1. S BRNSPAG=$P(^BRNRPT(BRNRPT,0),U,4) ;use separate pages?
  1. S BRNCTYP=$P(^BRNRPT(BRNRPT,0),U,5) ;report type (totals, subcounts, details)
  1. S $P(^BRNRPT(BRNRPT,13),U)=$G(BRNBD) ;reset beginning date
  1. S $P(^BRNRPT(BRNRPT,13),U,2)=$G(BRNED) ;reset ending date
  1. S X=0 F S X=$O(^BRNRPT(BRNRPT,12,X)) Q:X'=+X S BRNTCW=BRNTCW+$P(^BRNRPT(BRNRPT,12,X,0),U,2)+2 ;set right margin
  1. Q
  1. ;
  1. BUILD ;create new report entry
  1. S %H=$H D YX^%DTC S X=$P(^VA(200,DUZ,0),U)_"-"_Y
  1. S DIC(0)="L",DIC="^BRNRPT(",DLAYGO=90264.8,DIADD=1,DIC("DR")=".13////"_DUZ
  1. D ^DIC K DIC,DA,DR,DIADD,DLAYGO,DINUM
  1. I Y=-1 W !!,"UNABLE TO CREATE REPORT FILE ENTRY - NOTIFY SITE MANAGER!" S BRNQUIT=1 Q
  1. S BRNRPT=+Y
  1. K ^BRNRPT(BRNRPT,11) ;make sure 11 multiple is clean
  1. Q
  1. ;
  1. ZIS ;call to XBDBQUE to select print device
  1. K BRNOPT
  1. I 'BRNTCW S BRNTCW=IOM
  1. S BRNDONE=""
  1. D SHOW^BRNRUS,SHOWP^BRNRUS,SHOWR^BRNRUS ;show report summary
  1. D CLEAN ;clean up variables before continuing
  1. I $G(BRNBQC)=1 Q
  1. I BRNCTYP="D"!(BRNCTYP="S") D
  1. . S DIR(0)="S^P:PRINT Output;B:BROWSE Output on Screen",DIR("A")="Do you wish to ",DIR("B")="P" K DA D ^DIR K DIR
  1. . I $D(DIRUT) S BRNQUIT="" Q
  1. . S BRNOPT=Y
  1. G:$G(BRNQUIT) SAVE^BRNRU3
  1. I $G(BRNOPT)="B" D BROWSE,XIT Q
  1. S XBRP="^BRNRUP",XBRC="^BRNRU11",XBRX="XIT^BRNRU",XBNS="BRN"
  1. D ^XBDBQUE
  1. D XIT
  1. Q
  1. ;
  1. DEL ;EP Delete log entry inf one exists and user "^" out
  1. I $G(BRNRPT),$D(^BRNRPT(BRNRPT,0)),'$P(^BRNRPT(BRNRPT,0),U,2) S DIK="^BRNRPT(",DA=BRNRPT D ^DIK K DIK,DA,DIC
  1. Q
  1. ADD ;
  1. D ADD^BRNRU1
  1. Q
  1. ;
  1. BROWSE ;
  1. S XBRP="VIEWR^XBLM(""^BRNRUP"")"
  1. S XBRC="^BRNRU11",XBRX="XIT^BRNRU",XBIOP=0 D ^XBDBQUE
  1. Q
  1. ;
  1. XIT ;EP; called by XBDBQUE
  1. D EN^XBVK("BRN")
  1. K C,D,D0,DA,DIC,DD,DFN,DIADD,DLAYGO,DICR,DIE,DIK,DINUM,DIQ,DIR,DIRUT,DUOUT,DTOUT,DR,J,I,J,K,M,S,TS,X,Y,DIG,DIH,DIV,DQ,DDH
  1. ;
  1. CLEAN ; clean up variables not to be sent to XBDBQUE
  1. K BRNPREV
  1. Q