source: WorldVistAEHR/trunk/r/ENGINEERING-EN/ENEQP.m@ 1801

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

initial load of WorldVistAEHR

File size: 3.5 KB
Line 
1ENEQP ;(WASH ISC)/DH-Direct Posting to Equipment Histories ;10.9.97
2 ;;7.0;ENGINEERING;**45**;Aug 17, 1993
3EN ;Post info to equipment history sub-file
4 N TEMPLT,NUMBER,QUIT,DIC S (ENTMPLT,QUIT)=0
5 W @IOF,!!,"This is a utility for posting information directly to the AEMS-MERS",!,"Equipment History sub-file."
6 W ! S DIR(0)="Y",DIR("A")="Are you sure you want to proceed",DIR("B")="NO"
7 D ^DIR G:Y'>0 EXIT
8 W !! S DIR(0)="Y",DIR("A")="Are the Equipment Records to be found in a SORT template",DIR("B")="NO"
9 D ^DIR K DIR I Y>0 D GTMPLT G:'ENTMPLT EXIT G POST
10 S DIR(0)="PO^6914:AEQM" K ^TMP($J)
11 F W ! D ^DIR Q:Y'>0 S ^TMP($J,+Y)=""
12 G:'$D(^TMP($J)) EXIT
13 S DIR(0)="Y",DIR("A")="Shall we save these ENTRY NUMBERS in a SORT template for future use",DIR("B")="NO"
14 W ! D ^DIR K DIR D:Y>0 STMPLT G:QUIT EXIT
15 ;
16POST W !!,"Enter as much information as may apply."
17 K DIR S DIR(0)="PO^6920.1:AEQM"
18 W ! D ^DIR K DIR S ENACTN=$S(Y>0:+Y,1:"") I $E(X)="^" G EXIT
19 S DIR(0)="FO^3:12",DIR("A")="WORK ORDER REFERENCE"
20 S DIR("?")="Enter 3 to 12 characters. Optional."
21 W ! D ^DIR K DIR G:$E(Y)="?" POST G:$E(Y)="^" EXIT
22 S ENREF=Y
23 S DIR(0)="SO^P:PASSED;C:CORRECTIVE ACTION REQUIRED;D:DEFERRED"
24 S DIR("A")="PM STATUS"
25 W ! D ^DIR K DIR S ENSTAT=$S(Y?1U:Y,1:"") I $E(X)="^" G EXIT
26 S DIR(0)="NO^0:2080:1",DIR("A")="TOTAL HOURS"
27 W ! D ^DIR S ENHRS=$S(Y=+Y:Y,1:"") K DIR I $E(X)="^" G EXIT
28 S DIR(0)="NO^0:999999:2",DIR("A")="LABOR COST"
29 W ! D ^DIR S ENLABOR=$S(Y=+Y:Y,1:"") K DIR I $E(X)="^" G EXIT
30 S DIR(0)="NO^0:999999:2",DIR("A")="MATERIAL COST"
31 W ! D ^DIR S ENMATRL=$S(Y=+Y:Y,1:"") K DIR I $E(X)="^" G EXIT
32 S DIR(0)="NO^0:999999:2",DIR("A")="VENDOR COST"
33 W ! D ^DIR S ENVNDR=$S(Y=+Y:Y,1:"") K DIR I $E(X)="^" G EXIT
34 S DIR(0)="FO^3:15",DIR("A")="WORKER",DIR("B")=$E($P(^VA(200,DUZ,0),U),1,15)
35 W ! D ^DIR S ENEMP=Y K DIR I $E(X)="^" G EXIT
36 S DIR(0)="FO^3:60",DIR("A")="WORK PERFORMED"
37 S DIR("?")="Free text. 60 character maximum."
38 W ! D ^DIR K DIR S ENWORK=Y I $E(X)="^" G EXIT
39 D ^ENEQP1
40 G EXIT
41 ;
42GTMPLT ;Get the SORT template
43 S DIC="^DIBT(",DIC(0)="AEQM",DIC("S")="I $E(^(0),1,6)=""ENPOST"",$P(^(0),U,4)=6914"
44 S DIC("A")="Select SORT template (must begin with 'ENPOST'): "
45 W ! D ^DIC K DIC("A") I Y>0 S ENTMPLT=1,NUMBER=+Y
46 Q
47 ;
48STMPLT ;Create new SORT template
49 W !! S DIR(0)="F^6:30^K:$E(X,1,6)'=""ENPOST"" X"
50 S DIR("A")="Name of SORT template. Must begin with 'ENPOST'",DIR("?")="Template name (30 char max) must begin with 'ENPOST' (upper case)."
51 D ^DIR K DIR I $E(X)="^" S QUIT=1 Q
52 S TEMPLT=Y
53 I $D(^DIBT("B",TEMPLT)) D Q
54 . F NUMBER=0:0 S NUMBER=$O(^DIBT("B",TEMPLT,NUMBER)) Q:NUMBER'>0 I $P(^DIBT(NUMBER,0),U,5)=DUZ,$P(^(0),U,4)=6914 D Q
55 .. W !!,"SORT template "_TEMPLT_" already exists."
56 .. S DIR(0)="Y",DIR("A")="OK to replace it"
57 .. D ^DIR K DIR I Y>0 D Q
58 ... S DIK="^DIBT(",DA=NUMBER D ^DIK K DIK
59 ... K DD,DO S DIC="^DIBT(",DIC(0)="X",X=TEMPLT,DINUM=NUMBER
60 ... S DIC("DR")="2///^S X=DT;4///^S X=6914;5///^S X=DUZ"
61 ... D FILE^DICN I Y'>0 S NUMBER=""
62 .. I $E(X)="^" S QUIT=1 Q
63 .. S DIR(0)="Y",DIR("A")="OK to add these entries"
64 .. D ^DIR K DIR I Y>0 D Q
65 ... F %=0:0 S %=$O(^TMP($J,%)) Q:%'>0 S ^DIBT(NUMBER,1,%)=""
66 .. I $E(X)="^" S QUIT=1
67CRE8 S DIR(0)="Y",DIR("A")="OK to create new SORT template"
68 S DIR("B")="YES"
69 D ^DIR K DIR S:$E(X)="^" QUIT=1 Q:Y'>0
70 K DD,DO S DIC="^DIBT(",DIC(0)="X",X=TEMPLT
71 S DIC("DR")="2///^S X=DT;4///^S X=6914;5///^S X=DUZ"
72 D FILE^DICN I Y>0 S NUMBER=+Y D
73 . F %=0:0 S %=$O(^TMP($J,%)) Q:%'>0 S ^DIBT(NUMBER,1,%)=""
74 Q
75 ;
76EXIT K ^TMP($J)
77 K ENTMPLT,ENREF,ENSTAT,ENHRS,ENLABOR,ENMATRL,ENVNDR,ENEMP,ENWORK
78 K ENACTN
79 Q
80 ;ENEQP
Note: See TracBrowser for help on using the repository browser.