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

SD44AUDI.m

Go to the documentation of this file.
  1. SD44AUDI ;ALB/MGD - Audit print of file 44 fields ;3/11/22
  1. ;;5.3;Scheduling;**568,616,809**;Aug 13, 1993;Build 10
  1. ;;Per VHA Directive 6402, this routine should not be modified
  1. ;
  1. EN ;entry point from option
  1. ;Init variables and sort array
  1. N QFLG,SORT,SDX,SDNAM,SDSD,SDED,SDDT,SDNAME,SDST,SDSEQ,STCODE,D0,SDXPORT ;616
  1. ;
  1. S QFLG=0
  1. W !!,"This option prints a log of the changes made to Clinic Locations"
  1. ;
  1. ;Get sort
  1. D GETSORT Q:QFLG
  1. D DTRNG Q:QFLG
  1. S SDXPORT=$$EXPORT Q:SDXPORT=-1 ;616
  1. I '$G(SDXPORT) W !!,"** REPORT REQUIRES 132 COLUMNS TO PRINT CORRECTLY **" ;616
  1. D PRINT
  1. Q
  1. GETSORT ;Prompt for sorting order for report
  1. N DIR,X,Y,DIRUT
  1. S DIR(0)="SO^1:USER NAME;2:DATE CHANGED"
  1. S DIR("A")="Select sort for Clinic Edit Log",DIR("B")=1
  1. D ^DIR
  1. I $D(DIRUT) S QFLG=1 Q
  1. S SORT=Y
  1. Q
  1. PRINT ;Print report using fileman EN1^DIP
  1. N L,DIR,DIC,DIA,FLDS,DHD,BY,FR,TO,DIOBEG,SDFIL,PG,SDFLG,IOP ;616
  1. S SDFIL=44,SDFLG=0
  1. S L=0,DIC="^DIA("_SDFIL_"," S DIOBEG=$S('$G(SDXPORT):"I $E(IOST,1,2)=""C-"" W @IOF",1:"W ""USER NAME^DATE/TIME CHANGED^CLINIC IEN^CLINIC NAME^FIELD NAME^OLD VALUE^NEW VALUE""")
  1. I '$G(SDXPORT) D ;616
  1. .S FLDS=".04;L23,.02;C25;L20,D CLINIEN^SD44AUDI;C47;L10,D CLINM^SD44AUDI;C59;L30," ;616
  1. .S FLDS=FLDS_"1.1;C91;L10,D STCODE^SD44AUDI(2);C102;L30"
  1. .S FLDS(1)="D STCODE^SD44AUDI(3);C102;L30"
  1. I $G(SDXPORT) S FLDS=".04;X,""^"",.02;X,""^"",D CLINIEN^SD44AUDI;X,""^"",D CLINM^SD44AUDI;X,""^"",1.1;X;L40,""^"",D STCODE^SD44AUDI(2);X,""^"",D STCODE^SD44AUDI(3);X"
  1. S DHD=$S('$G(SDXPORT):"W ?0 D RPTHDR^SD44AUDI",1:"@@") ;616
  1. I SORT=1 D
  1. .S BY=".04,.02",FR="A,"_SDSD,TO="Zz,"_SDED
  1. I SORT=2 D
  1. .S BY=".02,.04",FR=SDSD_",A",TO=SDED_",Zz"
  1. I $G(SDXPORT) D EXPDISP Q:IOP="^" ;616
  1. D EN1^DIP
  1. I 'SDFLG,'$D(^DIA(SDFIL)) D
  1. .W !,"NO RECORDS FOUND"
  1. .I $E(IOST,1,2)="C-",'$G(SDXPORT) S DIR(0)="E" D ^DIR ;616
  1. I $G(SDXPORT) D ;616
  1. .W !!,"Turn off your logging..."
  1. .W !,"...Then, pull your export text file into your spreadsheet.",!
  1. .S DIR(0)="E",DIR("A")="Press any key to continue" D ^DIR
  1. .D HOME^%ZIS
  1. Q
  1. ;
  1. CLINM ;Clinic name
  1. I $G(X) D
  1. . W $E($P($G(^SC(+X,0)),"^"),1,30)
  1. Q
  1. CLINIEN ;section added in 616
  1. W +X Q
  1. ;
  1. SEQ ;retain sequence number
  1. S SDST=0 I $G(D0) D
  1. . S SDSEQ=D0
  1. . I $D(^DIA(44,SDSEQ,0)) D
  1. . I $P(^DIA(44,SDSEQ,0),"^",3)=8!($P(^(0),"^",3)=2503) D
  1. . . S SDST=1
  1. Q
  1. STCODE(FLD) ;Get AMIS Stop Code #
  1. D SEQ
  1. D
  1. . I '$D(^DIA(44,D0,FLD)) S STCODE="" Q
  1. . I SDST=1 D
  1. . . S STCODE=$S(FLD=2:$P($G(^DIA(44,D0,2.1)),U),1:$P($G(^DIA(44,D0,3.1)),U))
  1. . . I $D(^DIC(40.7,+STCODE,0)) S STCODE=$P(^DIC(40.7,STCODE,0),"^",2)
  1. . . ;if stcode name has been changed then just print free txt
  1. . . I STCODE="" S STCODE=^DIA(44,D0,FLD)
  1. . . W $E(STCODE,1,18)
  1. . E D
  1. . . W $E(^DIA(44,D0,FLD),1,30)
  1. Q
  1. RPTHDR ;report header
  1. N LN
  1. S PG=$G(PG)+1,SDFLG=1
  1. W "CLINIC EDIT LOG ",?115,"Page ",PG,!
  1. W "Printed on ",$$HTE^XLFDT($H)," for ",SDSD," to ",SDED,!
  1. W "USER NAME",?24,"DATE/TIME CHANGED",?46,"CLINIC IEN",?58
  1. W "CLINIC NAME",?90,"FIELD NAME",?101,"OLD VALUE",!,?101,"NEW VALUE",!
  1. S $P(LN,"-",130)="" W LN,!
  1. Q
  1. DTRNG ;report date range
  1. N %DT,ECDT,X,Y
  1. DTREP S %DT="AEX",%DT("A")="Starting with Date: ",%DT(0)="-NOW" D ^%DT
  1. I Y<0 S QFLG=1 Q
  1. S SDDT=Y,SDSD=$$FMTE^XLFDT(Y,2)
  1. S %DT="AEX",%DT("A")="Ending with Date: ",%DT(0)="-NOW" D ^%DT
  1. I Y<0 S QFLG=1 Q
  1. I Y<SDDT D G DTREP
  1. .W !!,"The ending date cannot be earlier than the starting date.",!
  1. I $E(Y,1,5)'=$E(SDDT,1,5) D G DTREP
  1. .W !!,"Beginning and ending dates must be in the same month and year.",!
  1. S SDED=$$FMTE^XLFDT(Y,2)
  1. Q
  1. EXPORT() ;Function indicates if report output is going to a device or to the screen in exportable format - API added in patch 616
  1. N DIR,DIRUT,DTOUT,DUOUT,DIROUT,X,Y,VAL
  1. W !
  1. S DIR("?",1)="Enter yes if you want the data to be displayed in an '^' delimited format",DIR("?")="that can be captured for exporting."
  1. S DIR(0)="SA^Y:YES;N:NO",DIR("B")="NO",DIR("A")="Do you want the output in exportable format? "
  1. D ^DIR
  1. S VAL=$S($D(DIRUT):-1,Y="N":0,1:1)
  1. I VAL=1 W !!,"Gathering data for export..."
  1. Q VAL
  1. ;
  1. EXPDISP ;Displays report in exportable format. API added in patch 616
  1. N I,%ZIS,POP,DIR,DTOUT,DIRUT,X,Y,DUOUT,ION
  1. W !!,"To ensure all data is captured during the export:"
  1. W !!,"1. Select 'Logging...' from the File Menu. Select your file, and where to save."
  1. W !,"2. On the Setup menu, select 'Display...',then 'screen' tab and modify 'columns'",!," setting to at least 225 characters."
  1. W !,"3. The DEVICE input for the columns should also contain a large enough",!," parameter (e.g. 225). The DEVICE prompt is defaulted to 0;225;99999 for you.",!," You may change it if need be."
  1. W !,"Example: DEVICE: 0;225;99999 *Where 0 is your screen, 225 is the margin width",!?17,"and 99999 is the screen length."
  1. W !!,"NOTE: In order for all number fields, such as SSN and Feeder Key, to be",!,"displayed correctly in the spreadsheet, these fields must be formatted as Text",!,"when importing the data into the spreadsheet.",!
  1. S %ZIS="N",%ZIS("B")="0;225;99999" D ^%ZIS S:POP IOP="^" S:'POP IOP=ION_";"_$G(IOM)_";"_$G(IOSL)