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

ASUAUTL1.m

Go to the documentation of this file.
ASUAUTL1 ;DSD/DFM - DATE UTILITY FUNCTIONS;  [ 04/15/98  2:56 PM ]
 ;;3.0;SAMS;**1**;AUG 20, 1993
DAYTIM ;EP; - SET DATE AND TIME
 D DATE
 D TIME
 I $D(ASUTRNS) S ASUTRNS(ASUTRNS,"DATE ENTERED")=ASUK("DATE","FM")_"."_ASUK("TIME","F")_"."_$J
 Q
DATE ;EP; - SET ASUK("DATE")
 N X
 I ($D(ASUK("DATE"))#10)=0 D
 .D NOW^%DTC S Y=% X ^DD("DD")
 .D SETDT
 Q
SETDT ;
 S DT=X,DN=X
 S ASUK("DATE","FM")=X,ASUK("DATE")=$P(Y,"@",1),ASUK("DATE","TIME")=Y
 S ASUK("DATE","ENXYR")=$E(X,1,3)+1_"1231"
 S ASUK("DATE","YEAR")=$P(ASUK("DATE"),",",2),ASUK("DATE","YMD")=$E(X,2,7)
 S ASUK("DATE","YR")=$E(X,2,3),ASUK("DATE","MO")=$E(X,4,5),ASUK("DATE","DA")=$E(X,6,7)
 S ASUK("DATE","CFYEDT")=$E(X,1,3)
 S ASUK("DATE","MONTH")=$P(ASUK("DATE")," ")
 S ASUK("DATE","YRMO")=$E(X,2,5)
 S ASUK("DATE","FYMO")=ASUK("DATE","YRMO")
 S ASUK("DATE","CFY")=ASUK("DATE","YR")
 I +ASUK("DATE","MO")>9 D
 .S ASUK("DATE","CFYEDT")=ASUK("DATE","CFYEDT")+1
 .S ASUK("DATE","CFY")=$E(ASUK("DATE","CFYEDT"),2,3)
 .S ASUK("DATE","FYMO")=ASUK("DATE","CFY")_ASUK("DATE","MO")
 S ASUK("DATE","PFYBDT")=ASUK("DATE","CFYEDT")-1
 S ASUK("DATE","PFY")=$E(ASUK("DATE","PFYBDT"),2,3)
 S ASUK("DATE","CFYEDT")=ASUK("DATE","CFYEDT")_"1231"
 S ASUK("DATE","PFYBDT")=ASUK("DATE","PFYBDT")_"0131"
 Q:'$D(%H)
 S ASUK("DATE","H")=$P(%H,",",1),ASUK("TIME","H")=$P(%H,",",2)
 S ASUK("TIME")=$P(Y,"@",2)
 Q
ASKDATE ;EP - ASK FOR A DATE AND SET ASUK("DATE") ARRAY
 S %DT="AS" D ^%DT S X=Y
 X ^DD("DD")
 D SETDT,TIME
 Q
TIME ;EP; - SET ASUK("TIME")
 N X
 S %H=$H D YX^%DTC
 S ASUK("TIME")=$P(Y,"@",2),ASUK("TIME","H")=$P(%H,",",2)
 S ASUK("TIME","F")=$P(ASUK("TIME"),":")_$P(ASUK("TIME"),":",2)_$P(ASUK("TIME"),":",3)
 I ($D(ASUK("DATE"))#10) D
 .S ASUK("DATE","TIME")=ASUK("DATE")_"@"_ASUK("TIME")
 E  D
 .S ASUK("DATE","TIME")=Y
 Q
GETRUN ;EP ; - GET RUN FISCAL YEAR AND MONTH
 I ($D(ASUK("DATE"))#10)'=1 D DATE
 S DIR(0)="D" D ^DIR K DIR
 Q:$D(DTOUT)  Q:$D(DUOUT)
 S ASUK("DATE","RUNMY")=$E(Y,4,5)_$E(Y,2,3)
 W !
 S ASUK("DATE","RUNMO")=$E(ASUK("DATE","RUNMY"),1,2)
 S ASUK("DATE","RUNYR")=$E(ASUK("DATE","RUNMY"),3,4)
 I $E(ASUK("DATE","RUNMO"),1)=0&($E(ASUK("DATE","RUNMO"),2,2))>0 D
 .S ASUK("DATE","RUNMO")=$E(ASUK("DATE","RUNMO"),2,2)
 Q
SETQTR ;PEP ;SET QUARTER - INPUT DT AND ASUK("DATE","RUNMO") OUTPUT ASUK("DATE","RUNQTR") IN YEARQT FORMAT
 I ($D(ASUK("DATE"))#10)'=1 D DATE
 I '$D(ASUK("DATE","RUNMO")) S DIR("A")="Enter Month & Fiscal Year for Quarterly Reports (MMFY)" D GETRUN
 Q:$D(DTOUT)  Q:$D(DUOUT)
 S ASUVYR=$S(ASUK("DATE","RUNYR")<60:20,1:19)_ASUK("DATE","RUNYR")
 S ASUK("DATE","RUNQTR")=ASUVYR_$S(ASUK("DATE","RUNMO")<4:"02",ASUK("DATE","RUNMO")<7:"03",ASUK("DATE","RUNMO")>9:"01",1:"04")
 K ASUVYR
 Q