<?

// 기본 설정 로딩
require_once 'config.php';
require_once 'function.php';
require_once 'lib.php';

//HTML 시작
if (!$_GET[limit]) {$limit = 10;} else { $limit = $_GET[limit];}

$query = "select deposit_num from depositdb";
$total_data = @mysql_query($query, $db_connect) or die($db_q_error);
$total = mysql_num_rows($total_data);

$list_no = (!$_GET[ea]) ? '20' : $_GET[ea];

if ($list_no > $total) {$list_no = $total;}
$total_page = ($total != '0') ? ceil($total / $list_no) : '0';

$page = $_GET[curPage];

if (!$page) {$page = 1;} elseif ($page >= $total_page) {$page = $total_page;} else { $page = $page;}

$next_page = ($page-'1') * $list_no;
$next_no = $next_page + $list_no;

$query = "select * from depositdb order by deposit_num desc limit " . $next_page . "," . $next_no;
$query_data = @mysql_query($query, $db_connect) or die($db_q_error);

?>


			<div class="panel-body">
				<div class="row">
<!--
					<form action="IdcDepositList.dep" method="post">
						<div class="col-lg-6 col-md-7 col-sm-8 col-xs-12">
							<div class="input-group">
								<input class="form-control" type="text" name="searchContent" placeholder="고객명" value="${searchContent }">
								<div class="input-group-btn">
									<input type="submit" class="btn btn-info btn-outline" value="검색">
								</div>
							</div>
						</div>
					</form>
				</div>
-->
				<input type="hidden" id="token">
	   			<div class="table-responsive" id="table">
					<table class="table table-bordered table-hover table-striped">
						<thead>
							<tr>
								<th style="text-align:center;width:85px;">고객명</th>
								<th style="text-align:center;width:60px;">은행</th>
								<th style="text-align:center;width:80px;">날짜</th>
								<th style="text-align:center;width:90px;">금액</th>
								<th style="text-align:center;width:60px;">입금자</th>
								<th style="text-align:center;width:300px;">비고</th>
								<th style="text-align:center;width:80px;">처리자</th>
								<th style="text-align:center;width:40px;">수정</th>
							</tr>
						</thead>
						<tbody>
<?

for ($i = $next_page; $i < $next_no; $i++) {
    $data = mysql_fetch_assoc($query_data);
    $deposit_amount = number_format($data[deposit_amount]);

    ?>
								<tr>
									<td style="text-align:center"><a href="/serviceList.sev?filter=mk_all&searchContextService=<?=$data[client_name]?>"><?=$data[client_name]?></a></td>
									<td style="text-align:center"><?=$data[deposit_bank]?></td>
									<td style="text-align:center"><?=$data[deposit_date]?></td>
									<td style="text-align:center"><?=$deposit_amount?></td>
									<td style="text-align:center"><?=$data[deposit_name]?></td>
									<td><?=$data[deposit_note]?></td>
									<td style="text-align:center"><?=$data[mkworker]?></td>
									<td style="text-align:center"><a href=/IdcDepositList.dep?searchContent=<?=$data[client_name]?>>수정</a></td>
								</tr>
<?}?>
						</tbody>
						<tfoot>
						</tfoot>
					</table>
				</div>
<!--
				<div>
					<ul class="pagination" style="margin:0px;">
						<li>
							<a class="btn btn-outline btn-default" href="IdcDepositList.dep?searchContent=${searchContent }">
								<i class="fa fa-angle-double-left "></i>
							</a>
						</li>
						<li>
							<c:if test="${curPage!=1 }">
								<a class="btn btn-outline_btn-default" href="IdcDepositList.dep?searchOption=${searchOption }&curPage=${curPage-1 }&searchContent=${searchContent}">
									<i class="fa fa-angle-left"></i>
								</a>
							</c:if>
							<c:if test="${curPage==1 }">
								<a class="btn btn-outline_btn-default" href="IdcDepositList.dep?searchOption=${searchOption }&curPage=1&searchContent=${searchContent}">
									<i class="fa fa-angle-left"></i>
								</a>
							</c:if>
						</li>
						<c:forEach var="i" begin="${firstPage }" end="${endPage }">
							<li>
								<a class="btn btn-outline btn-defualt" href="IdcDepositList.dep?curPage=${i}&searchContent=${searchContent }">${i}</a>
							</li>
						</c:forEach>
						<li>
							<c:if test="${curPage!=pageCnt }">
								<a class="btn btn-outline_btn-default" href="IdcDepositList.dep?searchOption=${searchOption }&curPage=${curPage+1 }&searchContent=${searchContent}">
									<i class="fa fa-angle-right"></i>
								</a>
							</c:if>
							<c:if test="${curPage==pageCnt }">
								<a class="btn btn-outline_btn-default" href="IdcDepositList.dep?searchOption=${searchOption }&curPage=${pageCnt }&searchContent=${searchContent}">
									<i class="fa fa-angle-right"></i>
								</a>
							</c:if>
						</li>
						<li>
							<a class="btn btn-outline btn-default" href="IdcDepositList.dep?curPage=${pageCnt}&searchContent=${searchContent }">
								<i class="fa fa-angle-double-right "></i>
							</a>
						</li>
					</ul>
				</div>
-->
			</div>

<div align='center'>
<?
$setup_dir = "http://" . $_SERVER['HTTP_HOST'] . ":6752";
$page_scale = 10;
$page3 = floor(($total_page-'1') / $page_scale);
$n_page = floor(($page-'1') / $page_scale);

if ($n_page > 0) {

    $p_start = (($n_page - 1) * $page_scale)+'1';
    $link = "<a onfocus=blur() href='" . $setup_dir . "/IdcDepositListMK.dep?ea=$_GET[ea]&curPage=" . $p_start . "'>";
    $link .= "<<";
    $link .= "</a>";
    echo $link . " ";
}
$is = ($n_page * $page_scale)+'1';
for ($i = $is; $i < $is + $page_scale; $i++) {

    if ($i < $total_page+'1') {
        if ($i == $page) {$ib = "<b>$i</b>";} else { $ib = $i;}
        $link = "<a onfocus=blur() href='" . $setup_dir . "/IdcDepositListMK.dep?ea=$_GET[ea]&curPage=" . $i . "'>";
        $link .= $ib;
        $link .= "</a>";
        echo $link . " ";
    }
}
if ($n_page < $page3) {
    $link = "<a onfocus=blur() href='" . $setup_dir . "/IdcDepositListMK.dep?ea=$_GET[ea]&curPage=" . $i . "'>";
    $link .= ">>";
    $link .= "</a>";
    echo $link;
}

?>
</div>

<?
//DB닫기
mysql_close($db_connect);

?>
