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

ACRFIV12.m

Go to the documentation of this file.
ACRFIV12 ;IHS/OIRM/DSD/THL,AEF - ACRFIV11 CON'T;  [ 7/20/2006  10:25 AM ]
 ;;2.1;ADMIN RESOURCE MGT SYSTEM;**3,5,16,17,19,20**;NOV 05, 2001
 ;;
 ;ACRFIV11 CON'T
SCHNO ;EP;TO CREATE THE NEXT TREASURY SCHEDULE NUMBER
 Q:'$D(ACRFY)#2
 S ACRX=$O(^ACRSYS(1,50,"B",ACRFY,0))
 Q:'ACRX
 S X=1
 S DA(2)=1
 S DA(1)=ACRX
 S DIC="^ACRSYS(1,50,"_ACRX_",1,"
 S DIC(0)="L"
 D FILE^ACRFDIC
 I '$G(ACRACPT) D ACPT
 S ACRSCHNO=ACRACPT_"A"_$E("000",1,3-$L(+Y))_Y
 S DA(2)=1
 S DA(1)=ACRX
 S DA=+Y
 S DIE="^ACRSYS(1,50,"_ACRX_",1,"
 S DR=".02////"_ACRSCHNO
 D DIE^ACRFDIC
 Q
ACPT ;SET ACCOUNING POINT
 S ACRACPT=$P($G(^ACRSYS(1,"DT1")),U,13)
 S ACRACPT=$P($G(^AUTTACPT(ACRACPT,0)),U)
 Q
AIRLINE ;EP;TO PAY AIRLINE EXPENSES
 F  D A1 Q:$D(ACRQUIT)!$D(^ACROUT)
 K ACRQUIT,ACRDOCDA,ACRFYFUN
 Q
A1 W @IOF
 N ACRINV
 K ACRIVTF
 W !?22,"TRAVEL ORDER/VOUCHER for Airline Payment",!
 S DIC="^ACRDOC("
 S DIC(0)="AEMQZ"
 S DIC("A")="TRAVEL ORDER/VOUCHER: "
 S DIC("S")="I $P(^(0),U,13)=133,$D(^ACRAL(""C"",+Y)),$P(^ACROBL(+Y,""APV""),U)=""A"",'$P(^(""APV""),U,10)"
 D DIC^ACRFDIC
 I +Y<1 S ACRQUIT="" Q
 ;
 S ACRDOCDA=+Y
 S ACRDOC=$P(^ACRDOC(ACRDOCDA,0),U)
 ;S ACRFYFUN=$P($G(^ACRLOCB(+$P(^ACRDOC(ACRDOCDA,0),U,6),"DT")),U) ;ACR*2.1*16.06 IM15505
 S ACRLBDA=$P(^ACRDOC(ACRDOCDA,0),U,6)          ;ACR*2.1*16.06 IM15505
 S ACRFYFUN=$P($G(^ACRLOCB(ACRLBDA,"DT")),U)    ;ACR*2.1*16.06 IM15505
 W !
 S ACRBTYP="V"                                  ;ACR*2.1*16.06 IM15505
 D AMOUNT
 Q:'$D(ACRIVPAY)
 K ACRVDA
 S DIC("B")=$P($G(^ACRSYS(1,501)),U)
 D VENDOR^ACRFPAY8
 Q:$D(ACRQUIT)!$D(ACROUT)!'$G(ACRVDA)
 D INVOICE^ACRFPAY1               ;ADD INVOICE NUMBER   ACR*2.1*5.03
 Q:$D(ACRQUIT)!$D(ACROUT)                            ;  ACR*2.1*5.03
 ;S ACRBTYP="V"                                ;ACR*2.1*16.06 IM15505
 ;D PTYPE^ACRFPAY9                             ;ACR*2.1*16.06 IM15505
 ;Q:$D(ACRQUIT)!$D(ACROUT)                     ;ACR*2.1*16.06 IM15505
 S DIR("B")=19214
 D PTYPE^ACRFPAY9
 Q:$D(ACRQUIT)!$D(ACROUT)
 S DIR("B")="FINAL"
 D FINAL^ACRFPAY1
 Q:$D(ACRQUIT)!$D(ACROUT)
 D PAYDUE^ACRFIV41
 Q:$D(ACRQUIT)!$D(ACROUT)!'$G(ACRPAYDA)!'$G(ACRPAYDU)
 ;S ACRACH="A"                                  ;ACR*2.1*17.01 IM17097
 D SCHT^ACRFIV4         ;GET PAYMENT TYPE       ;ACR*2.1*17.01 IM17097
 S ACRREF=618
 ;D ^ACRFIV11                                   ;ACR*2.1*17.01 IM17097
 D BCHECK^ACRFIV12                              ;ACR*2.1*17.01 IM17097
 Q:$D(ACRQUIT)                                  ;ACR*2.1*17.01 IM17097
 D N1166^ACRFIV11                               ;ACR*2.1*17.01 IM17097
 Q:$D(ACRQUIT)                                  ;ACR*2.1*17.01 IM17097
 S DA=ACRDOCDA
 S DIE="^ACROBL("
 S DR="913////1"
 D DIE^ACRFDIC
 Q
