def __titles(worksheet, header_dict): titles = [ { 'title': "Market", 'style': 'sky_header', 'width': 11 }, { 'title': "Student's Full Name", 'style': 'sky_header', 'width': 40 }, { 'title': "Student's Birth Date", 'style': 'sky_header', 'width': 23 }, { 'title': "Type of Program", 'style': 'sky_header', 'width': 20 }, { 'title': "Program Name", 'style': 'sky_header', 'width': 50 }, { 'title': "Consultant's Common Name", 'style': 'sky_header', 'width': 40 }, { 'title': "How did you find us?", 'style': 'sky_header', 'width': 24 }, { 'title': "Referred by/details?", 'style': 'sky_header', 'width': 35 }, { 'title': "Student's Email Address", 'style': 'sky_header', 'width': 37 }, { 'title': "Parent 1 Email", 'style': 'sky_header', 'width': 37 }, { 'title': "Parent 2 Email", 'style': 'sky_header', 'width': 37 }, ] create_titles(worksheet, titles, header_dict)
def __titles(worksheet, header_dict): titles = [{ 'title': "Market", 'style': 'sky_header', 'width': 11 }, { 'title': "Year", 'style': 'sky_header', 'width': 9 }, { 'title': "Status", 'style': 'sky_header', 'width': 11 }, { 'title': "Student's Full Name", 'style': 'sky_header', 'width': 40 }, { 'title': "Type of Program", 'style': 'sky_header', 'width': 20 }, { 'title': "Program Name", 'style': 'sky_header', 'width': 50 }, { 'title': "Period", 'style': 'sky_header', 'width': 12 }, { 'title': "Consultant's Common Name", 'style': 'sky_header', 'width': 40 }, { 'title': "Supervisor's Common Name", 'style': 'sky_header', 'width': 40 }, { 'title': "Created by", 'style': 'sky_header', 'width': 40 }] create_titles(worksheet, titles, header_dict)
def my_consultant_titles(worksheet, header_dict, dto): titles = [ {'title': u"Year", 'style': 'student_header', 'width': 9}, {'title': u"AAII#", 'style': 'student_header', 'width': 9}, {'title': u"Status", 'style': 'student_header', 'width': 11}, {'title': u"Registration Date", 'style': 'student_header', 'width': 20}, {'title': u"Student's Full Name", 'style': 'student_header', 'width': 40}, {'title': u"Student's Ad Astra Code", 'style': 'student_header', 'width': 34}, {'title': u"Type of Program", 'style': 'student_header', 'width': 19}, {'title': u"Program Name", 'style': 'student_header', 'width': 40}, {'title': u"Consultant's Common Name", 'style': 'student_header', 'width': 40}, {'title': u"Supervisor's Common Name", 'style': 'student_header', 'width': 40}, {'title': u"Period", 'style': 'student_header', 'width': 12}, {'title': u"Program Start Date", 'style': 'student_header', 'width': 21}, {'title': u"Program End Date", 'style': 'student_header', 'width': 21}, {'title': u"Notes", 'style': 'student_header', 'width': 50} ] create_titles(worksheet, titles, header_dict)
def my_sales_titles(worksheet, header_dict, dto): titles = [ { 'title': u"Year", 'style': 'student_header', 'width': 9 }, { 'title': u"AAII#", 'style': 'student_header', 'width': 10 }, { 'title': u"Status", 'style': 'student_header', 'width': 11 }, { 'title': u"Registration Date", 'style': 'student_header', 'width': 21 }, { 'title': u"Student's Full Name", 'style': 'student_header', 'width': 40 }, { 'title': u"Student's Ad Astra Code", 'style': 'student_header', 'width': 31 }, { 'title': u"Type of Program", 'style': 'student_header', 'width': 20 }, { 'title': u"Program", 'style': 'student_header', 'width': 40 }, { 'title': u"Consultant's Name", 'style': 'student_header', 'width': 40 }, { 'title': u"Supervisor's Name", 'style': 'student_header', 'width': 40 }, { 'title': u"Period", 'style': 'student_header', 'width': 12 }, { 'title': u"Program Start Date", 'style': 'student_header', 'width': 21 }, { 'title': u"Program End Date", 'style': 'student_header', 'width': 21 }, { 'title': u"Grade in Canada", 'style': 'student_header', 'width': 19 }, { 'title': u"Country", 'style': 'student_header', 'width': 20 }, { 'title': u"Returning Student", 'style': 'student_header', 'width': 22 }, { 'title': u"Registration Address", 'style': 'student_header', 'width': 50 }, { 'title': u"Parent 1 Name", 'style': 'student_header', 'width': 30 }, { 'title': u"Phone", 'style': 'student_header', 'width': 50 }, { 'title': u"Parent 1 Email", 'style': 'student_header', 'width': 30 }, { 'title': u"Parent 2 Name", 'style': 'student_header', 'width': 30 }, { 'title': u"Phone", 'style': 'student_header', 'width': 50 }, { 'title': u"Parent 2 Email", 'style': 'student_header', 'width': 30 }, { 'title': u"Student Date of Birth", 'style': 'student_header', 'width': 24 }, { 'title': u"Name of the School in Your Country", 'style': 'student_header', 'width': 37 }, { 'title': u"School Grade in your Country", 'style': 'student_header', 'width': 30 }, { 'title': u"T-shirt Size", 'style': 'student_header', 'width': 15 }, { 'title': u"Student Email Address", 'style': 'student_header', 'width': 30 }, { 'title': u"Emergency Contact Full Name", 'style': 'student_header', 'width': 50 }, { 'title': u"Relationship", 'style': 'student_header', 'width': 18 }, { 'title': u"Email", 'style': 'student_header', 'width': 35 }, { 'title': u"Phone", 'style': 'student_header', 'width': 35 }, { 'title': u"Special Interest or Allergies", 'style': 'student_header', 'width': 50 }, { 'title': u"Notes", 'style': 'student_header', 'width': 50 }, ] create_titles(worksheet, titles, header_dict)
def general_market_report_titles(worksheet, header_dict, dto): titles = [ { 'title': "Year", 'style': 'sky_header', 'width': 9 }, { 'title': "AAII#", 'style': 'sky_header', 'width': 9 }, { 'title': "Status", 'style': 'sky_header', 'width': 11 }, { 'title': "Registration Date", 'style': 'sky_header', 'width': 20 }, { 'title': "Student's Full Name", 'style': 'sky_header', 'width': 40 }, { 'title': "Student's Ad Astra Code", 'style': 'sky_header', 'width': 34 }, { 'title': "Type of Program", 'style': 'sky_header', 'width': 19 }, { 'title': "Program Name", 'style': 'sky_header', 'width': 40 }, { 'title': "Consultant's Common Name", 'style': 'sky_header', 'width': 40 }, { 'title': "Supervisor's Common Name", 'style': 'sky_header', 'width': 40 }, { 'title': "Period", 'style': 'sky_header', 'width': 12 }, { 'title': "Program Start Date", 'style': 'sky_header', 'width': 21 }, { 'title': "Program End Date", 'style': 'sky_header', 'width': 21 }, { 'title': "Grade in Canada", 'style': 'sky_header', 'width': 23 }, { 'title': "City", 'style': 'sky_header', 'width': 25 }, { 'title': "Country", 'style': 'sky_header', 'width': 25 }, { 'title': "Returning Student", 'style': 'sky_header', 'width': 25 }, { 'title': "Registration Address", 'style': 'sky_header', 'width': 50 }, { 'title': "Parent 1 Name", 'style': 'sky_header', 'width': 30 }, { 'title': "Phone", 'style': 'sky_header', 'width': 50 }, { 'title': "Parent 1 Email", 'style': 'sky_header', 'width': 30 }, { 'title': "Parent 2 Name", 'style': 'sky_header', 'width': 30 }, { 'title': "phone", 'style': 'sky_header', 'width': 50 }, { 'title': "Parent 2 Email", 'style': 'sky_header', 'width': 30 }, { 'title': "Student Date of Birth", 'style': 'sky_header', 'width': 28 }, { 'title': "Name of the School in Your Country", 'style': 'sky_header', 'width': 30 }, { 'title': "School Grade in You Country", 'style': 'sky_header', 'width': 30 }, { 'title': "T-shirt Size", 'style': 'sky_header', 'width': 20 }, { 'title': "Student Email Address", 'style': 'sky_header', 'width': 30 }, { 'title': "Emergency Contact Full Name", 'style': 'sky_header', 'width': 50 }, { 'title': "Relationship Emergency Contact", 'style': 'sky_header', 'width': 34 }, { 'title': "Email Emergency Contact", 'style': 'sky_header', 'width': 35 }, { 'title': "Phone Emergency Contact", 'style': 'sky_header', 'width': 35 }, { 'title': "Special Interest or Allergies", 'style': 'sky_header', 'width': 50 }, { 'title': "Notes", 'style': 'sky_header', 'width': 50 }, ] create_titles(worksheet, titles, header_dict)
def __reimbursement_draw(worksheet, header_dict, reimbursement): y_offset = 10 def add_column(value='', style='cell_center', write_type='write'): columns.append({'value': value, 'style': style, 'write_type': write_type}) vertical_titles = [ ['Complete Name:', reimbursement.creator.person.get_full_name()], ['Common Name:', reimbursement.creator.common_name], ['Location:', reimbursement.location], ['Bank:', reimbursement.bank], ['Account Number:', reimbursement.account_number], ['Swift:', reimbursement.swift], ['Clabe:', reimbursement.clabe], ['Description:', reimbursement.description] ] start_range = print_string(1) end_range = print_string(6) for i, data in enumerate(vertical_titles): row = i + 1 merge_range = '{}{}:{}{}'.format( start_range, row + 1, end_range, row + 1 ) worksheet.write(row, 0, data[0]) worksheet.merge_range(merge_range, data[1]) titles = [ {'title': "Date", 'style': 'student_header', 'width': 16}, {'title': "Type", 'style': 'student_header', 'width': 20}, {'title': "Item / Description", 'style': 'student_header', 'width': 40}, {'title': "Amount", 'style': 'student_header', 'width': 20}, {'title': "Currency", 'style': 'student_header', 'width': 13} ] if reimbursement.need_exchange: titles.append({'title': "Exchange Rate", 'style': 'student_header', 'width': 20}) titles.append({'title': "CAD Amount", 'style': 'student_header', 'width': 20}) create_titles(worksheet, titles, header_dict, y_offset=y_offset) amount_total = 0 total_total = 0 for i, item in enumerate(reimbursement.items.all()): columns = [] row_position = y_offset + i amount_total += item.amount total_total += item.total add_column(item.date.strftime("%Y-%b-%d")) add_column(item.type.name) add_column(item.description, 'cell') add_column(item.amount, 'number_format') add_column(item.currency.code) if reimbursement.need_exchange: add_column(item.exchange_rate, 'decimal_format') add_column(item.total, 'number_format') create_row(columns, row_position, worksheet, header_dict) row_position += 2 #15 if reimbursement.need_exchange: worksheet.merge_range('{}{}:{}{}'.format( print_string(0), row_position + 1, print_string(4), row_position + 1 ), '', header_dict['cell'] ) worksheet.write(row_position, 5, 'Total Amount', header_dict['cell_center_vc']) worksheet.write(row_position, 6, total_total, header_dict['number_format']) else: totals = reimbursement.get_items_totals() total_text = [] for total in totals: total_text.append('{} {}'.format(money_format(total['amount']), total['currency_code'])) total_text = "\n".join(total_text) worksheet.merge_range('{}{}:{}{}'.format( print_string(0), row_position + 1, print_string(1), row_position + 1 ), '', header_dict['cell'] ) worksheet.write(row_position, 2, 'Total Amount', header_dict['cell_center_vc']) worksheet.merge_range('{}{}:{}{}'.format( print_string(3), row_position + 1, print_string(4), row_position + 1 ), total_text, header_dict['cell_center'] ) worksheet.set_row(row_position, 15 * len(totals))