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

RCXFMSTX.m

Go to the documentation of this file.
  1. RCXFMSTX ;WISC/RFJ-fms transfer (tr) code sheet generator ;1 Oct 97
  1. ;;4.5;Accounts Receivable;**170,178,191,184**;Mar 20, 1995
  1. ;;Per VHA Directive 10-93-142, this routine should not be modified.
  1. Q
  1. ;
  1. ;
  1. STARTTR(RCDATEND) ; top entry point to generate a tr code sheet
  1. ; transferring dollars from mccf to hsif
  1. ;
  1. ; rcdatend is the ending date of the period.
  1. ; This date is the 3rd work day from the end of the month.
  1. ; The utility $$LDATE^RCRJR is used to figure it out. It will
  1. ; change from month to month and figures in holidays also.
  1. ; For example, if running the ARDC for the month of June 2003
  1. ; the EOAM will calculate out to be June 25, 2003.
  1. ; This is called by the background monthly data collector
  1. ;
  1. ;
  1. N GECSDATA,RCTRANID,RESULT
  1. ;
  1. ; build the data for the TR document. this call returns the rctrans
  1. ; array in the format rctrans(fromfund,fromrsc) = tofund ^ torsc ^
  1. ; amount
  1. ; example:
  1. ; rctrans(5287,"8bzz")="5358.1^8gzz^123.45"
  1. ; will transfer 123.45 from 5287 to 5358.1
  1. D GETPAY^RCBMILLT(RCDATEND)
  1. ;
  1. ; no code sheets to send
  1. I $O(RCTRANS(""))="" Q
  1. ;
  1. ; lookup fms document number to see if the monthly tr has been sent
  1. ; example rcdatend=3010531, lookup on 3010500
  1. D KEYLOOK^GECSSGET("TR-"_$E(RCDATEND,1,5)_"00",1)
  1. ;
  1. ; get the transacion id for the fms document
  1. ; if it is not sent, get the next number available
  1. I $G(GECSDATA) S RCTRANID=$E($P(GECSDATA("2100.1",GECSDATA,".01","E"),"-",2),1,11)
  1. I $G(RCTRANID)="" S RCTRANID=$$ENUM^RCMSNUM
  1. I RCTRANID<0 Q ;unable to retrieve the next number
  1. ; remove dash (example 460-K1A05HY)
  1. S RCTRANID=$TR(RCTRANID,"-")
  1. ;
  1. ; build the tr document
  1. S RESULT=$$BUILDTR(RCDATEND,.RCTRANS,+$G(GECSDATA),RCTRANID)
  1. ; error in building code sheet
  1. I 'RESULT Q
  1. ;
  1. ; set the 433 fields showing the dollars were transferred
  1. D SETPAY^RCBMILLT(RCDATEND)
  1. ;
  1. ; add/update entry in file 347 for reports
  1. N %DT,%X,D,D0,DA347,DI,DQ,DIC,ERROR
  1. S DA347=$O(^RC(347,"C",$P(RESULT,"^",2),0))
  1. ; if not in the file, addit fmsdocid sv id
  1. I 'DA347 D OPEN^RCFMDRV1($P(RESULT,"^",2),4,"TR-"_$E(RCDATEND,1,5)_"00",.DA347,.ERROR)
  1. I DA347 D SSTAT^RCFMFN02($P(RESULT,"^",2),1)
  1. Q
  1. ;
  1. ;
  1. BUILDTR(RCDATEND,RCTRANS,RCGECSDA,RCTRANID) ; generate a tr code sheet for
  1. ; transferring dollars from mccf to hsif
  1. ;
  1. ; rcdatend is the last day of the month for the data
  1. ;
  1. ; rctrans(fund,rsc) = data array passed
  1. ; fund=fund to transfer from
  1. ; rsc = rsc to transfer from
  1. ; data = fund to transfer to (piece 1)
  1. ; rsc to transfer to (piece 2)
  1. ; dollars to transfer (piece 3)
  1. ;
  1. ; rcgecsda is the ien for the gcs stack file 2100.1 for rebuilds
  1. ;
  1. ; rctranid is the document identifier
  1. ;
  1. N COUNT,DATA,DESCRIP,FISCALYR,FUND,GECSFMS,LINE,REVSRCE,TR2,X,Y
  1. ;
  1. S FISCALYR=$$FY^RCFN01(RCDATEND)
  1. ;
  1. ; build detail line
  1. S COUNT=0
  1. S FUND="" F S FUND=$O(RCTRANS(FUND)) Q:FUND="" D
  1. . S REVSRCE="" F S REVSRCE=$O(RCTRANS(FUND,REVSRCE)) Q:'REVSRCE D
  1. . . S DATA=RCTRANS(FUND,REVSRCE)
  1. . . ; if no value, quit
  1. . . I '$P(DATA,"^",3) Q
  1. . . ;
  1. . . ; create line to transfer from (decrease)
  1. . . S COUNT=COUNT+1
  1. . . S LINE(COUNT)="LIN^~CRA^"_$S($L(COUNT)=1:"00",$L(COUNT)=2:"0",1:"")_COUNT
  1. . . S $P(LINE(COUNT),"^",4)=FISCALYR
  1. . . S $P(LINE(COUNT),U,4)=$S($E(FUND,1,4)=5287:"05",1:FISCALYR)
  1. . . S $P(LINE(COUNT),"^",6)=FUND
  1. . . S $P(LINE(COUNT),"^",7)=$E(RCTRANID,1,3) ; station #
  1. . . S $P(LINE(COUNT),"^",10)=REVSRCE
  1. . . ;
  1. . . ; vendor id
  1. . . S $P(LINE(COUNT),"^",18)="MCCFVALUE"
  1. . . I FUND=5358.1 S $P(LINE(COUNT),"^",18)="HSIFVALUE"
  1. . . ;
  1. . . S $P(LINE(COUNT),"^",20)=$J($P(DATA,"^",3),0,2)
  1. . . S $P(LINE(COUNT),"^",21)="D"
  1. . . S $P(LINE(COUNT),"^",23)=33
  1. . . S $P(LINE(COUNT),"^",24)="~"
  1. . . ;
  1. . . ; create line to transfer to (increase)
  1. . . S COUNT=COUNT+1
  1. . . S LINE(COUNT)="LIN^~CRA^"_$S($L(COUNT)=1:"00",$L(COUNT)=2:"0",1:"")_COUNT
  1. . . S $P(LINE(COUNT),"^",4)=FISCALYR
  1. . . S $P(LINE(COUNT),U,4)=$S($E(FUND,1,4)=5287:"05",1:FISCALYR)
  1. . . S $P(LINE(COUNT),"^",6)=$P(DATA,"^")
  1. . . S $P(LINE(COUNT),"^",7)=$E(RCTRANID,1,3) ; station #
  1. . . S $P(LINE(COUNT),"^",10)=$P(DATA,"^",2)
  1. . . ;
  1. . . ; vendor id
  1. . . S $P(LINE(COUNT),"^",18)="MCCFVALUE"
  1. . . I $P(DATA,"^")=5358.1 S $P(LINE(COUNT),"^",18)="HSIFVALUE"
  1. . . ;
  1. . . S $P(LINE(COUNT),"^",20)=$J($P(DATA,"^",3),0,2)
  1. . . S $P(LINE(COUNT),"^",21)="I"
  1. . . S $P(LINE(COUNT),"^",23)=33
  1. . . S $P(LINE(COUNT),"^",24)="~"
  1. ;
  1. ; build tr2
  1. S TR2="CR2^"_$E(RCDATEND,2,3)_"^"_$E(RCDATEND,4,5)_"^"_$E(RCDATEND,6,7)_"^^^^^^E^^^"
  1. ; deposit number which is equal to the gcs id
  1. ; $j(0,0,2) is the document total which is zero
  1. S TR2=TR2_$P(RCTRANID,"^")_"^^"_$J(0,0,2)_"^^"
  1. ; deposit/transfer date which is end date of prior month
  1. S TR2=TR2_$E(RCDATEND,2,3)_"^"_$E(RCDATEND,4,5)_"^"_$E(RCDATEND,6,7)_"^~"
  1. ;
  1. ; put together document in gcs
  1. N %DT,D,D0,DA,DI,DIC,DIE,DIQ2,DQ,DR
  1. S Y=$E(RCDATEND,1,5)_"00" D DD^%DT
  1. S DESCRIP="Monthly Transfer MCCF to HSIF for "_Y
  1. I 'RCGECSDA D CONTROL^GECSUFMS("A",$E(RCTRANID,1,3),RCTRANID,"TR",10,0,"",DESCRIP)
  1. I RCGECSDA D REBUILD^GECSUFM1(RCGECSDA,"A",10,"N","Rebuild "_DESCRIP) S GECSFMS("DA")=RCGECSDA
  1. ;
  1. ; store document in gcs
  1. D SETCS^GECSSTAA(GECSFMS("DA"),TR2)
  1. F COUNT=1:1 Q:'$D(LINE(COUNT)) D SETCS^GECSSTAA(GECSFMS("DA"),LINE(COUNT))
  1. D SETCODE^GECSSDCT(GECSFMS("DA"),"D RETN^RCFMFN02")
  1. D SETSTAT^GECSSTAA(GECSFMS("DA"),"Q")
  1. ; set the key for lookup
  1. D SETKEY^GECSSTAA(GECSFMS("DA"),"TR-"_$E(RCDATEND,1,5)_"00")
  1. ;
  1. ; return 1 for success ^ fms document id
  1. Q 1_"^TR-"_$P(GECSFMS("CTL"),"^",9)