Adding CDPSM package.
[PyCIM.git] / CIM14 / IEC61968 / PaymentMetering / CashierShift.py
blob085d9a9bf49dc9d61b91b02a9cc3047d7884679b
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.PaymentMetering.Shift import Shift
19 class CashierShift(Shift):
20 """The operating shift for a cashier, during which he may transact against the CashierShift, subject to VendorShift being open.
21 """
23 def __init__(self, cashFloat=0.0, Receipts=None, Transactions=None, Cashier=None, PointOfSale=None, *args, **kw_args):
24 """Initialises a new 'CashierShift' instance.
26 @param cashFloat: The amount of cash that the cashier brings with him to start his shift and that he will take away at the end of his shift; i.e. the cash float does not get banked.
27 @param Receipts: All Receipts recorded for this Shift.
28 @param Transactions:
29 @param Cashier: Cashier operating this shift.
30 @param PointOfSale: Point of sale that is in operation during this shift.
31 """
32 #: The amount of cash that the cashier brings with him to start his shift and that he will take away at the end of his shift; i.e. the cash float does not get banked.
33 self.cashFloat = cashFloat
35 self._Receipts = []
36 self.Receipts = [] if Receipts is None else Receipts
38 self._Transactions = []
39 self.Transactions = [] if Transactions is None else Transactions
41 self._Cashier = None
42 self.Cashier = Cashier
44 self._PointOfSale = None
45 self.PointOfSale = PointOfSale
47 super(CashierShift, self).__init__(*args, **kw_args)
49 _attrs = ["cashFloat"]
50 _attr_types = {"cashFloat": float}
51 _defaults = {"cashFloat": 0.0}
52 _enums = {}
53 _refs = ["Receipts", "Transactions", "Cashier", "PointOfSale"]
54 _many_refs = ["Receipts", "Transactions"]
56 def getReceipts(self):
57 """All Receipts recorded for this Shift.
58 """
59 return self._Receipts
61 def setReceipts(self, value):
62 for x in self._Receipts:
63 x.CashierShift = None
64 for y in value:
65 y._CashierShift = self
66 self._Receipts = value
68 Receipts = property(getReceipts, setReceipts)
70 def addReceipts(self, *Receipts):
71 for obj in Receipts:
72 obj.CashierShift = self
74 def removeReceipts(self, *Receipts):
75 for obj in Receipts:
76 obj.CashierShift = None
78 def getTransactions(self):
80 return self._Transactions
82 def setTransactions(self, value):
83 for x in self._Transactions:
84 x.CashierShift = None
85 for y in value:
86 y._CashierShift = self
87 self._Transactions = value
89 Transactions = property(getTransactions, setTransactions)
91 def addTransactions(self, *Transactions):
92 for obj in Transactions:
93 obj.CashierShift = self
95 def removeTransactions(self, *Transactions):
96 for obj in Transactions:
97 obj.CashierShift = None
99 def getCashier(self):
100 """Cashier operating this shift.
102 return self._Cashier
104 def setCashier(self, value):
105 if self._Cashier is not None:
106 filtered = [x for x in self.Cashier.CashierShifts if x != self]
107 self._Cashier._CashierShifts = filtered
109 self._Cashier = value
110 if self._Cashier is not None:
111 if self not in self._Cashier._CashierShifts:
112 self._Cashier._CashierShifts.append(self)
114 Cashier = property(getCashier, setCashier)
116 def getPointOfSale(self):
117 """Point of sale that is in operation during this shift.
119 return self._PointOfSale
121 def setPointOfSale(self, value):
122 if self._PointOfSale is not None:
123 filtered = [x for x in self.PointOfSale.CashierShifts if x != self]
124 self._PointOfSale._CashierShifts = filtered
126 self._PointOfSale = value
127 if self._PointOfSale is not None:
128 if self not in self._PointOfSale._CashierShifts:
129 self._PointOfSale._CashierShifts.append(self)
131 PointOfSale = property(getPointOfSale, setPointOfSale)