AMOUNT ;CALCULATE PAYMENT AMOUNT
 K ACRIVPAY
 N ACRX
 S ACRX=0
 F  S ACRX=$O(^ACRAL("C",ACRDOCDA,ACRX)) Q:'ACRX  S ACRIVTF=$G(ACRIVTF)+$P($G(^ACRAL(ACRX,"DT")),U,9)
 Q:'$G(ACRIVTF)
 S ACRCANDA=$O(^ACRSS("J",ACRDOCDA,0))
 Q:'ACRCANDA
 S ACROBJDA=$P($G(^ACRSS(ACRCANDA,0)),U,4)
 S ACRCANDA=$P($G(^ACRSS(ACRCANDA,0)),U,5)
 Q:'ACRCANDA!'ACROBJDA
 S DIR("B")=ACRIVTF
 D AMOUNT^ACRFPAY1
 Q:'$G(ACRIVTF)
 S ACRIVPAY(ACRCANDA,ACROBJDA)=ACRIVTF
 Q
 ;SEQNO ;EP;FIND NEXT SEQUENCE NUMBER  ;ACR*2.1*16.06 IM15505
SEQNO(ACRFYDA,ACRBATDA,ACRSEQNO) ;EP;FIND NEXT SEQUENCE NUMBER  ;ACR*2.1*16.06 IM15505
 N X,Y
 S Y=0
 S X=""
 F  S X=$O(^AFSLAFP(ACRFYDA,1,ACRBATDA,1,"B",X)) Q:X=""  S Y=X
SEQNO1 S ACRSEQNO=Y+1
 S ACRSEQNO=$E("0000",1,4-$L(ACRSEQNO))_ACRSEQNO
 I $D(^AFSLAFP(ACRFYDA,1,ACRBATDA,1,"B",ACRSEQNO)) S Y=ACRSEQNO G SEQNO1
 Q
BCHECK ;EP;TO CHECK FOR BATCH NUMBER AND CREATE NEW BATCH
 S ACRFY=$S($E(ACRPAYDA,4,5)<10:$E(ACRPAYDA,1,3),1:$E(ACRPAYDA,1,3)+1)
 S ACRFY=ACRFY+1700
 I '$D(^AFSLAFP("B",ACRFY)) D
 .S X=ACRFY
 .S DIC="^AFSLAFP("
 .S DIC(0)="L"
 .D FILE^ACRFDIC
 S ACRFYDA=$O(^AFSLAFP("B",ACRFY,0))
 Q:'ACRFYDA
 Q:'$D(^AFSLAFP(ACRFYDA,0))
