source: WorldVistAEHR/trunk/r/ENGINEERING-EN/ENFACHG1.m@ 1211

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

initial load of WorldVistAEHR

File size: 3.2 KB
RevLine 
[613]1ENFACHG1 ;WASHINGTON IRMFO/KLD/DH/SAB; EQUIPMENT CHANGES (cont); 7/19/96
2 ;;7.0;ENGINEERING;**29,33**;Aug 17, 1993
3 Q
4MCS ; modified code sheets - called from ENFACHG
5 ; updates 'adjusted' fields on code sheet (FA or FB) being modified
6 I ENFC("BETRMNT")="00" D ;FC against an FA
7 . I $P(ENFAP(4),U,6)]"" D ; new value
8 . . ; get previous value (from adjusted value on FA) and save on FC
9 . . S $P(^ENG(6915.4,ENFC("DA"),100),U,4)=$P(^ENG(6915.2,ENFA("DA"),200),U,1)
10 . . ; update adjusted asset value on FA with new value
11 . . S $P(^ENG(6915.2,ENFA("DA"),200),U,1)=$P(ENFAP(4),U,6)
12 I ENFC("BETRMNT")>0 D ;FC applied to FB
13 . I $P(ENFAP(4),U,6)]"" D ; new value
14 . . ; get previous value (from adjusted value on FB) and save on FC
15 . . S $P(^ENG(6915.4,ENFC("DA"),100),U,4)=$P(^ENG(6915.3,$P(ENFAP(100),U,5),200),U,1)
16 . . ; update adjusted asset value on FB with new value
17 . . S $P(^ENG(6915.3,$P(ENFAP(100),U,5),200),U,1)=$P(ENFAP(4),U,6)
18 . ; update other 'adjusted' fields on FB
19 . I $P(ENFAP(3),U,11)]"" S $P(^ENG(6915.3,$P(ENFAP(100),U,5),200),U,2)=$P(ENFAP(3),U,11) ; desc
20 . I $P(ENFAP(100),U,6)]"" S $P(^ENG(6915.3,$P(ENFAP(100),U,5),200),U,3)=$P(ENFAP(100),U,6) ; acq date
21 . I $P(ENFAP(3),U,15)]"" S $P(^ENG(6915.3,$P(ENFAP(100),U,5),200),U,4)=$P(ENFAP(3),U,15) ; acq method
22 ; update variables in case data (e.g. previous value) was modified
23 S ENFAP(100)=$G(^ENG(6915.4,ENFC("DA"),100))
24 Q
25EQ ; update equipment file - called from ENFACHG
26 N VALUE
27 S DA=ENEQ("DA"),DIE="^ENG(6914,"
28 ; compute new total asset value (current+new-old)
29 S:$P(ENFAP(4),U,6)]"" VALUE=$P(ENEQ(2),U,3)+$P(ENFAP(4),U,6)-$P(ENFAP(100),U,4)
30FA I ENFC("BETRMNT")="00" D ;FC against an FA
31 . S DR=""
32 . I $G(ENFAP("CSN"))]"",$P(ENFAP(100),U)'=$P(ENEQ(2),U,8) S DR="18////^S X=$P(ENFAP(100),U)"
33 . I $G(ENFAP("CMR"))]"",$P(ENFAP(100),U,2)'=$P(ENEQ(2),U,9) S DR=DR_";19////^S X=$P(ENFAP(100),U,2)"
34 . S:$P(ENFAP(100),U,6)]"" DR=DR_";13////"_$P(ENFAP(100),U,6)
35 . S:$P(ENFAP(4),U,3)]"" DR=DR_";15////"_$P(ENFAP(4),U,3)
36 . S:$P(ENFAP(4),U,6)]"" DR=DR_";12////"_$$DEC^ENFAUTL(VALUE)
37 . S:$P(ENFAP(3),U,15)]"" DR=DR_";20.1////"_$P(ENFAP(3),U,15)
38 . S:$P(ENFAP(100),U,7)]"" DR=DR_";16////"_$P(ENFAP(100),U,7)
39 . S:$E(DR)=";" DR=$E(DR,2,200) D ^DIE
40FB I ENFC("BETRMNT")>0 D ;FC applied to FB
41 . ; compute new total asset value
42 . I $P(ENFAP(4),U,6)]"" S DR="12////"_$$DEC^ENFAUTL(VALUE) D ^DIE
43 Q
44 ;
45SHOW ;Error in selecting BETERMENT NUMBER
46 ; called from file #6915.3 input template ENFA CHANGE EN
47 ; called from file #6915.3 field #27 executable help
48 ; expects
49 ; X - betterment nummber entered by user
50 ; ENEQ("DA") - ien of equipment entry
51 ; ENFA("DA") - ien of latest FA Document for equipment entry
52 ; ENFC("DA") - ien of FC document being edited
53 N I,J
54 ;Show the valid choices
55 W:X'="?" !!,"BETTERMENT NUMBER ",X," invalid for ENTRY #",ENEQ("DA"),"."
56 W !,"Valid choices are:",!,?5,"00",?10,"Original FA document."
57 S I="" F S I=$O(^ENG(6915.3,"ABTR",ENEQ("DA"),I)) Q:I="" D
58 . S J=$O(^ENG(6915.3,"ABTR",ENEQ("DA"),I,0))
59 . ; screen betterments prior to current FA
60 . Q:$P($G(^ENG(6915.3,J,0)),U,2)<$P($G(^ENG(6915.2,ENFA("DA"),0)),U,2)
61 . W !,?5,I,?10,"$"_$P($G(^ENG(6915.3,J,200)),U),?30,$P($G(^(3)),U,8)
62 ; reset the betterment number field
63 S $P(^ENG(6915.4,ENFC("DA"),3),U,8)=""
64 Q
65 ;ENFACHG1
Note: See TracBrowser for help on using the repository browser.