#250 복합과세 부분취소 기능 추가
This commit is contained in:
@ -99,14 +99,14 @@ $row = sql_fetch($sql);
|
||||
$total_order = $row['sum_order'];
|
||||
|
||||
// 상품목록
|
||||
$sql = " select a.it_id,
|
||||
a.it_name,
|
||||
a.cp_amount,
|
||||
b.it_notax
|
||||
from {$g4['shop_cart_table']} a left join {$g4['shop_item_table']} b on ( a.it_id = b.it_id )
|
||||
where a.uq_id = '{$od['uq_id']}'
|
||||
and a.ct_num = '0'
|
||||
order by a.ct_id ";
|
||||
$sql = " select it_id,
|
||||
it_name,
|
||||
cp_amount,
|
||||
ct_notax
|
||||
from {$g4['shop_cart_table']}
|
||||
where uq_id = '{$od['uq_id']}'
|
||||
and ct_num = '0'
|
||||
order by ct_id ";
|
||||
$result = sql_query($sql);
|
||||
|
||||
$pg_anchor = '<ul class="anchor">
|
||||
@ -153,7 +153,7 @@ $pg_anchor = '<ul class="anchor">
|
||||
<li>
|
||||
<p>
|
||||
<a href="./itemform.php?w=u&it_id=<?php echo $row['it_id']; ?>"><?php echo $image; ?> <?php echo stripslashes($row['it_name']); ?></a>
|
||||
<?php if($default['de_tax_flag_use'] && $row['it_notax']) echo '[비과세상품]'; ?>
|
||||
<?php if($default['de_tax_flag_use'] && $row['ct_notax']) echo '[비과세상품]'; ?>
|
||||
</p>
|
||||
|
||||
<table>
|
||||
@ -338,7 +338,7 @@ $pg_anchor = '<ul class="anchor">
|
||||
</tr>
|
||||
<?php if($od['od_settle_case'] == '계좌이체') { ?>
|
||||
<tr>
|
||||
<th scope="row" class="sodr_sppay">결제 취소금액</th>
|
||||
<th scope="row">결제 취소금액</th>
|
||||
<td><?php echo display_price($od['od_cancel_card']); ?></td>
|
||||
</tr>
|
||||
<?php } ?>
|
||||
@ -525,10 +525,9 @@ $pg_anchor = '<ul class="anchor">
|
||||
</tr>
|
||||
<?php if($od['od_settle_case'] == '계좌이체') { ?>
|
||||
<tr>
|
||||
<th scope="row" class="sodr_sppay"><label for="od_cancel_card">결제 취소금액</label></th>
|
||||
<th scope="row"><label for="od_cancel_card">결제 취소금액</label></th>
|
||||
<td>
|
||||
<input type="text" name="od_cancel_card" value="<?php echo $od['od_cancel_card']; ?>" class="frm_input" size="10"> 원
|
||||
<a href="./partcancel.php?od_id=<?php echo $od['od_id']; ?>" target="_blank" id="win_partcancel">결제부분취소</a>
|
||||
</td>
|
||||
</tr>
|
||||
<?php } ?>
|
||||
@ -598,7 +597,6 @@ $pg_anchor = '<ul class="anchor">
|
||||
<th scope="row" class="sodr_sppay"><label for="od_cancel_card">카드 승인취소</label></th>
|
||||
<td>
|
||||
<input type="text" name="od_cancel_card" value="<?php echo $od['od_cancel_card']; ?>" class="frm_input" size="10"> 원
|
||||
<a href="./partcancel.php?od_id=<?php echo $od['od_id']; ?>" target="_blank" id="win_partcancel">결제부분취소</a>
|
||||
</td>
|
||||
</tr>
|
||||
<?php } ?>
|
||||
@ -667,6 +665,9 @@ $pg_anchor = '<ul class="anchor">
|
||||
</section>
|
||||
|
||||
<div class="btn_confirm">
|
||||
<?php if($od['od_settle_case'] == '계좌이체' || $od['od_settle_case'] == '신용카드') { ?>
|
||||
<a href="./partcancel.php?od_id=<?php echo $od['od_id']; ?>" target="_blank" id="win_partcancel">결제금액 부분취소</a>
|
||||
<?php } ?>
|
||||
<input type="submit" value="결제/배송내역 수정" class="btn_submit">
|
||||
</div>
|
||||
</form>
|
||||
|
||||
@ -7,7 +7,7 @@ auth_check($auth[$sub_menu], "w");
|
||||
$g4['title'] = $settle_method.' 부분취소 요청';
|
||||
include_once(G4_PATH.'/head.sub.php');
|
||||
|
||||
$sql = " select od_id, od_settle_case, od_receipt_amount, od_cancel_card, od_tno, od_time
|
||||
$sql = " select *
|
||||
from {$g4['shop_order_table']}
|
||||
where od_id = '{$_GET['od_id']}' ";
|
||||
$od = sql_fetch($sql);
|
||||
@ -26,10 +26,44 @@ if($od['od_settle_case'] == '계좌이체')
|
||||
$mod_type = 'STPA';
|
||||
|
||||
$available_cancel = $od['od_receipt_amount'] - $od['od_cancel_card'];
|
||||
|
||||
// 복합과세 사용시 각각 취소가능 금액
|
||||
if($default['de_tax_flag_use']) {
|
||||
$sql = " select ct_price, io_price, io_type, ct_qty, ct_notax, cp_amount
|
||||
from {$g4['shop_cart_table']}
|
||||
where uq_id = '{$od['uq_id']}'
|
||||
and ct_status IN ( '주문', '준비', '배송', '완료' ) ";
|
||||
$result = sql_query($sql);
|
||||
|
||||
$tot_tax_mny = 0;
|
||||
$tot_free_mny = 0;
|
||||
|
||||
for($i=0; $row=sql_fetch_array($result); $i++) {
|
||||
if($row['ct_notax']) {
|
||||
if($row['io_type']) {
|
||||
$tot_free += ($row['io_priece'] * $row['ct_qty']);
|
||||
} else {
|
||||
$tot_free += (($row['ct_price'] + $row['io_price']) * $row['ct_qty']);
|
||||
}
|
||||
|
||||
$tot_free -= $row['cp_amount'];
|
||||
} else {
|
||||
if($row['io_type']) {
|
||||
$tot_tax += ($row['io_priece'] * $row['ct_qty']);
|
||||
} else {
|
||||
$tot_tax += (($row['ct_price'] + $row['io_price']) * $row['ct_qty']);
|
||||
}
|
||||
|
||||
$tot_tax -= $row['cp_amount'];
|
||||
}
|
||||
}
|
||||
|
||||
//$tot_tax -= ($od['od_send_cost'] + $od['od_send_cost2'] - $od['od_coupon'] - $od['od_send_coupon'] - $od['od_receipt_point']);
|
||||
}
|
||||
?>
|
||||
|
||||
<div>
|
||||
<form name="fcardpartcancel" method="post" action="./partcancelupdate.php">
|
||||
<form name="fcardpartcancel" method="post" action="./partcancelupdate.php" onsubmit="return form_check(this);">
|
||||
<input type="hidden" name="od_id" value="<?php echo $od['od_id']; ?>">
|
||||
<input type="hidden" name="req_tx" value="mod">
|
||||
<input type="hidden" name="tno" value="<?php echo $od['od_tno']; ?>">
|
||||
@ -38,6 +72,20 @@ $available_cancel = $od['od_receipt_amount'] - $od['od_cancel_card'];
|
||||
<p>
|
||||
<?php echo $g4['title']; ?>
|
||||
</p>
|
||||
<?php if($default['de_tax_flag_use']) { ?>
|
||||
<p>
|
||||
과세 취소가능금액 : <?php echo number_format($tot_tax); ?> 원<br>
|
||||
비과세 취소가능금액 : <?php echo number_format($tot_free); ?> 원
|
||||
</p>
|
||||
<p>
|
||||
<label for="tax_mny">과세 취소요청금액</label>
|
||||
<input type="text" name="tax_mny" id="tax_mny" size="20"> 원
|
||||
</p>
|
||||
<p>
|
||||
<label for="mod_free_mny">비과세 취소요청금액</label>
|
||||
<input type="text" name="mod_free_mny" id="mod_free_mny" size="20"> 원
|
||||
</p>
|
||||
<?php } else { ?>
|
||||
<p>
|
||||
취소가능금액 : <?php echo number_format($available_cancel); ?> 원
|
||||
</p>
|
||||
@ -45,6 +93,7 @@ $available_cancel = $od['od_receipt_amount'] - $od['od_cancel_card'];
|
||||
<label for="mod_mny">취소요청금액</label>
|
||||
<input type="text" name="mod_mny" id="mod_mny" size="20" required class="required"> 원
|
||||
</p>
|
||||
<?php } ?>
|
||||
<p>
|
||||
<label for="mod_desc">취소요청사유</label>
|
||||
<input type="text" name="mod_desc" id="mod_desc" size="50" required class="required">
|
||||
@ -56,6 +105,23 @@ $available_cancel = $od['od_receipt_amount'] - $od['od_cancel_card'];
|
||||
</form>
|
||||
</div>
|
||||
|
||||
<script>
|
||||
function form_check(f)
|
||||
{
|
||||
<?php if($default['de_tax_flag_use']) { ?>
|
||||
var tax_mny = f.tax_mny.value;
|
||||
var free_mny = f.mod_free_mny.value;
|
||||
|
||||
if(tax_mny == "" && free_mny == "") {
|
||||
alert("과세 또는 비과세 취소요청금액을입력해 주십시오.");
|
||||
return false;
|
||||
}
|
||||
<?php } ?>
|
||||
|
||||
return true;
|
||||
}
|
||||
</script>
|
||||
|
||||
<?php
|
||||
include_once(G4_PATH.'/tail.sub.php');
|
||||
?>
|
||||
@ -21,9 +21,12 @@ if($od['od_settle_case'] != '신용카드' && $od['od_settle_case'] != '계좌
|
||||
if($od['od_settle_case'] == '계좌이체' && substr(0, 10, $od['od_time']) == G4_TIME_YMD)
|
||||
alert('실시간 계좌이체건의 부분취소 요청은 결제일 익일에 가능합니다.');
|
||||
|
||||
if($_POST['mod_type'] != 'RN07' && $_POST['mod_type'] != 'STPA')
|
||||
alert('취소요청 구분이 올바르지 않습니다.mod_type 값을 확인해 주십시오.');
|
||||
|
||||
// 취소사유의 한글깨짐 방지처리
|
||||
$def_locale = setlocale(LC_CTYPE, 0);
|
||||
$_POST['mod_desc'] = iconv("utf-8", "euc-kr", $_POST['mod_desc']);
|
||||
$_POST = array_map('iconv_euckr', $_POST);
|
||||
$locale_change = false;
|
||||
if(preg_match("/utf[\-]?8/i", $def_locale)) {
|
||||
setlocale(LC_CTYPE, 'ko_KR.euc-kr');
|
||||
@ -47,7 +50,8 @@ else {
|
||||
$default['de_kcp_mid'] = "SR".$default['de_kcp_mid'];
|
||||
}
|
||||
|
||||
$g_conf_site_cd = $default['de_kcp_mid'];
|
||||
$g_conf_site_cd = $default['de_kcp_mid'];
|
||||
$g_conf_site_key = $default['de_kcp_site_key'];
|
||||
$g_conf_home_dir = G4_SHOP_PATH.'/kcp';
|
||||
$g_conf_key_dir = '';
|
||||
$g_conf_log_dir = '';
|
||||
@ -70,38 +74,55 @@ else {
|
||||
$g_conf_log_level = "3";
|
||||
$g_conf_gw_port = "8090";
|
||||
|
||||
include_once(G4_SHOP_PATH.'/kcp/pp_ax_hub_lib.php');
|
||||
include G4_SHOP_PATH.'/kcp/pp_cli_hub_lib.php';
|
||||
|
||||
$tno = $_POST['tno'];
|
||||
$req_tx = $_POST['req_tx'];
|
||||
$mod_type = $_POST['mod_type'];
|
||||
$mod_desc = $_POST['mod_desc'];
|
||||
$cust_ip = getenv("REMOTE_ADDR");
|
||||
$cust_ip = getenv('REMOTE_ADDR');
|
||||
$rem_mny = $_POST['rem_mny'];
|
||||
$mod_mny = $_POST['mod_mny'];
|
||||
$tax_mny = $_POST['tax_mny'];
|
||||
$mod_free_mny = $_POST['mod_free_mny'];
|
||||
|
||||
$c_PayPlus = new C_PP_CLI;
|
||||
if($default['de_tax_flag_use']) {
|
||||
$mod_mny = strval($tax_mny + $mod_free_mny);
|
||||
}
|
||||
|
||||
$c_PayPlus = new C_PAYPLUS_CLI;
|
||||
$c_PayPlus->mf_clear();
|
||||
|
||||
if ( $req_tx == "mod" )
|
||||
{
|
||||
$tran_cd = "00200000";
|
||||
|
||||
$c_PayPlus->mf_set_modx_data( "tno", $tno ); // KCP 원거래 거래번호
|
||||
$c_PayPlus->mf_set_modx_data( "mod_type", $mod_type ); // 원거래 변경 요청 종류
|
||||
$c_PayPlus->mf_set_modx_data( "mod_ip", $cust_ip ); // 변경 요청자 IP
|
||||
$c_PayPlus->mf_set_modx_data( "mod_desc", $mod_desc ); // 변경 사유
|
||||
$c_PayPlus->mf_set_modx_data( "tno" , $tno ); // KCP 원거래 거래번호
|
||||
$c_PayPlus->mf_set_modx_data( "mod_type" , $mod_type ); // 원거래 변경 요청 종류
|
||||
$c_PayPlus->mf_set_modx_data( "mod_ip" , $cust_ip ); // 변경 요청자 IP
|
||||
$c_PayPlus->mf_set_modx_data( "mod_desc" , $mod_desc ); // 변경 사유
|
||||
$c_PayPlus->mf_set_modx_data( "rem_mny" , $rem_mny ); // 취소 가능 잔액
|
||||
$c_PayPlus->mf_set_modx_data( "mod_mny" , $mod_mny ); // 취소 요청 금액
|
||||
|
||||
if ( $mod_type == "RN07" || $mod_type == "STPA" ) // 부분취소의 경우
|
||||
if($default['de_tax_flag_use'])
|
||||
{
|
||||
$c_PayPlus->mf_set_modx_data( "mod_mny", $_POST[ "mod_mny" ] ); // 취소요청금액
|
||||
$c_PayPlus->mf_set_modx_data( "rem_mny", $_POST[ "rem_mny" ] ); // 취소가능잔액
|
||||
$mod_tax_mny = round((int)$tax_mny / 1.1);
|
||||
$mod_vat_mny = (int)$tax_mny - $mod_tax_mny;
|
||||
|
||||
$c_PayPlus->mf_set_modx_data( "tax_flag" , "TG03" ); // 복합과세 구분
|
||||
$c_PayPlus->mf_set_modx_data( "mod_tax_mny" , strval($mod_tax_mny) ); // 공급가 부분 취소 요청 금액
|
||||
$c_PayPlus->mf_set_modx_data( "mod_vat_mny" , strval($mod_vat_mny) ); // 부과세 부분 취소 요청 금액
|
||||
$c_PayPlus->mf_set_modx_data( "mod_free_mny" , $mod_free_mny ); // 비관세 부분 취소 요청 금액
|
||||
}
|
||||
}
|
||||
|
||||
if ( $tran_cd != "" )
|
||||
{
|
||||
$c_PayPlus->mf_do_tx( $trace_no, $g_conf_home_dir, $g_conf_site_cd, "", $tran_cd, "",
|
||||
$g_conf_gw_url, $g_conf_gw_port, "payplus_cli_slib", $ordr_idxx,
|
||||
$cust_ip, "3" , 0, 0, $g_conf_key_dir, $g_conf_log_dir); // 응답 전문 처리
|
||||
$c_PayPlus->mf_do_tx( "", $g_conf_home_dir, $g_conf_site_cd,
|
||||
$g_conf_site_key, $tran_cd, "",
|
||||
$g_conf_gw_url, $g_conf_gw_port, "payplus_cli_slib",
|
||||
$ordr_idxx, $cust_ip, $g_conf_log_level,
|
||||
"", 0 );
|
||||
|
||||
$res_cd = $c_PayPlus->m_res_cd; // 결과 코드
|
||||
$res_msg = $c_PayPlus->m_res_msg; // 결과 메시지
|
||||
@ -128,21 +149,14 @@ if ( $req_tx == "mod" )
|
||||
if ( $res_cd == "0000" )
|
||||
{
|
||||
$tno = $c_PayPlus->mf_get_res_data( "tno" ); // KCP 거래 고유 번호
|
||||
$amount = $c_PayPlus->mf_get_res_data( "amount" ); // 원 거래금액
|
||||
$mod_mny = $c_PayPlus->mf_get_res_data( "panc_mod_mny" ); // 취소요청된 금액
|
||||
$rem_mny = $c_PayPlus->mf_get_res_data( "panc_rem_mny" ); // 취소요청후 잔액
|
||||
|
||||
/* = -------------------------------------------------------------------------- = */
|
||||
/* = 부분취소 결과 처리 = */
|
||||
/* = -------------------------------------------------------------------------- = */
|
||||
if ( $mod_type == "RN07" || $mod_type == "STPA" ) // 부분취소의 경우
|
||||
{
|
||||
$amount = $c_PayPlus->mf_get_res_data( "amount" ); // 원 거래금액
|
||||
$mod_mny = $c_PayPlus->mf_get_res_data( "panc_mod_mny" ); // 취소요청된 금액
|
||||
$rem_mny = $c_PayPlus->mf_get_res_data( "panc_rem_mny" ); // 취소요청후 잔액
|
||||
|
||||
$sql = " update {$g4['shop_order_table']}
|
||||
set od_cancel_card = od_cancel_card + '$mod_mny'
|
||||
where od_id = '{$od['od_id']}' ";
|
||||
sql_query($sql);
|
||||
}
|
||||
$sql = " update {$g4['shop_order_table']}
|
||||
set od_cancel_card = od_cancel_card + '$mod_mny'
|
||||
where od_id = '{$od['od_id']}' ";
|
||||
sql_query($sql);
|
||||
} // End of [res_cd = "0000"]
|
||||
|
||||
/* = -------------------------------------------------------------------------- = */
|
||||
|
||||
Reference in New Issue
Block a user