BAT ;DETERMINE IF BATCH EXISTS FOR PAYMENT DATE AND TYPE (PO vs TRAVEL)
 K ACRBATNO,ACRQUIT
 N J,X,Y,Z
 S X=ACRPAYDA-1
 F  S X=$O(^AFSLAFP("J",X)) Q:'X!(ACRPAYDA<X)!$D(ACRQUIT)  D  ;ACR*2.1*3.42
 .S Y=0
 .F  S Y=$O(^AFSLAFP("J",X,ACRFYDA,Y)) Q:'Y!$D(ACRQUIT)  D
 ..Q:$P($G(^AFSLAFP(ACRFYDA,1,Y,2)),U,3)'="O"
 ..S J=$G(J)+1
 ..S ACRBATNO(J)=$P($G(^AFSLAFP(ACRFYDA,1,Y,0)),U)_U_Y
 I '$D(ACRBATNO) D NEWBAT(ACRPAYDA,ACRBTYP,ACRACH,ACRFYDA,.ACRBATNO,.ACRBATDA) Q
 S X=0
 F  S X=$O(ACRBATNO(X)) Q:'X!$D(ACRQUIT)  D
 .S Y=ACRBATNO(X)
 .S J=$E(Y)
 .Q:J=""
 .I $G(ACRBTYP)="T","DEFO"[J D
 ..I J="D",ACRACH'="A" Q
 ..I J="E",ACRACH'="B" Q
 ..I J="F",ACRACH'="C" Q
 ..I J="O",ACRACH'="N" Q
 ..S Z=Y
 .I "ABCGN"[J,$G(ACRBTYP)="V",$P($G(^AFSLAFP(ACRFYDA,1,+$P(Y,U,2),2)),U,8)=ACRACH S Z=Y
 .I $G(Z)]"" D  I 1
 ..S ACRBATDA=$P(Z,U,2)
 ..I $G(ACRBATDA),$$COUNT(ACRFYDA,ACRBATDA)<59!$P(^ACRSYS(1,"DT1"),U,16) D  I 1
 ...K ACRBATNO
 ...S ACRQUIT=""
 ...S ACRBATNO=$P(Z,U)
 ..E  K ACRBATDA
 K ACRQUIT
 I $G(ACRBATDA),$G(ACRFYDA) D
 . I $P($G(^AFSLAFP(ACRFYDA,1,ACRBATDA,2)),U,3)="C" K ACRBATNO,ACRBATDA Q
 . I $P($G(^AFSLAFP(ACRFYDA,1,ACRBATDA,1,0)),U,4)>59 K ACRBATNO,ACRBATDA
 I $G(ACRBATNO)=""!'$G(ACRBATDA) D NEWBAT(ACRPAYDA,ACRBTYP,ACRACH,ACRFYDA,.ACRBATNO,.ACRBATDA)
 Q
NEWBAT(ACRPAYDA,ACRBTYP,ACRACH,ACRFYDA,ACRBATNO,ACRBATDA)  ;
 ;----- CREATE NEW 1166 BATCH
 ;
 ;      ACRPAYDA = PAYMENT DUE DATE
 ;      ACRBTYP  = BATCH TYPE (V=VENDOR,T=TRAVEL)
 ;      ACRACH   = ACH SCHEDULE FORMAT
 ;      ACRFYDA  = FISCAL YEAR IEN IN 1166 APPROVALS FOR PAYMENT FILE
 ;      ACRJDATE = JULIAN DATE
 ;      V        = BATCH PREFIX
 ;      ACRBATNO = BATCH NUMBER (RETURNED)
 ;      ACRBATDA = BATCH IEN IN 1166 APPROVALS FOR PAYMENT FILE (RETURNED)
 ;
 N ACRJDATE,DA,DIC,DR,I,V,X,Y
 S ACRJDATE=$$JDATE(ACRPAYDA)
 I ACRBTYP="V" S V=ACRACH
 I ACRBTYP="T" D
 .S:ACRACH="A" V="D"
 .S:ACRACH="B" V="E"
 .S:ACRACH="C" V="F"
 .S:ACRACH="N" V="O"
 .S:ACRACH="G" V="G"
 F I=1:1:99 D  Q:'$D(^AFSLAFP("L",X,ACRFYDA))
 . S X=V_ACRJDATE_$$PAD^ACRFUTL(I,"L",2,0)
 Q:$D(^AFSLAFP("L",X,ACRFYDA))
 S ACRBATNO=X
 S DA(1)=ACRFYDA
 S DIC="^AFSLAFP("_DA(1)_",1,"
 S DIC(0)="L"
 S DIC("P")=$P(^DD(9002325,1,0),U,2)
 S DIC("DR")=".04////"_$G(ACRBTYP)_";1////"_DT_";3////"_ACRPAYDA_";6////O;8////"_DUZ_";22////"_ACRACH
 K DD,DO
 D FILE^DICN
 S ACRBATDA=+Y
 Q
JDATE(X) ;EP;CALCULATE JULIAN DATE
 S X1=X
 S X2=$E(X,1,3)_"0101"
 D ^%DTC
 S X=X+1
 S X=$E("000",1,3-$L(X))_X
 Q X
COUNT(X,Y) ;EP;COUNT NUMBER OF PAYMENTS
 ;FORCE NEW BATCH IF MORE THAN 60 PAYMENTS
 N A,J,K,Z
 S Z=$P($G(^AFSLAFP(X,1,Y,2)),U,8)
 S (J,K)=0
 F  S K=$O(^AFSLAFP(X,1,Y,1,K)) Q:'K  D
 .;IF ACH-GROUPED BATCH THEN COUNT ONLY NUMBER OF VENDORS/TRAVELERS
 .I Z]"","AD"[Z D  Q:A
 ..S A=$G(^AFSLAFP(X,1,Y,1,K,0))
 ..S A=$S($P(A,U,10):$P(A,U,10),$P(A,U,24):$P(A,U,24),1:"")
 ..I A,'$D(Z(A)) S J=J+1,Z(A)=""
 .K A
 .S J=J+1
 N X,Y
 S X=0
 F  S X=$O(ACRIVPAY(X)) Q:'X  D
 .S Y=0
 .F  S Y=$O(ACRIVPAY(X,Y)) Q:'Y  S J=J+1
 S X=0
 F  S X=$O(ACRIVDIS(X)) Q:'X  D
 .S Y=0
 .F  S Y=$O(ACRIVDIS(X,Y)) Q:'Y  S J=J+1
 Q J
VENDOR ;EP;GATHER ALL VENDOR DATA  ; SUBROUTINE REWRITTEN ACR*2.1*20.10  IM18953
 Q:'$G(ACRVDA)
 S ACR3=$S($G(ACR3):ACR3,1:1)
 S ACRV11=$G(^AUTTVNDR(ACRVDA,11))
 S ACRV13=$G(^AUTTVNDR(ACRVDA,13))
 S ACRV14=$G(^AUTTVNDR(ACRVDA,14))
 S ACR16=ACRVDA
 S ACR33=$E($P($G(^AUTTVNDR(ACRVDA,0)),U),1,40)
 S ACR33=$$UPPER(ACR33)
 S ACR58=$P(ACRV11,U,13)
 S ACR56=$E($P(ACRV11,U,13),11,12)
 S ACR65=ACRVDA
 ;BEGIN OLD CODE
 ;S ACR28=$P(ACRV14,U,6)
 ;S ACR28=$$UPPER(ACR28)
 ;S ACR29=$E($S($P(ACRV14,U,1)]"":$P(ACRV14,U,1),1:$P(ACRV13,U,1)),1,30)
 ;S ACR29=$$UPPER(ACR29)
 ;S ACR30=$E($S($P(ACRV14,U,3)]"":$P(ACRV14,U,3),1:$P(ACRV13,U,2)),1,20)
 ;S ACR30=$$UPPER(ACR30)
 ;S ACR31=$S($P(ACRV14,U,4)]"":$P(ACRV14,U,4),1:$P(ACRV13,U,3))
 ;S ACR31=$P($G(^DIC(5,+ACR31,0)),U,2)
 ;S ACR32=$E($S($P(ACRV14,U,5)]"":$P(ACRV14,U,5),1:$P(ACRV13,U,4)),1,10)
 ;S ACR68=$E($S($P(ACRV14,U,2)]"":$P(ACRV14,U,2),1:$P(ACRV13,U,10)),1,30)
 ;S ACR68=$$UPPER(ACR68)
 ;Q
 ;BEGIN NEW CODE
 S ACR28=$P(ACRV14,U,6)                 ;REMIT ATTN
 S ACR29=$P(ACRV14,U,1)                 ;REMIT STREET
 S ACR68=$P(ACRV14,U,2)                 ;REMIT STREET 2
 S ACR30=$P(ACRV14,U,3)                 ;REMIT CITY
 S ACR31=$P(ACRV14,U,4)                 ;REMIT STATE
 S ACR32=$P(ACRV14,U,5)                 ;REMIT ZIP
 I ACR29=""!(ACR30="")!(ACR31="") S (ACR28,ACR29,ACR30,ACR31,ACR32,ACR68)=""
 I ACR29="" D
 .S ACR28=$P(ACRV13,U,5)                 ;MAIL ATTN
 .S ACR29=$P(ACRV13,U,1)                 ;MAIL STREET
 .S ACR68=$P(ACRV13,U,10)                ;MAIL STREET 2
 .S ACR30=$P(ACRV13,U,2)                 ;MAIL CITY
 .S ACR31=$P(ACRV13,U,3)                 ;MAIL STATE
 .S ACR32=$P(ACRV13,U,4)                 ;MAIL ZIP
 .I ACR29=""!(ACR30="")!(ACR31="") S (ACR28,ACR29,ACR30,ACR31,ACR32)=""
 S ACR31=$P($G(^DIC(5,+ACR31,0)),U,2)
 S ACR28=$$UPPER(ACR28)
 S ACR29=$$UPPER(ACR29)
 S ACR30=$$UPPER(ACR30)
 S ACR68=$$UPPER(ACR68)
 Q
