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

APCLVL3.m

Go to the documentation of this file.
  1. APCLVL3 ; IHS/CMI/LAB - NO DESCRIPTION PROVIDED ;
  1. ;;2.0;IHS PCC SUITE;;MAY 14, 2009
  1. ;LAB added help text to dir call
  1. ;
  1. ;
  1. TITLE ;EP
  1. Q:"FTCP"[APCLCTYP
  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 APCLQUIT=1 Q
  1. Q:Y=0
  1. S APCLLENG=$S(APCLTCW:APCLTCW-8,1:60)
  1. I Y=1 K DIR,X,Y S DIR(0)="F^3:"_APCLLENG,DIR("A")="Enter custom title",DIR("?")=" Enter from 3 to "_APCLLENG_" characters" D ^DIR K DIR
  1. G:$D(DIRUT) TITLE
  1. S APCLTITL=Y
  1. S $P(^APCLVRPT(APCLRPT,13),U,3)=APCLTITL
  1. Q
  1. SAVE ;EP
  1. Q:$D(APCLCAND) ;--- don't ask if already a pre-defined rpt
  1. Q:APCLCTYP'="D" ;--- must be a detailed report to be saved
  1. S APCLSAVE=""
  1. K DIR,X,Y S DIR(0)="Y",DIR("A")="Do you wish to SAVE this "_$S('$D(APCLEP1):"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)="9001003.8,.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 APCLNAME=Y
  1. S DIE="^APCLVRPT(",DA=APCLRPT,DR=".02////1;.03///"_APCLNAME_";.06///"_APCLPTVS_";.05///"_APCLCTYP S:$D(APCLEP1) DR=DR_";.09///"_APCLPACK 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;C:Cohort/Template Save;D:Detailed "_$S(APCLPTVS="V":"Visit",1:"Patient")_" Listing"_$S(APCLPTVS="V":";F:Flat file of Area Database formatted records",1:"")
  1. S DIR(0)=DIR(0)_$S(APCLPTVS="V":";P:Unduplicated Patient Cohort/Template",1:"")
  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 APCLQUIT=1 Q
  1. S APCLCTYP=Y
  1. I APCLCTYP="F" D FLAT Q:$D(APCLQUIT) S $P(^APCLVRPT(APCLRPT,0),U,5)="F" S:APCLPTVS="V" APCLSORT=19,APCLSORV="Visit Date" Q
  1. I APCLCTYP="T" S $P(^APCLVRPT(APCLRPT,0),U,5)="T" S:APCLPTVS="V" APCLSORT=19,APCLSORV="Visit Date" S:APCLPTVS="P" APCLSORT=1,APCLSORV="Patient Name" Q
  1. I APCLCTYP="D" D PRINT Q:$D(APCLQUIT) D SORT Q
  1. I APCLCTYP="C"&(APCLPTVS="P") D ^APCLSTMP G:$D(APCLQUIT) COUNT D Q
  1. .S $P(^APCLVRPT(APCLRPT,0),U,5)="C"
  1. .S:APCLPTVS="P" APCLSORT=1,APCLSORV="Patient Name"
  1. I APCLCTYP="C"&(APCLPTVS="V") D ^APCLSTMV G:$D(APCLQUIT) COUNT D Q
  1. .S $P(^APCLVRPT(APCLRPT,0),U,5)="C"
  1. .S:APCLPTVS="V" APCLSORT=19,APCLSORV="Visit Date"
  1. I APCLCTYP="P" D ^APCLSTMP G:$D(APCLQUIT) COUNT D Q
  1. .S $P(^APCLVRPT(APCLRPT,0),U,5)="P"
  1. .S APCLSORT=1,APCLSORV="Patient Name"
  1. .Q
  1. I APCLCTYP="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 APCLQUIT=1 Q
  1. .I 'Y S APCLQUIT=1 Q
  1. .D PRINT Q:$D(APCLQUIT) S $P(^APCLVRPT(APCLRPT,0),U,5)="F" D Q:$D(APCLQUIT)
  1. .D SORT
  1. .D DELIMIT
  1. .I APCLDELT="" S APCLQUIT=1
  1. Q:$G(APCLQUIT)
  1. D SORT
  1. Q
  1. PRINT ;
  1. S APCLCNTL="P"
  1. D ^APCLVL4
  1. Q
  1. SORT ;EP
  1. K APCLSORT,APCLSORV,APCLQUIT
  1. I APCLCTYP="D"!(APCLCTYP="L"),'$D(^APCLVRPT(APCLRPT,12)) W !!,"NO PRINT FIELDS SELECTED!!",$C(7),$C(7) S APCLQUIT=1 Q
  1. S APCLSORT=""
  1. D SHOWR^APCLVLS
  1. S APCLCNTL="R" D ^APCLVL4 K APCLCNTL
  1. I '$D(APCLSORV) S APCLQUIT=1 Q
  1. Q:APCLCTYP'="D"
  1. PAGE ;
  1. K APCLSPAG
  1. Q:APCLCTYP'="D"
  1. S DIR(0)="Y",DIR("A")="Do you want a separate page for each "_APCLSORV,DIR("B")="N" D ^DIR K DIR S:$D(DUOUT) DIRUT=1
  1. I $D(DIRUT) G SORT
  1. S APCLSPAG=Y,DIE="^APCLVRPT(",DA=APCLRPT,DR=".04///"_APCLSPAG D ^DIE K DA,DR,DIE
  1. Q
  1. FLAT ;
  1. S APCLOUTF="APCL"_DUZ_"."
  1. S X2=$E(DT,1,3)_"0101",X1=DT D ^%DTC S APCLJD=X+1
  1. S APCLOUTF=APCLOUTF_APCLJD
  1. W !!,"I am going to create a file called ",APCLOUTF," which will reside in ",!,"the ",$S($P(^AUTTSITE(1,0),U,21)=1:"/usr/spool/uucppublic",1:"C:\EXPORT")," 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,"********** ",APCLOUTF," **********",!
  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 ",APCLOUTF,!
  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 APCLQUIT=1 Q
  1. S DA=APCLRPT,DR=".12///"_APCLOUTF,DIE="^APCLVRPT(" D ^DIE
  1. K DIE,DA,DR
  1. Q
  1. DELIMIT ;get filename for delimited output
  1. K APCLQUIT
  1. S APCLDELF="",APCLDELT=""
  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) S APCLDELT="" Q
  1. S APCLDELT=Y
  1. Q:APCLDELT="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 APCLDELF=Y
  1. S APCLHDIR=$S($P($G(^AUTTSITE(1,1)),U,2)]"":$P(^AUTTSITE(1,1),U,2),1:$G(^XTV(8989.3,1,"DEV")))
  1. I $G(APCLHDIR)="" S APCLHDIR="/usr/spool/uucppublic/"
  1. W !!,"When the report is finished your delimited output will be found in the",!,APCLHDIR," directory. The filename will be ",APCLDELF,".txt",!
  1. Q