Bumping version for release.
[PyCIM.git] / CIM14 / IEC61968 / Customers / PricingStructure.py
blobb103e8110817dd27ca36e00db9db074860eac350
1 # Copyright (C) 2010 Richard Lincoln
3 # This library is free software; you can redistribute it and/or
4 # modify it under the terms of the GNU Lesser General Public
5 # License as published by the Free Software Foundation; either
6 # version 2.1 of the License, or (at your option) any later version.
8 # This library is distributed in the hope that it will be useful,
9 # but WITHOUT ANY WARRANTY; without even the implied warranty of
10 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
11 # Lesser General Public License for more details.
13 # You should have received a copy of the GNU Lesser General Public
14 # License along with this library; if not, write to the Free Software
15 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA, USA
17 from CIM14.IEC61968.Common.Document import Document
19 class PricingStructure(Document):
20 """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.
21 """
23 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):
24 """Initialises a new 'PricingStructure' instance.
26 @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"
27 @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.
28 @param dailyFloorUsage: Absolute minimum valid non-demand usage quantity used in validating a customer's billed non-demand usage.
29 @param taxExemption: True if this pricing structure is not taxable.
30 @param dailyEstimatedUsage: Used in place of actual computed estimated average when history of usage is not available, and typically manually entered by customer accounting.
31 @param dailyCeilingUsage: Absolute maximum valid non-demand usage quantity used in validating a customer's billed non-demand usage.
32 @param Transactions: All transactions applying this pricing structure.
33 @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.
34 @param CustomerAgreements: All customer agreements with this pricing structure.
35 @param ServiceCategory: Service category to which this pricing structure applies.
36 @param Tariffs: All tariffs used by this pricing structure.
37 """
38 #: (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"
39 self.revenueKind = revenueKind
41 #: 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.
42 self.code = code
44 #: Absolute minimum valid non-demand usage quantity used in validating a customer's billed non-demand usage.
45 self.dailyFloorUsage = dailyFloorUsage
47 #: True if this pricing structure is not taxable.
48 self.taxExemption = taxExemption
50 #: Used in place of actual computed estimated average when history of usage is not available, and typically manually entered by customer accounting.
51 self.dailyEstimatedUsage = dailyEstimatedUsage
53 #: Absolute maximum valid non-demand usage quantity used in validating a customer's billed non-demand usage.
54 self.dailyCeilingUsage = dailyCeilingUsage
56 self._Transactions = []
57 self.Transactions = [] if Transactions is None else Transactions
59 self._ServiceDeliveryPoints = []
60 self.ServiceDeliveryPoints = [] if ServiceDeliveryPoints is None else ServiceDeliveryPoints
62 self._CustomerAgreements = []
63 self.CustomerAgreements = [] if CustomerAgreements is None else CustomerAgreements
65 self._ServiceCategory = None
66 self.ServiceCategory = ServiceCategory
68 self._Tariffs = []
69 self.Tariffs = [] if Tariffs is None else Tariffs
71 super(PricingStructure, self).__init__(*args, **kw_args)
73 _attrs = ["revenueKind", "code", "dailyFloorUsage", "taxExemption", "dailyEstimatedUsage", "dailyCeilingUsage"]
74 _attr_types = {"revenueKind": str, "code": str, "dailyFloorUsage": int, "taxExemption": bool, "dailyEstimatedUsage": int, "dailyCeilingUsage": int}
75 _defaults = {"revenueKind": "industrial", "code": '', "dailyFloorUsage": 0, "taxExemption": False, "dailyEstimatedUsage": 0, "dailyCeilingUsage": 0}
76 _enums = {"revenueKind": "RevenueKind"}
77 _refs = ["Transactions", "ServiceDeliveryPoints", "CustomerAgreements", "ServiceCategory", "Tariffs"]
78 _many_refs = ["Transactions", "ServiceDeliveryPoints", "CustomerAgreements", "Tariffs"]
80 def getTransactions(self):
81 """All transactions applying this pricing structure.
82 """
83 return self._Transactions
85 def setTransactions(self, value):
86 for x in self._Transactions:
87 x.PricingStructure = None
88 for y in value:
89 y._PricingStructure = self
90 self._Transactions = value
92 Transactions = property(getTransactions, setTransactions)
94 def addTransactions(self, *Transactions):
95 for obj in Transactions:
96 obj.PricingStructure = self
98 def removeTransactions(self, *Transactions):
99 for obj in Transactions:
100 obj.PricingStructure = None
102 def getServiceDeliveryPoints(self):
103 """All service delivery points (with prepayment meter running as a stand-alone device, with no CustomerAgreement or Customer) to which this pricing structure applies.
105 return self._ServiceDeliveryPoints
107 def setServiceDeliveryPoints(self, value):
108 for p in self._ServiceDeliveryPoints:
109 filtered = [q for q in p.PricingStructures if q != self]
110 self._ServiceDeliveryPoints._PricingStructures = filtered
111 for r in value:
112 if self not in r._PricingStructures:
113 r._PricingStructures.append(self)
114 self._ServiceDeliveryPoints = value
116 ServiceDeliveryPoints = property(getServiceDeliveryPoints, setServiceDeliveryPoints)
118 def addServiceDeliveryPoints(self, *ServiceDeliveryPoints):
119 for obj in ServiceDeliveryPoints:
120 if self not in obj._PricingStructures:
121 obj._PricingStructures.append(self)
122 self._ServiceDeliveryPoints.append(obj)
124 def removeServiceDeliveryPoints(self, *ServiceDeliveryPoints):
125 for obj in ServiceDeliveryPoints:
126 if self in obj._PricingStructures:
127 obj._PricingStructures.remove(self)
128 self._ServiceDeliveryPoints.remove(obj)
130 def getCustomerAgreements(self):
131 """All customer agreements with this pricing structure.
133 return self._CustomerAgreements
135 def setCustomerAgreements(self, value):
136 for p in self._CustomerAgreements:
137 filtered = [q for q in p.PricingStructures if q != self]
138 self._CustomerAgreements._PricingStructures = filtered
139 for r in value:
140 if self not in r._PricingStructures:
141 r._PricingStructures.append(self)
142 self._CustomerAgreements = value
144 CustomerAgreements = property(getCustomerAgreements, setCustomerAgreements)
146 def addCustomerAgreements(self, *CustomerAgreements):
147 for obj in CustomerAgreements:
148 if self not in obj._PricingStructures:
149 obj._PricingStructures.append(self)
150 self._CustomerAgreements.append(obj)
152 def removeCustomerAgreements(self, *CustomerAgreements):
153 for obj in CustomerAgreements:
154 if self in obj._PricingStructures:
155 obj._PricingStructures.remove(self)
156 self._CustomerAgreements.remove(obj)
158 def getServiceCategory(self):
159 """Service category to which this pricing structure applies.
161 return self._ServiceCategory
163 def setServiceCategory(self, value):
164 if self._ServiceCategory is not None:
165 filtered = [x for x in self.ServiceCategory.PricingStructures if x != self]
166 self._ServiceCategory._PricingStructures = filtered
168 self._ServiceCategory = value
169 if self._ServiceCategory is not None:
170 if self not in self._ServiceCategory._PricingStructures:
171 self._ServiceCategory._PricingStructures.append(self)
173 ServiceCategory = property(getServiceCategory, setServiceCategory)
175 def getTariffs(self):
176 """All tariffs used by this pricing structure.
178 return self._Tariffs
180 def setTariffs(self, value):
181 for p in self._Tariffs:
182 filtered = [q for q in p.PricingStructures if q != self]
183 self._Tariffs._PricingStructures = filtered
184 for r in value:
185 if self not in r._PricingStructures:
186 r._PricingStructures.append(self)
187 self._Tariffs = value
189 Tariffs = property(getTariffs, setTariffs)
191 def addTariffs(self, *Tariffs):
192 for obj in Tariffs:
193 if self not in obj._PricingStructures:
194 obj._PricingStructures.append(self)
195 self._Tariffs.append(obj)
197 def removeTariffs(self, *Tariffs):
198 for obj in Tariffs:
199 if self in obj._PricingStructures:
200 obj._PricingStructures.remove(self)
201 self._Tariffs.remove(obj)