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

SCCVE.m

Go to the documentation of this file.
  1. SCCVE ;ALB/RMO,TMP - Encounter Conversion Driver; [ 04/05/95 8:19 AM ]
  1. ;;5.3;Scheduling;**211**;Aug 13, 1993
  1. ;
  1. QUE(SCLOG,SCREQ) ;Schedule encounter conversion via task manager
  1. ; Input -- SCLOG CST log IEN
  1. ; SCREQ CST request IEN
  1. ; Output -- None
  1. N I,SCERRMSG,SCREQ0,SCREQD,Y,ZTDESC,ZTDTH,ZTIO,ZTRTN,ZTSAVE,ZTSK
  1. S SCREQ0=$G(^SD(404.98,SCLOG,"R",SCREQ,0))
  1. ;
  1. ; -- quit if convert or reconvert & conversion disabled
  1. IF $P(SCREQ0,U,3)=1!($P(SCREQ0,U,3)=2),'$$OK^SCCVU(1) G QUEQ
  1. ;
  1. I SCREQ0="" D G QUEQ
  1. . N SCERRIP
  1. . S SCERRIP(1)=SCLOG
  1. . S SCERRIP(2)=SCREQ
  1. . S SCERRIP(3)="Conversion"
  1. . D GETERR^SCCVLOG1(4049004.001,"",.SCERRIP,SCLOG,0,.SCERRMSG)
  1. S SCREQD=$$LOW^XLFSTR($$EXPAND^SCCVDSP2(404.9825,.02,$P(SCREQ0,U,2)))
  1. S ZTDESC="CST Log #"_SCLOG_" - "_SCREQD_" ("_$$LOW^XLFSTR($$EXPAND^SCCVDSP2(404.9825,.03,$P(SCREQ0,U,3)))_")"
  1. S ZTRTN="EN^SCCVE"
  1. F I="SCLOG","SCREQ" S ZTSAVE(I)=""
  1. S ZTIO="SCCV RESOURCE"
  1. S ZTDTH=$S($P(SCREQ0,U,4):$P(SCREQ0,U,4),1:$$NOW^XLFDT)
  1. D ^%ZTLOAD
  1. I $D(ZTSK) D
  1. . W " (Task: #",ZTSK,")"
  1. . D UPD^SCCVLOG("CST",SCLOG,"","","",ZTSK,$G(^%ZOSF("VOL")),6)
  1. QUEQ Q
  1. ;
  1. EN ;Entry point to run encounter estimate/conversion
  1. ; Input -- SCLOG CST log IEN
  1. ; SCREQ CST request IEN
  1. ; Output -- None
  1. N SCACT,SCCVEVT,SCEND,SCERRMSG,SCRSTDT,SCRSTPT,SCSTDT,SCSTOPF,SCBULL,SCTOT,SCRSTDFN,SCCVERRH,SCCVERRT,SCCVDIS,SCCVACRP,SCCV900,ZZLOG,SCCVMAXE
  1. I '$G(SCLOG)!('$G(SCREQ))!('$G(DUZ)) D G ENQ ;req vars missing
  1. . N SCERRIP
  1. . S SCERRIP(1)=$S('$G(SCLOG):"SCLOG",'$G(SCREQ):"SCREQ",1:"DUZ")
  1. . S SCERRIP(2)="EN^SCCVE"
  1. . D GETERR^SCCVLOG1(4040001.001,"",.SCERRIP,$G(SCLOG),0,.SCERRMSG)
  1. . I $G(SCLOG),$G(SCREQ) D STOP^SCCVLOG(SCLOG,SCREQ,1)
  1. ;
  1. ; -- set overall variables
  1. S SCCVACRP=$$ENDDATE^SCCVU()
  1. S SCCV900=+$O(^DIC(40.7,"C",900,0))
  1. S SCCVMAXE=$S($P($G(^SD(404.91,1,"CNV")),U,7):$P(^("CNV"),U,7),1:1000)-1
  1. ;
  1. D SET(SCLOG,SCREQ,.SCACT,.SCCVEVT,.SCSTDT,.SCENDT,.SCRSTPT,.SCRSTDT,.SCBULL,.SCRSTDFN)
  1. ;
  1. ; -- quit if convert or reconvert & conversion disabled
  1. IF SCCVEVT=1!(SCCVEVT=2),'$$OK^SCCVU(0) G ENQ
  1. ;
  1. ;Log event
  1. D UPD^SCCVLOG("CST",SCLOG,"","","","","",SCACT)
  1. ;
  1. I $G(SCCVEVT)=1,$$CHKACT^SCCVLOG(SCLOG,SCCVEVT,5,"CST") D G ENQ ;converted
  1. . D GETERR^SCCVLOG1(4049001.008,"","",SCLOG,0,.SCERRMSG)
  1. ;
  1. I "^2^4^"'[(U_SCACT_U) D G ENQ ;start or re-start
  1. . D GETERR^SCCVLOG1(4049006.001,"","",SCLOG,0,.SCERRMSG)
  1. . D STOP^SCCVLOG(SCLOG,SCREQ,1)
  1. ;
  1. I '$G(SCSTDT)!('$G(SCENDT)) D G ENQ ;start date or end date undefined
  1. . D GETERR^SCCVLOG1(4049001.003,"","",SCLOG,0,.SCERRMSG)
  1. . D STOP^SCCVLOG(SCLOG,SCREQ,1)
  1. ;
  1. I $G(SCCVEVT)="" D G ENQ ;event undefined
  1. . D GETERR^SCCVLOG1(4049001.009,"","",SCLOG,0,.SCERRMSG)
  1. . D STOP^SCCVLOG(SCLOG,SCREQ,1)
  1. ;
  1. I $$VERDT^SCCVU2(SCSTDT,SCENDT,SCLOG) D G ENQ ;invalid date range
  1. . D STOP^SCCVLOG(SCLOG,SCREQ,1)
  1. ;
  1. S (SCCVERRH,SCCVERRT)=+$P($G(^SD(404.98,SCLOG,1)),U,5)
  1. I SCCVEVT S SCTOT(1.02)=$P($G(^SD(404.98,SCLOG,1)),U,2),SCTOT(2.06)=$P($G(^(2)),U,6)
  1. I 'SCCVEVT K ^XTMP("SCCV-VIS-"_SCLOG),^XTMP("SCCV-BOTH-"_SCLOG)
  1. ;
  1. ;Convert appointments
  1. I $G(SCRSTPT)<2 D EN^SCCVEAP(SCCVEVT,SCSTDT,SCENDT,SCLOG,SCREQ,+$G(SCRSTDFN),.SCSTOPF) G ENQ:$G(SCSTOPF) I $G(SCRSTPT) S (SCRSTDT,SCRSTDFN)=""
  1. ;
  1. ;Convert disposition
  1. I $S('$G(SCRSTPT):1,1:SCRSTPT'=2) D EN^SCCVEDI(SCCVEVT,$S($G(SCRSTDT):SCRSTDT,1:SCSTDT),SCENDT,SCLOG,SCREQ,.SCSTOPF) G ENQ:$G(SCSTOPF) I $G(SCRSTPT) S (SCRSTDT,SCRSTDFN)=""
  1. ;
  1. ;Convert add/edits
  1. D EN^SCCVEAE(SCCVEVT,$S($G(SCRSTDT):SCRSTDT,1:SCSTDT),SCENDT,SCLOG,SCREQ,.SCSTOPF) G ENQ:$G(SCSTOPF)
  1. ;
  1. ;Log completion
  1. D UPD^SCCVLOG("CST",SCLOG,"","","","@","@",5)
  1. ;
  1. ENQ Q
  1. ;
  1. SET(SCLOG,SCREQ,SCACT,SCCVEVT,SCSTDT,SCENDT,SCRSTPT,SCRSTDT,SCBULL,SCRSTDFN) ;
  1. ; Set variables
  1. ; Input -- SCLOG CST log IEN
  1. ; SCREQ CST request IEN
  1. ; Output -- SCACT Action
  1. ; SCCVEVT Conversion event
  1. ; SCSTDT Start date
  1. ; SCENDT End date
  1. ; SCRSTPT Conversion re-start point (1=appt, 2=a/e, 3=disp)
  1. ; SCRSTDT Re-start date
  1. ; SCBULL Send bulletin flag
  1. ; SCRSTDFN Re-start dfn
  1. N SCLOG0,SCLOG1,SCOE,SCOE0,SCREQACT
  1. S SCLOG0=$G(^SD(404.98,SCLOG,0)),SCLOG1=$G(^(1))
  1. S SCREQACT=$P($G(^SD(404.98,SCLOG,"R",SCREQ,0)),U,2)
  1. S SCACT=$S(SCREQACT=1:2,SCREQACT=3:4,1:"") ;action based on request
  1. S SCCVEVT=$P(SCLOG0,U,5)
  1. S SCSTDT=$P(SCLOG0,U,3)
  1. S SCENDT=$P(SCLOG0,U,4)
  1. S SCBULL=$P(SCLOG0,U,6)
  1. ;
  1. I +SCLOG1,SCCVEVT,SCACT=4 D ;Only for re-start of conversion
  1. . S SCOE=+SCLOG1 ;last entry
  1. . I $P($G(^SCE(SCOE,0)),U,6) S SCOE=+$P(^(0),U,6) ;re-start at parent
  1. . S SCOE0=$G(^SCE(SCOE,0))
  1. . S SCRSTPT=+$P(SCOE0,U,8),SCRSTDT=$P(+SCOE0,"."),SCRSTDFN=$P(SCOE0,U,2) ;set re-start point
  1. ;
  1. I 'SCCVEVT D ;Estimate must start counting over from beginning
  1. .N Z,SC2,SCDATA,SCF
  1. .S SC2=$G(^SD(404.98,SCLOG,2))
  1. .F Z=1:1:11 I $P(SC2,U,Z) S SCF="2."_$S(Z<10:"0",1:"")_Z,SCDATA(+SCF)=0
  1. .I $D(SCDATA) D UPD^SCCVDBU(404.98,SCLOG,.SCDATA) ;Re-set totals to 0
  1. ;
  1. I SCCVEVT=2,SCACT'=4 D ;'Start' of re-convert deletes errors and resets counts to 0
  1. . N SCDATA
  1. . S SCDATA(1.05)=0,SCDATA(50)="@",SCDATA(2.06)=0,SCDATA(1.02)=0
  1. . D UPD^SCCVDBU(404.98,SCLOG,.SCDATA)
  1. Q
  1. ;
  1. STOP(SCLOG,SCREQ) ;User request to stop conversion
  1. ; Input -- SCLOG CST log IEN
  1. ; SCREQ CST request IEN
  1. ; Output -- None
  1. N SCSTOPF
  1. D STOP^SCCVLOG(SCLOG,SCREQ,.SCSTOPF)
  1. Q
  1. ;