Beispiel #1
0
def setFsHeaderState(table, titles):
    table.cell(0, 0).width = Cm(13)
    table.cell(0, 1).width = Cm(2)
    table.cell(0, 2).width = Cm(5)
    table.cell(0, 3).width = Cm(5)
    table.cell(0, 4).width = Cm(5)
    setCell(table.cell(0, 0), titles[0], WD_PARAGRAPH_ALIGNMENT.CENTER, False,
            "tableSmallCharacter")
    setCell(table.cell(0, 1), titles[1], WD_PARAGRAPH_ALIGNMENT.CENTER, False,
            "tableSmallCharacter")
    setCell(table.cell(0, 2), titles[2], WD_PARAGRAPH_ALIGNMENT.CENTER, False,
            "tableSmallCharacter")
    setCell(table.cell(0, 3), titles[3], WD_PARAGRAPH_ALIGNMENT.CENTER, False,
            "tableSmallCharacter")
    setCell(table.cell(0, 4), titles[4], WD_PARAGRAPH_ALIGNMENT.CENTER, False,
            "tableSmallCharacter")
Beispiel #2
0
def addFirstLine(document, context):

    # 公司名称
    companyName = context["report_params"]["companyName"]
    # 报告日期
    reportDate = context["report_params"]["reportDate"]
    # 人民币单位
    currencyUnit = context["notes_params"]["currencyUnit"]

    table = document.add_table(1, 3)
    table.rows[0].height_rule = WD_ROW_HEIGHT_RULE.EXACTLY
    table.rows[0].height = Cm(0.8)
    table.cell(0, 0).width = Cm(20)
    table.cell(0, 1).width = Cm(10)
    table.cell(0, 2).width = Cm(10)
    setCell(table.cell(0, 0),
            "编制单位:{}".format(companyName),
            WD_PARAGRAPH_ALIGNMENT.LEFT,
            toFloat=True,
            style="tableSmallCharacter")
    setCell(table.cell(0, 1),
            reportDate,
            WD_PARAGRAPH_ALIGNMENT.CENTER,
            toFloat=True,
            style="tableSmallCharacter")
    setCell(table.cell(0, 2),
            "单位:{}".format(currencyUnit),
            WD_PARAGRAPH_ALIGNMENT.RIGHT,
            toFloat=True,
            style="tableSmallCharacter")
Beispiel #3
0
def setOwnerHeaderList(table, period):
    table.cell(0, 0).width = Cm(8)
    table.cell(1, 0).width = Cm(8)
    table.cell(2, 0).width = Cm(8)
    table.cell(3, 0).width = Cm(8)
    table.cell(0, 1).width = Cm(2)
    table.cell(1, 1).width = Cm(2)
    table.cell(2, 1).width = Cm(2)
    table.cell(3, 1).width = Cm(2)

    values = [
        [
            "项            目", period, "nan", "nan", "nan", "nan", "nan", "nan",
            "nan", "nan", "nan", "nan", "nan", "nan", "nan"
        ],
        [
            "nan", "归属于母公司所有者权益", "nan", "nan", "nan", "nan", "nan", "nan",
            "nan", "nan", "nan", "nan", "nan", "少数股东权益", "所有者权益合计"
        ],
        [
            "nan", "实收资本(或股本)", "其他权益工具", "nan", "nan", "资本公积", "减:库存股",
            "其他综合收益", "专项储备", "盈余公积", "一般风险准备", "未分配利润", "小计", "nan", "nan"
        ],
        [
            "nan", "nan", "优先股", "永续债", "其他", "nan", "nan", "nan", "nan",
            "nan", "nan", "nan", "nan", "nan", "nan"
        ],
    ]

    for i, row in enumerate(values):
        for j, value in enumerate(row):
            setCell(table.cell(i, j), value, WD_PARAGRAPH_ALIGNMENT.CENTER,
                    False, "tableSmallCharacter")
    set_cell_border(table.cell(0,
                               len(table.columns) - 1),
                    right={
                        "sz": 0,
                        "val": "",
                        "space": "0"
                    })
