| 1 | PRCG237Q ;WISC/BGJ - IFCAP 442 FILE CLEANUP (QUEUE); 11/8/99 2:07pm ;9/20/00  13:00
 | 
|---|
| 2 | V ;;5.1;IFCAP;**95**;Oct 20, 2000
 | 
|---|
| 3 |  ;Per VHA Directive 10-93-142, this routine should not be modified.
 | 
|---|
| 4 |  ;This routine is installed by patch PRC*5*237.
 | 
|---|
| 5 |  ;This routine creates entries in file 443.1 for background processing
 | 
|---|
| 6 |  ;by PurgeMaster.  Entries are created for file 442.  Routine PRCG237P
 | 
|---|
| 7 |  ;will be utilized by PurgeMaster to actually purge the entries in file
 | 
|---|
| 8 |  ;442.
 | 
|---|
| 9 |  ;
 | 
|---|
| 10 |  W @IOF,!
 | 
|---|
| 11 |  D MSG
 | 
|---|
| 12 |  S %A="Are you ready to continue",%A(0)="!",%=1
 | 
|---|
| 13 |  D ^PRCFYN Q:%'=1
 | 
|---|
| 14 |  S PRCF("X")="AS" D ^PRCFSITE G OUT:'%
 | 
|---|
| 15 |  D NOW^%DTC K %H,%,%I
 | 
|---|
| 16 |  S CFY=$E(X,1,3)+1700,CFY=$S(+$E(X,4,5)>9:CFY+1,1:CFY)
 | 
|---|
| 17 |  S PFY=CFY-1700-1_"0930"
 | 
|---|
| 18 |  S X="Date/Fiscal Year thru which AR and other documents in file 442 will be purged."
 | 
|---|
| 19 |  D DATE
 | 
|---|
| 20 |  I +OUT G OUT
 | 
|---|
| 21 |  I $E(Y,4,7)="0000" S Y=$E(Y,1,3)_"0930"
 | 
|---|
| 22 |  S PRC("DATE")=Y
 | 
|---|
| 23 |  K OUT
 | 
|---|
| 24 | DQ ;
 | 
|---|
| 25 |  I $D(ZTQUEUED) S ZTREQ="@"
 | 
|---|
| 26 |  F I=1:1 S X=$T(LOAD+I) Q:$P(X,";",3)=""  D
 | 
|---|
| 27 |  . S FILE(I)=$P(X,";",3),GLO(I)=$P(X,";",4),REF(I)=$P(X,";",5),ADDVAR(I)=$P(X,";",6)
 | 
|---|
| 28 |  S N=0,TREC=0
 | 
|---|
| 29 |  F  S N=$O(GLO(N)) Q:'N  D
 | 
|---|
| 30 |  . S X="S REC(N)=$P("_GLO(N)_"0),U,4)" X X S TREC=TREC+REC(N)
 | 
|---|
| 31 |  S OGET=TREC\1000+1
 | 
|---|
| 32 |  S MESSAGE="CREATING PURGEMASTER ENTRIES FOR FILE CLEANUP"
 | 
|---|
| 33 |  D BEGIN^PRCGU
 | 
|---|
| 34 |  S LEVEL=0
 | 
|---|
| 35 |  F  S LEVEL=$O(GLO(LEVEL)) Q:LEVEL=""  D
 | 
|---|
| 36 |  . S GLO=GLO(LEVEL),REF=REF(LEVEL),ADDVAR=""
 | 
|---|
| 37 |  . S:ADDVAR(LEVEL)]"" @("ADDVAR="_ADDVAR(LEVEL))
 | 
|---|
| 38 |  . S NEXT=0
 | 
|---|
| 39 |  . F  D  S XCOUNT=XCOUNT+COUNT D PERCENT^PRCGU Q:'NEXT
 | 
|---|
| 40 |  . . S COUNT=0
 | 
|---|
| 41 |  . . F  D  Q:'NEXT!(COUNT>LREC)
 | 
|---|
| 42 |  . . . S GET=($S((LREC-COUNT)>OGET:OGET,1:(LREC-COUNT)+2))-1
 | 
|---|
| 43 |  . . . I GET<1 S GET=1
 | 
|---|
| 44 |  . . . D GET
 | 
|---|
| 45 |  . . . Q:'NEXT
 | 
|---|
| 46 |  . . . S COUNT=COUNT+ICOUNT
 | 
|---|
| 47 |  . . . S Z="",ROUTINE=REF_"^PRCG237P",VARIABLE=BEGDA_"-"_ENDA_";"_PRC("SITE")
 | 
|---|
| 48 |  . . . I ADDVAR]"" S VARIABLE=VARIABLE_";"_ADDVAR
 | 
