Esempio n. 1
0
    def setUp(self):
        self.gl_structure = GeneralLedgerStructure("NameA",
                                                   description="DescriptionA")
        self.sales_acc = self.gl_structure._acci_sales_.create_account(
            "sales_default", "0000")
        self.cos_acc = self.gl_structure._acci_cos_.create_account(
            "cos_default", "0000")
        self.reva_acc = self.gl_structure["Other Income"].create_account(
            "RevA", number="011")
        self.expa_acc = self.gl_structure["Expense"].create_account(
            "ExpenseA", number="011")

        self.object = Entity("EntityA",
                             gl_structure=self.gl_structure,
                             description="DescriptionA")
        # Set up the needed objects
        self.comp1 = self.object.create_component("ComponentA1",
                                                  description="ca1")
        basic_activity = BasicActivity("BasicActivityA",
                                       description="DescriptionA",
                                       dt_account="Bank",
                                       cr_account="Sales",
                                       amount=5000,
                                       start=datetime(2016, 2, 1),
                                       end=datetime(2017, 2, 1),
                                       interval=1)
        self.comp1.add_activity(basic_activity)

        self.clock = Clock("NameA", start_datetime=datetime(2016, 1, 1))
Esempio n. 2
0
 def setUp(self):
     self.structure = GeneralLedgerStructure("NameA",
                                             description="DescriptionA")
     self.structure["Retained Income"].create_account(
         "TestA", description="TestA_Desc", number="010")
     self.object = GeneralLedger("NameA",
                                 self.structure,
                                 description="DescriptionA")
Esempio n. 3
0
    def test_run(self):
        """
        Test that the activity run method creates a transaction with an amount
        of 5000.
        """

        structure = GeneralLedgerStructure("NameA", description="DescriptionA")
        gl = GeneralLedger("NameA", structure, description="DescriptionA")
        clock = Clock("NameA", start_datetime=datetime(2016, 1, 1))
        clock.tick()
        clock.tick()
        self.object.prepare_to_run(clock, 20)
        self.object.run(clock, gl)
        self.assertEqual(len(gl.transactions), 1)
        self.assertEqual(gl.transactions[0].amount, 5000)
Esempio n. 4
0
 def test_run(self):
     """
     Test that the component runs its activities.
     """
     # Set up the general ledger so that an activity can create a
     # transaction.
     structure = GeneralLedgerStructure("NameA", description="DescriptionA")
     gl = GeneralLedger("NameA", structure, description="DescriptionA")
     # Prepare the component for a run. Tick the clock to the correct place
     # for the activity to create a transaction.
     clock = Clock("NameA", start_datetime=datetime(2016, 1, 1))
     clock.tick()
     clock.tick()
     self.object.prepare_to_run(clock, 20)
     self.object.run(clock, gl)
     # If the activity has been run, then a transaction should have
     # been generated.
     self.assertEqual(len(gl.transactions), 1)
Esempio n. 5
0
 def setUp(self):
     self.gl_structure = GeneralLedgerStructure("NameA",
                                                description="DescriptionA")
     self.gl_structure["Sales"].create_account("Default", number="0000")
     self.gl = GeneralLedger("NameA",
                             self.gl_structure,
                             description="DescriptionA")
     self.object = Component("ComponentA",
                             self.gl,
                             description="DescriptionA")
     # Set up the needed objects
     self.object.create_component("ComponentA1", description="ca1")
     self.object.create_component("ComponentA2", description="ca2")
     self.basic_activity = BasicActivity("BasicActivityA",
                                         description="DescriptionA",
                                         dt_account="Bank/Default",
                                         cr_account="Sales/Default",
                                         amount=5000,
                                         start=datetime(2016, 2, 1),
                                         end=datetime(2017, 2, 1),
                                         interval=3)
     self.object["ComponentA1"].add_activity(self.basic_activity)
Esempio n. 6
0
 def setUp(self):
     self.object = TimeBasedModel("TimeBasedModelA",
                                  description="TimeBasedModel A",
                                  start_datetime=datetime(2016, 2, 1),
                                  period_duration=TimePeriod.day,
                                  period_count=200)
     # Set up the needed objects
     self.gl_structure = GeneralLedgerStructure("NameA",
                                                description="DescriptionA")
     entity = self.object.create_entity("EntityA",
                                        self.gl_structure,
                                        description="DescriptionA")
     # Set up the needed objects
     comp1 = entity.create_component("ComponentA1", description="ca1")
     basic_activity = BasicActivity("BasicActivityA",
                                    description="DescriptionA",
                                    dt_account="Bank",
                                    cr_account="Sales",
                                    amount=5000,
                                    start=datetime(2016, 2, 1),
                                    end=datetime(2016, 2, 14),
                                    interval=1)
     comp1.activities.append(basic_activity)
Esempio n. 7
0
    def setUp(self):
        self.gl_structure = GeneralLedgerStructure(
            "GL Structure", description="General Ledger Structure")
        self.gl_structure["Account Payable"].create_account(
            "Capital Loan", "0000")
        self.gl_structure["Expense"].create_account("Interest Expense", "0000")

        self.gl = GeneralLedger("GL",
                                self.gl_structure,
                                description="General Ledger")

        self.clock = Clock("NameA", start_datetime=datetime(2016, 2, 1))

        self.object = BasicLoanActivity(
            "Capital Loan",
            bank_account="Bank/Default",
            loan_account="Account Payable/Capital Loan",
            interest_account="Expense/Interest Expense",
            amount=180000,
            interest_rate=0.15,
            start=datetime(2016, 2, 1),
            duration=36,
            interval=1,
            description="Loan for Capital")
Esempio n. 8
0
 def setUp(self):
     self.object = GeneralLedgerStructure("NameA",
                                          description="DescriptionA")
Esempio n. 9
0
from datetime import datetime
from dateutil.relativedelta import relativedelta

from auxi.core.time import TimePeriod
from auxi.modelling.business.models import TimeBasedModel
from auxi.modelling.business.basic import BasicActivity, BasicLoanActivity
from auxi.modelling.financial.des import GeneralLedgerStructure
from auxi.core.reporting import ReportFormat

# Create general ledger structure and accounts.
gl_structure = GeneralLedgerStructure("Courier GL Structure")

gl_structure["Long Term Borrowing"].create_account("Loan", "0000")
gl_structure["Expense"].create_account("Interest Expense", "0000")
gl_structure["Fixed Assets"].create_account("Vehicle Asset", "0000")
gl_structure["Sales"].create_account("Sales Delivery", "0000")
gl_structure["Cost of Sales"].create_account("Fuel", "0000")
gl_structure["Expense"].create_account("Wages", "0000")

# Create the business model, entity and components.
start_datetime = datetime(2016, 2, 1)
end_datetime = datetime(2021, 1, 1)

model = TimeBasedModel("Business Model", start_datetime=start_datetime,
                       period_duration=TimePeriod.month, period_count=61)

courier_company = model.create_entity("CourierZA", gl_structure=gl_structure)
ops = courier_company.create_component("Operations")
hr = courier_company.create_component("HR")

# Create activities