Пример #1
0
from taxes import ISS, ICMS, ICPP, IKCV


class CalculatorTaxes(object):
    def calculates(self, budget, taxe):

        print(round(taxe.calc(budget), 2))


if __name__ == '__main__':

    from budget import Budget, Item

    # Budget One
    budget = Budget()
    budget.add_item(Item('Product 1', 10))
    budget.add_item(Item('Product 2', 5))
    budget.add_item(Item('Product 3', 4))
    budget.add_item(Item('Product 4', 4))
    budget.add_item(Item('Product 5', 4))
    budget.add_item(Item('Product 6', 1))

    # Calculator Taxes
    calculator = CalculatorTaxes()

    print('ISS and ICMS')
    calculator.calculates(budget, ISS())
    calculator.calculates(budget, ICMS())

    print('ISPP and IKCV')
    calculator.calculates(budget, ICPP())
from taxes import ISS, ICMS, ICPP, IKCV


class CalculatorTaxes(object):

    def calculates(self, budget, taxe):
        return taxe.calc(budget)


if __name__ == '__main__':

    from budget import Budget, Item

    # Budget One
    budget = Budget('Budget One')
    budget.add_item(Item('Product 1', 10))
    budget.add_item(Item('Product 2', 5))
    budget.add_item(Item('Product 3', 4))
    budget.add_item(Item('Product 4', 4))
    budget.add_item(Item('Product 5', 4))
    budget.add_item(Item('Product 6', 1))

    # Calculator Taxes
    calculator = CalculatorTaxes()

    print('Budget: %s | Total of items: %s' % (budget.name, budget.total_items))

    print('ISS:  %s' % round(calculator.calculates(budget, ISS()), 2))
    print('ICMS: %s' % round(calculator.calculates(budget, ICMS()), 2))

    print('ISS plus ICMS %s' % round(calculator.calculates(budget, ISS(ICMS())), 2))
Пример #3
0
from discounts import *


class Discount_calculator(object):
    def calculate(self, budget):

        discount = Discount_per_five_items(
            Discount_per_more_then_five_hundred_reais(
                Without_discount())).Calculate(budget)

        return discount


if __name__ == '__main__':

    from budget import Budget, Item

    budget = Budget()
    budget.add_item(Item('Item - 1', 50))
    budget.add_item(Item('Item - 2', 100))
    budget.add_item(Item('Item - 3', 500))

    print('Value without discount', budget.value)

    calculator = Discount_calculator()
    discount = calculator.calculate(budget)
    final_value = budget.value - discount

    print('Value with discount: ', discount)
Пример #4
0
# -*- coding: UTF-8 -*-
from taxes import *


class Tax_calculator(object):
    def performs_calculation(self, budget, tax):
        calculated_tax = tax.calculate(budget)
        print(calculated_tax)


if __name__ == '__main__':
    from budget import Budget, Item

    calculator = Tax_calculator()

    budget = Budget()
    budget.add_item(Item('Item 1 - ', 50))
    budget.add_item(Item('Item 1 - ', 200))
    budget.add_item(Item('Item 1 - ', 250))

    print('ISS and ICMS')
    calculator.performs_calculation(budget, ICMS())
    calculator.performs_calculation(budget, ISS())

    calculator.performs_calculation(budget, ISS(ICMS()))

    print('ICPP and IKCV')
    calculator.performs_calculation(budget, ICPP())
    calculator.performs_calculation(budget, IKCV())

    calculator.performs_calculation(budget, ICPP(IKCV()))