Skip to content
Toggle navigation
Projects
Groups
Snippets
Help
eshiled-new
/
audit_2021
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Settings
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit 5b239496
authored
May 31, 2023
by
杨林龙
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
添加审计脚本
1 parent
27a247fb
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
51 additions
and
0 deletions
deal_share.py
deal_share.py
0 → 100644
View file @
5b23949
import
datetime
def
calculate_amortization
(
start_date
,
end_date
,
total_amount
):
"""计算每年的分摊金额"""
# 计算总共需要分摊的月份数
duration_months
=
(
(
end_date
.
year
-
start_date
.
year
)
*
12
+
(
end_date
.
month
-
start_date
.
month
)
+
1
)
# 计算每年的分摊金额
yearly_amortization
=
[]
for
i
in
range
(
start_date
.
year
,
end_date
.
year
+
1
):
if
i
==
start_date
.
year
:
# 计算第一年的分摊金额
months_in_first_year
=
12
-
start_date
.
month
+
1
yearly_amortization
.
append
(
round
(
total_amount
/
duration_months
*
months_in_first_year
)
)
elif
i
==
end_date
.
year
:
# 计算最后一年的分摊金额
months_in_last_year
=
(
end_date
-
datetime
.
date
(
end_date
.
year
,
1
,
1
)
)
.
days
//
30
+
1
yearly_amortization
.
append
(
round
(
total_amount
/
duration_months
*
months_in_last_year
)
)
else
:
# 计算中间年份的分摊金额
yearly_amortization
.
append
(
round
(
total_amount
/
duration_months
*
12
))
return
yearly_amortization
if
__name__
==
"__main__"
:
start_date
=
datetime
.
date
(
2017
,
12
,
1
)
end_date
=
datetime
.
date
(
2020
,
11
,
1
)
moneny
=
200000
amortization01
=
calculate_amortization
(
start_date
,
end_date
,
moneny
)
start_date
=
datetime
.
date
(
2017
,
12
,
1
)
end_date
=
datetime
.
date
(
2018
,
11
,
1
)
amortization02
=
calculate_amortization
(
start_date
,
end_date
,
moneny
)
print
(
"调整前:"
+
str
(
amortization01
))
print
(
"调整后:"
+
str
(
amortization02
))
res
=
[]
res_l
=
0
for
i
in
range
(
len
(
amortization02
)):
res
.
append
(
amortization02
[
i
]
-
amortization01
[
i
])
res_l
=
i
for
i
in
range
(
res_l
+
1
,
len
(
amortization01
)):
res
.
append
(
0
-
amortization01
[
i
])
print
(
res
)
Write
Preview
Markdown
is supported
Attach a file
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to post a comment