source: WorldVistAEHR/trunk/r/ENGINEERING-EN/ENPOST.m@ 1351

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

initial load of WorldVistAEHR

File size: 3.4 KB
Line 
1ENPOST ;(WASH ISC)/DH-PostInitialization Routine ;8-16-93
2 ;;7.0;ENGINEERING;;Aug 17, 1993
3 ;
4EN I '$D(ENDATE) S %DT="",X="T" D ^%DT X ^DD("DD") S ENDATE=Y
5 S ENX=$S($D(^%ZOSF("VOL")):^%ZOSF("VOL"),1:"ENG"),^ENG("VERSION",7.0,ENX,"DD")=ENDATE
6 I $D(^ENG("VERSION"))#10=0 G EXIT
7 ;Convert CMR official to pointer
8 F DA=0:0 S DA=$O(^ENG(6914.1,DA)) Q:DA'>0 S X=$P(^ENG(6914.1,DA,0),U,2) I X]"",$D(^VA(200,"B",X)) S X=$O(^VA(200,"B",X,0)) S:X>0 $P(^ENG(6914.1,DA,0),U,2)=X
9 S DIK="^ENG(""SP"",",DIK(1)=".01^AF" D ENALL^DIK K DIK
10 I $E(^ENG("VERSION"))=7 G EXIT
11 K ^ENG("WO","C"),^ENG("WO","E"),^ENG("WO","F"),^ENG("WO","G")
12 K ^ENG("WO","H"),^ENG("WO","X")
13 W !!,"Now re-building your Work Order File."
14 F DA=0:0 S DA=$O(^ENG("WO",DA)) Q:DA'>0 D
15 . Q:'$D(^ENG("WO",DA,0)) I $E(^ENG("WO",DA,0))="*" Q
16 . I $D(^ENG("WO",DA,5)) S ENX=$P(^(5),U) I ENX>0 S $P(^(5),U)="" I $D(^ENG("ACT",ENX)) S ^ENG("WO",DA,8,0)="^6920.035PA^1^1",ENX(0)=$P(^ENG("ACT",ENX,0),U,2),^ENG("WO",DA,8,1,0)=ENX(0)
17 . S %X="^ENG(""WO"",DA,",%Y="^ENG(6920,DA," D %XY^%RCR K ^ENG("WO",DA) W:'(DA#20) "."
18 K ^ENG("WO")
19 W !,"Now re-indexing Work Order File. This could take awhile..."
20 S DIU(0)=""
21 S DIK="^ENG(6920," D IXALL^DIK
22 K DIK
23LOC ;Convert LOCATIONS from free text into pointers
24 W !!,"Now converting LOCATIONS in your Equipment File"
25 F DA=0:0 S DA=$O(^ENG(6914,DA)) Q:DA'>0 W:'(DA#30) "." D
26 . I $D(^ENG(6914,DA,3)) S ENX=$P(^(3),U,5) I ENX]"" D
27 .. S ENX1=$O(^ENG("SP","B",ENX,0)) I ENX1>0 D
28 ... S $P(^ENG(6914,DA,3),U,5)=ENX1
29 ... K ^ENG(6914,"D",ENX,DA)
30 ... S ^ENG(6914,"D",ENX1,DA)=""
31 W !!,"Now converting Work Order LOCATIONS"
32 F DA=0:0 S DA=$O(^ENG(6920,DA)) Q:DA'>0 W:'(DA#30) "." D
33 . Q:'$D(^ENG(6920,DA,0)) S ENX=$P(^(0),U,4) I ENX]"",ENX'=" " D
34 .. S ENX1=$O(^ENG("SP","B",ENX,0)) I ENX1>0 D
35 ... S $P(^ENG(6920,DA,0),U,4)=ENX1
36 ... K ^ENG(6920,"C",ENX,DA)
37 ... S ^ENG(6920,"C",ENX1,DA)=""
38PROJ ;Convert data in File 6925
39 W !!,"Now converting a few data elements in your existing construction projects."
40 W !,"This shouldn't take very long."
41 F DA=0:0 S DA=$O(^ENG("PROJ",DA)) Q:DA'>0 D W:'(DA#20) "."
42 . N STATION Q:'$D(^ENG("PROJ",DA,0)) S STATION=$P(^(0),"-") D:STATION]""
43 .. S ENX=$O(^DIC(4,"D",STATION,0)) I ENX>0 S $P(^ENG("PROJ",DA,0),U,4)=ENX
44 . I $D(^ENG("PROJ",DA,1)) S EN=^(1) D
45 .. S EN1=$P(EN,U,3) I EN1]"" D
46 ... S EN1(0)=$S(EN1="A/E":8,EN1="PP":9,EN1="WD":11,EN1="AA":13,EN1="CO":15,1:"")
47 ... I EN1(0)'="" S $P(EN,U,3)=EN1(0)
48 .. S EN2=$P(EN,U,4) I EN2]"" D
49 ... S EN2(0)=$S(EN2="HCF":3,EN2="A/E":1,EN2="O/F":1,1:"")
50 ... I EN2(0)'="" S $P(EN,U,4)=EN2(0)
51 .. S EN3=$P(EN,U,5) I EN3]"" D
52 ... S EN3(0)=$S(EN3="CONTR":1,EN3="P&H":2,EN3="8(a)":4,EN3="HCF":3,1:"")
53 ... I EN3(0)'="" S $P(EN,U,5)=EN3(0)
54 .. S $P(EN,U,9)=$P(EN,U,6),$P(EN,U,6)=""
55 .. S ^ENG("PROJ",DA,1)=EN
56 . I $D(^ENG("PROJ",DA,2)) D
57 .. S $P(^ENG("PROJ",DA,50),U,2)=$P(^(2),U,2),$P(^(2),U,2)=""
58 .. S $P(^ENG("PROJ",DA,50),U,3)=$P(^(2),U,3),$P(^(2),U,3)=""
59 . I $D(^ENG("PROJ",DA,3)) D
60 .. S $P(^ENG("PROJ",DA,50),U,17)=$P(^(3),U),$P(^(3),U)=""
61 .. S $P(^ENG("PROJ",DA,50),U,18)=$P(^(3),U,2),$P(^(3),U,2)=""
62 . I $D(^ENG("PROJ",DA,4)) S EN=^(4) D S ^ENG("PROJ",DA,4)=EN
63 .. S $P(EN,U,14)=$P(EN,U,5),$P(EN,U,5)=""
64 .. S $P(EN,U,15)=$P(EN,U,6),$P(EN,U,6)=""
65 W !,"Now re-indexing"
66 S DIK="^ENG(""PROJ""," D IXALL^DIK
67EXIT ;
68 S ^ENG("VERSION")=7.0
69 S %DT="T",X="N" D ^%DT,DD^%DT W !!,"Finished at ",Y,"."
70 L K ENDATE,ENX,ENX1,DA,%X,%Y,DIK,DIU
71 K EN,EN1,EN2,EN3
72 Q
73 ;ENPOST
Note: See TracBrowser for help on using the repository browser.