VistA-WorldVistAEHR/r/OCCURRENCE_SCREEN-QAO/QAOEDT2.m

64 lines
2.6 KiB
Mathematica

QAOEDT2 ;HISC/DAD-MISC EDITS ;7/26/93 12:27
;;3.0;Occurrence Screen;;09/14/1993
EN1 ; *** COMMITTEE EDIT
S QALIMIT="I $P(^(0),""^"",11)'>0",QAOSPROG="1^QAOEDT2" D EN2^QAOEDT
G EXIT
1 S QAOSWHAT="REVIEWED" D ENDISP^QAOUTL0
K DR S DIE="^QA(741,",DR="17",DR(2,741.017)=".01;4;10",DA=QAOSD0
D ^DIE S QAOSQUIT=$S($D(Y):1,1:0)
S QAUDIT("FILE")="741^27",QAUDIT("DA")=QAOSD0,QAUDIT("ACTION")="e"
S QAUDIT("COMMENT")="COMMITTEE REVIEW, OTHER THAN QA COMMITTEE"
D ^QAQAUDIT
Q
EN3 ; *** FINAL DISPOSITION
S QALIMIT="I +$P(^QA(741,+Y,0),""^"",11)=0,$O(^QA(741,+Y,""REVR"",0))"
S QAOSPROG="3^QAOEDT2" D EN2^QAOEDT G EXIT
3 S QAOSWHAT="CLOSED OUT" D ENDISP^QAOUTL0
K DR S DIE="^QA(741,",DR="14//TODAY;16;11//CLOSED",DA=QAOSD0
D ^DIE S QAOSQUIT=$S($D(Y):1,1:0)
S QAUDIT("FILE")="741^27",QAUDIT("DA")=QAOSD0,QAUDIT("ACTION")="c"
S QAUDIT("COMMENT")="CLOSE A RECORD" D ^QAQAUDIT
Q
EN4 ; *** DELETE
W !!,"Do you wish to see a list of deleted occurrences"
S %=2,LINE=1,QAOSQUIT=0 D YN^DICN Q:%=-1 G:%=2 DEL
I '% W !!?3,"Please answer Y(es) or N(o)" G EN4
W ! D WAIT^DICD W ! K ^TMP($J,"D")
F QAOSD0=0:0 S QAOSD0=$O(^QA(741,"AD",2,QAOSD0)) Q:QAOSD0'>0 D
. S LOC=^QA(741,QAOSD0,0),QAOSSCRN=+$G(^("SCRN")),QAOSWHO=+LOC
. S QAOSDATE=$P(LOC,"^",3)
. I $D(^DPT(QAOSWHO,0))#2 S QAOSWHO=$P(^(0),"^") D
.. S QAOSSCRN=+^QA(741.1,QAOSSCRN,0)
.. S ^TMP($J,"D",QAOSWHO,QAOSDATE,QAOSSCRN)=""
.. Q
. Q
I $O(^TMP($J,"D",""))="" W !?5,"*** NO DELETED OCCURRENCES FOUND ***" G DEL
S QAOSWHO="",LINE=$Y
F S QAOSWHO=$O(^TMP($J,"D",QAOSWHO)) Q:QAOSWHO=""!QAOSQUIT F QADATE=0:0 S QADATE=$O(^TMP($J,"D",QAOSWHO,QADATE)) Q:QADATE'>0!QAOSQUIT F QAOSSCRN=0:0 S QAOSSCRN=$O(^TMP($J,"D",QAOSWHO,QADATE,QAOSSCRN)) Q:QAOSSCRN'>0!QAOSQUIT D
. S Y=QADATE X ^DD("DD") W !?5,QAOSWHO,?30,Y,?50,QAOSSCRN
. Q:$Y'>(IOSL+LINE-3)
. K DIR S DIR(0)="E" D ^DIR K DIR
. S QAOSQUIT=$S(Y'>0:1,1:0),LINE=$Y
. Q
DEL ;
S QAOSPROG="DLT^QAOEDT2" D EN1^QAOEDT
G EXIT
DLT S QAOSWHAT="DELETED" D ENDISP^QAOUTL0 S (DIE,DIC)="^QA(741,"
ASKDEL W !!?5,"Delete this record (Y/N) " S %=2
D YN^DICN,YNOUT Q:%=2!QAOSQUIT
I %=0 W !!?10,"Please answer Y(es) or N(o)" G ASKDEL
S DR="11///^S X=2",DA=QAOSD0 D ^DIE
S QAUDIT("FILE")="741^27",QAUDIT("DA")=DA,QAUDIT("ACTION")="d"
S QAUDIT("COMMENT")="MARK A RECORD AS DELETED" D ^QAQAUDIT
W !!?5,"*** RECORD HAS BEEN DELETED ***",*7,!
Q
;
EXIT ;
K %,DA,DIC,DIE,DR,I,LINE,LOC,QA,QADATE,QALIMIT,QAOPCENT,QAOS,QAOSD0
K QAOSDATE,QAOSQUIT,QAOSWHAT,QAOSSCRN,QAUDIT,QAOSWHO,X,Y,QAOSTYPE
K QAOSONE,QAOSPROG
K ^TMP($J,"D")
Q
DIEOUT S QAOSQUIT=$S($D(DTOUT):1,$D(DUOUT):1,$D(Y):1,1:0) Q
YNOUT S QAOSQUIT=$S(%=-1:1,1:0) Q