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

ACRFPAY2.m

Go to the documentation of this file.
ACRFPAY2 ;IHS/OIRM/DSD/THL,AEF - CERTIFY AND EXPORT PAYMENT BATCH;  [ 09/23/2005  9:22 AM ]
 ;;2.1;ADMIN RESOURCE MGT SYSTEM;**3,16,19**;NOV 05, 2001
 ;;
TRANSFER ;EP;TO CREATE NEW SEQUENCE NUMBER AND TRANSFER PAYMENT TO ANOTHER BATCH
 N ACRBATDA,ACRFYDA
 S ACRBATDA=+ACRDEST
 S ACRFYDA=$P(ACRDEST,U,2)
 D NEWSEQ
 Q:'$D(ACRSEQDA)
 S ACRSEQNO=$P(^AFSLAFP(ACRFYDA,1,ACRBATDA,1,ACRSEQDA,0),U)
 S %X="^AFSLAFP("_ACRSFY_",1,"_ACRSBAT_",1,"_ACRSS_","
 S %Y="^AFSLAFP("_ACRFYDA_",1,"_ACRBATDA_",1,"_ACRSEQDA_","
 D %XY^%RCR
 S $P(^AFSLAFP(ACRFYDA,1,ACRBATDA,1,ACRSEQDA,0),U)=ACRSEQNO
 S DA=ACRSEQDA
 S DA(2)=ACRFYDA
 S DA(1)=ACRBATDA
 S DIK="^AFSLAFP("_ACRFYDA_",1,"_ACRBATDA_",1,"
 D IX1^ACRFDIC
 S DA=ACRSS
 S DA(2)=ACRSFY
 S DA(1)=ACRSBAT
 S DIK="^AFSLAFP("_ACRSFY_",1,"_ACRSBAT_",1,"
 D DIK^ACRFDIC
 Q
NEWSEQ ;CREATE NEW SEQUENCE ENTRY
 ;D SEQNO^ACRFIV12                             ;ACR*2.1*16.06 IM15505
 D SEQNO^ACRFIV12(ACRFYDA,ACRBATDA,.ACRSEQNO)  ;ACR*2.1*16.06 IM15505
 Q:'$G(ACRSEQNO)
 S DA(2)=ACRFYDA
 S DA(1)=ACRBATDA
 S X=ACRSEQNO
 S DIC="^AFSLAFP("_DA(2)_",1,"_DA(1)_",1,"
 S DIC(0)="L"
 S DIC("DR")="2////"_DUZ
 S:'$D(^AFSLAFP(ACRFYDA,1,ACRBATDA,1,0)) ^(0)="^9002325.02"
 D FILE^ACRFDIC
 S ACRSEQDA=+Y
 Q
TRANS ;EP;TRANSFER A PAYMENT
 S DIC="^AFSLAFP("
 S DIC(0)="AEMQZ"
 S DIC("A")="Fiscal Year of DESTINATION Batch.: "
 S DIC("B")=$P(^AFSLAFP(ACRFYDA,0),U)
 W !
 D DIC^ACRFDIC
 I +Y<1 S ACRQUIT="" Q
 S $P(ACRDEST,U,2)=+Y
BAT S DIC="^AFSLAFP("_+Y_",1,"
 S DIC(0)="AEMQZ"
 S DIC("A")="Batch Number of DESTINATION Batch: "
 S DIC("S")="I $P($G(^(2)),U,3)=""O"""
 D DIC^ACRFDIC
 I +Y<1 S ACRQUIT="" Q
 S $P(ACRDEST,U)=+Y
 S DIR(0)="LO^1:"_ACRMAX
 S DIR("A")="TRANSFER Which PAYMENT(s)"
 W !
 D DIR^ACRFDIC
 I '+Y S ACRQUIT="" Q
 S ACRXX=ACRY
 S DIR("A",1)="Are you CERTAIN you want to TRANSFER"
 S DIR("A")="payment(s) "_$E(ACRY,1,$L(ACRY)-1)_" from this batch"
 S DIR(0)="YO"
 S DIR("B")="NO"
 W !
 D DIR^ACRFDIC
 I +Y'=1 S ACRQUIT="" Q
 S ACRSFY=ACRFYDA
 S ACRSBAT=ACRBATDA
 F ACRJ=1:1 S X=$P(ACRXX,",",ACRJ) Q:'X!'+$G(^TMP("ACRPAY",$J,+X))!$D(ACRQUIT)  S ACRSS=+^TMP("ACRPAY",$J,X) D TRANSFER
 K ACRQUIT
 Q
