master
yulingwei 5 years ago
parent dc96411757
commit 5dde3ef96e

@ -137,7 +137,7 @@ class SettlementController extends ThinkController
}
$result = M('spend', 'tab_')->query("
SELECT
sum(s.pay_amount) as amount, g.relation_game_id, g.relation_game_name, p.partner, p.id as p_id, p.channel_rate, p.invoice_rate, g.id as game_id
TRUNCATE(sum(s.pay_amount), 2) as amount, g.relation_game_id, g.relation_game_name, p.partner, p.id as p_id, p.channel_rate, p.invoice_rate, g.id as game_id
FROM
tab_spend as s
INNER JOIN tab_game g on s.game_id = g.id
@ -179,7 +179,7 @@ class SettlementController extends ThinkController
$data['relation_game_name'] = $item['relation_game_name'];
$data['amount'] = $item['amount'];
$data['self_game_ratio'] = 100 - $data['game_ratio'];
$data['parter_settlement'] = $item['amount'] * $data['game_ratio']/100 - ($item['amount']*$item['channel_rate'] ) + $list[$item['p_id']]['bonuses'] - $list[$item['p_id']]['fine'];
$data['parter_settlement'] = floor(($item['amount'] * ($data['game_ratio']/100) - ($item['amount']*$item['channel_rate'] ) + $list[$item['p_id']]['bonuses'] - $list[$item['p_id']]['fine'])*100)/100;
$list[$item['p_id']]['channels'][] = array_merge($data, [
'company_id'=>$item['p_id'],
'company_name'=>$item['partner'],
@ -206,7 +206,7 @@ class SettlementController extends ThinkController
foreach ($result as $key => $item) {
$res = M()->query("
select
g.relation_game_name, g.relation_game_id, sum(s.pay_amount) as amount
g.relation_game_name, g.relation_game_id, TRUNCATE(sum(s.pay_amount), 2) as amount
from
tab_spend s
inner join tab_promote p on (p.chain like '/{$item['id']}/%' or p.id = {$item['id']}) and s.promote_id = p.id
@ -236,7 +236,7 @@ class SettlementController extends ThinkController
'time_start' => date('Y-m-d', $time_start),
'time_end' => date('Y-m-d', $time_end)
];
$list[$item['p_id']]['total_amount'] = $list[$item['p_id']]['bonuses'] - $list[$item['p_id']]['fine'];
$list[$item['p_id']]['total_amount'] = floor(($list[$item['p_id']]['bonuses'] - $list[$item['p_id']]['fine'])*100)/100;
}
foreach ($res as $k => $val) {
$gameRatio = getPromoteGameRatio($item['id'], $val['relation_game_id'], $val['amount'], $time_start, $time_end, true);
@ -278,7 +278,7 @@ class SettlementController extends ThinkController
foreach ($result as $key => $item) {
$res = M()->query("
select
g.relation_game_name, g.relation_game_id, sum(s.pay_amount) as amount
g.relation_game_name, g.relation_game_id, TRUNCATE(sum(s.pay_amount), 2) as amount
from
tab_spend s
inner join tab_promote p on (p.chain like '/{$item['id']}/%' or p.id = {$item['id']}) and s.promote_id = p.id
@ -310,7 +310,7 @@ class SettlementController extends ThinkController
'time_start' => date('Y-m-d', $time_start),
'time_end' => date('Y-m-d', $time_end)
];
$list[$item['p_id']]['total_amount'] = $list[$item['p_id']]['bonuses'] - $list[$item['p_id']]['fine'];
$list[$item['p_id']]['total_amount'] = floor(($list[$item['p_id']]['bonuses'] - $list[$item['p_id']]['fine'])*100)/100;
}
foreach ($res as $k => $val) {
$gameRatio = getPromoteGameRatio($item['id'], $val['relation_game_id'], $val['amount'], $time_start, $time_end, true);

Loading…
Cancel
Save