Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 15 additions & 15 deletions django_ledger/report/balance_sheet.py
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ def print_section_data(self, section_data):
self.cell(
w=self.get_string_width(d['role_name']),
h=2,
txt=d['role_name']
text=d['role_name']
)
self.ln(h=5)

Expand All @@ -75,47 +75,47 @@ def print_section_data(self, section_data):
self.cell(
w=self.TABLE_HEADERS['role']['width'],
h=account_height,
txt=''
text=''
)
self.cell(
w=self.TABLE_HEADERS['code']['width'],
h=account_height,
txt=' {code}'.format(code=acc['code'])
text=' {code}'.format(code=acc['code'])
)

if acc['activity']:
act = ' '.join(acc['activity'].split('_')).lower()
self.cell(
w=self.TABLE_HEADERS['name']['width'],
h=account_height,
txt=f'{acc["name"]} ({act})'
text=f'{acc["name"]} ({act})'
)
else:
self.cell(
w=self.TABLE_HEADERS['name']['width'],
h=account_height,
txt=acc['name']
text=acc['name']
)

self.cell(
w=self.TABLE_HEADERS['balance_type']['width'],
h=account_height,
txt=acc['balance_type'],
text=acc['balance_type'],
align='C'
)
self.cell(
w=self.TABLE_HEADERS['balance']['width'],
h=account_height,
align='R',
txt=f"{self.CURRENCY_SYMBOL}{currency_format(acc['balance'])}"
text=f"{self.CURRENCY_SYMBOL}{currency_format(acc['balance'])}"
)
self.ln(5)

self.set_font(self.FONT_FAMILY, style='B', size=self.FONT_SIZE)
self.cell(
w=20,
h=2,
txt='Total {r}'.format(r=d['role_name'])
text='Total {r}'.format(r=d['role_name'])
)

self.set_font(self.FONT_FAMILY, style='B', size=self.FONT_SIZE + 1)
Expand All @@ -124,7 +124,7 @@ def print_section_data(self, section_data):
w=20,
h=2,
align='R',
txt='{s}{tot}'.format(s=currency_symbol(),
text='{s}{tot}'.format(s=currency_symbol(),
tot=currency_format(d['total_balance']))
)
self.ln(3)
Expand All @@ -148,7 +148,7 @@ def print_assets(self):
w=20,
h=2,
align='R',
txt='Total Assets: {s}{tot}'.format(s=currency_symbol(),
text='Total Assets: {s}{tot}'.format(s=currency_symbol(),
tot=currency_format(section_data['total_balance']))
)
self.ln(h=5)
Expand All @@ -168,7 +168,7 @@ def print_liabilities(self):
w=20,
h=2,
align='R',
txt='Total Liabilities: {s}{tot}'.format(s=currency_symbol(),
text='Total Liabilities: {s}{tot}'.format(s=currency_symbol(),
tot=currency_format(section_data['total_balance']))
)
self.ln(h=5)
Expand All @@ -189,14 +189,14 @@ def print_equity(self):
self.cell(
w=20,
h=2,
txt='Retained Earnings'
text='Retained Earnings'
)
self.set_x(180)
self.cell(
w=20,
h=2,
align='R',
txt='{s}{tot}'.format(r='Retained Earnings',
text='{s}{tot}'.format(r='Retained Earnings',
s=currency_symbol(),
tot=currency_format(bs_data['retained_earnings_balance']))
)
Expand All @@ -210,7 +210,7 @@ def print_equity(self):
w=20,
h=2,
align='R',
txt='Total Equity: {s}{tot}'.format(s=currency_symbol(),
text='Total Equity: {s}{tot}'.format(s=currency_symbol(),
tot=currency_format(bs_data['equity_balance']))
)
self.ln(h=10)
Expand All @@ -221,7 +221,7 @@ def print_equity(self):
w=20,
h=2,
align='R',
txt='Total Liabilities + Equity: {s}{tot}'.format(s=currency_symbol(),
text='Total Liabilities + Equity: {s}{tot}'.format(s=currency_symbol(),
tot=currency_format(
bs_data['liabilities_equity_balance']))
)
Expand Down
2 changes: 1 addition & 1 deletion django_ledger/report/cash_flow_statement.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ def print_amount(self, amt, zoom=0):
h=5,
markdown=True,
align='R',
txt=f'**{self.CURRENCY_SYMBOL}{currency_format(amt)}**'
text=f'**{self.CURRENCY_SYMBOL}{currency_format(amt)}**'
)
self.set_default_font()

