#283 개인결제 기능 추가

This commit is contained in:
chicpro
2013-09-03 13:26:01 +09:00
parent d5288477be
commit 5027621753
27 changed files with 2881 additions and 8 deletions

View File

@ -8,6 +8,7 @@ $menu['menu400'] = array (
array('400410', '주문개별내역', G4_ADMIN_URL.'/shop_admin/orderstatuslist.php', 'scf_order_by', 1),
array('400420', '주문통합내역', G4_ADMIN_URL.'/shop_admin/orderlist2.php', 'scf_order_all', 1),
array('400430', '취소교환반품내역', G4_ADMIN_URL.'/shop_admin/orderrequestlist.php', 'scf_request', 1),
array('400440', '개인결제관리', G4_ADMIN_URL.'/shop_admin/personalpaylist.php', 'scf_personalpay', 1),
array('400200', '분류관리', G4_ADMIN_URL.'/shop_admin/categorylist.php', 'scf_cate'),
array('400300', '상품관리', G4_ADMIN_URL.'/shop_admin/itemlist.php', 'scf_item'),
array('400660', '상품문의', G4_ADMIN_URL.'/shop_admin/itemqalist.php', 'scf_item_qna'),

View File

@ -34,6 +34,11 @@ include_once (G4_ADMIN_PATH.'/admin.head.php');
<form name="fcouponform" action="./couponformupdate.php" method="post" onsubmit="return form_check(this);">
<input type="hidden" name="w" value="<?php echo $w; ?>">
<input type="hidden" name="cp_id" value="<?php echo $cp_id; ?>">
<input type="hidden" name="sst" value="<?php echo $sst; ?>">
<input type="hidden" name="sod" value="<?php echo $sod; ?>">
<input type="hidden" name="sfl" value="<?php echo $sfl; ?>">
<input type="hidden" name="stx" value="<?php echo $stx; ?>">
<input type="hidden" name="page" value="<?php echo $page;?>">
<section class="cbox">
<h2><?php echo $html_title; ?></h2>

View File

@ -761,6 +761,9 @@ $pg_anchor .='<li><a href="#anc_sodr_chk">결제상세정보 확인</a></li>
<div class="btn_confirm">
<input type="submit" value="결제/배송내역 수정" class="btn_submit">
<?php if($amount['미수'] > 0) { ?>
<a href="./personalpayform.php?popup=yes&amp;od_id=<?php echo $od_id; ?>" id="personalpay_add">개인결제추가</a>
<?php } ?>
</div>
</form>
</section>
@ -959,6 +962,13 @@ $(function() {
else
$chk.attr("checked", false);
});
// 개인결제추가
$("#personalpay_add").on("click", function() {
var href = this.href;
window.open(href, "personalpaywin", "left=100, top=100, width=700, height=650, scrollbars=yes");
return false;
});
});
function form_submit(f)

View File

@ -0,0 +1,63 @@
<?php
$sub_menu = '400440';
include_once('./_common.php');
auth_check($auth[$sub_menu], 'w');
$g4['title'] = '개인결제 복사';
include_once(G4_PATH.'/head.sub.php');
$sql = " select * from {$g4['shop_personalpay_table']} where pp_id = '$pp_id' ";
$row = sql_fetch($sql);
if(!$row['pp_id'])
alert_close('복사하시려는 개인결제 정보가 존재하지 않습니다.');
?>
<form name="fpersonalpaycopy" method="post" action="./personalpaycopyupdate.php" onsubmit="return form_check(this);">
<input type="hidden" name="pp_id" value="<?php echo $pp_id; ?>">
<div class="cbox">
<h1>개인결제 복사</h1>
<table class="frm_tbl">
<tbody>
<tr>
<th scope="row"><label for="pp_name">이름</label></th>
<td><input type="text" name="pp_name" value="<?php echo $row['pp_name']; ?>" id="pp_name" required class="required frm_input"></td>
</tr>
<tr>
<th scope="row"><label for="od_id">주문번호</label></th>
<td><input type="text" name="od_id" value="<?php echo $row['od_id']; ?>" id="od_id" class="frm_input"></td>
</tr>
<tr>
<th scope="row"><label for="pp_amount">주문금액</label></th>
<td><input type="text" name="pp_amount" value="" id="pp_amount" required class="required frm_input" size="20"> 원</td>
</tr>
</tbody>
</table>
<div class="btn_confirm">
<input type="submit" value="복사하기" class="btn_submit">
<button type="button" onclick="self.close();">창닫기</button>
</div>
</div>
</form>
<script>
// <![CDATA[
function form_check(f)
{
if(f.pp_amount.value.replace(/[0-9]/g, "").length > 0) {
alert("주문금액은 숫자만 입력해 주십시오");
return false;
}
return true;
}
// ]]>
</script>
<?php
include_once(G4_PATH.'/tail.sub.php');
?>

