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

BARUFEX3.m

Go to the documentation of this file.
BARUFEX3 ; IHS/SD/TPF - CONTINUATION OF EXPORT TO PROCESS PAYMENTS ;10/31/08
 ;;1.8;IHS ACCOUNTS RECEIVABLE;**4,6,7,8,23**;OCT 26, 2005
 ;NEW ROUTINE ;ITEM 1 OF SCR58 1/2/2008
 ;BAR*1.8*4 DD ITEM 4.1.1
 ;
REVERSAL() ;EP; CHECK REVERSAL DATES AND FIX IF POSSIBLE
 ;          RETURNS ORIGINAL SCHEDULE NUMBER IF REVERSAL
 ;
 ; FIX ANY TRANSACTION HAS A 0 REVERSAL DATE
 I $P($G(^BARTR(DUZ(2),TRDATE,1)),U,10)=0 D DEPOP  ;CLEAN BAD DATA
 ;
 ; FIX TRANTYPE NOT = PAYMENT WITH A REVERSAL DATE
 I TRANTYPE='"PAYMENT",($P($G(^BARTR(DUZ(2),TRDATE,1)),U,10)) D  Q ""
 .D DEPOP
 ;
 ; FIX TRANTYPE = PAYMENT WITH A REVERSAL DATE AND A POSITIVE AMT
 I (ARCRDEB>0!(ARCRDEB=0)),$P($G(^BARTR(DUZ(2),TRDATE,1)),U,10) D  Q ""
 .D DEPOP
 ;
 ; ONLY LOOK AT PAYMENTS
 I TRANTYPE'="PAYMENT" Q ""
 ;
 ; CHECK FOR BATCH
 I ARCOLITM=""!(ARCOLIN="") D  Q ""                ;NOT OK
ERR23 .D ERR^BARUFEXU(23)                               ;NO BATCH IN TX
 .S ARBILL=""
 ;
 ; CHECK BOB FOR CODES
 N SCHED,BARFLG,BARZ0
 S BARZ0=$G(^BARBOB("BARZ",BARDUZ,DUZ(2),ARCOLIN,ARCOLITM,TRDATE))
 S BARFLG=$P(BARZ0,U,5)             ;PAIR OR -ERROR FLAG
 S SCHED=$$IPAC^BARUFEX4(ARCOLIN,ARCOLITM,TRDATE_",")
 I '$$CKIPAC(SCHED) Q ""   ;BAD IPAC ERROR 5
IGNORE I BARFLG="-I" D  Q ""     ;PERMANENTLY IGNORABLE PAIR
 .D SETI
 .D ERR^BARUFEXU("I")
 .S ARBILL=""
 I BARFLG=1 D POP Q SCHED     ;ORIGINAL NOT IN BILL, BUT PAIRED IN BATCH/ITEM
 I BARFLG=2 D POP Q SCHED     ;SIMPLE REVERSAL ALREADY PAIRED
ERRNEG I $E(BARFLG)="-" D  Q ""     ;ONE OF THE MINUS CODES
 .D ERR^BARUFEXU(-BARFLG)
 .S ARBILL=""
 ;
 ;CHECK +DOLLAR PAYMENTS FOR REVERSALS THEN QUIT
 I ARCRDEB>0 D  Q SCHED
 .S BAROK=$$COLCK^BARUFEX4(BARDUZ)  ;BATCH/ITEM CHECK
 .I 'BAROK S (ARBILL,SCHED)=""      ;DIDN'T FIND MATCH
 ;
DIAG ;NOTHING SHOULD REACH THIS POINT AFTER NEW CODING
DIAG1 W !!,"*** ERROR **** ENTERING CHECK FOR ERA OR MANUAL REVERSALS "
 W !?5,UDUZ,"  ",TRDATE,"  ",ARBILLIN,"  ",BARZ0
 S ARBILL=""
 Q ""
 ;
POP ;POPULATE THE REVERSAL FIELDS
 S SCHED=$P(BARZ0,U,2)              ;GET MATCHED TDN/IPAC
 S DA=TRDATE
 S DIE="^BARTR("_DUZ(2)_","
 ;S DR="110////"_$P($P(BARZ0,U,8),".",1)         ;MRS:BAR*1.8*6 IM29571
 S DR="110////"_$P(BARZ0,U,11)                   ;MRS:BAR*1.8*6 IM29571
 S DR=DR_";111////"_SCHED
 D ^DIE
 K DIR,DR,DIC,DA,DIE
 Q
SETI ;POPULATE THE IGNORE TRANSACTION FIELD
 S DA=TRDATE
 S DIE="^BARTR("_DUZ(2)_","
 S DR="112////I"
 D ^DIE
 K DIR,DR,DIC,DA,DIE
 Q