Beispiel #4
0
def addFsTableLineState(table, key, newRecords, num):
    smallNum = to_chinese(newRecords[key]["noteNum"])
    if smallNum == 0:
        recordNum = ""
    else:
        recordNum = "{}({})".format(num, smallNum)

    table.cell(key, 0).width = Cm(13)
    table.cell(key, 1).width = Cm(2)
    table.cell(key, 2).width = Cm(5)
    table.cell(key, 3).width = Cm(5)
    table.cell(key, 4).width = Cm(5)
    setCell(table.cell(key, 0),
            *getAlignAndText(newRecords[key]["type"], newRecords[key]["name"]),
            False, "tableSmallCharacter")
    setCell(table.cell(key, 1), key, WD_PARAGRAPH_ALIGNMENT.CENTER, False,
            "tableSmallCharacter")
    setCell(table.cell(key, 2), newRecords[key]["endDate"],
            WD_PARAGRAPH_ALIGNMENT.RIGHT, True, "tableSmallCharacter")
    setCell(table.cell(key, 3), newRecords[key]["startDate"],
            WD_PARAGRAPH_ALIGNMENT.RIGHT, True, "tableSmallCharacter")
    setCell(table.cell(key, 4), recordNum, WD_PARAGRAPH_ALIGNMENT.CENTER, True,
            "tableSmallCharacter")
Beispiel #5
0
def add_last_line(document):
    table = document.add_table(1, 3)
    table.cell(0, 0).width = Cm(10)
    table.cell(0, 1).width = Cm(13)
    table.cell(0, 2).width = Cm(10)
    setCell(table.cell(0, 0),
            "法定代表人:",
            WD_PARAGRAPH_ALIGNMENT.LEFT,
            toFloat=True,
            style="tableSmallCharacter")
    setCell(table.cell(0, 1),
            "主管会计工作的负责人:",
            WD_PARAGRAPH_ALIGNMENT.LEFT,
            toFloat=True,
            style="tableSmallCharacter")
    setCell(table.cell(0, 2),
            "会计机构负责人:",
            WD_PARAGRAPH_ALIGNMENT.LEFT,
            toFloat=True,
            style="tableSmallCharacter")
Beispiel #6
0
def addOsTableLineList(table, key, newRecords, reportType):

    if reportType == "合并":
        step = 3
    else:
        step = 2
    table.cell(key + step, 0).width = Cm(8)
    table.cell(key + step, 1).width = Cm(1)

    setCell(table.cell(key + step, 0),
            *getAlignAndText(newRecords[key]["type"], newRecords[key]["name"]),
            False, "tableSmallCharacter")
    setCell(table.cell(key + step, 1), newRecords[key]["paidInCapital"],
            WD_PARAGRAPH_ALIGNMENT.RIGHT, True, "tableSmallCharacter")
    setCell(table.cell(key + step, 2), newRecords[key]["preferedStock"],
            WD_PARAGRAPH_ALIGNMENT.RIGHT, True, "tableSmallCharacter")
    setCell(table.cell(key + step, 3), newRecords[key]["perpetualDebt"],
            WD_PARAGRAPH_ALIGNMENT.RIGHT, True, "tableSmallCharacter")
    setCell(table.cell(key + step,
                       4), newRecords[key]["otherEquityInstruments"],
            WD_PARAGRAPH_ALIGNMENT.RIGHT, True, "tableSmallCharacter")
    setCell(table.cell(key + step, 5), newRecords[key]["capitalReserve"],
            WD_PARAGRAPH_ALIGNMENT.RIGHT, True, "tableSmallCharacter")
    setCell(table.cell(key + step, 6), newRecords[key]["treasuryStock"],
            WD_PARAGRAPH_ALIGNMENT.RIGHT, True, "tableSmallCharacter")
    setCell(table.cell(key + step,
                       7), newRecords[key]["otherComprehensiveIncome"],
            WD_PARAGRAPH_ALIGNMENT.RIGHT, True, "tableSmallCharacter")
    setCell(table.cell(key + step, 8), newRecords[key]["specialReserve"],
            WD_PARAGRAPH_ALIGNMENT.RIGHT, True, "tableSmallCharacter")
    setCell(table.cell(key + step, 9), newRecords[key]["surplusReserve"],
            WD_PARAGRAPH_ALIGNMENT.RIGHT, True, "tableSmallCharacter")
    if reportType == "合并":
        setCell(table.cell(key + step,
                           10), newRecords[key]["generalRiskReserve"],
                WD_PARAGRAPH_ALIGNMENT.RIGHT, True, "tableSmallCharacter")
        setCell(table.cell(key + step,
                           11), newRecords[key]["undistributedProfit"],
                WD_PARAGRAPH_ALIGNMENT.RIGHT, True, "tableSmallCharacter")
        setCell(table.cell(key + step, 12), newRecords[key]["subtotal"],
                WD_PARAGRAPH_ALIGNMENT.RIGHT, True, "tableSmallCharacter")
        setCell(table.cell(key + step,
                           13), newRecords[key]["minorityInterests"],
                WD_PARAGRAPH_ALIGNMENT.RIGHT, True, "tableSmallCharacter")
        setCell(table.cell(key + step,
                           14), newRecords[key]["totalOwnerEquity"],
                WD_PARAGRAPH_ALIGNMENT.RIGHT, True, "tableSmallCharacter")
    else:
        setCell(table.cell(key + step,
                           10), newRecords[key]["undistributedProfit"],
                WD_PARAGRAPH_ALIGNMENT.RIGHT, True, "tableSmallCharacter")
        setCell(table.cell(key + step, 11), newRecords[key]["subtotal"],
                WD_PARAGRAPH_ALIGNMENT.RIGHT, True, "tableSmallCharacter")
