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

ASUL19EN.m

Go to the documentation of this file.
ASUL19EN ; IHS/ITSC/LMH - ADD/EDIT USER TABLE #20 ; 
 ;;4.2T2;Supply Accounting Mgmt. System;;JUN 30, 2000
 ;;Y2K/OK AEF/2970717
 ;
ADD ;EP -- MAIN ENTRY POINT TO ADD NEW USER
 ;
 N ASUL,ASUL65,ASUOUT
 D INIT Q:$G(ASUOUT)
 F  D A1 Q:$G(ASUOUT)  W !
 W !
 Q:$G(ASUOUT)
 G ADD
 Q
 ;
A1 ;EP -- PROMPT FOR USER - ADD NEW ONE IF NOT ONE
 ;
 ;      User IEN must be calculated from 2 digit AREA_4 digit USER CODE
 ;
 N ASUAREA,ASUCODE,ASUIEN,ASUNAME,ASUPROG,ASUUSR,DA,DD,DIC,DIE,DINUM,DIR,DIRUT,DO,DR,DTOUT,DUOUT,DZ,X,Y,Z
 Q:'$G(ASUL(1,"AR","AP"))
 S ASUAREA=ASUL(1,"AR","AP")
 S DIR(0)="FAO^3:40",DIR("A")="Select User: "
 S DIR("?")="^D USRHLP^ASUL19EN"
 D ^DIR K DIR
 I $D(DTOUT)!($D(DUOUT))!($D(DIRUT)) S ASUOUT=1 Q
 S DIC="^ASUL(19,",DIC(0)="EMN"
 D ^DIC
 I $D(DTOUT)!($D(DUOUT)) G A1
 I Y>0 D E2(+Y) Q
 S ASUNAME=X
 S DIR(0)="YAO",DIR("A")="Are you adding '"_ASUNAME_"' as a new USER? "
 S DIR("B")="NO"
 D ^DIR K DIR
 I 'Y G A1
 I ASUNAME=+ASUNAME S ASUUSR=ASUNAME,ASUNAME=""
 I $G(ASUUSR)>0,$G(ASUUSR)'?6N W *7,"  ??" G A1
 D USRNAME I $G(ASUNAME)']"" G A1
 D USRPROG I $G(ASUPROG)']"" G A1
 D USRCODE I $G(ASUCODE)']"" G A1
 S Y=$E(ASUCODE,3) D TR^ASULALGO(.Y) I Y<0 G A1
 S ASUIEN=ASUAREA_$E(ASUCODE,1,2)_Y
 I '$G(ASUUSR) S ASUUSR=ASUIEN
 I ASUIEN'=ASUUSR W *7,!,"User codes do not match, try again." G A1
 I $D(^ASUL(19,ASUUSR)) W !,"User "_ASUIEN_" already exists in the ASUTBL USER file.",!,"Please check user codes and try again." G A1
 S ASUPROG=+ASUPROG
 K DD,DO
 S DIC="^ASUL(19,",(DA,DINUM)=ASUUSR,X=ASUNAME
 S DIC("DR")=".02////^S X=ASUAREA;.03////^S X=ASUPROG;1////^S X=ASUCODE"
 D FILE^DICN
 I Y'>0 W *7,"  ??" G A1
 W !,"User "_ASUUSR_"  "_ASUNAME_"   ADDED"
 D USR^ASULDIRR(ASUUSR)
 Q
USRNAME ;----- PROMPT FOR USER NAME
 ;
 N DIR,X,Y
 S DIR(0)="FAO",DIR("A")="NAME: "
 I $G(ASUNAME)]"" S DIR("B")=ASUNAME
 D ^DIR
 I Y["^" S ASUNAME="" Q
 S ASUNAME=Y
 Q
USRPROG ;----- PROMPT FOR USER PROGRAM CODE
 ;
 N DIR,X,Y
 S DIR(0)="PA^ASUL(22,:AEMQ"
 S DIR("A")="PROGRAM: "
 D ^DIR
 I Y'>0 S ASUPROG=""
 S ASUPROG=Y
 Q
USRCODE ;----- PROMPT FOR USER CODE
 ;
 N DIR,X,Y
 S DIR(0)="FA^3:3^K:$E(X,1,2)'=$P($G(ASUPROG),U,2)!($E(X,3)'?1UN) X"
 S DIR("A")="CODE: "
 S DIR("?")="Enter 3 digit USER CODE, i.e., PROGRAM CODE + 1 digit  EX: 800, 801, 80A"
 D ^DIR
 I Y["^" S ASUCODE="" Q
 S ASUCODE=Y
 Q
USRHLP ;----- HELP FOR 'SELECT USER' PROMPT
 ;
 N D,DIC,DZ,X,Y
 S DIC="^ASUL(19,",DIC("S")="I $E(+Y,1,2)=$G(ASUL(1,""AR"",""AP""))"
 S DIC(0)="EMN",D="B",DZ="??"
 D DQ^DICQ
 Q
EDIT ;EP -- EDIT EXISTING USER
 ;
 N ASUL,ASUL65,ASUOUT
 D INIT Q:$G(ASUOUT)
 F  D E1 Q:$G(ASUOUT)
 Q:$G(ASUOUT)
 W !
 G EDIT
 Q
E1 ;----- LOOK UP ENTRY
 ;
 N DA,DIC,X,Y
 S DIC="^ASUL(19,",DIC(0)="AEMQ",DIC("A")="Select User: "
 D ^DIC
 I Y'>0 S ASUOUT=1 Q
 S DA=+Y
 D E2(DA)
 W !
 G E1
 Q
E2(DA) ;----- EDIT ENTRY
 ;
 N DIE,DR,X,Y
 K ASUL(19)
 D USR^ASULDIRR(DA)
 S DIE="^ASUL(19,",DR=.01
 D ^DIE
 Q
INIT ;----- SET UP REQUIRED VARIABLES
 ;
 I '$D(DUZ(2)) W !?10,"DIVISION NOT SET, PLEASE SEE SITE MANAGER" S ASUOUT=1 Q
 I '$D(ASUL(1,"AR","AP")) D SETAREA^ASULARST
 I ASUL(1,"AR","AP")=65 S ASUL65=1
 D AREA
 Q
AREA ;----- PROMPT USER FOR AREA
 ;
 Q:'$G(ASUL65)
 D FINDAREA^ASULARST
 I Y'>0 S ASUOUT=1
 Q