View File

@ -0,0 +1,54 @@
<?php
$sub_menu = '400440';
include_once('./_common.php');
auth_check($auth[$sub_menu], 'w');
$_POST = array_map('trim', $_POST);
if(!$_POST['pp_name'])
alert('이름을 입력해 주십시오.');
if(!$_POST['pp_amount'])
alert('주문금액을 입력해 주십시오.');
if(preg_match('/[^0-9]/', $_POST['pp_amount']))
alert('주문금액은 숫자만 입력해 주십시오.');
if($_POST['od_id']) {
$sql = " select od_id from {$g4['shop_order_table']} where od_id = '{$_POST['od_id']}' ";
$od = sql_fetch($sql);
if(!$od['od_id'])
alert('입력하신 주문번호는 존재하지 않습니다.');
}
$sql = " select * from {$g4['shop_personalpay_table']} where pp_id = '$pp_id' ";
$row = sql_fetch($sql);
if(!$row['pp_id'])
alert_close('복사하시려는 개인결제 정보가 존재하지 않습니다.');
$new_pp_id = get_uniqid();
$sql = " insert into {$g4['shop_personalpay_table']}
set pp_id = '$new_pp_id',
od_id = '{$_POST['od_id']}',
pp_name = '{$_POST['pp_name']}',
pp_content = '{$row['pp_content']}',
pp_use = '{$row['pp_use']}',
pp_amount = '{$_POST['pp_amount']}',
pp_ip = '{$_SERVER['REMOTE_ADDR']}',
pp_time = '".G4_TIME_YMDHIS."' ";
sql_query($sql);
$g4['title'] = '개인결제 복사';
include_once(G4_PATH.'/head.sub.php');
?>
<script>
alert("개인결제 정보가 복사되었습니다.");
window.opener.location.reload();
self.close();
</script>
<?php
include_once(G4_PATH.'/tail.sub.php');
?>

View File

