财务季报评估报表数据提取+自动撰写2.1

财务季报分析:行业资产、负债、收入与成本变化
该程序读取资产负债表.xlsx文件,针对批发业、零售业、住宿业和餐饮业,计算并比较了1-3季度的企业数量、资产总计、负债合计、营业收入、营业成本、税金及附加、四项费用、营业利润、应交增值税等关键指标,并分析了各行业的变化趋势。同时,计算了营业收入户均值和人均值,展示了不同行业的财务状况。最后,将结果保存到'财务季报评估报告.docx'中。
from docx import Document
from docx.shared import Inches

document = Document()


from openpyxl import load_workbook

'''
@File    :
@Author  :  william
@Time    :  2020/09/29
@notice  :  null
@coding  : utf-8
'''
# import xlrd
# from xlutils.copy import copy
import openpyxl

# 下一步还得训练程序
# 使其满足对excel文件名和excel工作薄的识别
# 记得把表格再粘贴下,转成仅值




ws = 0
row_result = 0
column_result = 0
result = 0

#####################################################################锁定资产负债表和工作薄
# 如下代码用于多个相关表的打开操作
fn = '资产负债表.xlsx'
wb = openpyxl.load_workbook(fn)

ws = wb.get_sheet_by_name('资产负债表')


# print(ws)


def getdate(date_row, date_column):
    # print(date_row)
    # print(date_column)

    for row in ws.iter_rows():
        for cell in row:
            if str(str(cell.value).replace(' ', '')).find(date_row) != -1:
                row_result = cell.row
            # print(row_result)
            else:
                result = 0

                break
    for row in ws.iter_rows():
        for cell in row:
            if str(str(cell.value).replace(' ', '')).find(date_column) != -1:
                column_result = cell.column
                #  print(column_result)

                break
    # print(column_result)
    if row_result == 0 or column_result == 0:
        result = 0

    else:
        if ws.cell(row=row_result, column=column_result).value != None:
            # print(column_result)
            result = ws.cell(row=row_result, column=column_result).value
        # print(result)

    return result


def getdate_lastyear(date_row, date_column):
    # print(date_row)
    # print(date_column)

    for row in ws.iter_rows():
        for cell in row:
            if str(str(cell.value).replace(' ', '')).find(date_row) != -1:
                row_result = cell.row
            # print(row_result)
            else:
                result = 0

                break
    for row in ws.iter_rows():
        for cell in row:
            if str(str(cell.value).replace(' ', '')).find(date_column) != -1:
                column_result = cell.column + 1
                #  print(column_result)

                break
    # print(column_result)
    if row_result == 0 or column_result == 0:
        result = 0

    else:
        if ws.cell(row=row_result, column=column_result).value != None:
            # print(column_result)
            result = ws.cell(row=row_result, column=column_result).value
        # print(result)

    return result


def getspeed(date_row, date_column):
    # print(date_row)
    # print(date_column)

    for row in ws.iter_rows():
        for cell in row:
            if str(str(cell.value).replace(' ', '')).find(date_row) != -1:
                row_result = cell.row
            # print(row_result)
            else:
                result = 0

                break
    for row in ws.iter_rows():
        for cell in row:
            if str(str(cell.value).replace(' ', '')).find(date_column) != -1:
                column_result = cell.column + 2
                #  print(column_result)

                break
    # print(column_result)
    if row_result == 0 or column_result == 0:
        result = 0

    else:
        if ws.cell(row=row_result, column=column_result).value != None:
            # print(column_result)
            result = ws.cell(row=row_result, column=column_result).value
        # print(result)

    return result