LOCATOR ;EP;TO LOCATE A DOCUMENT
 F  D L1 Q:$D(ACRQUIT)!$D(ACROUT)
 Q
L1 W @IOF
 N ACRXREF,ACRX
 W !?17,"Document LOCATOR",!
 S DIR(0)="SO^1:Vendor Name/EIN;2:Traveler;3:Document Number;4:ARMS Invoice Number"
 S DIR("A")="Which one"
 W !
 D DIR^ACRFDIC
 Q:'Y
 I Y=1 D VN S Y=1
 I Y=2 D TV S Y=2
 I Y=3 D DN S Y=3
 I Y=4 D IN S Y=4
 I $G(ACRX)]"",$G(ACRXREF)]"" D ZIS
 K ACRQUIT
 Q
VN S DIC="^AUTTVNDR("
 S DIC(0)="AEMQZ"
 S DIC("A")="Which Vendor: "
 S DIC("S")="I $D(^AFSLAFP(""E"",+Y))"
 W !
 D DIC^ACRFDIC
 I +Y<1 S ACRQUIT="" Q
 S ACRX=+Y
 S ACRXREF="E"
 S ACRXX=$P($G(^AUTTVNDR(ACRX,0)),U)
 D ^ACRFDATE
 Q
TV S DIC="^ACRAU("
 S DIC(0)="AEMQZ"
 S DIC("A")="Which Traveler: "
 S DIC("S")="I $D(^AFSLAFP(""H"",+Y))"
 W !
 D DIC^ACRFDIC
 I +Y<1 S ACRQUIT="" Q
 S ACRX=+Y
 S ACRXREF="H"
 ;S ACRXX=$P($G(^VA(200,ACRX,0)),U)  ;ACR*2.1*19.02 IM16848
 S ACRXX=$$NAME2^ACRFUTL1(ACRX)  ;ACR*2.1*19.02 IM16848
 D ^ACRFDATE
 Q
DN S DIR(0)="FO^10:10"
 S DIR("A")="Document NUMBER"
 S DIR("?",1)="Enter the 10 character document number"
 S DIR("?")="for the document you want to locate."
 W !
 D DIR^ACRFDIC
 I $L(Y)'=10 S ACRQUIT="" Q
DN1 S (ACRX,ACRXX)=ACRY
 S ACRXREF="N"
 I '$D(^AFSLAFP(ACRXREF,ACRX)) D  Q
 .W !!,"No payments on file in 1166 PAYMENT PACKAGE for ",ACRXX
 .D PAUSE^ACRFWARN
 .K ACRQUIT,ACRX,ACRXX,ACRXREF
 Q
IN S DIC="^ACRINV("
 S DIC(0)="AEMQZ"
 S DIC("A")="Invoice Number: "
 W !
 D DIC^ACRFDIC
 I +Y<1 K ACRQUIT Q
 S ACRY=$P(^ACRINV(+Y,0),U,7)
 S ACRDOCDA=$P(^ACRINV(+Y,0),U,2)
 I ACRDOCDA D
 . S ACRY=$P($G(^ACRDOC(ACRDOCDA,0)),U,2)
 . I ACRY="" S ACRY=$E($TR($P($G(^ACRDOC(ACRDOCDA,0)),U),"-",""),1,10)
 D DN1
 Q
