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

GMRCYP69.m

Go to the documentation of this file.
  1. GMRCYP69 ;SLC/WAT - Reformat long comments from Edit/Resubmit ;1/21/09
  1. ;;3.0;CONSULT/REQUEST TRACKING;**69**;DEC 27, 1997;Build 13
  1. ;;
  1. ;;ICR Invoked
  1. ;;10063, ^%ZTLOAD - $$S
  1. ;;10141, ^XPDUTL - BMES, PATCH
  1. ;;10103, ^XLFDT - $$FMADD, $$NOW, $$FMTH
  1. ;;10113, ^XMB(3.9
  1. ;;10066, XMZ^XMA2
  1. ;;10070, ^XMD - ENL, ENT1
  1. ;;10011, ^DIWP, ^UTILITY($J
  1. ;;2053, WP^DIE
  1. PRE ;sys check
  1. I $G(DUZ)="" D BMES^XPDUTL("Your DUZ is not defined. Install aborted. Transport global NOT deleted from system.") S XPDABORT=2 Q
  1. I '$$PATCH^XPDUTL("OR*3.0*296") S XPDABORT=2 D Q
  1. .D BMES^XPDUTL("*************")
  1. .D BMES^XPDUTL("OR*3.0*296 and the associated CPRS GUI exe must be installed first!")
  1. .D BMES^XPDUTL("Install aborted. Transport global NOT deleted from system.")
  1. Q
  1. POST ;go
  1. D QUEUE
  1. Q
  1. QUEUE ;task entry point
  1. N ZTRTN,ZTDESC,ZTIO,ZTDTH,ZTSK
  1. S ZTRTN="EN^GMRCYP69",ZTDESC="GMRC Reformat Long Comments from Edit/Resubmit Action",ZTIO="",ZTDTH=$H
  1. D ^%ZTLOAD I '$G(ZTSK) D BMES^XPDUTL("POST INSTALL NOT QUEUED - RUN EN^GMRCYP69 AFTER INSTALL FINISHES") Q
  1. D BMES^XPDUTL("Post-install queued as task #"_$G(ZTSK))
  1. D BMES^XPDUTL("If any records are locked, task will re-run 5 minutes after completion.")
  1. Q
  1. EN ;main
  1. S $P(^XTMP("GMRC_PRE69",0),U)=$$FMADD^XLFDT(DT,45),$P(^XTMP("GMRC_PRE69",0),U,2)=DT
  1. S $P(^XTMP("GMRC_PRE69",0),U,3)=DUZ_" Patch installer's DUZ, global contains comment data before reformat in GMRC*3.0*69"
  1. S ^XTMP("GMRC_PRE69","DUZ")=DUZ ;get user's DUZ for mail mesage
  1. D SRCH
  1. I $D(^XTMP("GMRC_PRE69","RECHECK")) D RECHECK S ZTREQ="@" Q ;some are locked, run recheck, clean task and quit
  1. I $D(^XTMP("GMRC_PRE69","RECHECK"))=0 D MSG S ZTREQ="@" Q ;If all are checked, send msg, clean task, and quit
  1. Q
  1. RECHECK ;if locked records requeue and re-run until all are checked
  1. Q:'$D(ZTQUEUED)&($D(^XTMP("GMRC_PRE69","RECHECK"))=0) ;abort if outside taskman and all records already checked.
  1. N RECLOCK,IEN,A,B,TOTAL,IDX S (IEN,TOTAL)=0,IDX=""
  1. F S IEN=$O(^XTMP("GMRC_PRE69","RECHECK",IEN)) Q:IEN="" D
  1. .S RECLOCK=$$LOCKREC^GMRCUTL1(IEN)
  1. .Q:$G(RECLOCK)'=1 ;if still locked, do nothing
  1. .F S IDX=$O(^XTMP("GMRC_PRE69","RECHECK",IEN,IDX)) Q:IDX="" D
  1. ..S A=$P(^XTMP("GMRC_PRE69","RECHECK",IEN,IDX),",",4),B=1
  1. ..D REFORMAT D UNLKREC^GMRCUTL1(IEN) S ^XTMP("GMRC_PRE69","TOTAL")=$G(^XTMP("GMRC_PRE69","TOTAL"))+1
  1. ..K ^XTMP("GMRC_PRE69","RECHECK",IEN,IDX)
  1. I $D(^XTMP("GMRC_PRE69","RECHECK"))=0 D MSG S:($D(ZTQUEUED)) ZTREQ="@" Q
  1. E D
  1. .N ZTRTN,ZTDESC,ZTIO,ZTDTH,ZTSK,ZTSAVE
  1. .S ZTRTN="RECHECK^GMRCYP69",ZTDESC="GMRC Reformat Long Comments from Edit/Resubmit Action - RECHECK",ZTIO=""
  1. .S ZTDTH=$$FMTH^XLFDT($$FMADD^XLFDT($$NOW^XLFDT,,,5)) ;set to re-run in 5 minutes
  1. .D ^%ZTLOAD
  1. S ZTREQ="@"
  1. Q
  1. SRCH ;search for long comments
  1. N IEN,A,B,C,TOTAL,FLG,LNCNT,RECLOCK,STPCHK,IDX S (IEN,TOTAL,RECLOCK,STPCHK,IDX)=0,LNCNT=1
  1. F S IEN=$O(^GMR(123,IEN)) Q:+IEN=0!($G(ZTSTOP)) D
  1. .S A=0,STPCHK=STPCHK+1
  1. .I STPCHK>1000,$D(ZTQUEUED) S:$$S^%ZTLOAD ZTSTOP=1 Q:$G(ZTSTOP) S STPCHK=0
  1. .F S A=$O(^GMR(123,IEN,40,A)) Q:+A=0 D
  1. ..Q:$D(^GMR(123,IEN,40,A,0))<1
  1. ..Q:$P(^GMR(123,IEN,40,A,0),U,2)'=20 ;quit if action is not Add Comment
  1. ..;quit if next action not Edit/Resubmit, only get comments from Edit/Resubmit
  1. ..Q:$D(^GMR(123,IEN,40,A+1,0))<10&($P($G(^GMR(123,IEN,40,A+1,0)),U,2)'=11)
  1. ..S B=0
  1. ..F S B=$O(^GMR(123,IEN,40,A,B)) Q:+B=0 D
  1. ...S C=0,FLG=0
  1. ...F S C=$O(^GMR(123,IEN,40,A,B,C)) Q:+C=0 D Q:FLG=1!($G(RECLOCK)=1)
  1. ....S FLG=0,RECLOCK=0 S:($L(^GMR(123,IEN,40,A,B,C,0))>80) FLG=1 Q:FLG'=1
  1. ....S RECLOCK=$$LOCKREC^GMRCUTL1(IEN)
  1. ....I $G(RECLOCK)'=1 S ^XTMP("GMRC_PRE69","RECHECK",IEN,IDX)=$NA(^GMR(123,IEN,40,A,B,C,0)),IDX=IDX+1
  1. ....S:$G(RECLOCK)=1 TOTAL=TOTAL+1,^XTMP("GMRC_PRE69","TOTAL")=$G(^XTMP("GMRC_PRE69","TOTAL"))+1
  1. ....D REFORMAT D:$G(RECLOCK)=1 UNLKREC^GMRCUTL1(IEN)
  1. Q
  1. REFORMAT ;reformat data to 74 characters
  1. K ^UTILITY($J,"W")
  1. N INT,GMRC69,GMRCTMP,REF S INT=0,REF=A
  1. N X,DIWL,DIWR,DIWF
  1. S DIWL=1,DIWR=74,DIWF=""
  1. Q:$G(RECLOCK)'=1
  1. F S INT=$O(^GMR(123,IEN,40,A,B,INT)) Q:+INT=0 D
  1. .S ^XTMP("GMRC_PRE69",IEN,40,A,B,INT,0)=^GMR(123,IEN,40,A,B,INT,0)
  1. .S X=^GMR(123,IEN,40,A,B,INT,0)
  1. .D ^DIWP
  1. .S:$G(RECLOCK)'=1 INT="A"
  1. D WP^DIE(123.02,REF_","_IEN_",","5","","^UTILITY($J,""W"",1)","^TMP($J,""ERR"")")
  1. Q
  1. MSG ;create and send message
  1. N XMDUZ,XMSUB,XMZ,XMTEXT,XMY ;i/o args for XMZ^XMA2.
  1. N IEN,A,B,C,LNCNT S (IEN,A,B,C)=0,LNCNT=1
  1. S XMY(^XTMP("GMRC_PRE69","DUZ"))=""
  1. S XMDUZ="GMRC PACKAGE"
  1. S XMSUB="GMRC*3.0*69 COMMENTS BEFORE REFORMAT"
  1. D XMZ^XMA2 ; call Create Message Module
  1. I $G(^XTMP("GMRC_PRE69","TOTAL"))>0 F S IEN=$O(^XTMP("GMRC_PRE69",IEN)) Q:+IEN=0 D
  1. .F S A=$O(^XTMP("GMRC_PRE69",IEN,40,A)) Q:+A=0 D
  1. ..F S B=$O(^XTMP("GMRC_PRE69",IEN,40,A,B)) Q:+B=0 D
  1. ...F S C=$O(^XTMP("GMRC_PRE69",IEN,40,A,B,C)) Q:+C=0 D
  1. ....S ^XMB(3.9,XMZ,2,LNCNT,0)=$NA(^GMR(123,IEN,40,A,B,C,0))_U_^XTMP("GMRC_PRE69",IEN,40,A,B,C,0)
  1. ....S ^XMB(3.9,XMZ,2,0)="^3.92^"_LNCNT_"^"_LNCNT_"^"_DT ;define zero node per API
  1. ....S LNCNT=LNCNT+1
  1. I $G(^XTMP("GMRC_PRE69","TOTAL"))=0!($D(^XTMP("GMRC_PRE69","TOTAL"))=0) D
  1. .S XMTEXT="XMTEXT"
  1. .S XMTEXT(1)="No long comments found. No records were modified in ^GMR(123."
  1. .D ENL^XMD
  1. D ENT1^XMD
  1. Q