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

IBPU.m

Go to the documentation of this file.
  1. IBPU ;ALB/CPM - ARCHIVE/PURGING UTILITIES ; 20-APR-92
  1. ;;Version 2.0 ; INTEGRATED BILLING ;; 21-MAR-94
  1. ;;Per VHA Directive 10-93-142, this routine should not be modified.
  1. ;
  1. ASK(FILE,JOB) ; User prompts to find/archive/purge entries for each data file.
  1. ; Input: FILE -- Billing Data file number
  1. ; JOB -- 1 Find Billing Data to Archive
  1. ; -- 2 Archive Billing Data
  1. ; -- 3 Purge Billing Data
  1. ; Output: -1 -- Exit option
  1. ; 0 -- No action to be taken
  1. ; 1^a -- Take action.
  1. ; Optional second piece (a) is ien of
  1. ; log entry if a restart is required.
  1. N FNAME,STATUS,Y
  1. S STATUS=$$LOG($G(FILE)) I 'STATUS W !,"File #",FILE," is not defined." Q 0
  1. S FNAME=$P($G(^DIC(FILE,0)),"^")
  1. I (JOB=2&(STATUS=1))!(JOB=3&(STATUS<3)) W !,"You must ",$S(STATUS=1:"find ",1:"archive "),FNAME," entries before you can ",$S(JOB=2:"archive.",1:"purge.") Q 0
  1. S STATUS=STATUS-JOB+1
  1. Q $S(STATUS>1:$$RESTART(FNAME,FILE,JOB),1:$$START(FNAME,JOB))
  1. ;
  1. START(NAME,JOB) ; Start find/archive/purge action?
  1. ; Input: NAME -- File name
  1. ; JOB -- same as above (1, 2, or 3)
  1. ; Output: 1 -- Yes, 0 -- No, -1 -- Exit Option
  1. N DESC,DIR,DIRUT,DUOUT,DTOUT,Y
  1. S DESC=$P("find^archive^purge","^",JOB)
  1. S DIR(0)="Y",DIR("A")="Do you wish to "_DESC_" "_NAME_" file entries"
  1. S DIR("?",1)="Enter: 'Y' to "_DESC_" "_NAME_" entries"
  1. S DIR("?",2)=" 'N' to ignore "_$P("find^archiv^purg","^",JOB)_"ing "_NAME_" entries, or"
  1. S DIR("?")=" '^' to quit this option." D ^DIR
  1. Q $S($D(DIRUT)!($D(DUOUT))!($D(DTOUT)):-1,Y:1,1:0)
  1. ;
  1. RESTART(NAME,FILE,JOB) ; Re-start find/archive action?
  1. ; Input: NAME -- File name
  1. ; FILE -- Billing Data file number
  1. ; JOB -- same as above (only 1 or 2)
  1. ; Output: 1 -- Yes, 0 -- No, -1 -- Exit Option
  1. N DIR,DIRUT,DUOUT,DTOUT,Y
  1. W !,NAME," file entries have already been ",$P("found.^archived.","^",JOB)
  1. S DIR(0)="Y",DIR("A")="Do you wish to "_$S(JOB=1:"delete your search template and start",1:"archive these entries")_" again"
  1. S DIR("?",1)="Enter: 'Y' to "_$S(JOB=1:"delete your current search template and search",1:"archive entries")_" again"
  1. S DIR("?",2)=" 'N' to "_$S(JOB=1:"retain your current search template",1:"ignore archiving this file")_", or"
  1. S DIR("?")=" '^' to quit this option." D ^DIR
  1. Q $S($D(DIRUT)!($D(DUOUT))!($D(DTOUT)):-1,Y:"1^"_$$LOGIEN^IBPU1(FILE),1:0)
  1. ;
  1. LOG(FILE) ; Determine Log status for a file.
  1. ; Input: FILE -- Billing Data file number
  1. ; Output: 0 -- File undefined, or invalid file number
  1. ; 1 -- No active log entry on file
  1. ; 2 -- Active log entry on file - entries FOUND
  1. ; 3 -- Active log entry on file - entries ARCHIVED
  1. N Y,LOG,LOG1,LOG2
  1. I '$D(^DIC(+$G(FILE))) S Y=0 G LOGQ
  1. S DA=$$LOGIEN^IBPU1(FILE)
  1. S LOG=$G(^IBE(350.6,DA,0)),LOG1=$G(^(1)),LOG2=$G(^(2))
  1. I $P(LOG,"^",5)'=1 S Y=1
  1. LOGQ Q $S($D(Y):Y,$P(LOG2,"^",2):3,$P(LOG1,"^",2):2,1:1)
  1. ;
  1. NUM() ; How many previous fiscal year's worth of data should be retained?
  1. ; Input: NONE Output: number of years, or -1 to exit option.
  1. N DIR,DIRUT,DUOUT,DTOUT,Y
  1. S DIR("A")="Select the number of previous fiscal year's data to retain: "
  1. S DIR("?",1)="Please select the number of previous fiscal years' worth of billing"
  1. S DIR("?")="data that you wish to retain in your system, or '^' to exit."
  1. S DIR(0)="NA^1:20:0",DIR("B")=1 D ^DIR
  1. Q $S($D(DIRUT)!($D(DUOUT))!($D(DTOUT)):-1,1:Y)
  1. ;
  1. DAT() ; What is the date through which data should be archived?
  1. ; Input: NONE Output: final date for archiving, or -1 to exit.
  1. N %DT,DTOUT,X,Y
  1. S %DT="AEPX",%DT(0)=-$$LAST^IBPFU(1),%DT("A")="Enter the final date through which data should be archived: "
  1. D ^%DT
  1. Q Y