L2 ;EP;TO PRINT PAYMENT HISTORY
 I '$D(^AFSLAFP(ACRXREF,ACRX)) D  Q
 .W !!,"No payments on file in 1166 PAYMENT PACKAGE for ",ACRXX
 .D PAUSE^ACRFWARN
 .K ACRQUIT
 S ACRFYDA=99999
 F  S ACRFYDA=$O(^AFSLAFP(ACRXREF,ACRX,ACRFYDA),-1) Q:'ACRFYDA!$D(ACRQUIT)  D
 .S ACRBATDA=99999999
 .F  S ACRBATDA=$O(^AFSLAFP(ACRXREF,ACRX,ACRFYDA,ACRBATDA),-1) Q:'ACRBATDA!$D(ACRQUIT)  D
 ..N X,Y,Z
 ..S X=$G(^AFSLAFP(ACRFYDA,1,ACRBATDA,0))
 ..S Y=$G(^AFSLAFP(ACRFYDA,1,ACRBATDA,2))
 ..I $D(ACRBEGIN),+Y,+Y<ACRBEGIN Q
 ..I $D(ACREND),+Y,+Y>ACREND Q
 ..I $D(ACRBEGIN),'+Y,$P(Y,U,2),$P(Y,U,2)<ACRBEGIN Q
 ..I $D(ACREND),'+Y,$P(Y,U,2),$P(Y,U,2)>ACREND Q
 ..D BATCH
 ..S ACRSEQDA=0
 ..F  S ACRSEQDA=$O(^AFSLAFP(ACRXREF,ACRX,ACRFYDA,ACRBATDA,ACRSEQDA)) Q:'ACRSEQDA!$D(ACRQUIT)  D
 ...S X=$G(^AFSLAFP(ACRFYDA,1,ACRBATDA,1,ACRSEQDA,0))
 ...S Y=$G(^AFSLAFP(ACRFYDA,1,ACRBATDA,1,ACRSEQDA,1))
 ...S Z=$G(^AFSLAFP(ACRFYDA,1,ACRBATDA,1,ACRSEQDA,2))
 ...D SEQ
 K ACRQUIT,ACROUT
 Q
BATCH W !!,"FISCAL YEAR....: ",$P($G(^AFSLAFP(ACRFYDA,0)),U)
 W !,"BATCH NUMBER...: ",$P(X,U)
 W !,"SCHEDULE NUMBER: ",$P(Y,U,6)
 I $P(Y,U) S Y=$P(Y,U) X ^DD("DD") W !,"EXPORT DATE....: ",Y
 E  I $P(Y,U,2) S Y=$P(Y,U,2) X ^DD("DD") W !,"EXPORT DUE.....: ",Y
 Q
SEQ W !!?3,"SEQUENCE NO.: ",$P(X,U)
 W !?3,"DOCUMENT NO.: ",$P(X,U,20),?35,"(",$P(X,U,5),")"
 W !?3,"AMOUNT......: ",$J($FN($P(X,U,11),"P",2),11),?35,"(",$P($G(^AUTTCAN(+$P(X,U,7),0)),U),?$X+3,$P($G(^AUTTOBJC(+$P(X,U,8),0)),U),")"
 I $P(X,U,10) W !?3,"VENDOR......: ",$P($G(^AUTTVNDR($P(X,U,10),0)),U)
 ;I $P(X,U,24) W !?3,"EMPLOYEE....: ",$P($G(^VA(200,$P(X,U,24),0)),U)  ;ACR*2.1*19.02 IM16848
 I $P(X,U,24) W !?3,"EMPLOYEE....: ",$$NAME2^ACRFUTL1($P(X,U,24))  ;ACR*2.1*19.02 IM16848
 W !?3,"PAID FOR....: ",$P(Z,U,14)
 W !?3,"ACH ADDENDUM: ",$P(Z,U,2)
 D PAUSE^ACRFWARN
 I $Y+4>IOSL W @IOF
 Q
ZIS ;PRINT PAYMENT HISTORY
 S (ZTRTN,ACRRTN)="L2^ACRFPAY2"
 S ZTDESC="PRINT PAYMENT HISTORY"
 D ^ACRFZIS
 Q
DHR(ACRFYDA,ACRBATDA,ACRSEQDA) ;EP;TO CREATE PAYMENT DHR
 Q:'ACRFYDA!'ACRBATDA!'ACRSEQDA
 N X                                               ;ACR*2.1*3.06
 S X=$G(^AFSLAFP(ACRFYDA,1,ACRBATDA,1,ACRSEQDA,0))
 Q:X=""
 D DHR2(ACRFYDA,ACRBATDA,ACRSEQDA,X)               ;ACR*2.1*3.06
 Q                                                 ;ACR*2.1*3.06