DEPOP ;EP - DE POPULATE IF REVERSAL DATES NOT FOUND
 ;ONLY FOR BETA SITES
 K DIR,DIE,DIC,DA,DR
 S DA=TRDATE
 S DR="110///@;111///@"
 S DIE="^BARTR("_DUZ(2)_","
 D ^DIE
 K DIR,DIE,DIC,DA,DR
 Q
 ;
GOODIPAC(X) ;EP - INPUT TRANSFORM FOR TREASURY SCHEDULE NUMBER/IPAC
 N Z
 I X="NONPAYMENT" Q 1
 I X="PRE-UFMS_COLLECTIONS" Q 1
 S Z=$$UPC^BARUTL(X)
 S Z=$TR(Z,"-,")
 I Z["NON" Q 0                  ;CHECK FOR NON IN ANY FORM
 I $L(X)>5,$L(X)<21,X?.UN Q 1   ;MIN/MAX MIXED ALPHA/NUMERIC ;MRS:BAR*1.8*7 IM30201
 I $L(X)<6!($L(X)>20) Q 0       ;MIN/MAX CHECK ;MRS:BAR*1.8*7 IM30201
 ;RE-WRITTEN TO ALLOW FY# PREFIX ;MRS:BAR*1.8*8 D150
 ;I $E(X,1,2)?1U1"-",$E(X,3,20)?.UN Q 1   ;IPAC WITH DASH AND MIXED ALPHA/NUMERIC ;MRS:BAR*1.8*7 IM30201;MRS:BAR*1.8*8
 N ZZ
 S ZZ=X
 I $E(Z,1,2)="FY" S ZZ=$E(X,4,20)  ;ALLOW FY# PREFIX ;MRS:BAR*1.8*8 D150
 I $E(ZZ,1,2)?1U1"-",$E(ZZ,3,20)?.UN Q 1  ;MRS:BAR*1.8*8 D150
 I X?.UN Q 1                    ;STRAIGHT MIXED ALPHA/NUMERIC ;MRS:BAR*1.8*7 IM30201
 Q 0
 ;
FINDREV ;EP - FIND REVERSALS ON THE SYSTEM - THIS IS FOR TESTING ONLY
 N TEMPDUZ2,TRDATE,REVDATE,SCHEDNUM,ARCOL,ARITEM,SOURCE
 N TRANTYPE,CREDDEB
 S TEMPDUZ2=DUZ(2)
 S DUZ(2)=1
 F  S DUZ(2)=$O(^BARTR(DUZ(2)))  Q:'DUZ(2)  D
 . Q:'$$IHS^BARUFUT(DUZ(2))
 . ;;;Q:'$$IHSERA^BARUFUT(DUZ(2)) ;P.OTT
 .S FACILITY=$$GET1^DIQ(9999999.06,DUZ(2)_",",.01,"E")
 .S TRDATE=0
 .F  S TRDATE=$O(^BARTR(DUZ(2),TRDATE)) Q:'TRDATE  D
 ..S REVDATE=$$GET1^DIQ(90050.03,TRDATE_",",110)
 ..S SCHEDNUM=$$GET1^DIQ(90050.03,TRDATE_",",111)
 ..Q:SCHEDNUM=""&(REVDATE="")
 ..S SOURCE=$$GET1^DIQ(90050.03,TRDATE_",",106)
 ..S ARBILL=$$GET1^DIQ(90050.03,TRDATE_",",4)
 ..S TRANTYPE=$$GET1^DIQ(90050.03,TRDATE_",",101)
 ..S ARCOL=$$GET1^DIQ(90050.03,TRDATE_",",14)
 ..S ARITEM=$$GET1^DIQ(90050.03,TRDATE_",",15)
 ..S ARCRDEB=$$GET1^DIQ(90050.03,TRDATE,3.5,"E")
 ..W !!!,"FACILITY: ",FACILITY
 ..W !,"BILL: ",ARBILL
 ..W !,"TRDATE: ",TRDATE
 ..W !,"TRANTYPE: ",TRANTYPE
 ..W !,"REVDATE: ",REVDATE
 ..W !,"SCHEDNUM: ",SCHEDNUM
 ..W !,"ARCOL: ",ARCOL
 ..W !,"ARITEM: ",ARITEM
 ..W !,"SOURCE: ",SOURCE
 ..W !,"CREDIT-DEBIT: ",ARCRDEB
 S DUZ(2)=TEMPDUZ2
 Q
CKIPAC(X) ;
 ;ENTERS WITH  X = SCHEDULE NUMBER
 ;
 I '$$GOODIPAC(X) D  Q 0   ;STILL NOT AN ACCEPTABLE SCHEDULE # FORMAT
ERR5 .D ERR^BARUFEXU(5)            ;Bad schedule number
 .S ARBILL=""
 Q 1