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

ACRFIV41.m

Go to the documentation of this file.
ACRFIV41 ;IHS/OIRM/DSD/THL,AEF - ARMS TO 1166 PAYMENT INTERFACE;  [ 04/21/2005  7:53 AM ]
 ;;2.1;ADMIN RESOURCE MGT SYSTEM;**16,17**;MAY 15, 2001
 ;;
 ;UTILITY TO EDIT PAYMENT DATA AFTER INVOICE AUDIT COMPLETED
 Q:'$G(ACRDOCDA)
EN D EN1
EXIT K ACRDATE,ACRIVDAT,ACRRRDAT,ACRPAY,ACRDATE,ACRTYPE
 Q
EN1 D GATHER
 W !!,"BATCH YEAR: ",$S($E($G(ACRPAYDA),1,3)]"":$E($G(ACRPAYDA),1,3)+1700,1:"")
 W !,"BATCH NO..: ",$G(ACRBATNO)
 W $$DASH^ACRFMENU
 W !,"DOC YEAR: ",$G(ACRDOCYR)
 W ?40,"FY OF FUNDS: ",$G(ACRFYFUN)
 W !,"DOC NO..: ",$G(ACRDOC)
 D PAUSE^ACRFWARN
 Q
GATHER ;GATHER ALL DATA
 S:'$D(ACRBATNO) ACRBATNO="XXXXXX"
 S ACRDOC=$S($P(^ACRDOC(ACRDOCDA,0),U,2)]"":$P(^(0),U,2),1:$P(^(0),U))
 S ACRDOCYR=$S(ACRREF=116&(ACRDOC["-"):$E(ACRDOC,9),1:$E(ACRDOC))
 S ACRFYFUN=$P(^ACRLOCB($P(ACRDOC0,U,6),"DT"),U)
 Q
LATEPAY(ACRIVT,ACRPEN,ACRIRATE) ;EP;TO CALCULATE THE LATE PAYMENT INTEREST CHARGE
 Q:'$G(ACRIVT) "" ;PENALTY CANNOT BE CALCULATED WITH OUT KNOWING THE TOTAL AMOUNT OF THE PAYMENT DUE
 Q:'$G(ACRPEN) "" ;PENALTY CANNOT BE CALCULATED WITH OUT KNOWING THE NUMBER OF DAYS LATE
 Q:'$G(ACRIRATE) "" ;PENALTY CANNOT BE CALCULATED WITH OUT KNOWING THE DAY ON WHICH THE PAYMENT IS TO BE MADE
 N X,Y,Z
 ;ADD 2 DAYS TO NUMBER OF PENALTY DAYS TO COVER PROCESSING DAYS
 S Y=ACRIVT*(ACRIRATE/100*((ACRPEN+2)/360))
 S Y=$FN(Y,"P",2)
 S Y=+$TR(Y," ","")
 Q Y
IRATE(ACRPAYDA) ;EP;CALCULATE APPLICABLE INTEREST RATE
 Q:ACRPAYDA="" ""
 S X=$O(^ACRSYS(1,40,"B",ACRPAYDA+1),-1)
 Q:'X "" ;PENALTY CANNOT BE CALCULATED IF NO APPLICABLE RATE IS ON FILE
 S X=$O(^ACRSYS(1,40,"B",X,0))
 S X=$P($G(^ACRSYS(1,40,X,0)),U,2)
 Q X
INTEREST ;EP;INDICATE INTEREST PAYMENT DUE
 Q:$D(ACRQUIT)!$D(ACROUT)
 K ACRDT,ACRQUIT,ACRTERMS,ACRTYPE,ACRT,ACRPPEN
 W !!,"Payment will be made ",ACRPEN," days late"
 S ACRIRATE=$$IRATE^ACRFIV41(ACRPAYDA)
 W !,"At the current daily interest rate of ",ACRIRATE
 S ACRP=$$LATEPAY(ACRIVT,ACRPEN,ACRIRATE)
 ;S ACRTERMS=ACRPEN_U_ACRP             ;ACR*2.1*16.06 IM15505
 ;S ACRT=-1                            ;ACR*2.1*16.06 IM15505
 ;D PAY                               ;ACR*2.1*16.06 IM15505
 S ACRTERMS=ACRPEN_U_ACRP_U_ACRIRATE  ;ACR*2.1*16.06 IM15505
 S $P(ACRTERMS,U,13)=4319          ;INTEREST OCC  ;ACR*2.1*16.06 IM15505
 S $P(ACRTERMS,U,8)=19917          ;INTEREST TCODE;ACR*2.1*16.06 IM15505
 S ACRT=-1
 S $P(ACRTERMS,U,14)=ACRT          ;TYPE INT/DSC  ;ACR*2.1*16.06 IM15505
 D PAY^ACRFIV43(.ACRIVPAY,.ACRIVT,.ACRTERMS,.ACRT) ;ACR*2.1*16.06 IM15505
 Q:$D(ACROUT)
 I +$G(ACRTERMS)<1 D  Q
 .W !!,"Payment will be made ",+$G(ACRTERMS)*-1," days early.  No Interest payment due."
 .D PAUSE^ACRFWARN
 .K ACROUT,ACRT,ACRTERMS
 .S ACRQUIT=""
 ;D CORRECT^ACRFIV4                      ;ACR*2.1*16.06 IM15505
 D CORRECT^ACRFIV43(.ACRDT,.ACRPCNT,.ACRIVDC,.ACRIVTF)  ;ACR*2.1*16.06 IM15505
 I '$D(ACRDT) K ACRTERMS,ACRP,ACRPCNT,ACRIRATE,ACRQUIT Q
 D DCAN^ACRFIV42(.ACRTERMS,ACRT,.ACRIVDIS)
 K ACRQUIT
 Q
PAYDATE ;EP;CALCULATE PAYMENT DATE
 I '$G(ACRDOCDA) D PD1 Q
 S ACRIVDAT=$P(^ACRDOC(ACRDOCDA,"PO"),U,21)
 S ACRRRDAT=$P(^ACRDOC(ACRDOCDA,"REQ1"),U,7)
 I ACRIVDAT=""!(ACRRRDAT="") D  Q
 .W !!,"The "
 .W:ACRIVDAT="" "Invoice Date"
 .W:ACRIVDAT=""&(ACRRRDAT="") " and the "
 .W:ACRRRDAT="" "Receiving Report Date"
 .I ACRIVDAT=""&(ACRRRDAT="") W " are "
 .E  W " is "
 .W "missing."
 .W !,"You cannot proceed with payment processing until"
 .I ACRIVDAT=""&(ACRRRDAT="") W " they are "
 .E  W " it is "
 .W "entered."
 .D PAUSE^ACRFWARN
 .S ACRQUIT=""
PD1 ;FOR NON-ARMS DOCUMENTS
 I '$G(ACRRRDAT)!'$G(ACRIVDAT) D PAYDUE Q
 W !!,"Receiving Report done on:  "
 S Y=$P(ACRRRDAT,"@")
 X ^DD("DD")
 W Y
 W !,"Invoice received on.....:  "
 S Y=$P(ACRIVDAT,"@")
 X ^DD("DD")
 W Y
 S X1=ACRIVDAT,X2=ACRRRDAT
 D ^%DTC
 ;S (X1,ACRDATE)=$S(X>-1!(X<-7):ACRIVDAT,1:ACRRRDAT) ;ACR*2.1*17.01 IM17097
 S (X1,ACRDATE)=ACRRRDAT                             ;ACR*2.1*17.01 IM17097
 I $G(X)]"",X>-1&(X<-7) S (X1,ACRDATE)=X             ;ACR*2.1*17.01 IM17097
 Q:X1=""
 S X2=30
 D C^%DTC
 S Y=$P(X,"@")
 X ^DD("DD")
 S DIR("B")=$P(Y,"@")
