source: FOIAVistA/tag/r/ENGINEERING-EN/ENFACHG.m@ 719

Last change on this file since 719 was 628, checked in by George Lilly, 15 years ago

initial load of FOIAVistA 6/30/08 version

File size: 4.1 KB
Line 
1ENFACHG ;WASHINGTON IRMFO/KLD/DH/SAB; EQUIPMENT CHANGES; 1/3/97
2 ;;7.0;ENGINEERING;**29,39**;Aug 17, 1993
3 ;This routine should not be modified.
4 D SETUP
5 D:ENDO ASKEQ
6 D:ENDO ADDFC
7 D:ENDO ASKCS
8 D:ENDO ASKDATA
9 K ENAV I ENDO D I $G(ENUT) S ENDO=0 K ENUT
10 . S ENAV=$$AVP^ENFAAV("6915.4",ENFC("DA"))
11 . I 'ENAV W !,"Adjustment voucher was NOT created."
12 D:ENDO ASKOK
13 D:'ENDO DEL
14 D:ENDO UPDATE
15 D WRAPUP
16 Q
17SETUP ;
18 S ENDO=1
19 S (ENEQ("DA"),ENFA("DA"),ENFB("DA"),ENFC("DA"),ENFC("BETRMNT"))=""
20 S:'$D(ENFAP("SITE")) ENFAP("SITE")=+^ENG(6915.1,1,0)
21 Q
22ASKEQ ; ask for equipment item
23 D GETEQ^ENUTL I Y'>0 S ENDO=0 Q
24 L +^ENG(6914,+Y):5 I '$T D S ENDO=0 Q
25 . W !!,"Someone else is editing this Equipment Record."
26 . W !,"Please try again later."
27 S ENEQ("DA")=+Y
28 I '$D(^ENG(6915.2,"B",ENEQ("DA"))) D S ENDO=0 Q
29 . W !!,"There is no FA document on file for this asset."
30 . W !,"Nothing to change."
31 S X=$$CHKFA^ENFAUTL(ENEQ("DA")) I +X=0 D S ENDO=0 Q
32 . S Y=$P(X,U,3) D DD^%DT
33 . W !!,"An FD document for ENTRY #",ENEQ("DA")," was processed on ",Y,"."
34 S ENFA("DA")=$P(X,U,4)
35 F I=1,2,3,8,9 S ENEQ(I)=$G(^ENG(6914,ENEQ("DA"),I))
36 Q
37ADDFC ; create entry for FC code sheet
38 S DIC="^ENG(6915.4,",DIC(0)="L",DLAYGO=6915.4
39 S X=ENEQ("DA"),DIC("DR")="1///NOW;1.5////^S X=DUZ"
40 K DD,DO D FILE^DICN K DLAYGO
41 I Y'>0 D S ENDO=0 Q
42 . W !!,"Can't update the FC DOCUMENT LOG file. Better contact IRM."
43 S ENFC("DA")=+Y
44 L +^ENG(6915.4,+Y):0 I '$T D S ENDO=0 Q
45 . W !!,"The FC document that you just created is being edited by someone else."
46 . W !,"Please notify your ADPAC."
47 Q
48ASKCS ; ask for code sheet to change
49 W !
50 S DIE="^ENG(6915.4,",DA=ENFC("DA"),DR="[ENFA CHANGE EN]"
51 D ^DIE I $D(DTOUT) W !!,"Timeout" S ENDO=0 Q
52 S ENFC("BETRMNT")=$P($G(^ENG(6915.4,ENFC("DA"),3)),U,8)
53 I ENFC("BETRMNT")="" D S ENDO=0 Q
54 . W !!,"Document being changed (BETTERMENT NUMBER) must be specified."
55 Q
56ASKDATA ; ask data for FC Document
57 S DIE="^ENG(6915.4,",DIE("NO^")="BACKOUTOK",DA=ENFC("DA")
58 S DR="[ENFA CHANGE "_$S(ENFC("BETRMNT")="00":"FA]",1:"FB]")
59 W ! D ^DIE K DIE("NO^") I $D(DTOUT) W !!,"Timeout" S ENDO=0 Q
60 ;
61 S ENFAP(100)=$G(^ENG(6915.4,ENFC("DA"),100))
62 S X=$P(ENFAP(100),U,6) I X]"" S X1=$G(^ENG(6915.4,ENFC("DA"),3)),$P(X1,U,12)=$E(X,1,3)+1700,$P(X1,U,13)=$E(X,4,5),$P(X1,U,14)=$E(X,6,7),^(3)=X1
63 S X=$P(ENFAP(100),U,7) I X]"" S X1=$G(^ENG(6915.4,ENFC("DA"),4)),$P(X1,U,14)=$E(X,1,3)+1700,$P(X1,U,15)=$E(X,4,5),$P(X1,U,16)=$E(X,6,7),^(4)=X1
64 I $P(ENFAP(100),U)]"" S ENFAP("CSN")=$$GET1^DIQ(6915.4,ENFC("DA"),100),$P(^ENG(6915.4,ENFC("DA"),3),U,9)=$$GROUP^ENFAVAL(ENFAP("CSN")),$P(^ENG(6915.4,ENFC("DA"),3),U,11)=ENFAP("CSN")
65 I $P(ENFAP(100),U,2)]"" S ENFAP("CMR")=$$GET1^DIQ(6915.4,ENFC("DA"),101),$P(^ENG(6915.4,ENFC("DA"),3),U,10)=$$LOC^ENFAVAL(ENFAP("CMR"))
66 F I=0,3,4,6 S ENFAP(I)=$G(^ENG(6915.4,ENFC("DA"),I))
67 ;
68 S ENFAP("DOC")="FC" K ^TMP($J) D ^ENFAVAL
69 I $D(^TMP($J)) D LISTP^ENFAXMTM D G:Y ASKDATA S ENDO=0 Q
70 . S DIR(0)="Y",DIR("A")="Re-edit this change",DIR("B")="YES"
71 . D ^DIR K DIR
72 . I 'Y W !!,"Sorry, I must then delete this change!" Q
73 . ;Initialize derived values
74 . S X1=$G(^ENG(6915.4,ENFC("DA"),3)),$P(X1,U,9,14)="^^^^^",^(3)=X1
75 . S X1=$G(^ENG(6915.4,ENFC("DA"),4)),$P(X1,U,14,16)="^^",^(4)=X1
76 . S ENFAP("CSN")="",ENFAP("CMR")=""
77 . S Y=1
78 Q
79ASKOK ;
80 S DIR(0)="Y",DIR("A")="Sure you want to process these changes"
81 S DIR("B")="YES" D ^DIR K DIR I 'Y!($D(DIRUT)) S ENDO=0
82 Q
83DEL ;
84 I $G(ENFC("DA"))]"" D
85 . S DA=ENFC("DA"),DIK="^ENG(6915.4," D ^DIK K DIK
86 . W !,"FC Document deleted..."
87 W $C(7),!,"No action taken. Database unchanged."
88 Q
89UPDATE ;
90 ; update modified code sheet
91 D MCS^ENFACHG1
92 ;update FAP Balance when value entered
93 I $P(ENFAP(4),U,6)]"" D ADJBAL^ENFABAL($P(ENEQ(9),U,5),$P(ENEQ(9),U,7),$P(ENEQ(8),U,6),$P($P(ENFAP(0),U,2),"."),$P(ENFAP(4),U,6)-$P(ENFAP(100),U,4))
94 W !!,"Updating the Equipment File..." D EQ^ENFACHG1
95 W !!,"Sending FC document to FAP..." D ^ENFAXMT
96 I $G(ENAV) D
97 . S DIE="^ENG(6915.4,",DR="301///NOW",DA=ENFC("DA") D ^DIE
98 . W !,"Adjustment Voucher was created.",!
99 Q
100WRAPUP ;
101 I $G(ENEQ("DA"))]"" L -^ENG(6914,ENEQ("DA"))
102 I $G(ENFC("DA"))]"" L -^ENG(6915.4,ENFC("DA"))
103 K DA,DIC,DIE,DR,DIK,DIR,DIROUT,DIRUT,DTOUT,DUOUT,X,X1,Y
104 K ENAV,ENDO,ENEQ,ENFAP,ENFA,ENFB,ENFC
105 Q
106 ;ENFACHG
Note: See TracBrowser for help on using the repository browser.