DG53659M ;EG - DG*5.3*659 cleanup ;03/21/2006
;;5.3;Registration;**659,1015**;Aug 13,1993;Build 21
;
;
MAIL(NAMSPC,TESTING,DUZ) ; mail stats
N U,MSGNO,TOTREC,TOTPAT
N STAT,STIME,ETIME
S U="^"
S X=$G(^XTMP(NAMSPC,0,0))
S TOTREC=$P(X,U,2)
S STAT=$P(X,U,6),STIME=$P(X,U,7)
S ETIME=$P(X,U,8)
S TOTPAT=$P(X,U,10)
;
S X=$$HDNG(NAMSPC,.HTEXT,.LIN,STAT,STIME,ETIME,TESTING)
S X=$$SUMRY(.LIN,TOTREC,TOTPAT)
S X=$$MAILIT(HTEXT,DUZ,NAMSPC)
K ^TMP(NAMSPC,$J,"MSG")
Q 1
;
;build heading lines for mail message
HDNG(NAMSPC,HTEXT,LIN,STAT,STIME,ETIME,TESTING) ;
N X,TEXT,U
S U="^"
K ^TMP(NAMSPC,$J,"MSG")
S LIN=0
S HTEXT="Convert Radiation Exposure Method "_STAT_" on "
S HTEXT=HTEXT_$$FMTE^XLFDT(ETIME)
S X=$$BLDLINE(NAMSPC,HTEXT,.LIN)
S X=$$BLDLINE(NAMSPC,"",.LIN)
I TESTING="Y" D
. S TEXT="** TESTING - NO CHANGES TO DATABASE EXECUTED **"
. S X=$$BLDLINE(NAMSPC,TEXT,.LIN)
. Q
S X=$$BLDLINE(NAMSPC,"",.LIN)
Q 1
;
;build summary lines for mail message
SUMRY(LIN,TOTREC,TOTPAT) ;
N TEXT,X,U,OLD,NEW
S U="^"
S TEXT=" Total Patient Records Read: "_$J($FN(TOTREC,","),11)
S X=$$BLDLINE(NAMSPC,TEXT,.LIN)
S TEXT=" Total Patient Records Changed: "_$J($FN(TOTPAT,","),11)
S X=$$BLDLINE(NAMSPC,TEXT,.LIN)
Q 1
;
;
BLDLINE(NAMSPC,TEXT,LIN) ;build a single line into TMP message global
S LIN=LIN+1
S ^TMP(NAMSPC,$J,"MSG",LIN)=TEXT
Q 1
MAILIT(HTEXT,DUZ,NAMSPC) ; send the mail message
N XMY,XMDUZ,XMSUB,XMTEXT
S XMY(DUZ)="",XMDUZ=.5
S XMSUB=HTEXT
S XMTEXT="^TMP(NAMSPC,$J,""MSG"","
D ^XMD
Q 1
DG53659M ;EG - DG*5.3*659 cleanup ;03/21/2006
+1 ;;5.3;Registration;**659,1015**;Aug 13,1993;Build 21
+2 ;
+3 ;
MAIL(NAMSPC,TESTING,DUZ) ; mail stats
+1 NEW U,MSGNO,TOTREC,TOTPAT
+2 NEW STAT,STIME,ETIME
+3 SET U="^"
+4 SET X=$GET(^XTMP(NAMSPC,0,0))
+5 SET TOTREC=$PIECE(X,U,2)
+6 SET STAT=$PIECE(X,U,6)
SET STIME=$PIECE(X,U,7)
+7 SET ETIME=$PIECE(X,U,8)
+8 SET TOTPAT=$PIECE(X,U,10)
+9 ;
+10 SET X=$$HDNG(NAMSPC,.HTEXT,.LIN,STAT,STIME,ETIME,TESTING)
+11 SET X=$$SUMRY(.LIN,TOTREC,TOTPAT)
+12 SET X=$$MAILIT(HTEXT,DUZ,NAMSPC)
+13 KILL ^TMP(NAMSPC,$JOB,"MSG")
+14 QUIT 1
+15 ;
+16 ;build heading lines for mail message
HDNG(NAMSPC,HTEXT,LIN,STAT,STIME,ETIME,TESTING) ;
+1 NEW X,TEXT,U
+2 SET U="^"
+3 KILL ^TMP(NAMSPC,$JOB,"MSG")
+4 SET LIN=0
+5 SET HTEXT="Convert Radiation Exposure Method "_STAT_" on "
+6 SET HTEXT=HTEXT_$$FMTE^XLFDT(ETIME)
+7 SET X=$$BLDLINE(NAMSPC,HTEXT,.LIN)
+8 SET X=$$BLDLINE(NAMSPC,"",.LIN)
+9 IF TESTING="Y"
Begin DoDot:1
+10 SET TEXT="** TESTING - NO CHANGES TO DATABASE EXECUTED **"
+11 SET X=$$BLDLINE(NAMSPC,TEXT,.LIN)
+12 QUIT
End DoDot:1
+13 SET X=$$BLDLINE(NAMSPC,"",.LIN)
+14 QUIT 1
+15 ;
+16 ;build summary lines for mail message
SUMRY(LIN,TOTREC,TOTPAT) ;
+1 NEW TEXT,X,U,OLD,NEW
+2 SET U="^"
+3 SET TEXT=" Total Patient Records Read: "_$JUSTIFY($FNUMBER(TOTREC,","),11)
+4 SET X=$$BLDLINE(NAMSPC,TEXT,.LIN)
+5 SET TEXT=" Total Patient Records Changed: "_$JUSTIFY($FNUMBER(TOTPAT,","),11)
+6 SET X=$$BLDLINE(NAMSPC,TEXT,.LIN)
+7 QUIT 1
+8 ;
+9 ;
BLDLINE(NAMSPC,TEXT,LIN) ;build a single line into TMP message global
+1 SET LIN=LIN+1
+2 SET ^TMP(NAMSPC,$JOB,"MSG",LIN)=TEXT
+3 QUIT 1
MAILIT(HTEXT,DUZ,NAMSPC) ; send the mail message
+1 NEW XMY,XMDUZ,XMSUB,XMTEXT
+2 SET XMY(DUZ)=""
SET XMDUZ=.5
+3 SET XMSUB=HTEXT
+4 SET XMTEXT="^TMP(NAMSPC,$J,""MSG"","
+5 DO ^XMD
+6 QUIT 1