if __name__ == '__main__':
    print("企业数和企业亏损情况")
    print(round(getdate('总计', '企业数'), 1));

    print('资产情况')

    print(round(getdate('总计', '资产总计'), 1));
    print(round(getspeed('总计', '资产总计'), 1));

    print(round(getdate('一、批发业', '资产总计'), 1));
    print(round(getspeed('一、批发业', '资产总计'), 1));

    print(round(getdate('二、零售业', '资产总计'), 1));
    print(round(getspeed('二、零售业', '资产总计'), 1));

    print(round(getdate('三、住宿业', '资产总计'), 1));
    print(round(getspeed('三、住宿业', '资产总计'), 1));

    print(round(getdate('四、餐饮业', '资产总计'), 1));
    print(round(getspeed('四、餐饮业', '资产总计'), 1));

    print('负债情况')

    print(round(getdate('总计', '负债合计'), 1));
    print(round(getspeed('总计', '负债合计'), 1));

    print(round(getdate('一、批发业', '负债合计'), 1));
    print(round(getspeed('一、批发业', '负债合计'), 1));

    print(round(getdate('二、零售业', '负债合计'), 1));
    print(round(getspeed('二、零售业', '负债合计'), 1));

    print(round(getdate('三、住宿业', '负债合计'), 1));
    print(round(getspeed('三、住宿业', '负债合计'), 1));

    print(round(getdate('四、餐饮业', '负债合计'), 1));
    print(round(getspeed('四、餐饮业', '负债合计'), 1));

    print('营业收入')

    print(round(getdate('总计', '营业收入'), 1));
    print(round(getspeed('总计', '营业收入'), 1));

    print(round(getdate('一、批发业', '营业收入'), 1));
    print(round(getspeed('一、批发业', '营业收入'), 1));

    print(round(getdate('二、零售业', '营业收入'), 1));
    print(round(getspeed('二、零售业', '营业收入'), 1));

    print(round(getdate('三、住宿业', '营业收入'), 1));
    print(round(getspeed('三、住宿业', '营业收入'), 1));

    print(round(getdate('四、餐饮业', '营业收入'), 1));
    print(round(getspeed('四、餐饮业', '营业收入'), 1));

    print('营业成本')

    print(round(getdate('总计', '营业成本'), 1));
    print(round(getspeed('总计', '营业成本'), 1));

    print(round(getdate('一、批发业', '营业成本'), 1));
    print(round(getspeed('一、批发业', '营业成本'), 1));

    print(round(getdate('二、零售业', '营业成本'), 1));
    print(round(getspeed('二、零售业', '营业成本'), 1));

    print(round(getdate('三、住宿业', '营业成本'), 1));
    print(round(getspeed('三、住宿业', '营业成本'), 1));

    print(round(getdate('四、餐饮业', '营业成本'), 1));
    print(round(getspeed('四、餐饮业', '营业成本'), 1));

    print('营业税金')

    print(round(getdate('总计', '税金及附加'), 1));
    print(round(getspeed('总计', '税金及附加'), 1));

    print(round(getdate('一、批发业', '税金及附加'), 1));
    print(round(getspeed('一、批发业', '税金及附加'), 1));

    print(round(getdate('二、零售业', '税金及附加'), 1));
    print(round(getspeed('二、零售业', '税金及附加'), 1));

    print(round(getdate('三、住宿业', '税金及附加'), 1));
    print(round(getspeed('三、住宿业', '税金及附加'), 1));

    print(round(getdate('四、餐饮业', '税金及附加'), 1));
    print(round(getspeed('四、餐饮业', '税金及附加'), 1));

    print('四项费用')

    print(round(getdate('总计', '销售费用') + getdate('总计', '管理费用') + getdate('总计', '研发费用') + getdate('总计', '财务费用'), 1));

    print(
        round(((getdate('总计', '销售费用') + getdate('总计', '管理费用') + getdate('总计', '研发费用') + getdate('总计', '财务费用')) / (
                    getdate_lastyear('总计', '销售费用') + getdate_lastyear('总计', '管理费用') + getdate_lastyear('总计',
                                                                                                       '研发费用') + getdate_lastyear(
                '总计', '财务费用')) - 1) * 100, 1)
    )

    print(
        round(getdate('一、批发业', '销售费用') + getdate('一、批发业', '管理费用') + getdate('一、批发业', '研发费用') + getdate('一、批发业', '财务费用'),
              1));
    print(
        round(((getdate('一、批发业', '销售费用') + getdate('一、批发业', '管理费用') + getdate('一、批发业', '研发费用') + getdate('一、批发业',
                                                                                                         '财务费用')) / (
                           getdate_lastyear('一、批发业', '销售费用') + getdate_lastyear('一、批发业', '管理费用') + getdate_lastyear(
                       '一、批发业', '研发费用') + getdate_lastyear('一、批发业', '财务费用')) - 1) * 100, 1)
    )

    print(
        round(getdate('二、零售业', '销售费用') + getdate('二、零售业', '管理费用') + getdate('二、零售业', '研发费用') + getdate('二、零售业', '财务费用'),
              1));
    print(
        round(((getdate('二、零售业', '销售费用') + getdate('二、零售业', '管理费用') + getdate('二、零售业', '研发费用') + getdate('二、零售业',
                                                                                                         '财务费用')) / (
                           getdate_lastyear('二、零售业', '销售费用') + getdate_lastyear('二、零售业', '管理费用') + getdate_lastyear(
                       '二、零售业', '研发费用') + getdate_lastyear('二、零售业', '财务费用')) - 1) * 100, 1)
    )
    print(
        round(getdate('三、住宿业', '销售费用') + getdate('三、住宿业', '管理费用') + getdate('三、住宿业', '研发费用') + getdate('三、住宿业', '财务费用'),
              1));
    print(
        round(((getdate('三、住宿业', '销售费用') + getdate('三、住宿业', '管理费用') + getdate('三、住宿业', '研发费用') + getdate('三、住宿业',
                                                                                                         '财务费用')) / (
                           getdate_lastyear('三、住宿业', '销售费用') + getdate_lastyear('三、住宿业', '管理费用') + getdate_lastyear(
                       '三、住宿业', '研发费用') + getdate_lastyear('三、住宿业', '财务费用')) - 1) * 100, 1)
    )

    print(
        round(getdate('四、餐饮业', '销售费用') + getdate('四、餐饮业', '管理费用') + getdate('四、餐饮业', '研发费用') + getdate('四、餐饮业', '财务费用'),
              1));
    print(
        round(((getdate('四、餐饮业', '销售费用') + getdate('四、餐饮业', '管理费用') + getdate('四、餐饮业', '研发费用') + getdate('四、餐饮业',
                                                                                                         '财务费用')) / (
                           getdate_lastyear('四、餐饮业', '销售费用') + getdate_lastyear('四、餐饮业', '管理费用') + getdate_lastyear(
                       '四、餐饮业', '研发费用') + getdate_lastyear('四、餐饮业', '财务费用')) - 1) * 100, 1)
    )

    print('营业利润')

    print(round(getdate('总计', '营业利润'), 1));
    print(round(getspeed('总计', '营业利润'), 1));

    print(round(getdate('一、批发业', '营业利润'), 1));
    print(round(getspeed('一、批发业', '营业利润'), 1));

    print(round(getdate('二、零售业', '营业利润'), 1));
    print(round(getspeed('二、零售业', '营业利润'), 1));

    print(round(getdate('三、住宿业', '营业利润'), 1));
    print(round(getspeed('三、住宿业', '营业利润'), 1));

    print(round(getdate('四、餐饮业', '营业利润'), 1));
    print(round(getspeed('四、餐饮业', '营业利润'), 1));

    print('应交增值税')

    print(round(getdate('总计', '应交增值税'), 1));
    print(round(getspeed('总计', '应交增值税'), 1));

    print(round(getdate('一、批发业', '应交增值税'), 1));
    print(round(getspeed('一、批发业', '应交增值税'), 1));

    print(round(getdate('二、零售业', '应交增值税'), 1));
    print(round(getspeed('二、零售业', '应交增值税'), 1));

    print(round(getdate('三、住宿业', '应交增值税'), 1));
    print(round(getspeed('三、住宿业', '应交增值税'), 1));

    print(round(getdate('四、餐饮业', '应交增值税'), 1));
    print(round(getspeed('四、餐饮业', '应交增值税'), 1));

    print('资产负债率')
    if (getdate('总计', '负债合计') > 0 and getdate('总计', '资产总计') > 0):
        print(round(getdate('总计', '负债合计') / getdate('总计', '资产总计') * 100, 1));
    else:
        print("error")

    if (getdate('总计', '资产总计') > 0 and getdate_lastyear('总计', '资产总计') > 0 and getdate('总计',
                                                                                     '负债合计') > 0 and getdate_lastyear(
            '总计', '负债合计') > 0):
        print(round((getdate('总计', '负债合计') / getdate('总计', '资产总计') - getdate_lastyear('总计', '负债合计') / getdate_lastyear(
            '总计', '资产总计')) * 100, 1));
    else:
        print("error")

    if (getdate('一、批发业', '资产总计') > 0 and getdate('一、批发业', '负债合计') > 0):
        print(round(getdate('一、批发业', '负债合计') / getdate('一、批发业', '资产总计') * 100, 1));
    else:
        print("error")
    if (getdate('一、批发业', '资产总计') > 0 and getdate_lastyear('一、批发业', '资产总计') > 0 and getdate('一、批发业',
                                                                                           '负债合计') > 0 and getdate_lastyear(
            '一、批发业', '负债合计') > 0):
        print(round((getdate('一、批发业', '负债合计') / getdate('一、批发业', '资产总计') - getdate_lastyear('一、批发业',
                                                                                            '负债合计') / getdate_lastyear(
            '一、批发业', '资产总计')) * 100, 1));
    else:
        print("error")

    if (getdate('二、零售业', '资产总计') > 0 and getdate('二、零售业', '负债合计') > 0):
        print(round(getdate('二、零售业', '负债合计') / getdate('二、零售业', '资产总计') * 100, 1));
    else:
        print("error")

    if (getdate('二、零售业', '资产总计') > 0 and getdate_lastyear('二、零售业', '资产总计') > 0 and getdate('二、零售业',
                                                                                           '负债合计') > 0 and getdate_lastyear(
            '二、零售业', '负债合计') > 0):
        print(round((getdate('二、零售业', '负债合计') / getdate('二、零售业', '资产总计') - getdate_lastyear('二、零售业',
                                                                                            '负债合计') / getdate_lastyear(
            '二、零售业', '资产总计')) * 100, 1));
    else:
        print("error")

    if (getdate('三、住宿业', '资产总计') > 0 and getdate('三、住宿业', '负债合计') > 0):
        print(round(getdate('三、住宿业', '负债合计') / getdate('三、住宿业', '资产总计') * 100, 1));
    else:
        print("error")

    if (getdate('三、住宿业', '资产总计') > 0 and getdate_lastyear('三、住宿业', '资产总计') > 0 and getdate('三、住宿业',
                                                                                           '负债合计') > 0 and getdate_lastyear(
            '三、住宿业', '负债合计') > 0):
        print(round((getdate('三、住宿业', '负债合计') / getdate('三、住宿业', '资产总计') - getdate_lastyear('三、住宿业',
                                                                                            '负债合计') / getdate_lastyear(
            '三、住宿业', '资产总计')) * 100, 1));
    else:
        print("error")

    if (getdate('三、住宿业', '资产总计') > 0 and getdate('四、餐饮业', '负债合计') > 0):
        print(round(getdate('四、餐饮业', '负债合计') / getdate('三、住宿业', '资产总计') * 100, 1));
    else:
        print("error")

    if (getdate('四、餐饮业', '资产总计') > 0 and getdate_lastyear('四、餐饮业', '资产总计') > 0 and getdate('四、餐饮业',
                                                                                           '负债合计') > 0 and getdate_lastyear(
            '四、餐饮业', '负债合计') > 0):
        print(round((getdate('四、餐饮业', '负债合计') / getdate('四、餐饮业', '资产总计') - getdate_lastyear('四、餐饮业',
                                                                                            '负债合计') / getdate_lastyear(
            '四、餐饮业', '资产总计')) * 100, 1));
    else:
        print("error")
    print('毛利率')

    if (getdate('总计', '营业收入') > 0 and getdate('总计', '营业成本') > 0):
        print(round((1 - getdate('总计', '营业成本') / getdate('总计', '营业收入')) * 100, 1));
    else:
        print("error")

    if (getdate_lastyear('总计', '营业收入') > 0 and getdate('总计', '营业收入') > 0 and getdate_lastyear('总计',
                                                                                              '营业成本') > 0 and getdate(
            '总计', '营业成本') > 0):
        print(round((getdate_lastyear('总计', '营业成本') / getdate_lastyear('总计', '营业收入') - getdate('总计', '营业成本') / getdate(
            '总计', '营业收入')) * 100, 1));
    else:
        print("error")

    if (getdate('一、批发业', '营业收入') > 0 and getdate('一、批发业', '营业成本') > 0):
        print(round((1 - getdate('一、批发业', '营业成本') / getdate('一、批发业', '营业收入')) * 100, 1));
    else:
        print("error")

    if (getdate_lastyear('一、批发业', '营业收入') > 0 and getdate('一、批发业', '营业收入') > 0 and getdate_lastyear('一、批发业',
                                                                                                    '营业成本') > 0 and getdate(
            '一、批发业', '营业成本') > 0):
        print(round((getdate_lastyear('一、批发业', '营业成本') / getdate_lastyear('一、批发业', '营业收入') - getdate('一、批发业',
                                                                                                     '营业成本') / getdate(
            '一、批发业', '营业收入')) * 100, 1));
    else:
        print("error")

    if (getdate('二、零售业', '营业收入') > 0 and getdate('二、零售业', '营业成本') > 0):
        print(round((1 - getdate('二、零售业', '营业成本') / getdate('二、零售业', '营业收入')) * 100, 1));
    else:
        print("error")
    if (getdate_lastyear('二、零售业', '营业收入') > 0 and getdate('二、零售业', '营业收入') > 0 and getdate_lastyear('二、零售业',
                                                                                                    '营业成本') > 0 and getdate(
            '二、零售业', '营业成本') > 0):

        print(round((getdate_lastyear('二、零售业', '营业成本') / getdate_lastyear('二、零售业', '营业收入') - getdate('二、零售业',
                                                                                                     '营业成本') / getdate(
            '二、零售业', '营业收入')) * 100, 1));
    else:
        print("error")
    if (getdate('三、住宿业', '营业收入') > 0 and getdate('三、住宿业', '营业收入') > 0):
        print(round((1 - getdate('三、住宿业', '营业成本') / getdate('三、住宿业', '营业收入')) * 100, 1));
    else:
        print("error")
    if (getdate_lastyear('三、住宿业', '营业收入') > 0 and getdate('三、住宿业', '营业收入') > 0 and getdate_lastyear('三、住宿业',
                                                                                                    '营业成本') > 0 and getdate(
            '三、住宿业', '营业成本') > 0):
        print(round((getdate_lastyear('三、住宿业', '营业成本') / getdate_lastyear('三、住宿业', '营业收入') - getdate('三、住宿业',
                                                                                                     '营业成本') / getdate(
            '三、住宿业', '营业收入')) * 100, 1));
    else:
        print("error")
    if (getdate('四、餐饮业', '营业收入') > 0 and getdate('四、餐饮业', '营业成本') > 0):
        print(round((1 - getdate('四、餐饮业', '营业成本') / getdate('四、餐饮业', '营业收入')) * 100, 1));
    else:
        print("error")
    if (getdate_lastyear('四、餐饮业', '营业收入') > 0 and getdate('四、餐饮业', '营业收入') > 0 and getdate_lastyear('四、餐饮业',
                                                                                                    '营业成本') > 0 and getdate(
            '四、餐饮业', '营业成本') > 0):
        print(round((getdate_lastyear('四、餐饮业', '营业成本') / getdate_lastyear('四、餐饮业', '营业收入') - getdate('四、餐饮业',
                                                                                                     '营业成本') / getdate(
            '四、餐饮业', '营业收入')) * 100, 1));
    else:
        print("error")

    print('营业收入户均值')

    if (getdate('一、批发业', '企业数') > 0):
        print(round(getdate('一、批发业', '营业收入') / getdate('一、批发业', '企业数') * 10000, 1));
    else:
        print("error")
    if (getdate('二、零售业', '企业数') > 0):
        print(round(getdate('二、零售业', '营业收入') / getdate('二、零售业', '企业数') * 10000, 1));
    else:
        print("error")
    if (getdate('三、住宿业', '企业数') > 0):
        print(round(getdate('三、住宿业', '营业收入') / getdate('三、住宿业', '企业数') * 10000, 1));
    else:
        print("error")
    if (getdate('四、餐饮业', '企业数') > 0):
        print(round(getdate('四、餐饮业', '营业收入') / getdate('四、餐饮业', '企业数') * 10000, 1));
    else:
        print("error")

    print('营业收入人均值')

    if (getdate('一、批发业', '从业人员平均人数(人)') > 0):
        print(round(getdate('一、批发业', '营业收入') / getdate('一、批发业', '从业人员平均人数(人)') * 10000, 1));
    else:
        print("error")

    if (getdate('二、零售业', '从业人员平均人数(人)') > 0):
        print(round(getdate('二、零售业', '营业收入') / getdate('二、零售业', '从业人员平均人数(人)') * 10000, 1));
    else:
        print("error")

    if (getdate('三、住宿业', '从业人员平均人数(人)') > 0):
        print(round(getdate('三、住宿业', '营业收入') / getdate('三、住宿业', '从业人员平均人数(人)') * 10000, 1));
    else:
        print("error")

    if (getdate('四、餐饮业', '从业人员平均人数(人)') > 0):
        print(round(getdate('四、餐饮业', '营业收入') / getdate('四、餐饮业', '从业人员平均人数(人)') * 10000, 1));
    else:
        print("error")

    print('销售费用')

    print(round(getdate('总计', '销售费用'), 1));

    print(
        round(((getdate('总计', '销售费用')) / (getdate_lastyear('总计', '销售费用')) - 1) * 100, 1)
    )

    print(round(getdate('一、批发业', '销售费用'), 1));
    print(
        round(((getdate('一、批发业', '销售费用')) / (getdate_lastyear('一、批发业', '销售费用')) - 1) * 100, 1)
    )

    print(round(getdate('二、零售业', '销售费用'), 1));
    print(
        round(((getdate('二、零售业', '销售费用')) / (getdate_lastyear('二、零售业', '销售费用')) - 1) * 100, 1)
    )
    print(round(getdate('三、住宿业', '销售费用'), 1));
    print(
        round(((getdate('三、住宿业', '销售费用')) / (getdate_lastyear('三、住宿业', '销售费用')) - 1) * 100, 1)
    )

    print(round(getdate('四、餐饮业', '销售费用'), 1));
    print(
        round(((getdate('四、餐饮业', '销售费用')) / (getdate_lastyear('四、餐饮业', '销售费用')) - 1) * 100, 1)
    )

    print('管理费用')

    print(round(getdate('总计', '管理费用'), 1));

    print(
        round(((getdate('总计', '管理费用')) / (getdate_lastyear('总计', '管理费用')) - 1) * 100, 1)
    )

    print(round(getdate('一、批发业', '管理费用'), 1));
    print(
        round(((getdate('一、批发业', '管理费用')) / (getdate_lastyear('一、批发业', '管理费用')) - 1) * 100, 1)
    )

    print(round(getdate('二、零售业', '管理费用'), 1));
    print(
        round(((getdate('二、零售业', '管理费用')) / (getdate_lastyear('二、零售业', '管理费用')) - 1) * 100, 1)
    )
    print(round(getdate('三、住宿业', '管理费用'), 1));
    print(
        round(((getdate('三、住宿业', '管理费用')) / (getdate_lastyear('三、住宿业', '管理费用')) - 1) * 100, 1)
    )

    print(round(getdate('四、餐饮业', '管理费用'), 1));
    print(
        round(((getdate('四、餐饮业', '管理费用')) / (getdate_lastyear('四、餐饮业', '管理费用')) - 1) * 100, 1)
    )

    print('研发费用')

    print(round(getdate('总计', '研发费用'), 1));

    print(
        round(((getdate('总计', '研发费用')) / (getdate_lastyear('总计', '研发费用')) - 1) * 100, 1)
    )

    print(round(getdate('一、批发业', '研发费用'), 1));
    print(
        round(((getdate('一、批发业', '研发费用')) / (getdate_lastyear('一、批发业', '研发费用')) - 1) * 100, 1)
    )

    print(round(getdate('二、零售业', '研发费用'), 1));

    if (getdate_lastyear('二、零售业', '研发费用') > 0):
        print(round(((getdate('二、零售业', '研发费用')) / (getdate_lastyear('二、零售业', '研发费用')) - 1) * 100, 1));
    else:
        print("error")


    print(round(getdate('三、住宿业', '研发费用'), 1));

    if (getdate_lastyear('三、住宿业', '研发费用') != 0):

        print(round(((getdate('三、住宿业', '研发费用')) / (getdate_lastyear('三、住宿业', '研发费用')) - 1) * 100, 1))
    else:
        print("error")
    print(round(getdate('四、餐饮业', '研发费用'), 1));

    if (getdate_lastyear('四、餐饮业', '研发费用') != 0):
        print(
            round(((getdate('四、餐饮业', '研发费用')) / (getdate_lastyear('四、餐饮业', '研发费用')) - 1) * 100, 1)
        )
    else:
        print("error")

        print('财务费用')

    print(round(getdate('总计', '财务费用'), 1));

    print(
        round(((getdate('总计', '财务费用')) / (getdate_lastyear('总计', '财务费用')) - 1) * 100, 1)
    )

    print(round(getdate('一、批发业', '财务费用'), 1));
    print(
        round(((getdate('一、批发业', '财务费用')) / (getdate_lastyear('一、批发业', '财务费用')) - 1) * 100, 1)
    )

    print(round(getdate('二、零售业', '财务费用'), 1));
    print(
        round(((getdate('二、零售业', '财务费用')) / (getdate_lastyear('二、零售业', '财务费用')) - 1) * 100, 1)
    )
    print(round(getdate('三、住宿业', '财务费用'), 1));
    print(
        round(((getdate('三、住宿业', '财务费用')) / (getdate_lastyear('三、住宿业', '财务费用')) - 1) * 100, 1)
    )

    print(round(getdate('四、餐饮业', '财务费用'), 1));
    print(
        round(((getdate('四、餐饮业', '财务费用')) / (getdate_lastyear('四、餐饮业', '财务费用')) - 1) * 100, 1)
    )





