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

BLRRFILE.m

Go to the documentation of this file.
BLRRFILE ; IHS/DIR/FJE - REFILES ENTRY IN IHS LAB TX LOG ; [ 07/30/2002  8:45 AM ]
 ;;5.2;LR;**1013**;JUL 30, 2002
CTL ;
 D INIT
 D SEQ1 Q:BLRDONE
 D:'BLRDONE TEMP
 D KILL
 Q
 ;
INIT ;
 S BLR="",BLRPCC=$G(BLRPCC) I BLRPCC'="" S BLRHDR="WITH PCC ERRORS" S:BLRPCC'="ALL" BLRHDR=BLRHDR_" CONTAINING "_BLRPCC
 I '$D(IOF) S IOP="HOME" D ^%ZIS K IOP
 Q
 ;
ASKSEQS ;
 S DIC("A")="START WITH SEQUENCE NUMBER: ",DIC("B")=1 D ASKSEQ Q:'BLRDONE  S BLRFIRST=+Y
ASKSEQS1 S DIC("A")="GO TO SEQUENCE NUMBER: ",DIC("B")=$P(^BLRTXLOG(0),U,3)
 D ASKSEQ Q:'BLRDONE
 I Y<BLRFIRST W "LAST must be greater than START !" G ASKSEQS1
 S BLRLAST=+Y
 Q
 ;
SEQ ;
 D SEQ1,KILL
 Q
 ;
SEQ1 ;
 D ASKSEQ Q:'BLRDONE
 S BLRLOGDA=+Y D SHOW
 Q
 ;
ASKSEQ ;
 S BLRDONE=0
 S DIC=9009022,DIC(0)="AQEM" D ^DIC Q:Y<1
 S BLRDONE=1
 Q
 ;
SHOW K DA,DR S DA=BLRLOGDA D EN^DIQ
 W !!,"Do you wish to try and refile this entry?",!
 S DIR(0)="Y",DIR("A")="Enter Yes or No",DIR("B")="N" D ^DIR K DIR S:$D(DUOUT) DIRUT=1
 I $D(DIRUT) W !,"Entry NOT filed",! Q
 I +Y=0 W !,"Entry NOT filed",! Q
 D TOP^BLRQUE(BLRLOGDA,0)
 Q
 ;
SORT ;
 D INIT,TEMP,KILL
 Q
 ;
PCCERR ;
 S BLRGLO="^TMP($J)"
 D INIT,ASKSEQS I BLRDONE D CHECK D ASKQUE:BLRFND
 D KILL
 K ^TMP($J)
 Q
 ;
TEMP ;
 ; Ask for template
 ;
 S BLRGLO="^DIBT(BLRTMP,1)",DIC=.401,DIC(0)="AQEMZ" D ^DIC Q:Y<1
 I $P(Y(0),U,4)'=9009022 W !!,"Template must read IHS Lab Transaction Log! (File #9009022)",! G TEMP
 S BLRTMP=+Y
 D ASKQUE
 Q
 ;
CHECK ;
 S BLRFND=0,BLRN=$S($G(BLRFIRST):BLRFIRST-1,1:0)
 F  S BLRN=$O(^BLRTXLOG(BLRN)) Q:$S('BLRN:1,BLRLAST:BLRN>BLRLAST)  D
 .S BLRERR=$P($G(^BLRTXLOG(BLRN,1)),U,6)
 .I BLRPCC="ALL" S:BLRERR'="" BLRFND=1,^TMP($J,BLRN)="" Q
 .S:BLRERR[BLRPCC BLRFND=1,^TMP($J,BLRN)=""
 W:'BLRFND !,"No Matches found",!
 Q
 ;
ASKQUE ;
 D HDR
 S BLRN=0 F  S BLRN=$O(@BLRGLO@(BLRN)) Q:'BLRN  W BLRN,?$X+10\10*10 I $X>70 W !  I $Y#20=0 W !,"Press enter to continue: " R BLR:10,! Q:BLR="^"  D HDR
 I BLR="^" W "request aborted",! Q
 W !!,"Do you wish to Queue these entries for processing?",!
 S DIR(0)="Y",DIR("A")="Enter Yes or No",DIR("B")="N" D ^DIR K DIR S:$D(DUOUT) DIRUT=1
 I +Y=0 W !,"Entries NOT Queued",! Q
 S BLRN=0 F  S BLRN=$O(@BLRGLO@(BLRN)) Q:'BLRN  D TOP^BLRQUE(BLRN)
 Q
 ;
HDR ;
 W @IOF,!,?22,"IHS LAB Transaction Sequence Numbers",! W:BLRPCC'="" ?(80-$L(BLRHDR))/2,BLRHDR,! W !
 Q
 ;
START ;STARTS LOOP FOR REFILING
 S BLRX=0 F  S BLRX=$O(^BLRTXLOG(BLRX)) Q:+BLRX=0  D ONE Q:$G(DUOUT)
 W !,"FINISHED",!! Q
 ;
ONE S BLRY=$G(^BLRTXLOG(BLRX,1))
 Q:$P(BLRY,U,6)=""
 S BLRLOGDA=BLRX,DIC="^BLRTXLOG(" D SHOW
 S BLRY=$G(^BLRTXLOG(BLRX,1))
 W:$L($P(BLRY,U,6)) !!,"ERROR** "_$P(BLRY,U,6)_" **REPORTED",*7,!!
 Q
 ;
KILL ;
 K BLR,BLRDONE,BLRERR,BLRGLO,BLRHDR,BLRLOGDA,BLRN,BLRPCC,BLRTMP,BLRX,BLRY,DA,DIC,DIR,DIRUT
 Q