示例#1
0
def index():
    form = OptionForm()
    if form.validate_on_submit():
        Option.set('office_number', form.office_number.data)
        Option.set('office_name', form.office_name.data)
        try:
            db.session.commit()
            flash('Option saved successfully.', 'success')
            return redirect(url_for('index'))
        except:
            db.session.rollback()
            flash('Error update option!', 'danger')
    else:
        form.office_number.data = Option.get('office_number', '')
        form.office_name.data = Option.get('office_name', '')
    return render_template('options/edit.pug', form=form)
示例#2
0
def index():
    form = OptionForm()
    if form.validate_on_submit():
        Option.set('office_number', form.office_number.data)
        Option.set('office_name', form.office_name.data)
        try:
            db.session.commit()
            flash('設定を反映しました', 'success')
            return redirect(url_for('index'))
        except Exception as e:
            db.session.rollback()
            flash('設定反映時にエラーが発生しました "{}"'.format(e), 'danger')
    else:
        form.office_number.data = Option.get('office_number', '')
        form.office_name.data = Option.get('office_name', '')
    return render_template('options/edit.pug', form=form)
示例#3
0
文件: options.py 项目: abtoc/ofpp-app
def index():
    form = OptionForm()
    if form.validate_on_submit():
        Option.set('office_number', form.office_number.data)
        Option.set('office_name', form.office_name.data)
        try:
            db.session.commit()
            flash('設定を反映しました', 'success')
            return redirect(url_for('index'))
        except Exception as e:
            db.session.rollback()
            flash('設定反映時にエラーが出ました {}'.format(e), 'danger')
            from traceback import format_exc
            print(format_exc)
    elif request.method == 'GET':
        form.office_number.data = Option.get('office_number')
        form.office_name.data = Option.get('office_name')
    return render_template('options/edit.pug', form=form)
示例#4
0
def make_pdf(head, items, foot):
    output = BytesIO()
    psize = portrait(A4)
    xmargin = 15.0*mm
    p = canvas.Canvas(output, pagesize=psize, bottomup=True)
    # Title
    name = Option.get('office_name',  '')
    colw = (45.5*mm, 20.5*mm, 24.5*mm, 22.5*mm, 30.5*mm, 27.5*mm)
    data = [[head['ym'],'出勤簿','氏名:',head['name'],'所属:',name]]
    table = Table(data, colWidths=colw, rowHeights=8.0*mm)
    table.setStyle([
        ('FONT',   ( 0, 0), ( 1,-1), 'Gothic', 16),
        ('FONT',   ( 2, 0), (-1,-1), 'Gothic', 12),
        ('ALIGN',  ( 0, 0), (-1,-1), 'CENTER'),
        ('ALIGN',  ( 2, 0), ( 2,-1), 'RIGHT'),
        ('ALIGN',  ( 3, 0), ( 3,-1), 'LEFT'),
        ('ALIGN',  ( 4, 0), ( 4,-1), 'RIGHT'),
        ('ALIGN',  ( 5, 0), ( 5,-1), 'LEFT'),
    ])
    table.wrapOn(p, xmargin, 272.0*mm)
    table.drawOn(p, xmargin, 272.0*mm)
    # Detail
    colw = (10.0*mm, 10.0*mm, 16.5*mm, 16.5*mm, 16.5*mm, 20.5*mm, 16.5*mm, 10.5*mm, 10.5*mm, 10.5*mm, 47.0*mm)
    data =[
        ['日','曜日','始業','終業','休憩','時間','残業', '欠勤', '遅刻', '早退', '備考']
    ]
    for item in items:
        row = []
        if item  is not None:
            row.append(item['dd'])
            row.append(item['ww'])
            row.append(item['work_in'])
            row.append(item['work_out'])
            row.append(item['break_t'])
            row.append(item['value'])
            row.append(item['over_t'])
            row.append(item['absence'])
            row.append(item['late'])
            row.append(item['leave'])
            row.append(item['remarks'])
        data.append(row)
    table = Table(data, colWidths=colw, rowHeights=8.0*mm)
    table.setStyle([
        ('FONT',   ( 0, 0), (-1,-1), 'Gothic', 12),
        ('GRID',   ( 0, 0), (-1,-1), 0.5, colors.black),
        ('BOX',    ( 0, 0), (-1,-1), 1.8, colors.black),
        ('VALIGN', ( 0, 0), (-1,-1), 'MIDDLE'),
        ('ALIGN',  ( 0, 0), (-1,-1), 'CENTER'),
        ('ALIGN',  (10, 1), (10,-1), 'LEFT')
    ])
    table.wrapOn(p, xmargin, 16.0*mm)
    table.drawOn(p, xmargin, 16.0*mm)
    # Foot
    colw = (20.0*mm, 33.0*mm, 16.5*mm, 20.5*mm, 16.5*mm, 10.5*mm, 10.5*mm, 10.5*mm, 47.0*mm)
    data =[
        [
            '合計',
            '{}日'.format(foot['count']),
            foot['break_t'],
            foot['value'],
            foot['over_t'], 
            foot['absence'], 
            foot['late'], 
            foot['leave'],
            ''
        ]
    ]
    table = Table(data, colWidths=colw, rowHeights=8.0*mm)
    table.setStyle([
        ('FONT',   ( 0, 0), (-1,-1), 'Gothic', 12),
        ('GRID',   ( 0, 0), (-1,-1), 0.5, colors.black),
        ('BOX',    ( 0, 0), (-1,-1), 1.8, colors.black),
        ('VALIGN', ( 0, 0), (-1,-1), 'MIDDLE'),
        ('ALIGN',  ( 0, 0), (-1,-1), 'CENTER'),
    ])
    table.wrapOn(p, xmargin, 7.0*mm)
    table.drawOn(p, xmargin, 7.0*mm)
    # Print
    p.showPage()
    p.save()
    result = output.getvalue()
    output.close()
    return result
