Functional Description
Purpose
The purpose of F1307 Edit Work Order Status is to insert a record in the Status History Table (F1307)
when a record is added to the Work Order Master Table (F4801) or when a change is made to the Work
Order Status (SRST).
Setup Notes and Prerequisites
Special Logic
This program will provide a hard error if the dates overlap. The user must enter a date
greater than the last start date.
when changing through Work Order Print or the Work Order Inventory Issues program.
Technical Specification
1.// Set Defaults for Input Parameters
2.If Record Type (TREC) <> '2'
3. Record Type (TREC) = '2'
4.End If
5.If Remark (RMK) = ""
6. Remark (RMK) = " "
7.End If
8.If Processing Mode (EV01) <> '1' And <> '2' And <> '3'
9. Processing Mode (EV01) = '1'
10.End If
11.// Initialize Error Code
12.Error Code (ERRC) = '0'
13.Error Code (wf) = '0'
14.//
15.// Open Tables
16.Open F4801, F1307
17.//
18.Call Internal Function Check Date Overlap(Work Order Number (DOCO))
19.//
20.If Error Code (wf) <> '0' And Processing Mode (EV01) = '1'
21. Error Code (ERRC) = Error Code (wf)
22.End If
23.
24.If Error Code (ERRC) = '0' And Processing Mode (EV01) <> '1' And Write (wf) = '1'
25. // Update Status for Work OrderNumber (DOCO)
26. Call Internal Function Update Order Status (Work Order Number (DOCO))
27. //
28.End If
29.
Internal Function Check Date Overlap(Input Order Number)
1.// Check for Date Overlap with Any History Record in F1307
2.Write (wf) = '1'
3.Fetch the record from F1307 with the highest EFTB and BEGT value and matches F1DOCO=Input Order
Number, F1TREC=Record Type (TREC). Save this record in DS_OPENHISTORYRECORD (wf)
4.If Fetch is Successful
5. If F1EFTB > Input Begin Date of Status (EFTB)
6. Error Code (wf) = '1'
7. Else
8. If F1EFTB = Begin Date of Status (EFTB) And F1BEGT > Begin Time of Status (BEGT)
9. Error Code (wf) = '1'
10. End If
11. End If
12. // Determine if the F1307 record is the same status as the new status.
13. If F1EWST = New Status of Equipment(EWST)
14. Write (wf) = '0'
15. End If
16. // Determine if Previous History Record before has same status.
17. Previous_Hist_STHR (wf) = 0
18. Previous_Hist_CUMH (wf) = 0
19. Select Records from F1307 using F1TREC=Record Type(TREC), F1DOCO=Input Order
Number, And (F1EFTB< Begin Date if Status (BEGT) Or F1EFTB=Begin Date of Status(EFTB) And F1BEGT <
Begin Time of Status (BEGT))
20. Fetch Record
21. If Fetch Was Successful
22. If F1EWST = New Status of Equipment(EWST)
23. Write (wf) = '0'
24. Copy F1CUMH to Previous_Hist_CUMH (wf)
25. Copy F1STHR to Previous_Hist_STHR (wf)
26. Else
27. While Fetch is Successful
28. If F1EWST = New Status of Equipment (EWST)
29. Copy F1CUMH to Previous_Hist_CUMH (wf)
30. Copy F1STHR to Previous_Hist_STHR (wf)
31. Break out from while loop.
32. End If
33. End While
34. End If
35. End If
36. // Check if there is a direct match on EFTB and BEGT
37. Fetch the record from F1307 using keys: F1DOCO=Input Order Number, F1TREC=Record
Type (TREC), F1EFTB= Begin Date of Status (EFTB), F1BEGT= Begin Time of Status (BEGT)
38. If Fetch is Successful
39. // Overlap on same date/time on different status.
40. If F1EWST <> New Status of Equipment (EWST)
41. Error Code (wf) = '2'
42. End If
43. Save this record in DS_HISTORYRECORDWITHSAMESTART (wf).
44. End If
45.End If
Internal Function Update Order Status(Input Order Number To Update)
1.Update Old (wf) = '0'
2.// Calculate Cumulative Hours
3.Cum Hours (wf) = Previous_Hist_CUMH (wf) + Previous_Hist_STHR (wf)
4.//
5.// Calculate Meter Readings
6.Meter (wf) = ' '
7.If Record Type (TREC) = '2' And Processing Mode (EV01) = '2' And Asset Number (NUMB) <> 0
8. Meter (wf) = '1'
9. HBAL (wf) = 0
10.MBAL (wf) = 0
11.FBAL (wf) = 0
12.Fetch Record from F1201 using FANUMB= Asset Number (NUMB)
13.
14.Call Accumulate Date Sensitive Balances (B1200007 ) to calculate HBAL(wf).
15.Call Accumulate Date Sensitive Balances (B1200007 ) to calculate MBAL(wf).
16.Call Accumulate Date Sensitive Balances (B1200007 ) to calculate FBAL(wf).
17.End If
18.//
19.If Error Code (wf) = '0'
20. // Normal Status Update and Insert with no Date Overlap Conditions.
21. // Update Open History record to close it.
22. If DS_OPENHISTORYRECORD.F1NUMR <> 0
23. Call Internal Function Calculate Hours (DS_OPENHISTORYRECORD.F1EFTB, Begin
Date of Status (EFTB), DS_OPENHISTORYRECORD.F1BEGT, Begin Time of Status (BEGT),
Elapsed Hrs(wf)).
24. DS_OPENHISTORYRECORD.F1EFTE = Begin Date of Status (EFTB)
25. DS_OPENHISTORYRECORD.F1BEGT = Begin Time of Status (BEGT)
26. DS_OPENHISTORYRECORD.F1STHR = Elapsed Hrs(wf)
27. DS_OPENHISTORYRECORD.Audit Information fields.
28. Update F1307 using DS_OPENHISTORYRECORD.
29. End If
30. // Insert new history record.
31. F1TREC = Record Type (TREC)
32. F1NUMR = Asset Number (NUMB)
33. F1DOCO = Input Order Number to Update
34. F1LHR = HBAL(wf)
35. F1LMR = MBAL (wf)
36. F1LFR = FBAL (wf)
37. F1EWST = New Status of Equipment (EWST)
38. F1EFTB = Begin Date of Status (EFTB)
39. F1BEGT = Begin Time of Status (BEGT)
40. F1EFTE = Null
41. F1ENDT = 0
42. F1STHR = 0
43. F1CUMH = Cum Hours (wf)
44. F1RMK = Remark (RMK)
45. Audit Information Fields.
46. Insert to F1307
47.End If
48.//
49.If Error Code (wf) <> '0' (B1)
50. // If History Record with Same Start date and time Exists, Update it.
51. Adjust Hrs (wf) = 0
52. If DS_HISTORYRECORDWITHSAMESTART.F1NUMR <> 0(B2)
53. // It Exists
54. Update Old(wf) = '1'
55. Old Status (wf) = DS_HISTORYRECORDWITHSAMESTART.F1EWST
56. Adjust Hrs(wf) = DS_HISTORYRECORDWITHSAMESTART.F1STHR
57. DS_HISTORYRECORDWITHSAMESTART.F1EWST = New Status of Equipment (EWST)
58. DS_HISTORYRECORDWITHSAMESTART.F1CUMH = Cum Hours (wf)
59. DS_HISTORYRECORDWITHSAMESTART.F1RMK = Remark (RMK)
60. DS_HISTORYRECORDWITHSAMESTART.Audit Information fields.
61. Update F1307 using DS_HISTORYRECORDWITHSAMESTART
62. //
63. // Get the next record with higher EFTB and BEGT value and same
status.
64. Select on F1307 using F1TREC= Record Type (TREC), F1DOCO= Input Order
Number To Update, F1EFTB > Begin Date of Status (EFTB) OR F1EFTB = Begin Date of Status
(EFTB) And F1BEGT > Begin Time of Status (BEGT), Order by EFTB Asc and BEGT Asc.
65. Fetch the F1307 record
66. If Fetch Succeeds And F1EWST = New Status of Equipment (EWST)
67. Delete from F1307 using keys in record fetched.
68. DS_HISTORYRECORDWITHSAMESTART.F1EFTE = F1EFTE(deleted rec)
69. DS_HISTORYRECORDWITHSAMESTART.F1ENDT = F1ENDT(deleted rec)
70. DS_HISTORYRECORDWITHSAMESTART.F1STHR = F1STHR(deleted rec)
71. DS_HISTORYRECORDWITHSAMESTART.Audit Information fields.
72. Update F1307 using DS_HISTORYRECORDWITHSAMESTART.
73. End If
74. //
75. // Get record next record with lower EFTB and BEGT value and same
status.
76. Select on F1307 using F1TREC= Record Type (TREC), F1DOCO= Input Order
Number To Update, F1EFTB < Begin Date of Status (EFTB) OR F1EFTB = Begin Date of Status
(EFTB) And F1BEGT < Begin Time of Status (BEGT), Order by EFTB Dsc and BEGT Dsc.
77. Fetch the F1307 record
78. If Fetch Succeeds And
79. F1EFTE = DS_HISTORYRECORDWITHSAMESTART.F1EFTE
80. F1ENDT = DS_HISTORYRECORDWITHSAMESTART.F1ENDT
81. F1STHR = DS_HISTORYRECORDWITHSAMESTART.F1STHR
82. Audit Information fields.
83. Update F1307 using current values.
84. Delete F1307 using DS_HISTORYRECORDWITHSAMESTART
85. End If
86. Else (X2)
87. // DS_HISTORYRECORDWITHSAMESTART was not found
88. Select on F1307 using F1TREC= Record Type (TREC), F1DOCO= Input Order
Number To Update, F1EFTB < Begin Date of Status (EFTB) OR F1EFTB = Begin Date of Status
(EFTB) And F1BEGT < Begin Time of Status (BEGT), Order by EFTB Dsc and BEGT Dsc.
89. Fetch F1307
90. If Fetch Succeeds then
91. Update Old(wf) = '1'
92. Old Status (wf) = F1EWST
93. Call Internal Function Calculate Hours (F1EFTB, Begin Date of
Status (EFTB), F1BEGT, Begin Time of Status (BEGT), Elapsed Hrs(wf)).
94. F1EFTE = Begin Date of Status (EFTB)
95. F1ENDT = Begin Time of Status (BEGT)
96. F1STHR = Elapsed Hrs(wf)
97. Update F1307
98. End If
99. Select on F1307 using F1TREC= Record Type (TREC), F1DOCO = Input Asset
Number To Update, F1EFTB > Begin Date of Status (EFTB) OR F1EFTB = Begin Date of Status
(EFTB) And F1BEGT > Begin Time of Status (BEGT), Order by EFTB Asc and BEGT Asc.
100. Fetch the F1307 record
101. If Fetch Succeeds then (B3)
102. Call Internal Function Calculate Hours (Begin Date of Status
(EFTB), F1EFTB, Begin Time of Status (BEGT), F1BEGT, Elapsed Hrs(wf)).
103. Adjust Hrs (wf) = Elapsed Hrs(wf)
104. If New Status of Equipment (EWST) <> F1EWST
105. F1EFTE = F1EFTB
106. F1ENDT = F1BEGT
107. F1TREC = Record Type (TREC)
108. F1NUMR = Asset Number (NUMB)
109. F1DOCO = Input Order Number To Update
110.
111. F1LHR = HBAL (wf)
112. F1LMR = MBAL (wf)
113. F1LFR = FBAL (wf)
114. F1EWST = New Status of Equipment (EWST)
115. F1EFTB = Begin Date of Status (EFTB)
116. F1BEGT = , Begin Time of Status (BEGT)
117. F1STHR = Elapsed Hrs(wf)
118. F1CUMH = Cum Hours (wf)
119. F1RMK = Remark (RMK)
120. Insert into F1307
121. Else
122. F1EFTB = Begin Date of Status (EFTB)
123. F1BEGT = , Begin Time of Status (BEGT)
124. If F1STHR <> 0
125. F1STHR = F1STHR + Elapsed Hrs(wf)
126. '1a'1a'1a'1a'1a'1a'1a'1aE'1a'1a'08'1a'1a'1a'1a'1a'1a'14
D1300030 - F1307 Update Work Order Status
Parameter Name | Data Item | Data Type | Req/Opt | I/O/Both |
---|---|---|---|---|
cRecordType | TREC | char | OPT | NONE |
A code that indicates whether a particular record represents a change in equipment status or a change in work order status. Valid values
| ||||
mnWorkOrderNumber | DOCO | MATH_NUMERIC | OPT | NONE |
A number that identifies an original document. This document can be a voucher, a sales order, an invoice, unapplied cash, a journal entry,
| ||||
szNewStatusOfWorkOrder | EWST | char | OPT | NONE |
The status associated with either a piece of equipment or a work order. | ||||
jdBeginDateOfStatus | EFTB | JDEDATE | OPT | NONE |
The date that an address, item, transaction, or table record becomes active. The meaning of this field differs, depending on the program.
| ||||
mnBeginTimeOfStatus | BEGT | MATH_NUMERIC | OPT | NONE |
The time at which the status of a piece of equipment or a work order changes. Use the HH:MM format (for example, 12:35). | ||||
mnAssetNumber | NUMB | MATH_NUMERIC | OPT | NONE |
An 8-digit number that uniquely identifies an asset. | ||||
szProgramId | PID | char | OPT | NONE |
The number that identifies the batch or interactive program (batch or interactive object). For example, the number of the Sales Order Entry
| ||||
szRemark | RMK | char | OPT | NONE |
A generic field that you use for a remark, description, name, or address. | ||||
cProcessingMode | EV01 | char | OPT | NONE |
An option that specifies the type of processing for an event. | ||||
cErrorCode | ERRC | char | OPT | NONE |
This error code indicates if any errors occurred during the creation of the Trip Document Detail (F4914) records by the Delivery Document
|
B1200007 F1202 Accumulate Date Sensitive Balances | ||||
B9800100 Get Audit Information |
F1201 Asset Master File | ||||
F1307 Status History File | ||||
F4801 Work Order Master File |