포인트소계 계산 쿼리 추가
This commit is contained in:
@ -1,7 +1,7 @@
|
|||||||
<?
|
<?
|
||||||
include_once('./_common.php');
|
include_once('./_common.php');
|
||||||
|
|
||||||
if (!$member[mb_id])
|
if (!$member[mb_id])
|
||||||
alert_close('회원만 조회하실 수 있습니다.');
|
alert_close('회원만 조회하실 수 있습니다.');
|
||||||
|
|
||||||
$g4['title'] = $member[mb_nick].' 님의 포인트 내역';
|
$g4['title'] = $member[mb_nick].' 님의 포인트 내역';
|
||||||
@ -20,6 +20,20 @@ $rows = $config[cf_page_rows];
|
|||||||
$total_page = ceil($total_count / $rows); // 전체 페이지 계산
|
$total_page = ceil($total_count / $rows); // 전체 페이지 계산
|
||||||
if (!$page) { $page = 1; } // 페이지가 없으면 첫 페이지 (1 페이지)
|
if (!$page) { $page = 1; } // 페이지가 없으면 첫 페이지 (1 페이지)
|
||||||
$from_record = ($page - 1) * $rows; // 시작 열을 구함
|
$from_record = ($page - 1) * $rows; // 시작 열을 구함
|
||||||
|
|
||||||
|
// 지급포인트소계
|
||||||
|
$sql = " select SUM(po_point) as sum_point1
|
||||||
|
$sql_common
|
||||||
|
and po_point >= 0 ";
|
||||||
|
$row = sql_fetch($sql);
|
||||||
|
$sum_point1 = $row['sum_point1'];
|
||||||
|
|
||||||
|
// 사용포인트소계
|
||||||
|
$sql = " select SUM(po_point) as sum_point2
|
||||||
|
$sql_common
|
||||||
|
and po_point < 0 ";
|
||||||
|
$row = sql_fetch($sql);
|
||||||
|
$sum_point2 = $row['sum_point2'];
|
||||||
?>
|
?>
|
||||||
|
|
||||||
<h1>포인트내역</h1>
|
<h1>포인트내역</h1>
|
||||||
@ -37,15 +51,15 @@ $from_record = ($page - 1) * $rows; // 시작 열을 구함
|
|||||||
<tfoot>
|
<tfoot>
|
||||||
<tr>
|
<tr>
|
||||||
<td colspan="2">소계</td>
|
<td colspan="2">소계</td>
|
||||||
<td><?=$sum_point1?></td>
|
<td><?=number_format($sum_point1)?></td>
|
||||||
<td><?=$sum_point2?></td>
|
<td><?=number_format($sum_point2)?></td>
|
||||||
</tr>
|
</tr>
|
||||||
</tfoot>
|
</tfoot>
|
||||||
<tbody>
|
<tbody>
|
||||||
<?
|
<?
|
||||||
$sum_point1 = $sum_point2 = 0;
|
$sum_point1 = $sum_point2 = 0;
|
||||||
|
|
||||||
$sql = " select *
|
$sql = " select *
|
||||||
{$sql_common}
|
{$sql_common}
|
||||||
{$sql_order}
|
{$sql_order}
|
||||||
limit {$from_record}, {$rows} ";
|
limit {$from_record}, {$rows} ";
|
||||||
@ -59,7 +73,7 @@ for ($i=0; $row=sql_fetch_array($result); $i++) {
|
|||||||
$point2 = number_format($row[po_point]);
|
$point2 = number_format($row[po_point]);
|
||||||
$sum_point2 += $row[po_point];
|
$sum_point2 += $row[po_point];
|
||||||
}
|
}
|
||||||
|
|
||||||
?>
|
?>
|
||||||
<tr>
|
<tr>
|
||||||
<td><?=$row[po_datetime]?></td>
|
<td><?=$row[po_datetime]?></td>
|
||||||
|
|||||||
Reference in New Issue
Block a user