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
7b15f999
Commit
7b15f999
authored
Dec 17, 2018
by
hujun
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
佣金统计
parent
5b30726d
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
115 additions
and
2 deletions
+115
-2
Finance.php
application/index/controller/Finance.php
+79
-2
OPayLogModel.php
application/model/OPayLogModel.php
+35
-0
route.php
application/route.php
+1
-0
No files found.
application/index/controller/Finance.php
View file @
7b15f999
...
...
@@ -3115,7 +3115,7 @@ class Finance extends Basic
}
if
(
$this
->
params
[
'status'
]
>
-
1
)
{
$where
[
'
agent_id'
]
=
$this
->
params
[
'agent_id
'
];
$where
[
'
status'
]
=
$this
->
params
[
'status'
]
==
2
?
2
:
[
'in'
,
'0,1
'
];
}
$m_daily
=
new
ODaily
();
...
...
@@ -3241,7 +3241,84 @@ class Finance extends Basic
return
$this
->
response
(
$code
,
''
,
$result
);
}
public
function
sumPrice
()
{
/**
* 佣金统计
*
* @return \think\Response
*/
public
function
getPayLogTotalPrice
()
{
//付款类型 10意向金 20定金 30保管金 40押金 50 租金 60 进场费 70转让费 80其他 90佣金 91中介费 92 案场费
//调整类型 意向金:1转中介费 2转案场费 3转意向金 保管金:4转中介费 5转案场费 6转保管金
$agent_fee
=
$this
->
sumPayLogBargainByType
(
91
,
0
);
//未开业中介费
$case_fee
=
$this
->
sumPayLogBargainByType
(
92
,
0
);
//未开业案场费
$data
[
'not_open_commission'
]
=
$agent_fee
+
$case_fee
;
//中介费入账
$open_agent_fee
=
$this
->
sumPayLogBargainByType
(
91
,
1
);
//开业中介费
$open_case_fee
=
$this
->
sumPayLogBargainByType
(
92
,
1
);
//开业案场费
$data
[
'open_commission'
]
=
$open_agent_fee
+
$open_case_fee
;
//案场费入账
//佣金总计:中介费入账+案场费入账-中介费退款-案场费退款
$data
[
'total_commission'
]
=
$data
[
'not_open_commission'
]
+
$data
[
'open_commission'
];
$data
[
'intention_recorded'
]
=
$this
->
sumPayLogPriceByType
(
10
,
0
);
//意向金入账
$agent_fee
=
$this
->
sumPayLogPriceByType
(
1
,
1
);
//意向金转中介费
$case_fee
=
$this
->
sumPayLogPriceByType
(
2
,
1
);
//意向金转案场费
$intention_fee
=
$this
->
sumPayLogPriceByType
(
3
,
1
);
//意向金转意向金
//意向金转意向金+意向金转中介费+意向金转案场费
$data
[
'intention_adjustment'
]
=
$agent_fee
+
$case_fee
+
$intention_fee
;
//意向金调整
$data
[
'intention_refund'
]
=
0
;
//意向金退款
//意向金入账-意向金调整-意向金退款
$data
[
'total_intention_recorded'
]
=
$data
[
'intention_recorded'
]
-
$data
[
'intention_adjustment'
]
-
$data
[
'intention_refund'
];
//账上意向金
$data
[
'custody_recorded'
]
=
$this
->
sumPayLogPriceByType
(
30
,
0
);
//保管金入账
$agent_fee
=
$this
->
sumPayLogPriceByType
(
4
,
1
);
//保管金转中介费
$case_fee
=
$this
->
sumPayLogPriceByType
(
5
,
1
);
//保管金转案场费
$custody_fee
=
$this
->
sumPayLogPriceByType
(
6
,
1
);
//保管金转保管金
//保管金调整:保管金转保管金+保管金转中介费+保管金转案场费
$data
[
'custody_adjustment'
]
=
$agent_fee
+
$case_fee
+
$custody_fee
;
//保管金调整
$data
[
'custody_refund '
]
=
0
;
//保管金转定
//意向金入账-意向金调整-意向金退款
$data
[
'total_custody_recorded'
]
=
$data
[
'custody_recorded'
]
-
$data
[
'custody_adjustment'
]
-
$data
[
'custody_refund'
];
//账上保管金
//待处理款项总计:未开业佣金+账上意向金+账上保管金
$data
[
'wait_total_fee'
]
=
$data
[
'not_open_commission'
]
+
$data
[
'intention_recorded'
]
+
$data
[
'custody_recorded'
];
return
$this
->
response
(
200
,
''
,
$data
);
}
/**
* @param $type
* @param int $is_open
* @return float|int|string
*/
private
function
sumPayLogBargainByType
(
$type
,
$is_open
=
0
)
{
$m_pay
=
new
OPayLogModel
();
if
(
$is_open
)
{
$where
[
'b.is_open'
]
=
$is_open
;
}
$where
[
'a.type'
]
=
$type
;
$price
=
$m_pay
->
sumBargainPrice
(
'a.money'
,
$where
);
//未开业中介费
return
empty
(
$price
)
?
''
:
$price
;
}
/**
* @param int $type
* @param int $is_adjustment 0调整前 1调整后
* @return float|int|string
*/
private
function
sumPayLogPriceByType
(
int
$type
,
int
$is_adjustment
=
0
)
{
$m_pay
=
new
OPayLogModel
();
if
(
$is_adjustment
)
{
$where
[
'b.type'
]
=
$type
;
$where
[
'source'
]
=
2
;
$price
=
$m_pay
->
sumAdjustment
(
'b.money'
,
$where
,
$is_adjustment
);
}
else
{
$where
[
'a.type'
]
=
$type
;
$price
=
$m_pay
->
sumAdjustment
(
'a.money'
,
$where
,
$is_adjustment
);
}
return
empty
(
$price
)
?
''
:
$price
;
}
}
application/model/OPayLogModel.php
View file @
7b15f999
...
...
@@ -545,4 +545,38 @@ class OPayLogModel extends Model
->
where
(
$where
)
->
select
();
}
/**
* @param $field
* @param $where
* @return float|int
*/
public
function
sumBargainPrice
(
$field
,
$where
)
{
return
$this
->
db_
->
alias
(
'a'
)
->
join
(
'o_bargain b'
,
'a.id=b.order_id'
)
->
where
(
$where
)
->
sum
(
$field
);
}
/**
* @param string $field
* @param array $where
* @param int $type 1 调整前 0调整后
* @return float|int|string
*/
public
function
sumAdjustment
(
string
$field
,
array
$where
,
int
$type
=
1
)
{
if
(
$type
)
{
$field
=
$this
->
db_
->
alias
(
'a'
)
->
join
(
'o_paylog_adjustment b'
,
'a.id=b.paylog_id'
)
->
where
(
$where
)
->
sum
(
$field
);
}
else
{
$field
=
$this
->
db_
->
alias
(
'a'
)
->
join
(
'o_paylog_adjustment b'
,
'a.id=b.new_paylog_id'
)
->
where
(
$where
)
->
sum
(
$field
);
}
return
$field
;
}
}
\ No newline at end of file
application/route.php
View file @
7b15f999
...
...
@@ -280,6 +280,7 @@ Route::group('index', [
'getAdjustment'
=>
[
'index/Finance/getAdjustment'
,
[
'method'
=>
'get'
]],
//剩余可以调整或退款的钱
'delAdjustment'
=>
[
'index/Finance/delAdjustment'
,
[
'method'
=>
'post'
]],
//撤销调整
'getAdjustmentDetail'
=>
[
'index/Finance/getAdjustmentDetail'
,
[
'method'
=>
'get'
]],
//调整详情
'getPayLogTotalPrice'
=>
[
'index/Finance/getPayLogTotalPrice'
,
[
'method'
=>
'get'
]],
//佣金统计
'performanceInfo'
=>
[
'index/PerformanceInfo/performanceInfo'
,
[
'method'
=>
'post|get'
]],
//业绩明细
'getPerformanceInfoExcel'
=>
[
'index/PerformanceInfo/getPerformanceInfoExcel'
,
[
'method'
=>
'post|get'
]],
//业绩明细
...
...
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