document.add_heading("财务季报评估报告")
paragraph100 = document.add_paragraph('一、四行业总体情况')


'''
paragraph101 = document.add_paragraph('1-3季度,济南市财务季报上报单位3083个,其中亏损单位1330个,占全市限上企业的43.1%,主要受新冠肺炎疫情影响,亏损企业较去年增多,占比提高。其中批发业亏损企业618个,占批发业企业的33.9%;零售业亏损企业409个,占零售业企业的49.3%;住宿业亏损企业113个,占住宿业企业的72.4%;餐饮业亏损企业190个,占餐饮企业的69.3%。')
'''

paragraph101 = document.add_paragraph('1-3季度,济南市财务季报上报单位')
paragraph101.add_run(str(round(getdate('总计', '企业数'), 1)))
paragraph101.add_run('个')
paragraph101.add_run("。其中批发业企业")
paragraph101.add_run("个,占比")
paragraph101.add_run("%;零售业企业")
paragraph101.add_run("个,占比")
paragraph101.add_run("%;住宿业企业")
paragraph101.add_run("个,占比")
paragraph101.add_run("%;餐饮业企业")
paragraph101.add_run("个,占比")
paragraph101.add_run("%。")







paragraph200 = document.add_paragraph('二、财务数据分析')


'''
paragraph201 = document.add_paragraph('1、资产情况。1-2季度,全市限额以上企业资产总计3683.4亿元,同比下降0.6%。其中,批发业企业资产总计2768.8亿元,同比下降2.2%;零售业企业资产总计797.5亿元,同比增长7.2%;住宿业企业资产总计65.1亿元,同比下降16.0%;餐饮业企业资产总计51.9亿元,同比下降0.3%。')‘’

'''




