Kraken report mostly works
This commit is contained in:
parent
9b337c455e
commit
4e3ac4b693
|
@ -41,6 +41,7 @@ FONT_HEADER = openpyxl.styles.Font(size=20)
|
||||||
ALIGN_CENTER = openpyxl.styles.Alignment(horizontal="center", vertical="center")
|
ALIGN_CENTER = openpyxl.styles.Alignment(horizontal="center", vertical="center")
|
||||||
ALIGN_WRAP = openpyxl.styles.Alignment(wrap_text=True)
|
ALIGN_WRAP = openpyxl.styles.Alignment(wrap_text=True)
|
||||||
BORDER_BOTTOM = openpyxl.styles.Border(bottom=openpyxl.styles.Side(border_style='medium', color='FF000000'))
|
BORDER_BOTTOM = openpyxl.styles.Border(bottom=openpyxl.styles.Side(border_style='medium', color='FF000000'))
|
||||||
|
BORDER_TOP = openpyxl.styles.Border(top=openpyxl.styles.Side(border_style='thin', color='FF000000'))
|
||||||
BORDER_SUM = openpyxl.styles.Border(top=openpyxl.styles.Side(border_style='thin', color='FF000000'),
|
BORDER_SUM = openpyxl.styles.Border(top=openpyxl.styles.Side(border_style='thin', color='FF000000'),
|
||||||
bottom=openpyxl.styles.Side(border_style='double', color='FF000000'))
|
bottom=openpyxl.styles.Side(border_style='double', color='FF000000'))
|
||||||
|
|
||||||
|
@ -79,11 +80,11 @@ def write_current_assets(sheet, tax_report: TaxReport):
|
||||||
row_idx += 1
|
row_idx += 1
|
||||||
del asset, positions, row, total_amount
|
del asset, positions, row, total_amount
|
||||||
|
|
||||||
sheet.column_dimensions['A'].width = 16
|
sheet.column_dimensions['A'].width = 14
|
||||||
sheet.column_dimensions['B'].width = 16
|
sheet.column_dimensions['B'].width = 12
|
||||||
sheet.column_dimensions['C'].width = 15
|
sheet.column_dimensions['C'].width = 12
|
||||||
sheet.column_dimensions['D'].width = 15
|
sheet.column_dimensions['D'].width = 15
|
||||||
sheet.column_dimensions['E'].width = 15
|
sheet.column_dimensions['E'].width = 20
|
||||||
set_number_format(sheet, 'C1:D6')
|
set_number_format(sheet, 'C1:D6')
|
||||||
|
|
||||||
def write_ledger_sheet(sheet, tax_report: TaxReport):
|
def write_ledger_sheet(sheet, tax_report: TaxReport):
|
||||||
|
@ -111,7 +112,18 @@ def write_ledger_sheet(sheet, tax_report: TaxReport):
|
||||||
ledger_entry.amount.amount,
|
ledger_entry.amount.amount,
|
||||||
ledger_entry.account_provider,
|
ledger_entry.account_provider,
|
||||||
'',
|
'',
|
||||||
] + [(ledger_entry.balance.amount if ledger_entry.amount.asset == a else '') for a in assets]
|
]
|
||||||
|
for a_idx, a in enumerate(assets):
|
||||||
|
above_cell = f'{get_column_letter(7+a_idx)}{row_idx-1}'
|
||||||
|
if row_idx == 2:
|
||||||
|
above_cell = 0
|
||||||
|
if ledger_entry.amount.asset == a:
|
||||||
|
row.append(f'={above_cell} + D{row_idx}')
|
||||||
|
else:
|
||||||
|
row.append(f'={above_cell}')
|
||||||
|
|
||||||
|
del a
|
||||||
|
|
||||||
sheet.append(row)
|
sheet.append(row)
|
||||||
|
|
||||||
if entry_time != prev_entry_time and prev_entry_time is not None:
|
if entry_time != prev_entry_time and prev_entry_time is not None:
|
||||||
|
@ -119,6 +131,10 @@ def write_ledger_sheet(sheet, tax_report: TaxReport):
|
||||||
sheet.merge_cells(f'A{start_of_same_entry}:A{row_idx-1}')
|
sheet.merge_cells(f'A{start_of_same_entry}:A{row_idx-1}')
|
||||||
sheet[f'A{start_of_same_entry}'].alignment = ALIGN_CENTER
|
sheet[f'A{start_of_same_entry}'].alignment = ALIGN_CENTER
|
||||||
start_of_same_entry = row_idx
|
start_of_same_entry = row_idx
|
||||||
|
|
||||||
|
for row in sheet[f'A{row_idx}:J{row_idx}']:
|
||||||
|
for cell in row:
|
||||||
|
cell.border = BORDER_TOP
|
||||||
prev_entry_time = entry_time
|
prev_entry_time = entry_time
|
||||||
row_idx+= 1
|
row_idx+= 1
|
||||||
del ledger_entry, row
|
del ledger_entry, row
|
||||||
|
@ -195,7 +211,7 @@ def write_fifo_sheet(sheet, bought_and_sold_for: list, exchange_rate_at_time) ->
|
||||||
sheet.column_dimensions['B'].width = 20
|
sheet.column_dimensions['B'].width = 20
|
||||||
sheet.column_dimensions['C'].width = 16
|
sheet.column_dimensions['C'].width = 16
|
||||||
sheet.column_dimensions['D'].width = 10
|
sheet.column_dimensions['D'].width = 10
|
||||||
sheet.column_dimensions['E'].width = 15
|
sheet.column_dimensions['E'].width = 18
|
||||||
sheet.column_dimensions['F'].width = 15
|
sheet.column_dimensions['F'].width = 15
|
||||||
sheet.column_dimensions['G'].width = 26
|
sheet.column_dimensions['G'].width = 26
|
||||||
sheet.column_dimensions['H'].width = 20
|
sheet.column_dimensions['H'].width = 20
|
||||||
|
|
Loading…
Reference in New Issue
Block a user