Expand Down
44 changes: 32 additions & 12 deletions django_ledger/report/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,13 @@ def header(self):
)
w = self.get_string_width(self.get_report_name())
self.set_x((self.PAGE_WIDTH - w) / 2)
self.cell(w, 3, self.get_report_name(), ln=1)
self.cell(
w=w,
h=3,
text=self.get_report_name(),
new_x=XPos.LMARGIN,
new_y=YPos.NEXT,
)

# Report Title
self.set_font(
Expand All @@ -64,7 +70,7 @@ def header(self):
self.set_x((self.PAGE_WIDTH - w) / 2)
self.cell(w=w,
h=6,
txt=report_title,
text=report_title,
border=0,
new_x=XPos.LMARGIN,
new_y=YPos.NEXT,
Expand All @@ -80,7 +86,7 @@ def header(self):
self.set_x((self.PAGE_WIDTH - w) / 2)
self.cell(w=w,
h=6,
txt=self.REPORT_SUBTITLE.title(),
text=self.REPORT_SUBTITLE.title(),
border=0,
new_x=XPos.LMARGIN,
new_y=YPos.NEXT,
Expand All @@ -106,7 +112,7 @@ def header(self):
self.set_x((self.PAGE_WIDTH - w) / 2)
self.cell(w=w,
h=5,
txt=period,
text=period,
new_x=XPos.LMARGIN,
new_y=YPos.NEXT,
align='C')
Expand All @@ -125,7 +131,7 @@ def print_headers(self):
self.cell(
w=w,
h=5,
txt=header['title'],
text=header['title'],
align=header['align'],
)
self.ln(8)
Expand All @@ -142,7 +148,7 @@ def print_amount(self, amt, zoom=0):
h=5,
markdown=True,
align='R',
txt=f'**{self.CURRENCY_SYMBOL}{currency_format(amt)}**'
text=f'**{self.CURRENCY_SYMBOL}{currency_format(amt)}**'
)
self.set_default_font()

Expand Down Expand Up @@ -189,24 +195,38 @@ def print_section_title(self, title, style='BU', zoom=4, w=160, align='L'):
self.cell(
w=w,
h=6,
txt=title,
text=title,
align=align
)
self.set_default_font()

def footer(self):
self.set_y(-25)
self.set_font(self.FONT_FAMILY, 'I', 8)
self.cell(0, 5, 'Page ' + str(self.page_no()) + '/{nb}', 0, 1, 'C')
self.cell(
w=0,
h=5,
text=f'Page {self.page_no()}/{{nb}}',
border=0,
new_x=XPos.LMARGIN,
new_y=YPos.NEXT,
align='C',
)
self.set_font(family=self.FONT_FAMILY, size=self.FONT_SIZE - 3)
self.image(self.get_report_footer_logo_path(),
w=30, x=(200 - 30) / 2,
link='https://www.djangoledger.com')
self.ln(1)
self.cell(0, 5,
'Powered by Django Ledger. Open Source software under GPLv3 License. '
'Created by Miguel Sanda <msanda@arrobalytics.com>',
0, 1, 'C')
self.cell(
w=0,
h=5,
text='Powered by Django Ledger. Open Source software under GPLv3 License. '
'Created by Miguel Sanda <msanda@arrobalytics.com>',
border=0,
new_x=XPos.LMARGIN,
new_y=YPos.NEXT,
align='C'
)

def create_pdf_report(self):
raise NotImplementedError()
Expand Down
Loading