示例#5
0
 def make_page(self, p, head, items, foot):
     xmargin = 15.0 * mm
     # Title
     p.setFont('Gothic', 16)
     p.drawString(75 * mm, 275 * mm, '就労継続支援提供実績記録票')
     p.setFont('Gothic', 11)
     p.drawString(17 * mm, 275 * mm, head['gm'])
     # Header
     colw = (25.0 * mm, 29.5 * mm, 32.0 * mm, 32.0 * mm, 22.0 * mm,
             43.5 * mm)
     idm = head['idm']
     number = Option.get('office_number', '')
     name = Option.get('office_name', '')
     data = [[
         '受給者証番号', head['number'], '支給決定障害者氏名', head['name'], '事業所番号',
         number
     ], ['契約支給量', head['amount'], '', '', '事業者及び\nその事業所', name]]
     table = Table(data, colWidths=colw, rowHeights=10.0 * mm)
     table.setStyle([('FONT', (0, 0), (-1, -1), 'Gothic', 8),
                     ('GRID', (0, 0), (-1, -1), 0.5, colors.black),
                     ('BOX', (0, 0), (-1, -1), 1.8, colors.black),
                     ('VALIGN', (0, 0), (-1, -1), 'MIDDLE'),
                     ('ALIGN', (0, 0), (-1, -1), 'CENTER'),
                     ('ALIGN', (1, 1), (1, 1), 'LEFT'),
                     ('SPAN', (1, 1), (3, 1))])
     table.wrapOn(p, xmargin, 252.0 * mm)
     table.drawOn(p, xmargin, 252.0 * mm)
     # Detail
     colw = (8.6 * mm, 11.0 * mm, 17.2 * mm, 17.2 * mm, 17.2 * mm, 6.0 * mm,
             6.0 * mm, 9.6 * mm, 6.6 * mm, 6.6 * mm, 6.6 * mm, 8.6 * mm,
             8.6 * mm, 14.6 * mm, 39.6 * mm)
     data = [[
         '日\n付', '曜\n日', 'サービス提供実績', '', '', '', '', '', '', '', '', '', '',
         '利用者\n確認印', '備考'
     ],
             [
                 '', '', 'サービス提供\nの状況', '開始時間', '終了時間', '送迎加算', '',
                 '訪問支援\n特別加算', '食事\n提供\n加算', '医療\n連携\n体制\n加算',
                 '体験\n利用\n支援\n加算', '施設外\n就労', '施設外\n支援'
             ], ['', '', '', '', '', '往', '復', '時間数']]
     count = 0
     for item in items:
         row = []
         row.append(item['dd'])
         row.append(item['ww'])
         row.append(item['stat'])
         row.append(item['work_in'])
         row.append(item['work_out'])
         row.append(item['pickup_in'])
         row.append(item['pickup_out'])
         row.append(item['visit'])
         row.append(item['meal'])
         row.append(item['medical'])
         row.append(item['experience'])
         row.append(item['outemp'])
         row.append(item['outside'])
         row.append('')
         row.append(item['remarks'])
         data.append(row)
         count = count + 1
     while count < 28:
         data.append([])
         count = count + 1
     table = Table(data, colWidths=colw, rowHeights=7.0 * mm)
     table.setStyle([
         ('FONT', (0, 0), (-1, -1), 'Gothic', 9),
         ('FONT', (2, 1), (2, 1), 'Gothic', 7),  # サービス提供の状況
         ('FONT', (5, 1), (6, 1), 'Gothic', 7),  # 送迎加算
         ('FONT', (7, 1), (7, 1), 'Gothic', 5),  # 訪問支援特別加算
         ('FONT', (7, 2), (7, 2), 'Gothic', 7),  # 訪問支援特別加算
         ('FONT', (8, 1), (8, 1), 'Gothic', 7),  # 食事提供加算
         ('FONT', (9, 1), (9, 1), 'Gothic', 6),  # 医療連携体制加算
         ('FONT', (10, 1), (10, 1), 'Gothic', 6),  # 体験利用加算
         ('FONT', (11, 1), (11, 1), 'Gothic', 7),  # 施設外就労
         ('FONT', (12, 1), (12, 1), 'Gothic', 7),
         ('GRID', (0, 0), (-1, -1), 0.5, colors.black),
         ('BOX', (0, 0), (-1, -1), 1.8, colors.black),
         ('VALIGN', (0, 0), (-1, -1), 'MIDDLE'),
         ('ALIGN', (0, 0), (-1, -1), 'CENTER'),
         ('SPAN', (0, 0), (0, 2)),  # 日付
         ('SPAN', (1, 0), (1, 2)),  # 曜日
         ('SPAN', (2, 0), (12, 0)),  # サービス提供実績
         ('SPAN', (13, 0), (13, 2)),  # 利用者確認印
         ('SPAN', (14, 0), (14, 2)),  # 備考
         ('SPAN', (2, 1), (2, 2)),  # サービス提供の状況
         ('SPAN', (3, 1), (3, 2)),  # 開始時間
         ('SPAN', (4, 1), (4, 2)),  # 終了時間
         ('SPAN', (5, 1), (6, 1)),  # 送迎加算
         ('SPAN', (8, 1), (8, 2)),  # 食事提供加算
         ('SPAN', (9, 1), (9, 2)),  # 医療連携体制加算
         ('SPAN', (10, 1), (10, 2)),  # 体験利用支援加算
         ('SPAN', (11, 1), (11, 2)),  # 施設外就労
         ('SPAN', (12, 1), (12, 2)),  # 施設外支援
         ('ALIGN', (14, 3), (14, -1), 'LEFT'),
     ])
     table.wrapOn(p, xmargin, 32.0 * mm)
     table.drawOn(p, xmargin, 32.0 * mm)
     # Footer
     colw = (36.8 * mm, 34.2 * mm, 12.0 * mm, 9.6 * mm, 6.6 * mm, 6.6 * mm,
             6.6 * mm, 8.6 * mm, 13.6 * mm, 10.0 * mm, 26.2 * mm, 13.2 * mm)
     data = [[
         '合計', '{}回'.format(foot['count']), '{}回'.format(foot['pickup']),
         '{}回'.format(foot['visit']), '{}回'.format(foot['meal']),
         '{}回'.format(foot['medical']), '{}回'.format(foot['experience']),
         '{}回'.format(foot['outemp']), '施設外\n支援', '当月',
         '{}日      '.format(foot['outside']), ''
     ],
             [
                 '', '', '', '', '', '', '', '', '', '累計',
                 '{}日/180日'.format(foot['outside_sum'])
             ]]
     table = Table(data, colWidths=colw, rowHeights=4.0 * mm)
     table.setStyle([
         ('FONT', (0, 0), (-1, -1), 'Gothic', 8),
         ('FONT', (0, 0), (0, 0), 'Gothic', 9),
         ('GRID', (0, 0), (-1, -1), 0.5, colors.black),
         ('BOX', (0, 0), (-1, -1), 1.8, colors.black),
         ('VALIGN', (0, 0), (-1, -1), 'MIDDLE'),
         ('ALIGN', (0, 0), (-1, -1), 'CENTER'),
         ('ALIGN', (10, 0), (10, -1), 'RIGHT'),
         ('SPAN', (0, 0), (0, 1)),  # 合計
         ('SPAN', (1, 0), (1, 1)),  # 利用回数
         ('SPAN', (2, 0), (2, 1)),  # 送迎加算
         ('SPAN', (3, 0), (3, 1)),  # 訪問支援特別加算
         ('SPAN', (4, 0), (4, 1)),  # 食事提供加算
         ('SPAN', (5, 0), (5, 1)),  # 医療連携体制加算
         ('SPAN', (6, 0), (6, 1)),  # 体験利用支援加算
         ('SPAN', (7, 0), (7, 1)),  # 施設外就労
         ('SPAN', (8, 0), (8, 1)),  # 施設外支援
         ('SPAN', (11, 0), (11, 1)),
     ])
     table.wrapOn(p, xmargin, 23.2 * mm)
     table.drawOn(p, xmargin, 23.2 * mm)
     # UseStart
     colw = (28.0 * mm, 21.5 * mm, 30.5 * mm, 21.5 * mm, 30.5 * mm,
             21.5 * mm, 30.5 * mm)
     data = [[
         '初期加算', '利用開始日', head['usestart'], '30日目', head['usestart30d'],
         '当月算定日数', '{}日'.format(foot['usestart'])
     ]]
     table = Table(data, colWidths=colw, rowHeights=6.5 * mm)
     table.setStyle([('FONT', (0, 0), (-1, -1), 'Gothic', 9),
                     ('GRID', (0, 0), (-1, -1), 0.5, colors.black),
                     ('BOX', (0, 0), (-1, -1), 1.8, colors.black),
                     ('VALIGN', (0, 0), (-1, -1), 'MIDDLE'),
                     ('ALIGN', (0, 0), (-1, -1), 'CENTER')])
     table.wrapOn(p, xmargin, 15.0 * mm)
     table.drawOn(p, xmargin, 15.0 * mm)
     # IDm
     p.setFont('Gothic', 11)
     p.drawString(17 * mm, 10 * mm, '記録ICカード:{idm}'.format(idm=idm))
     # Print
     p.showPage()