TRAVELER ;EP;GATHER TRAVELER DATA FOR TRAVEL PAYMENT
 N X,Z
 S (X,ACRDUZ)=$S($G(ACRDUZ):ACRDUZ,1:$P($G(^ACRDOC(ACRDOCDA,"TO")),U,9))
 ;S ACR33=$P($G(^VA(200,+X,0)),U)  ;ACR*2.1*19.02 IM16848
 S ACR33=$$NAME2^ACRFUTL1(+X)  ;ACR*2.1*19.02 IM16848
 I ACR33="" S ACROUT="" Q
 I $G(ACRDOCDA) S ACRBEG=$G(^ACRDOC(ACRDOCDA,"TO"))
 I $G(ACRDOCDA) S ACREND=$P(ACRBEG,U,15)
 I $G(ACRDOCDA) S ACRBEG=$P(ACRBEG,U,14)
 S ACR58=$P($G(^VA(200,+X,1)),U,9)
 S ACR27=X
 S Z=$G(^VA(200,X,.11))
 S ACR29=$P(Z,U)
 S ACR29=$$UPPER(ACR29)
 S ACR68=$P(Z,U,2)
 S ACR68=$$UPPER(ACR68)
 S ACR30=$P(Z,U,4)
 S ACR30=$$UPPER(ACR30)
 S ACR31=$P($G(^DIC(5,+$P(Z,U,5),0)),U,2)
 S ACR32=$P(Z,U,6)
 S ACRREF2=$P($G(^ACRDOC(+$G(ACRDOCDA),18)),U,5)
 S ACR18=+$P($G(^ACRDOC(+$G(ACRDOCDA),"TO")),U,25)   ;TRAVEL ADVANCE
 S ACR18=$P(ACR18,".")
 S:ACRREF2 ACRREF2=$P($G(^AUTTDOCR(ACRREF2,0)),U)
 S ACRDOC2=$P($G(^ACRDOC(+$G(ACRDOCDA),18)),U,4)
 S ACR3=$S($G(ACR3):ACR3,1:4)
 S ACRFINAL=1
 S ACR64=ACRDUZ
 S ACRTCODE=$S($G(ACRTCODE)]"":ACRTCODE,1:19214)
 S:$G(ACRFYFUN)="" ACRFYFUN=$P($G(^ACRLOCB(+$P($G(^ACRDOC(+$G(ACRDOCDA),0)),U,6),"DT")),U)
 Q