@ -0,0 +1,154 @@
<?php
$sub_menu = '400440';
include_once('./_common.php');
auth_check($auth[$sub_menu], "w");
$g4['title'] = '개인결제 관리';
if ($w == 'u') {
$html_title = '개인결제 수정';
$sql = " select * from {$g4['shop_personalpay_table']} where pp_id = '$pp_id' ";
$pp = sql_fetch($sql);
if (!$pp['pp_id']) alert('등록된 자료가 없습니다.');
}
else
{
$html_title = '개인결제 입력';
$pp['pp_use'] = 1;
}
if($popup == 'yes') {
include_once(G4_PATH.'/head.sub.php');
$pp['od_id'] = $od_id;
$sql = " select od_id, od_name, (od_temp_amount - od_receipt_amount) as misu
from {$g4['shop_order_table']}
where od_id = '$od_id' ";
$od = sql_fetch($sql);
if(!$od['od_id'])
alert_close('주문정보가 존재하지 않습니다.');
$pp['pp_name'] = $od['od_name'];
if($od['misu'] > 0)
$pp['pp_amount'] = $od['misu'];
}
else
include_once (G4_ADMIN_PATH.'/admin.head.php');
?>
<form name="fpersonalpayform" action="./personalpayformupdate.php" method="post" onsubmit="return form_check(this);">
<input type="hidden" name="w" value="<?php echo $w; ?>">
<input type="hidden" name="pp_id" value="<?php echo $pp_id; ?>">
<input type="hidden" name="sst" value="<?php echo $sst; ?>">
<input type="hidden" name="sod" value="<?php echo $sod; ?>">
<input type="hidden" name="sfl" value="<?php echo $sfl; ?>">
<input type="hidden" name="stx" value="<?php echo $stx; ?>">
<input type="hidden" name="page" value="<?php echo $page; ?>">
<input type="hidden" name="popup" value="<?php echo $popup; ?>">
<section class="cbox">
<h2><?php echo $html_title; ?></h2>
<table class="frm_tbl">
<colgroup>
<col class="grid_3">
<col>
</colgroup>
<tbody>
<tr>
<th scope="row"><label for="pp_name">이름</label></th>
<td><input type="text" name="pp_name" value="<?php echo $pp['pp_name']; ?>" id="pp_name" required class="required frm_input"></td>
</tr>
<tr>
<th scope="row"><label for="pp_amount">주문금액</label></th>
<td><input type="text" name="pp_amount" value="<?php echo $pp['pp_amount']; ?>" id="pp_amount" required class="required frm_input" size="15"> 원</td>
</tr>
<tr>
<th scope="row"><label for="od_id">주문번호</label></th>
<td><input type="text" name="od_id" value="<?php echo $pp['od_id'] ? $pp['od_id'] : ''; ?>" id="od_id" class="frm_input" size="20"></td>
</tr>
<tr>
<th scope="row"><label for="pp_content">내용</label></th>
<td><textarea name="pp_content" id="pp_content" rows="8"><?php echo $pp['pp_content']; ?></textarea></td>
</tr>
<?php if($popup != 'yes') { ?>
<tr>
<th scope="row"><label for="pp_receipt_amount">결제금액</label></th>
<td><input type="text" name="pp_receipt_amount" value="<?php echo $pp['pp_receipt_amount'] ? $pp['pp_receipt_amount'] : ''; ?>" id="pp_receipt_amount" class="frm_input" size="15"> 원</td>
</tr>
<tr>
<th scope="row"><label for="pp_settle_case">결제방법</label></th>
<td>
<select name="pp_settle_case" id="pp_settle_case">
<option value="" <?php echo get_selected($pp['pp_settle_case'], ''); ?>>선택</option>
<option value="무통장" <?php echo get_selected($pp['pp_settle_case'], '무통장'); ?>>무통장</option>
<option value="계좌이체" <?php echo get_selected($pp['pp_settle_case'], '계좌이체'); ?>>계좌이체</option>
<option value="가상계좌" <?php echo get_selected($pp['pp_settle_case'], '가상계좌'); ?>>가상계좌</option>
<option value="신용카드" <?php echo get_selected($pp['pp_settle_case'], '신용카드'); ?>>신용카드</option>
<option value="휴대폰" <?php echo get_selected($pp['pp_settle_case'], '휴대폰'); ?>>휴대폰</option>
</select>
</td>
</tr>
<tr>
<th scope="row"><label for="pp_receipt_time">결제일시</label></th>
<td>
<label for="pp_receipt_chk">현재 시간으로 설정</label>
<input type="checkbox" name="pp_receipt_chk" id="pp_receipt_chk" value="<?php echo date("Y-m-d H:i:s", G4_SERVER_TIME); ?>" onclick="if (this.checked == true) this.form.pp_receipt_time.value=this.form.pp_receipt_chk.value; else this.form.pp_receipt_time.value = this.form.pp_receipt_time.defaultValue;"><br>
<input type="text" name="pp_receipt_time" value="<?php echo is_null_time($pp['pp_receipt_time']) ? "" : $pp['pp_receipt_time']; ?>" id="pp_receipt_time" class="frm_input" maxlength="19">
</td>
</tr>
<?php } ?>
<tr>
<th scope="row"><label for="pp_shop_memo">상점메모</label></th>
<td><textarea name="pp_shop_memo" id="pp_shop_memo" rows="8"><?php echo $pp['pp_shop_memo']; ?></textarea></td>
</tr>
<tr>
<th scope="row"><label for="pp_use">사용</label></th>
<td>
<select name="pp_use" id="pp_use">
<option value="1" <?php echo get_selected($pp['pp_use'], 1); ?>>사용함</option>
<option value="0" <?php echo get_selected($pp['pp_use'], 0); ?>>사용안함</option>
</select>
</td>
</tr>
</tbody>
</table>
<div class="btn_confirm">
<input type="submit" value="확인" class="btn_submit" accesskey="s">
<?php if($popup == 'yes') { ?>
<button type="button" onclick="self.close();">닫기</button>
<?php } else { ?>
<a href="./personalpaylist.php?<?php echo $qstr; ?>">목록</a>
<?php } ?>
<?php if($w == 'u') { ?>
<a href="./personalpayformupdate.php?w=d&amp;pp_id=<?php echo $pp['pp_id']; ?>" onclick="return del_confirm();">삭제</a>
<?php } ?>
</div>
</section>
</form>
<script>
function form_check(f)
{
if(f.pp_amount.value.replace(/[0-9]/g, "").length > 0) {
alert("주문금액은 숫자만 입력해 주십시오");
return false;
}
return true;
}
function del_confirm()
{
return confirm("개인결제 정보를 삭제하시겠습니까?\n\n삭제한 정보는 복구할 수 없습니다.");
}
</script>
<?php
if($popup == 'yes')
include_once(G4_PATH.'/tail.sub.php');
else
include_once (G4_ADMIN_PATH.'/admin.tail.php');
?>

