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

BARUFEX4.m

Go to the documentation of this file.
BARUFEX4 ; IHS/SD/TPF - CONTINUATION OF EXPORT -- PAYMENT PROCESSING ;10/31/08
 ;;1.8;IHS ACCOUNTS RECEIVABLE;**4,8**;NOV 13, 2007
 ;NEW ROUTINE;ITEM 1 OF SCR58 1/2/2008 ;MRS:BAR*1.8*4 DD ITEM 4.1.1
 ;
COLCK(BARDUZ) ;EP; CHECK +DOLLAR PAYMENTS ENTRIES IN COLLECTION BATCH FOR REVERSAL PAYMENTS
 ;         ENTERS WITH: BARDUZ= CASHIER
 ;                      TRDATE   ;TRANSACTION DATE
 ;                      ARBILL   ;A/R BILL
 ;                      ARBILLIN ;A/R BILL IEN
 ;                      ARCRDEB  ;PAYMENT AMOUNT = +$AMOUNT ONLY
 ;                      ARCOLB   ;COLLECTION BATCH NAME
 ;                      ARCOLITM ;COLLECTION ITEM
 ;                      ARCOLIN  ;COLLECTION BATCH PTR
 ;                      DUZ(2)
 ;                      
 ;          RETURNS 0 = NOT OK TO SEND TO UFMS
 ;                  1 = OK TO SEND TO UFMS
 ;
 N BAROK
 I '$D(^BARCOL(DUZ(2),ARCOLIN,1,ARCOLITM)) D  Q 0  ;NOT OK
ERR24 .D ERR^BARUFEXU(24)                               ;TX NOT IN BATCH
 ;
 I $G(^BARBOB("BARZ",BARDUZ,DUZ(2),ARCOLIN,ARCOLITM))=1 Q 1  ;NO REVERSALS IN BATCH/ITEM
 D LOOP
 Q BAROK
 ;
LOOP ; LOOP THROUGH ^BARBOB("BARZ",DUZ THAT IS SET IN BARUFEX5
 ; CODE 2 = SIMPLE REVERSALS ARE PAIRED IN BOB
 ; CODE 1 = COULDN'T FIND ORIGINAL PAYMENT, BUT MADE MATCH IN BATCH/ITEM
 ; CODE -I = IGNORE--REVERSAL PRECEDES PAYMENT IN BILL AND MATCH IN BATCH/ITEM
 ; CODES 1,2 are sent to UFMS
 ; All negative codes are treated as errors and not sent to UFMS
 ; (CODE -I is currently treated as error; will be coded to ignore -- NO UFMS)
 ; -25 CODE = DUPLICATE PAYMENT, ERROR ALL OUT
 ; -6 or -3 = ORIGINAL PAYMENT NOT IN BILL OR BATCH/ITEM, ERROR ALL OUT
 ; -7 or -4 = MULTIPLE PAYMENTS, ONLY ERROR OUT BILL
 ;
 ; IF THE SEARCH FINDS AN UNPAIRED NEGATIVE PAYMENT, BAROK IS ONLY SET TRUE
 ; WHEN THE SCHEDULE NUMBER AND ABSOLUTE PAYMENT AMOUNTS MATCH
 ; IF NO NEGATIVE PAYMENT AND THE POSITIVE VALUE ENTRY IS FOUND
 ; BAROK IS SET TO TRUE
 ; OTHERWISE, BAROK IS NOT OK, AND A NOT SENT ERROR IS GENERATED
 ;
 N TDATE,TARBILL,TARBILIN,TARCRDB,TARCITM,BAR,TIPAC,TTRAN,ERR,BARFLG
 S (TDATE,BARCNT,BARPNEG,BARNEG,ERR)=0
 K ERR(0)
 S BAROK=0
 F  S TDATE=$O(^BARBOB("BARZ",BARDUZ,DUZ(2),ARCOLIN,ARCOLITM,TDATE)) Q:'TDATE!($D(ERR(0)))  D
 .S IENS=TDATE_","
 .S BARZ0=^BARBOB("BARZ",BARDUZ,DUZ(2),ARCOLIN,ARCOLITM,TDATE)
 .S BARFLG=$P(BARZ0,U,5)
 .Q:BARFLG>0!(BARFLG="-I")            ;PAIR FLAGGED OK OR IGNORABLE
 .S TIPAC=$P(BARZ0,U,2)               ;IPAC
 .S TCRDEB=$P(BARZ0,U,1)              ;CREDIT - DEBIT
 .S TARBILIN=$P(BARZ0,U,3)            ;A/R BILL PTR
 .S TARBILL=$P(BARZ0,U,4)             ;A/R BILL NUMBER
 .I TCRDEB<0 D                        ;NEGATIVE ENTRY IN COL BATCH
ERR47 ..I BARFLG=-7!(BARFLG=-4)!(BARFLG=-25) D  Q
 ...I ARBILLIN=TARBILIN S ERR=-BARFLG Q    ;ONLY ERROR OUT SAME BILL
ERR36 ..I BARFLG=-6!(BARFLG=-3) S ERR=-BARFLG   ;NOT IN BILL, ERROR ALL OUT
 ..I TIPAC=BARIPAC,(-ARCRDEB=TCRDEB) S BAROK=1 Q  ;FOUND THE PAIR
ERR902 ..I TIPAC'=BARIPAC&((-ARCRDEB)=(TCRDEB)) S ERR=9.02
ERR901 ..I TIPAC=BARIPAC&((-ARCRDEB)'=(TCRDEB)) S ERR=9.01
ERR903 ..I 'ERR S ERR=9.03
 ..S BAR(0)=ERR
 I BAROK Q          ;FOUND A MATCH
 I $D(BAR(0)) D  Q
 .S BAROK=0
ERR9 .D ERR^BARUFEXU(BAR(0))    ;COMPLEX PAYMENT/REVERSAL IN COLLECTION BATCH
 S BAROK=1
 Q
 ;
ERR(MSG) ;NOT SENT ERROR MESSAGE CENTER
 ;
 D ERR^BARUFEXU(MSG)
 Q
IPAC(X,Y,IENS) ;EP  BAR*1.8*4 DD item 4.1.5.4
 S Z=$$GET1^DIQ(90050.03,IENS,17,"E")
 I Z'="" Q Z                           ;FOUND IN TX FILE
 ;S Z=$P($G(^BARCOL(DUZ(2),X,1,Y,0)),U,20)  ;MRS:BAR*1.8*8 D150
 S Z=$$GET1^DIQ(90051.1101,Y_","_X_",",20)  ;MRS:BAR*1.8*8 D150
 S:Z="" Z="PRE-UFMS_COLLECTIONS"
 Q Z