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