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

ACRFPAYE.m

Go to the documentation of this file.
ACRFPAYE ;IHS/OIRM/DSD/THL,AEF - MISC PM REPORTS;  [ 01/03/2003  9:52 AM ]
 ;;2.1;ADMIN RESOURCE MGT SYSTEM;**5**;NOV 05, 2001
 ;;
EFTRPT ;EP;TO PRINT ELECTRONIC FUNDS TRANSFER PROFILE
 F  D EFT1 Q:$D(ACRQUIT)!$D(ACROUT)
EFTEXIT K ACRQUIT,ACROUT
 K ^TMP("ACREFTR",$J)
 Q
EFT1 ;
 N ACRBEGIN,ACREND,ACRDATE
 K ^TMP("ACREFTR",$J)
 W @IOF
 W !?10,"Select beginning and ending dates for the"
 W !?10,"ELECTRONIC FUNDS TRANSFER TO TREASURY PROFILE"
 W !
 D ^ACRFDATE
 I '$G(ACRBEGIN)!'$G(ACREND) S ACRQUIT="" Q
 S (ACRRTN,ZTRTN)="EFT2^ACRFPAYE"
 S ZTDESC="ELECTRONIC FUNDS TRANSFER TO TREASURY PROFILE"
 D ^ACRFZIS
 Q
