[613] | 1 | ECXPHAU ;ALB/JAM - Print Pharmacy Volume Edit Log (IVP,PRE,UDP) ; 11/2/06 8:54am
|
---|
| 2 | ;;3.0;DSS EXTRACTS;**92**;Dec 22, 1997;Build 30
|
---|
| 3 | EN ;entry point from option
|
---|
| 4 | ;Init variables and sort array
|
---|
| 5 | N QFLG,SORT,ECXX,ECXNAM,ECSD,ECED
|
---|
| 6 | ;
|
---|
| 7 | S QFLG=0
|
---|
| 8 | W !!,"This option prints a log of the changes made to the Pharmacy"
|
---|
| 9 | W !,"Extracts: PRE, IVP or UDP",!
|
---|
| 10 | ;
|
---|
| 11 | ;Get Extract
|
---|
| 12 | D EXTRT Q:QFLG
|
---|
| 13 | ;Get sort
|
---|
| 14 | D GETSORT Q:QFLG
|
---|
| 15 | W !!,"** REPORT REQUIRES 132 COLUMNS TO PRINT CORRECTLY **"
|
---|
| 16 | D DTRNG Q:QFLG
|
---|
| 17 | D PRINT
|
---|
| 18 | Q
|
---|
| 19 | EXTRT ;Prompt for extract to report on
|
---|
| 20 | N DIR,DIRUT
|
---|
| 21 | S DIR(0)="SO^P:PRE;I:IVP;U:UDP"
|
---|
| 22 | S DIR("A")="Which extract log do you need?"
|
---|
| 23 | D ^DIR I $D(DIRUT) S QFLG=1 Q
|
---|
| 24 | S ECXX=Y,ECXNAM=Y(0)
|
---|
| 25 | Q
|
---|
| 26 | GETSORT ;Prompt for sorting order for report
|
---|
| 27 | N DIR,X,Y,DIRUT
|
---|
| 28 | S DIR(0)="SO^1:USER NAME;2:DATE CHANGED"
|
---|
| 29 | S DIR("A")="Select sort for Pharmacy Volume Edit Log",DIR("B")=1
|
---|
| 30 | D ^DIR
|
---|
| 31 | I $D(DIRUT) S QFLG=1 Q
|
---|
| 32 | S SORT=Y
|
---|
| 33 | Q
|
---|
| 34 | PRINT ;Print report using fileman EN1^DIP for IVP
|
---|
| 35 | N L,DIR,DIC,DIA,FLDS,DHD,BY,FR,TO,DIOBEG,ECXFIL,PG,ECXFLG
|
---|
| 36 | S ECXFIL=$S(ECXX="P":"727.81",ECXX="I":"727.819",1:"727.809"),ECXFLG=0
|
---|
| 37 | S L=0,DIC="^DIA("_ECXFIL_",",DIOBEG="I $E(IOST,1,2)=""C-"" W @IOF"
|
---|
| 38 | S FLDS=".04;L23,.02;C25;L20,.01;C47;L14,D EXTNOI^ECXPHAU;C62;L9,"
|
---|
| 39 | S FLDS=FLDS_"1.1;C74;L15,2;C90;L19,3;C110;L15"
|
---|
| 40 | S DHD="W ?0 D RPTHDR^ECXPHAU"
|
---|
| 41 | I SORT=1 D
|
---|
| 42 | .S BY=".04,.02",FR="A,"_ECSD,TO="Zz,"_ECED
|
---|
| 43 | I SORT=2 D
|
---|
| 44 | .S BY=".02,.04",FR=ECSD_",A",TO=ECED_",Zz"
|
---|
| 45 | D EN1^DIP
|
---|
| 46 | I 'ECXFLG,'$D(^DIA(ECXFIL)) D
|
---|
| 47 | .W !,"NO RECORDS FOUND"
|
---|
| 48 | .I $E(IOST,1,2)="C-" S DIR(0)="E" D ^DIR
|
---|
| 49 | Q
|
---|
| 50 | ;
|
---|
| 51 | EXTNOI ;Extract Number
|
---|
| 52 | I $G(X) W $P($G(^ECX(ECXFIL,+X,0)),"^",3)
|
---|
| 53 | Q
|
---|
| 54 | RPTHDR ;report header
|
---|
| 55 | N LN
|
---|
| 56 | S PG=$G(PG)+1,ECXFLG=1
|
---|
| 57 | W "PHARMACY VOLUME EDIT LOG FOR "_ECXNAM,?115,"Page ",PG,!
|
---|
| 58 | W "Printed on ",$$HTE^XLFDT($H)," for ",ECSD," to ",ECED,!
|
---|
| 59 | W "USER NAME",?24,"DATE/TIME CHANGED",?46,"SEQUENCE #",?61
|
---|
| 60 | W "EXTRACT #",?73,"FIELD NAME",?89,"OLD VALUE",?109,"NEW VALUE",!
|
---|
| 61 | S $P(LN,"-",130)="" W LN,!
|
---|
| 62 | Q
|
---|
| 63 | DTRNG ;report date range
|
---|
| 64 | N %DT,ECDT,X,Y
|
---|
| 65 | DTREP S %DT="AEX",%DT("A")="Starting with Date: ",%DT(0)="-NOW" D ^%DT
|
---|
| 66 | I Y<0 S QFLG=1 Q
|
---|
| 67 | S ECDT=Y,ECSD=$$FMTE^XLFDT(Y,2)
|
---|
| 68 | S %DT="AEX",%DT("A")="Ending with Date: ",%DT(0)="-NOW" D ^%DT
|
---|
| 69 | I Y<0 S QFLG=1 Q
|
---|
| 70 | I Y<ECDT D G DTREP
|
---|
| 71 | .W !!,"The ending date cannot be earlier than the starting date.",!
|
---|
| 72 | I $E(Y,1,5)'=$E(ECDT,1,5) D G DTREP
|
---|
| 73 | .W !!,"Beginning and ending dates must be in the same month and year.",!
|
---|
| 74 | S ECED=$$FMTE^XLFDT(Y,2)
|
---|
| 75 | Q
|
---|