Пример #1
0
    def __init__(self, category_dom, parent):
        """ Constructor
        """

        self.parent = parent

        super(YNAB3_Category, self).__init__(category_dom, \
                [xmlize('name'),  xmlize('note')])
Пример #2
0
    def __init__(self, category_dom, parent):
        """ Constructor
        """

        self.parent = parent

        super(YNAB3_Category, self).__init__(category_dom, \
                [xmlize('name'),  xmlize('note')])
Пример #3
0
    def __init__(self, category_dom, parent):
        """ Constructor
        """

        self.parent = parent

        super(YNAB3_MonthlySubCategoryBudget, self).__init__(category_dom, \
                [xmlize('name')])
Пример #4
0
    def __init__(self, category_dom, parent):
        """ Constructor
        """

        self.parent = parent

        super(YNAB3_MonthlySubCategoryBudget, self).__init__(category_dom, \
                [xmlize('name')])
Пример #5
0
    def __init__(self, transaction_dom):
        """Constructor

        """
        super(YNAB3_Transaction, self).__init__(transaction_dom, [xmlize('accepted'), \
              xmlize('date'), xmlize('account'), xmlize('accountID'),xmlize('payee'), \
              xmlize('category'), xmlize('cleared')])
Пример #6
0
    def __init__(self, transaction_dom):
        """Constructor

        """
        super(YNAB3_Transaction, self).__init__(transaction_dom, [xmlize('accepted'), \
              xmlize('date'), xmlize('account'), xmlize('accountID'),xmlize('payee'), \
              xmlize('category'), xmlize('cleared')])
Пример #7
0
 def __init__(self, category_dom):
     """ Constructor
     """
     
     super(YNAB3_MonthlyBudget, self).__init__(category_dom, \
             [xmlize('categoryName'),  xmlize('month')])
Пример #8
0
    def __init__(self, category_dom):
        """ Constructor
        """

        super(YNAB3_MonthlyBudget, self).__init__(category_dom, \
                [xmlize('categoryName'),  xmlize('month')])
Пример #9
0
class YNAB3_AccountingWidget(object):
    """
    Base class for various YNAB3 things
    (ie. YNAB3_Payee, YNAB3_Transaction)

    """

    dom = None

    fields_of_interest = [xmlize('memo'), xmlize('inflow'), xmlize('outflow')]

    def __init__(self, transaction_dom, additional_fields_of_interest):
        """Constructor

        """

        self.dom = transaction_dom

        for field in additional_fields_of_interest:
            if field not in self.fields_of_interest:
                self.fields_of_interest.append(field)

        for child in transaction_dom.childNodes:
            self.load_properties(child)

    def get_property(self, name):
        """ get a property (return None if it doesn't exist)

        We do this because this class loads properties from the xml
        dynamically, so there's a chance some properties may be missing
        """
        if hasattr(self, name):
            return getattr(self, name)
        return None

    def get_inflow(self):
        """ get_inflow
        """
        return self.get_property('inflow')

    def get_outflow(self):
        """ get_outflow
        """
        return self.get_property('outflow')

    def get_balance(self):
        """ get_balance

        Get the balance for this transaction, accounting
        for both outflow and inflow
        """

        if self.get_outflow() != None and self.get_inflow() != None:
            return float(self.get_inflow()) - float(self.get_outflow())
        else:
            return None

    def get_memo(self):
        """ get_memo
        """

        return self.get_property('memo')

    def toxml(self):
        """ Get XML representation of this objects dom
        """
        return self.dom.toxml()
Пример #10
0
    def __init__(self, category_dom):
        """ Constructor
        """

        super(YNAB3_Category, self).__init__(category_dom, \
                [xmlize('name'),  xmlize('type'), xmlize('note')])
Пример #11
0
 def __init__(self, category_dom):
     """ Constructor
     """
     
     super(YNAB3_Category, self).__init__(category_dom, \
             [xmlize('name'),  xmlize('type'), xmlize('note')])
Пример #12
0
    def __init__(self, payee_dom):
        """Constructor

        """
        
        super(YNAB3_Payee, self).__init__(payee_dom, [xmlize('category')])