View File

@ -0,0 +1,70 @@
<?php
$sub_menu = '400440';
include_once('./_common.php');
if($w == 'd') {
auth_check($auth[$sub_menu], 'd');
$sql = " select pp_id from {$g4['shop_personalpay_table']} where pp_id = '{$_GET['pp_id']}' ";
$row = sql_fetch($sql);
if(!$row['pp_id'])
alert('삭제하시려는 자료가 존재하지 않습니다.');
sql_query(" delete from {$g4['shop_personalpay_table']} where pp_id = '{$_GET['pp_id']}' ");
goto_url('./personalpaylist.php?'.$qstr);
} else {
auth_check($auth[$sub_menu], 'w');
$_POST = array_map('trim', $_POST);
if(!$_POST['pp_name'])
alert('이름을 입력해 주십시오.');
if(!$_POST['pp_amount'])
alert('주문금액을 입력해 주십시오.');
if(preg_match('/[^0-9]/', $_POST['pp_amount']))
alert('주문금액은 숫자만 입력해 주십시오.');
if($_POST['od_id']) {
$sql = " select od_id from {$g4['shop_order_table']} where od_id = '{$_POST['od_id']}' ";
$row = sql_fetch($sql);
if(!$row['od_id'])
alert('입력하신 주문번호는 존재하지 않는 주문 자료입니다.');
}
$sql_common = " pp_name = '{$_POST['pp_name']}',
pp_amount = '{$_POST['pp_amount']}',
od_id = '{$_POST['od_id']}',
pp_content = '{$_POST['pp_content']}',
pp_receipt_amount = '{$_POST['pp_receipt_amount']}',
pp_settle_case = '{$_POST['pp_settle_case']}',
pp_receipt_time = '{$_POST['pp_receipt_time']}',
pp_shop_memo = '{$_POST['pp_shop_memo']}',
pp_use = '{$_POST['pp_use']}' ";
}
if($w == '') {
$pp_id = get_uniqid();
$sql = " insert into {$g4['shop_personalpay_table']}
set pp_id = '$pp_id',
$sql_common ,
pp_ip = '{$_SERVER['REMOTE_ADDR']}',
pp_time = '".G4_TIME_YMDHIS."' ";
sql_query($sql);
} else if($w == 'u') {
$sql = " select pp_id from {$g4['shop_personalpay_table']} where pp_id = '{$_POST['pp_id']}' ";
$row = sql_fetch($sql);
if(!$row['pp_id'])
alert('수정하시려는 자료가 존재하지 않습니다.');
$sql = " update {$g4['shop_personalpay_table']}
set $sql_common
where pp_id = '{$_POST['pp_id']}' ";
sql_query($sql);
}
if($popup == 'yes')
alert_close('개인결제가 추가됐습니다.');
else
goto_url('./personalpayform.php?w=u&amp;pp_id='.$pp_id.'&amp;'.$qstr);
?>

