ACRFVEN ;OIRM/IHS/DSD/AEF - EXTRINSIC FUNCTION TO RETURN VENDOR LAST EXPORT DATE [ 11/01/2001 9:44 AM ]
;;2.1;ADMIN RESOURCE MGT SYSTEM;;NOV 05, 2001
;
EN(EIN) ;EP -- EXTRINSIC FUNCTION MAIN ENTRY POINT
;
; EIN = VENDOR IEN
;
I EIN="" Q EIN
N BAT,FY,LAST,SEQ,VEN
K ^TMP("ACRZ",$J)
S VEN=EIN
S FY=0 F S FY=$O(^AFSLAFP("E",VEN,FY)) Q:'FY D
. S BAT=0 F S BAT=$O(^AFSLAFP("E",VEN,FY,BAT)) Q:'BAT D
. . S SEQ=0 F S SEQ=$O(^AFSLAFP("E",VEN,FY,BAT,SEQ)) Q:'SEQ D ONE
I '$D(^TMP("ACRF",$J,VEN)) Q ""
S LAST=$O(^TMP("ACRF",$J,VEN,0))
I LAST S LAST=$P(^TMP("ACRF",$J,VEN,LAST,0),U,2)
K ^TMP("ACRZ",$J)
Q LAST
Q
ONE ;----- SETS DATA FOR ONE SEQUENCE NUMBER ENTRY
;
N EXP
S EXP=$P($G(^AFSLAFP(FY,1,BAT,2)),U)
I EXP'="" D
. S ^TMP("ACRF",$J,VEN,9999999-EXP,0)=VEN_U_EXP
Q
ADD(D0) ;EP -- RETURNS ADDRESS VARIABLES IN ADD ARRAY
;
; D0 = VENDOR FILE IEN
;
N DATA,CNT,STATE
K ADD
S CNT=0
S DATA=$G(^AUTTVNDR(D0,14))
S STATE=$P(DATA,U,4)
I STATE S STATE=$P($G(^DIC(5,STATE,0)),U,2)
I $P(DATA,U)'="" S CNT=CNT+1 S ADD(CNT)=$P(DATA,U)
I $P(DATA,U,2)'="" S CNT=CNT+1 S ADD(CNT)=$P(DATA,U,2)
I ($P(DATA,U,3)="")&(STATE="")&($P(DATA,U,5)="") Q
S CNT=CNT+1
S ADD(CNT)=$P(DATA,U,3)_", "_STATE_" "_$P(DATA,U,5)
Q
ACRFVEN ;OIRM/IHS/DSD/AEF - EXTRINSIC FUNCTION TO RETURN VENDOR LAST EXPORT DATE [ 11/01/2001 9:44 AM ]
+1 ;;2.1;ADMIN RESOURCE MGT SYSTEM;;NOV 05, 2001
+2 ;
EN(EIN) ;EP -- EXTRINSIC FUNCTION MAIN ENTRY POINT
+1 ;
+2 ; EIN = VENDOR IEN
+3 ;
+4 IF EIN=""
QUIT EIN
+5 NEW BAT,FY,LAST,SEQ,VEN
+6 KILL ^TMP("ACRZ",$JOB)
+7 SET VEN=EIN
+8 SET FY=0
FOR
SET FY=$ORDER(^AFSLAFP("E",VEN,FY))
IF 'FY
QUIT
Begin DoDot:1
+9 SET BAT=0
FOR
SET BAT=$ORDER(^AFSLAFP("E",VEN,FY,BAT))
IF 'BAT
QUIT
Begin DoDot:2
+10 SET SEQ=0
FOR
SET SEQ=$ORDER(^AFSLAFP("E",VEN,FY,BAT,SEQ))
IF 'SEQ
QUIT
DO ONE
End DoDot:2
End DoDot:1
+11 IF '$DATA(^TMP("ACRF",$JOB,VEN))
QUIT ""
+12 SET LAST=$ORDER(^TMP("ACRF",$JOB,VEN,0))
+13 IF LAST
SET LAST=$PIECE(^TMP("ACRF",$JOB,VEN,LAST,0),U,2)
+14 KILL ^TMP("ACRZ",$JOB)
+15 QUIT LAST
+16 QUIT
ONE ;----- SETS DATA FOR ONE SEQUENCE NUMBER ENTRY
+1 ;
+2 NEW EXP
+3 SET EXP=$PIECE($GET(^AFSLAFP(FY,1,BAT,2)),U)
+4 IF EXP'=""
Begin DoDot:1
+5 SET ^TMP("ACRF",$JOB,VEN,9999999-EXP,0)=VEN_U_EXP
End DoDot:1
+6 QUIT
ADD(D0) ;EP -- RETURNS ADDRESS VARIABLES IN ADD ARRAY
+1 ;
+2 ; D0 = VENDOR FILE IEN
+3 ;
+4 NEW DATA,CNT,STATE
+5 KILL ADD
+6 SET CNT=0
+7 SET DATA=$GET(^AUTTVNDR(D0,14))
+8 SET STATE=$PIECE(DATA,U,4)
+9 IF STATE
SET STATE=$PIECE($GET(^DIC(5,STATE,0)),U,2)
+10 IF $PIECE(DATA,U)'=""
SET CNT=CNT+1
SET ADD(CNT)=$PIECE(DATA,U)
+11 IF $PIECE(DATA,U,2)'=""
SET CNT=CNT+1
SET ADD(CNT)=$PIECE(DATA,U,2)
+12 IF ($PIECE(DATA,U,3)="")&(STATE="")&($PIECE(DATA,U,5)="")
QUIT
+13 SET CNT=CNT+1
+14 SET ADD(CNT)=$PIECE(DATA,U,3)_", "_STATE_" "_$PIECE(DATA,U,5)
+15 QUIT