EFT2 ;EP;TO PRINT ELECTRONIC FUNDS TRANSFER PROFILE
 D EFTHEAD
 N ACROBJ,ACR0,ACRBAT,ACRVT,ACRREF,ACRREF2,ACRF,ACRF,ACRV,ACRB
 N ACRFYDA,ACRBATDA,ACRSEQDA,ACRX,ACRXM,ACRP
 S ACRDATE=ACRBEGIN-1
 S ACRF="ACREFTR"
 F  S ACRDATE=$O(^AFSLAFP("EXP",ACRDATE)) Q:'ACRDATE!(ACRDATE>ACREND)  D
 .S ACRFYDA=0
 .F  S ACRFYDA=$O(^AFSLAFP("EXP",ACRDATE,ACRFYDA)) Q:'ACRFYDA  D
 ..S ACRBATDA=0
 ..F  S ACRBATDA=$O(^AFSLAFP("EXP",ACRDATE,ACRFYDA,ACRBATDA)) Q:'ACRBATDA  D
 ...S ACR0=$G(^AFSLAFP(ACRFYDA,1,ACRBATDA,0))
 ...Q:ACR0=""
 ...S ACRBAT=$$BATCH^ACRFPAYE(ACRFYDA,ACRBATDA)  ; Batch Type
 ...Q:ACRBAT=""
 ...Q:ACRBAT="G"
 ...S ACRVT=$P(ACR0,U,4)              ; Vendor or Travel
 ...Q:ACRVT=""
 ...I ACRVT="T" D
 ....S ACRBAT=$S(ACRBAT="A":"D",ACRBAT="B":"E",ACRBAT="C":"F",ACRBAT="N":"O",1:ACRBAT)
 ...S ACRSEQDA=0
 ...F  S ACRSEQDA=$O(^AFSLAFP(ACRFYDA,1,ACRBATDA,1,ACRSEQDA)) Q:'ACRSEQDA  D
 ....S ACRVT=$P(ACR0,U,4)              ; Vendor or Travel
 ....S ACRX=$G(^AFSLAFP(ACRFYDA,1,ACRBATDA,1,ACRSEQDA,0))
 ....S ACROBJ=$P(ACRX,U,8)
 ....Q:ACROBJ=""
 ....S ACROBJ=$P(^AUTTOBJC(ACROBJ,0),U)
 ....Q:ACROBJ=""
 ....S ACRREF=$P(ACRX,U,5)
 ....S ACRREF2=$P(ACRX,U,6)
 ....S ACRP=$$NET^ACRFSSU(ACRFYDA,ACRBATDA,ACRSEQDA) ;NET TO TREASURY
 ....S ACRVT=$$BAT(ACRVT,ACRREF,ACRREF2,ACROBJ)
 ....I ACRREF=326 D  Q                    ;COUNT CONTRACTS
 .....I $E(ACROBJ,1,3)=418!(ACROBJ>2581&(ACROBJ<2586)) D  Q
 ......D CNT(ACRF,"I",ACRBAT,ACRP) Q  ; Tribal
 .....D CNT(ACRF,"X",ACRBAT,ACRP)
 ....D CNT(ACRF,ACRVT,ACRBAT,ACRP)
 ;
 N A,B,C,D,E,F,G,STR,STR1,STR2,CNT
 F A="V","X","VTOT","T","AIR","TTOT","I","ITOT","TOT" D
 .I A["TOT" D  Q
 ..S STR=$G(^TMP(ACRF,$J,A,"TOT"))
 ..S (B1,B2)=" "
 ..S STR1=$G(^TMP(ACRF,$J,A,"ACH"))
 ..S STR2=$G(^TMP(ACRF,$J,A,"CHK"))
 ..D WRITE(A,B1,STR1,B2,STR2,STR,.CNT)
 .S G="" K CNT F  S G=$O(^TMP(ACRF,$J,A,G)) Q:G=""  D
 ..S STR=$G(^TMP(ACRF,$J,A,G))
 ..S B1=$E(G,1),B2=$E(G,2)
 ..S STR1=$G(^TMP(ACRF,$J,A,G,B1))
 ..S STR2=$G(^TMP(ACRF,$J,A,G,B2))
 ..D WRITE(A,B1,STR1,B2,STR2,STR,.CNT)
 W $$DASH^ACRFMENU
 D PAUSE^ACRFWARN
 Q
WRITE(A,B,C,D,E,F,CNT) ;LOCAL ENTRY TO WRITE PROFILE
 N T
 D TITLE(A,.CNT,.T)
 N C1,C2,E1,E2
 S C1=$P(C,U)
 S C2=$P(C,U,2)
 S E1=$P(E,U)
 S E2=$P(E,U,2)
 S F1=$P(F,U)
 S F2=$P(F,U,2)
 I A["TOT" D  W !
 .I A'="TOT" D
 ..W !,?13,"|-----",?19,"|---------------",?35,"|-----"
 ..W ?41,"|---------------",?57,"|-----",?63,"|----------------"
 .W !?13 F J=1:1:67 W "_"
 W !,T,?13,"|"_B,$J(C1,4),?19,"|",$J($FN(C2,"P,",2),15)
 W ?35,"|"_D,$J(E1,4),?41,"|",$J($FN(E2,"P,",2),15)
 W ?57,"|",$J(F1,5),"|"
 W ?63,$J($FN(F2,"P,",2),16)
 Q
TITLE(A,CNT,T)       ;LOCAL ENTRY
 ; RETURNS TITLE
 S T=""
 I A="V",'$G(CNT) S T="VENDOR" W ! S CNT=1
 I A="T",'$G(CNT) S T="TRAVEL" W !,$$DASH^ACRFMENU,! S CNT=1
 I A="I",'$G(CNT) S T="TRIBAL" W !,$$DASH^ACRFMENU,! S CNT=1
 I A="X",'$G(CNT) S T=" CONTRACT" D WRT(.CNT)
 I A="AIR",'$G(CNT) S T=" AIRLINE" D WRT(.CNT)
 I A="VTOT" S T=" VENDOR TOTAL"
 I A="TTOT" S T=" TRAVEL TOTAL"
 I A="ITOT" S T=" TRIBAL TOTAL"
 I A="TOT" S T="GRAND TOTAL",CNT=1
 Q
WRT(CNT) ;LOCAL ENTRY
 S CNT=1
 W !,?13,"|-----",?19,"|---------------",?35,"|-----"
 W ?41,"|---------------",?57,"|-----",?63,"|----------------"
 W !
 Q
EFTHEAD ;
 W @IOF
 W !?10,"INDIAN HEALTH SERVICE"
 W !?10,$P($G(^AUTTAREA(+$G(^ACRSYS(1,0)),0)),U)," AREA OFFICE"
 W !!?10,"ELECTRONIC FUNDS TRANSFER TO TREASURY PROFILE"
 W !?10,"REPORT DATE: "
 S Y=DT
 X ^DD("DD")
 W Y
 W !?10,"REPORT FROM: "
 S Y=ACRBEGIN
 X ^DD("DD")
 W Y
 W !?10,"REPORT TO..: "
 S Y=ACREND
 X ^DD("DD")
 W Y
 W $$DASH^ACRFMENU
 W !!,?13,"|    EFT",?35,"|    NON-EFT",?57,"|TOTAL",?63,"|  TOTAL"
 W !,"PAYMENT TYPE",?13,"| NO. ",?19,"|  DOLLARS",?35,"| NO. "
 W ?41,"|  DOLLARS",?57,"| NO. ",?63,"|  DOLLARS"
 W $$DASH^ACRFMENU
 Q
CNT(F,V,B,P) ;LOCAL ENTRY - COUNT NON-CHECKS
 ;
 N T,G
 S T="UNKNOWN"_ACRX
 I "ABDE"[B S T="ACH"
 I "CFNO"[B S T="CHK"
 S G=$$GRP(B)
 I G="UNKNOWN" S ^TMP(F,$J,"ERROR",X)="" Q
 ;
 S $P(^TMP(F,$J,V,G,B),U)=$P($G(^TMP(F,$J,V,G,B)),U)+1
 S $P(^TMP(F,$J,V,G,B),U,2)=$P($G(^TMP(F,$J,V,G,B)),U,2)+P
 S $P(^TMP(F,$J,V,G),U)=$P($G(^TMP(F,$J,V,G)),U)+1
 S $P(^TMP(F,$J,V,G),U,2)=$P($G(^TMP(F,$J,V,G)),U,2)+P
 ;
 ;SUB AND GRAND TOTALS
 S $P(^TMP(F,$J,"TOT",T),U)=$P($G(^TMP(F,$J,"TOT",T)),U)+1
 S $P(^TMP(F,$J,"TOT",T),U,2)=$P($G(^TMP(F,$J,"TOT",T)),U,2)+P
 S $P(^TMP(F,$J,"TOT","TOT"),U)=$P($G(^TMP(F,$J,"TOT","TOT")),U)+1
 S $P(^TMP(F,$J,"TOT","TOT"),U,2)=$P($G(^TMP(F,$J,"TOT","TOT")),U,2)+P
 I V["X"!(V["AIR") D
 .S:V["X" V="V"
 .S:V["AIR" V="T"
 S $P(^TMP(F,$J,V_"TOT",T),U)=$P($G(^TMP(F,$J,V_"TOT",T)),U)+1
 S $P(^TMP(F,$J,V_"TOT",T),U,2)=$P($G(^TMP(F,$J,V_"TOT",T)),U,2)+P
 S $P(^TMP(F,$J,V_"TOT","TOT"),U)=$P($G(^TMP(F,$J,V_"TOT","TOT")),U)+1
 S $P(^TMP(F,$J,V_"TOT","TOT"),U,2)=$P($G(^TMP(F,$J,V_"TOT","TOT")),U,2)+P
 Q
BAT(VT,ACRR,ACRR2,ACRO)      ;LOCAL EXTRINSIC FUNCTION
 ; ENTERS WITH REFERENCE CODES
 ;CHANGES VENDOR TO TRAVEL IF AIRLINE PAYMENT
 ;
 I VT="V",ACRR=130,$E(ACRO,1,3)=221!($E(ACRO,1,3)=121) Q "T"
 I ACRR=602!(ACRR2=602) Q "T"  ; TRAVEL ADVANCE
 I ACRO="219M"!(ACRR=618) Q "AIR"
 I VT="V",ACRR=130 Q "AIR"
 I ACRR'=618,ACRR2'=618 Q VT  ; NOT AIRLINE
 Q "AIR"  ; AIRLINE, CHANGE TO TRAVEL
 ;
GRP(B)          ;LOCAL FORENSIC FUNCTION
 ;ENTERS WITH BATCH PREFIX
 ;RETURN GROUP DESIGNATION
 I "AC"[B Q "AC"
 I "BN"[B Q "BN"
 I "DF"[B Q "DF"
 I "EO"[B Q "EO"
 Q B
 ;
BATCH(ACRFYDA,ACRBATDA)      ;LOCAL ENTRY; EXTRINSIC FUNCTION
 ;              Enters with EIN for 1166 Approvals for Payment file
 ;              Returns Batch type
 N ACRTMP,ACRBAT
 S ACRTMP=$G(^AFSLAFP(ACRFYDA,1,ACRBATDA,2))
 S ACRBAT=$P(ACRTMP,U,8)
 Q ACRBAT