View File

@ -0,0 +1,190 @@
<?php
$sub_menu = '400440';
include_once('./_common.php');
auth_check($auth[$sub_menu], "r");
$token = get_token();
$sql_common = " from {$g4['shop_personalpay_table']} ";
$sql_search = " where (1) ";
if ($stx) {
$sql_search .= " and ( ";
switch ($sfl) {
case 'pp_id' :
$sql_search .= " ({$sfl} = '{$stx}') ";
break;
case 'od_id' :
$sql_search .= " ({$sfl} = '{$stx}') ";
break;
default :
$sql_search .= " ({$sfl} like '%{$stx}%') ";
break;
}
$sql_search .= " ) ";
}
if (!$sst) {
$sst = "pp_id";
$sod = "desc";
}
$sql_order = " order by {$sst} {$sod} ";
$sql = " select count(*) as cnt
{$sql_common}
{$sql_search}
{$sql_order} ";
$row = sql_fetch($sql);
$total_count = $row['cnt'];
$rows = $config['cf_page_rows'];
$total_page = ceil($total_count / $rows); // 전체 페이지 계산
if ($page == '') $page = 1; // 페이지가 없으면 첫 페이지 (1 페이지)
$from_record = ($page - 1) * $rows; // 시작 열을 구함
$sql = " select *
{$sql_common}
{$sql_search}
{$sql_order}
limit {$from_record}, {$rows} ";
$result = sql_query($sql);
$g4['title'] = '개인결제 관리';
include_once (G4_ADMIN_PATH.'/admin.head.php');
$colspan = 8;
?>
<form name="fsearch" id="fsearch" method="get">
<fieldset>
<legend>개인결제 검색</legend>
<span>
<?php echo $listall ?>
전체 <?php echo number_format($total_count) ?> 건
</span>
<select name="sfl" title="검색대상">
<option value="pp_id"<?php echo get_selected($_GET['sfl'], "pp_id"); ?>>개인결제번호</option>
<option value="pp_name"<?php echo get_selected($_GET['sfl'], "pp_name"); ?>>이름</option>
<option value="od_id"<?php echo get_selected($_GET['sfl'], "od_id"); ?>>주문번호</option>
</select>
<label for="stx" class="sound_only">검색어<strong class="sound_only"> 필수</strong></label>
<input type="text" name="stx" value="<?php echo $stx ?>" id="stx" required class="required frm_input">
<input type="submit" class="btn_submit" value="검색">
</fieldset>
</form>
<section id="spp_list" class="cbox">
<h2>개인결제 내역</h2>
<div class="btn_add sort_with">
<a href="./personalpayform.php" id="personalpay_add">개인결제 추가</a>
</div>
<ul class="sort_odr">
<li><?php echo subject_sort_link('pp_id') ?>개인결제번호<span class="sound_only"> 순 정렬</span></a></li>
<li><?php echo subject_sort_link('od_id') ?>주문번호<span class="sound_only"> 순 정렬</span></a></li>
<li><?php echo subject_sort_link('pp_receipt_time') ?>입금일<span class="sound_only"> 순 정렬</span></a></li>
</ul>
<form name="fpersonalpaylist" id="fpersonalpaylist" method="post" action="./personalpaylistdelete.php" onsubmit="return fpersonalpaylist_submit(this);">
<input type="hidden" name="sst" value="<?php echo $sst; ?>">
<input type="hidden" name="sod" value="<?php echo $sod; ?>">
<input type="hidden" name="sfl" value="<?php echo $sfl; ?>">
<input type="hidden" name="stx" value="<?php echo $stx; ?>">
<input type="hidden" name="page" value="<?php echo $page; ?>">
<input type="hidden" name="token" value="<?php echo $token; ?>">
<table class="tbl_pt_list">
<thead>
<tr>
<th scope="col">
<label for="chkall" class="sound_only">개인결제 전체</label>
<input type="checkbox" name="chkall" value="1" id="chkall" onclick="check_all(this.form)">
</th>
<th scope="col">이름</th>
<th scope="col">주문번호</th>
<th scope="col">주문금액</th>
<th scope="col">입금금액</th>
<th scope="col">미수금액</th>
<th scope="col">입금방법</a></th>
<th scope="col">입금일</a></th>
<th scope="col">사용</th>
<th scope="col">관리</th>
</tr>
</thead>
<tbody>
<?php
for ($i=0; $row=sql_fetch_array($result); $i++) {
if($row['od_id'])
$od_id = '<a href="./orderform.php?od_id='.$row['od_id'].'" target="_blank">'.$row['od_id'].'</a>';
else
$od_id = '&nbsp;';
?>
<tr>
<td class="td_chk">
<input type="hidden" id="pp_id_<?php echo $i; ?>" name="pp_id[<?php echo $i; ?>]" value="<?php echo $row['pp_id']; ?>">
<input type="checkbox" id="chk_<?php echo $i; ?>" name="chk[]" value="<?php echo $i; ?>" title="내역선택">
</td>
<td class="spp_list_name"><?php echo $row['pp_name']; ?></td>
<td class="spp_list_id"><?php echo $od_id; ?></td>
<td><?php echo number_format($row['pp_amount']); ?></td>
<td class="td_name"><?php echo number_format($row['pp_receipt_amount']); ?></td>
<td class="td_name"><?php echo number_format($row['pp_amount'] - $row['pp_receipt_amount']); ?></td>
<td class="td_time"><?php echo $row['pp_settle_case']; ?></td>
<td><?php echo is_null_time($row['pp_receipt_time']) ? '' : substr($row['pp_receipt_time'], 2, 8); ?></td>
<td class="td_boolean"><?php echo $row['pp_use'] ? '예' : '아니오'; ?></td>
<td class="td_smallmng">
<a href="./personalpayform.php?w=u&amp;pp_id=<?php echo $row['pp_id']; ?>&amp;<?php echo $qstr; ?>"><span class="sound_only"><?php echo $row['pp_id']; ?> </span>수정</a>
<a href="./personalpaycopy.php?pp_id=<?php echo $row['pp_id']; ?>" class="personalpaycopy"><span class="sound_only"><?php echo $row['pp_id']; ?> </span>복사</a>
</td>
</tr>
<?php
}
if ($i == 0)
echo '<tr><td colspan="'.$colspan.'" class="empty_table">자료가 없습니다.</td></tr>';
?>
</tbody>
</table>
<div class="btn_list">
<input type="submit" name="act_button" value="선택삭제" onclick="document.pressed=this.value">
</div>
</form>
</section>
<?php echo get_paging(G4_IS_MOBILE ? $config['cf_mobile_pages'] : $config['cf_write_pages'], $page, $total_page, "{$_SERVER['PHP_SELF']}?$qstr&amp;page="); ?>
<script>
$(function() {
$(".personalpaycopy").on("click", function() {
var href = this.href;
window.open(href, "copywin", "left=100, top=100, width=600, height=300, scrollbars=0");
return false;
});
});
function fpersonalpaylist_submit(f)
{
if (!is_checked("chk[]")) {
alert(document.pressed+" 하실 항목을 하나 이상 선택하세요.");
return false;
}
if(document.pressed == "선택삭제") {
if(!confirm("선택한 자료를 정말 삭제하시겠습니까?")) {
return false;
}
}
return true;
}
</script>
<?php
include_once (G4_ADMIN_PATH.'/admin.tail.php');
?>

View File

@ -0,0 +1,25 @@
<?php
$sub_menu = '400440';
include_once('./_common.php');
check_demo();
auth_check($auth[$sub_menu], 'd');
check_token();
$count = count($_POST['chk']);
if(!$count)
alert('선택삭제 하실 항목을 하나이상 선택해 주세요.');
for ($i=0; $i<$count; $i++)
{
// 실제 번호를 넘김
$k = $_POST['chk'][$i];
$sql = " delete from {$g4['shop_personalpay_table']} where pp_id = '{$_POST['pp_id'][$k]}' ";
sql_query($sql);
}
goto_url('./personalpaylist.php');
?>