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

ACRFT25H.m

Go to the documentation of this file.
ACRFT25H ;IHS/OIRM/DSD/AEF - FIND TRAVEL VOUCHERS > $2500 [ 09/26/2005   9:44 AM ]
 ;;2.1;ADMIN RESOURCE MGT SYSTEM;**19**;NOV 05, 2001
 ;
 ;
DESC ;----- ROUTINE DESCRIPTION
 ;;
 ;;This routine will loop through the travel vouchers and find all
 ;;those that total more than $2500.00 for the date range specified.
 ;;The resulting report shows the document number, traveler name,
 ;;departure date, return date, CAN number, department account, and
 ;;amount claimed.
 ;;
 ;;$$END
 Q
 ;
EN ;----- MAIN ENTRY POINT
 ;
 N ACRDATES,ACROUT,ZTDESC,ZTRTN,ZTSAVE,X,Y
 ;
 D ^XBKVAR
 D HOME^%ZIS
 ;
 D TXT
 ;
 D DATES(.ACRDATES,.ACROUT)
 Q:ACROUT
 ;
 S ZTRTN="DQ^ACRFT25H"
 S ZTSAVE("ACRDATES")=""
 S ZTDESC="TRAVEL ORDERS EXCEEDING $2500"
 D QUE^ACRFUTL(ZTRTN,.ZTSAVE,.ZTDESC)
 ;
 Q
DATES(ACRDATES,ACROUT)       ;
 ;----- ASK BEGINNING TRAVEL DATE RANGE
 ;
DLOOP ;----- DATE LOOP   
 ;
 N ACRBEG,ACREND,DIR,DIRUT,DTOUT,DUOUT,X,Y
 W !
 S ACROUT=1
 S DIR(0)="DO^::E"
 S DIR("A")="Begin with DATE OF DEPARTURE"
 S DIR("?")="The date to be included in the date range"
 D ^DIR
 Q:$D(DTOUT)!($D(DUOUT))!($D(DIRUT))
 Q:Y=""
 S ACRBEG=Y
 S DIR("A")="End with DATE OF DEPARTURE"
 D ^DIR
 Q:$D(DTOUT)!($D(DTOUT))!($D(DIRUT))
 Q:Y=""
 S ACREND=Y_".999999"
 I ACREND<ACRBEG D  G DLOOP
 . W *7,!?5,"ENDING DATE cannot be less than BEGINNING DATE"
 S ACRDATES=ACRBEG_U_ACREND
 S ACROUT=0
 Q
DQ ;EP -- QUEUED REPORT STARTS HERE
 ;
 D GET(ACRDATES)
 D PRINT(ACRDATES)
 K ^TMP("ACR",$J,"TVL2500")
 D ^%ZISC
 Q
GET(ACRDATES)      ;
 ;----- LOOP THROUGH "REF" CROSSREFERENCE
 ;      GATHER DATA AND PUT INTO ^TMP("ACR",$J,"TVL2500" GLOBAL
 ;
 N ACRAMT,ACRBEG,ACRCAN,ACRDEPT,ACRDOC0,ACRDOCDA,ACRDOCNO,ACRDTBEG,ACRDTEND,ACREND,ACRFY,ACRREF,ACRTO,ACRTRAV
 K ^TMP("ACR",$J,"TVL2500")
 S ACRREF=$O(^AUTTDOCR("B",600,0))
 Q:'ACRREF
 S ACRBEG=$P(ACRDATES,U)
 S ACREND=$P(ACRDATES,U,2)
 ;
 S ACRDOCDA=0
 F  S ACRDOCDA=$O(^ACRDOC("REF",ACRREF,ACRDOCDA)) Q:'ACRDOCDA  D
 . Q:$P($G(^ACRDOC(ACRDOCDA,0)),U,14)["CANCEL"
 . S ACRDTBEG=$P($G(^ACRDOC(ACRDOCDA,"TO")),U,14)
 . Q:ACRDTBEG<ACRBEG
 . Q:ACRDTBEG>ACREND
 . S ACRDOC0=$G(^ACRDOC(ACRDOCDA,0))
 . S ACRDOCNO=$P(ACRDOC0,U)
 . S ACRTO=$G(^ACRDOC(ACRDOCDA,"TO"))
 . S ACRTRAV=$P(ACRTO,U,9)
 . ;I ACRTRAV S ACRTRAV=$P($G(^VA(200,ACRTRAV,0)),U)  ;ACR*2.1*19.02 IM16848
 . I ACRTRAV S ACRTRAV=$$NAME2^ACRFUTL1(ACRTRAV)  ;ACR*2.1*19.02 IM16848
 . S ACRDTBEG=$P(ACRTO,U,14)
 . I ACRDTBEG]"" S ACRDTBEG=$E(ACRDTBEG,4,5)_"/"_$E(ACRDTBEG,6,7)_"/"_$E(ACRDTBEG,2,3)
 . S ACRDTEND=$P(ACRTO,U,15)
 . I ACRDTEND]"" S ACRDTEND=$E(ACRDTEND,4,5)_"/"_$E(ACRDTEND,6,7)_"/"_$E(ACRDTEND,2,3)
 . S ACRAMT=$$TOTAMT^ACRFSSU(ACRDOCDA)
 . S ACRCAN=$P($G(^ACRDOC(ACRDOCDA,"REQ")),U,10)
 . I ACRCAN S ACRCAN=$P($G(^AUTTCAN(ACRCAN,0)),U)
 . S ACRDEPT=$P(ACRDOC0,U,6)
 . S ACRFY=""
 . I ACRDEPT S ACRFY=$P($G(^ACRLOCB(ACRDEPT,"DT")),U)
 . S ^TMP("ACR",$J,"TVL2500",$E(ACRDOCNO,1,10),1_$E(ACRDOCNO,11,13))=ACRDOCNO_U_ACRTRAV_U_ACRDTBEG_U_ACRDTEND_U_ACRCAN_U_ACRDEPT_U_ACRFY_U_ACRAMT
 . S ^TMP("ACR",$J,"TVL2500",$E(ACRDOCNO,1,10),0)=$G(^TMP("ACR",$J,"TVL2500",$E(ACRDOCNO,1,10),0))+ACRAMT
 Q
 ;
