[[ repeatIn(objects,'o') ]]

[[ setLang(o.lang) ]]

	[[ o.title.name or '' ]] [[ o.name ]] [[ display_address(o) ]] VAT: [[ o.vat or removeParentNode('para') ]]

Document: Customer account statement

Date: [[ formatLang(time.strftime('%Y-%m-%d'),date=True) ]]

Customer Ref: [[ o.ref or ' ']]

[[ not getLines(o) and removeParentNode('para') or 'Dear Sir/Madam,']]

[[ not getLines(o) and removeParentNode('section') or repeatln(message(o, company), 'line') ]]

[[ line or removeParentNode('para')]]

[[ getLines(o) and removeParentNode('para') or 'There is nothing due with this customer.']]

[[ not getLines(o) and removeParentNode('para') or 'Best regards,']]

Date[[ not getLines(o) and removeParentNode('blockTable') ]]	Description	Ref	Maturity date	Due	Paid	Maturity	Li.

[[repeatIn(getLines(o), 'line') ]]

[[ formatLang(line['date'],date=True) ]]	[[ line['name'] ]]	[[ line['ref'] ]]	[[ line['date_maturity'] and formatLang(line['date_maturity'],date=True) or '' ]]	[[ (line['account_id']['type'] == 'receivable' and formatLang(line['debit']) or 0) or (line['account_id']['type'] == 'payable' and formatLang(line['credit'] * -1) or ' ') ]]	[[ (line['account_id']['type'] == 'receivable' and formatLang(line['credit']) or 0) or (line['account_id']['type'] == 'payable' and formatLang(line['debit'] * -1) or 0) ]]	[[ time.strftime('%Y-%m-%d') > formatLang((line['date_maturity'])) and formatLang(line['debit'] - line['credit'],currency_obj=company.currency_id) ]]	[[ line['blocked'] and 'X' or '' ]]
	[[ not getLines(o) and removeParentNode('blockTable') or 'Sub-Total :']]	[[ formatLang((reduce(lambda x, y: x + ((y['account_id']['type'] == 'receivable' and y['debit'] or 0) or (y['account_id']['type'] == 'payable' and y['credit'] * -1 or 0)), getLines(o), 0))) ]]	[[ formatLang((reduce(lambda x, y: x + ((y['account_id']['type'] == 'receivable' and y['credit'] or 0) or (y['account_id']['type'] == 'payable' and y['debit'] * -1 or 0)), getLines(o), 0))) ]]	[[ formatLang((reduce(lambda x, y: x + (y['debit'] - y['credit']), filter(lambda x: x['date_maturity'] < time.strftime('%Y-%m-%d'), getLines(o)), 0))) ]] [[ company.currency_id.symbol ]]	
	[[ not getLines(o) and removeParentNode('blockTable') or 'Balance :']]	[[ formatLang((reduce(lambda x, y: x +(y['debit'] - y['credit']), getLines(o), 0)), currency_obj = company.currency_id) ]]	

Total amount due: [[ not getLines(o) and removeParentNode('blockTable') or formatLang((reduce(lambda x, y: x + (y['debit'] - y['credit']), getLines(o), 0)), currency_obj=company.currency_id) ]].

ado

2005-10-07T19:06:11