def render_real_htmldiv(self, real_root, price_map, price_date, options_map, file): # Render the income statement tables. operating_currencies = options_map['operating_currency'] income = tree_table.table_of_balances( realization.get(real_root, options_map['name_income']), price_map, price_date, operating_currencies, self.formatter) expenses = tree_table.table_of_balances( realization.get(real_root, options_map['name_expenses']), price_map, price_date, operating_currencies, self.formatter) file.write(""" <div id="income" class="halfleft"> <div id="income"> <h3>Income</h3> {income} </div> </div> <div class="halfright"> <div id="expenses"> <h3>Expenses</h3> {expenses} </div> </div> """.format(**locals()))
def render_real_htmldiv(self, real_root, options_map, file): text = tree_table.table_of_balances(real_root, options_map['operating_currency'], self.formatter, classes=['trial']) balance_cost = realization.compute_balance(real_root).cost() if not balance_cost.is_empty(): text += """ Total Balance: <span class="num">{}</span> """.format(balance_cost) file.write(text)
def render_real_htmldiv(self, real_root, options_map, file): operating_currencies = options_map['operating_currency'] assets = tree_table.table_of_balances( realization.get(real_root, options_map['name_assets']), operating_currencies, self.formatter) liabilities = tree_table.table_of_balances( realization.get(real_root, options_map['name_liabilities']), operating_currencies, self.formatter) equity = tree_table.table_of_balances( realization.get(real_root, options_map['name_equity']), operating_currencies, self.formatter) file.write(""" <div class="halfleft"> <div id="assets"> <h3>Assets</h3> {assets} </div> </div> <div class="halfright"> <div id="liabilities"> <h3>Liabilities</h3> {liabilities} </div> <div class="spacer"> </div> <div id="equity"> <h3>Equity</h3> {equity} </div> </div> """.format(**locals()))
def test_table_of_balances(self): formatter = html_formatter.HTMLFormatter( display_context.DEFAULT_DISPLAY_CONTEXT) html = tree_table.table_of_balances(self.real_root, ['USD', 'CAD'], formatter, classes=['586e8200b379']) self.assertRegex(html, '<table') self.assertRegex(html, 'USD') self.assertRegex(html, 'CAD') self.assertRegex(html, '586e8200b379') self.assertRegex(html, 'Checking') # Check that an inactive account is being skipped. self.assertNotRegex(html, 'Inactive')