paragraph201 = document.add_paragraph('1、资产情况。1-2季度,全市限额以上企业资产总计')
paragraph101.add_run(str(round(getdate('总计', '资产总计'), 1)))
paragraph101.add_run('亿元,同比下降')
paragraph101.add_run(str(round(getspeed('总计', '资产总计'), 1)))
paragraph101.add_run('%。其中,批发业企业资产总计')
paragraph101.add_run(str(round(getdate('一、批发业', '资产总计'), 1)))
paragraph101.add_run('亿元,同比下降')
paragraph101.add_run(str(round(getspeed('一、批发业', '资产总计'), 1)))
paragraph101.add_run('%;零售业企业资产总计')
paragraph101.add_run(str(round(getdate('二、零售业', '资产总计'), 1)))
paragraph101.add_run('亿元,同比增长')
paragraph101.add_run(str(round(getspeed('二、零售业', '资产总计'), 1)))
paragraph101.add_run('%;住宿业企业资产总计')
paragraph101.add_run(str(round(getdate('三、住宿业', '资产总计'), 1)))
paragraph101.add_run('亿元,同比下降')
paragraph101.add_run(str(round(getspeed('三、住宿业', '资产总计'), 1)))
paragraph101.add_run('%;餐饮业企业资产总计')
paragraph101.add_run(str((getdate('四、餐饮业', '资产总计'), 1)))
paragraph101.add_run('亿元,同比下降')
paragraph101.add_run(str(round(getspeed('四、餐饮业', '资产总计'), 1)))
paragraph101.add_run('%。')


