SCCVEGD0 ;ALB/JRP,TMP - DSPLY RSLTS 4 ENCNTR CNVRSN GLBL ESTMTR;18-JAN-96
 ;;5.3;Scheduling;**211**;Aug 13, 1993
MAILSUM(PTRLOG,RESULT) ;MAIL SUMMARY OF GLOBAL ESTIMATES
 ;INPUT  : PTRLOG - Pointer to entry in SCHEDULING CONVERSION LOG
 ;                  file (#404.98) that display is built for
 ;OUTPUT : RESULT - the # of users the bulletin was sent to [optional]
 ;NOTES  : Summary will be mailed to all users that scheduled and
 ;         re-started the estimation and to the current user.  If no
 ;         valid recipients are, it will be sent to the POSTMASTER.
 ;
 N SCLINES,LINES,NODE,TMP,TMP1,XMSUB,XMDUZ,XMY,XMZ,XMTEXT
 ;
 S RESULT=0
 ;
 Q:'$D(^SD(404.98,+$G(PTRLOG),0))
 ;
 ;Build message subject/stub
 S XMSUB="Scheduling Conversion Global Growth for "
 S TMP=+$P($G(^SD(404.98,PTRLOG,0)),U,3)
 S XMSUB=XMSUB_$E(TMP,4,5)_"/"_$E(TMP,6,7)_"/"_(1700+$E(TMP,1,3))
 S TMP=+$P($G(^SD(404.98,PTRLOG,0)),U,4)
 S XMSUB=XMSUB_" to "_$E(TMP,4,5)_"/"_$E(TMP,6,7)_"/"_(1700+$E(TMP,1,3))
 S XMDUZ="SCHEDULING CONVERSION GLOBAL ESTIMATOR"
 ;Build bulletin text
 S LINES=$$BUILD(PTRLOG,"SCLINES")
 S XMTEXT="SCLINES("
 I $G(DUZ) S XMY(+DUZ)="",RESULT=RESULT+1  ;Send to current user
 ;Find all users that scheduled or re-started the conversion
 S TMP=0
 F  S TMP=+$O(^SD(404.98,PTRLOG,"R",TMP)) Q:'TMP  S NODE=$G(^(TMP,0)) D
 .Q:"13"'[+$P(NODE,U,2)  ; schedule or re-start only
 .I $P(NODE,U,6),'$D(XMY(+$P(NODE,U,6))) S RESULT=RESULT+1,XMY(+$P(NODE,U,6))=""
 ;No users - send to POSTMASTER
 I '$O(XMY(0)) S XMY(.5)="",RESULT=1
 ;Send message
 D ^XMD
 Q
 ;
BUILD(PTRLOG,OUTARRAY) ;BUILD DISPLAY FOR GLOBAL ESTIMATES
 ;INPUT  : PTRLOG - Pointer to entry in SCHEDULING CONVERSION LOG
 ;                  file (#404.98) that display is built for
 ;         OUTARRAY - Array to build display into (full global reference)
 ;                      Defaults to ^TMP("SCCVEG",$J,"DISPLAY")
 ;OUTPUT : N - Number of lines in display
 ;         OUTARRAY will be returned as follows
 ;           OUTARRAY(x,0) = Line x of display
 ;                           (First line in display will be line # 1)
 ;NOTES  : Display is based on a screen width of 80 characters
 ;       : It is the responsibility of the calling application to
 ;         initialize OUTARRAY
 ;
 N CURRENT,INSERTED,LOGNODE,TMP,INFO,DATE,SCCV2,Z
 ;
 Q:'$D(^SD(404.98,+$G(PTRLOG,0))) 0
 ;
 S:$G(OUTARRAY)="" OUTARRAY="^TMP(""SCCVEG"","_$J_",""DISPLAY"")"
 S LOGNODE=$G(^SD(404.98,PTRLOG,0)),SCCV2=$G(^(2))
 ;Put totals into display
 S CURRENT=1
 S Z="Template #: "_PTRLOG
 S @OUTARRAY@(CURRENT,0)=Z
 S CURRENT=CURRENT+1
 S @OUTARRAY@(CURRENT,0)=$E("Total # new entries expected:"_$J("",39),1,39)_"Total # encounters to convert:"
 S CURRENT=CURRENT+1
 S @OUTARRAY@(CURRENT,0)=$E("  Encounters  : "_+$P(SCCV2,U,7)_$J("",39),1,39)_"  Add/Edits   : "_+$P(SCCV2,U)
 S CURRENT=CURRENT+1
 S @OUTARRAY@(CURRENT,0)=$E("  Visits      : "_+$P(SCCV2,U,8)_$J("",39),1,39)_"  Ancillaries : "_+$P(SCCV2,U,2)
 S CURRENT=CURRENT+1
 S @OUTARRAY@(CURRENT,0)=$E("  V PROVIDERs : "_+$P(SCCV2,U,9)_$J("",39),1,39)_"  Appointments: "_+$P(SCCV2,U,3)
 S CURRENT=CURRENT+1
 S @OUTARRAY@(CURRENT,0)=$E("  V POVs      : "_+$P(SCCV2,U,10)_$J("",39),1,39)_"  Credit Stops: "_+$P(SCCV2,U,4)
 S CURRENT=CURRENT+1
 S @OUTARRAY@(CURRENT,0)=$E("  V CPTs      : "_+$P(SCCV2,U,11)_$J("",39),1,39)_"  Dispositions: "_+$P(SCCV2,U,5)
 ;Put whitespace into display
 S CURRENT=CURRENT+1,@OUTARRAY@(CURRENT,0)=""
 ;Put global estimations chart into display
 S INSERTED=$$DSPGLBL^SCCVEGD1(PTRLOG,OUTARRAY,CURRENT)
 S CURRENT=CURRENT+INSERTED
 ;Done - return number of lines contained in display
 Q CURRENT
 
--- Routine Detail   --- with STRUCTURED ROUTINE LISTING ---[H[J[2J[HSCCVEGD0   3695     printed  Sep 23, 2025@20:15:12                                                                                                                                                                                                    Page 2
SCCVEGD0  ;ALB/JRP,TMP - DSPLY RSLTS 4 ENCNTR CNVRSN GLBL ESTMTR;18-JAN-96
 +1       ;;5.3;Scheduling;**211**;Aug 13, 1993
MAILSUM(PTRLOG,RESULT) ;MAIL SUMMARY OF GLOBAL ESTIMATES
 +1       ;INPUT  : PTRLOG - Pointer to entry in SCHEDULING CONVERSION LOG
 +2       ;                  file (#404.98) that display is built for
 +3       ;OUTPUT : RESULT - the # of users the bulletin was sent to [optional]
 +4       ;NOTES  : Summary will be mailed to all users that scheduled and
 +5       ;         re-started the estimation and to the current user.  If no
 +6       ;         valid recipients are, it will be sent to the POSTMASTER.
 +7       ;
 +8        NEW SCLINES,LINES,NODE,TMP,TMP1,XMSUB,XMDUZ,XMY,XMZ,XMTEXT
 +9       ;
 +10       SET RESULT=0
 +11      ;
 +12       if '$DATA(^SD(404.98,+$GET(PTRLOG),0))
               QUIT 
 +13      ;
 +14      ;Build message subject/stub
 +15       SET XMSUB="Scheduling Conversion Global Growth for "
 +16       SET TMP=+$PIECE($GET(^SD(404.98,PTRLOG,0)),U,3)
 +17       SET XMSUB=XMSUB_$EXTRACT(TMP,4,5)_"/"_$EXTRACT(TMP,6,7)_"/"_(1700+$EXTRACT(TMP,1,3))
 +18       SET TMP=+$PIECE($GET(^SD(404.98,PTRLOG,0)),U,4)
 +19       SET XMSUB=XMSUB_" to "_$EXTRACT(TMP,4,5)_"/"_$EXTRACT(TMP,6,7)_"/"_(1700+$EXTRACT(TMP,1,3))
 +20       SET XMDUZ="SCHEDULING CONVERSION GLOBAL ESTIMATOR"
 +21      ;Build bulletin text
 +22       SET LINES=$$BUILD(PTRLOG,"SCLINES")
 +23       SET XMTEXT="SCLINES("
 +24      ;Send to current user
           IF $GET(DUZ)
               SET XMY(+DUZ)=""
               SET RESULT=RESULT+1
 +25      ;Find all users that scheduled or re-started the conversion
 +26       SET TMP=0
 +27       FOR 
               SET TMP=+$ORDER(^SD(404.98,PTRLOG,"R",TMP))
               if 'TMP
                   QUIT 
               SET NODE=$GET(^(TMP,0))
               Begin DoDot:1
 +28      ; schedule or re-start only
                   if "13"'[+$PIECE(NODE,U,2)
                       QUIT 
 +29               IF $PIECE(NODE,U,6)
                       IF '$DATA(XMY(+$PIECE(NODE,U,6)))
                           SET RESULT=RESULT+1
                           SET XMY(+$PIECE(NODE,U,6))=""
               End DoDot:1
 +30      ;No users - send to POSTMASTER
 +31       IF '$ORDER(XMY(0))
               SET XMY(.5)=""
               SET RESULT=1
 +32      ;Send message
 +33       DO ^XMD
 +34       QUIT 
 +35      ;
BUILD(PTRLOG,OUTARRAY) ;BUILD DISPLAY FOR GLOBAL ESTIMATES
 +1       ;INPUT  : PTRLOG - Pointer to entry in SCHEDULING CONVERSION LOG
 +2       ;                  file (#404.98) that display is built for
 +3       ;         OUTARRAY - Array to build display into (full global reference)
 +4       ;                      Defaults to ^TMP("SCCVEG",$J,"DISPLAY")
 +5       ;OUTPUT : N - Number of lines in display
 +6       ;         OUTARRAY will be returned as follows
 +7       ;           OUTARRAY(x,0) = Line x of display
 +8       ;                           (First line in display will be line # 1)
 +9       ;NOTES  : Display is based on a screen width of 80 characters
 +10      ;       : It is the responsibility of the calling application to
 +11      ;         initialize OUTARRAY
 +12      ;
 +13       NEW CURRENT,INSERTED,LOGNODE,TMP,INFO,DATE,SCCV2,Z
 +14      ;
 +15       if '$DATA(^SD(404.98,+$GET(PTRLOG,0)))
               QUIT 0
 +16      ;
 +17       if $GET(OUTARRAY)=""
               SET OUTARRAY="^TMP(""SCCVEG"","_$JOB_",""DISPLAY"")"
 +18       SET LOGNODE=$GET(^SD(404.98,PTRLOG,0))
           SET SCCV2=$GET(^(2))
 +19      ;Put totals into display
 +20       SET CURRENT=1
 +21       SET Z="Template #: "_PTRLOG
 +22       SET @OUTARRAY@(CURRENT,0)=Z
 +23       SET CURRENT=CURRENT+1
 +24       SET @OUTARRAY@(CURRENT,0)=$EXTRACT("Total # new entries expected:"_$JUSTIFY("",39),1,39)_"Total # encounters to convert:"
 +25       SET CURRENT=CURRENT+1
 +26       SET @OUTARRAY@(CURRENT,0)=$EXTRACT("  Encounters  : "_+$PIECE(SCCV2,U,7)_$JUSTIFY("",39),1,39)_"  Add/Edits   : "_+$PIECE(SCCV2,U)
 +27       SET CURRENT=CURRENT+1
 +28       SET @OUTARRAY@(CURRENT,0)=$EXTRACT("  Visits      : "_+$PIECE(SCCV2,U,8)_$JUSTIFY("",39),1,39)_"  Ancillaries : "_+$PIECE(SCCV2,U,2)
 +29       SET CURRENT=CURRENT+1
 +30       SET @OUTARRAY@(CURRENT,0)=$EXTRACT("  V PROVIDERs : "_+$PIECE(SCCV2,U,9)_$JUSTIFY("",39),1,39)_"  Appointments: "_+$PIECE(SCCV2,U,3)
 +31       SET CURRENT=CURRENT+1
 +32       SET @OUTARRAY@(CURRENT,0)=$EXTRACT("  V POVs      : "_+$PIECE(SCCV2,U,10)_$JUSTIFY("",39),1,39)_"  Credit Stops: "_+$PIECE(SCCV2,U,4)
 +33       SET CURRENT=CURRENT+1
 +34       SET @OUTARRAY@(CURRENT,0)=$EXTRACT("  V CPTs      : "_+$PIECE(SCCV2,U,11)_$JUSTIFY("",39),1,39)_"  Dispositions: "_+$PIECE(SCCV2,U,5)
 +35      ;Put whitespace into display
 +36       SET CURRENT=CURRENT+1
           SET @OUTARRAY@(CURRENT,0)=""
 +37      ;Put global estimations chart into display
 +38       SET INSERTED=$$DSPGLBL^SCCVEGD1(PTRLOG,OUTARRAY,CURRENT)
 +39       SET CURRENT=CURRENT+INSERTED
 +40      ;Done - return number of lines contained in display
 +41       QUIT CURRENT