안녕하세요 그누 초보입니다.
요즘 계속 포인트쪽 수정중인데 많은 분들께서 도움주셔서 차곡차곡 수정해나가고 있습니다.
정말 감사합니다.
다름이 아니고 이번에 막히는 부분은
포인트 리스트중에
지급(+) 부분의 합계값인 {$sum_point1} 이부분과
차감(-) 부분의 합계값인 {$sum_point2} 이부분이 있는데요
{$sum_point1} - {$sum_point2} = 최종값
이런 최종값을 얻으려면 어떻게 해야하나요?
<table width='99%' align=center cellpadding=3 cellspacing=0 border=1 bordercolordark=#F0F0F0>
<colgroup width=130></colgroup>
<colgroup width=''></colgroup>
<colgroup width=70></colgroup>
<colgroup width=70></colgroup>
<tr height=25 bgcolor=#F9F9F9 align=center>
<td>일시</td>
<td>내용</td>
<td>지급(+)</td>
<td>차감(-)</td>
</tr>
<?
$sum_point1 = $sum_point2 = 0;
$sql = " select *
$sql_common
$sql_order
limit $from_record, $rows ";
$result = sql_query($sql);
for ($i=0; $row=sql_fetch_array($result); $i++) {
$point1 = $point2 = 0;
if ($row[po_point] > 0) {
$point1 = "" . number_format($row[po_point]);
$sum_point1 += $row[po_point];
} else {
$point2 = number_format($row[po_point]);
$sum_point2 += $row[po_point];
}
echo <<<HEREDOC
<tr height=25 bgcolor="#F6F6F6" align="center">
<td height="24">$row[po_datetime]</td>
<td align="left" title='$row[po_content]'><nobr style='display:block; overflow:hidden; width:100%;'> $row[po_content]</a></td>
<td align=right>{$point1} 원 </td>
<td align=right>{$point2} 원 </td>
</tr>
HEREDOC;
}
if ($i == 0)
echo "<tr><td colspan=5 align=center height=100>자료가 없습니다.</td></tr>";
else {
if ($sum_point1 > 0)
$sum_point1 = "" . number_format($sum_point1);
$sum_point2 = number_format($sum_point2);
echo <<<HEREDOC
<tr height=25 bgcolor="#E1E1E1" align="center">
<td height="24" colspan=2 align=center>소 계</td>
<td align=right>{$sum_point1} 원 </td>
<td align=right>{$sum_point2} 원 </td>
</tr>
HEREDOC;
}
?>
</table>
요즘 계속 포인트쪽 수정중인데 많은 분들께서 도움주셔서 차곡차곡 수정해나가고 있습니다.
정말 감사합니다.
다름이 아니고 이번에 막히는 부분은
포인트 리스트중에
지급(+) 부분의 합계값인 {$sum_point1} 이부분과
차감(-) 부분의 합계값인 {$sum_point2} 이부분이 있는데요
{$sum_point1} - {$sum_point2} = 최종값
이런 최종값을 얻으려면 어떻게 해야하나요?
<table width='99%' align=center cellpadding=3 cellspacing=0 border=1 bordercolordark=#F0F0F0>
<colgroup width=130></colgroup>
<colgroup width=''></colgroup>
<colgroup width=70></colgroup>
<colgroup width=70></colgroup>
<tr height=25 bgcolor=#F9F9F9 align=center>
<td>일시</td>
<td>내용</td>
<td>지급(+)</td>
<td>차감(-)</td>
</tr>
<?
$sum_point1 = $sum_point2 = 0;
$sql = " select *
$sql_common
$sql_order
limit $from_record, $rows ";
$result = sql_query($sql);
for ($i=0; $row=sql_fetch_array($result); $i++) {
$point1 = $point2 = 0;
if ($row[po_point] > 0) {
$point1 = "" . number_format($row[po_point]);
$sum_point1 += $row[po_point];
} else {
$point2 = number_format($row[po_point]);
$sum_point2 += $row[po_point];
}
echo <<<HEREDOC
<tr height=25 bgcolor="#F6F6F6" align="center">
<td height="24">$row[po_datetime]</td>
<td align="left" title='$row[po_content]'><nobr style='display:block; overflow:hidden; width:100%;'> $row[po_content]</a></td>
<td align=right>{$point1} 원 </td>
<td align=right>{$point2} 원 </td>
</tr>
HEREDOC;
}
if ($i == 0)
echo "<tr><td colspan=5 align=center height=100>자료가 없습니다.</td></tr>";
else {
if ($sum_point1 > 0)
$sum_point1 = "" . number_format($sum_point1);
$sum_point2 = number_format($sum_point2);
echo <<<HEREDOC
<tr height=25 bgcolor="#E1E1E1" align="center">
<td height="24" colspan=2 align=center>소 계</td>
<td align=right>{$sum_point1} 원 </td>
<td align=right>{$sum_point2} 원 </td>
</tr>
HEREDOC;
}
?>
</table>
댓글 2개
게시글 목록
| 번호 | 제목 |
|---|---|
| 284508 | |
| 284499 | |
| 284492 | |
| 284490 | |
| 284484 | |
| 284481 | |
| 284478 | |
| 284476 | |
| 284474 | |
| 284472 | |
| 284470 | |
| 284458 | |
| 284457 | |
| 284454 | |
| 284453 | |
| 284447 | |
| 284446 | |
| 284444 | |
| 284441 | |
| 284440 |
댓글 작성
댓글을 작성하시려면 로그인이 필요합니다.
로그인하기