장부스킨에서 (수입-지출=순이익) 이렇게 구하고 싶습니다. 계산 추가 가능할까요~?
본문
https://sir.kr/g5_skin/10925?sfl=wr_subject%7C%7Cwr_content&stx=%EC%9E%A5%EB%B6%80
오래전 장부 스킨인데요~
수입이wr_1, 비용이wr_2로 되어있습니다
여기서 wr_1 - wr_2 금액을 뺀 순이익을 옆칸에 표시하기가 가능한지
가능하면 어디를 뭐라고 추가해야할지 도움 부탁드려봅니다.
list.skin.php 파일 내용입니다
<?php
if(!defined('_GNUBOARD_')) exit; // 개별 페이지 접근 불가
///////////////////////////////////////////////////
/****** 사용 여분필드 *********
wr_1 수입 금액
wr_2 수입 부가세
wr_3 비용 금액
wr_4 비용 부가세
wr_5 고정자산증감 금액
wr_6 고정자산증감 부가세
wr_7 세액구분
wr_8 비고
wr_9
wr_10 기기넘버
************************/
include_once("$board_skin_path/list_sort.skin.php");
include_once("$board_skin_path/lib.skin.php");
// 선택옵션으로 인해 셀합치기가 가변적으로 변함
$colspan = 13;
if($is_checkbox) $colspan++;
//if($is_category) $colspan++;
// add_stylesheet('css 구문', 출력순서); 숫자가 작을 수록 먼저 출력됨
add_stylesheet('<link rel="stylesheet" href="'.$board_skin_url.'/style.css">', 0);
?>
<h2 id="container_title"><?php echo $board['bo_subject'] ?><span class="sound_only"> 목록</span></h2>
<div class="fw_title_c" style="text-align:center; z-index:3000;">
<button class='btn2 m' onclick="location.href='<?php echo G5_BBS_URL?>/board.php?bo_table=<?php echo $bo_table?>&sca=<?php echo $sca?>&wr_10=<?php echo $wr_10?>&sdate=<?php echo $pre_href?>' "> < </button>
<?php echo $start_title?>
<button class='btn2 m' onclick="location.href='<?php echo G5_BBS_URL?>/board.php?bo_table=<?php echo $bo_table?>&sca=<?php echo $sca?>&wr_10=<?php echo $wr_10?>&sdate=<?php echo $next_href?>' "> > </button>
<!-- <button class='btn2 m' onclick="location.href='<?php// echo G5_BBS_URL?>/board.php?bo_table=<?php// echo $bo_table?>&sca=<?php// echo $sca?>&wr_10=<?php// echo $wr_10?>&sdate=<?php// echo date('Y-m-d')?>&edate=<?php// echo date('Y-m-d')?>' ">오늘</button> -->
<button class='btn2 m' onclick="location.href='<?php echo G5_BBS_URL?>/board.php?bo_table=<?php echo $bo_table?>&sca=<?php echo $sca?>&wr_10=<?php echo $wr_10?>&sdate=<?php echo substr(date('Y-m-d'), 0, 7)?>' ">이달</button>
</div>
<div>
<form name="fsearch" method="get">
<input type="hidden" name="bo_table" value="<?php echo $bo_table ?>">
<input type="hidden" name="sca" value="<?php echo $sca ?>">
<input type="hidden" name="sop" value="and">
<input type='hidden' name='bo_table' value="<?php echo $bo_table?>">
<input class='ed' type='input' id='sdate' name='sdate' size='11' maxlength='10' itemname='시작일' value='<?php echo $sdate?>'>
~
<input class='ed' type='input' id='edate' name='edate' size='11' maxlength='10' itemname='마지막일' value='<?php echo $edate?>'>
<button type="submit" class="btn2 s">날짜별 검색</button>
</form>
</div>
<!-- 게시판 목록 시작 { -->
<div id="bo_list" style="width:<?php echo $width; ?>">
<!-- 기기넘버 { -->
<nav id="bo_cate2">
<h2><?php echo $board['bo_subject'] ?> 기기넘버</h2>
<ul id="bo_cate_ul">
<?php if(AC_CATEGORY) echo get_ac_category($bo_table, $sca, $wr_10, $sdate, $edate);?>
<li><a id="ac_category_toogle">기기넘버등록</a></li>
</ul>
</nav>
<div id="ac_category_div" style="display:none; padding:0 0 20px 0; text-align:center;">
<textarea id="ac_category" class="tx" row='3' style="height:50px; width:99%;"><?php echo AC_CATEGORY?></textarea>
<input type='hidden' id='ac_category_name' value="<?php echo AC_CATEGORY_NAME?>">
<div style="font-size:12px; color:#999; text-align:left;">[Tip] 기기넘버와 기기넘버 사이는 | 로 구분하세요. 입력예) 기기넘버A|기기넘버B|기기넘버C </div>
<span class='btn s' id='ac_category_btn'>저장</span>
</div>
<!-- } 기기넘버 -->
<!-- 게시판 페이지 정보 및 버튼 시작 { -->
<div class="bo_fx">
<div id="bo_list_total">
<span>Total <?php echo number_format($total_count) ?></span>,
<?php echo $page ?>page
</div>
<?php if ($rss_href || $write_href) { ?>
<ul class="btn_bo_user">
<?php if ($rss_href) { ?><li><a href="<?php echo $rss_href ?>" class="btn m">RSS</a></li><?php } ?>
<?php if ($admin_href) { ?><li><a href="<?php echo $admin_href ?>" class="btn2 m">관리자</a></li><?php } ?>
<?php /* if ($write_href) { ?><li><a href="<?php echo $write_href ?>" class="btn m">글쓰기</a></li><?php }*/ ?>
</ul>
<?php } ?>
</div>
<!-- } 게시판 페이지 정보 및 버튼 끝 -->
<form name="fboardlist" id="fboardlist" action="./board_list_update.php" onsubmit="return fboardlist_submit(this);" method="post">
<input type="hidden" name="bo_table" value="<?php echo $bo_table ?>">
<input type="hidden" name="sfl" value="<?php echo $sfl ?>">
<input type="hidden" name="stx" value="<?php echo $stx ?>">
<input type="hidden" name="spt" value="<?php echo $spt ?>">
<input type="hidden" name="sca" value="<?php echo $sca ?>">
<input type="hidden" name="page" value="<?php echo $page ?>">
<input type="hidden" name="sw" value="">
<div class="tbl_wrap">
<table id='bo_list'>
<thead>
<tr>
<th scope="col" rowspan="2">번호</th>
<?php if ($is_checkbox) { ?><th scope="col" rowspan="2"><input type="checkbox" id="chkall" onclick="if (this.checked) all_checked(true); else all_checked(false);"></th><?php } ?>
<th scope="col" rowspan="2"><a href='<?php echo G5_BBS_URL?>/board.php?bo_table=<?php echo $bo_table?>&sca=<?php echo $sca?>&sop=and&sst=wr_datetime&sod=desc'>날짜</a></th>
<th scope="col" rowspan="2">기기넘버</th>
<th scope="col" rowspan="2">거래내용</th>
<th scope="col" rowspan="2">세액<br>구분</th>
<th scope="col" colspan="2">수입(매출)</th>
<th scope="col" colspan="2">비용(매입)</th>
<th scope="col" colspan="2">고정자산증감(매매)</th>
<th scope="col" rowspan="2">비고</th>
<th scope="col" rowspan="2" style="min-width:40px;"></th>
</tr>
<tr>
<th scope="col">금액</th>
<th scope="col">부가세</th>
<th scope="col">금액</th>
<th scope="col">부가세</th>
<th scope="col">금액</th>
<th scope="col">부가세</th>
</tr>
</thead>
<?php include_once("$board_skin_path/list_add.skin.php");?>
<input type='hidden' name='chk' value='<?php echo count($list)?>'>
<tbody id='add_data'>
<?php
for ($i=0; $i<count($list); $i++)
{
//검색시 검색어 색상 변경되는 클래스 제거
if($sfl)
$list[$i]['subject'] = strip_tags($list[$i]['subject']);
?>
<input type='hidden' name='wr_id_up[<?php echo $i ?>]' value='<?php echo $list[$i][wr_id] ?>' id='wr_id_<?php echo $i ?>'>
<tr class="<?php if ($list[$i]['is_notice']) echo "bo_notice"; ?>">
<td align="center">
<?php
if ($list[$i]['is_notice']) // 공지사항
echo '<strong>공지</strong>';
else if ($wr_id == $list[$i]['wr_id'])
echo "<span class=\"bo_current\">열람중</span>";
else
echo "<a href='{$list[$i][href]}'>{$list[$i]['num']}</a>";
?>
</td>
<?php if ($is_checkbox) { ?>
<td class="td_chk"><input type="checkbox" name="chk_wr_id[]" value="<?php echo $list[$i]['wr_id'] ?>" id="chk_wr_id_<?php echo $i ?>"></td>
<?php } ?>
<td><input type='text' name='wr_datetime[<?php echo $i ?>]' value='<?php echo $list[$i]['datetime'] ?>' class="frm_input_datetime" readonly='readonly'></td>
<td><input type="text" name="wr_10[<?php echo $i ?>]" value="<?php echo $list[$i]['wr_10'];?>" class="frm_input_10"></td>
<td class="td_subject">
<?php echo $list[$i]['icon_reply'];?>
<input type="text" name="wr_subject[<?php echo $i ?>]" value="<?php echo $list[$i]['subject'] ?>" id="wr_subject" required class="frm_input_subject">
</td>
<td class="td_num">
<select name="wr_7[<?php echo $i ?>]" class='frm_input_2'>
<option value="1" <?php echo ($list[$i]['wr_7'] == "1")?"selected":"";?>>별도</option>
<option value="0" <?php echo ($list[$i]['wr_7'] == "0")?"selected":"";?>>없음</option>
</select>
</td>
<td class="td_num"><input type="text" name="wr_1[<?php echo $i ?>]" value="<?php if($list[$i]['wr_1']) echo number_format($list[$i]['wr_1']);?>" class="frm_input_1"></td>
<td class="td_num"><input type="text" name="wr_2[<?php echo $i ?>]" value="<?php if($list[$i]['wr_2']) echo number_format($list[$i]['wr_2']);?>" class="frm_input_2"></td>
<td class="td_num"><input type="text" name="wr_3[<?php echo $i ?>]" value="<?php if($list[$i]['wr_3']) echo number_format($list[$i]['wr_3']);?>" class="frm_input_1"></td>
<td class="td_num"><input type="text" name="wr_4[<?php echo $i ?>]" value="<?php if($list[$i]['wr_4']) echo number_format($list[$i]['wr_4']);?>" class="frm_input_2"></td>
<td class="td_num"><input type="text" name="wr_5[<?php echo $i ?>]" value="<?php if($list[$i]['wr_5']) echo number_format($list[$i]['wr_5']);?>" class="frm_input_1"></td>
<td class="td_num"><input type="text" name="wr_6[<?php echo $i ?>]" value="<?php if($list[$i]['wr_6']) echo number_format($list[$i]['wr_6']);?>" class="frm_input_2"></td>
<td class="td_num"><input type="text" name="wr_8[<?php echo $i ?>]" value="<?php if($list[$i]['wr_8']) echo $list[$i]['wr_8'];?>" id="wr_8" class="frm_input_8"></td>
<td align="center">
<?php if($is_admin || $member['mb_id'] == $list[$i]['mb_id']) { ?>
<span class='btn2 s ac_del' id='<?php echo $list[$i]['wr_id']?>'>삭제</span>
<?php } ?>
</td>
</tr>
<?php
//페이지 합계
for ($j=1; $j<=10; $j++)
{
if($j != 9)
{
$y = "wr_$j";
$page_add[$y] = $list[$i][$y] + $page_add[$y];
//if($list[$i][$y] != '') $list[$i][$y] = number_format($list[$i][$y]);
if($list[$i][$y] != '') $list[$i][$y] = $list[$i][$y];
}
}
}
//전체합계
$sca =$_GET['sca'];
$wr_10 = $_GET['wr_10'];
$all_add = " select sum(wr_1) as wr_1, sum(wr_2) as wr_2, sum(wr_3) as wr_3, sum(wr_4) as wr_4, sum(wr_5) as wr_5, sum(wr_6) as wr_6 from $write_table where wr_is_comment = 0 ";
if($sca) $all_add .= " and ca_name = '$sca' ";
if($wr_10) $all_add .= " and wr_10 = '$wr_10' ";
if($_GET['sdate']) $all_add .= " and wr_datetime between '$start_datetime' and '$end_datetime' ";
$all_add = sql_fetch($all_add);
?>
<?php if (count($list) == 0) { ?>
<input type='hidden' name='wr_id_up[0]' value='0' id='wr_id_0'> <!-- 데이타 없을 시 초기 wr_id 값 만들기 위해 -->
<tr><td colspan="<?php echo $colspan?>" class="empty_table">데이타가 없습니다.</td></tr>
<?php } ?>
<tr>
<td align="center" colspan='<?php echo $colspan-8;?>'><b>합계</b></td>
<td class="td_sum"><?php echo number_format($page_add[wr_1])?></td>
<td class="td_sum"><?php echo number_format($page_add[wr_2])?></td>
<td class="td_sum">-<?php echo number_format($page_add[wr_3])?></td>
<td class="td_sum"><?php echo number_format($page_add[wr_4])?></td>
<td class="td_sum"><?php echo number_format($page_add[wr_5])?></td>
<td class="td_sum"><?php echo number_format($page_add[wr_6])?></td>
<td class="td_sum"></td>
<td class="td_sum"></td>
</tr>
<tr>
<td align="center" colspan='<?php echo $colspan-8;?>'><b>전체 합계</b></td>
<td class="td_sum"><?php echo number_format($all_add[wr_1])?></td>
<td class="td_sum"><?php echo number_format($all_add[wr_2])?></td>
<td class="td_sum">-<?php echo number_format($all_add[wr_3])?></td>
<td class="td_sum"><?php echo number_format($all_add[wr_4])?></td>
<td class="td_sum"><?php echo number_format($all_add[wr_5])?></td>
<td class="td_sum"><?php echo number_format($all_add[wr_6])?></td>
<td class="td_sum"></td>
<td class="td_sum"></td>
</tr>
</tbody>
</table>
</div>
<?php if ($list_href || $is_checkbox || $write_href) { ?>
<div class="bo_fx" style="padding:10px 0;">
<?php if ($is_checkbox) { ?>
<input type="submit" name="btn_submit" value="선택삭제" onclick="document.pressed=this.value" class="btn2 m">
<input type="submit" name="btn_submit" value="선택복사" onclick="document.pressed=this.value" class="btn2 m">
<input type="submit" name="btn_submit" value="선택이동" onclick="document.pressed=this.value" class="btn2 m">
<?php } ?>
<?php if ($list_href || $write_href) { ?>
<ul class="btn_bo_user">
<?php if ($list_href) { ?><li><a href="<?php echo $list_href ?>" class="btn m">목록</a></li><?php } ?>
<?php/* if ($write_href) { ?><li><a href="<?php echo $write_href ?>" class="btn m">글쓰기</a></li><?php }*/ ?>
<?php if ($write_href) { ?><li><a href="javascript:select_update();" class="btn m">전체수정</a></li><?php } ?>
</ul>
<?php } ?>
</div>
<?php } ?>
</form>
</div>
<?php if($is_checkbox) { ?>
<noscript>
<p>자바스크립트를 사용하지 않는 경우<br>별도의 확인 절차 없이 바로 선택삭제 처리하므로 주의하시기 바랍니다.</p>
</noscript>
<?php } ?>
답변 2
echo number_format(intval($all_add['wr_1'])-intval($all_add['wr_2']));
이렇게 형변환 하셔서 값을 구하시면 됩니다.
!-->
echo number_format(intval($all_add['wr_1'])-intval($all_add['wr_2']));
이렇게 형변환 하셔서 값을 구하시면 됩니다.
!-->
답변을 작성하시기 전에 로그인 해주세요.