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

IVMUPUR.m

Go to the documentation of this file.
  1. IVMUPUR ;ALB/CPM - PURGE IVM TRANSMISSION RECORDS ; 22-MAY-94
  1. ;;Version 2.0 ; INCOME VERIFICATION MATCH ;; 21-OCT-94
  1. ;;Per VHA Directive 10-93-142, this routine should not be modified.
  1. ;
  1. EN ; Queue job to purge IVM Transmissions from file #301.6
  1. ;
  1. I $$NODUZ() G ENQ
  1. ;
  1. S IVMPYR=1699+$E(DT,1,3)
  1. ;
  1. W !!,"This option is used to purge data from the IVM TRANSMISSIONS (#301.6) file."
  1. W !,"Entries in this file will only be purged for corresponding case records"
  1. W !,"in the IVM PATIENT (#301.5) file which have been closed."
  1. ;
  1. W !!,"You will purge transmission records for an entire income year's worth of cases."
  1. W !,"However, you must select an income year prior to the year which corresponds"
  1. W !,"to the current year's Means Tests. Since this year's Means Tests are based"
  1. W !,"on ",IVMPYR," income, you must select an income year prior to ",IVMPYR,".",!!
  1. ;
  1. SEL ; - select an income year prior to that which current MT's are based
  1. S %DT("A")="Select the Income Year for which to purge transmissions: "
  1. S %DT(0)=2860000,%DT="AE" D ^%DT K %DT G:$D(DTOUT)!(Y<0) ENQ
  1. I $E(Y,1,3)+1700'<IVMPYR W !!,"Invalid year entered. Enter a year prior to ",IVMPYR,".",! G SEL
  1. S IVMYR=$E(Y,1,3)_"0000"
  1. ;
  1. ; - okay to task off the job?
  1. I $$OKAY D TASK
  1. ;
  1. ENQ K IVMPYR,IVMYR
  1. Q
  1. ;
  1. ;
  1. NODUZ() ; Check for the existence of DUZ
  1. ; Input: NONE
  1. ; Output: 0 -- has DUZ, 1 -- no DUZ
  1. N Y
  1. I '$G(DUZ) S Y=1 W !!,"Your DUZ code must be defined in order to use this option.",!
  1. Q +$G(Y)
  1. ;
  1. OKAY() ; Okay to queue this job?
  1. ; Input: NONE
  1. ; Output: 0 -- No, not okay, 1 -- Yes, okay to continue
  1. N DIR,DIRUT,DUOUT,DTOUT,Y
  1. S DIR(0)="Y",DIR("A")="Is it okay to queue this job"
  1. S DIR("?",1)="Enter: 'Y' if you wish to task off this job, or"
  1. S DIR("?")=" 'N' or '^' to quit this option." W ! D ^DIR
  1. Q $S($D(DIRUT)!($D(DUOUT))!($D(DTOUT)):0,1:Y)
  1. ;
  1. TASK ; Task off the job.
  1. S ZTRTN="DQ^IVMUPUR",ZTSAVE("IVMYR")="",ZTIO=""
  1. S ZTDESC="IVM - PURGE IVM TRANSMISSION RECORDS"
  1. D ^%ZTLOAD W !!,$S($D(ZTSK):"This job has been queued. The task number is "_ZTSK_".",1:"Unable to queue this job.")
  1. K ZTSK
  1. Q
  1. ;
  1. ;
  1. ;
  1. DQ ; Tasked entry point to purge transmission data.
  1. ; Input: IVMYR -- Income year for which to purge data
  1. ;
  1. S (IVMCNTT,IVMCNTV,IVMCNTP)=0
  1. D NOW^%DTC S IVMSTART=%
  1. ;
  1. ; - do the purge and collect statistics
  1. S DFN="" F S DFN=$O(^IVM(301.5,"AYR",IVMYR,DFN)) Q:'DFN D
  1. .S IVMDA=0 F S IVMDA=$O(^IVM(301.5,"AYR",IVMYR,DFN,IVMDA)) Q:'IVMDA D
  1. ..S IVMCNTT=IVMCNTT+1
  1. ..Q:'$P($G(^IVM(301.5,IVMDA,0)),"^",4) ; case is still active
  1. ..S IVMCNTV=IVMCNTV+1
  1. ..;
  1. ..; - delete all transmissions for the closed case
  1. ..S IVMTR=0 F S IVMTR=$O(^IVM(301.6,"B",IVMDA,IVMTR)) Q:'IVMTR D
  1. ...S IVMCNTP=IVMCNTP+1
  1. ...S DIK="^IVM(301.6,",DA=IVMTR D ^DIK
  1. ;
  1. D NOW^%DTC S IVMEND=%
  1. ;
  1. ; - send a mail message with the results
  1. S XMSUB="COMPLETED PURGE OF IVM TRANSMISSION RECORDS"
  1. S XMDUZ="INCOME VERIFICATION MATCH PACKAGE"
  1. S XMTEXT="IVMTXT("
  1. S XMY(DUZ)=""
  1. ;
  1. S IVMTXT(1)="The purge of data from the IVM TRANSMISSIONS (#301.6) file has completed."
  1. S IVMTXT(2)=" "
  1. S IVMTXT(3)=" Job Start Date/Time: "_$$DAT2^IVMUFNC4(IVMSTART)
  1. S IVMTXT(4)=" Job End Date/Time: "_$$DAT2^IVMUFNC4(IVMEND)
  1. S IVMTXT(5)=" "
  1. S IVMTXT(6)=" "
  1. S IVMTXT(7)=" Income Year: "_($E(IVMYR,1,3)+1700)
  1. S IVMTXT(8)=" "
  1. S IVMTXT(9)=" Total number of case file records checked: "_IVMCNTT
  1. S IVMTXT(10)=" Number of closed case records found: "_IVMCNTV
  1. S IVMTXT(11)=" Number of IVM TRANSMISSION records deleted: "_IVMCNTP
  1. ;
  1. ; - deliver and quit
  1. D ^XMD
  1. ;
  1. I $D(ZTQUEUED) S ZTREQ="@"
  1. K DA,DFN,DIK,IVMSTART,IVMEND,IVMYR,IVMDA,IVMTR,IVMTXT,IVMCNTT,IVMCNTP,IVMCNTV
  1. K XMSUB,XMDUZ,XMY,XMTEXT
  1. Q