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

PRPFPURG.m

Go to the documentation of this file.
  1. PRPFPURG ;CTB/WASH-ISC@ALTOONA PATIENT FUNDS PURGE ;3/18/97 1:49 PM
  1. V ;;3.0;PATIENT FUNDS;**6,9**;JUNE 1, 1989
  1. N PERCENT,MIN,SEC,TIME,DX,DY,HOURS,TREC,LREC,LINE,DA,LASTENT,XPOS,A,BTIME,XCOUNT,COUNT,LASTARCH,PURGDATE,RETURN,LY
  1. W @IOF,!!!
  1. S %A="This program will summarize and remove entries from the Patient Funds card and",%A(1)="make a BALANCE CARRIED FORWARD entry for the summarized amount.",%A(2)="OK to Continue",%=1 D ^PRPFYN
  1. Q:%'=1
  1. S LASTARCH=$O(^PRPF(470.9,"AC",0))
  1. I LASTARCH="" S X="This data has never been archived, purging cannot be accomplished until the archive is completed.*7" D MSG^PRPFU1 S X="No action taken.*7" D MSG^PRPFU1 QUIT
  1. S LASTARCH=10000000-LASTARCH,Y=LASTARCH,LY=$$FMADD^XLFDT(DT,-400) S:Y>LY Y=LY S %DT(0)=-Y D D^PRPFU1 ; By REW for 3*9
  1. DT S %DT("B")=$P(Y,"@") W !!,"The Summarize Through date must be no later than "_%DT("B"),!," -- the earlier of 400 days before today and the date of the latest archive.",!
  1. S %DT="AEXP",%DT("A")="Select the desired Summarize Through date: "
  1. D ^%DT K %DT(0) Q:Y<0 ; By REW for 3*9
  1. DTZ ;W !! S %DT="AEXP",%DT("A")="Select ending date for summarization: ",%DT("B")=$P(Y,"@") D ^%DT Q:Y<0
  1. ; I Y>LASTARCH S Y=LASTARCH D D^PRPFU1 S X="The date you selected exceeds the last archive date of "_Y_". You may NOT purge data that has not been archived.*7" D MSG^PRPFU1 G DT ; can no longer happen! rew 3*9
  1. S PURGDATE=$P(Y,".")
  1. S TREC=$P(^PRPF(470,0),"^",4)
  1. ; G DONE???? rather than Q: ????????? why did I ever want to ??????
  1. Q:TREC<1 ; By REW for 3*9 QUIT:TREC=0
  1. S MESSAGE="Loading Purgemaster for Patient Funds purge. ITEMS BEING PROCESSED = DAYS"
  1. D BEGIN^PRPFU
  1. S DA=0 F D S XCOUNT=XCOUNT+COUNT D:'$D(ZTQUEUED) PERCENT^PRPFU Q:'DA
  1. . F COUNT=1:1:LREC S DA=$O(^PRPF(470,DA)) S:'DA COUNT=COUNT-1 Q:'DA D ADD^PRCGPM1("ONE^PRPFPUR1",DA_","_PURGDATE,.RETURN)
  1. . QUIT
  1. K X S $P(X," ",40)=""
  1. W !!!!,"100% complete."_$P(X," ",1,40),!
  1. D:$G(XPDNM)="" KILL^%ZISS
  1. X W !! S X="For PurgeMaster to run, you must execute the PRCG PURGEMASTER SITE EDIT option and then schedule the PRCG PURGEMASTER (TASKMANAGER) option to run daily."
  1. D MSG^PRPFQ
  1. ;DONE -- was label of next line
  1. D ADD^PRPFARC("PURGE",PURGDATE)
  1. QUIT
  1. ;
  1. OT ;OPTION TERMINATED
  1. S X=" <Option Terminated, No Action Taken.>*" D MSG^PRPFU1
  1. Q