paragraph202 = document.add_paragraph('2、负债情况。1-2季度,全市限额以上企业负债合计'
                                      '亿元,同比增长'
                                      '%。其中,批发业企业负债合计'
                                      '亿元,同比增长'
                                      '%;零售业企业负债合计'
                                      '亿元,同比增长5.5%;住宿业企业负债合计'
                                      '亿元,同比下降19.7%;餐饮业企业负债合计'
                                      '亿元,同比增长'
                                      '%。')



paragraph203 = document.add_paragraph('3、营业收入。1-2季度,全市限额以上企业实现营业收入'
                                      '亿元,同比下降'
                                      '%。其中,批发业企业实现营业收入'
                                      '亿元,同比增长'
                                      '%;零售业企业营业收入'
                                      '亿元,同比下降'
                                      '%;住宿业企业营业收入'
                                      '亿元,同比下降'
                                      '%;餐饮业企业营业收入'
                                      '亿元,同比下降'
                                      '%。')
paragraph204 = document.add_paragraph('4、营业成本。1-2季度,全市限额以上企业营业成本合计'
                                      '亿元,同比下降'
                                      '%。其中,批发业企业营业成本'
                                      '亿元,同比增长'
                                      '%;零售业企业营业成本'
                                      '亿元,同比下降'
                                      '%;住宿业企业营业成本'
                                      '亿元,同比下降'
                                      '%;餐饮业企业营业成本合计'
                                      '亿元,同比下降'
                                      '%。')



