ENPAT35 ;(WIRMFO)/DH-Delete old incomplete PM Work Orders ;1.6.97
;;7.0;ENGINEERING;**35**;Aug 17,1993
; Distributed as part of post-init for EN*7.0*35
PM I '$D(^ENG("PATCH 7*35 PM DELETE")) G PMDUN
N SHOP,DA,ENDA,DIK,COUNT S COUNT=0
S DIK="^ENG(6920,",ENDA("START")=$P(^ENG("PATCH 7*35 PM DELETE",0),U,2)
S SHOP=0 F S SHOP=$O(^ENG("PATCH 7*35 PM DELETE",SHOP)) Q:'SHOP D
. S ENDA=9999999999-ENDA("START")
. F S ENDA=$O(^ENG(6920,"AINC",SHOP,ENDA)) Q:'ENDA D
.. S DA=9999999999-ENDA
.. I $E($P($G(^ENG(6920,DA,0)),U),1,3)="PM-" D ^DIK S COUNT=COUNT+1
PMDUN K ^ENG("PATCH 7*35 PM DELETE"),^TMP($J)
S XMY(DUZ)="",XMDUZ=.5,XMSUB="Deletion of Old Incomplete PM Work Orders"
S ^TMP($J,1)=COUNT_" old incomplete PM work orders were just deleted."
S XMTEXT="^TMP($J,"
D ^XMD
K XMY,XMDUZ,XMTEXT,XMSUB
K ^TMP($J)
I $D(ZTQUEUED) S ZTREQ="@"
Q
;ENPAT35
--- Routine Detail --- with STRUCTURED ROUTINE LISTING ---[H[J[2J[HENPAT35 886 printed Dec 13, 2024@01:54:36 Page 2
ENPAT35 ;(WIRMFO)/DH-Delete old incomplete PM Work Orders ;1.6.97
+1 ;;7.0;ENGINEERING;**35**;Aug 17,1993
+2 ; Distributed as part of post-init for EN*7.0*35
PM IF '$DATA(^ENG("PATCH 7*35 PM DELETE"))
GOTO PMDUN
+1 NEW SHOP,DA,ENDA,DIK,COUNT
SET COUNT=0
+2 SET DIK="^ENG(6920,"
SET ENDA("START")=$PIECE(^ENG("PATCH 7*35 PM DELETE",0),U,2)
+3 SET SHOP=0
FOR
SET SHOP=$ORDER(^ENG("PATCH 7*35 PM DELETE",SHOP))
if 'SHOP
QUIT
Begin DoDot:1
+4 SET ENDA=9999999999-ENDA("START")
+5 FOR
SET ENDA=$ORDER(^ENG(6920,"AINC",SHOP,ENDA))
if 'ENDA
QUIT
Begin DoDot:2
+6 SET DA=9999999999-ENDA
+7 IF $EXTRACT($PIECE($GET(^ENG(6920,DA,0)),U),1,3)="PM-"
DO ^DIK
SET COUNT=COUNT+1
End DoDot:2
End DoDot:1
PMDUN KILL ^ENG("PATCH 7*35 PM DELETE"),^TMP($JOB)
+1 SET XMY(DUZ)=""
SET XMDUZ=.5
SET XMSUB="Deletion of Old Incomplete PM Work Orders"
+2 SET ^TMP($JOB,1)=COUNT_" old incomplete PM work orders were just deleted."
+3 SET XMTEXT="^TMP($J,"
+4 DO ^XMD
+5 KILL XMY,XMDUZ,XMTEXT,XMSUB
+6 KILL ^TMP($JOB)
+7 IF $DATA(ZTQUEUED)
SET ZTREQ="@"
+8 QUIT
+9 ;ENPAT35