示例#6
0
def make_pdf(head, items, foot):
    output = BytesIO()
    psize  = portrait(A4)
    xmargin = 15.0*mm
    p = canvas.Canvas(output, pagesize=psize, bottomup=True)
    # Title
    p.setFont('Gothic', 16)
    p.drawString(75*mm, 275*mm, '就労継続支援提供実績記録票')
    p.setFont('Gothic', 11)
    p.drawString(17*mm, 275*mm, head['gm'])
    # Header
    colw = (25.0*mm, 29.5*mm, 32.0*mm, 32.0*mm, 22.0*mm, 43.5*mm)
    idm = head['idm']
    office_number = Option.get('office_number','')
    office_name   = Option.get('office_name',  '')
    data =[
        ['受給者証番号',head['number'],'支給決定障害者氏名',head['name'],'事業所番号',office_number],
        ['契約支給量',head['amount'],'','','事業者及び\nその事業所',office_name]
    ]
    table = Table(data, colWidths=colw, rowHeights=10.0*mm)
    table.setStyle([
        ('FONT',   ( 0, 0), (-1,-1), 'Gothic', 8),
        ('GRID',   ( 0, 0), (-1,-1), 0.5, colors.black),
        ('BOX',    ( 0, 0), (-1,-1), 1.8, colors.black),
        ('VALIGN', ( 0, 0), (-1,-1), 'MIDDLE'),
        ('ALIGN',  ( 0, 0), (-1,-1), 'CENTER'),
        ('ALIGN',  ( 1, 1), ( 1, 1), 'LEFT'),
        ('SPAN',   ( 1, 1), ( 3, 1))
    ])
    table.wrapOn(p, xmargin, 252.0*mm)
    table.drawOn(p, xmargin, 252.0*mm)
    # Detail
    colw = (8.6*mm,11.0*mm, 17.2*mm, 17.2*mm, 17.2*mm, 17.2*mm, 8.0*mm, 8.0*mm, 14.0*mm, 8.6*mm, 8.6*mm, 13.8*mm, 34.6*mm )
    data = [
        ['日\n付','曜\n日','サービス提供実績','','','','','','','','','利用者\n確認印','備考'],
        ['','','サービス提供\nの状況','開始時間','終了時間','利用時間','送迎加算','','`訪問支援特別加算','食事提供\n加算','施設外\n就労','',''],
        ['','','','','','','往','復','時間数'],
    ]
    for item in items:
        d = []
        if item != None:
            d.append(item['dd'])
            d.append(item['ww'])
            d.append(item['stat'])
            if 'in' in item:
                d.append(item['in'])
            else:
                d.append('')
            if 'out' in item:
                d.append(item['out'])
            else:
                d.append('')
            if 'val' in item:
                d.append(item['val'])
            else:
                d.append('')
            d.append('')
            d.append('')
            d.append('')
            d.append('')
            d.append('')
            d.append('')
            if 'reason' in item:
                d.append(item['reason'])
            else:
                d.append('')

        data.append(d)
    table = Table(data, colWidths=colw, rowHeights=7.0*mm)
    table.setStyle([
        ('FONT',   ( 0, 0), (-1,-1), 'Gothic', 9),
        ('FONT',   ( 2, 1), ( 2, 1), 'Gothic', 8),
        ('FONT',   ( 8, 1), ( 8, 1), 'Gothic', 5),
        ('FONT',   ( 9, 1), (10, 1), 'Gothic', 6),
        ('GRID',   ( 0, 0), (-1,-1), 0.5, colors.black),
        ('BOX',    ( 0, 0), (-1,-1), 1.8, colors.black),
        ('BOX',    ( 0, 0), (-1, 2), 1.8, colors.black),
        ('BOX',    ( 0, 0), ( 1,-1), 1.8, colors.black),
        ('BOX',    (11, 0), (11,-1), 1.8, colors.black),
        ('VALIGN', ( 0, 0), (-1,-1), 'MIDDLE'),
        ('ALIGN',  ( 0, 0), (-1, 2), 'CENTER'),
        ('ALIGN',  ( 0, 2), ( 5,-1), 'CENTER'),
        ('SPAN',   ( 0, 0), ( 0, 2)),
        ('SPAN',   ( 1, 0), ( 1, 2)),
        ('SPAN',   ( 2, 0), (10, 0)),
        ('SPAN',   ( 2, 1), ( 2, 2)),
        ('SPAN',   ( 3, 1), ( 3, 2)),
        ('SPAN',   ( 4, 1), ( 4, 2)),
        ('SPAN',   ( 5, 1), ( 5, 2)),
        ('SPAN',   ( 6, 1), ( 7, 1)),
        ('SPAN',   ( 9, 1), ( 9, 2)),
        ('SPAN',   (10, 1), (10, 2)),
        ('SPAN',   (11, 0), (11, 2)),
        ('SPAN',   (12, 0), (12, 2))
    ])
    table.wrapOn(p, xmargin, 32.0*mm)
    table.drawOn(p, xmargin, 32.0*mm)
    # Footer
    colw=(54.1*mm,17.1*mm,17.1*mm,16.0*mm,14.0*mm,8.6*mm,13.6*mm,9.0*mm,34.5*mm)
    data=[
        ['合計','{}日'.format(foot['cnt']),'{}時間'.format(foot['sum']),'回','回','回','施設外\n就労','当月','日      '],
        ['','','','','','','','累計','日/180日']
    ]
    table = Table(data, colWidths=colw, rowHeights=4.0*mm)
    table.setStyle([
        ('FONT',   ( 0, 0), (-1,-1), 'Gothic', 8),
        ('FONT',   ( 1, 0), ( 5,-1), 'Gothic', 6),
        ('FONT',   ( 7, 0), ( 7,-1), 'Gothic', 6),
        ('GRID',   ( 0, 0), (-1,-1), 0.5, colors.black),
        ('BOX',    ( 0, 0), (-1,-1), 1.8, colors.black),
        ('VALIGN', ( 0, 0), (-1,-1), 'MIDDLE'),
        ('ALIGN',  ( 0, 0), ( 0,-1), 'CENTER'),
        ('ALIGN',  ( 1, 0), ( 5,-1), 'RIGHT'),
        ('ALIGN',  ( 6, 0), ( 7,-1), 'CENTER'),
        ('ALIGN',  ( 8, 0), ( 8,-1), 'RIGHT'),
        ('SPAN',   ( 0, 0), ( 0, 1)),
        ('SPAN',   ( 1, 0), ( 1, 1)),
        ('SPAN',   ( 2, 0), ( 2, 1)),
        ('SPAN',   ( 3, 0), ( 3, 1)),
        ('SPAN',   ( 4, 0), ( 4, 1)),
        ('SPAN',   ( 5, 0), ( 5, 1)),
        ('SPAN',   ( 6, 0), ( 6, 1))
    ])
    table.wrapOn(p, xmargin, 23.2*mm)
    table.drawOn(p, xmargin, 23.2*mm)
    colw=(28.0*mm,21.5*mm,30.5*mm,21.5*mm,30.5*mm,21.5*mm,30.5*mm)
    data=[
        ['初期加算','利用開始日',head['usestart'],'30日目',head['usestart30'],'当月算定日数','']
    ]
    table = Table(data, colWidths=colw, rowHeights=6.5*mm)
    table.setStyle([
        ('FONT',   ( 0, 0), (-1,-1), 'Gothic', 9),
        ('GRID',   ( 0, 0), (-1,-1), 0.5, colors.black),
        ('BOX',    ( 0, 0), (-1,-1), 1.8, colors.black),
        ('VALIGN', ( 0, 0), (-1,-1), 'MIDDLE'),
        ('ALIGN',  ( 0, 0), (-1,-1), 'CENTER')
    ])
    table.wrapOn(p, xmargin, 15.0*mm)
    table.drawOn(p, xmargin, 15.0*mm)
    # IDm
    p.setFont('Gothic', 11)
    p.drawString(17*mm, 10*mm, '記録ICカード:{idm}'.format(idm=idm))
    # Page Print
    p.showPage()
    p.save()
    result = output.getvalue()
    output.close()
    return result
