Class s.d.t.Till(Domain):

Part of stoqlib.domain.till View In Hierarchy

The Till describes the financial operations of a specific day.

The operations that are recorded in a Till:

Each operation is associated with a TillEntry.

You can only open a Till once per day, and you cannot open a new till before you closed the previously opened one.

Instance Variablesinitial_cash_amountThe total amount we have in the moment we are opening the till.
final_cash_amountThe total amount we have in the moment we are closing the till.
opening_dateWhen the till was opened or None if it has not yet been opened.
closing_dateWhen the till was closed or None if it has not yet been closed
stationthe station associated with the till, eg the computer which opened it.
Class VariablesSTATUS_PENDINGthis till is created, but not yet opened
STATUS_OPENthis till is opened and we can make sales for it.
STATUS_CLOSEDend of the day, the till is closed and no more financial operations can be done in this store.
Class Method get_current Fetches the Till for the current station.
Class Method get_last_opened Fetches the last Till which was opened.
Method open_till Open the till.
Method close_till This method close the current till operation with the confirmed
Method add_entry Adds an entry to the till.
Method add_debit_entry Add debit to the till
Method add_credit_entry Add credit to the till
Method needs_closing Checks if there's an open till that needs to be closed before
Method get_balance Returns the balance of all till operations plus the initial amount
Method get_cash_amount Returns the total cash amount on the till. That includes "extra"
Method get_entries Fetches all the entries related to this till
Method get_credits_total Calculates the total credit for all entries in this till
Method get_debits_total Calculates the total debit for all entries in this till
Method _get_last_closed_till Undocumented
Method _add_till_entry Undocumented

Inherited from Domain:

Method __init__ Undocumented
Method _create Undocumented
Method user Undocumented
Class Method iselect Like select, but search on the adapter implementing the interface iface
Class Method iselectBy Like selectBy, but search on the adapter implementing the interface iface
Class Method iselectOne Like selectOne, but search on the adapter implementing the interface iface
Class Method iselectOneBy Like selectOneBy, but search on the adapter implementing the interface iface
Class Method iget Like get, but gets on the adapter implementing the interface iface

Inherited from AbstractModel (via Domain, BaseDomain):

Method __ne__ Undocumented
Method __eq__ Undocumented
Method _SO_setValue Undocumented
Method clone Get a persistent copy of an existent object. Remember that we can
Method get_connection Undocumented

Inherited from AdaptableORMObject (via Domain):

Class Method registerFacet Registers a facet for class cls.

Inherited from Adaptable (via Domain, AdaptableORMObject):

Class Method getFacetType Fetches a facet type associated with an interface, or raise
Class Method getFacetTypes Returns facet classes for this object
Method addFacet Adds a facet implementing iface for the current object
Method removeFacet Removes a facet from the current object
Method getFacets Gets a list of facets assoicated with the current object.
@classmethod
def get_current(cls, conn):
Fetches the Till for the current station.
Parametersconna database connection
Returnsa Till instance or None
@classmethod
def get_last_opened(cls, conn):
Fetches the last Till which was opened. If in doubt, use Till.get_current instead. This method is a special case which is used to be able to close a till without calling get_current()
Parametersconna database connection
def open_till(self):
Open the till.

It can only be done once per day. The final cash amount of the previous till will be used as the initial value in this one after opening it.

def close_till(self):
This method close the current till operation with the confirmed sales associated. If there is a sale with a differente status than SALE_CONFIRMED, a new 'pending' till operation is created and these sales are associated with the current one.
Parametersremoved
def add_entry(self, payment):
Adds an entry to the till.
Parameterspayment
Returnstill entry representing the added debit (type: TillEntry )
def add_debit_entry(self, value, reason=u''):
Add debit to the till
Parametersvalueamount to add
reasondescription of payment
Returnstill entry representing the added debit (type: TillEntry )
def add_credit_entry(self, value, reason=u''):
Add credit to the till
Parametersvalueamount to add
reasondescription of payment
Returnstill entry representing the added credit (type: TillEntry )
def needs_closing(self):
Checks if there's an open till that needs to be closed before we can do any further fiscal operations.
ReturnsTrue if it needs to be closed, otherwise false
def get_balance(self):
Returns the balance of all till operations plus the initial amount cash amount.
Returnsthe balance (type: currency )
def get_cash_amount(self):
Returns the total cash amount on the till. That includes "extra" payments (like cash advance, till complement and so on), the money payments and the initial cash amount.
Returnsthe cash amount on the till (type: currency )
def get_entries(self):
Fetches all the entries related to this till
Returnsall entries (type: sequence of TillEntry )
def get_credits_total(self):
Calculates the total credit for all entries in this till
Returnstotal credit (type: currency )
def get_debits_total(self):
Calculates the total debit for all entries in this till
Returnstotal debit (type: currency )
def _get_last_closed_till(self):
Undocumented
def _add_till_entry(self, value, description, payment=None):
Undocumented
API Documentation for Stoqlib, generated by pydoctor at 2009-07-14 16:00:32.