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

DGMSRPT.m

Go to the documentation of this file.
  1. DGMSRPT ;ALB/LBD - Military Service Inconsistency Report; 01/05/04
  1. ;;5.3;Registration;**562,603,1015**; Aug 13,1993;Build 21
  1. ;
  1. EN ; Called from DG MS INCONSISTENCIES RPT option
  1. ; Prompt user to select to run extract or print report
  1. N DGSEL
  1. S DGSEL=$$SEL Q:'DGSEL
  1. S DGSEL="SEL"_DGSEL
  1. G @DGSEL
  1. Q
  1. ;
  1. SEL() ; Select action: Extract or Print
  1. ; INPUT: None
  1. ; OUTPUT: 1=Extract; 2=Print; 0=Quit
  1. N DIR,X,Y,DTOUT,DUOUT,DIRUT,DIROUT
  1. W !!,"Military Service Data Inconsistencies Report"
  1. W !,"============================================"
  1. S DIR(0)="S^1:Extract and Count Inconsistencies;2:Print Inconsistencies Detail Report"
  1. S DIR("A")="Enter 1 or 2"
  1. S DIR("?",1)="(1) Extract and Count Inconsistencies - selecting this option will queue a"
  1. S DIR("?",2)=" process to read through the Patient file and find records with"
  1. S DIR("?",3)=" inconsistent military service data. The inconsistencies will be"
  1. S DIR("?",4)=" totaled by category in the Military Service Data Inconsistencies Volume"
  1. S DIR("?",5)=" Report that will be sent as a mail message to the DGEN ELIGIBILITY ALERT"
  1. S DIR("?",6)=" mail group. This process must be run before the detail report can"
  1. S DIR("?",7)=" be printed, and can be rerun as necessary."
  1. S DIR("?",8)=""
  1. S DIR("?",9)="(2) Print Inconsistencies Detail Report - selecting this option will"
  1. S DIR("?",10)=" produce a detail report of the inconsistencies found for"
  1. S DIR("?",11)=" individual veterans. The report can be sorted by veteran name"
  1. S DIR("?",12)=" or SSN (terminal digits)."
  1. S DIR("?")=" "
  1. D ^DIR I 'Y!($D(DTOUT))!($D(DUOUT)) Q 0
  1. Q Y
  1. ;
  1. SEL1 ; Extract and count military service data inconsistencies from Patient
  1. ; file #2
  1. N DIR,X,Y,DTOUT,DUOUT,DIRUT,DIROUT
  1. I '$$CHK W ! S DIR(0)="E" D ^DIR Q
  1. W !!
  1. S DIR(0)="Y",DIR("A")="Queue Extract",DIR("B")="NO"
  1. D ^DIR K DIR Q:'Y!($D(DTOUT))!($D(DUOUT))
  1. K ^XTMP("DGMSRPT")
  1. D EXTQUE
  1. W ! S DIR(0)="E" D ^DIR
  1. Q
  1. SEL2 ; Print detail report of military service data inconsistencies
  1. ; extracted and stored in ^XTMP("DGMSRPT",
  1. N DIR,X,Y,DTOUT,DUOUT,DIRUT,DIROUT,DGTOT,DGBEG,DGEND,DGSRT
  1. I $P($G(^XTMP("DGMSRPT","DATE")),U,2)="" D Q
  1. .W !!,*7,"*** The Extract of Military Service Data Inconsistencies must be run"
  1. .W !," before the report can be printed."
  1. .W ! S DIR(0)="E" D ^DIR
  1. I '$$CHK W ! S DIR(0)="E" D ^DIR Q
  1. I +$G(^XTMP("DGMSRPT","MSINC","CNT","VET"))=0 W !!,*7,"There are no records to print.",! S DIR(0)="E" D ^DIR Q
  1. W !!
  1. S DIR(0)="Y",DIR("A")="Print Report",DIR("B")="YES"
  1. D ^DIR K DIR Q:'Y!($D(DTOUT))!($D(DUOUT))
  1. S DGTOT=+$G(^XTMP("DGMSRPT","MSINC","CNT","VET"))
  1. W !!,"Total veteran records to print: ",DGTOT
  1. S DGBEG=$$BEG(DGTOT) Q:'DGBEG
  1. S DGEND=$$END(DGBEG,DGTOT) Q:'DGEND
  1. S DGSRT=$$SRT Q:DGSRT=""
  1. D RPTQUE
  1. Q
  1. CHK() ; Check if extract can be tasked to run
  1. ; INPUT: None
  1. ; OUTPUT: 1=Run Extract; 0=Don't run Extract
  1. N CHK S CHK=1
  1. I $G(^XTMP("DGMSRPT","RUNNING")) D Q CHK
  1. .N ZTSK
  1. .S ZTSK=^XTMP("DGMSRPT","RUNNING") D STAT^%ZTLOAD
  1. .I ZTSK(1)=1!(ZTSK(1)=2) W !!,*7,"*** Extract is currently running or queued as task ",^XTMP("DGMSRPT","RUNNING") S CHK=0
  1. I $P($G(^XTMP("DGMSRPT","DATE")),U,2)'="" W !!,"Extract was last run ",$P(^XTMP("DGMSRPT","DATE"),U,2)
  1. Q CHK
  1. ;
  1. BEG(TOT) ; Get starting record number to print
  1. ; INPUT: TOT - Total number of veteran records to print
  1. ; OUTPUT: Y - Starting record number
  1. N DIR,X,Y,DTOUT,DUOUT,DIRUT,DIROUT
  1. I '$G(TOT) Q 0
  1. S DIR(0)="NA^1:"_TOT,DIR("A")="Print from record: ",DIR("B")=1
  1. D ^DIR I 'Y!($D(DTOUT))!($D(DUOUT)) Q 0
  1. Q Y
  1. END(BEG,TOT) ; Get ending record number to print
  1. ; INPUT: BEG - Starting record number to print
  1. ; TOT - Total number of veteran records to print
  1. ; OUTPUT: Y - Ending record number
  1. N DIR,X,Y,DTOUT,DUOUT,DIRUT,DIROUT
  1. I '$G(BEG),'$G(TOT) Q 0
  1. S DIR(0)="NA^"_BEG_":"_TOT,DIR("A")=" to record: ",DIR("B")=DGTOT
  1. D ^DIR I 'Y!($D(DTOUT))!($D(DUOUT)) Q 0
  1. Q Y
  1. SRT() ; Get sort order
  1. ; OUPUT: Y - Sort (N=Name; S=SSN)
  1. N DIR,X,Y,DTOUT,DUOUT,DIRUT,DIROUT
  1. S DIR(0)="SA^N:Name;S:SSN (Terminal digits)",DIR("A")="Sort report by Name or SSN (Terminal digits): ",DIR("B")="NAME"
  1. S DIR("?",1)="Indicate whether the report should be sorted by the"
  1. S DIR("?")="Veteran's Name or the terminal digits of the Veteran's SSN"
  1. D ^DIR I $D(DTOUT)!($D(DUOUT)) Q ""
  1. Q Y
  1. ;
  1. EXTQUE ; Queue extract task
  1. N ZTRTN,ZTDESC,ZTSK,ZTIO,ZTDTH,DIR
  1. S ZTRTN="EN^DGMSRPT1",ZTIO="",ZTDTH=""
  1. S ZTDESC="Extract Military Service Inconsistencies"
  1. D ^%ZTLOAD
  1. I $G(ZTSK) D Q
  1. .S ^XTMP("DGMSRPT","RUNNING")=ZTSK
  1. .W !,"Extract queued as task ",ZTSK
  1. .W !!,"When the process is completed a message containing the Military Service Data"
  1. .W !,"Inconsistencies Volume Report will be sent to mail group DGEN ELIGIBILITY ALERT.",!
  1. W !,*7,"Extract could not be queued!"
  1. Q
  1. ;
  1. RPTQUE ; Get report device. Queue report if requested.
  1. N POP,ZTRTN,ZTDESC,ZTSAVE,DIR,X,Y,DTOUT,DUOUT,DIRUT,DIROUT
  1. K IOP,%ZIS
  1. S %ZIS="MQ"
  1. W !
  1. D ^%ZIS I POP W !!,*7,"Report Cancelled!",! S DIR(0)="E" D ^DIR Q
  1. I $D(IO("Q")) D Q
  1. .S ZTRTN="EN^DGMSRPT2(DGBEG,DGEND,DGSRT)"
  1. .S ZTDESC="Print Military Service Inconsistencies Report"
  1. .S (ZTSAVE("DGBEG"),ZTSAVE("DGEND"),ZTSAVE("DGSRT"))=""
  1. .D ^%ZTLOAD
  1. .W !!,"Report "_$S($D(ZTSK):"Queued!",1:"Cancelled!")
  1. .W ! S DIR(0)="E" D ^DIR
  1. .D HOME^%ZIS
  1. D EN^DGMSRPT2(DGBEG,DGEND,DGSRT)
  1. D ^%ZISC
  1. Q
  1. ;
  1. MSG(DGXTMP) ; Send message with counts of inconsistencies when extract completes.
  1. ;INPUT: DGXTMP - ^XTMP global reference
  1. N DGMSG,XMDUZ,XMSUB,XMTEXT,XMY,LN,SUB,SITE
  1. S:$G(DGXTMP)="" DGXTMP="^XTMP(""DGMSRPT"",""MSINC"")"
  1. S SITE=$P($$SITE^VASITE,U,3) S:SITE="" SITE="UNKNOWN"
  1. S XMDUZ="STATION #"_SITE
  1. I $$GET1^DIQ(869.3,"1,",.03,"I")'="P" S XMDUZ=XMDUZ_" [TEST]"
  1. S XMSUB="MILITARY SERVICE DATA INCONSISTENCIES VOLUME REPORT"
  1. S (XMY(DUZ),XMY("G.DGEN ELIGIBILITY ALERT"),XMY("HECDQSUPPORT@MED.VA.GOV"))="",XMTEXT="DGMSG("
  1. S DGMSG(1)="The extract of Military Service data inconsistencies has completed"
  1. S DGMSG(2)="successfully."
  1. S DGMSG(3)=""
  1. S DGMSG(4)="Extract process started: "_$P($G(^XTMP("DGMSRPT","DATE")),U,1)
  1. S DGMSG(5)="Extract process ended: "_$P($G(^XTMP("DGMSRPT","DATE")),U,2)
  1. S DGMSG(6)=""
  1. S DGMSG(7)="Total Veterans with MS Data Inconsistencies: "_+@DGXTMP@("CNT","VET")
  1. S DGMSG(8)=""
  1. S DGMSG(9)=$$LJ^XLFSTR(" INCONSISTENCY CATEGORY",55)_$$RJ^XLFSTR("TOTAL",20)
  1. S DGMSG(10)=$$LJ^XLFSTR("",79,"=")
  1. S LN=10,SUB=""
  1. F S SUB=$O(@DGXTMP@("CNT",SUB)) Q:'SUB S LN=LN+1,DGMSG(LN)=$$LJ^XLFSTR($P(^(SUB),U,2),55)_$$RJ^XLFSTR($P(^(SUB),U,1),20)
  1. D ^XMD
  1. Q
  1. ;
  1. INIT ; Set variables and initialize array for counts
  1. S DGXTMP="^XTMP(""DGMSRPT"",""MSINC"")"
  1. S @DGXTMP@("CNT",2)="0^Branch of Service=B.E.C."
  1. S @DGXTMP@("CNT",3)="0^Branch of Service=Merchant Seaman, No WWII Service"
  1. S @DGXTMP@("CNT",4)="0^Military Service Episode Data Missing"
  1. S @DGXTMP@("CNT",5)="0^Military Service Episode Date Imprecise"
  1. S @DGXTMP@("CNT",6)="0^Military Service Episode End Date Before Start Date"
  1. S @DGXTMP@("CNT",7)="0^Military Service Episodes Overlap"
  1. S @DGXTMP@("CNT",8)="0^Combat Data Missing"
  1. S @DGXTMP@("CNT",9)="0^Combat Date Imprecise"
  1. S @DGXTMP@("CNT",10)="0^Combat Date Not Valid for Location"
  1. S @DGXTMP@("CNT",11)="0^Combat Date Not Within MSE"
  1. S @DGXTMP@("CNT",12)="0^Conflict Data Missing"
  1. S @DGXTMP@("CNT",13)="0^Conflict Date Imprecise"
  1. S @DGXTMP@("CNT",14)="0^Conflict Date Not Valid for Location"
  1. S @DGXTMP@("CNT",15)="0^Conflict Date Not Within MSE"
  1. S @DGXTMP@("CNT",16)="0^Prisoner of War Data Missing"
  1. S @DGXTMP@("CNT",17)="0^Prisoner of War Date Imprecise"
  1. S @DGXTMP@("CNT",18)="0^Prisoner of War Date Not Valid for Location"
  1. S @DGXTMP@("CNT",19)="0^Prisoner of War Date Not Within MSE"
  1. S @DGXTMP@("CNT","VET")="0^Number of Veterans with Inconsistent MS Data"
  1. Q