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

ASUAUTIL.m

Go to the documentation of this file.
  1. ASUAUTIL ;DSD/DFM -UTILITY SUB-ROUTINES; [ 04/15/98 2:55 PM ]
  1. ;;3.0;SAMS;**1**;AUG 20, 1993
  1. ARPRINT ;EP; Write out Area Name and save Area Lookup table EIN
  1. D ARL W " ",ASUK("AREA NAME") Q
  1. AREA ;EP - Lookup Area Name. X=AREA CODE
  1. S ASUF("LOOKA")=$G(ASUF("LOOKA"))
  1. S:ASUF("LOOKA")="" ASUF("LOOKA")=1
  1. I $D(ASUK("AREA","ACCPT")) G ARL
  1. I ASUF("LOOKA"),'$D(X) D SETAREA^ASUAUARE S ASUF("LOOKA")=0 G ARX
  1. S ASUK("AREA","ACCPT")=X
  1. ARL ;
  1. S ASUK("TR1","AREA")=$O(^ASUTB01("B",ASUK("AREA","ACCPT"),0))
  1. S ASUK("AREA NAME")=$S(ASUK("TR1","AREA")]"":$P(^ASUTB01(ASUK("TR1","AREA"),0),U,2),1:"")
  1. S ASUF("LOOKA")=$G(ASUF("LOOKA"))
  1. D:ASUF("LOOKA") LOOKUP^ASUAUARE
  1. ARX ;
  1. Q
  1. STPRINT ;
  1. D STL W " ",ASUK("STATION","NAME") Q
  1. STAT ;EP - Lookup Station Name. X=AREA CODE, X1=STATION CODE.
  1. I $D(ASUK("AREA","ACCPT")) G STK
  1. I '$D(X) D G STK
  1. .S X=$G(ASUK("AREA","ACCPT")) D:X="" SETAREA^ASUAUARE
  1. S ASUK("AREA","ACCPT")=X D ARL
  1. STK ;
  1. I $D(ASUK("STATION","CODE")) G STL
  1. I '$D(X1) S (ASUK("STATION","CODE"),ASUK("STATION","NAME"))="" G STX
  1. S ASUK("STATION","CODE")=X1
  1. STL ;
  1. S ASUK("TR1","STATION")=$O(^ASUTB01(ASUK("TR1","AREA"),1,"B",ASUK("STATION","CODE"),0))
  1. S ASUK("STATION","NAME")=$S(ASUK("TR1","STATION")]"":$P(^ASUTB01(ASUK("TR1","AREA"),1,ASUK("TR1","STATION"),0),U,2),1:"")
  1. STX ;
  1. Q
  1. GL ;EP - Lookup GL Account Name. X=GL CODE
  1. S ASUK("ACCOUNT NAME")=$S($O(^ASUTBLA("B",X,0)):$P(^ASUTBLA($O(^ASUTBLA("B",X,0)),0),U,3),1:"")
  1. Q
  1. ITEM ;EP - Lookup item Description 1 & 2. X=INDEX NUMBER.
  1. S (ASUIXM("DESCRIPTION1"),ASUIXM("DESCRIPTION2"))=""
  1. Q:'X
  1. Q:$L($O(^ASUINDX("B",X,0)))=0
  1. S X=$O(^ASUINDX("B",X,0))
  1. S ASUIXM("DESCRIPTION1")=$P(^ASUINDX(X,0),U,2)
  1. S ASUIXM("DESCRIPTION2")=$P(^ASUINDX(X,0),U,3)
  1. Q
  1. LOGV ;EP; SAVE OR PRINT INVENTORY LOG DATA
  1. S:'$D(ASUK("PRINT QUEUED")) ASUK("PRINT QUEUED")=0
  1. I ASUK("PRINT QUEUED") D
  1. .S ASUK("LOG VLIN")=$G(ASUK("LOG VLIN"))+1
  1. .S ^ASUX(0,"V",ASUK("LOG VLIN"))=ASUTRX
  1. E D
  1. .D:'$D(IO(0)) HOME^%ZIS U IO(0)
  1. .X ASUTRX
  1. .S DIR(0)="E" D ^DIR K DIR
  1. Q
  1. LOG ;EP; SAVE OR PRINT LOG DATA
  1. S ASUK("LOG LINE")=$G(ASUK("LOG LINE"))+1
  1. S ^ASUX(0,ASUK("LOG LINE"))=ASUTRX
  1. S:'$D(ASUK("PRINT QUEUED")) ASUK("PRINT QUEUED")=0
  1. I ASUK("PRINT QUEUED") Q
  1. D:'$D(IO(0)) HOME^%ZIS U IO(0)
  1. X ASUTRX
  1. Q
  1. PVLOG ;EP - QUEUED JOB LISTING
  1. I '$D(^ASUX(0,"V")) Q
  1. D CLS^ASUAULGO
  1. W !!,"The following are SAMS Inventory System messages from Queued Jobs:",!!
  1. F S ASUK("LOG VLIN")=$O(^ASUX(0,"V",$G(ASUK("LOG VLIN")))) Q:ASUK("LOG VLIN")']"" D
  1. .X ^ASUX(0,"V",ASUK("LOG VLIN"))
  1. .S DIR(0)="E" D ^DIR K DIR
  1. W !!,"ALL MESSAGES HAVE BEEN PRINTED",!!
  1. S DIR(0)="E" D ^DIR K DIR
  1. K ^ASUX(0,"V"),ASUK("LOG VLIN")
  1. Q
  1. COMDN ;EP - SET SIGN NEGATIVE, INSERT DECIMALS AND COMMAS
  1. I X'["." D
  1. .I $L(X)=1 D
  1. ..S X=".0"_X
  1. .E D
  1. ..I $L(X)=2 D
  1. ...S X="."_X
  1. ..E D
  1. ...D INDC
  1. S X=X*-1
  1. D COM
  1. Q
  1. COMD ;EP - INSERT DECIMAL & COMMAS
  1. I X'["." D
  1. .D INDC
  1. D COM
  1. Q
  1. COMN ;EP - SET SIGN NEGATIVE INSERT COMMAS
  1. S X=X*-1 D COM Q
  1. COM ;EP - INSERT COMMAS & RIGHT JUSTIFY (X2 = # DECIMAL, X3 = SIZE OF OUTPUT)
  1. S:'$D(X2) X2=2
  1. S:'$D(X3) X3=12
  1. S X=$FN(X,"T,",X2)
  1. S X=$J(X,X3)
  1. Q
  1. INDC ;EP INSERT DECIMAL POINT (IF NO X2, DEFAULT IS 2 PLACES)
  1. S:'$D(X2) X2=2
  1. I $L(X)<X2 S X4=$E("00000",1,X2-$L(X)),X="."_X4_X Q
  1. S X=$E(X,1,$L(X)-X2)_"."_$E(X,$L(X)-(X2-1),$L(X))
  1. Q
  1. RND2D ;EP TO ROUND TO TWO DECIMAL PLACES
  1. S Y=$FN(X,"T",2) Q
  1. RND0D ;EP TO ROUND TO WHOLE NUMBER
  1. S Y=$FN(X,"T",0)
  1. PHONE ;EP INPUT TRANSFORM FOR A PHONE NUMBER
  1. D
  1. .I $L(X)>8 D
  1. ..I X'?1"(".3N.1") ".3N.1"-".4N K X
  1. .E D
  1. ..I X'?3N.1"-".4N K X
  1. Q