ACRFUFMZ ;IHS/OIRM/DSD/AEF - MATCH OPEN DOCUMENTS FROM CORE FOR UFMS [ 05/16/2007 9:44 AM ]
;;2.1;ADMIN RESOURCE MGMT SYSTEM;**22**;NOV 05, 2001
;NEW ROUTINE ACR*2.1*22 UFMS
;
; File ^ACRZ("ACRCORE",##) is created by READ^ACRFUFMR
; by reading the flat file provided by CORE.
; File name is Docs##.txt where ## is the Accounting Point.
; Comma delimiters were stripped and replaced by the ARMS
; up-arrow (^) delimiter, which is used throughout.
;
; ^ACRZ("ACRCORE",##)=
; Piece 1: AP = Accounting Point
; 2: doc_type = CORE Document Type (see below)
; 3: doc_no = CORE Document number
; 4: fy = 4-digit Fiscal Year
; 5: can = Common Accounting Number (CAN)
; 6: obj_cls = Object Class Code (OCC)
; 7: amt = Dollar Amount
; 8: ref = Reference Code
; 9: ein = CORE Vendor EIN
;
; CORE DOC_TYPE =
; AP - Requisition/Purchase Order/Contracts
; AT - Airline
; GP - Government Payment
; GR - Grants (Non-PMS)
; PM - Grants (PMS)
; PR - Payroll
; TN - Training
; TR - Travel
; MO - Mixed obligations
; MD - Miscellaneous documents
;
; ****************************************
; ****************************************
; This routine loops through the ^ACRZ("ACRCORE" entries and
; attempts to match the CORE document number with ARMS
; documents in the FMS Document, FMS Document History Record and
; the 1166 Approvals for Payment files.
;
; When it finds a document hit, the routine matches the CAN,
; Fiscal Year, and Object Class Code supplied by CORE.
;
; When it finds a match the routine:
; 1) sets the error variable ACRERR to null
; 2) sets ^ACRZ("ACRDOC",CORE Index number) = DOCUMENT String
; Piece 1 = Accounting Point_-_Vendor IEN
; 2 = ASUFAC number_-_Vendor IEN
; 3 = Vendor name
; 4 = Vendor EIN
; 5 = Vendor suffix
; 6 = ARMS Requisition number or blank
; 7 = Document or Transaction dates
; 8 = Identifier, Invoice number or blank
; 9 = Accounting point (begins CORE data string)
; 10 = CORE Document Type
; 11 = CORE Document number
; 12 = 4 digit Fiscal Year
; 13 = Common Accounting Number (CAN)
; 14 = Object Class Code (OCC)
; 15 = CORE Dollar amount
; 16 = CORE Reference code
; 17 = Receiving Report Status
; 18 = Invoice Status
; 19 = Vendor Error flag
; 3) retreives the Vendor IEN from ARMS record (can be zero if no Vendor)
; 4) if no Vendor in the FMS Document file, sets
; ^ACRZ("NOVNDR",Core Index number) = DOCUMENT_CORE strings
; As Travel documents will not have a vendor they are captured
; in the ^ACRZ("TR",Core Index number)= DOCUMENT_CORE strings regardless
; of whether or not they are matched in ARMS
; Other entries will be obligations only
; 5) checks the entry in the VENDOR file for errors
; if an error is found, ACRERR = Error string
; errors are set in ^ACRZ("ERR",CORE Index number) = DOCUMENT_CORE_ACRERR
; 6) sets ^ACRZ("VNDR",Vendor IEN) =DOCUMENT_CORE_ACRERR
; ACRERR can = "NO ERRORS" or Vendor file errors
; 7) in addition, sets non-ARMS documents and certain subsets into:
; a. ^ACRZ("PAY",CORE Index number)= CORE string (Non-ARMS Payroll)
; b. ^ACRZ("CHS",CORE Index number)= CORE string (Non-ARMS Contract Health)
; c. ^ACRZ("GR",CORE Index number)= CORE string (Non-ARMS Grants)
; d. ^ACRZ("GTRIP",CORE Index number)= CORE string (Non-ARMS GovTrip Travel)
; e. ^ACRZ("ITEMS",CORE Index number)= CORE string (ARMS Items in matched documents)
; f. ^ACRZ("NOMATCH",CORE Index number)= CORE string (ARMS Hit, no precise match)
; g. ^ACRZ("TR",CORE Index number)= CORE string (All Old ARMS Travel match)
; h. ^ACRZ("TOTALS",CORE Index number)= CORE string (Totals of all reports)
; i. ^ACRZ("CEIN",CORE Index number)= CORE string (CORE/ARMS Vendor mismatches)
; j. ^ACRZ("NOHIT",CORE Index number)= CORE string (No known category)
; *********************************
; *********************************
EN ;EP; MAIN ENTRY POINT -- CALLED BY READ^ACRFUFMR THROUGH TASKMAN
D INIT
D LOOP
D TOTAL
D ENW^ACRFUFMR ;CREATE REPORTS IN CSV FORMAT
Q
; *********************************
; *********************************
INIT ;SET UP GLOBALS
K ^ACRZ("ACRDOC")
K ^ACRZ("VNDR")
K ^ACRZ("ERR")
K ^ACRZ("NOVNDR")
K ^ACRZ("NOHIT")
K ^ACRZ("NOMATCH")
K ^ACRZ("PAY")
K ^ACRZ("TOTALS")
K ^ACRZ("ITEMS")
K ^ACRZ("GTRIP")
K ^ACRZ("CHS")
K ^ACRZ("TR")
K ^ACRZ("GR")
K ^ACRZ("CEIN") ;AUDIT FOR MISMATCHED EIN'S
;INITIALIZE VARIABLES
K ACR,ACRDCNT,ACRVCNT,ACRECNT,ACRERR,ACRTCNT,ACRZCNT,ACRMCNT,ACRAP,ACRPCNT
K ACRGTRIP,ACRGTOT,ACRCHST,ACRTRTOT,ACRTAIL,ACRNTRT,ACRGRTOT
K ACRCEIN,ACRAMT,ACRHIT,ACRCORE
S (ACR,ACRDCNT,ACRVCNT,ACRECNT,ACRERR,ACRTCNT,ACRZCNT,ACRMCNT,ACRPCNT)=0
S (ACRGTOT,ACRCHST,ACRTRTOT,ACRGRTOT,ACRAMT)=0
S ASUFAC=$$ASUFAC^ACRFFF4(+$P(^AUTTSITE(1,0),U))
Q
; *********************************
; *********************************
LOOP ;LOOP THROUGH CORE OPEN DOCUMENTS
F S ACR=$O(^ACRZ("ACRCORE",ACR)) Q:'ACR D
.S ACRMATCH=0
.D SETCORE ;PIECE OUT CORE VARIABLES (they will float)
.Q:ACRCDOC="" ;SCREEN EXEMPTIONS
.;LOOK FOR MATCH IN ARMS FILES
.I $D(^ACRDOC("B",ACRCDOC))!($D(^ACRDOC("C",ACRCDOC))) D Q:ACRMATCH
..D HITDOC(ACRCDOC) ;FMS DOCUMENT FILE
.I $$REQ D HITDOC(ACRREQ) S ACRREQ="" Q:ACRMATCH ;FOUND REBUILT REQ
.I $D(^AFSLAFP("N",ACRCDOC)) D HIT1166^ACRFUFMX(ACRCDOC,0) Q:ACRMATCH ;1166 APPROVALS FOR PAYMENT FILE
.I $D(^ACRDHR("B",ACRCDOC)) D HITDHR^ACRFUFMX(ACRCDOC) Q ;FMS DOCUMENT HISTORY RECORD FILE
.Q:$D(^ACRZ("NOMATCH",ACR)) ;ALREADY COUNTED
.;NO HIT -- ACCOUNT FOR NONARMS
.D NONARMS
Q
; ***********************************
NONARMS ;ASSIGN NON-ARMS TO APPROPRIATE FILES
; ***********************************
;
;CHS FI PAID **********************
I ACRCHS D CHSSET(ACR) Q ;DON'T CHECK CHS VENDOR
;
;CHECK CORE VENDOR ****************
S ACRV=$$VEN^ACRFUFMU(ACRCEIN) ;CHECK CORE VENDOR
S:ACRV=0 ACRERR="NO VENDOR FOUND"
I ACRV,ACRCEIN'[111111111,'$D(^ACRZ("VNDR",ACRV)) D
.Q:ACRCTYP="TR" ;DON'T WANT TRAVEL VENDORS
.D CKVEND^ACRFUFMU(ACRV)
.S ACRSTR="CORE VENDOR FOUND"_U_U_U_ACRCORE_U_U
.D SETVND
;
;GOVTRIP *************************
I ACRGTRIP D Q
.S ^ACRZ("GTRIP",ACR)="NO HIT GOV TRIP"_U_ACRCORE_U_ACRERR
.S ACRGTOT=ACRGTOT+1
;
;ARMS TRAVEL/AIRLINE *************
I ACRCTYP="TR"!(ACRCTYP="AT") D Q ;CAPTURE TRAVEL/AIRLINE
.Q:$D(^ACRZ("TR",ACR))
.S ^ACRZ("TR",ACR)="NO HIT TRAVEL"_U_U_U_U_ACRCORE
.S ACRTRTOT=ACRTRTOT+1
;
;GRANTS **************************
I ACRCTYP="GR"!(ACRCTYP="PM") D Q
.S ^ACRZ("GR",ACR)="NO HIT GRANT"_U_ACRCORE_U_ACRERR
.S ACRGRTOT=ACRGRTOT+1
;
;NOHIT -- LEFTOVERS **************
S ^ACRZ("NOHIT",ACR)="NO HIT UNKNOWN"_U_ACRCORE_U_ACRERR
S ACRTCNT=ACRTCNT+1
Q
; *********************************
TOTAL ;SET TOTALS ***********************
S ^ACRZ("TOTALS","TOTAL")=ACRAMT ;Total amount from all CORE Docs
S ^ACRZ("ACRDOC","TOTAL")=ACRDCNT ;# of matched documents w/Vendor
S ^ACRZ("VNDR","TOTAL")=ACRVCNT ;# of unique Vendors
S ^ACRZ("NOHIT","TOTAL")=ACRTCNT ;# of Unidentified No Hits
S ^ACRZ("NOMATCH","TOTAL")=ACRMCNT ;# of Hits with No Match
S ^ACRZ("NOVNDR","TOTAL")=ACRZCNT ;# of matched Documents w/o Vendors
S ^ACRZ("ERR","TOTAL")=ACRECNT ;# of Vendors with Errors
S ^ACRZ("PAY","TOTAL")=ACRPCNT ;# of Payroll documents (No Hit)
S ^ACRZ("GTRIP","TOTAL")=ACRGTOT ;# of GovTrip documents (No Hit)
S ^ACRZ("CHS","TOTAL")=ACRCHST ;# of CHS documents (No Hit)
S ^ACRZ("TR","TOTAL")=ACRTRTOT ;# of non-GovTrip Travel documents
S ^ACRZ("GR","TOTAL")=ACRGRTOT ;# of Grants documents (No Hit)
Q
; *********************************
; *********************************
SETCORE ; SET VARIABLES FROM CORE FILE STRING
S (ACRV,ACRCDOC,ACRREQ,ACRSTR)=""
S ACRGTRIP=0
S ACRCORE=^ACRZ("ACRCORE",ACR)
S ACRCTYP=$P(ACRCORE,U,2) ;CORE DOCUMENT TYPE
S ACRCAMT=$P(ACRCORE,U,7) ;CORE DOLLAR AMOUNT
S ACRAMT=ACRAMT+ACRCAMT ;TOTAL ALL AMOUNTS FOR AREA
;
I ACRCTYP="PR" D Q ;DON'T WANT PAYROLL ************
.S ^ACRZ("PAY",ACR)="PAYROLL"_U_ACRCORE
.S ACRPCNT=ACRPCNT+1
;
S ACRCDOC=$P(ACRCORE,U,3) ;CORE DOCUMENT NUMBER
I $E(ACRCDOC,1,3)="HHS",$L(ACRCDOC)>19 D
.S ACRCDOC=$E(ACRCDOC,11,25) ;CHECK FOR EXTENSION DOC NUMBERS
;
S:ACRCTYP="AT" ACRCTYP="TR" ;CHANGE AIRLINE TO TRAVEL
I ACRCTYP="TR"!(ACRCTYP="TN") D ;CHECK GOVTRIP TRAVEL DOC
.F I="CB","TA","RM" I $E(ACRCDOC,9,10)=I S ACRGTRIP=1
.S MRSTR=$G(MRSTR)+1 ;COUNT TRAVEL
;
S ACRCAP=$P(ACRCORE,U) ;CORE ACCOUNTING POINT
S ACRCFY=$P(ACRCORE,U,4) ;CORE FISCAL YEAR
S ACRCCAN=$P(ACRCORE,U,5) ;CORE CAN
S ACRCOCC=$P(ACRCORE,U,6) ;CORE OBJECT CLASS CODE
S ACRCREF=$P(ACRCORE,U,8) ;CORE REFERENCE CODE
S ACRCEIN=$P(ACRCORE,U,9) ;CORE VENDOR EIN
S ACRAP=$E(ACRCCAN,2,3) ;GET ACTUAL AP FROM CAN
S ACRCHS=$$CHS^ACRFUFMU ;SET CHS FLAG
Q
;
; ***********************************
HITDOC(ACRDOC) ;FOUND CORE DOCUMENT NUMBER IN ARMS FMS DOCUMENT FILE
;
; - Enters with: ACRCDOC = CORE document number
;
; ACRCORE VARIABLES FROM string from CORE file
;
N ACRDA,ACRREQ,ACRXZ
F ACRXZ="B","C" D Q:ACRMATCH
.Q:'$D(^ACRDOC(ACRXZ,ACRDOC))
.S ACRDA=0
.F S ACRDA=$O(^ACRDOC(ACRXZ,ACRDOC,ACRDA)) Q:'ACRDA D Q:ACRMATCH
..S ACRMATCH=$$MATCHDOC(ACRDA)
Q
;
; ***********************************
MATCHDOC(ACRDA) ;Check ARMS against CORE
;
;----- LOOP THROUGH PO ITEMS IN FMS SUPPLIES AND SERVICES FILE
; AND MATCH WITH CORE DATA
; Enters with: ACRDOCDA = FMS Document file IEN
; ACRCOCC = CORE OCC
; ACRCFY = CORE Fiscal Year
; ACRCCAN = CORE CAN
; ACRCEIN = CORE VENDOR EIN
; ACRFY = ARMS
; ACROCC = ARMS OCC
; ACRCAN = ARMS CAN
; Returns: 0 = No match
; 1 = Match
;
N ACRCANDA,ACRCAN,ACRSS0,ACRIDA,ACRDEPT,ACROCCDA,ACROCC,ACRFY
N ACRRFIN,ACRIFIN,ACRID
K ACRXX
S (ACRCAN,ACROCC)=""
S (ACRMATCH,ACRHIT)=0
S ACRDOC0=$G(^ACRDOC(ACRDA,0))
S ACRREQ=$P(ACRDOC0,U) ;REQUISITION/TRAVEL NUMB
S ACRCC=$P(ACRDOC0,U,4) ;REQUEST TYPE
;GET VENDOR FROM DOCUMENT OR THE CREDIT CARD DEFAULT VENDOR
S ACRV=$S(ACRCC=35:$$CCVEN^ACRFUFMU,1:$$VENDOR^ACRFUFMU(ACRDA))
I ACRV,'ACRCHS,ACRCTYP="TR" S ACRV=0 ;DON'T WANT TRAVELER
S ACRID=$P(ACRDOC0,U,14)
S ACRSTR=ACRREQ_U_$$DOCDT^ACRZFFU(ACRDA)_U_ACRID ;DOC DAT,IDENTIFIER
F ACRX="C","J" D Q:ACRHIT
.S ACRIDA=0
.F S ACRIDA=$O(^ACRSS(ACRX,ACRDA,ACRIDA)) Q:'ACRIDA D
..S ACRSS0=$G(^ACRSS(ACRIDA,0))
..S ACRSS0=$TR(ACRSS0,"""")
..S ACROCCDA=$P(ACRSS0,U,4) ;OBJECT CLASS CODE
..S ACRCANDA=$P(ACRSS0,U,5) ;COMMON ACCOUNTING NUMBER
..S ACRDEPT=$P(ACRSS0,U,6)
..S ACRFY=$$FYFUN^ACRFUTL1(ACRDEPT)
..D PIECE^ACRFUFMU
..S ACRMATCH=$$MATCH^ACRFUFMU ;LOOK FOR FY,CAN,OCC MATCH
..I ACRMATCH D
...D ITEMS^ACRFUFMI(ACRCDOC,ACRIDA,ACRCORE,.ACRRFIN,.ACRIFIN,.ACRHIT) ;SETS ITEMS INTO ^ACRZ("ITEMS"
.I ACRHIT D SET
.I 'ACRHIT D SETCK^ACRFUFMU("NO MATCH DOC",ACR)
Q ACRHIT
;
; ***********************************
SET ;EP; SET ACRZ(NODE,# WITH MATCHED DATA
; ENTERS WITH DATA STRING FROM
; FMS DOCUMENT FILE or
; 1166 APPROVALS FOR PAYMENT FILE or
; FMS DOCUMENT HISTORY RECORD FILE
; ACRV = VENDOR FILE IEN
;
S ACRMATCH=1
I ACRV'>0 S ACRV=$$VEN^ACRFUFMU(ACRCEIN) ;CHECK CORE VENDOR
S ACRERR=$S(ACRV>0:$$CKVEND^ACRFUFMU(ACRV),1:"") ;CHECK FOR VENDOR ERRORS
S:ACRERR="" ACRERR="NO VENDOR ERRORS"
S ACRSTR=ACRSTR_U_ACRCORE_U_ACRRFIN_U_ACRIFIN ;ADD ARMS RR & INVOICE STATUS
;
; TRAVEL ****************************
I ACRCTYP="TR"!(ACRCTYP="AT") D Q
.S MSG=$S(ACRV>0:$$VNAME^ACRFUFMU(ACRV),1:"TRAVELLER")
.S ^ACRZ("TR",ACR)=MSG_U_ACRSTR_U_ACRERR
.D SETVND
.S ACRTRTOT=ACRTRTOT+1
.D SETCK^ACRFUFMU(MSG,ACR)
;
; NO VENDOR IN ARMS *****************
I ACRV=0 D Q
.S ^ACRZ("NOVNDR",ACR)="NO VENDOR"_U_ACRSTR
.I ACRCEIN'["1111111111" D
..S ^ACRZ("CEIN",ACR)=ACRCEIN_"/NO IHS"_U_ACRCORE ;CAPTURE CORE VENDOR EIN FOR DOCUMENT
.S ACRZCNT=ACRZCNT+1
.D SETCK^ACRFUFMU("",ACR)
;
; ARMS MATCH WITH VENDOR ************
D SETVND
S ^ACRZ("ACRDOC",ACR)=ACRSTR
S ACRDCNT=ACRDCNT+1
D SETCK^ACRFUFMU("",ACR)
Q
SETVND ;EP - SET STRING INTO VNDR NODE *********
Q:ACRV'>0
S ACRAPV=ACRAP_"-"_ACRV
S ACRASV=ASUFAC_"-"_ACRV
S:ACRERR="" ACRERR="NO VENDOR ERRORS"
S ACRVNAM=$$VNAME^ACRFUFMU(ACRV)
S ACREIN=$$EIN^ACRFUFMU(ACRV)
S ACRSFX=$$SFX^ACRFUFMU(ACRV)
S ACRSTR=ACRAPV_U_ACRASV_U_ACRVNAM_U_ACREIN_U_ACRSFX_U_ACRSTR_U_ACRERR ;ADD VENDOR INFORMATION
Q:$D(^ACRZ("VNDR",ACRV)) ;SET STRING AND QUIT IF FOUND
S ^ACRZ("VNDR",ACRV)=ACRSTR ;SET VNDR
S ACRVCNT=ACRVCNT+1
I ACRERR'["NO VENDOR ERRORS" D
.S ACRECNT=ACRECNT+1
.S ^ACRZ("ERR",ACR)=ACRSTR
Q
; ***********************************
CHSSET(ACR) ;EP;
S ^ACRZ("CHS",ACR)="NO HIT CHS"_U_ACRCORE
S ACRCHST=ACRCHST+1
Q
; ***********************************
REQ() ;BUILD ORIGINAL REQUISITION NUMBER
N ACRCANDA,ACRLOCDA,ACRLOC
S ACRCANDA=$O(^AUTTCAN("B",ACRCCAN,0))
I ACRCANDA="" Q 0 ;NOT IN COMMON ACCOUNTING NUM FILE
S ACRLOCDA=$P($G(^AUTTCAN(ACRCANDA,0)),U,6)
I ACRLOCDA="" S ACRLOCDA=$P($G(^ACRCAN(ACRCANDA,0)),U,7)
I ACRLOCDA="" Q 0 ;NO LOCATION POINTER
S ACRLOC=$P(^AUTTLCOD(ACRLOCDA,0),U)
S ACRREQ=$E(ACRLOC)_$E(ACRCDOC,1,2)_"-"_$E(ACRCDOC,3,5)_"-"_$E(ACRCDOC,6)_"-"_$E(ACRCDOC,7,10)
I '$D(^ACRDOC("B",ACRREQ)) S ACRREQ="" Q 0 ;NOT IN DOC FILE
Q 1
ACRFUFMZ ;IHS/OIRM/DSD/AEF - MATCH OPEN DOCUMENTS FROM CORE FOR UFMS [ 05/16/2007 9:44 AM ]
+1 ;;2.1;ADMIN RESOURCE MGMT SYSTEM;**22**;NOV 05, 2001
+2 ;NEW ROUTINE ACR*2.1*22 UFMS
+3 ;
+4 ; File ^ACRZ("ACRCORE",##) is created by READ^ACRFUFMR
+5 ; by reading the flat file provided by CORE.
+6 ; File name is Docs##.txt where ## is the Accounting Point.
+7 ; Comma delimiters were stripped and replaced by the ARMS
+8 ; up-arrow (^) delimiter, which is used throughout.
+9 ;
+10 ; ^ACRZ("ACRCORE",##)=
+11 ; Piece 1: AP = Accounting Point
+12 ; 2: doc_type = CORE Document Type (see below)
+13 ; 3: doc_no = CORE Document number
+14 ; 4: fy = 4-digit Fiscal Year
+15 ; 5: can = Common Accounting Number (CAN)
+16 ; 6: obj_cls = Object Class Code (OCC)
+17 ; 7: amt = Dollar Amount
+18 ; 8: ref = Reference Code
+19 ; 9: ein = CORE Vendor EIN
+20 ;
+21 ; CORE DOC_TYPE =
+22 ; AP - Requisition/Purchase Order/Contracts
+23 ; AT - Airline
+24 ; GP - Government Payment
+25 ; GR - Grants (Non-PMS)
+26 ; PM - Grants (PMS)
+27 ; PR - Payroll
+28 ; TN - Training
+29 ; TR - Travel
+30 ; MO - Mixed obligations
+31 ; MD - Miscellaneous documents
+32 ;
+33 ; ****************************************
+34 ; ****************************************
+35 ; This routine loops through the ^ACRZ("ACRCORE" entries and
+36 ; attempts to match the CORE document number with ARMS
+37 ; documents in the FMS Document, FMS Document History Record and
+38 ; the 1166 Approvals for Payment files.
+39 ;
+40 ; When it finds a document hit, the routine matches the CAN,
+41 ; Fiscal Year, and Object Class Code supplied by CORE.
+42 ;
+43 ; When it finds a match the routine:
+44 ; 1) sets the error variable ACRERR to null
+45 ; 2) sets ^ACRZ("ACRDOC",CORE Index number) = DOCUMENT String
+46 ; Piece 1 = Accounting Point_-_Vendor IEN
+47 ; 2 = ASUFAC number_-_Vendor IEN
+48 ; 3 = Vendor name
+49 ; 4 = Vendor EIN
+50 ; 5 = Vendor suffix
+51 ; 6 = ARMS Requisition number or blank
+52 ; 7 = Document or Transaction dates
+53 ; 8 = Identifier, Invoice number or blank
+54 ; 9 = Accounting point (begins CORE data string)
+55 ; 10 = CORE Document Type
+56 ; 11 = CORE Document number
+57 ; 12 = 4 digit Fiscal Year
+58 ; 13 = Common Accounting Number (CAN)
+59 ; 14 = Object Class Code (OCC)
+60 ; 15 = CORE Dollar amount
+61 ; 16 = CORE Reference code
+62 ; 17 = Receiving Report Status
+63 ; 18 = Invoice Status
+64 ; 19 = Vendor Error flag
+65 ; 3) retreives the Vendor IEN from ARMS record (can be zero if no Vendor)
+66 ; 4) if no Vendor in the FMS Document file, sets
+67 ; ^ACRZ("NOVNDR",Core Index number) = DOCUMENT_CORE strings
+68 ; As Travel documents will not have a vendor they are captured
+69 ; in the ^ACRZ("TR",Core Index number)= DOCUMENT_CORE strings regardless
+70 ; of whether or not they are matched in ARMS
+71 ; Other entries will be obligations only
+72 ; 5) checks the entry in the VENDOR file for errors
+73 ; if an error is found, ACRERR = Error string
+74 ; errors are set in ^ACRZ("ERR",CORE Index number) = DOCUMENT_CORE_ACRERR
+75 ; 6) sets ^ACRZ("VNDR",Vendor IEN) =DOCUMENT_CORE_ACRERR
+76 ; ACRERR can = "NO ERRORS" or Vendor file errors
+77 ; 7) in addition, sets non-ARMS documents and certain subsets into:
+78 ; a. ^ACRZ("PAY",CORE Index number)= CORE string (Non-ARMS Payroll)
+79 ; b. ^ACRZ("CHS",CORE Index number)= CORE string (Non-ARMS Contract Health)
+80 ; c. ^ACRZ("GR",CORE Index number)= CORE string (Non-ARMS Grants)
+81 ; d. ^ACRZ("GTRIP",CORE Index number)= CORE string (Non-ARMS GovTrip Travel)
+82 ; e. ^ACRZ("ITEMS",CORE Index number)= CORE string (ARMS Items in matched documents)
+83 ; f. ^ACRZ("NOMATCH",CORE Index number)= CORE string (ARMS Hit, no precise match)
+84 ; g. ^ACRZ("TR",CORE Index number)= CORE string (All Old ARMS Travel match)
+85 ; h. ^ACRZ("TOTALS",CORE Index number)= CORE string (Totals of all reports)
+86 ; i. ^ACRZ("CEIN",CORE Index number)= CORE string (CORE/ARMS Vendor mismatches)
+87 ; j. ^ACRZ("NOHIT",CORE Index number)= CORE string (No known category)
+88 ; *********************************
+89 ; *********************************
EN ;EP; MAIN ENTRY POINT -- CALLED BY READ^ACRFUFMR THROUGH TASKMAN
+1 DO INIT
+2 DO LOOP
+3 DO TOTAL
+4 ;CREATE REPORTS IN CSV FORMAT
DO ENW^ACRFUFMR
+5 QUIT
+6 ; *********************************
+7 ; *********************************
INIT ;SET UP GLOBALS
+1 KILL ^ACRZ("ACRDOC")
+2 KILL ^ACRZ("VNDR")
+3 KILL ^ACRZ("ERR")
+4 KILL ^ACRZ("NOVNDR")
+5 KILL ^ACRZ("NOHIT")
+6 KILL ^ACRZ("NOMATCH")
+7 KILL ^ACRZ("PAY")
+8 KILL ^ACRZ("TOTALS")
+9 KILL ^ACRZ("ITEMS")
+10 KILL ^ACRZ("GTRIP")
+11 KILL ^ACRZ("CHS")
+12 KILL ^ACRZ("TR")
+13 KILL ^ACRZ("GR")
+14 ;AUDIT FOR MISMATCHED EIN'S
KILL ^ACRZ("CEIN")
+15 ;INITIALIZE VARIABLES
+16 KILL ACR,ACRDCNT,ACRVCNT,ACRECNT,ACRERR,ACRTCNT,ACRZCNT,ACRMCNT,ACRAP,ACRPCNT
+17 KILL ACRGTRIP,ACRGTOT,ACRCHST,ACRTRTOT,ACRTAIL,ACRNTRT,ACRGRTOT
+18 KILL ACRCEIN,ACRAMT,ACRHIT,ACRCORE
+19 SET (ACR,ACRDCNT,ACRVCNT,ACRECNT,ACRERR,ACRTCNT,ACRZCNT,ACRMCNT,ACRPCNT)=0
+20 SET (ACRGTOT,ACRCHST,ACRTRTOT,ACRGRTOT,ACRAMT)=0
+21 SET ASUFAC=$$ASUFAC^ACRFFF4(+$PIECE(^AUTTSITE(1,0),U))
+22 QUIT
+23 ; *********************************
+24 ; *********************************
LOOP ;LOOP THROUGH CORE OPEN DOCUMENTS
+1 FOR
SET ACR=$ORDER(^ACRZ("ACRCORE",ACR))
IF 'ACR
QUIT
Begin DoDot:1
+2 SET ACRMATCH=0
+3 ;PIECE OUT CORE VARIABLES (they will float)
DO SETCORE
+4 ;SCREEN EXEMPTIONS
IF ACRCDOC=""
QUIT
+5 ;LOOK FOR MATCH IN ARMS FILES
+6 IF $DATA(^ACRDOC("B",ACRCDOC))!($DATA(^ACRDOC("C",ACRCDOC)))
Begin DoDot:2
+7 ;FMS DOCUMENT FILE
DO HITDOC(ACRCDOC)
End DoDot:2
IF ACRMATCH
QUIT
+8 ;FOUND REBUILT REQ
IF $$REQ
DO HITDOC(ACRREQ)
SET ACRREQ=""
IF ACRMATCH
QUIT
+9 ;1166 APPROVALS FOR PAYMENT FILE
IF $DATA(^AFSLAFP("N",ACRCDOC))
DO HIT1166^ACRFUFMX(ACRCDOC,0)
IF ACRMATCH
QUIT
+10 ;FMS DOCUMENT HISTORY RECORD FILE
IF $DATA(^ACRDHR("B",ACRCDOC))
DO HITDHR^ACRFUFMX(ACRCDOC)
QUIT
+11 ;ALREADY COUNTED
IF $DATA(^ACRZ("NOMATCH",ACR))
QUIT
+12 ;NO HIT -- ACCOUNT FOR NONARMS
+13 DO NONARMS
End DoDot:1
+14 QUIT
+15 ; ***********************************
NONARMS ;ASSIGN NON-ARMS TO APPROPRIATE FILES
+1 ; ***********************************
+2 ;
+3 ;CHS FI PAID **********************
+4 ;DON'T CHECK CHS VENDOR
IF ACRCHS
DO CHSSET(ACR)
QUIT
+5 ;
+6 ;CHECK CORE VENDOR ****************
+7 ;CHECK CORE VENDOR
SET ACRV=$$VEN^ACRFUFMU(ACRCEIN)
+8 IF ACRV=0
SET ACRERR="NO VENDOR FOUND"
+9 IF ACRV
IF ACRCEIN'[111111111
IF '$DATA(^ACRZ("VNDR",ACRV))
Begin DoDot:1
+10 ;DON'T WANT TRAVEL VENDORS
IF ACRCTYP="TR"
QUIT
+11 DO CKVEND^ACRFUFMU(ACRV)
+12 SET ACRSTR="CORE VENDOR FOUND"_U_U_U_ACRCORE_U_U
+13 DO SETVND
End DoDot:1
+14 ;
+15 ;GOVTRIP *************************
+16 IF ACRGTRIP
Begin DoDot:1
+17 SET ^ACRZ("GTRIP",ACR)="NO HIT GOV TRIP"_U_ACRCORE_U_ACRERR
+18 SET ACRGTOT=ACRGTOT+1
End DoDot:1
QUIT
+19 ;
+20 ;ARMS TRAVEL/AIRLINE *************
+21 ;CAPTURE TRAVEL/AIRLINE
IF ACRCTYP="TR"!(ACRCTYP="AT")
Begin DoDot:1
+22 IF $DATA(^ACRZ("TR",ACR))
QUIT
+23 SET ^ACRZ("TR",ACR)="NO HIT TRAVEL"_U_U_U_U_ACRCORE
+24 SET ACRTRTOT=ACRTRTOT+1
End DoDot:1
QUIT
+25 ;
+26 ;GRANTS **************************
+27 IF ACRCTYP="GR"!(ACRCTYP="PM")
Begin DoDot:1
+28 SET ^ACRZ("GR",ACR)="NO HIT GRANT"_U_ACRCORE_U_ACRERR
+29 SET ACRGRTOT=ACRGRTOT+1
End DoDot:1
QUIT
+30 ;
+31 ;NOHIT -- LEFTOVERS **************
+32 SET ^ACRZ("NOHIT",ACR)="NO HIT UNKNOWN"_U_ACRCORE_U_ACRERR
+33 SET ACRTCNT=ACRTCNT+1
+34 QUIT
+35 ; *********************************
TOTAL ;SET TOTALS ***********************
+1 ;Total amount from all CORE Docs
SET ^ACRZ("TOTALS","TOTAL")=ACRAMT
+2 ;# of matched documents w/Vendor
SET ^ACRZ("ACRDOC","TOTAL")=ACRDCNT
+3 ;# of unique Vendors
SET ^ACRZ("VNDR","TOTAL")=ACRVCNT
+4 ;# of Unidentified No Hits
SET ^ACRZ("NOHIT","TOTAL")=ACRTCNT
+5 ;# of Hits with No Match
SET ^ACRZ("NOMATCH","TOTAL")=ACRMCNT
+6 ;# of matched Documents w/o Vendors
SET ^ACRZ("NOVNDR","TOTAL")=ACRZCNT
+7 ;# of Vendors with Errors
SET ^ACRZ("ERR","TOTAL")=ACRECNT
+8 ;# of Payroll documents (No Hit)
SET ^ACRZ("PAY","TOTAL")=ACRPCNT
+9 ;# of GovTrip documents (No Hit)
SET ^ACRZ("GTRIP","TOTAL")=ACRGTOT
+10 ;# of CHS documents (No Hit)
SET ^ACRZ("CHS","TOTAL")=ACRCHST
+11 ;# of non-GovTrip Travel documents
SET ^ACRZ("TR","TOTAL")=ACRTRTOT
+12 ;# of Grants documents (No Hit)
SET ^ACRZ("GR","TOTAL")=ACRGRTOT
+13 QUIT
+14 ; *********************************
+15 ; *********************************
SETCORE ; SET VARIABLES FROM CORE FILE STRING
+1 SET (ACRV,ACRCDOC,ACRREQ,ACRSTR)=""
+2 SET ACRGTRIP=0
+3 SET ACRCORE=^ACRZ("ACRCORE",ACR)
+4 ;CORE DOCUMENT TYPE
SET ACRCTYP=$PIECE(ACRCORE,U,2)
+5 ;CORE DOLLAR AMOUNT
SET ACRCAMT=$PIECE(ACRCORE,U,7)
+6 ;TOTAL ALL AMOUNTS FOR AREA
SET ACRAMT=ACRAMT+ACRCAMT
+7 ;
+8 ;DON'T WANT PAYROLL ************
IF ACRCTYP="PR"
Begin DoDot:1
+9 SET ^ACRZ("PAY",ACR)="PAYROLL"_U_ACRCORE
+10 SET ACRPCNT=ACRPCNT+1
End DoDot:1
QUIT
+11 ;
+12 ;CORE DOCUMENT NUMBER
SET ACRCDOC=$PIECE(ACRCORE,U,3)
+13 IF $EXTRACT(ACRCDOC,1,3)="HHS"
IF $LENGTH(ACRCDOC)>19
Begin DoDot:1
+14 ;CHECK FOR EXTENSION DOC NUMBERS
SET ACRCDOC=$EXTRACT(ACRCDOC,11,25)
End DoDot:1
+15 ;
+16 ;CHANGE AIRLINE TO TRAVEL
IF ACRCTYP="AT"
SET ACRCTYP="TR"
+17 ;CHECK GOVTRIP TRAVEL DOC
IF ACRCTYP="TR"!(ACRCTYP="TN")
Begin DoDot:1
+18 FOR I="CB","TA","RM"
IF $EXTRACT(ACRCDOC,9,10)=I
SET ACRGTRIP=1
+19 ;COUNT TRAVEL
SET MRSTR=$GET(MRSTR)+1
End DoDot:1
+20 ;
+21 ;CORE ACCOUNTING POINT
SET ACRCAP=$PIECE(ACRCORE,U)
+22 ;CORE FISCAL YEAR
SET ACRCFY=$PIECE(ACRCORE,U,4)
+23 ;CORE CAN
SET ACRCCAN=$PIECE(ACRCORE,U,5)
+24 ;CORE OBJECT CLASS CODE
SET ACRCOCC=$PIECE(ACRCORE,U,6)
+25 ;CORE REFERENCE CODE
SET ACRCREF=$PIECE(ACRCORE,U,8)
+26 ;CORE VENDOR EIN
SET ACRCEIN=$PIECE(ACRCORE,U,9)
+27 ;GET ACTUAL AP FROM CAN
SET ACRAP=$EXTRACT(ACRCCAN,2,3)
+28 ;SET CHS FLAG
SET ACRCHS=$$CHS^ACRFUFMU
+29 QUIT
+30 ;
+31 ; ***********************************
HITDOC(ACRDOC) ;FOUND CORE DOCUMENT NUMBER IN ARMS FMS DOCUMENT FILE
+1 ;
+2 ; - Enters with: ACRCDOC = CORE document number
+3 ;
+4 ; ACRCORE VARIABLES FROM string from CORE file
+5 ;
+6 NEW ACRDA,ACRREQ,ACRXZ
+7 FOR ACRXZ="B","C"
Begin DoDot:1
+8 IF '$DATA(^ACRDOC(ACRXZ,ACRDOC))
QUIT
+9 SET ACRDA=0
+10 FOR
SET ACRDA=$ORDER(^ACRDOC(ACRXZ,ACRDOC,ACRDA))
IF 'ACRDA
QUIT
Begin DoDot:2
+11 SET ACRMATCH=$$MATCHDOC(ACRDA)
End DoDot:2
IF ACRMATCH
QUIT
End DoDot:1
IF ACRMATCH
QUIT
+12 QUIT
+13 ;
+14 ; ***********************************
MATCHDOC(ACRDA) ;Check ARMS against CORE
+1 ;
+2 ;----- LOOP THROUGH PO ITEMS IN FMS SUPPLIES AND SERVICES FILE
+3 ; AND MATCH WITH CORE DATA
+4 ; Enters with: ACRDOCDA = FMS Document file IEN
+5 ; ACRCOCC = CORE OCC
+6 ; ACRCFY = CORE Fiscal Year
+7 ; ACRCCAN = CORE CAN
+8 ; ACRCEIN = CORE VENDOR EIN
+9 ; ACRFY = ARMS
+10 ; ACROCC = ARMS OCC
+11 ; ACRCAN = ARMS CAN
+12 ; Returns: 0 = No match
+13 ; 1 = Match
+14 ;
+15 NEW ACRCANDA,ACRCAN,ACRSS0,ACRIDA,ACRDEPT,ACROCCDA,ACROCC,ACRFY
+16 NEW ACRRFIN,ACRIFIN,ACRID
+17 KILL ACRXX
+18 SET (ACRCAN,ACROCC)=""
+19 SET (ACRMATCH,ACRHIT)=0
+20 SET ACRDOC0=$GET(^ACRDOC(ACRDA,0))
+21 ;REQUISITION/TRAVEL NUMB
SET ACRREQ=$PIECE(ACRDOC0,U)
+22 ;REQUEST TYPE
SET ACRCC=$PIECE(ACRDOC0,U,4)
+23 ;GET VENDOR FROM DOCUMENT OR THE CREDIT CARD DEFAULT VENDOR
+24 SET ACRV=$SELECT(ACRCC=35:$$CCVEN^ACRFUFMU,1:$$VENDOR^ACRFUFMU(ACRDA))
+25 ;DON'T WANT TRAVELER
IF ACRV
IF 'ACRCHS
IF ACRCTYP="TR"
SET ACRV=0
+26 SET ACRID=$PIECE(ACRDOC0,U,14)
+27 ;DOC DAT,IDENTIFIER
SET ACRSTR=ACRREQ_U_$$DOCDT^ACRZFFU(ACRDA)_U_ACRID
+28 FOR ACRX="C","J"
Begin DoDot:1
+29 SET ACRIDA=0
+30 FOR
SET ACRIDA=$ORDER(^ACRSS(ACRX,ACRDA,ACRIDA))
IF 'ACRIDA
QUIT
Begin DoDot:2
+31 SET ACRSS0=$GET(^ACRSS(ACRIDA,0))
+32 SET ACRSS0=$TRANSLATE(ACRSS0,"""")
+33 ;OBJECT CLASS CODE
SET ACROCCDA=$PIECE(ACRSS0,U,4)
+34 ;COMMON ACCOUNTING NUMBER
SET ACRCANDA=$PIECE(ACRSS0,U,5)
+35 SET ACRDEPT=$PIECE(ACRSS0,U,6)
+36 SET ACRFY=$$FYFUN^ACRFUTL1(ACRDEPT)
+37 DO PIECE^ACRFUFMU
+38 ;LOOK FOR FY,CAN,OCC MATCH
SET ACRMATCH=$$MATCH^ACRFUFMU
+39 IF ACRMATCH
Begin DoDot:3
+40 ;SETS ITEMS INTO ^ACRZ("ITEMS"
DO ITEMS^ACRFUFMI(ACRCDOC,ACRIDA,ACRCORE,.ACRRFIN,.ACRIFIN,.ACRHIT)
End DoDot:3
End DoDot:2
+41 IF ACRHIT
DO SET
+42 IF 'ACRHIT
DO SETCK^ACRFUFMU("NO MATCH DOC",ACR)
End DoDot:1
IF ACRHIT
QUIT
+43 QUIT ACRHIT
+44 ;
+45 ; ***********************************
SET ;EP; SET ACRZ(NODE,# WITH MATCHED DATA
+1 ; ENTERS WITH DATA STRING FROM
+2 ; FMS DOCUMENT FILE or
+3 ; 1166 APPROVALS FOR PAYMENT FILE or
+4 ; FMS DOCUMENT HISTORY RECORD FILE
+5 ; ACRV = VENDOR FILE IEN
+6 ;
+7 SET ACRMATCH=1
+8 ;CHECK CORE VENDOR
IF ACRV'>0
SET ACRV=$$VEN^ACRFUFMU(ACRCEIN)
+9 ;CHECK FOR VENDOR ERRORS
SET ACRERR=$SELECT(ACRV>0:$$CKVEND^ACRFUFMU(ACRV),1:"")
+10 IF ACRERR=""
SET ACRERR="NO VENDOR ERRORS"
+11 ;ADD ARMS RR & INVOICE STATUS
SET ACRSTR=ACRSTR_U_ACRCORE_U_ACRRFIN_U_ACRIFIN
+12 ;
+13 ; TRAVEL ****************************
+14 IF ACRCTYP="TR"!(ACRCTYP="AT")
Begin DoDot:1
+15 SET MSG=$SELECT(ACRV>0:$$VNAME^ACRFUFMU(ACRV),1:"TRAVELLER")
+16 SET ^ACRZ("TR",ACR)=MSG_U_ACRSTR_U_ACRERR
+17 DO SETVND
+18 SET ACRTRTOT=ACRTRTOT+1
+19 DO SETCK^ACRFUFMU(MSG,ACR)
End DoDot:1
QUIT
+20 ;
+21 ; NO VENDOR IN ARMS *****************
+22 IF ACRV=0
Begin DoDot:1
+23 SET ^ACRZ("NOVNDR",ACR)="NO VENDOR"_U_ACRSTR
+24 IF ACRCEIN'["1111111111"
Begin DoDot:2
+25 ;CAPTURE CORE VENDOR EIN FOR DOCUMENT
SET ^ACRZ("CEIN",ACR)=ACRCEIN_"/NO IHS"_U_ACRCORE
End DoDot:2
+26 SET ACRZCNT=ACRZCNT+1
+27 DO SETCK^ACRFUFMU("",ACR)
End DoDot:1
QUIT
+28 ;
+29 ; ARMS MATCH WITH VENDOR ************
+30 DO SETVND
+31 SET ^ACRZ("ACRDOC",ACR)=ACRSTR
+32 SET ACRDCNT=ACRDCNT+1
+33 DO SETCK^ACRFUFMU("",ACR)
+34 QUIT
SETVND ;EP - SET STRING INTO VNDR NODE *********
+1 IF ACRV'>0
QUIT
+2 SET ACRAPV=ACRAP_"-"_ACRV
+3 SET ACRASV=ASUFAC_"-"_ACRV
+4 IF ACRERR=""
SET ACRERR="NO VENDOR ERRORS"
+5 SET ACRVNAM=$$VNAME^ACRFUFMU(ACRV)
+6 SET ACREIN=$$EIN^ACRFUFMU(ACRV)
+7 SET ACRSFX=$$SFX^ACRFUFMU(ACRV)
+8 ;ADD VENDOR INFORMATION
SET ACRSTR=ACRAPV_U_ACRASV_U_ACRVNAM_U_ACREIN_U_ACRSFX_U_ACRSTR_U_ACRERR
+9 ;SET STRING AND QUIT IF FOUND
IF $DATA(^ACRZ("VNDR",ACRV))
QUIT
+10 ;SET VNDR
SET ^ACRZ("VNDR",ACRV)=ACRSTR
+11 SET ACRVCNT=ACRVCNT+1
+12 IF ACRERR'["NO VENDOR ERRORS"
Begin DoDot:1
+13 SET ACRECNT=ACRECNT+1
+14 SET ^ACRZ("ERR",ACR)=ACRSTR
End DoDot:1
+15 QUIT
+16 ; ***********************************
CHSSET(ACR) ;EP;
+1 SET ^ACRZ("CHS",ACR)="NO HIT CHS"_U_ACRCORE
+2 SET ACRCHST=ACRCHST+1
+3 QUIT
+4 ; ***********************************
REQ() ;BUILD ORIGINAL REQUISITION NUMBER
+1 NEW ACRCANDA,ACRLOCDA,ACRLOC
+2 SET ACRCANDA=$ORDER(^AUTTCAN("B",ACRCCAN,0))
+3 ;NOT IN COMMON ACCOUNTING NUM FILE
IF ACRCANDA=""
QUIT 0
+4 SET ACRLOCDA=$PIECE($GET(^AUTTCAN(ACRCANDA,0)),U,6)
+5 IF ACRLOCDA=""
SET ACRLOCDA=$PIECE($GET(^ACRCAN(ACRCANDA,0)),U,7)
+6 ;NO LOCATION POINTER
IF ACRLOCDA=""
QUIT 0
+7 SET ACRLOC=$PIECE(^AUTTLCOD(ACRLOCDA,0),U)
+8 SET ACRREQ=$EXTRACT(ACRLOC)_$EXTRACT(ACRCDOC,1,2)_"-"_$EXTRACT(ACRCDOC,3,5)_"-"_$EXTRACT(ACRCDOC,6)_"-"_$EXTRACT(ACRCDOC,7,10)
+9 ;NOT IN DOC FILE
IF '$DATA(^ACRDOC("B",ACRREQ))
SET ACRREQ=""
QUIT 0
+10 QUIT 1