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

ECXPLBB.m

Go to the documentation of this file.
  1. ECXPLBB ;DALOI/KML - DSS BLOOD BANK PRE-EXTRACT AUDIT REPORT ;5/31/17 16:32
  1. ;;3.0;DSS EXTRACTS;**78,92,105,136,143,149,153,156,166**;Dec 22, 1997;Build 24
  1. ;Per VA Directive 6402, this routine should not be modified. Medical Device # BK970021
  1. ;entry point from option
  1. D SETUP^ECXLBB1 I ECFILE="" Q ;149
  1. N ECXINST,ECXPORT,CNT ;149
  1. D DATES
  1. Q:ECED']""!(ECSD']"") ;149 Changed logic so it stops if either start or stop date is null
  1. S ECXPORT=$$EXPORT^ECXUTL1 Q:ECXPORT=-1 I $G(ECXPORT) D Q ;149 Section added
  1. .W !!,"This report may take a while to generate. Please be patient.",!
  1. .S ECSDN=$$FMTE^XLFDT(ECSD),ECEDN=$$FMTE^XLFDT(ECED),ECSD1=ECSD-.1
  1. .K ^TMP($J,"ECXPORT")
  1. .S ^TMP($J,"ECXPORT",0)="NAME^SSN^FEEDER LOCATION^TRANSFUSION DATE^COMPONENT^NUMBER OF UNITS",CNT=1
  1. .D START
  1. .D EXPDISP^ECXUTL1
  1. .D ^ECXKILL
  1. N ECXPOP S ECXPOP=0 D QUE Q:ECXPOP
  1. ;
  1. START ; entry point from tasked job
  1. ; get LAB DATA and build temporary global ^TMP("ECXLBB",$J)
  1. N ECTRSP,ECADMT,ECTODT,ECXRPT,ECOUT,ECXSTR,ECRDT,ECLINE,ECPG,ECQUIT
  1. N ECD,ECXDFN,ECARRY,EC66,ECERR,ECTRFDT,ECTRFTM,ECX,ECINOUT,ECXJOB
  1. N ECXLOGIC,ECXREC ;156
  1. S ECXJOB=$J
  1. K ^TMP("ECXLBB",ECXJOB)
  1. U IO
  1. I '$G(ECXPORT) I $E(IOST,1,2)="C-" W !,"Retrieving records... " ;149
  1. S ECXRPT=1 D AUDRPT^ECXLBB1 ;149
  1. OUTPUT ; entry point called by EN tag
  1. I '$D(^TMP("ECXLBB",ECXJOB)) W:'$G(ECXPORT) !,"There were no records that met the date range criteria" Q ;149
  1. S (ECPG,ECDATE,ECQUIT,ECXDFN,ECXREC)=0,ECLINE="",$P(ECLINE,"=",80)="="
  1. S ECSDN=$$FMTE^XLFDT(ECSD,9),ECEDN=$$FMTE^XLFDT(ECED,9),ECRDT=$$FMTE^XLFDT(DT,9)
  1. I '$G(ECXPORT) W:$E(IOST,1,2)="C-" @IOF D HED ;149
  1. F S ECXDFN=$O(^TMP("ECXLBB",ECXJOB,ECXDFN)) Q:'ECXDFN D Q:ECQUIT
  1. .F S ECDATE=$O(^TMP("ECXLBB",ECXJOB,ECXDFN,ECDATE)) Q:'ECDATE D Q:ECQUIT
  1. ..F S ECXREC=$O(^TMP("ECXLBB",ECXJOB,ECXDFN,ECDATE,ECXREC)) Q:'+ECXREC S ECXSTR=^(ECXREC) D PRINT Q:ECQUIT ;143,156-added additional for loop
  1. I '$G(ECXPORT) D ^ECXKILL ;149
  1. Q
  1. ;
  1. PRINT ;
  1. I $G(ECXPORT) S ^TMP($J,"ECXPORT",CNT)=$P(ECXSTR,U,5)_U_$P(ECXSTR,U,4)_U_$P(ECXSTR,U,16)_U_$$FMTE^XLFDT($$HL7TFM^XLFDT($P(ECXSTR,U,8)),2)_U_$P(ECXSTR,U,11)_U_+$P(ECXSTR,U,12),CNT=CNT+1 Q ;149
  1. I $Y+5>IOSL D Q:ECQUIT
  1. . I $E(IOST,1,2)["C-" S DIR(0)="E" D ^DIR K DIR I 'Y S ECQUIT=1 Q
  1. . W @IOF D HED
  1. W !,$P(ECXSTR,"^",5),?11,$P(ECXSTR,"^",4),?26,$P(ECXSTR,"^",16)
  1. W ?37,$$FMTE^XLFDT($$HL7TFM^XLFDT($P(ECXSTR,"^",8)),2)
  1. W ?49,$P(ECXSTR,"^",11),?60,$J(+$P(ECXSTR,"^",12),2)
  1. Q
  1. ;
  1. HED ;
  1. S ECPG=ECPG+1
  1. W !,"Laboratory Blood Bank (LBB) Pre-Extract Audit Report",?72,"Page",$J(ECPG,3) ;136,166 tjl - Changed report title
  1. W !,ECSDN," - ",ECEDN,?58,"Run Date:",$J(ECRDT,12)
  1. W !,?37,"Transf",?57,"Number"
  1. W !,"Name",?14,"SSN",?25,"FDR LOC",?37,"Date",?49,"COMP"
  1. W ?57,"of Units"
  1. W !,ECLINE
  1. Q
  1. DATES ;
  1. N OUT,CHKFLG
  1. I '$D(ECNODE) S ECNODE=7
  1. I '$D(ECHEAD) S ECHEAD=" "
  1. W @IOF,!,"Laboratory Blood Bank (LBB) Pre-Extract Audit Report Information for DSS",!! ;136,166 tjl - Changed report title
  1. ;Added descriptive text DSS FY13 Logic
  1. W !,"**NOTE: This audit can only be run prior to the LBB Extract being generated." ;136
  1. W !,"If you have already generated your LBB Extract, refer to the Processing "
  1. W !,"Guide Chapter 4 section on Regenerating.**",!
  1. S:'$D(ECINST) ECINST=+$P(^ECX(728,1,0),U)
  1. S ECXINST=ECINST
  1. K ECXDIC S DA=ECINST,DIC="^DIC(4,",DIQ(0)="I",DIQ="ECXDIC",DR=".01;99"
  1. D EN^DIQ1 S ECINST=$G(ECXDIC(4,DA,99,"I")) K DIC,DIQ,DA,DR,ECXDIC
  1. S ECLDT=$S($D(^ECX(728,1,ECNODE)):$P(^(ECNODE),U,ECPIECE),1:2610624)
  1. S:ECLDT="" ECLDT=2610624
  1. S ECOUT=0 F S (ECED,ECSD)="" D Q:ECOUT
  1. . K %DT S %DT="AEX",%DT("A")="Starting with Date: " D ^%DT
  1. . I Y<0 S ECOUT=1 Q
  1. . S ECSD=Y
  1. . K %DT S %DT="AEX",%DT("A")="Ending with Date: " D ^%DT
  1. . I Y<0 S ECOUT=1 Q
  1. . I Y<ECSD W !!,"The ending date cannot be earlier than the starting date.",!,"Please try again.",!! Q
  1. . I $E(Y,1,5)'=$E(ECSD,1,5) W !!,"Beginning and ending dates must be in the same month and year.",!,"Please try again.",!! Q
  1. . S ECED=Y
  1. . I ECLDT'<ECSD W !!,"The Blood Bank information has already been extracted through ",$$FMTE^XLFDT(ECLDT),".",!,"Please enter a new date range.",!! Q
  1. . S ECOUT=1
  1. Q
  1. ;
  1. QUE ;
  1. K ZTSAVE
  1. S ECSDN=$$FMTE^XLFDT(ECSD),ECEDN=$$FMTE^XLFDT(ECED),ECSD1=ECSD-.1
  1. K ZTSAVE
  1. F X="ECINST","ECED","ECSD","ECSD1","ECEDN","ECSDN" S ZTSAVE(X)=""
  1. F X="ECPACK","ECPIECE","ECRTN","ECGRP","ECNODE" S ZTSAVE(X)=""
  1. F X="ECFILE","ECHEAD","ECVER","ECINST","ECXINST" S ZTSAVE(X)=""
  1. F X="ECXLOGIC","ECXDATES" S ZTSAVE(X)=""
  1. S ZTDESC=ECPACK_" EXTRACT AUDIT REPORT: "_ECSDN_" TO "_ECEDN,ZTRTN="START^ECXPLBB",ZTIO="" ;149,153
  1. S IOP="Q" W ! S %ZIS="QMP" D ^%ZIS S:POP ECXPOP=1 Q:POP I $D(IO("Q")) K IO("Q"),ZTIO D ^%ZTLOAD W:$D(ZTSK) !,$C(7),"REQUEST QUEUED",!,"Task #: ",$G(ZTSK) K I,ZTSK,ZTIO,ZTSAVE,ZTRTN D HOME^%ZIS S ECXPOP=1
  1. Q
  1. ;
  1. EN(ECXJOB,ECSD,ECED) ; entry point used primarily for testing
  1. ; input:
  1. ; ECXJOB = $J that is assigned to the 2nd subscript of
  1. ; the temporary global array containing the
  1. ; extracted data that feeds the pre-extract
  1. ; audit report
  1. ; ECSD = starting date range representing the FM
  1. ; date used to retrieve data from file #63
  1. ; ECED = ending date range representing the FM date
  1. ; used to retrieve data from file #63
  1. ; syntax of the call: D EN^ECXPLBB(541571372,3000101,3000131)
  1. D OUTPUT
  1. Q
  1. ;
  1. ;ECXPLBB