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

BOPEXCP.m

Go to the documentation of this file.
BOPEXCP ;IHS/ILC/DUG -  Exception error report;06-Apr-2005 13:41;SM
 ;;1.0;AUTOMATED DISPENSING INTERFACE;;Jul 26, 2005
 ;
FIND ;find all the error exceptions and put in array
 N DIR,X,Y,X1,X2,BOPNAME,BOPDT,BOPDRUG,BOPDRGNM,BOPERR,BOPDTTM,CNT,A,BOPDFN,BOPUSER
 S DIR("A")="Enter the date to begin the Exception Report"
 S DIR("B")="T-1",DIR(0)="D" D ^DIR
 Q:Y'>0
 S (BOPNAME,BOPDT,BOPDRUG,BOPDRGNM,BOPERR,BOPUSER)="",CNT=1
 S BOPDTTM=Y S X1=Y,X2=-1 D C^%DTC S BOPDTTM=X
 F  S BOPDTTM=$O(^BOP(90355.4,"B",BOPDTTM)) Q:'BOPDTTM  D
 . S A=$O(^BOP(90355.4,"B",BOPDTTM,0))
 . S BOPDRUG=$P(^BOP(90355.4,A,0),U,8) I BOPDRUG["-" S BOPDRUG=$P(BOPDRUG,"-",2)
 . I '$D(^PSDRUG(BOPDRUG,0)) S BOPERR="Bad Drug" S BOPDRGNM=$P(^BOP(90355.4,A,0),U,12) S BOPDFN=$P(^BOP(90355.4,A,0),U,5)
 . S BOPNAME=$S(BOPDFN'="":$P($G(^DPT(BOPDFN,0)),U),1:"Invalid patient")
 . S BOPDFN=$P(^BOP(90355.4,A,0),U,5)
 . I BOPDFN="" S BOPERR="Bad Patient ID" S BOPDRGNM=$P(^BOP(90355.4,A,0),U,12)
 . I BOPDFN I '$D(^DPT(BOPDFN,0)) S BOPERR="Bad Patient ID" S BOPDRGNM=$P(^BOP(90355.4,A,0),U,12)
 . S BOPUSER="" S BOPUSER=$P(^BOP(90355.4,A,0),U,14)
 . S BOPTMP(CNT)=BOPERR_" "_$S(BOPERR["Drug":$G(BOPDRUG),1:$G(BOPDFN))_"^"_BOPDRGNM_"^"_BOPDTTM_"^"_"Pt: "_BOPNAME_"^"_"User: "_BOPUSER,CNT=CNT+1
 D ASKPR
 QUIT
 ;
 W @IOF,"TYPE OF ERROR ^ DRUG NAME ^ DATE/TIME ^ PATIENT NAME ^ USER NAME",!! Q
 ;
ASKPR ;
 S %ZIS="Q" D ^%ZIS I POP K ZTRTN,ZTDESC,POP D ^%ZISC QUIT
 I $D(IO("Q")) D  D ^%ZISC QUIT
 . S ZTRTN="PRINT^VEFCDSP1",ZTDESC="EXCEPTION REPORT"
 . D ^%ZTLOAD W:$D(ZTSK) !,"Report Queued to Print!!",! K ZTSK,IO("Q")
PRINT ;
 N CNT,ANS,STOP S STOP="" D HEADER
 S CNT=0 F  S CNT=$O(BOPTMP(CNT)) Q:'CNT  W !,BOPTMP(CNT) D  Q:STOP
 . I IOST["P" Q
 . I CNT#20=0 S DIR("A")="Enter '^' to quit, <return> to continue",DIR(0)="FO" D  Q:STOP
 . . D ^DIR K DIR I $D(DIRUT) S STOP=1 Q    ;DUGIHS 9/27/04 invoke DIR call
 . . D HEADER
 QUIT
 ;
EOR ;BOPEXCP;Exception error report