UPPER(X) ;CONVERT TO UPPER CASE
 X ^%ZOSF("UPPERCASE")
 Q Y
DATES ;EP -- GET TRAVEL BEGIN AND END DATES
 ;
 ;      RETURNS:  ACRBEG = BEGINNING TRAVEL DATE
 ;                ACREND = ENDING TRAVEL DATE
 ;
 N DIR,X,Y
 K ACRBEG,ACREND
 N ACRTMP                                           ;ACR*2.1*3.37
 I +$G(ACRX),$G(ACRDOC) D                           ;ACR*2.1*3.37
 .S ACRTMP=$G(^ACRDOC(ACRX,"TO"))                   ;ACR*2.1*3.37
 .S ACRBEG=$P(ACRTMP,U,14),ACREND=$P(ACRTMP,U,15)   ;ACR*2.1*3.37
 I +$G(ACRBEG) D                                    ;ACR*2.1*3.37
 .N Y S Y=ACRBEG X ^DD("DD") S DIR("B")=Y           ;ACR*2.1*3.37
 S DIR(0)="D^::E"
 S DIR("A")="TRAVEL BEGIN DATE..."
 S DIR("?")="Enter the beginning date of travel"
 D ^DIR
 I $D(DTOUT)!($D(DIRUT)) S ACROUT="" Q
 S ACRBEG=Y
 I +$G(ACREND) D                                    ;ACR*2.1*3.37
 .N Y S Y=ACREND X ^DD("DD") S DIR("B")=Y           ;ACR*2.1*3.37
 S DIR("A")="TRAVEL END DATE....."
 S DIR("?")="Enter the ending date of travel"
 D ^DIR
 I $D(DTOUT)!($D(DIRUT)) K ACRBEG S ACROUT="" Q
 S ACREND=Y
 I ACREND<ACRBEG W !,*7,"   ENDING DATE CANNOT BE BEFORE BEGINNING DATE!" G DATES
 Q