Beispiel #7
0
def addOsTableLineState(table, key, newRecords):
    table.cell(key + 3, 0).width = Cm(8)
    table.cell(key + 3, 1).width = Cm(1)

    setCell(table.cell(key + 3, 0),
            *getAlignAndText(newRecords[key]["type"], newRecords[key]["name"]),
            False, "tableSmallCharacter")
    setCell(table.cell(key + 3, 1), key, WD_PARAGRAPH_ALIGNMENT.CENTER, False,
            "tableSmallCharacter")
    setCell(table.cell(key + 3, 2), newRecords[key]["paidInCapital"],
            WD_PARAGRAPH_ALIGNMENT.RIGHT, True, "tableSmallCharacter")
    setCell(table.cell(key + 3, 3), newRecords[key]["preferedStock"],
            WD_PARAGRAPH_ALIGNMENT.RIGHT, True, "tableSmallCharacter")
    setCell(table.cell(key + 3, 4), newRecords[key]["perpetualDebt"],
            WD_PARAGRAPH_ALIGNMENT.RIGHT, True, "tableSmallCharacter")
    setCell(table.cell(key + 3, 5), newRecords[key]["otherEquityInstruments"],
            WD_PARAGRAPH_ALIGNMENT.RIGHT, True, "tableSmallCharacter")
    setCell(table.cell(key + 3, 6), newRecords[key]["capitalReserve"],
            WD_PARAGRAPH_ALIGNMENT.RIGHT, True, "tableSmallCharacter")
    setCell(table.cell(key + 3, 7), newRecords[key]["treasuryStock"],
            WD_PARAGRAPH_ALIGNMENT.RIGHT, True, "tableSmallCharacter")
    setCell(table.cell(key + 3,
                       8), newRecords[key]["otherComprehensiveIncome"],
            WD_PARAGRAPH_ALIGNMENT.RIGHT, True, "tableSmallCharacter")
    setCell(table.cell(key + 3, 9), newRecords[key]["specialReserve"],
            WD_PARAGRAPH_ALIGNMENT.RIGHT, True, "tableSmallCharacter")
    setCell(table.cell(key + 3, 10), newRecords[key]["surplusReserve"],
            WD_PARAGRAPH_ALIGNMENT.RIGHT, True, "tableSmallCharacter")
    setCell(table.cell(key + 3, 11), newRecords[key]["generalRiskReserve"],
            WD_PARAGRAPH_ALIGNMENT.RIGHT, True, "tableSmallCharacter")
    setCell(table.cell(key + 3, 12), newRecords[key]["undistributedProfit"],
            WD_PARAGRAPH_ALIGNMENT.RIGHT, True, "tableSmallCharacter")
    setCell(table.cell(key + 3, 13), newRecords[key]["subtotal"],
            WD_PARAGRAPH_ALIGNMENT.RIGHT, True, "tableSmallCharacter")
    setCell(table.cell(key + 3, 14), newRecords[key]["minorityInterests"],
            WD_PARAGRAPH_ALIGNMENT.RIGHT, True, "tableSmallCharacter")
    setCell(table.cell(key + 3, 15), newRecords[key]["totalOwnerEquity"],
            WD_PARAGRAPH_ALIGNMENT.RIGHT, True, "tableSmallCharacter")