paragraph205 = document.add_paragraph('5、营业税金。1-2季度,全市限额以上企业税金及附加合计'
                                      '亿元,同比下降'
                                      '%。其中,批发业企业税金及附加合计'
                                      '亿元,同比下降'
                                      '%,零售业企业税金及附加合计'
                                      '亿元,同比下降'
                                      '%;住宿业企业税金及附加合计'
                                      '亿元,同比下降'
                                      '%;餐饮业企业税金及附加合计'
                                      '亿元,同比下降'
                                      '%。')




paragraph206 = document.add_paragraph('6、四项费用。1-2季度,全市限额以上企业销售费用、管理费用、研发费用及财务费用合计'
                                      '亿元,同比下降'
                                      '%。其中批发业企业四项费用合计'
                                      '亿元,同比下降'
                                      '%;零售业企业四项费用合计'
                                      '亿元,同比下降'
                                      '%;住宿业企业四项费用合计'
                                      '亿元,同比下降'
                                      '%;餐饮业企业四项费用合计'
                                      '亿元,同比下降'
                                      '%。')


paragraph207 = document.add_paragraph('7、营业利润。1-2季度,全市限额以上企业营业利润合计'
                                      '亿元,同比下降'
                                      '%。批发业企业营业利润合计'
                                      '亿元,同比增长'
                                      '%;零售业企业营业利润合计'
                                      '亿元,同比下降'
                                      '%;住宿业企业营业利润合计'
                                      '亿元,而去年同期为'
                                      '亿元;餐饮业企业营业利润合计'
                                      '亿,而去年同期为'
                                      '亿元。')



