1 # Copyright (C) 2010-2011 Richard Lincoln
3 # Permission is hereby granted, free of charge, to any person obtaining a copy
4 # of this software and associated documentation files (the "Software"), to
5 # deal in the Software without restriction, including without limitation the
6 # rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
7 # sell copies of the Software, and to permit persons to whom the Software is
8 # furnished to do so, subject to the following conditions:
10 # The above copyright notice and this permission notice shall be included in
11 # all copies or substantial portions of the Software.
13 # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14 # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15 # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
16 # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17 # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
18 # FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
21 from CIM15
.IEC61968
.Common
.Document
import Document
23 class WorkCostDetail(Document
):
24 """A collection of all of the individual cost items collected from multiple sources.A collection of all of the individual cost items collected from multiple sources.
27 def __init__(self
, type='', isDebit
=False, transactionDateTime
='', amount
=0.0, WorkTask
=None, Works
=None, Design
=None, MiscCostItems
=None, WorkCostSummary
=None, PropertyUnits
=None, ErpProjectAccounting
=None, LaborItems
=None, MaterialItems
=None, EquipmentItems
=None, ContractorItems
=None, OverheadCost
=None, CostType
=None, *args
, **kw_args
):
28 """Initialises a new 'WorkCostDetail' instance.
30 @param type: Type of work cost.
31 @param isDebit: True if 'amount' is a debit, false if it is a credit.
32 @param transactionDateTime: Date and time that 'amount' is posted to the work.
33 @param amount: Amount in designated currency for work, either a total or an individual element. As defined in the attribute 'type,' multiple instances are applicable to each work for: planned cost, actual cost, authorized cost, budgeted cost, forecasted cost, other.
38 @param WorkCostSummary:
40 @param ErpProjectAccounting:
43 @param EquipmentItems:
44 @param ContractorItems:
51 #: True if 'amount' is a debit, false if it is a credit.
52 self
.isDebit
= isDebit
54 #: Date and time that 'amount' is posted to the work.
55 self
.transactionDateTime
= transactionDateTime
57 #: Amount in designated currency for work, either a total or an individual element. As defined in the attribute 'type,' multiple instances are applicable to each work for: planned cost, actual cost, authorized cost, budgeted cost, forecasted cost, other.
61 self
.WorkTask
= WorkTask
64 self
.Works
= [] if Works
is None else Works
69 self
._MiscCostItems
= []
70 self
.MiscCostItems
= [] if MiscCostItems
is None else MiscCostItems
72 self
._WorkCostSummary
= None
73 self
.WorkCostSummary
= WorkCostSummary
75 self
._PropertyUnits
= []
76 self
.PropertyUnits
= [] if PropertyUnits
is None else PropertyUnits
78 self
._ErpProjectAccounting
= None
79 self
.ErpProjectAccounting
= ErpProjectAccounting
82 self
.LaborItems
= [] if LaborItems
is None else LaborItems
84 self
._MaterialItems
= []
85 self
.MaterialItems
= [] if MaterialItems
is None else MaterialItems
87 self
._EquipmentItems
= []
88 self
.EquipmentItems
= [] if EquipmentItems
is None else EquipmentItems
90 self
._ContractorItems
= []
91 self
.ContractorItems
= [] if ContractorItems
is None else ContractorItems
93 self
._OverheadCost
= None
94 self
.OverheadCost
= OverheadCost
97 self
.CostType
= CostType
99 super(WorkCostDetail
, self
).__init
__(*args
, **kw_args
)
101 _attrs
= ["type", "isDebit", "transactionDateTime", "amount"]
102 _attr_types
= {"type": str, "isDebit": bool, "transactionDateTime": str, "amount": float}
103 _defaults
= {"type": '', "isDebit": False, "transactionDateTime": '', "amount": 0.0}
105 _refs
= ["WorkTask", "Works", "Design", "MiscCostItems", "WorkCostSummary", "PropertyUnits", "ErpProjectAccounting", "LaborItems", "MaterialItems", "EquipmentItems", "ContractorItems", "OverheadCost", "CostType"]
106 _many_refs
= ["Works", "MiscCostItems", "PropertyUnits", "LaborItems", "MaterialItems", "EquipmentItems", "ContractorItems"]
108 def getWorkTask(self
):
110 return self
._WorkTask
112 def setWorkTask(self
, value
):
113 if self
._WorkTask
is not None:
114 filtered
= [x
for x
in self
.WorkTask
.WorkCostDetails
if x
!= self
]
115 self
._WorkTask
._WorkCostDetails
= filtered
117 self
._WorkTask
= value
118 if self
._WorkTask
is not None:
119 if self
not in self
._WorkTask
._WorkCostDetails
:
120 self
._WorkTask
._WorkCostDetails
.append(self
)
122 WorkTask
= property(getWorkTask
, setWorkTask
)
128 def setWorks(self
, value
):
129 for p
in self
._Works
:
130 filtered
= [q
for q
in p
.WorkCostDetails
if q
!= self
]
131 self
._Works
._WorkCostDetails
= filtered
133 if self
not in r
._WorkCostDetails
:
134 r
._WorkCostDetails
.append(self
)
137 Works
= property(getWorks
, setWorks
)
139 def addWorks(self
, *Works
):
141 if self
not in obj
._WorkCostDetails
:
142 obj
._WorkCostDetails
.append(self
)
143 self
._Works
.append(obj
)
145 def removeWorks(self
, *Works
):
147 if self
in obj
._WorkCostDetails
:
148 obj
._WorkCostDetails
.remove(self
)
149 self
._Works
.remove(obj
)
155 def setDesign(self
, value
):
156 if self
._Design
is not None:
157 filtered
= [x
for x
in self
.Design
.WorkCostDetails
if x
!= self
]
158 self
._Design
._WorkCostDetails
= filtered
161 if self
._Design
is not None:
162 if self
not in self
._Design
._WorkCostDetails
:
163 self
._Design
._WorkCostDetails
.append(self
)
165 Design
= property(getDesign
, setDesign
)
167 def getMiscCostItems(self
):
169 return self
._MiscCostItems
171 def setMiscCostItems(self
, value
):
172 for x
in self
._MiscCostItems
:
173 x
.WorkCostDetail
= None
175 y
._WorkCostDetail
= self
176 self
._MiscCostItems
= value
178 MiscCostItems
= property(getMiscCostItems
, setMiscCostItems
)
180 def addMiscCostItems(self
, *MiscCostItems
):
181 for obj
in MiscCostItems
:
182 obj
.WorkCostDetail
= self
184 def removeMiscCostItems(self
, *MiscCostItems
):
185 for obj
in MiscCostItems
:
186 obj
.WorkCostDetail
= None
188 def getWorkCostSummary(self
):
190 return self
._WorkCostSummary
192 def setWorkCostSummary(self
, value
):
193 if self
._WorkCostSummary
is not None:
194 self
._WorkCostSummary
._WorkCostDetail
= None
196 self
._WorkCostSummary
= value
197 if self
._WorkCostSummary
is not None:
198 self
._WorkCostSummary
.WorkCostDetail
= None
199 self
._WorkCostSummary
._WorkCostDetail
= self
201 WorkCostSummary
= property(getWorkCostSummary
, setWorkCostSummary
)
203 def getPropertyUnits(self
):
205 return self
._PropertyUnits
207 def setPropertyUnits(self
, value
):
208 for p
in self
._PropertyUnits
:
209 filtered
= [q
for q
in p
.WorkCostDetails
if q
!= self
]
210 self
._PropertyUnits
._WorkCostDetails
= filtered
212 if self
not in r
._WorkCostDetails
:
213 r
._WorkCostDetails
.append(self
)
214 self
._PropertyUnits
= value
216 PropertyUnits
= property(getPropertyUnits
, setPropertyUnits
)
218 def addPropertyUnits(self
, *PropertyUnits
):
219 for obj
in PropertyUnits
:
220 if self
not in obj
._WorkCostDetails
:
221 obj
._WorkCostDetails
.append(self
)
222 self
._PropertyUnits
.append(obj
)
224 def removePropertyUnits(self
, *PropertyUnits
):
225 for obj
in PropertyUnits
:
226 if self
in obj
._WorkCostDetails
:
227 obj
._WorkCostDetails
.remove(self
)
228 self
._PropertyUnits
.remove(obj
)
230 def getErpProjectAccounting(self
):
232 return self
._ErpProjectAccounting
234 def setErpProjectAccounting(self
, value
):
235 if self
._ErpProjectAccounting
is not None:
236 filtered
= [x
for x
in self
.ErpProjectAccounting
.WorkCostDetails
if x
!= self
]
237 self
._ErpProjectAccounting
._WorkCostDetails
= filtered
239 self
._ErpProjectAccounting
= value
240 if self
._ErpProjectAccounting
is not None:
241 if self
not in self
._ErpProjectAccounting
._WorkCostDetails
:
242 self
._ErpProjectAccounting
._WorkCostDetails
.append(self
)
244 ErpProjectAccounting
= property(getErpProjectAccounting
, setErpProjectAccounting
)
246 def getLaborItems(self
):
248 return self
._LaborItems
250 def setLaborItems(self
, value
):
251 for x
in self
._LaborItems
:
252 x
.WorkCostDetail
= None
254 y
._WorkCostDetail
= self
255 self
._LaborItems
= value
257 LaborItems
= property(getLaborItems
, setLaborItems
)
259 def addLaborItems(self
, *LaborItems
):
260 for obj
in LaborItems
:
261 obj
.WorkCostDetail
= self
263 def removeLaborItems(self
, *LaborItems
):
264 for obj
in LaborItems
:
265 obj
.WorkCostDetail
= None
267 def getMaterialItems(self
):
269 return self
._MaterialItems
271 def setMaterialItems(self
, value
):
272 for x
in self
._MaterialItems
:
273 x
.WorkCostDetail
= None
275 y
._WorkCostDetail
= self
276 self
._MaterialItems
= value
278 MaterialItems
= property(getMaterialItems
, setMaterialItems
)
280 def addMaterialItems(self
, *MaterialItems
):
281 for obj
in MaterialItems
:
282 obj
.WorkCostDetail
= self
284 def removeMaterialItems(self
, *MaterialItems
):
285 for obj
in MaterialItems
:
286 obj
.WorkCostDetail
= None
288 def getEquipmentItems(self
):
290 return self
._EquipmentItems
292 def setEquipmentItems(self
, value
):
293 for x
in self
._EquipmentItems
:
294 x
.WorkCostDetail
= None
296 y
._WorkCostDetail
= self
297 self
._EquipmentItems
= value
299 EquipmentItems
= property(getEquipmentItems
, setEquipmentItems
)
301 def addEquipmentItems(self
, *EquipmentItems
):
302 for obj
in EquipmentItems
:
303 obj
.WorkCostDetail
= self
305 def removeEquipmentItems(self
, *EquipmentItems
):
306 for obj
in EquipmentItems
:
307 obj
.WorkCostDetail
= None
309 def getContractorItems(self
):
311 return self
._ContractorItems
313 def setContractorItems(self
, value
):
314 for x
in self
._ContractorItems
:
315 x
.WorkCostDetail
= None
317 y
._WorkCostDetail
= self
318 self
._ContractorItems
= value
320 ContractorItems
= property(getContractorItems
, setContractorItems
)
322 def addContractorItems(self
, *ContractorItems
):
323 for obj
in ContractorItems
:
324 obj
.WorkCostDetail
= self
326 def removeContractorItems(self
, *ContractorItems
):
327 for obj
in ContractorItems
:
328 obj
.WorkCostDetail
= None
330 def getOverheadCost(self
):
332 return self
._OverheadCost
334 def setOverheadCost(self
, value
):
335 if self
._OverheadCost
is not None:
336 filtered
= [x
for x
in self
.OverheadCost
.WorkCostDetails
if x
!= self
]
337 self
._OverheadCost
._WorkCostDetails
= filtered
339 self
._OverheadCost
= value
340 if self
._OverheadCost
is not None:
341 if self
not in self
._OverheadCost
._WorkCostDetails
:
342 self
._OverheadCost
._WorkCostDetails
.append(self
)
344 OverheadCost
= property(getOverheadCost
, setOverheadCost
)
346 def getCostType(self
):
348 return self
._CostType
350 def setCostType(self
, value
):
351 if self
._CostType
is not None:
352 filtered
= [x
for x
in self
.CostType
.WorkCostDetails
if x
!= self
]
353 self
._CostType
._WorkCostDetails
= filtered
355 self
._CostType
= value
356 if self
._CostType
is not None:
357 if self
not in self
._CostType
._WorkCostDetails
:
358 self
._CostType
._WorkCostDetails
.append(self
)
360 CostType
= property(getCostType
, setCostType
)