- BNIGVL3 ; IHS/CMI/LAB - general retrieval cont ;
- ;;1.0;BNI CPHD ACTIVITY DATASYSTEM;;DEC 20, 2006
- ;
- ;
- TITLE ;EP
- Q:"FTC"[BNIGCTYP
- 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
- I $D(DIRUT) S BNIGQUIT=1 Q
- Q:Y=0
- S BNIGLENG=$S(BNIGCTYP="L":60,BNIGTCW:BNIGTCW-8,1:60)
- 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
- G:$D(DIRUT) TITLE
- S BNIGTITL=Y
- Q
- SAVE ;EP
- Q:$D(BNIGCAND) ;--- don't ask if already a pre-defined rpt
- Q:BNIGCTYP'="D" ;--- must be a detailed report to be saved
- S BNIGSAVE=""
- 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
- Q:$D(DIRUT)
- Q:'Y
- 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
- G:$D(DIRUT) SAVE
- S BNIGNAME=Y
- 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
- Q
- COUNT ;EP
- W !!
- S DIR(0)="S^T:Total Count Only;S:Sub-counts and Total Count;D:Detailed Activity Record Listing"
- S DIR(0)=DIR(0)_";L:Delimited Output File for use in Excel"
- S DIR("A")=" Choose Type of Report",DIR("B")="D" D ^DIR K DIR W !!
- S:$D(DUOUT) DIRUT=1
- I $D(DIRUT) S BNIGQUIT=1 Q
- S BNIGCTYP=Y
- S DA=BNIGRPT,DR=".05///"_BNIGCTYP,DIE="^BNIRTMP(" D ^DIE
- K DIE,DA,DR
- I BNIGCTYP="T" S $P(^BNIRTMP(BNIGRPT,0),U,5)="T" S BNIGSORT=1,BNIGSORV="Activity Date" Q
- I BNIGCTYP="D" D PRINT Q:$D(BNIGQUIT) D SORT Q
- I BNIGCTYP="L" D Q
- .W !!,"You have selected to create a delimited output file, you will be"
- .W !,"asked to select the print items, the sort item and then to name the"
- .W !,"output file.",!!
- .K DIR S DIR(0)="Y",DIR("A")="Do you wish to continue",DIR("B")="Y" KILL DA D ^DIR KILL DIR
- .I $D(DIRUT) S BNIGQUIT=1 Q
- .I 'Y S BNIGQUIT=1 Q
- .D PRINT Q:$D(BNIGQUIT) S $P(^BNIGRTMP(BNIGRPT,0),U,5)="F" D Q:$D(BNIGQUIT)
- .D SORT
- .D DELIMIT
- .I BNIGDELT="" S BNIGQUIT=1
- D SORT
- Q
- PRINT ;
- S BNIGCNTL="P"
- D ^BNIGVL4
- Q
- SORT ;EP
- K BNIGSORT,BNIGSORV,BNIGQUIT
- I BNIGCTYP="D"!(BNIGCTYP="L"),'$D(^BNIRTMP(BNIGRPT,12)) W !!,"NO PRINT FIELDS SELECTED!!",$C(7),$C(7) S BNIGQUIT=1 Q
- S BNIGSORT=""
- D SHOWR^BNIGVLS
- S BNIGCNTL="R" D ^BNIGVL4 K BNIGCNTL
- I '$D(BNIGSORV) S BNIGQUIT=1 Q
- Q:BNIGCTYP'="D"
- PAGE ;
- K BNIGSPAG
- Q:BNIGCTYP'="D"
- 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
- I $D(DIRUT) G SORT
- S BNIGSPAG=Y,DIE="^BNIRTMP(",DA=BNIGRPT,DR=".04///"_BNIGSPAG D ^DIE K DA,DR,DIE
- Q
- FLAT ;
- S BNIGFILE="BNIG"_DUZ_"."
- S X2=$E(DT,1,3)_"0101",X1=DT D ^%DTC S BNIGJD=X+1
- S BNIGFILE=BNIGFILE_BNIGJD
- 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.",!
- W "Actually, the file will be placed in the same directory that the data export"
- 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," **********",!
- W "It may be several hours (or overnight) before your report and flat file are ",!,"finished.",!
- W !,"As a reminder, the records that are generated and placed in file ",BNIGFILE,!
- W !,"are in a standard, pre-defined record format. For a definition of the format",!,"please see your user manual.",!
- S DIR(0)="Y",DIR("A")="Is everything ok? Do you want to continue?",DIR("B")="Y" K DA D ^DIR K DIR
- I $D(DIRUT)!(Y'=1) S BNIGQUIT=1 Q
- S DA=BNIGRPT,DR=".12///"_BNIGFILE,DIE="^BNIRTMP(" D ^DIE
- K DIE,DA,DR
- Q
- DELIMIT ;get filename for delimited output
- K BNIGQUIT
- S BNIGDELF="",BNIGDELT=""
- 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"
- 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!!",!!
- 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
- I $D(DIRUT) G DELIMIT
- S BNIGDELT=Y
- Q:BNIGDELT="S"
- S DIR(0)="F^1:40" W !,"Enter a filename for the delimited output (no more than 40 characters)"
- S DIR("A")="Filename" KILL DA D ^DIR KILL DIR
- I $D(DIRUT) G DELIMIT
- S BNIGDELF=Y
- S BNIGHDIR=$S($P($G(^AUTTSITE(1,1)),U,2)]"":$P(^AUTTSITE(1,1),U,2),1:$G(^XTV(8989.3,1,"DEV")))
- I $G(BNIGHDIR)="" S BNIGHDIR="/usr/spool/uucppublic/"
- W !!,"When the report is finished your delimited output will be found in the",!,BNIGHDIR," directory. The filename will be ",BNIGDELF,".txt",!
- S DA=BNIGRPT,DR=".12///"_BNIGDELF,DIE="^BNIRTMP(" D ^DIE
- K DIE,DA,DR
- Q
- BNIGVL3 ; IHS/CMI/LAB - general retrieval cont ;
- +1 ;;1.0;BNI CPHD ACTIVITY DATASYSTEM;;DEC 20, 2006
- +2 ;
- +3 ;
- TITLE ;EP
- +1 IF "FTC"[BNIGCTYP
- QUIT
- +2 KILL DIR,X,Y
- SET DIR(0)="Y"
- SET DIR("A")="Would you like a custom title for this report"
- SET DIR("B")="N"
- DO ^DIR
- KILL DIR
- IF $DATA(DUOUT)
- SET DIRUT=1
- +3 IF $DATA(DIRUT)
- SET BNIGQUIT=1
- QUIT
- +4 IF Y=0
- QUIT
- +5 SET BNIGLENG=$SELECT(BNIGCTYP="L":60,BNIGTCW:BNIGTCW-8,1:60)
- +6 IF Y=1
- KILL DIR,X,Y
- SET DIR(0)="F^3:"_BNIGLENG
- SET DIR("A")="Enter custom title"
- SET DIR("?")=" Enter from 3 to "_BNIGLENG_" characters"
- DO ^DIR
- KILL DIR
- +7 IF $DATA(DIRUT)
- GOTO TITLE
- +8 SET BNIGTITL=Y
- +9 QUIT
- SAVE ;EP
- +1 ;--- don't ask if already a pre-defined rpt
- IF $DATA(BNIGCAND)
- QUIT
- +2 ;--- must be a detailed report to be saved
- IF BNIGCTYP'="D"
- QUIT
- +3 SET BNIGSAVE=""
- +4 KILL DIR,X,Y
- SET DIR(0)="Y"
- SET DIR("A")="Do you wish to SAVE this "_$SELECT('$DATA(BNIGEP1):"SEARCH/",1:"")_"PRINT/SORT logic for future use"
- SET DIR("B")="N"
- DO ^DIR
- KILL DIR
- IF $DATA(DUOUT)
- SET DIRUT=1
- +5 IF $DATA(DIRUT)
- QUIT
- +6 IF 'Y
- QUIT
- +7 KILL DIR,X,Y
- SET DIR(0)="90512.88,.03"
- SET DIR("A")="Enter NAME for this REPORT DEFINITION"
- DO ^DIR
- KILL DIR
- IF $DATA(DUOUT)
- SET DIRUT=1
- +8 IF $DATA(DIRUT)
- GOTO SAVE
- +9 SET BNIGNAME=Y
- +10 SET DIE="^BNIRTMP("
- SET DA=BNIGRPT
- SET DR=".02////1;.03///"_BNIGNAME_";.06///"_BNIGPTVS_";.05///"_BNIGCTYP
- IF $DATA(BNIGEP1)
- SET DR=DR_";.09///"_BNIGPACK
- DO ^DIE
- KILL DIE,DA,DR
- +11 QUIT
- COUNT ;EP
- +1 WRITE !!
- +2 SET DIR(0)="S^T:Total Count Only;S:Sub-counts and Total Count;D:Detailed Activity Record Listing"
- +3 SET DIR(0)=DIR(0)_";L:Delimited Output File for use in Excel"
- +4 SET DIR("A")=" Choose Type of Report"
- SET DIR("B")="D"
- DO ^DIR
- KILL DIR
- WRITE !!
- +5 IF $DATA(DUOUT)
- SET DIRUT=1
- +6 IF $DATA(DIRUT)
- SET BNIGQUIT=1
- QUIT
- +7 SET BNIGCTYP=Y
- +8 SET DA=BNIGRPT
- SET DR=".05///"_BNIGCTYP
- SET DIE="^BNIRTMP("
- DO ^DIE
- +9 KILL DIE,DA,DR
- +10 IF BNIGCTYP="T"
- SET $PIECE(^BNIRTMP(BNIGRPT,0),U,5)="T"
- SET BNIGSORT=1
- SET BNIGSORV="Activity Date"
- QUIT
- +11 IF BNIGCTYP="D"
- DO PRINT
- IF $DATA(BNIGQUIT)
- QUIT
- DO SORT
- QUIT
- +12 IF BNIGCTYP="L"
- Begin DoDot:1
- +13 WRITE !!,"You have selected to create a delimited output file, you will be"
- +14 WRITE !,"asked to select the print items, the sort item and then to name the"
- +15 WRITE !,"output file.",!!
- +16 KILL DIR
- SET DIR(0)="Y"
- SET DIR("A")="Do you wish to continue"
- SET DIR("B")="Y"
- KILL DA
- DO ^DIR
- KILL DIR
- +17 IF $DATA(DIRUT)
- SET BNIGQUIT=1
- QUIT
- +18 IF 'Y
- SET BNIGQUIT=1
- QUIT
- +19 DO PRINT
- IF $DATA(BNIGQUIT)
- QUIT
- SET $PIECE(^BNIGRTMP(BNIGRPT,0),U,5)="F"
- Begin DoDot:2
- End DoDot:2
- IF $DATA(BNIGQUIT)
- QUIT
- +20 DO SORT
- +21 DO DELIMIT
- +22 IF BNIGDELT=""
- SET BNIGQUIT=1
- End DoDot:1
- QUIT
- +23 DO SORT
- +24 QUIT
- PRINT ;
- +1 SET BNIGCNTL="P"
- +2 DO ^BNIGVL4
- +3 QUIT
- SORT ;EP
- +1 KILL BNIGSORT,BNIGSORV,BNIGQUIT
- +2 IF BNIGCTYP="D"!(BNIGCTYP="L")
- IF '$DATA(^BNIRTMP(BNIGRPT,12))
- WRITE !!,"NO PRINT FIELDS SELECTED!!",$CHAR(7),$CHAR(7)
- SET BNIGQUIT=1
- QUIT
- +3 SET BNIGSORT=""
- +4 DO SHOWR^BNIGVLS
- +5 SET BNIGCNTL="R"
- DO ^BNIGVL4
- KILL BNIGCNTL
- +6 IF '$DATA(BNIGSORV)
- SET BNIGQUIT=1
- QUIT
- +7 IF BNIGCTYP'="D"
- QUIT
- PAGE ;
- +1 KILL BNIGSPAG
- +2 IF BNIGCTYP'="D"
- QUIT
- +3 SET DIR(0)="Y"
- SET DIR("A")="Do you want a separate page for each "_BNIGSORV
- SET DIR("B")="N"
- DO ^DIR
- KILL DIR
- IF $DATA(DUOUT)
- SET DIRUT=1
- +4 IF $DATA(DIRUT)
- GOTO SORT
- +5 SET BNIGSPAG=Y
- SET DIE="^BNIRTMP("
- SET DA=BNIGRPT
- SET DR=".04///"_BNIGSPAG
- DO ^DIE
- KILL DA,DR,DIE
- +6 QUIT
- FLAT ;
- +1 SET BNIGFILE="BNIG"_DUZ_"."
- +2 SET X2=$EXTRACT(DT,1,3)_"0101"
- SET X1=DT
- DO ^%DTC
- SET BNIGJD=X+1
- +3 SET BNIGFILE=BNIGFILE_BNIGJD
- +4 WRITE !!,"I am going to create a file called ",BNIGFILE," which will reside in ",!,"the ",$SELECT($PIECE(^AUTTSITE(1,0),U,21)=1:"/usr/spool/uucppublic",1:$PIECE($GET(^AUTTSITE(1,2)),U))," directory.",!
- +5 WRITE "Actually, the file will be placed in the same directory that the data export"
- +6 WRITE !,"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," **********",!
- +7 WRITE "It may be several hours (or overnight) before your report and flat file are ",!,"finished.",!
- +8 WRITE !,"As a reminder, the records that are generated and placed in file ",BNIGFILE,!
- +9 WRITE !,"are in a standard, pre-defined record format. For a definition of the format",!,"please see your user manual.",!
- +10 SET DIR(0)="Y"
- SET DIR("A")="Is everything ok? Do you want to continue?"
- SET DIR("B")="Y"
- KILL DA
- DO ^DIR
- KILL DIR
- +11 IF $DATA(DIRUT)!(Y'=1)
- SET BNIGQUIT=1
- QUIT
- +12 SET DA=BNIGRPT
- SET DR=".12///"_BNIGFILE
- SET DIE="^BNIRTMP("
- DO ^DIE
- +13 KILL DIE,DA,DR
- +14 QUIT
- DELIMIT ;get filename for delimited output
- +1 KILL BNIGQUIT
- +2 SET BNIGDELF=""
- SET BNIGDELT=""
- +3 WRITE !!,"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"
- +4 WRITE !,"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!!",!!
- +5 SET 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"
- SET DIR("A")="Select output type"
- SET DIR("B")="S"
- KILL DA
- DO ^DIR
- KILL DIR
- +6 IF $DATA(DIRUT)
- GOTO DELIMIT
- +7 SET BNIGDELT=Y
- +8 IF BNIGDELT="S"
- QUIT
- +9 SET DIR(0)="F^1:40"
- WRITE !,"Enter a filename for the delimited output (no more than 40 characters)"
- +10 SET DIR("A")="Filename"
- KILL DA
- DO ^DIR
- KILL DIR
- +11 IF $DATA(DIRUT)
- GOTO DELIMIT
- +12 SET BNIGDELF=Y
- +13 SET BNIGHDIR=$SELECT($PIECE($GET(^AUTTSITE(1,1)),U,2)]"":$PIECE(^AUTTSITE(1,1),U,2),1:$GET(^XTV(8989.3,1,"DEV")))
- +14 IF $GET(BNIGHDIR)=""
- SET BNIGHDIR="/usr/spool/uucppublic/"
- +15 WRITE !!,"When the report is finished your delimited output will be found in the",!,BNIGHDIR," directory. The filename will be ",BNIGDELF,".txt",!
- +16 SET DA=BNIGRPT
- SET DR=".12///"_BNIGDELF
- SET DIE="^BNIRTMP("
- DO ^DIE
- +17 KILL DIE,DA,DR
- +18 QUIT