Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
T
tl_estate
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
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
hujun
tl_estate
Commits
09898dc5
Commit
09898dc5
authored
Nov 29, 2018
by
hujun
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
单独业绩统计
parent
3ba0ea87
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
54 additions
and
3 deletions
+54
-3
Finance.php
application/index/controller/Finance.php
+54
-3
No files found.
application/index/controller/Finance.php
View file @
09898dc5
...
@@ -1140,7 +1140,8 @@ class Finance extends Basic
...
@@ -1140,7 +1140,8 @@ class Finance extends Basic
foreach
(
$real_income_arr
as
$v3
)
{
foreach
(
$real_income_arr
as
$v3
)
{
//todo 收佣日期统计
//todo 收佣日期统计
$income_time
=
$m_real
->
getFieldValue
(
'income_time'
,
[
'id'
=>
$v3
[
'real_income_id'
]]);
$income_time
=
$m_real
->
getFieldValue
(
'income_time'
,
[
'id'
=>
$v3
[
'real_income_id'
]]);
$this
->
updatePerformanceData
(
$v3
[
'agent_id'
],
$income_time
,
$v3
[
'store_id'
],
$v3
[
'district_id'
]);
// $this->updatePerformanceData($v3['agent_id'], $income_time, $v3['store_id'], $v3['district_id']);
$this
->
totalOfficialReceipts
(
$v3
[
'agent_id'
],
$v3
[
'district_id'
],
$v3
[
'store_id'
],
$income_time
);
}
}
}
}
// $data = $m_partial->addCommission($this->params, $this->userId);
// $data = $m_partial->addCommission($this->params, $this->userId);
...
@@ -2121,14 +2122,23 @@ class Finance extends Basic
...
@@ -2121,14 +2122,23 @@ class Finance extends Basic
$where_bargain
[
'create_time'
]
=
[
'BETWEEN'
,
[
$create_time
.
' 00:00:00'
,
$create_time
.
' 23:59:59'
]];
$where_bargain
[
'create_time'
]
=
[
'BETWEEN'
,
[
$create_time
.
' 00:00:00'
,
$create_time
.
' 23:59:59'
]];
$bargainSum
=
$this
->
m_bargain
->
getAddBargainNumGroupTimeNew
(
$where_bargain
,
1
);
$bargainSum
=
$this
->
m_bargain
->
getAddBargainNumGroupTimeNew
(
$where_bargain
,
1
);
$id
=
$m_agent_total
->
getTotalEndTimeByAgentId
(
'id'
,
[
'total_time'
=>
$
where_bargain
[
'create_time'
]
,
'agent_id'
=>
$where_bargain
[
'agent_id'
]]);
$id
=
$m_agent_total
->
getTotalEndTimeByAgentId
(
'id'
,
[
'total_time'
=>
$
create_time
,
'agent_id'
=>
$where_bargain
[
'agent_id'
]]);
if
(
!
empty
(
$id
))
{
if
(
!
empty
(
$id
))
{
$update_data
[
$k
][
"performance"
]
=
!
empty
(
$bargainSum
[
0
][
"num"
])
?
$bargainSum
[
0
][
"num"
]
:
0
;
$update_data
[
$k
][
"performance"
]
=
!
empty
(
$bargainSum
[
0
][
"num"
])
?
$bargainSum
[
0
][
"num"
]
:
0
;
$update_data
[
$k
][
'id'
]
=
$id
[
0
][
'id'
];
$update_data
[
$k
][
'id'
]
=
$id
[
0
][
'id'
];
}
}
if
(
count
(
$update_data
)
>
0
)
{
if
(
empty
(
$update_data
))
{
$insert_data
[]
=
[
'store_id'
=>
$v
[
'store_id'
],
'district_id'
=>
$v
[
'district_id'
],
'agent_id'
=>
$v
[
'agent_id'
],
'total_time'
=>
date
(
'Y-m-d'
),
'create_time'
=>
date
(
'Y-m-d H:i:s'
)
];
$m_agent_total
->
addTotal
(
$insert_data
);
}
else
{
$m_agent_total
->
saveTotal
(
$update_data
);
$m_agent_total
->
saveTotal
(
$update_data
);
}
}
}
}
...
@@ -2175,4 +2185,45 @@ class Finance extends Basic
...
@@ -2175,4 +2185,45 @@ class Finance extends Basic
return
$this
->
response
(
$code
,
$msg
,
$data
);
return
$this
->
response
(
$code
,
$msg
,
$data
);
}
}
/**
* (临时处理)业绩统计-实收统计
*
* @param $agent_id
* @param $district_id
* @param $store_id
* @param $date
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\ModelNotFoundException
* @throws \think\exception\DbException
*/
public
function
totalOfficialReceipts
(
$agent_id
,
$district_id
,
$store_id
,
$date
)
{
//获取被修改人信息
$m_agent_total
=
new
TAgentTotalModel
();
$update_data
=
[];
$where_bargain
[
'agent_id'
]
=
$agent_id
;
$where_bargain
[
'create_time'
]
=
[
'BETWEEN'
,
[
$date
.
' 00:00:00'
,
$date
.
' 23:59:59'
]];
$receivedSum
=
$this
->
m_bargain
->
getReceivedGroupTimeNew
(
$where_bargain
);
$result_arr
[
"received_sum"
]
=
empty
(
$receivedSum
[
0
][
"num"
])
?
""
:
$receivedSum
[
0
][
"num"
];
$id
=
$m_agent_total
->
getTotalEndTimeByAgentId
(
'id'
,
[
'total_time'
=>
$date
,
'agent_id'
=>
$where_bargain
[
'agent_id'
]]);
if
(
empty
(
$id
))
{
$insert_data
[]
=
[
'store_id'
=>
$district_id
,
'district_id'
=>
$store_id
,
'agent_id'
=>
$agent_id
,
'total_time'
=>
date
(
'Y-m-d'
),
'create_time'
=>
date
(
'Y-m-d H:i:s'
)
];
$m_agent_total
->
addTotal
(
$insert_data
);
}
else
{
$update_data
[
"received_sum"
]
=
empty
(
$result_arr
[
"received_sum"
])
?
0
:
$result_arr
[
"received_sum"
];
$update_data
[
'id'
]
=
$id
[
0
][
'id'
];
$m_agent_total
->
saveTotal
(
$update_data
);
}
return
;
}
}
}
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