DHR2(ACRFYDA,ACRBATDA,ACRSEQDA,X)        ;EP;              ;ACR*2.1*3.06
 N Y,Z                                             ;ACR*2.1*3.06
 S Y=$G(^AFSLAFP(ACRFYDA,1,ACRBATDA,1,ACRSEQDA,1))
 Q:Y=""
 S Z=$G(^AFSLAFP(ACRFYDA,1,ACRBATDA,1,ACRSEQDA,2))
 Q:Z=""
 N ACRZ S ACRZ=$G(^AFSLAFP(ACRFYDA,1,ACRBATDA,1,ACRSEQDA,3))
 S ACR1=$P(X,U,4) ;RECORD TYPE                     ;ACR*2.1*3.07
 S ACR2=DT
 S ACR3=$E($P(X,U,18),1,3)
 S ACR4=$E($P(X,U,18),4)
 S ACR5=$E($P(X,U,18),5)
 S ACR6=$P(X,U,5)
 S ACR7=$P(X,U,20)
 S ACR8=$P(X,U,6)                                  ;ACR*2.1*3.06
 S ACR9=$P(X,U,21)                                 ;ACR*2.1*3.06
 S ACR10=1
 S ACR11=$P(X,U,2)
 S ACR12=$P(X,U,7)
 S ACR12=$P($G(^AUTTCAN(+ACR12,0)),U)
 S ACR13=$P(X,U,8)
 S ACR13=$P($G(^AUTTOBJC(+ACR13,0)),U)
 S ACR14=$P(X,U,11)
 S ACR14=$TR(ACR14,".","")
 S ACR14=$E("000000000000",1,12-$L(ACR14))_ACR14
 S ACR15=$P(X,U,15)
 S ACR16=$P(X,U,10)
 S ACR16=$P($G(^AUTTVNDR(+ACR16,11)),U,13)
 S ACR16=ACR16_$E("               ",1,15-$L(ACR16))
 S ACR17="               "
 S ACR18=$P(Y,U,11)
 S ACR19="      "
 S ACR20="  "
 S ACR21=" "
 S ACR22="  "
 S ACR23="    "
 S ACR24="    "
 S ACR25="      "
 S ACR26=$P(ACRZ,U)
 I $L(ACR26)'=4 S ACR26="    "
 S ACR27=$P(ACRZ,U,2)
 I $L(ACR27)'=4 S ACR27="    "
 S ACR28=$P(ACRZ,U,3)
 I $L(ACR28)'=2 S ACR28="  "
 S ACR29=" "
 S ACR30="    "
 S DR=""
 F J=1:1:30 S DR=DR_@("ACR"_J)
 S:DR["^" DR=$TR(DR,"^","")
 I $D(^ACRDHR("C",DR)) D  Q
 . S ACRFMS=$O(^ACRDHR("C",DR,0))
 I $G(ACRDOCDA)="",ACR7]"" D                     ;ACR*2.1*3.06
 .S ACRDOCDA=$O(^ACRDOC("B",ACR7,0))             ;ACR*2.1*3.06
 .S:ACRDOCDA="" ACRDOCDA=$O(^ACRDOC("C",ACR7,0)) ;ACR*2.1*16.06 IM15505
 S ACRDR="99////"_DR
 S DIC="^ACRDHR("
 S DIC(0)="L"
 S X=".02////"_DT_";.03////"_DUZ_";.04////"_$G(ACRDOCDA)_";"
 F J=1:1:16,18,26,27,28 S X=X_J_"////"_@("ACR"_J)_";"
 S DIC("DR")=X
 S X=ACR7
 D FILE^ACRFDIC
 S DA=+Y
 S ACRFMS=+Y
 S DIE="^ACRDHR("
 S DR=ACRDR
 D DIE^ACRFDIC
 F J=1:1:30 K @("ACR"_J)
 S DA=ACRSEQDA
 S DIE="^AFSLAFP("_ACRFYDA_",1,"_ACRBATDA_",1,"
 S DR=".04////"_ACRFMS
 D ^DIE
 K ACRFMS
 Q