paragraph208 = document.add_paragraph('8、应交增值税。1-2季度,全市限额以上企业应交增值税合计'
                                      '亿元,而去年同期为'
                                      '亿元。其中批发业企业应交增值税合计'
                                      '亿元,而去年同期为'
                                      '亿元;零售业企业应交增值税合计'
                                      '亿元,同比下降'
                                      '%;住宿业企业应交增值税合计'
                                      '亿元,而去年同期为'
                                      '亿元;餐饮业企业应交增值税'
                                      '亿元,同比下降'
                                      '%。')


paragraph209 = document.add_paragraph('9、资产负债率。1-2季度,全市限额以上企业资产负债率'
                                      '%,比去年同期提高'
                                      '个百分点。其中批发业企业资产负债率'
                                      '%,比去年同期提高'
                                      '个百分点;零售业企业资产负债率'
                                      '%,比去年同期提高'
                                      '个百分点;住宿业企业资产负债率'
                                      '%,比去年同期下降'
                                      '个百分点;餐饮业企业资产负债率'
                                      '%,比去年同期提高'
                                      '个百分点。')


paragraph210 = document.add_paragraph('10、毛利率。1-2季度,全市限额以上企业毛利率7.1%,比去年同期减少1.1个百分点。其中批发业企业毛利率5.4%,比去年同期减少0.4个百分点;零售业企业毛利率12.9%,比上年同期减少1.5个百分点;住宿业企业毛利率59.7%,比上年同期减少10个百分点;餐饮业企业毛利率49.1%,比上年同期减少5.4个百分点。')
paragraph211 = document.add_paragraph('11、营业收入户均值。1-2季度,全市限额以上企业中批发业营业收入户均值1.3亿元;零售业企业营业收入户均值0.6亿元;住宿业企业营业收入户均值570万元;餐饮业企业营业收入户均值470万元。')
paragraph212 = document.add_paragraph('12、营业收入人均值。1-2季度,全市限额以上企业中批发业企业营业收入人均值348.1万元;零售业企业营业收入人均值72.9万元;住宿业企业营业收入人均值6.3万元;餐饮业营业收入人均值7.0万元。')












