税率计算

 1 # !/usr/bin/python36
 2 # -*- coding: UTF-8 -*-
 3 __author__ = 'zp'
 4 
 5 temp = ['不含税收入金额', '增值税税额', '城建税税额', '教育费附加税额', '地方税金额', '印花税', '水利基金']
 6 temp_01 = {}
 7 k = 0
 8 
 9 
10 class TaxCalculation(object):
11     """
12     计算各个公司的每月报税金额
13     """
14 
15     def __init__(self, name, tax_income, time=''):
16         """
17         基本数据定义
18         :param name: 公司名称
19         :param tax_income: 每月金额
20         :return:
21         """
22         self.name = name
23         self.time = time
24         self.tax_income = tax_income  # 含税收入金额
25         self.k = 0
26 
27     def __str__(self):
28         # print('公司名称:{}'.format(self.name))
29         # print('不含税收入金额:', self.basic_algorithm()[0])
30         mag = self.accumulative_number()
31         return mag
32 
33     def basic_algorithm(self):
34         """
35         基本税率计算公式
36         :return:
37         """
38         tax_free_income = self.tax_income / 1.03  # 不含税收入金额
39         value_added_tax = tax_free_income * 0.03  # 增值税税额
40         construction_tax = value_added_tax * 0.07  # 城建税税额
41         ducatione_tax = value_added_tax * 0.03  # 教育费附加税额
42         local_tax = value_added_tax * 0.02  # 地方税金额
43         stamp_duty = tax_free_income * 0.8 * 0.0003  # 印花税
44         water_resources_fund = tax_free_income * 0.006  # 水利基金
45         return tax_free_income, value_added_tax, construction_tax, ducatione_tax, local_tax, stamp_duty, water_resources_fund
46 
47     def accumulative_number(self):
48         """
49         累计
50         :return:
51         """
52         for i in temp:
53             new_num = round(self.basic_algorithm()[self.k], 2)
54             temp_01[i] = new_num
55             self.k += 1
56         for key, values in temp_01.items():
57             print('{}:'.format(key), '{}'.format(values, ">20"))
58             print()
59         print(temp_01)
60         # return temp_01
61 
62 if __name__ == '__main__':
63     print('''
64     **********************************************************
65     基本税额计算,只包含基本税额计算,为第一次学习开发测试软件
66     **********************************************************
67     ''')
68     print()
69     temp_02 = float(input('请输入含税收入金额:'))
70     my_tax = TaxCalculation('zp', temp_02)
71     print()
72     print()
73     my_tax.accumulative_number()
74     print()
75     input('按回车键退出。')

 

posted on 2019-08-06 13:25  新手爱好者  阅读(104)  评论(0编辑  收藏  举报

导航