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

BNIGVL3.m

Go to the documentation of this file.
  1. BNIGVL3 ; IHS/CMI/LAB - general retrieval cont ;
  1. ;;1.0;BNI CPHD ACTIVITY DATASYSTEM;;DEC 20, 2006
  1. ;
  1. ;
  1. TITLE ;EP
  1. Q:"FTC"[BNIGCTYP
  1. K DIR,X,Y S DIR(0)="Y",DIR("A")="Would you like a custom title for this report",DIR("B")="N" D ^DIR K DIR S:$D(DUOUT) DIRUT=1
  1. I $D(DIRUT) S BNIGQUIT=1 Q
  1. Q:Y=0
  1. S BNIGLENG=$S(BNIGCTYP="L":60,BNIGTCW:BNIGTCW-8,1:60)
  1. I Y=1 K DIR,X,Y S DIR(0)="F^3:"_BNIGLENG,DIR("A")="Enter custom title",DIR("?")=" Enter from 3 to "_BNIGLENG_" characters" D ^DIR K DIR
  1. G:$D(DIRUT) TITLE
  1. S BNIGTITL=Y
  1. Q
  1. SAVE ;EP
  1. Q:$D(BNIGCAND) ;--- don't ask if already a pre-defined rpt
  1. Q:BNIGCTYP'="D" ;--- must be a detailed report to be saved
  1. S BNIGSAVE=""
  1. K DIR,X,Y S DIR(0)="Y",DIR("A")="Do you wish to SAVE this "_$S('$D(BNIGEP1):"SEARCH/",1:"")_"PRINT/SORT logic for future use",DIR("B")="N" D ^DIR K DIR S:$D(DUOUT) DIRUT=1
  1. Q:$D(DIRUT)
  1. Q:'Y
  1. K DIR,X,Y S DIR(0)="90512.88,.03",DIR("A")="Enter NAME for this REPORT DEFINITION" D ^DIR K DIR S:$D(DUOUT) DIRUT=1
  1. G:$D(DIRUT) SAVE
  1. S BNIGNAME=Y
  1. S DIE="^BNIRTMP(",DA=BNIGRPT,DR=".02////1;.03///"_BNIGNAME_";.06///"_BNIGPTVS_";.05///"_BNIGCTYP S:$D(BNIGEP1) DR=DR_";.09///"_BNIGPACK D ^DIE K DIE,DA,DR
  1. Q
  1. COUNT ;EP
  1. W !!
  1. S DIR(0)="S^T:Total Count Only;S:Sub-counts and Total Count;D:Detailed Activity Record Listing"
  1. S DIR(0)=DIR(0)_";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 BNIGQUIT=1 Q
  1. S BNIGCTYP=Y
  1. S DA=BNIGRPT,DR=".05///"_BNIGCTYP,DIE="^BNIRTMP(" D ^DIE
  1. K DIE,DA,DR
  1. I BNIGCTYP="T" S $P(^BNIRTMP(BNIGRPT,0),U,5)="T" S BNIGSORT=1,BNIGSORV="Activity Date" Q
  1. I BNIGCTYP="D" D PRINT Q:$D(BNIGQUIT) D SORT Q
  1. I BNIGCTYP="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 BNIGQUIT=1 Q
  1. .I 'Y S BNIGQUIT=1 Q
  1. .D PRINT Q:$D(BNIGQUIT) S $P(^BNIGRTMP(BNIGRPT,0),U,5)="F" D Q:$D(BNIGQUIT)
  1. .D SORT
  1. .D DELIMIT
  1. .I BNIGDELT="" S BNIGQUIT=1
  1. D SORT
  1. Q
  1. PRINT ;
  1. S BNIGCNTL="P"
  1. D ^BNIGVL4
  1. Q
  1. SORT ;EP
  1. K BNIGSORT,BNIGSORV,BNIGQUIT
  1. I BNIGCTYP="D"!(BNIGCTYP="L"),'$D(^BNIRTMP(BNIGRPT,12)) W !!,"NO PRINT FIELDS SELECTED!!",$C(7),$C(7) S BNIGQUIT=1 Q
  1. S BNIGSORT=""
  1. D SHOWR^BNIGVLS
  1. S BNIGCNTL="R" D ^BNIGVL4 K BNIGCNTL
  1. I '$D(BNIGSORV) S BNIGQUIT=1 Q
  1. Q:BNIGCTYP'="D"
  1. PAGE ;
  1. K BNIGSPAG
  1. Q:BNIGCTYP'="D"
  1. S DIR(0)="Y",DIR("A")="Do you want a separate page for each "_BNIGSORV,DIR("B")="N" D ^DIR K DIR S:$D(DUOUT) DIRUT=1
  1. I $D(DIRUT) G SORT
  1. S BNIGSPAG=Y,DIE="^BNIRTMP(",DA=BNIGRPT,DR=".04///"_BNIGSPAG D ^DIE K DA,DR,DIE
  1. Q
  1. FLAT ;
  1. S BNIGFILE="BNIG"_DUZ_"."
  1. S X2=$E(DT,1,3)_"0101",X1=DT D ^%DTC S BNIGJD=X+1
  1. S BNIGFILE=BNIGFILE_BNIGJD
  1. W !!,"I am going to create a file called ",BNIGFILE," which will reside in ",!,"the ",$S($P(^AUTTSITE(1,0),U,21)=1:"/usr/spool/uucppublic",1:$P($G(^AUTTSITE(1,2)),U))," directory.",!
  1. W "Actually, the file will be placed in the same directory that the data export"
  1. W !,"globals are placed. See your site manager for assistance in finding the file",!,"after it is created. PLEASE jot down and remember the following file name:",!?15,"********** ",BNIGFILE," **********",!
  1. W "It may be several hours (or overnight) before your report and flat file are ",!,"finished.",!
  1. W !,"As a reminder, the records that are generated and placed in file ",BNIGFILE,!
  1. W !,"are in a standard, pre-defined record format. For a definition of the format",!,"please see your user manual.",!
  1. S DIR(0)="Y",DIR("A")="Is everything ok? Do you want to continue?",DIR("B")="Y" K DA D ^DIR K DIR
  1. I $D(DIRUT)!(Y'=1) S BNIGQUIT=1 Q
  1. S DA=BNIGRPT,DR=".12///"_BNIGFILE,DIE="^BNIRTMP(" D ^DIE
  1. K DIE,DA,DR
  1. Q
  1. DELIMIT ;get filename for delimited output
  1. K BNIGQUIT
  1. S BNIGDELF="",BNIGDELT=""
  1. W !!,"You have selected to create a '^' delimited output file. You can have this",!,"output file created as a text file in the pub directory, ",!,"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",!,"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",DIR("A")="Select output type",DIR("B")="S" KILL DA D ^DIR KILL DIR
  1. I $D(DIRUT) G DELIMIT
  1. S BNIGDELT=Y
  1. Q:BNIGDELT="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 BNIGDELF=Y
  1. S BNIGHDIR=$S($P($G(^AUTTSITE(1,1)),U,2)]"":$P(^AUTTSITE(1,1),U,2),1:$G(^XTV(8989.3,1,"DEV")))
  1. I $G(BNIGHDIR)="" S BNIGHDIR="/usr/spool/uucppublic/"
  1. W !!,"When the report is finished your delimited output will be found in the",!,BNIGHDIR," directory. The filename will be ",BNIGDELF,".txt",!
  1. S DA=BNIGRPT,DR=".12///"_BNIGDELF,DIE="^BNIRTMP(" D ^DIE
  1. K DIE,DA,DR
  1. Q