SCDXFX01 ;ALB/JRP - AMBULATORY CARE FILE X-REFS & UTILS;30-APR-1996
;;5.3;Scheduling;**44,99**;AUG 13, 1993
;
AACXMIT(IFN,SET,OLDDATE) ;Logic for AACXMIT* cross references of
; TRANSMITTED OUTPATIENT ENCOUNTER file (#409.73)
;
;Input : IFN - Pointer to entry in file
; SET - If 1, set cross reference
; If 0, kill cross reference
; If -1, check the current value of TRANSMISSION
; REQUIRED field (#.04), setting the cross reference
; if a value of 'YES' is found and killing the
; cross reference if a value of 'NO' is found
; (DEFAULT)
; OLDDATE - Previous value of DATE/TIME OF EVENT field (#.06)
; - Only valid when KILLing the x-ref is due to the
; DATE/TIME OF EVENT field (#.06) changing
;Output : None
;
;Check input
Q:('$G(IFN))
Q:('$D(^SD(409.73,IFN)))
S:($G(SET)="") SET=-1
S OLDDATE=+$G(OLDDATE)
;Declare variables
N ZERO,EVENT,EVNTDATE,XMIT
;Get zero node
S ZERO=$G(^SD(409.73,IFN,0))
;Get value of TRANSMISSION REQUIRED field
S XMIT=+$P(ZERO,"^",4)
;Set/kill logic based on value of TRANSMISSION REQUIRED
S:(SET=-1) SET=$S(XMIT=1:1,1:0)
;Get event date/time
S EVNTDATE=+$P(ZERO,"^",6)
;Use old event date/time if killing due to this value changing
S:(('SET)&(OLDDATE)) EVNTDATE=OLDDATE
;No event date/time - don't set x-ref
Q:('EVNTDATE)
;Setting of x-ref is screened so x-ref is only set on add, edit,
; delete, and retransmit events
S EVENT=+$P(ZERO,"^",5)
I (SET) Q:((EVENT>3)!(EVENT<0)) S ^SD(409.73,"AACXMIT",EVNTDATE,IFN)=""
;Kill x-ref
K:('SET) ^SD(409.73,"AACXMIT",EVNTDATE,IFN)
Q
;
AACNA(IFN,SET,OLDDATE) ;Logic for AACNA* cross references of TRANSMITTED
; OUTPATIENT ENCOUNTER file (#409.73)
;
;Input : IFN - Pointer to entry in file
; SET - If 1, set cross reference
; If 0, kill cross reference (DEFAULT)
; OLDDATE - Previous value of DATE/TIME OF XMIT TO NPCDB
; field (#11)
; - Only valid when KILLing the x-ref is due to the
; DATE/TIME OF XMIT TO NPCDB field (#11) changing
;Output : None
;
;Check input
Q:('$G(IFN))
Q:('$D(^SD(409.73,IFN)))
S SET=+$G(SET)
S OLDDATE=+$G(OLDDATE)
;Declare variables
N NODE,XMITDATE
;Get node
S NODE=$G(^SD(409.73,IFN,1))
;Get date/time of transmission
S XMITDATE=+$P(NODE,"^",1)
;Use old date/time of transmission if this changed
S:(('SET)&(OLDDATE)) XMITDATE=OLDDATE
;No transmission date/time - don't set x-ref
Q:('XMITDATE)
;Set x-ref
S:(SET) ^SD(409.73,"AACNOACK",XMITDATE,IFN)=""
;Kill x-ref
K:('SET) ^SD(409.73,"AACNOACK",XMITDATE,IFN)
Q
;
AUTO() ;Auto-numbering logic for TRANSMITTED OUTPATIENT ENCOUNTER file
;
;Input : None
;Output : N - Next value to use for NUMBER field (#.01) of
; TRANSMITTED OUTPATIENT ENCOUNTER file (#409.73)
;Note : Auto-numbering logic is based on the LAST XMIT OUTPAT
; ENC NUMBER field (#701.01) of the SCHEDULING PARAMETER
; file (#404.91)
;
;Declare variables
N NEXT,SUCCESS
;Lock node to prevent simultaneous use
L +^SD(404.91,1,"AMB"):1800 S SUCCESS=$S(($T):1,1:0)
Q:('SUCCESS) 0
;Get last value used and increment by 1
S NEXT=1+$G(^SD(404.91,1,"AMB"))
;Make sure value hasn't already been used
I $D(^SD(409.73,"B",NEXT)) F NEXT=NEXT:1 Q:('$D(^SD(409.73,"B",NEXT)))
;Store new value
S $P(^SD(404.91,1,"AMB"),"^",1)=NEXT
;Unlock node
L -^SD(404.91,1,"AMB")
;Return value to use
Q NEXT
--- Routine Detail --- with STRUCTURED ROUTINE LISTING ---[H[J[2J[HSCDXFX01 3647 printed Dec 13, 2024@02:39:15 Page 2
SCDXFX01 ;ALB/JRP - AMBULATORY CARE FILE X-REFS & UTILS;30-APR-1996
+1 ;;5.3;Scheduling;**44,99**;AUG 13, 1993
+2 ;
AACXMIT(IFN,SET,OLDDATE) ;Logic for AACXMIT* cross references of
+1 ; TRANSMITTED OUTPATIENT ENCOUNTER file (#409.73)
+2 ;
+3 ;Input : IFN - Pointer to entry in file
+4 ; SET - If 1, set cross reference
+5 ; If 0, kill cross reference
+6 ; If -1, check the current value of TRANSMISSION
+7 ; REQUIRED field (#.04), setting the cross reference
+8 ; if a value of 'YES' is found and killing the
+9 ; cross reference if a value of 'NO' is found
+10 ; (DEFAULT)
+11 ; OLDDATE - Previous value of DATE/TIME OF EVENT field (#.06)
+12 ; - Only valid when KILLing the x-ref is due to the
+13 ; DATE/TIME OF EVENT field (#.06) changing
+14 ;Output : None
+15 ;
+16 ;Check input
+17 if ('$GET(IFN))
QUIT
+18 if ('$DATA(^SD(409.73,IFN)))
QUIT
+19 if ($GET(SET)="")
SET SET=-1
+20 SET OLDDATE=+$GET(OLDDATE)
+21 ;Declare variables
+22 NEW ZERO,EVENT,EVNTDATE,XMIT
+23 ;Get zero node
+24 SET ZERO=$GET(^SD(409.73,IFN,0))
+25 ;Get value of TRANSMISSION REQUIRED field
+26 SET XMIT=+$PIECE(ZERO,"^",4)
+27 ;Set/kill logic based on value of TRANSMISSION REQUIRED
+28 if (SET=-1)
SET SET=$SELECT(XMIT=1:1,1:0)
+29 ;Get event date/time
+30 SET EVNTDATE=+$PIECE(ZERO,"^",6)
+31 ;Use old event date/time if killing due to this value changing
+32 if (('SET)&(OLDDATE))
SET EVNTDATE=OLDDATE
+33 ;No event date/time - don't set x-ref
+34 if ('EVNTDATE)
QUIT
+35 ;Setting of x-ref is screened so x-ref is only set on add, edit,
+36 ; delete, and retransmit events
+37 SET EVENT=+$PIECE(ZERO,"^",5)
+38 IF (SET)
if ((EVENT>3)!(EVENT<0))
QUIT
SET ^SD(409.73,"AACXMIT",EVNTDATE,IFN)=""
+39 ;Kill x-ref
+40 if ('SET)
KILL ^SD(409.73,"AACXMIT",EVNTDATE,IFN)
+41 QUIT
+42 ;
AACNA(IFN,SET,OLDDATE) ;Logic for AACNA* cross references of TRANSMITTED
+1 ; OUTPATIENT ENCOUNTER file (#409.73)
+2 ;
+3 ;Input : IFN - Pointer to entry in file
+4 ; SET - If 1, set cross reference
+5 ; If 0, kill cross reference (DEFAULT)
+6 ; OLDDATE - Previous value of DATE/TIME OF XMIT TO NPCDB
+7 ; field (#11)
+8 ; - Only valid when KILLing the x-ref is due to the
+9 ; DATE/TIME OF XMIT TO NPCDB field (#11) changing
+10 ;Output : None
+11 ;
+12 ;Check input
+13 if ('$GET(IFN))
QUIT
+14 if ('$DATA(^SD(409.73,IFN)))
QUIT
+15 SET SET=+$GET(SET)
+16 SET OLDDATE=+$GET(OLDDATE)
+17 ;Declare variables
+18 NEW NODE,XMITDATE
+19 ;Get node
+20 SET NODE=$GET(^SD(409.73,IFN,1))
+21 ;Get date/time of transmission
+22 SET XMITDATE=+$PIECE(NODE,"^",1)
+23 ;Use old date/time of transmission if this changed
+24 if (('SET)&(OLDDATE))
SET XMITDATE=OLDDATE
+25 ;No transmission date/time - don't set x-ref
+26 if ('XMITDATE)
QUIT
+27 ;Set x-ref
+28 if (SET)
SET ^SD(409.73,"AACNOACK",XMITDATE,IFN)=""
+29 ;Kill x-ref
+30 if ('SET)
KILL ^SD(409.73,"AACNOACK",XMITDATE,IFN)
+31 QUIT
+32 ;
AUTO() ;Auto-numbering logic for TRANSMITTED OUTPATIENT ENCOUNTER file
+1 ;
+2 ;Input : None
+3 ;Output : N - Next value to use for NUMBER field (#.01) of
+4 ; TRANSMITTED OUTPATIENT ENCOUNTER file (#409.73)
+5 ;Note : Auto-numbering logic is based on the LAST XMIT OUTPAT
+6 ; ENC NUMBER field (#701.01) of the SCHEDULING PARAMETER
+7 ; file (#404.91)
+8 ;
+9 ;Declare variables
+10 NEW NEXT,SUCCESS
+11 ;Lock node to prevent simultaneous use
+12 LOCK +^SD(404.91,1,"AMB"):1800
SET SUCCESS=$SELECT(($TEST):1,1:0)
+13 if ('SUCCESS)
QUIT 0
+14 ;Get last value used and increment by 1
+15 SET NEXT=1+$GET(^SD(404.91,1,"AMB"))
+16 ;Make sure value hasn't already been used
+17 IF $DATA(^SD(409.73,"B",NEXT))
FOR NEXT=NEXT:1
if ('$DATA(^SD(409.73,"B",NEXT)))
QUIT
+18 ;Store new value
+19 SET $PIECE(^SD(404.91,1,"AMB"),"^",1)=NEXT
+20 ;Unlock node
+21 LOCK -^SD(404.91,1,"AMB")
+22 ;Return value to use
+23 QUIT NEXT