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

ASUUTIL1.m

Go to the documentation of this file.
  1. ASUUTIL1 ; IHS/ITSC/LMH - VARIOUS UTILITY SUBROUTINES USED BY SAMS REPORTS ;
  1. ;;4.2T2;Supply Accounting Mgmt. System;;JUN 30, 2000
  1. ;;Y2K/OK AEF/2970311
  1. ;This routine contains various utilities used by the SAMS reports
  1. ;
  1. ;
  1. EXTDATE(Y) ;EP
  1. ;----- CONVERTS INTERNAL FM DATE TO EXTERNAL
  1. ;
  1. X ^DD("DD")
  1. Q Y
  1. ;
  1. FY(X) ;EP -- RETURNS FY AND BEGINNING AND ENDING DATES OF FISCAL YEAR
  1. ;
  1. ; Returns Fileman beginning and ending dates for fiscal year in
  1. ; FY^FY1STDAY^FYLASTDAY format
  1. ;
  1. ; X = date passed by calling routine
  1. ; Y = first day of fiscal year
  1. ; Z = last day of fiscal year
  1. ;
  1. N Y,Z
  1. S (Y,Z)=$E(X,1,3)
  1. S:+$E(X,4,5)<10 Y=Y-1
  1. S Y=Y_1001
  1. S:+$E(X,4,5)>9 Z=Z+1
  1. S Z=Z_"0930"
  1. Q $E(Z,1,3)_"0000"_"^"_Y_"^"_Z
  1. ;
  1. FPP(X) ;EP -- SETS UP FY, PREV FY, PREV PREV FY DATE ARRAY USED BY DATABOOK
  1. ; REPORTS
  1. ;
  1. ; Returns current fiscal year beginning and ending dates,
  1. ; previous fiscal year beginning and ending dates,
  1. ; previous previous fiscal year beginning and ending dates
  1. ; in ASU("DT") array
  1. ;
  1. ; X = date passed by calling routine
  1. ;
  1. S ASU("DT","FY")=+$$FY^ASUUTIL1(X)
  1. S ASU("DT","FY1")=ASU("DT","FY")-10000
  1. S ASU("DT","FY2")=ASU("DT","FY")-20000
  1. S ASU("DT","BEG")=$P($$FY^ASUUTIL1(ASU("DT","FY")),U,2)
  1. S ASU("DT","END")=$P($$FY^ASUUTIL1(ASU("DT","FY")),U,3)
  1. S ASU("DT","BEG1")=$P($$FY^ASUUTIL1(ASU("DT","FY1")),U,2)
  1. S ASU("DT","END1")=$P($$FY^ASUUTIL1(ASU("DT","FY1")),U,3)
  1. S ASU("DT","BEG2")=$P($$FY^ASUUTIL1(ASU("DT","FY2")),U,2)
  1. S ASU("DT","END2")=$P($$FY^ASUUTIL1(ASU("DT","FY2")),U,3)
  1. Q
  1. LDOM(X) ;EP -- LAST DAY OF MONTH
  1. ;
  1. ; Returns FileMan date of last day of a particular month
  1. ;
  1. ; X = date passed by calling routine
  1. ;
  1. N Y
  1. S X=$E(X,1,5)_$P("31^28^31^30^31^30^31^31^30^31^30^31","^",+$E(X,4,5))
  1. I +$E(X,4,5)=2 S Y=X X ^DD("DD") S X=X+$$LEAP^ASUUTIL1($P(Y,",",2))
  1. Q X
  1. ;
  1. LEAP(X) ;EP -- EXTRINSIC FUNCTION - LEAP YEAR CALCULATION
  1. ;
  1. ; X = 4 DIGIT YEAR
  1. ;
  1. ; Returns: 0 if year is not a leap year
  1. ; 1 if year is a leap year
  1. ;
  1. ; Every year that is exactly divisible by 4 is a leap year,
  1. ; except for years that are exactly divisible by 100; these
  1. ; centurial years are leap years only if they are exactly
  1. ; divisible by 400. As a result the year 2000 is a leap year,
  1. ; whereas 1900 and 2100 are not leap years.
  1. ;
  1. I '(X#100),'(X#4),'(X#400) Q 1
  1. I '(X#4),'(X#100) Q 0
  1. I '(X#4) Q 1
  1. Q 0
  1. ;
  1. SOBJ(Y) ;EP; - OUTPUT TRANSFORM FOR SUB OBJECT
  1. S:Y?4N Y=$E(Y,1,2)_"."_$E(Y,3,4) Q