Update README.rst
[PyCIM.git] / CIM14 / IEC61968 / Customers / PricingStructure.py
blob0bdec28f0762064ef064a8aa34b17a519c86a84d
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
19 # IN THE SOFTWARE.
21 from CIM14.IEC61968.Common.Document import Document
23 class PricingStructure(Document):
24 """Grouping of pricing components and prices used in the creation of customer charges and the eligibility criteria under which these terms may be offered to a customer. The reasons for grouping include state, customer classification, site characteristics, classification (i.e. fee price structure, deposit price structure, electric service price structure, etc.) and accounting requirements.
25 """
27 def __init__(self, revenueKind="industrial", code='', dailyFloorUsage=0, taxExemption=False, dailyEstimatedUsage=0, dailyCeilingUsage=0, Transactions=None, ServiceDeliveryPoints=None, CustomerAgreements=None, ServiceCategory=None, Tariffs=None, *args, **kw_args):
28 """Initialises a new 'PricingStructure' instance.
30 @param revenueKind: (Accounting) Kind of revenue, often used to determine the grace period allowed, before collection actions are taken on a customer (grace periods vary between revenue classes). Values are: "industrial", "streetLight", "other", "nonResidential", "irrigation", "residential", "commercial"
31 @param code: Unique user-allocated key for this pricing structure, used by company representatives to identify the correct price structure for allocating to a customer. For rate schedules it is often prefixed by a state code.
32 @param dailyFloorUsage: Absolute minimum valid non-demand usage quantity used in validating a customer's billed non-demand usage.
33 @param taxExemption: True if this pricing structure is not taxable.
34 @param dailyEstimatedUsage: Used in place of actual computed estimated average when history of usage is not available, and typically manually entered by customer accounting.
35 @param dailyCeilingUsage: Absolute maximum valid non-demand usage quantity used in validating a customer's billed non-demand usage.
36 @param Transactions: All transactions applying this pricing structure.
37 @param ServiceDeliveryPoints: All service delivery points (with prepayment meter running as a stand-alone device, with no CustomerAgreement or Customer) to which this pricing structure applies.
38 @param CustomerAgreements: All customer agreements with this pricing structure.
39 @param ServiceCategory: Service category to which this pricing structure applies.
40 @param Tariffs: All tariffs used by this pricing structure.
41 """
42 #: (Accounting) Kind of revenue, often used to determine the grace period allowed, before collection actions are taken on a customer (grace periods vary between revenue classes). Values are: "industrial", "streetLight", "other", "nonResidential", "irrigation", "residential", "commercial"
43 self.revenueKind = revenueKind
45 #: Unique user-allocated key for this pricing structure, used by company representatives to identify the correct price structure for allocating to a customer. For rate schedules it is often prefixed by a state code.
46 self.code = code
48 #: Absolute minimum valid non-demand usage quantity used in validating a customer's billed non-demand usage.
49 self.dailyFloorUsage = dailyFloorUsage
51 #: True if this pricing structure is not taxable.
52 self.taxExemption = taxExemption
54 #: Used in place of actual computed estimated average when history of usage is not available, and typically manually entered by customer accounting.
55 self.dailyEstimatedUsage = dailyEstimatedUsage
57 #: Absolute maximum valid non-demand usage quantity used in validating a customer's billed non-demand usage.
58 self.dailyCeilingUsage = dailyCeilingUsage
60 self._Transactions = []
61 self.Transactions = [] if Transactions is None else Transactions
63 self._ServiceDeliveryPoints = []
64 self.ServiceDeliveryPoints = [] if ServiceDeliveryPoints is None else ServiceDeliveryPoints
66 self._CustomerAgreements = []
67 self.CustomerAgreements = [] if CustomerAgreements is None else CustomerAgreements
69 self._ServiceCategory = None
70 self.ServiceCategory = ServiceCategory
72 self._Tariffs = []
73 self.Tariffs = [] if Tariffs is None else Tariffs
75 super(PricingStructure, self).__init__(*args, **kw_args)
77 _attrs = ["revenueKind", "code", "dailyFloorUsage", "taxExemption", "dailyEstimatedUsage", "dailyCeilingUsage"]
78 _attr_types = {"revenueKind": str, "code": str, "dailyFloorUsage": int, "taxExemption": bool, "dailyEstimatedUsage": int, "dailyCeilingUsage": int}
79 _defaults = {"revenueKind": "industrial", "code": '', "dailyFloorUsage": 0, "taxExemption": False, "dailyEstimatedUsage": 0, "dailyCeilingUsage": 0}
80 _enums = {"revenueKind": "RevenueKind"}
81 _refs = ["Transactions", "ServiceDeliveryPoints", "CustomerAgreements", "ServiceCategory", "Tariffs"]
82 _many_refs = ["Transactions", "ServiceDeliveryPoints", "CustomerAgreements", "Tariffs"]
84 def getTransactions(self):
85 """All transactions applying this pricing structure.
86 """
87 return self._Transactions
89 def setTransactions(self, value):
90 for x in self._Transactions:
91 x.PricingStructure = None
92 for y in value:
93 y._PricingStructure = self
94 self._Transactions = value
96 Transactions = property(getTransactions, setTransactions)
98 def addTransactions(self, *Transactions):
99 for obj in Transactions:
100 obj.PricingStructure = self
102 def removeTransactions(self, *Transactions):
103 for obj in Transactions:
104 obj.PricingStructure = None
106 def getServiceDeliveryPoints(self):
107 """All service delivery points (with prepayment meter running as a stand-alone device, with no CustomerAgreement or Customer) to which this pricing structure applies.
109 return self._ServiceDeliveryPoints
111 def setServiceDeliveryPoints(self, value):
112 for p in self._ServiceDeliveryPoints:
113 filtered = [q for q in p.PricingStructures if q != self]
114 self._ServiceDeliveryPoints._PricingStructures = filtered
115 for r in value:
116 if self not in r._PricingStructures:
117 r._PricingStructures.append(self)
118 self._ServiceDeliveryPoints = value
120 ServiceDeliveryPoints = property(getServiceDeliveryPoints, setServiceDeliveryPoints)
122 def addServiceDeliveryPoints(self, *ServiceDeliveryPoints):
123 for obj in ServiceDeliveryPoints:
124 if self not in obj._PricingStructures:
125 obj._PricingStructures.append(self)
126 self._ServiceDeliveryPoints.append(obj)
128 def removeServiceDeliveryPoints(self, *ServiceDeliveryPoints):
129 for obj in ServiceDeliveryPoints:
130 if self in obj._PricingStructures:
131 obj._PricingStructures.remove(self)
132 self._ServiceDeliveryPoints.remove(obj)
134 def getCustomerAgreements(self):
135 """All customer agreements with this pricing structure.
137 return self._CustomerAgreements
139 def setCustomerAgreements(self, value):
140 for p in self._CustomerAgreements:
141 filtered = [q for q in p.PricingStructures if q != self]
142 self._CustomerAgreements._PricingStructures = filtered
143 for r in value:
144 if self not in r._PricingStructures:
145 r._PricingStructures.append(self)
146 self._CustomerAgreements = value
148 CustomerAgreements = property(getCustomerAgreements, setCustomerAgreements)
150 def addCustomerAgreements(self, *CustomerAgreements):
151 for obj in CustomerAgreements:
152 if self not in obj._PricingStructures:
153 obj._PricingStructures.append(self)
154 self._CustomerAgreements.append(obj)
156 def removeCustomerAgreements(self, *CustomerAgreements):
157 for obj in CustomerAgreements:
158 if self in obj._PricingStructures:
159 obj._PricingStructures.remove(self)
160 self._CustomerAgreements.remove(obj)
162 def getServiceCategory(self):
163 """Service category to which this pricing structure applies.
165 return self._ServiceCategory
167 def setServiceCategory(self, value):
168 if self._ServiceCategory is not None:
169 filtered = [x for x in self.ServiceCategory.PricingStructures if x != self]
170 self._ServiceCategory._PricingStructures = filtered
172 self._ServiceCategory = value
173 if self._ServiceCategory is not None:
174 if self not in self._ServiceCategory._PricingStructures:
175 self._ServiceCategory._PricingStructures.append(self)
177 ServiceCategory = property(getServiceCategory, setServiceCategory)
179 def getTariffs(self):
180 """All tariffs used by this pricing structure.
182 return self._Tariffs
184 def setTariffs(self, value):
185 for p in self._Tariffs:
186 filtered = [q for q in p.PricingStructures if q != self]
187 self._Tariffs._PricingStructures = filtered
188 for r in value:
189 if self not in r._PricingStructures:
190 r._PricingStructures.append(self)
191 self._Tariffs = value
193 Tariffs = property(getTariffs, setTariffs)
195 def addTariffs(self, *Tariffs):
196 for obj in Tariffs:
197 if self not in obj._PricingStructures:
198 obj._PricingStructures.append(self)
199 self._Tariffs.append(obj)
201 def removeTariffs(self, *Tariffs):
202 for obj in Tariffs:
203 if self in obj._PricingStructures:
204 obj._PricingStructures.remove(self)
205 self._Tariffs.remove(obj)