SDAMQ4 ;ALB/MJK - AM Background Job/Add/Edit Processing ; 24 Aug 99 9:59 PM
;;5.3;Scheduling;**24,132,153,199**;Aug 13, 1993
;
EN(SDBEG,SDEND) ; -- count add/edits
N SDT,SDOE
S SDT=SDBEG
F S SDT=$O(^SCE("B",SDT)) Q:'SDT!(SDT>SDEND) D
. S SDOE=0
. F S SDOE=$O(^SCE("B",SDT,SDOE)) Q:'SDOE D CHK(SDOE)
ENQ Q
;
CHK(SDOE) ; -- set data in ^tmp if appropriate
N SDOE0,SDIVNM,SDNAT,X,SDSTOP,SDSTAT
S SDOE0=$G(^SCE(SDOE,0))
S SDPAR=+$P(SDOE0,U,6)
S SDORG=+$P(SDOE0,U,8)
S SDSTAT=$P(SDOE0,U,12)
;
; -- do checks
IF SDPAR G CHKQ ; -- quit if has parent
IF SDORG'=2 G CHKQ ; -- quit if no a/e
IF $$REQ^SDM1A(+SDOE0)'="CO" G CHKQ ; -- quit if "CO" not required
IF '$$DIV^SDAMQ(+$P(SDOE0,U,11),.SDIVNM,35) G CHKQ ; -- quit if no division
;
; -- set ^tmp
S SDNAT='$$CO^SDAMQ(SDOE) I SDNAT S SDNAT=SDSTAT=14
S SDSTOP=+$P($G(^DIC(40.7,+$P(SDOE0,U,3),0)),U,2)
S X=$G(^TMP("SDSTATS",$J,SDIVNM,"AE",SDSTOP))
S ^TMP("SDSTATS",$J,SDIVNM,"AE",SDSTOP)=(X+SDNAT)_U_($P(X,U,2)+1)
;
CHKQ Q
;
BULL(SDIVNM,SDLN,SDTOT) ;
N SDSTOP,SDSTOPN,NAT,GRAND,OTHER,TNAT,TGRAND
D HDR
S (OTHER,SDSTOP,TNAT,TGRAND)=0
F S SDSTOP=$O(^TMP("SDSTATS",$J,SDIVNM,"AE",SDSTOP)) Q:'SDSTOP S X=^(SDSTOP) D
.S NAT=+X,GRAND=+$P(X,U,2)
.S TNAT=TNAT+NAT,TGRAND=TGRAND+GRAND
.S SDTOT("DIV","NAT")=SDTOT("DIV","NAT")+NAT
.S SDTOT("DIV","GRAND")=SDTOT("DIV","GRAND")+GRAND
.S SDSTOPN=$S($D(^DIC(40.7,+$O(^DIC(40.7,"C",SDSTOP,0)),0)):$P(^(0),U),1:"UNKNOWN")
.I 'NAT S OTHER=OTHER+GRAND
.I NAT D LINE^SDAMQ3(SDSTOP_"-"_SDSTOPN,NAT,GRAND)
D LINE^SDAMQ3("ALL OTHER STOPS",0,OTHER)
D SET^SDAMQ3(" --------------- ---------------- ------- -------")
D LINE^SDAMQ3("Add/Edit Totals",TNAT,TGRAND)
BULLQ Q
;
HDR ; -- ae header block
D SET^SDAMQ3("")
D SET^SDAMQ3(" Add/Edits Total")
D SET^SDAMQ3(" Stop Code Requiring Action Stops Pct.")
D SET^SDAMQ3(" --------- ---------------- ------- -------")
Q
--- Routine Detail --- with STRUCTURED ROUTINE LISTING ---[H[J[2J[HSDAMQ4 2126 printed Dec 13, 2024@02:48:13 Page 2
SDAMQ4 ;ALB/MJK - AM Background Job/Add/Edit Processing ; 24 Aug 99 9:59 PM
+1 ;;5.3;Scheduling;**24,132,153,199**;Aug 13, 1993
+2 ;
EN(SDBEG,SDEND) ; -- count add/edits
+1 NEW SDT,SDOE
+2 SET SDT=SDBEG
+3 FOR
SET SDT=$ORDER(^SCE("B",SDT))
if 'SDT!(SDT>SDEND)
QUIT
Begin DoDot:1
+4 SET SDOE=0
+5 FOR
SET SDOE=$ORDER(^SCE("B",SDT,SDOE))
if 'SDOE
QUIT
DO CHK(SDOE)
End DoDot:1
ENQ QUIT
+1 ;
CHK(SDOE) ; -- set data in ^tmp if appropriate
+1 NEW SDOE0,SDIVNM,SDNAT,X,SDSTOP,SDSTAT
+2 SET SDOE0=$GET(^SCE(SDOE,0))
+3 SET SDPAR=+$PIECE(SDOE0,U,6)
+4 SET SDORG=+$PIECE(SDOE0,U,8)
+5 SET SDSTAT=$PIECE(SDOE0,U,12)
+6 ;
+7 ; -- do checks
+8 ; -- quit if has parent
IF SDPAR
GOTO CHKQ
+9 ; -- quit if no a/e
IF SDORG'=2
GOTO CHKQ
+10 ; -- quit if "CO" not required
IF $$REQ^SDM1A(+SDOE0)'="CO"
GOTO CHKQ
+11 ; -- quit if no division
IF '$$DIV^SDAMQ(+$PIECE(SDOE0,U,11),.SDIVNM,35)
GOTO CHKQ
+12 ;
+13 ; -- set ^tmp
+14 SET SDNAT='$$CO^SDAMQ(SDOE)
IF SDNAT
SET SDNAT=SDSTAT=14
+15 SET SDSTOP=+$PIECE($GET(^DIC(40.7,+$PIECE(SDOE0,U,3),0)),U,2)
+16 SET X=$GET(^TMP("SDSTATS",$JOB,SDIVNM,"AE",SDSTOP))
+17 SET ^TMP("SDSTATS",$JOB,SDIVNM,"AE",SDSTOP)=(X+SDNAT)_U_($PIECE(X,U,2)+1)
+18 ;
CHKQ QUIT
+1 ;
BULL(SDIVNM,SDLN,SDTOT) ;
+1 NEW SDSTOP,SDSTOPN,NAT,GRAND,OTHER,TNAT,TGRAND
+2 DO HDR
+3 SET (OTHER,SDSTOP,TNAT,TGRAND)=0
+4 FOR
SET SDSTOP=$ORDER(^TMP("SDSTATS",$JOB,SDIVNM,"AE",SDSTOP))
if 'SDSTOP
QUIT
SET X=^(SDSTOP)
Begin DoDot:1
+5 SET NAT=+X
SET GRAND=+$PIECE(X,U,2)
+6 SET TNAT=TNAT+NAT
SET TGRAND=TGRAND+GRAND
+7 SET SDTOT("DIV","NAT")=SDTOT("DIV","NAT")+NAT
+8 SET SDTOT("DIV","GRAND")=SDTOT("DIV","GRAND")+GRAND
+9 SET SDSTOPN=$SELECT($DATA(^DIC(40.7,+$ORDER(^DIC(40.7,"C",SDSTOP,0)),0)):$PIECE(^(0),U),1:"UNKNOWN")
+10 IF 'NAT
SET OTHER=OTHER+GRAND
+11 IF NAT
DO LINE^SDAMQ3(SDSTOP_"-"_SDSTOPN,NAT,GRAND)
End DoDot:1
+12 DO LINE^SDAMQ3("ALL OTHER STOPS",0,OTHER)
+13 DO SET^SDAMQ3(" --------------- ---------------- ------- -------")
+14 DO LINE^SDAMQ3("Add/Edit Totals",TNAT,TGRAND)
BULLQ QUIT
+1 ;
HDR ; -- ae header block
+1 DO SET^SDAMQ3("")
+2 DO SET^SDAMQ3(" Add/Edits Total")
+3 DO SET^SDAMQ3(" Stop Code Requiring Action Stops Pct.")
+4 DO SET^SDAMQ3(" --------- ---------------- ------- -------")
+5 QUIT