示例#1
0
    def update_entries(self):
        from dal.dao import Dao
        from models.invoice import Invoice

        dao = Dao(stateful=True)

        invoice_rex = self.import_spreadsheet()

        for invoice_rec in list(invoice_rex):
            ledger_rec = Invoice.get_by_invoice(dao, invoice_rec.invoice_num)
            if ledger_rec:
                ledger_rec.update_balance(dao, invoice_rec.amount)

        new_rex = Invoice.get_rex(dao)

        dao.close()

        gbl.dataset.set_ledger_data(new_rex)
        self.init_view()
示例#2
0
    def _get_data(self):
        from dal.dao import Dao
        from tests.ledger_data.test_data import invoices_q2_pre_query

        from models.employee import Employee
        from models.department import Department
        from models.grant_admin import GrantAdmin
        from models.invoice import Invoice
        from models.assignment import Assignment

        dao = Dao(db_path=self.db_path, stateful=True)
        self._emp_rex = Employee.get_all(dao)
        self._dept_rex = Department.get_all(dao)
        self._grant_admin_rex = GrantAdmin.get_all(dao)
        invoices_unpaid = Invoice.get_rex(dao)
        # invoices_unpaid = invoices_q2
        self._invoices_sent = [
            invoice for invoice in invoices_unpaid if invoice.sent
        ]
        self._invoices_unsent = [
            invoice for invoice in invoices_unpaid if not invoice.sent
        ]
        self._asn_rex = Assignment.get_billables(dao)
        dao.close()