PAYDUE ;EP;TO SELECT PAYMENT DUE DATE
 S DIR(0)="DT^::E"
 S DIR("A",1)="To avoid penalties"
 S DIR("A")="Payment is due by......."
 D DIR^ACRFDIC
 I '+Y K ACRQUIT Q
 I +Y S ACRPAYDU=+Y
 S X1=ACRPAYDU
 S X2=-7
 D C^%DTC
 I $E(X,4,7)=1225 S X=$E(X,1,3)_1224
 I $E(X,4,7)="0101" S X=$E(X,1,3)_"0102"
 I $E(X,4,7)="0704" S X=$E(X,1,3)_"0705"
 S Z=X
 D DW^%DTC
 I $E(X)="S" D
 .S X1=Z
 .S X2=$S($E(X,1,2)="SA":-1,1:-2)
 .D C^%DTC
 .S Z=$P(X,"@")
PAYON S Y=$S(Z>DT:Z,1:DT)
 X ^DD("DD")
 S DIR(0)="D^::ET"
 S DIR("A")="Make payment on........."
 S DIR("B")=$P(Y,"@")
 D DIR^ACRFDIC
 I '+Y K ACRQUIT Q
 I Y<DT W !!,"Payment CANNOT be made prior to TODAY." G PAYON
 S ACRPAYDA=Y
 S X=Y
 D DW^%DTC
 I $E(X)="S" W *7,*7,!!,"You cannot schedule a payment to be made on a ",X,! G PAYON
 S X1=ACRPAYDA,X2=ACRPAYDU
 D ^%DTC
 S ACRPEN=X
 K ACRQUIT
 W !!,"Payment will be scheduled "
 W @ACRON
 I ACRPEN=0 W "the same day"
 E  W $TR(ACRPEN,"-","")," days ",$S(ACRPEN<0:" before",1:"after")
 W @ACROF
 W " the payment is due"
 Q
LOST ;EP;INDICATE THE PERCENT OF DISCOUNT LOST
 ;  Moved to ACRFIV42    ;ACR*2.1*16.06  IM15505
 Q                       ;ACR*2.1*16.06  IM15505
PAY ;EP;TO DISPLAY PAYMENT SUMMARY
 ;  Moved to ACRFIV43    ;ACR*2.1*16.06  IM15505
 Q                       ;ACR*2.1*16.06  IM15505