本文整理汇总了Python中reportlab.platypus.BaseDocTemplate.approval方法的典型用法代码示例。如果您正苦于以下问题:Python BaseDocTemplate.approval方法的具体用法?Python BaseDocTemplate.approval怎么用?Python BaseDocTemplate.approval使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类reportlab.platypus.BaseDocTemplate
的用法示例。
在下文中一共展示了BaseDocTemplate.approval方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: _create_renewal
# 需要导入模块: from reportlab.platypus import BaseDocTemplate [as 别名]
# 或者: from reportlab.platypus.BaseDocTemplate import approval [as 别名]
def _create_renewal(renewal_buffer, approval, proposal):
site_url = settings.SITE_URL
every_page_frame = Frame(PAGE_MARGIN, PAGE_MARGIN, PAGE_WIDTH - 2 * PAGE_MARGIN,
PAGE_HEIGHT - 160, id='EveryPagesFrame')
every_page_template = PageTemplate(id='EveryPages', frames=[every_page_frame], onPage=_create_approval_header)
doc = BaseDocTemplate(renewal_buffer, pageTemplates=[every_page_template], pagesize=A4)
# this is the only way to get data into the onPage callback function
doc.approval = approval
doc.site_url = site_url
approval_table_style = TableStyle([('VALIGN', (0, 0), (-1, -1), 'TOP')])
elements = []
title = approval.title.encode('UTF-8')
# additional information
'''if approval.additional_information:
elements.append(Spacer(1, SECTION_BUFFER_HEIGHT))
elements.append(Paragraph('Additional Information', styles['BoldLeft']))
elements += _layout_paragraphs(approval.additional_information)'''
# delegation holds the dates, approvale and issuer details.
delegation = []
# proponent details
delegation.append(Spacer(1, SECTION_BUFFER_HEIGHT))
address = proposal.applicant.organisation.postal_address
address_paragraphs = [Paragraph(address.line1, styles['Left']), Paragraph(address.line2, styles['Left']),
Paragraph(address.line3, styles['Left']),
Paragraph('%s %s %s' % (address.locality, address.state, address.postcode), styles['Left']),
Paragraph(address.country.name, styles['Left'])]
delegation.append(Table([[[Paragraph('Licensee:', styles['BoldLeft']), Paragraph('Address', styles['BoldLeft'])],
[Paragraph(_format_name(approval.applicant),
styles['Left'])] + address_paragraphs]],
colWidths=(120, PAGE_WIDTH - (2 * PAGE_MARGIN) - 120),
style=approval_table_style))
expiry_date = approval.expiry_date.strftime(DATE_FORMAT)
full_name = proposal.submitter.get_full_name()
delegation.append(Spacer(1, SECTION_BUFFER_HEIGHT))
delegation.append(Paragraph('Dear {} '.format(full_name), styles['Left']))
delegation.append(Spacer(1, SECTION_BUFFER_HEIGHT))
delegation.append(Paragraph('This is a reminder that your approval: ', styles['Left']))
delegation.append(Spacer(1, SECTION_BUFFER_HEIGHT))
title_with_number = '{} - {}'.format(approval.lodgement_number, title)
delegation.append(Paragraph(title_with_number, styles['InfoTitleLargeLeft']))
delegation.append(Spacer(1, SECTION_BUFFER_HEIGHT))
delegation.append(Paragraph('is due to expire on {}'.format(expiry_date), styles['Left']))
delegation.append(Spacer(1, SECTION_BUFFER_HEIGHT))
delegation.append(Paragraph('Please note that if you have outstanding compliances these are required to be submitted before the approval can be renewed'
, styles['Left']))
delegation.append(Spacer(1, SECTION_BUFFER_HEIGHT))
delegation.append(Paragraph('If you have any queries, contact the {} '
'on {}.'.format(settings.DEP_NAME, settings.DEP_PHONE), styles['Left']))
delegation.append(Spacer(1, SECTION_BUFFER_HEIGHT))
delegation.append(Paragraph('Yours sincerely ', styles['Left']))
delegation.append(Spacer(1, SECTION_BUFFER_HEIGHT))
delegation.append(Spacer(1, SECTION_BUFFER_HEIGHT))
delegation.append(Spacer(1, SECTION_BUFFER_HEIGHT))
delegation.append(Paragraph('DIRECTOR GENERAL', styles['Left']))
delegation.append(Paragraph('{}'.format(settings.DEP_NAME), styles['Left']))
elements.append(KeepTogether(delegation))
doc.build(elements)
return renewal_buffer
示例2: _create_approval
# 需要导入模块: from reportlab.platypus import BaseDocTemplate [as 别名]
# 或者: from reportlab.platypus.BaseDocTemplate import approval [as 别名]
def _create_approval(approval_buffer, approval, proposal, copied_to_permit, user):
site_url = settings.SITE_URL
every_page_frame = Frame(PAGE_MARGIN, PAGE_MARGIN, PAGE_WIDTH - 2 * PAGE_MARGIN,
PAGE_HEIGHT - 160, id='EveryPagesFrame')
every_page_template = PageTemplate(id='EveryPages', frames=[every_page_frame], onPage=_create_approval_header)
doc = BaseDocTemplate(approval_buffer, pageTemplates=[every_page_template], pagesize=A4)
# this is the only way to get data into the onPage callback function
doc.approval = approval
doc.site_url = site_url
region = approval.region if hasattr(approval, 'region') else ''
district = approval.district if hasattr(approval, 'district') else ''
region_district = '{} - {}'.format(region, district) if district else region
approval_table_style = TableStyle([('VALIGN', (0, 0), (-1, -1), 'TOP')])
elements = []
title = approval.title.encode('UTF-8')
#Organization details
address = proposal.applicant.organisation.postal_address
email = proposal.applicant.organisation.organisation_set.all().first().contacts.all().first().email
elements.append(Paragraph(email,styles['BoldLeft']))
elements.append(Spacer(1, SECTION_BUFFER_HEIGHT))
elements.append(Paragraph(_format_name(approval.applicant),styles['BoldLeft']))
elements.append(Paragraph(address.line1, styles['BoldLeft']))
elements.append(Paragraph(address.line2, styles['BoldLeft']))
elements.append(Paragraph(address.line3, styles['BoldLeft']))
elements.append(Paragraph('%s %s %s' % (address.locality, address.state, address.postcode), styles['BoldLeft']))
elements.append(Paragraph(address.country.name, styles['BoldLeft']))
elements.append(Spacer(1, SECTION_BUFFER_HEIGHT))
elements.append(Paragraph(approval.issue_date.strftime(DATE_FORMAT), styles['BoldLeft']))
elements.append(Spacer(1, SECTION_BUFFER_HEIGHT))
#elements.append(Paragraph(title, styles['InfoTitleVeryLargeCenter']))
#elements.append(Paragraph(approval.activity, styles['InfoTitleLargeLeft']))
elements.append(Paragraph('APPROVAL OF PROPOSAL {} {} TO UNDERTAKE DISTURBANCE ACTIVITY IN {}'.format(title, proposal.lodgement_number, region_district), styles['InfoTitleLargeLeft']))
#import ipdb; ipdb.set_trace()
#elements.append(Paragraph(approval.tenure if hasattr(approval, 'tenure') else '', styles['InfoTitleLargeRight']))
elements.append(Spacer(1, SECTION_BUFFER_HEIGHT))
elements.append(Paragraph('The submitted proposal {} {} has been assessed and approved. The approval is granted on the understanding that: '.format(title, proposal.lodgement_number), styles['BoldLeft']))
elements.append(Spacer(1, SECTION_BUFFER_HEIGHT))
list_of_bullets= []
list_of_bullets.append('The potential impacts of the proposal on values the department manages have been removed or minimised to a level \'As Low As Reasonably Practicable\' (ALARP) and the proposal is consistent with departmental objectives, associated management plans and the land use category/s in the activity area.')
list_of_bullets.append('Approval is granted for the period {} to {}. This approval is not valid if {} makes changes to what has been proposed or the proposal has expired. To change the proposal or seek an extension, the proponent must re-submit the proposal for assessment.'.format(approval.start_date.strftime(DATE_FORMAT), approval.expiry_date.strftime(DATE_FORMAT),_format_name(approval.applicant)))
list_of_bullets.append('The proponent accepts responsibility for advising {} of new information or unforeseen threats that may affect the risk of the proposed activity.'.format(settings.DEP_NAME_SHORT))
list_of_bullets.append('Information provided by {0} for the purposes of this proposal will not be provided to third parties without permission from {0}.'.format(settings.DEP_NAME_SHORT))
list_of_bullets.append('The proponent accepts responsibility for supervising and monitoring implementation of activity/ies to ensure compliance with this proposal. {} reserves the right to request documents and records demonstrating compliance for departmental monitoring and auditing.'.format(settings.DEP_NAME_SHORT))
list_of_bullets.append('Non-compliance with the conditions of the proposal may trigger a suspension or withdrawal of the approval for this activity.')
list_of_bullets.append('Management actions listed in Appendix 1 are implemented.')
understandingList = ListFlowable(
[ListItem(Paragraph(a, styles['Left']), bulletColour='black', value='circle') for a in list_of_bullets],
bulletFontName=BOLD_FONTNAME, bulletFontSize=SMALL_FONTSIZE, bulletType='bullet')
#bulletFontName=BOLD_FONTNAME
elements.append(understandingList)
# proposal requirements
requirements = proposal.requirements.all().exclude(is_deleted=True)
if requirements.exists():
elements.append(Spacer(1, SECTION_BUFFER_HEIGHT))
elements.append(Paragraph('The following requirements must be satisfied for the approval of the proposal not to be withdrawn:', styles['BoldLeft']))
elements.append(Spacer(1, SECTION_BUFFER_HEIGHT))
conditionList = ListFlowable(
[Paragraph(a.requirement, styles['Left']) for a in requirements.order_by('order')],
bulletFontName=BOLD_FONTNAME, bulletFontSize=MEDIUM_FONTSIZE)
elements.append(conditionList)
# if copied_to_permit:
# elements.append(Spacer(1, SECTION_BUFFER_HEIGHT))
# elements.append(Paragraph('Assessor Comments', styles['BoldLeft']))
# elements.append(Spacer(1, SECTION_BUFFER_HEIGHT))
# for k,v in copied_to_permit:
# elements.append(Paragraph(v.encode('UTF-8'), styles['Left']))
# elements.append(Paragraph(k.encode('UTF-8'), styles['Left']))
# elements.append(Spacer(1, SECTION_BUFFER_HEIGHT))
elements += _layout_extracted_fields(approval.extracted_fields)
# additional information
'''if approval.additional_information:
elements.append(Spacer(1, SECTION_BUFFER_HEIGHT))
elements.append(Paragraph('Additional Information', styles['BoldLeft']))
elements += _layout_paragraphs(approval.additional_information)'''
# delegation holds the dates, approvale and issuer details.
delegation = []
# dates and licensing officer
# dates_licensing_officer_table_style = TableStyle([('VALIGN', (0, 0), (-2, -1), 'TOP'),
# ('VALIGN', (0, 0), (-1, -1), 'BOTTOM')])
#.........这里部分代码省略.........