DHRPRINT ;EP;TO SELECT PAYMENT BATCH TO PRINT
 K ACRFYDA,ACRBATDA,ACRSEQDA
 F  D DP1 Q:$D(ACRQUIT)!$D(ACROUT)
 K ACRQUIT,ACROUT,ACRFYDA,ACRBATDA,ACRSEQDA
 Q
DP1 ;SELECT FY
 W @IOF
 W !?20,"Select the Fiscal Year and Batch"
 W !?20,"for Payment DHR's to be printed."
 W !!
 S ACRDHR=""
 D FYBAT
 Q:'$G(ACRFYDA)!'$G(ACRBATDA)
DHRZIS ;EP;TO SELECT DEVICE
 S (ZTRTN,ACRRTN)="DP2^ACRFPAY2"
 S ZTDESC="PRINT PAYMENT DHR'S"
 D ^ACRFZIS
 Q
DP2 ;EP;
 K ACRQUIT,ACRDOC
 N ACRSEQDA,ACRSCHNO
 S ACRSCHNO=$P(^AFSLAFP(ACRFYDA,1,ACRBATDA,2),U,6)
 Q:ACRSCHNO=""
 S ACRSEQDA=0
 F  S ACRSEQDA=$O(^AFSLAFP(ACRFYDA,1,ACRBATDA,1,ACRSEQDA)) Q:'ACRSEQDA!$D(ACRQUIT)  D
 .S ACRDOC=$P($G(^AFSLAFP(ACRFYDA,1,ACRBATDA,1,ACRSEQDA,0)),U,20)
 .Q:ACRDOC=""
 .Q:$D(ACRDOC(ACRDOC))
 .S ACRDOC(ACRDOC)=""
 .S D0=0
 .F  S D0=$O(^ACRDHR("B",ACRDOC,D0)) Q:'D0  D
 ..Q:$P($G(^ACRDHR(D0,1)),U,18)'=ACRSCHNO
 ..D DHRP
 Q
DHRP ;EP;TO PRINT PAYMENT DHR'S
 D ^ACRDHR
 D PAUSE^ACRFWARN
 W @IOF
 Q
DHRPYN ;EP
 S DIR(0)="YO"
 S DIR("A")="Print Payment DHR's now"
 S DIR("B")="NO"
 W !
 D DIR^ACRFDIC
 I Y'=1 S ACRQUIT="" Q
 D DP1
 Q
FYBAT ;EP;SELECT FY AND BATCH
 S DIC="^AFSLAFP("
 S DIC(0)="AEMQZ"
 S DIC("A")="Which FISCAL YEAR: "
 S DIC("B")=$S($E(DT,4,5)<10:$E(DT,1,3)+1700,1:($E(DT,1,3)+1)+1700)
 S DIC("S")="I $P(^(0),U)=X"
 S Y=""
 I $G(ACRFYDA) S Y=ACRFYDA K DIC
 E  W ! D DIC^ACRFDIC
 I +Y<1 S ACRQUIT="" K ACRFYDA Q
 S (ACRFYDA,DA(1))=+Y
 S ACRFY=$P(^AFSLAFP(+Y,0),U)
 S DIC="^AFSLAFP("_DA(1)_",1,"
 S DIC(0)="AEMQZ"
 S DIC("A")="Batch or Sched #: "
 I $D(ACRDIC("S"))#2 S DIC("S")=ACRDIC("S") K ACRDIC("S")
 I $D(ACRDHR) K ACRDHR S DIC("S")="I +$G(^(2))"
 S Y=""
 I $G(ACRBATDA) S Y=ACRBATDA K DIC
 E  W ! D DIC^ACRFDIC
 I +Y<1 S ACRQUIT="" K ACRBATDA Q
 S ACRBATDA=+Y
 S ACRBATNO=$P(^AFSLAFP(ACRFYDA,1,+Y,0),U)
 S ACRSCHNO=$P($G(^AFSLAFP(ACRFYDA,1,ACRBATDA,2)),U,6)
 I $D(ACREXP)#2,$P($G(^AFSLAFP(ACRFYDA,1,ACRBATDA,2)),U)]"" D  Q
 .W !!,"This Batch has already been exported."
 .K ACRBATDA
 .D PAUSE^ACRFWARN
 Q