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

BRNRU3.m

Go to the documentation of this file.
  1. BRNRU3 ; IHS/OIT/LJF - MISC REPORT LOGIC
  1. ;;2.0;RELEASE OF INFO SYSTEM;*1*;APR 10, 2003
  1. ;IHS/OIT/LJF 10/25/2007 PATCH 1 Added routine
  1. ;
  1. ;
  1. TITLE ;EP; Custom Title for report
  1. NEW Y,LENGTH,TITLE,DIE,DA,DR
  1. Q:"FTCP"[BRNCTYP
  1. S Y=$$READ^BRNU("Y","Would you like a custom title for this report","NO") Q:Y=0
  1. I Y=U S BRNQUIT=1 Q
  1. S LENGTH=$S(BRNTCW:BRNTCW-8,1:60)
  1. S TITLE=$$READ^BRNU("F^3:"_LENGTH,"Enter custom title",," Enter from 3 to "_LENGTH_" characters")
  1. I (Y=U)!(Y="") D TITLE Q
  1. S DIE=90264.8,DA=BRNRPT,DR="1303///"_TITLE D ^DIE
  1. Q
  1. ;
  1. SAVE ;EP; Ask user to save report logic
  1. Q:$D(BRNCAND) ;--- don't ask if already a pre-defined rpt
  1. Q:BRNCTYP'="D" ;--- must be a detailed report to be saved
  1. Q:'$$READ^BRNU("Y","Do you wish to SAVE this SEARCH/PRINT/SORT logic for future use","NO")
  1. ;
  1. NEW NAME,DIE,DR,DA
  1. S NAME=$$READ^BRNU("90264.8,.03","Enter NAME for this REPORT DEFINITION") Q:$L(NAME)<3
  1. S DIE="^BRNRPT(",DA=BRNRPT,DR=".02////1;.03///"_NAME_";.05///"_BRNCTYP D ^DIE
  1. Q
  1. ;
  1. COUNT ;EP; Counts and Subcount logic
  1. W !!
  1. S DIR(0)="S^T:Total Count Only;S:Sub-counts and Total Count;D:Detailed Listing;L:Delimited Output File for use in Excel"
  1. S DIR("A")=" Choose Type of Report",DIR("B")="D" D ^DIR K DIR W !!
  1. S:$D(DUOUT) DIRUT=1
  1. I $D(DIRUT) S BRNQUIT=1 Q
  1. S BRNCTYP=Y
  1. I BRNCTYP="T" S $P(^BRNRPT(BRNRPT,0),U,5)="T" S BRNSORT=1,BRNSORV="Patient Name" Q
  1. I BRNCTYP="D" D PRINT Q:$D(BRNQUIT) D SORT Q
  1. I BRNCTYP="L" D Q
  1. .W !!,"You have selected to create a delimited output file, you will be"
  1. .W !,"asked to select the print items, the sort item and then to name the"
  1. .W !,"output file.",!!
  1. .K DIR S DIR(0)="Y",DIR("A")="Do you wish to continue",DIR("B")="Y" KILL DA D ^DIR KILL DIR
  1. .I $D(DIRUT) S BRNQUIT=1 Q
  1. .I 'Y S BRNQUIT=1 Q
  1. .D PRINT Q:$D(BRNQUIT) S $P(^BRNRPT(BRNRPT,0),U,5)="F" D Q:$D(BRNQUIT)
  1. .D SORT
  1. .D DELIMIT
  1. .I BRNDELT="" S BRNQUIT=1
  1. Q:$G(BRNQUIT)
  1. D SORT
  1. Q
  1. ;
  1. PRINT ;
  1. S BRNCNTL="P"
  1. D ^BRNRU2
  1. Q
  1. ;
  1. SORT ;EP
  1. K BRNSORT,BRNSORV,BRNQUIT
  1. I BRNCTYP="D"!(BRNCTYP="L"),'$D(^BRNRPT(BRNRPT,12)) W !!,"NO PRINT FIELDS SELECTED!!",$C(7),$C(7) S BRNQUIT=1 Q
  1. S BRNSORT=""
  1. D SHOWR^BRNRUS
  1. S BRNCNTL="R" D ^BRNRU2 K BRNCNTL
  1. I '$D(BRNSORV) S BRNQUIT=1 Q
  1. Q:BRNCTYP'="D"
  1. PAGE ;
  1. K BRNSPAG
  1. Q:BRNCTYP'="D"
  1. S DIR(0)="Y",DIR("A")="Do you want a separate page for each "_BRNSORV,DIR("B")="N" D ^DIR K DIR S:$D(DUOUT) DIRUT=1
  1. I $D(DIRUT) G SORT
  1. S BRNSPAG=Y,DIE="^BRNRPT(",DA=BRNRPT,DR=".04///"_BRNSPAG D ^DIE K DA,DR,DIE
  1. Q
  1. ;
  1. DELIMIT ;get filename for delimited output
  1. K BRNQUIT
  1. S BRNDELF="",BRNDELT=""
  1. W !!,"You have selected to create a '^' delimited output file. You can have this"
  1. W !,"output file created as a text file in the pub directory, "
  1. W !,"OR you can have the delimited output display on your screen so that"
  1. W !,"you can do a file capture. Keep in mind that if you choose to"
  1. W !,"do a screen capture you CANNOT Queue your report to run in the background!!",!!
  1. S DIR(0)="S^S:SCREEN - delimited output will display on screen for capture;F:FILE - delimited output will be written to a file in pub"
  1. S DIR("A")="Select output type",DIR("B")="S" KILL DA
  1. D ^DIR KILL DIR
  1. I $D(DIRUT) S BRNDELT="" Q
  1. S BRNDELT=Y
  1. Q:BRNDELT="S"
  1. S DIR(0)="F^1:40" W !,"Enter a filename for the delimited output (no more than 40 characters)"
  1. S DIR("A")="Filename" KILL DA D ^DIR KILL DIR
  1. I $D(DIRUT) G DELIMIT
  1. S BRNDELF=Y
  1. S BRNHDIR=$S($P($G(^AUTTSITE(1,1)),U,2)]"":$P(^AUTTSITE(1,1),U,2),1:$G(^XTV(8989.3,1,"DEV")))
  1. I $G(BRNHDIR)="" S BRNHDIR="/usr/spool/uucppublic/"
  1. W !!,"When the report is finished your delimited output will be found in the",!,BRNHDIR," directory. The filename will be ",BRNDELF,".txt",!
  1. Q