示例#7
0
def make_pdf_staff(head, items, foot):
    output = BytesIO()
    psize  = portrait(A4)
    xmargin = 15.0*mm
    p = canvas.Canvas(output, pagesize=psize, bottomup=True)
    # Title
    # Header
    office_name   = Option.get('office_name',  '')
    colw = (45.5*mm, 20.5*mm, 20.5*mm, 27.5*mm, 20.5*mm, 27.5*mm)
    data = [[head['ym'],'出勤簿','氏名:',head['name'],'所属:',office_name]]
    table = Table(data, colWidths=colw, rowHeights=8.0*mm)
    table.setStyle([
        ('FONT',   ( 0, 0), ( 1,-1), 'Gothic', 16),
        ('FONT',   ( 2, 0), (-1,-1), 'Gothic', 10),
        ('ALIGN',  ( 0, 0), (-1,-1), 'CENTER'),
        ('ALIGN',  ( 2, 0), ( 2,-1), 'RIGHT'),
        ('ALIGN',  ( 3, 0), ( 3,-1), 'LEFT'),
        ('ALIGN',  ( 4, 0), ( 4,-1), 'RIGHT'),
        ('ALIGN',  ( 5, 0), ( 5,-1), 'LEFT'),
    ])
    table.wrapOn(p, xmargin, 272.0*mm)
    table.drawOn(p, xmargin, 272.0*mm)
    # Detail
    colw = (10.0*mm, 10.0*mm, 21.5*mm, 21.5*mm, 23.0*mm, 25.5*mm, 25.5*mm, 41.0*mm)
    data =[
        ['日','曜日','始業時刻','終業時刻','休憩時間','労働時間','残業時間','備考']
    ]
    for item in items:
        d = []
        if item != None:
            d.append(item['dd'])
            d.append(item['ww'])
            if 'in' in item:
                d.append(item['in'])
            else:
                d.append('')
            if 'out' in item:
                d.append(item['out'])
            else:
                d.append('')
            if 'break' in item:
                d.append(item['break'])
            else:
                d.append('')
            if 'val' in item:
                d.append(item['val'])
            else:
                d.append('')
            if 'over' in item:
                d.append(item['over'])
            else:
                d.append('')
            if 'reason' in item:
                d.append(item['reason'])
            else:
                d.append('')
        data.append(d)
    table = Table(data, colWidths=colw, rowHeights=8.0*mm)
    table.setStyle([
        ('FONT',   ( 0, 0), (-1,-1), 'Gothic', 12),
        ('GRID',   ( 0, 0), (-1,-1), 0.5, colors.black),
        ('BOX',    ( 0, 0), (-1,-1), 1.8, colors.black),
        ('VALIGN', ( 0, 0), (-1,-1), 'MIDDLE'),
        ('ALIGN',  ( 0, 0), (-1,-1), 'CENTER'),
        ('ALIGN',  ( 7, 1), ( 7,-1), 'LEFT')
    ])
    table.wrapOn(p, xmargin, 16.0*mm)
    table.drawOn(p, xmargin, 16.0*mm)
    # Footer
    colw = (86.0*mm, 25.5*mm, 25.5*mm, 25.5*mm, 15.5*mm)
    data =[
        ['合計',foot['sum'],foot['over'],'出勤日数',foot['cnt']],
    ]
    table = Table(data, colWidths=colw, rowHeights=8.0*mm)
    table.setStyle([
        ('FONT',   ( 0, 0), (-1,-1), 'Gothic', 12),
        ('GRID',   ( 0, 0), (-1,-1), 0.5, colors.black),
        ('BOX',    ( 0, 0), (-1,-1), 1.8, colors.black),
        ('VALIGN', ( 0, 0), (-1,-1), 'MIDDLE'),
        ('ALIGN',  ( 0, 0), (-1,-1), 'CENTER')
    ])
    table.wrapOn(p, xmargin, 7.0*mm)
    table.drawOn(p, xmargin, 7.0*mm)
    # Page Print
    p.showPage()
    p.save()
    result = output.getvalue()
    output.close()
    return result