'Draws the boxes containing the totals and the tax id.'

def draw_totals(self, y_pos):

    totals_data = [[_('Total'), self.total_cost], [_('Payment    Received'), self.payment_received], [_('Balance'), self.balance]]
    if self.is_invoice:
        totals_data.append(['', '{tax_label}:        {tax_id}'.format(tax_label=self.tax_label, tax_id=self.tax_id)])
    heights = (8 * mm)
    totals_table = Table(totals_data, (40 * mm), heights)
    styles = [('ALIGN', (0, 0), ((-1), (-1)), 'RIGHT'), ('VALIGN', (0, 0), ((-1), (-1)), 'MIDDLE'), ('TEXTCOLOR', (0, 0), ((-1), (-1)), colors.black), ('RIGHTPADDING', ((-1), 0), ((-1), 2), (7 * mm)), ('GRID', ((-1), 0), ((-1), 2), 3.0, colors.white), ('BACKGROUND', ((-1), 0), ((-1), 2), '#EEEEEE')]
    totals_table.setStyle(TableStyle(styles))
    (__, rendered_height) = totals_table.wrap(0, 0)
    left_padding = (97 * mm)
    if ((y_pos - (self.margin + self.min_clearance)) <= rendered_height):
        self.prepare_new_page()
        totals_table.drawOn(self.pdf, (self.margin + left_padding), (self.second_page_start_y_pos - rendered_height))
        return ((self.second_page_start_y_pos - rendered_height) - self.min_clearance)
    else:
        totals_table.drawOn(self.pdf, (self.margin + left_padding), (y_pos - rendered_height))
        return ((y_pos - rendered_height) - self.min_clearance)