Beispiel #8
0
def setOwnerHeaderListSingle(table, period):
    table.cell(0, 0).width = Cm(8)
    table.cell(1, 0).width = Cm(8)
    table.cell(2, 0).width = Cm(8)
    table.cell(0, 1).width = Cm(2)
    table.cell(1, 1).width = Cm(2)
    table.cell(2, 1).width = Cm(2)

    values = [
        [
            "项            目", period, "nan", "nan", "nan", "nan", "nan", "nan",
            "nan", "nan", "nan", "nan"
        ],
        [
            "nan", "实收资本(或股本)", "其他权益工具", "nan", "nan", "资本公积", "减:库存股",
            "其他综合收益", "专项储备", "盈余公积", "未分配利润", "所有者权益合计"
        ],
        [
            "nan", "nan", "优先股", "永续债", "其他", "nan", "nan", "nan", "nan",
            "nan", "nan", "nan"
        ],
    ]
    for i, row in enumerate(values):
        for j, value in enumerate(row):
            setCell(table.cell(i, j), value, WD_PARAGRAPH_ALIGNMENT.CENTER,
                    False, "tableSmallCharacter")
    # setCell(table.cell(0, 0), "项            目", WD_PARAGRAPH_ALIGNMENT.CENTER, False, "tableSmallCharacter")
    # setCell(table.cell(0, 1), period, WD_PARAGRAPH_ALIGNMENT.CENTER, False, "tableSmallCharacter")
    # setCell(table.cell(1, 1), "实收资本(或股本)", WD_PARAGRAPH_ALIGNMENT.CENTER, False, "tableSmallCharacter")
    # setCell(table.cell(1, 2), "其他权益工具", WD_PARAGRAPH_ALIGNMENT.CENTER, False, "tableSmallCharacter")
    # setCell(table.cell(1, 5), "资本公积", WD_PARAGRAPH_ALIGNMENT.CENTER, False, "tableSmallCharacter")
    # setCell(table.cell(1, 6), "减:库存股", WD_PARAGRAPH_ALIGNMENT.CENTER, False, "tableSmallCharacter")
    # setCell(table.cell(1, 7), "其他综合收益", WD_PARAGRAPH_ALIGNMENT.CENTER, False, "tableSmallCharacter")
    # setCell(table.cell(1, 8), "专项储备", WD_PARAGRAPH_ALIGNMENT.CENTER, False, "tableSmallCharacter")
    # setCell(table.cell(1, 9), "盈余公积", WD_PARAGRAPH_ALIGNMENT.CENTER, False, "tableSmallCharacter")
    # setCell(table.cell(1, 10), "未分配利润", WD_PARAGRAPH_ALIGNMENT.CENTER, False, "tableSmallCharacter")
    # setCell(table.cell(1, 11), "所有者权益合计", WD_PARAGRAPH_ALIGNMENT.CENTER, False, "tableSmallCharacter")
    # setCell(table.cell(2, 2), "优先股", WD_PARAGRAPH_ALIGNMENT.CENTER, False, "tableSmallCharacter")
    # setCell(table.cell(2, 3), "永续债", WD_PARAGRAPH_ALIGNMENT.CENTER, False, "tableSmallCharacter")
    # setCell(table.cell(2, 4), "其他", WD_PARAGRAPH_ALIGNMENT.CENTER, False, "tableSmallCharacter")
    # # 合并单元格
    # # 第一列
    # for i in range(1, 3):
    #     table.cell(i, 0).merge(table.cell(i - 1, 0))
    # # 第一行
    # for i in range(2, 12):
    #     table.cell(0, i).merge(table.cell(0, i - 1))
    # # 第二列
    # table.cell(2, 1).merge(table.cell(1, 1))
    # # 第二行
    # for i in range(3, 5):
    #     table.cell(1, i).merge(table.cell(1, i - 1))
    # # 第七列到十二列
    # for i in range(5, 12):
    #     table.cell(2, i).merge(table.cell(1, i))

    set_cell_border(table.cell(0,
                               len(table.columns) - 1),
                    right={
                        "sz": 0,
                        "val": "",
                        "space": "0"
                    })