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

DGPTRPP.m

Go to the documentation of this file.
DGPTRPP ;ALB/MTC - PRINT/PURGE SPECIAL TRANSACTION REQUEST LIST ; 19 FEB 91 
 ;;5.3;Registration;;Aug 13, 1993
PRN ;--entry for list
 D INIT G ENQ:DGOUT
 W @IOF,?12,"SPECIAL TRANSACTION REQUEST LISTING",!
 D GETDATE G ENQ:DGOUT
 D GETFMT G ENQ:DGOUT
 S L=0,DIC="^DGP(45.87,",FLDS="[DGPT PRINT]",FR=SP1,TO=SP2,BY="@-.01"
 S DIS(0)="I $E($P(^DGP(45.87,D0,0),U,4),2,4)=DGFMT!(DGFMT=""ALL"")"
 D EN1^DIP
ENQ K X,Y,DGD1,DGD2,SP1,SP2,DGOUT,L,DIC,BY,FR,TO,FLDS,DIS,DGFMT,ZTDESC,ZTIO,ZTDTH,ZTRTN,ZTSAVE Q
 ;
GETDATE ;THIS ROUTINE WILL GET THE DATE RANGE FROM THE USER
 S DGOUT=0,Y=$O(^DGP(45.87,"B",0))
 I 'Y W !,"No records in PTF TRANSACTION LOG FILE" S DGOUT=1 G GETQ
 D DD^%DT S %DT("B")=Y
 S %DT("A")="Start with DATE OF REQUEST : ",%DT="AETS"
 D ^%DT I (Y=-1)!$D(DTOUT) S DGOUT=1 G GETQ
 S (SP1,%DT(0))=Y,%DT("B")="NOW",%DT("A")="Go to DATE OF REQUEST : "
 D ^%DT I (Y=-1)!$D(DTOUT) S DGOUT=1 G GETQ
 S SP2=Y
GETQ K %,%DT,X,Y,DIR,DIRUT,DTOUT Q
 ;
GETFMT ;-- will get from the user which records to process
 S DGOUT=0
 S DIR(0)="S^099:099 Transactions;150:150 Specific Record Printout (RPO);151:151 Generic Record Printout (RPO);ALL:ALL Records in Special Transaction File",DIR("A")="Process which records",DIR("B")="ALL"
 D ^DIR I $D(DIRUT) S DGOUT=1 G GETFMTQ
 S DGFMT=X
GETFMTQ ;
 K DIR,X,Y,DIRUT
 Q
 ;
PUR ;--entry for purge RPO
 D INIT G ENQ:DGOUT
 W @IOF,?12,"PURGE SPECIAL TRANSACTION REQUEST.",!
 D GETDATE G ENQ:DGOUT
 D GETFMT G ENQ:DGOUT
 D CONT I DGOUT G ENQ
 D NOW^%DTC S ZTIO="",ZTDESC="Purge Special Transactions",ZTDTH=%,ZTRTN="PURGE^DGPTRPP",ZTSAVE("SP1")="",ZTSAVE("SP2")="",ZTSAVE("DGFMT")="" D ^%ZTLOAD
 W !!,$S($D(ZTSK):"Request Queued!",1:"Request Cancelled!")
 D HOME^%ZIS K ZTSAVE,ZTSK
 D ENQ
 Q
 ;
CONT ;--verify before delete
 S DGOUT=0
 S Y=SP1 D DD^%DT S DGD1=Y,Y=SP2 D DD^%DT S DGD2=Y
 S DIR(0)="Y",DIR("A")="Purge "_DGFMT_" Requests from "_DGD1_" to "_DGD2,DIR("B")="NO"
 D ^DIR
 I (Y=0)!$D(DIRUT) S DGOUT=1
CONTQ K X,Y,DIR,DIRUT
 Q
PURGE ;purge rpo record for the given date range
 S DGTPUR=0
 F DGDATE=SP1-.000001:0 S DGDATE=$O(^DGP(45.87,"B",DGDATE)) Q:'DGDATE!(DGDATE>SP2)  F DGDA=0:0 S DGDA=$O(^DGP(45.87,"B",DGDATE,DGDA)) Q:'DGDA  I $D(^DGP(45.87,DGDA,0)) I $E($P(^DGP(45.87,DGDA,0),U,4),2,4)=DGFMT!(DGFMT="ALL") D GOGO
PURGEQ ;
 D COM
 K DGTPUR,DGFMT,DGI,DGDATE,DGDA
 Q
 ;
GOGO ;-- count total items purged call delete routine
 S DGTPUR=DGTPUR+1
 D DEL^DGPTRPO
 Q
COM ;--send mailman message when purge is done
 S DGPURMSG(1,0)="PTF PURGE SPECIAL TRANSACTION LOG COMPLETE.",DGPURMSG(2,0)="Record format :"_DGFMT,DGPURMSG(3,0)="Total # of records deleted = "_DGTPUR
 S XMTEXT="DGPURMSG(",XMDUZ=.5,XMY(DUZ)="",XMSUB="PURGE PTF SPECIAL TRANSACTION LOG" D ^XMD
 K XMTEXT,XMY,XMZ,DGPURMSG,XMSUB,XMDUZ
 Q
 ;
INIT ;
 D LO^DGUTL,HOME^%ZIS S DGOUT=0
 Q