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
69333579
Commit
69333579
authored
Dec 26, 2018
by
hujun
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
退款总计
parent
17ec83b3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
51 additions
and
5 deletions
+51
-5
Finance.php
application/index/controller/Finance.php
+37
-4
OPayLogModel.php
application/model/OPayLogModel.php
+1
-1
ORefundModel.php
application/model/ORefundModel.php
+13
-0
No files found.
application/index/controller/Finance.php
View file @
69333579
...
...
@@ -3394,14 +3394,19 @@ class Finance extends Basic
public
function
getPayLogTotalPrice
()
{
//付款类型 10意向金 20定金 30保管金 40押金 50 租金 60 进场费 70转让费 80其他 90佣金 91中介费 92 案场费
//调整类型 意向金:1转中介费 2转案场费 3转意向金 保管金:4转中介费 5转案场费 6转保管金
//退款类型:0退意向金1意向金转定2退保管金3保管金转定4退中介费5退案场
$agent_fee
=
$this
->
sumPayLogBargainByType
(
91
,
0
);
//未开业中介费
$case_fee
=
$this
->
sumPayLogBargainByType
(
92
,
0
);
//未开业案场费
$data
[
'not_open_commission'
]
=
$agent_fee
+
$case_fee
;
//未开业佣金
$agent_refund_fee
=
$this
->
sumPayLogRefundByType
(
4
,
0
);
//未开业中介费退款
$case_refund_fee
=
$this
->
sumPayLogRefundByType
(
5
,
0
);
//未开业案场费退款
$data
[
'not_open_commission'
]
=
$agent_fee
+
$case_fee
-
$agent_refund_fee
-
$case_refund_fee
;
//未开业佣金
$open_agent_fee
=
$this
->
sumPayLogBargainByType
(
91
,
1
);
//开业中介费
$open_case_fee
=
$this
->
sumPayLogBargainByType
(
92
,
1
);
//开业案场费
$data
[
'open_commission'
]
=
$open_agent_fee
+
$open_case_fee
;
//已开业佣金
$open_agent_refund
=
$this
->
sumPayLogRefundByType
(
4
,
1
);
//开业中介费退款
$open_case_refund
=
$this
->
sumPayLogRefundByType
(
5
,
1
);
//开业案场费退款
$data
[
'open_commission'
]
=
$open_agent_fee
+
$open_case_fee
-
$open_agent_refund
-
$open_case_refund
;
//已开业佣金
//佣金总计:中介费入账+案场费入账-中介费退款-案场费退款
$data
[
'total_commission'
]
=
$data
[
'not_open_commission'
]
+
$data
[
'open_commission'
];
...
...
@@ -3413,7 +3418,7 @@ class Finance extends Basic
$intention_fee
=
$this
->
sumPayLogPriceByType
(
3
,
1
);
//意向金转意向金
//意向金转意向金+意向金转中介费+意向金转案场费
$data
[
'intention_adjustment'
]
=
$agent_fee
+
$case_fee
+
$intention_fee
;
//意向金调整
$data
[
'intention_refund'
]
=
0
;
//意向金退款
$data
[
'intention_refund'
]
=
$this
->
sumPayLogRefundByType
(
0
,
0
,
0
)
;
//意向金退款
//意向金入账-意向金调整-意向金退款
$data
[
'total_intention_recorded'
]
=
$data
[
'intention_recorded'
]
-
$data
[
'intention_adjustment'
]
-
$data
[
'intention_refund'
];
//账上意向金
...
...
@@ -3433,6 +3438,8 @@ class Finance extends Basic
}
/**
* 开业和未开业入账金额计算
*
* @param $type
* @param int $is_open
* @return float|int|string
...
...
@@ -3444,7 +3451,33 @@ class Finance extends Basic
}
$where
[
'a.type'
]
=
$type
;
$price
=
$m_pay
->
sumBargainPrice
(
'a.money'
,
$where
);
//未开业中介费
$price
=
$m_pay
->
sumBargainPrice
(
'a.real_money'
,
$where
);
//未开业中介费
return
empty
(
$price
)
?
''
:
$price
;
}
/**
* 开业和未开业退款金额计算
*
* @param $type
* @param int $is_open
* @param int $is_bargain
* @return float|int|string
*/
private
function
sumPayLogRefundByType
(
$type
,
$is_open
=
0
,
$is_bargain
=
1
)
{
$m_pay
=
new
ORefundModel
();
if
(
$is_bargain
)
{
if
(
$is_open
)
{
$where
[
'b.is_open'
]
=
$is_open
;
}
$where
[
'a.type'
]
=
$type
;
$price
=
$m_pay
->
sumBargainPrice
(
'a.refund_money'
,
$where
);
//未开业中介费
}
else
{
$where
[
'type'
]
=
$type
;
$price
=
$m_pay
->
getRefundSum
(
'refund_money'
,
$where
);
}
return
empty
(
$price
)
?
''
:
$price
;
}
...
...
application/model/OPayLogModel.php
View file @
69333579
...
...
@@ -531,7 +531,7 @@ class OPayLogModel extends Model
*/
public
function
sumBargainPrice
(
$field
,
$where
)
{
return
$this
->
db_
->
alias
(
'a'
)
->
join
(
'o_bargain b'
,
'a.id=b.order_id'
)
->
join
(
'o_bargain b'
,
'a.
order_
id=b.order_id'
)
->
where
(
$where
)
->
sum
(
$field
);
}
...
...
application/model/ORefundModel.php
View file @
69333579
...
...
@@ -293,4 +293,16 @@ class ORefundModel extends Model{
public
function
updateData
(
$data
,
$where
)
{
return
$this
->
where
(
$where
)
->
update
(
$data
);
}
/**
* @param $field
* @param $where
* @return float|int
*/
public
function
sumBargainPrice
(
$field
,
$where
)
{
return
$this
->
db_
->
alias
(
'a'
)
->
join
(
'o_bargain b'
,
'a.order_id=b.order_id'
)
->
where
(
$where
)
->
sum
(
$field
);
}
}
\ No newline at end of file
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