PRINT(ACRDATES)    ;
 ;----- LOOP THROUGH ^TMP("ACR",$J,"TVL2500" GLOBAL AND PRINT REPORT
 ;
 N ACR,ACRDATA,ACRDOCNO,ACROUT,ACRPAGE,ACRZ
 D HDR(ACRDATES,.ACROUT,.ACRPAGE)
 S ACRZ=1
 S ACRDOCNO=""
 F  S ACRDOCNO=$O(^TMP("ACR",$J,"TVL2500",ACRDOCNO)) Q:ACRDOCNO']""  D  Q:$G(ACROUT)
 . Q:^TMP("ACR",$J,"TVL2500",ACRDOCNO,0)<2500
 . S ACRZ=0
 . S ACR=0
 . F  S ACR=$O(^TMP("ACR",$J,"TVL2500",ACRDOCNO,ACR)) Q:'ACR  D  Q:$G(ACROUT)
 . . S ACRDATA=^TMP("ACR",$J,"TVL2500",ACRDOCNO,ACR)
 . . I $Y>(IOSL-5) D HDR(ACRDATES,.ACROUT,.ACRPAGE)
 . . Q:$G(ACROUT)
 . . W !
 . . W $P(ACRDATA,U)
 . . W ?15,$E($P(ACRDATA,U,2),1,15)
 . . W ?31,$P(ACRDATA,U,3)
 . . W ?40,$P(ACRDATA,U,4)
 . . W ?49,$P(ACRDATA,U,5)
 . . W ?57,$J($P(ACRDATA,U,6),6)
 . . W ?64,$P(ACRDATA,U,7)
 . . W ?68,$J($P(ACRDATA,U,8),12,2)
 . W !?72,"--------"
 . W !?61,"TOTAL"
 . W ?68,$J(^TMP("ACR",$J,"TVL2500",ACRDOCNO,0),12,2)
 . W !
 I ACRZ D
 . W !?5,"NO DATA FOUND"
 Q
HDR(ACRDATES,ACROUT,ACRPAGE) ;
 ;----- PRINT REPORT HEADER
 ;
 N DIR,X
 S ACROUT=0
 I $E($G(IOST))="C",$G(ACRPAGE)  D  Q:$G(ACROUT)
 . S DIR(0)="E"
 . D ^DIR
 . I 'Y S ACROUT=1
 S ACRPAGE=$G(ACRPAGE)+1
 ;
 W @IOF
 W !,"TRAVEL VOUCHERS EXCEEDING $2500, "
 S X=$P(ACRDATES,U)
 W $E(X,4,5)_"/"_$E(X,6,7)_"/"_$E(X,2,3)
 W "-"
 S X=$P(ACRDATES,U,2)
 W $E(X,4,5)_"/"_$E(X,6,7)_"/"_$E(X,2,3)
 W ?52,$$NOW^ACRFUTL
 W "   PAGE ",$G(ACRPAGE)
 W !,"TRAVEL"
 W ?31,"DEPART"
 W ?40,"RETURN"
 W ?49,"CAN"
 W ?59,"DEPT"
 W ?64,"FY"
 W !,"VOUCHER NO."
 W ?15,"TRAVELER"
 W ?31,"DATE"
 W ?40,"DATE"
 W ?49,"NO."
 W ?59,"ACCT"
 W ?64,"FUNDS"
 W ?74,"AMOUNT"
 W !
 F I=1:1:80 W "-"
 Q
TXT ;----- WRITE ROUTINE DESCRIPTION
 ;
 N I
 F I=1:1 S X=$P($T(DESC+I),";",3) Q:X["$$END"  W !,X
 Q