|---|
| 49 |  . . . D ADD^PRCGPM1(ROUTINE,VARIABLE,.Z)
 | 
|---|
| 50 |  D CLN4406
 | 
|---|
| 51 |  D END^PRCGU
 | 
|---|
| 52 |  ;
 | 
|---|
| 53 | OUT ;
 | 
|---|
| 54 |  K A,ADDVAR,ATERM,BEGDA,BTIME,CFY,COUNT,CURSOR,DX,DY,ENDA,FILE,GET,GLO,HOURS,ICOUNT,LEVEL,LINE,LREC,MIN,NEXT,OGET,OUT,PERCENT,PFY,REC,REF,ROUTINE,RTIME,SEC,TIME,TREC,TTIME,VARIABLE,X,XCOUNT,XPOS,Y,Z,PRC
 | 
|---|
| 55 |  D KILL^%ZISS
 | 
|---|
| 56 |  Q
 | 
|---|
| 57 | GET ;
 | 
|---|
| 58 |  S (BEGDA,ENDA)=NEXT+1,ICOUNT=1
 | 
|---|
| 59 |  S @("NEXT=$O("_GLO_"NEXT))")
 | 
|---|
| 60 |  I 'NEXT S NEXT="" Q
 | 
|---|
| 61 |  S BEGDA=NEXT,(NEXT,ENDA)=NEXT+GET,ICOUNT=ENDA-BEGDA+1
 | 
|---|
| 62 |  Q
 | 
|---|
| 63 | MSG ;
 | 
|---|
| 64 |  S X="This will schedule records in file 442 for review in the "
 | 
|---|
| 65 |  S X=X_"background by PurgeMaster (file 443.1 will be populated).  "
 | 
|---|
| 66 |  S X=X_"Accounts Receivable documents in file 442 will be purged by "
 | 
|---|
| 67 |  S X=X_"PurgeMaster based on the date that you will enter.  Any "
 | 
|---|
| 68 |  S X=X_"document in file 442 without a P.O. DATE will also be purged "
 | 
|---|
| 69 |  S X=X_"based on the date you enter and the date in the DATE P.O. "
 | 
|---|
| 70 |  S X=X_"ASSIGNED field in file 442."
 | 
|---|
| 71 |  D MSG^PRCFQ W !
 | 
|---|
| 72 |  S X="The date you are about to enter MUST be confirmed with A&MM "
 | 
|---|
| 73 |  S X=X_"or Fiscal staff.  FAILURE TO DO SO MAY RESULT IN DATA "
 | 
|---|
| 74 |  S X=X_"CORRUPTION." D MSG^PRCFQ W $C(7),$C(7),$C(7)
 | 
|---|
| 75 |  Q
 | 
|---|
| 76 | DATE ;Select fiscal year
 | 
|---|
| 77 |  S DIR(0)="DA^:"_PFY_":EA"
 | 
|---|
| 78 |  S DIR("A")="Select DATE/FISCAL YEAR: "
 | 
|---|
| 79 |  S DIR("A",1)=X
 | 
|---|
| 80 |  S DIR("?")="You may only select for purging those documents which are not in the current Fiscal Year."
 | 
|---|
| 81 |  D ^DIR
 | 
|---|
| 82 |  S OUT=$G(DTOUT)_$G(DUOUT)_$G(DIRUT)_$G(DIROUT)
 | 
|---|
| 83 |  K DTOUT,DUOUT,DIRUT,DIROUT,DIR
 | 
|---|
| 84 |  Q
 | 
|---|
| 85 | CLN4406 ;add line to delete
 | 
|---|
| 86 |  S MYHLD=0,MYCOUNT=0,THISCNT=0
 | 
|---|
| 87 |  F  S MYHLD=$O(^PRC(443.1,MYHLD)) Q:'MYHLD  S MYCOUNT=MYHLD
 | 
|---|
| 88 |  S LAST=MYCOUNT+1
 | 
|---|
| 89 |  S X="START^PRCCL406"
 | 
|---|
| 90 |  S THISCNT=$P(^PRC(443.1,0),U,4)
 | 
|---|
| 91 |  S Y=""
 | 
|---|
| 92 |  S:X'["^" X="^"_X
 | 
|---|
| 93 |  I '$D(^PRC(443.1,LAST)) S ^PRC(443.1,LAST,0)=LAST_"^"_X_"^"_Y,$P(^PRC(443.1,0),"^",3,4)=(LAST_"^"_(THISCNT+1))
 | 
|---|
| 94 |  K MYHLD,MYCOUNT,THISCNT
 | 
|---|
| 95 |  Q
 | 
|---|
| 96 | LOAD ;
 | 
|---|
| 97 |  ;;442;^PRC(442,;442;PRC("DATE")
 | 
|---|
| 98 |  ;;;
 | 
|---|