리스트에서 SUM 여줘봅니다. 채택완료
탐크루지
3년 전
조회 2,595
리스트에서 여분필드의 값들을 총합계로 계산을 했습니다.
그런데 잘 되는 필드가 있는 반면에 이상하게 계산을 하는 필드도 있습니다.
왜이럴까요?ㅠㅠ
한번 검토해 주시면 정말로 감사하겠습니다.

</p>
<p><?php
$FareTotal=0;
$ServiceTotal=0;
$ChargeTotal=0;
$TaxTotal=0;
$SellTotal=0;
$BalTotal=0;
$NetTotal=0;
$ProfitTotal=0;
for($i=0; $i<count($list); $i++)
{
$FareTotal+=$list[$i]['wr_3'];
$ServiceTotal+=$list[$i]['wr_4'];
$ChargeTotal+=$list[$i]['wr_9'];
$TaxTotal+=$list[$i]['wr_10'];
$SellTotal+=$list[$i]['wr_11'];
$BalTotal+=$list[$i]['wr_12'];
$NetTotal+=$list[$i]['wr_13'];
$ProfitTotal+=$list[$i]['wr_14'];
}
?>
<tr>
<td colspan="7" style="text-align: right;"><strong>Total</strong></td>
<td style="text-align: right;">$<?php echo number_format($FareTotal, 2)?></td>
<td style="text-align: right;">$<?php echo number_format($ServiceTotal, 2)?></td>
<td></td>
<td></td>
<td></td>
<td></td>
<td style="text-align: right;">$<?php echo number_format($ChargeTotal, 2)?></td>
<td style="text-align: right;">$<?php echo number_format($TaxTotal, 2)?></td>
<td style="text-align: right;">$<?php echo number_format($SellTotal ,2)?></td>
<td style="text-align: right;">$<?php echo number_format($BalTotal, 2)?></td>
<td style="text-align: right;">$<?php echo number_format($NetTotal, 2)?></td>
<td style="text-align: right;">$<?php echo number_format($ProfitTotal, 2)?></td>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
</tr></p>
<p>
댓글을 작성하려면 로그인이 필요합니다.
답변 2개
채택된 답변
+20 포인트
댓글을 작성하려면 로그인이 필요합니다.
3년 전
저소스 위부분을 올려보세요
안되면
https://sir.kr/gujik/1290" rel="nofollow noreferrer noopener" target="_blank">https://sir.kr/gujik/1290 에 저의 연락처가 있습니다
핸드폰으로 연락주시면 같이 고민 해드릴게요
로그인 후 평가할 수 있습니다
댓글을 작성하려면 로그인이 필요합니다.
답변을 작성하려면 로그인이 필요합니다.
로그인