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
dbd3a9eb
Commit
dbd3a9eb
authored
Apr 11, 2019
by
hujun
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
income_time
parent
fa2e9619
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
69 additions
and
31 deletions
+69
-31
Finance.php
application/index/controller/Finance.php
+55
-31
ORefundModel.php
application/model/ORefundModel.php
+14
-0
No files found.
application/index/controller/Finance.php
View file @
dbd3a9eb
...
@@ -4196,47 +4196,60 @@ class Finance extends Basic
...
@@ -4196,47 +4196,60 @@ class Finance extends Basic
* @return \think\Response
* @return \think\Response
*/
*/
public
function
getPayLogTotalPrice
()
{
public
function
getPayLogTotalPrice
()
{
$this
->
params
[
'start_time'
]
=
'2019-4-9'
;
$this
->
params
[
'end_time'
]
=
'2019-4-10'
;
if
(
empty
(
$this
->
params
[
'start_time'
])
||
empty
(
$this
->
params
[
'end_time'
]))
{
return
$this
->
response
(
101
,
'参数错误'
);
}
if
(
!
strtotime
(
$this
->
params
[
'start_time'
])
||
!
strtotime
(
$this
->
params
[
'end_time'
]))
{
return
$this
->
response
(
101
,
'时间格式错误'
);
}
$income_start
=
$this
->
params
[
'start_time'
]
.
' 00:00:00'
;
$income_end
=
$this
->
params
[
'end_time'
]
.
' 23:59:59'
;
//付款类型 10意向金 20定金 30保管金 40押金 50 租金 60 进场费 70转让费 80其他 90佣金 91中介费 92 案场费
//付款类型 10意向金 20定金 30保管金 40押金 50 租金 60 进场费 70转让费 80其他 90佣金 91中介费 92 案场费
//调整类型 意向金:1转中介费 2转案场费 3转意向金 保管金:4转中介费 5转案场费 6转保管金
//调整类型 意向金:1转中介费 2转案场费 3转意向金 保管金:4转中介费 5转案场费 6转保管金
//退款类型:0退意向金1意向金转定2退保管金3保管金转定4退中介费5退案场
//退款类型:0退意向金1意向金转定2退保管金3保管金转定4退中介费5退案场
$agent_fee
=
$this
->
sumPayLogBargainByType
(
91
,
0
);
//未开业中介费
$agent_fee
=
$this
->
sumPayLogBargainByType
(
91
,
0
,
$income_start
,
$income_end
);
//未开业中介费
$case_fee
=
$this
->
sumPayLogBargainByType
(
92
,
0
);
//未开业案场费
$case_fee
=
$this
->
sumPayLogBargainByType
(
92
,
0
,
$income_start
,
$income_end
);
//未开业案场费
$agent_refund_fee
=
$this
->
sumPayLogRefundByType
(
4
,
0
);
//未开业中介费退款
$agent_refund_fee
=
$this
->
sumPayLogRefundByType
(
4
,
0
,
0
,
$income_start
,
$income_end
);
//未开业中介费退款
$case_refund_fee
=
$this
->
sumPayLogRefundByType
(
5
,
0
);
//未开业案场费退款
$case_refund_fee
=
$this
->
sumPayLogRefundByType
(
5
,
0
,
0
,
$income_start
,
$income_end
);
//未开业案场费退款
$data
[
'not_open_commission'
]
=
$agent_fee
+
$case_fee
-
$agent_refund_fee
-
$case_refund_fee
;
//未开业佣金
$data
[
'not_open_commission'
]
=
$agent_fee
+
$case_fee
-
$agent_refund_fee
-
$case_refund_fee
;
//未开业佣金
$open_agent_fee
=
$this
->
sumPayLogBargainByType
(
91
,
1
);
//开业中介费
$open_agent_fee
=
$this
->
sumPayLogBargainByType
(
91
,
1
,
$income_start
,
$income_end
);
//开业中介费
$open_case_fee
=
$this
->
sumPayLogBargainByType
(
92
,
1
);
//开业案场费
$open_case_fee
=
$this
->
sumPayLogBargainByType
(
92
,
1
,
$income_start
,
$income_end
);
//开业案场费
$open_agent_refund
=
$this
->
sumPayLogRefundByType
(
4
,
1
);
//开业中介费退款
$open_agent_refund
=
$this
->
sumPayLogRefundByType
(
4
,
1
,
0
,
$income_start
,
$income_end
);
//开业中介费退款
$open_case_refund
=
$this
->
sumPayLogRefundByType
(
5
,
1
);
//开业案场费退款
$open_case_refund
=
$this
->
sumPayLogRefundByType
(
5
,
1
,
0
,
$income_start
,
$income_end
);
//开业案场费退款
$data
[
'open_commission'
]
=
$open_agent_fee
+
$open_case_fee
-
$open_agent_refund
-
$open_case_refund
;
//已开业佣金
$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'
];
$data
[
'total_commission'
]
=
$data
[
'not_open_commission'
]
+
$data
[
'open_commission'
];
$data
[
'intention_recorded'
]
=
$this
->
sumPayLogPriceByType
(
10
,
0
);
//意向金入账
$data
[
'intention_recorded'
]
=
$this
->
sumPayLogPriceByType
(
10
,
0
,
$income_start
,
$income_end
);
//意向金入账
$agent_fee
=
$this
->
sumPayLogPriceByType
(
1
,
1
);
//意向金转中介费
$agent_fee
=
$this
->
sumPayLogPriceByType
(
1
,
1
,
$income_start
,
$income_end
);
//意向金转中介费
$case_fee
=
$this
->
sumPayLogPriceByType
(
2
,
1
);
//意向金转案场费
$case_fee
=
$this
->
sumPayLogPriceByType
(
2
,
1
,
$income_start
,
$income_end
);
//意向金转案场费
$intention_fee
=
$this
->
sumPayLogPriceByType
(
3
,
1
);
//意向金转意向金
$intention_fee
=
$this
->
sumPayLogPriceByType
(
3
,
1
,
$income_start
,
$income_end
);
//意向金转意向金
$custody_fee
=
$this
->
sumPayLogPriceByType
(
7
,
1
);
//意向金转保管金
$custody_fee
=
$this
->
sumPayLogPriceByType
(
7
,
1
,
$income_start
,
$income_end
);
//意向金转保管金
//意向金转意向金+意向金转中介费+意向金转案场费
//意向金转意向金+意向金转中介费+意向金转案场费
$data
[
'intention_adjustment'
]
=
$agent_fee
+
$case_fee
+
$intention_fee
+
$custody_fee
;
//意向金调整
$data
[
'intention_adjustment'
]
=
$agent_fee
+
$case_fee
+
$intention_fee
+
$custody_fee
;
//意向金调整
$data
[
'intention_refund'
]
=
$this
->
sumPayLogRefundByType
(
0
,
0
,
0
);
//意向金退款
$data
[
'intention_refund'
]
=
$this
->
sumPayLogRefundByType
(
0
,
0
,
0
,
$income_start
,
$income_end
);
//意向金退款
$data
[
'intention_refund'
]
+=
$this
->
sumPayLogRefundByType
(
1
,
0
,
0
);
//意向金退款
$data
[
'intention_refund'
]
+=
$this
->
sumPayLogRefundByType
(
1
,
0
,
0
,
$income_start
,
$income_end
);
//意向金退款
$data
[
'intention_refund'
]
=
round
(
$data
[
'intention_refund'
],
2
);
$data
[
'intention_refund'
]
=
round
(
$data
[
'intention_refund'
],
2
);
//意向金入账-意向金调整-意向金退款
//意向金入账-意向金调整-意向金退款
$data
[
'total_intention_recorded'
]
=
$data
[
'intention_recorded'
]
-
$data
[
'intention_adjustment'
]
-
$data
[
'intention_refund'
];
//账上意向金
$data
[
'total_intention_recorded'
]
=
$data
[
'intention_recorded'
]
-
$data
[
'intention_adjustment'
]
-
$data
[
'intention_refund'
];
//账上意向金
$data
[
'custody_recorded'
]
=
$this
->
sumPayLogPriceByType
(
30
,
0
);
//保管金入账
$data
[
'custody_recorded'
]
=
$this
->
sumPayLogPriceByType
(
30
,
0
,
$income_start
,
$income_end
);
//保管金入账
$agent_fee
=
$this
->
sumPayLogPriceByType
(
4
,
1
);
//保管金转中介费
$agent_fee
=
$this
->
sumPayLogPriceByType
(
4
,
1
,
$income_start
,
$income_end
);
//保管金转中介费
$case_fee
=
$this
->
sumPayLogPriceByType
(
5
,
1
);
//保管金转案场费
$case_fee
=
$this
->
sumPayLogPriceByType
(
5
,
1
,
$income_start
,
$income_end
);
//保管金转案场费
$custody_fee
=
$this
->
sumPayLogPriceByType
(
6
,
1
);
//保管金转保管金
$custody_fee
=
$this
->
sumPayLogPriceByType
(
6
,
1
,
$income_start
,
$income_end
);
//保管金转保管金
//保管金调整:保管金转保管金+保管金转中介费+保管金转案场费
//保管金调整:保管金转保管金+保管金转中介费+保管金转案场费
$data
[
'custody_adjustment'
]
=
$agent_fee
+
$case_fee
+
$custody_fee
;
//保管金调整
$data
[
'custody_adjustment'
]
=
$agent_fee
+
$case_fee
+
$custody_fee
;
//保管金调整
$data
[
'custody_refund'
]
=
$this
->
sumPayLogRefundByType
(
3
,
0
,
0
);
//保管金转定
$data
[
'custody_refund'
]
=
$this
->
sumPayLogRefundByType
(
3
,
0
,
0
,
$income_start
,
$income_end
);
//保管金转定
$data
[
'custody_refund'
]
+=
$this
->
sumPayLogRefundByType
(
2
,
0
,
0
);
//保管金转定
$data
[
'custody_refund'
]
+=
$this
->
sumPayLogRefundByType
(
2
,
0
,
0
,
$income_start
,
$income_end
);
//保管金转定
//意向金入账-意向金调整-意向金退款
//意向金入账-意向金调整-意向金退款
$data
[
'total_custody_recorded'
]
=
$data
[
'custody_recorded'
]
-
$data
[
'custody_adjustment'
]
-
$data
[
'custody_refund'
];
//账上保管金
$data
[
'total_custody_recorded'
]
=
$data
[
'custody_recorded'
]
-
$data
[
'custody_adjustment'
]
-
$data
[
'custody_refund'
];
//账上保管金
...
@@ -4251,15 +4264,18 @@ class Finance extends Basic
...
@@ -4251,15 +4264,18 @@ class Finance extends Basic
*
*
* @param $type
* @param $type
* @param int $is_open
* @param int $is_open
* @param $income_time_start
* @param $income_time_end
* @return float|int|string
* @return float|int|string
*/
*/
private
function
sumPayLogBargainByType
(
$type
,
$is_open
=
0
)
{
private
function
sumPayLogBargainByType
(
$type
,
$is_open
=
0
,
$income_time_start
,
$income_time_end
)
{
$m_pay
=
new
OPayLogModel
();
$m_pay
=
new
OPayLogModel
();
$where
[
'b.is_open'
]
=
$is_open
;
$where
[
'b.is_open'
]
=
$is_open
;
$where
[
'a.type'
]
=
$type
;
$where
[
'a.type'
]
=
$type
;
$where
[
'b.status'
]
=
[
'in'
,
'10,11,13'
];
$where
[
'b.status'
]
=
[
'in'
,
'10,11,13'
];
$where
[
'b.father_id'
]
=
$where
[
'a.is_del'
]
=
0
;
$where
[
'b.father_id'
]
=
$where
[
'a.is_del'
]
=
0
;
$where
[
'a.income_time'
]
=
[
'between'
,
[
$income_time_start
,
$income_time_end
]];
$price
=
$m_pay
->
sumBargainPrice
(
'a.real_money'
,
$where
);
//未开业中介费
$price
=
$m_pay
->
sumBargainPrice
(
'a.real_money'
,
$where
);
//未开业中介费
return
empty
(
$price
)
?
''
:
$price
;
return
empty
(
$price
)
?
''
:
$price
;
}
}
...
@@ -4268,11 +4284,13 @@ class Finance extends Basic
...
@@ -4268,11 +4284,13 @@ class Finance extends Basic
* 开业和未开业退款金额计算
* 开业和未开业退款金额计算
*
*
* @param $type
* @param $type
* @param int $is_open
* @param $is_open
* @param int $is_bargain
* @param $is_bargain
* @param $income_start
* @param $income_end
* @return float|int|string
* @return float|int|string
*/
*/
private
function
sumPayLogRefundByType
(
$type
,
$is_open
=
0
,
$is_bargain
=
1
)
{
private
function
sumPayLogRefundByType
(
$type
,
$is_open
,
$is_bargain
,
$income_start
,
$income_end
)
{
$m_pay
=
new
ORefundModel
();
$m_pay
=
new
ORefundModel
();
if
(
$is_bargain
)
{
if
(
$is_bargain
)
{
...
@@ -4280,10 +4298,12 @@ class Finance extends Basic
...
@@ -4280,10 +4298,12 @@ class Finance extends Basic
$where
[
'a.type'
]
=
$type
;
$where
[
'a.type'
]
=
$type
;
$where
[
'b.status'
]
=
[
'in'
,
'10,11,13'
];
$where
[
'b.status'
]
=
[
'in'
,
'10,11,13'
];
$where
[
'b.father_id'
]
=
$where
[
'a.is_del'
]
=
0
;
$where
[
'b.father_id'
]
=
$where
[
'a.is_del'
]
=
0
;
$where
[
'c.income_time'
]
=
[
'between'
,
[
$income_start
,
$income_end
]];
$price
=
$m_pay
->
sumBargainPrice
(
'a.refund_money'
,
$where
);
//未开业中介费
$price
=
$m_pay
->
sumBargainPrice
(
'a.refund_money'
,
$where
);
//未开业中介费
}
else
{
}
else
{
$where
[
'type'
]
=
$type
;
$where
[
'a.type'
]
=
$type
;
$price
=
$m_pay
->
getRefundSum
(
'refund_money'
,
$where
);
$where
[
'b.income_time'
]
=
[
'between'
,
[
$income_start
,
$income_end
]];
$price
=
$m_pay
->
getRefundSumV2
(
'a.refund_money'
,
$where
);
}
}
return
empty
(
$price
)
?
''
:
$price
;
return
empty
(
$price
)
?
''
:
$price
;
...
@@ -4291,21 +4311,25 @@ class Finance extends Basic
...
@@ -4291,21 +4311,25 @@ class Finance extends Basic
/**
/**
* @param int $type
* @param int $type
* @param int $is_adjustment 0调整前 1调整后
* @param int $is_adjustment 0调整前 1调整后
* @return float|int|string
* @param $income_start
* @param $income_end
* @return float|int
*/
*/
private
function
sumPayLogPriceByType
(
int
$type
,
int
$is_adjustment
=
0
)
{
private
function
sumPayLogPriceByType
(
int
$type
,
int
$is_adjustment
,
$income_start
,
$income_end
)
{
if
(
$is_adjustment
)
{
if
(
$is_adjustment
)
{
$m_pay_adjustment
=
new
OPayLogAdjustment
();
$m_pay_adjustment
=
new
OPayLogAdjustment
();
$where
[
'a.type'
]
=
$type
;
$where
[
'a.type'
]
=
$type
;
$where
[
'b.source'
]
=
2
;
$where
[
'b.source'
]
=
2
;
$where
[
'a.is_del'
]
=
0
;
$where
[
'a.is_del'
]
=
0
;
$where
[
'b.is_del'
]
=
0
;
$where
[
'b.is_del'
]
=
0
;
$price
=
$m_pay_adjustment
->
sumMoney
(
'a.money'
,
$where
,
$is_adjustment
);
$where
[
'b.income_time'
]
=
[
'between'
,
[
$income_start
,
$income_end
]];
$price
=
$m_pay_adjustment
->
sumMoney
(
'a.money'
,
$where
);
}
else
{
}
else
{
$m_pay
=
new
OPayLogModel
();
$m_pay
=
new
OPayLogModel
();
$where
[
'type'
]
=
$type
;
$where
[
'type'
]
=
$type
;
$where
[
'is_del'
]
=
0
;
$where
[
'is_del'
]
=
0
;
$where
[
'income_time'
]
=
[
'between'
,
[
$income_start
,
$income_end
]];
$price
=
$m_pay
->
sumPayLog
(
'real_money'
,
$where
);
$price
=
$m_pay
->
sumPayLog
(
'real_money'
,
$where
);
}
}
return
$price
;
return
$price
;
...
...
application/model/ORefundModel.php
View file @
dbd3a9eb
...
@@ -282,6 +282,19 @@ class ORefundModel extends Model{
...
@@ -282,6 +282,19 @@ class ORefundModel extends Model{
}
}
public
function
getRefundSumV2
(
$field
,
$params
)
{
if
(
!
isset
(
$params
[
'is_del'
]))
{
$params
[
'a.is_del'
]
=
0
;
}
$data
=
$this
->
db_
->
alias
(
'a'
)
->
join
(
'o_paylog b'
,
'a.pay_log_id=b.id'
)
->
where
(
$params
)
->
sum
(
$field
);
return
$data
;
}
/**
/**
* @param $params
* @param $params
* @return float|int
* @return float|int
...
@@ -320,6 +333,7 @@ class ORefundModel extends Model{
...
@@ -320,6 +333,7 @@ class ORefundModel extends Model{
public
function
sumBargainPrice
(
$field
,
$where
)
{
public
function
sumBargainPrice
(
$field
,
$where
)
{
return
$this
->
db_
->
alias
(
'a'
)
return
$this
->
db_
->
alias
(
'a'
)
->
join
(
'o_bargain b'
,
'a.order_id=b.order_id'
)
->
join
(
'o_bargain b'
,
'a.order_id=b.order_id'
)
->
join
(
'o_paylog c'
,
'a.pay_log_id=c.id'
)
->
where
(
$where
)
->
where
(
$where
)
->
sum
(
$field
);
->
sum
(
$field
);
}
}
...
...
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