Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Sign in
Toggle navigation
F
fund_report
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Packages
Packages
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
彭熊
fund_report
Commits
b5804341
Commit
b5804341
authored
Feb 06, 2021
by
赵杰
Browse files
Options
Browse Files
Download
Plain Diff
Merge remote-tracking branch 'origin/manage-public' into manage-public
parents
f7fbc3cd
74bf199d
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
39 additions
and
21 deletions
+39
-21
statement_service.py
app/service/statement_service.py
+39
-21
No files found.
app/service/statement_service.py
View file @
b5804341
...
@@ -34,8 +34,7 @@ def get_order_info(user_id):
...
@@ -34,8 +34,7 @@ def get_order_info(user_id):
data
=
cur
.
fetchall
()
data
=
cur
.
fetchall
()
order_df
=
pd
.
DataFrame
(
list
(
data
),
order_df
=
pd
.
DataFrame
(
list
(
data
),
columns
=
[
'fund_id'
,
'user_name'
,
'customer_name'
,
'customer_id'
,
'value_sex'
,
'type'
,
columns
=
[
'fund_id'
,
'user_name'
,
'customer_name'
,
'customer_id'
,
'value_sex'
,
'type'
,
'order_type'
,
'order_type'
,
'pay_date'
,
'pay_date'
,
'subscription_fee'
,
'confirm_share_date'
,
'confirm_share'
,
'subscription_fee'
,
'confirm_share_date'
,
'confirm_share'
,
'confirm_amount'
,
'nav'
,
'folio_name'
])
'confirm_amount'
,
'nav'
,
'folio_name'
])
return
order_df
return
order_df
...
@@ -80,17 +79,15 @@ def get_month_list(quarter, year):
...
@@ -80,17 +79,15 @@ def get_month_list(quarter, year):
def
type2note
(
type
):
def
type2note
(
type
):
type2note_dict
=
{
1
:
"申购"
,
type2note_dict
=
{
1
:
"购入"
,
2
:
"追加"
,
2
:
"赎回"
,
3
:
"赎回"
,
4
:
"分红"
}
4
:
"分红再投"
,
5
:
"现金分红"
}
return
type2note_dict
.
get
(
type
)
return
type2note_dict
.
get
(
type
)
def
cal_total_amount
(
df
):
def
cal_total_amount
(
df
):
purchase_amount
=
df
[
df
[
'order_type'
]
.
isin
([
1
,
2
])
][
'confirm_amount'
]
.
sum
()
purchase_amount
=
df
[
df
[
'order_type'
]
==
1
][
'confirm_amount'
]
.
sum
()
redemption_amount
=
df
[
df
[
'order_type'
]
==
3
][
'confirm_amount'
]
.
sum
()
redemption_amount
=
df
[
df
[
'order_type'
]
==
2
][
'confirm_amount'
]
.
sum
()
subscription_fee
=
df
[
'subscription_fee'
]
.
sum
()
subscription_fee
=
df
[
'subscription_fee'
]
.
sum
()
total_amount
=
purchase_amount
-
redemption_amount
-
subscription_fee
total_amount
=
purchase_amount
-
redemption_amount
-
subscription_fee
return
total_amount
return
total_amount
...
@@ -105,6 +102,22 @@ def num2chinese(number):
...
@@ -105,6 +102,22 @@ def num2chinese(number):
def
get_tax_rate
():
def
get_tax_rate
():
# with TAMP_SQL(tamp_order_engine) as tamp_order, TAMP_SQL(tamp_user_engine) as tamp_user:
# tamp_order_session = tamp_order.session
# # sql = """select f1.ifa_id, f1.customer_id, f1.fund_id, f1.fund_nav,
# # f1.fund_nav_date, f1.predict_date, f1.pro_date, f1.manage_predict_fee, f1.permc_exc_predict_fee, f1.permc_rem_fee,
# # f1.recommend_ifa_id, f1.recommend_fee, f1.permc_recommend_fee, f1.incentive_fee_ratio, f1.retention_shares
# # from ifa_provision_day_info as f1 where f1.ifa_id='{}'""".format(user_id)
# sql = """SELECT * FROM `ifa_provision_day_info` WHERE `ifa_id` = '{}'""".format(user_id)
# cur = tamp_order_session.execute(sql)
# data = cur.fetchall()
# provision_df = pd.DataFrame(list(data),
# columns=['id', 'ifa_id', 'customer_id', 'fund_id', 'order_id', 'fund_nav', 'fund_nav_date',
# 'predict_date', 'pro_date','pro_type',
# 'manage_predict_fee', 'permc_exc_predict_fee', 'permc_rem_predict_fee',
# 'manage_fee', 'permc_exc_fee','permc_rem_fee', 'recommend_ifa_id',
# 'recommend_fee','permc_recommend_fee', 'incentive_fee_ratio',
# 'deduction','retention_shares','status'])
return
0
return
0
...
@@ -215,9 +228,18 @@ class Statement(object):
...
@@ -215,9 +228,18 @@ class Statement(object):
bonus_policy
=
[]
bonus_policy
=
[]
bonus_policy
.
append
({
'month_achieve'
:
'达到1000万以上'
,
'bonus_policy_item'
:
'标准管理费分成+0.1
%
'
})
bonus_policy
.
append
({
'month_achieve'
:
'达到1000万以上'
,
'bonus_policy_item'
:
'标准管理费分成+0.1
%
'
})
bonus_policy
.
append
({
'month_achieve'
:
'达到2000万以上'
,
'bonus_policy_item'
:
'标准管理费分成+0.15
%
'
})
bonus_policy
.
append
({
'month_achieve'
:
'达到3000万以上'
,
'bonus_policy_item'
:
'标准管理费分成+0.2
%
'
})
bonus_policy
.
append
({
'month_achieve'
:
'达到4000万以上'
,
'bonus_policy_item'
:
'标准管理费分成+0.25
%
'
})
bonus_policy
.
append
({
'month_achieve'
:
'达到5000万以上'
,
'bonus_policy_item'
:
'标准管理费分成+0.3
%
'
})
month_remain_data
[
'bonus_policy'
]
=
bonus_policy
month_remain_data
[
'bonus_policy'
]
=
bonus_policy
bonus_image
=
''
bonus_image
=
[]
bonus_image
.
append
({
'goal_value'
:
float
(
quarter_amount
)
/
500000.0
,
'goal'
:
'5000万目标'
})
bonus_image
.
append
({
'goal_value'
:
float
(
quarter_amount
)
/
400000.0
,
'goal'
:
'4000万目标'
})
bonus_image
.
append
({
'goal_value'
:
float
(
quarter_amount
)
/
300000.0
,
'goal'
:
'3000万目标'
})
bonus_image
.
append
({
'goal_value'
:
float
(
quarter_amount
)
/
200000.0
,
'goal'
:
'2000万目标'
})
bonus_image
.
append
({
'goal_value'
:
float
(
quarter_amount
)
/
100000.0
,
'goal'
:
'1000万目标'
})
month_remain_data
[
'bonus_image'
]
=
bonus_image
month_remain_data
[
'bonus_image'
]
=
bonus_image
return
month_remain_data
return
month_remain_data
...
@@ -242,10 +264,7 @@ class Statement(object):
...
@@ -242,10 +264,7 @@ class Statement(object):
after_tax
=
0
after_tax
=
0
detail
=
[]
detail
=
[]
for
i
in
range
(
df_length
):
for
i
in
range
(
df_length
):
try
:
tax_rate
=
get_tax_rate
()
tax_rate
=
get_tax_rate
()
except
:
tax_rate
=
0
detail
.
append
({
'fund'
:
customer_df
[
'fund_id'
]
.
values
[
i
],
detail
.
append
({
'fund'
:
customer_df
[
'fund_id'
]
.
values
[
i
],
'confirm_amount'
:
customer_df
[
'confirm_amount'
]
.
values
[
i
],
'confirm_amount'
:
customer_df
[
'confirm_amount'
]
.
values
[
i
],
...
@@ -296,6 +315,7 @@ class Statement(object):
...
@@ -296,6 +315,7 @@ class Statement(object):
tax_rate
=
get_tax_rate
()
tax_rate
=
get_tax_rate
()
except
:
except
:
tax_rate
=
0
tax_rate
=
0
detail
.
append
({
'date'
:
customer_fund_df
[
'predict_date'
]
.
values
[
i
]
.
strftime
(
'
%
Y-
%
m-
%
d'
),
detail
.
append
({
'date'
:
customer_fund_df
[
'predict_date'
]
.
values
[
i
]
.
strftime
(
'
%
Y-
%
m-
%
d'
),
'hold_share'
:
customer_fund_df
[
'retention_shares'
]
.
values
[
i
],
'hold_share'
:
customer_fund_df
[
'retention_shares'
]
.
values
[
i
],
'nav'
:
customer_fund_df
[
'fund_nav'
]
.
values
[
i
],
'nav'
:
customer_fund_df
[
'fund_nav'
]
.
values
[
i
],
...
@@ -452,21 +472,19 @@ class Statement(object):
...
@@ -452,21 +472,19 @@ class Statement(object):
summary_data
[
'month_remain'
]
=
self
.
month_remain
()
summary_data
[
'month_remain'
]
=
self
.
month_remain
()
summary_data
[
'subscription_fee'
],
sub_after_tax
=
self
.
subscription_fee
()
summary_data
[
'subscription_fee'
],
sub_after_tax
=
self
.
subscription_fee
()
summary_data
[
'manage_fee'
],
man_after_tax
=
self
.
manage_fee
()
summary_data
[
'manage_fee'
],
man_after_tax
=
self
.
manage_fee
()
summary_data
[
'carry'
]
=
self
.
carry
()
summary_data
[
'carry'
]
,
carry_after_tax
=
self
.
carry
()
summary_data
[
'incentive'
],
incen_after_tax
=
self
.
incentive
()
summary_data
[
'incentive'
],
incen
tive
_after_tax
=
self
.
incentive
()
summary_data
[
'recommend_bonus'
]
=
{
'total_before_tax'
:
Decimal
(
'0'
),
summary_data
[
'recommend_bonus'
]
=
{
'total_before_tax'
:
Decimal
(
'0'
),
'total_after_tax'
:
Decimal
(
'0'
),
'total_after_tax'
:
Decimal
(
'0'
),
'total_tax'
:
Decimal
(
'0.0'
),
'total_tax'
:
Decimal
(
'0.0'
),
'referral_detail'
:
'referral_detail'
:[]}
[]}
carry_after_tax
=
0
summary_after_tax
=
sub_after_tax
+
man_after_tax
+
carry_after_tax
+
incentive_after_tax
summary_after_tax
=
sub_after_tax
+
man_after_tax
+
incen_after_tax
summary_data
[
'summary'
]
=
{
'total_after_tax'
:
summary_after_tax
,
summary_data
[
'summary'
]
=
{
'total_after_tax'
:
summary_after_tax
,
'detail'
:
[{
'item'
:
"已结算申购费用"
,
'amount'
:
sub_after_tax
,
'note'
:
''
},
'detail'
:
[{
'item'
:
"已结算申购费用"
,
'amount'
:
sub_after_tax
,
'note'
:
''
},
{
'item'
:
"已结算管理费用"
,
'amount'
:
man_after_tax
,
'note'
:
''
},
{
'item'
:
"已结算管理费用"
,
'amount'
:
man_after_tax
,
'note'
:
''
},
{
'item'
:
"已结算业绩报酬费用"
,
'amount'
:
carry_after_tax
,
'note'
:
''
},
{
'item'
:
"已结算业绩报酬费用"
,
'amount'
:
carry_after_tax
,
'note'
:
''
},
{
'item'
:
"已结算业绩激励奖金"
,
'amount'
:
incen_after_tax
,
'note'
:
''
},
{
'item'
:
"已结算业绩激励奖金"
,
'amount'
:
incen
tive
_after_tax
,
'note'
:
''
},
{
'item'
:
"已结算推荐费"
,
'amount'
:
Decimal
(
'0.00'
),
'note'
:
''
},
{
'item'
:
"已结算推荐费"
,
'amount'
:
Decimal
(
'0.00'
),
'note'
:
''
},
{
'item'
:
"{}年{}季度待结算佣金"
.
format
(
self
.
year
,
num2chinese
(
self
.
quarter
)),
{
'item'
:
"{}年{}季度待结算佣金"
.
format
(
self
.
year
,
num2chinese
(
self
.
quarter
)),
'amount'
:
Decimal
(
'0.00'
),
'note'
:
''
}
'amount'
:
Decimal
(
'0.00'
),
'note'
:
''
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
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 comment