document.save('财务季报评估报告.docx')
【电动汽车充电站有序充电调度的分散式优化】基于蒙特卡诺和拉格朗日的电动汽车优化调度(分时电价调度)(Matlab代码实现)内容概要:本文介绍了基于蒙特卡洛和拉格朗日方法的电动汽车充电站有序充电调度优化方案,重点在于采用分散式优化策略应对分时电价机制下的充电需求管理。通过构建数学模型,结合不确定性因素如用户充电行为和电网负荷波动,利用蒙特卡洛模拟生成大量场景,并运用拉格朗日松弛法对复杂问题进行分解求解,从而实现全局最优或近似最优的充电调度计划。该方法有效降低了电网峰值负荷压力,提升了充电站运营效率与经济效益,同时兼顾用户充电便利性。 适合人群:具备一定电力系统、优化算法和Matlab编程基础的高校研究生、科研人员及从事智能电网、电动汽车相关领域的工程技术人员。 使用场景及目标:①应用于电动汽车充电站的日常运营管理,优化充电负荷分布;②服务于城市智能交通系统规划,提升电网与交通系统的协同水平;③作为学术研究案例,用于验证分散式优化算法在复杂能源系统中的有效性。 阅读建议:建议读者结合Matlab代码实现部分,深入理解蒙特卡洛模拟与拉格朗日松弛法的具体实施步骤,重点关注场景生成、约束处理与迭代收敛过程,以便在实际项目中灵活应用与改进。
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值