From 3843021d1ed31537ec5ed5668115f8fc03403cf6 Mon Sep 17 00:00:00 2001 From: chicpro Date: Tue, 18 Jun 2013 18:20:36 +0900 Subject: [PATCH] =?UTF-8?q?#235=20=EB=B3=B5=ED=95=A9=EA=B3=BC=EC=84=B8=20?= =?UTF-8?q?=EA=B2=B0=EC=A0=9C=20=EA=B8=B0=EB=8A=A5=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- mobile/shop/kcp/order_approval_form.php | 25 ++++ mobile/shop/orderform.php | 148 ++++++++++++++++++++++-- mobile/shop/orderformupdate.php | 6 + shop/orderform.php | 143 ++++++++++++++++++++++- shop/orderformupdate.php | 32 +++++ 5 files changed, 342 insertions(+), 12 deletions(-) diff --git a/mobile/shop/kcp/order_approval_form.php b/mobile/shop/kcp/order_approval_form.php index dd05714ae..864c07aa2 100644 --- a/mobile/shop/kcp/order_approval_form.php +++ b/mobile/shop/kcp/order_approval_form.php @@ -58,6 +58,10 @@ $bask_cntx = $_POST[ "bask_cntx" ]; // 장바구니 상품수 $tablet_size = $_POST[ "tablet_size" ]; // 모바일기기 화면비율 + $comm_tax_mny = $_POST[ "comm_tax_mny" ]; // 과세금액 + $comm_vat_mny = $_POST[ "comm_vat_mny" ]; // 부가세 + $comm_free_mny = $_POST["comm_free_mny" ]; // 비과세금액 + /* * 기타 파라메터 추가 부분 - Start - */ @@ -203,6 +207,7 @@ od.getElementById("show_progress").style.display = "block"; od.getElementById("show_pay_btn").style.display = "inline"; + alert("주문하기를 클릭하셔야 주문이 완료됩니다."); window.close(); } else { kcp_AJAX(); @@ -299,6 +304,26 @@ */ --> + + + + + + + diff --git a/mobile/shop/orderform.php b/mobile/shop/orderform.php index 9e06583df..f97723fb9 100644 --- a/mobile/shop/orderform.php +++ b/mobile/shop/orderform.php @@ -66,7 +66,10 @@ ob_start(); a.ct_qty, a.ct_status, a.ct_send_cost, - b.ca_id + b.ca_id, + b.ca_id2, + b.ca_id3, + 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 = '$s_uq_id' and a.ct_select = '1' @@ -127,6 +130,21 @@ ob_start(); $it_send_cost += get_item_sendcost($row['it_id'], $sum['price'], $sum['qty']); } + // 복합과세금액 계산 + if($default['de_tax_flag_use']) { + $tax_mny = $vat_mnt = $free_mny = 0; + if($row['it_notax']) { + $free_mny = $sum['price']; + $comm_free_mny += $free_mny; + } else { + $tax_mny = round((int)$sum['price'] / 1.1); + $vat_mny = (int)$sum['price'] - $tax_mny; + + $comm_tax_mny += $tax_mny; + $comm_vat_mny += $vat_mny; + } + } + $point = $sum['point']; $sell_amount = $sum['price']; @@ -161,6 +179,9 @@ ob_start(); + + + @@ -198,6 +219,15 @@ ob_start(); $send_cost = $it_send_cost; } } + + // 배송비 복합과세처리 + if($default['de_tax_flag_use'] && $send_cost > 0) { + $send_tax = round((int)$send_cost / 1.1); + $send_vat = (int)$send_cost - $send_tax; + + $comm_tax_mny += $send_tax; + $comm_vat_mny += $send_vat; + } ?> @@ -285,6 +315,29 @@ ob_end_clean(); BC 2,3,6개월, 국민 3,6개월, 삼성 6,9개월 무이자 : CCBC-02:03:06,CCKM-03:06,CCSS-03:06:04 */ --> + + + + + + @@ -296,6 +349,8 @@ ob_end_clean(); + + @@ -765,6 +820,10 @@ $(function() { var $s_el = $cp_row_el.find(".ct_sell_amount");; sell_amount = parseInt($cp_row_el.find("input[name^=it_amount]").val()); sell_amount = sell_amount - parseInt(amount); + if(sell_amount < 0) { + alert("쿠폰할인금액이 상품 주문금액보다 크므로 쿠폰을 적용할 수 없습니다."); + return false; + } $s_el.text(number_format(String(sell_amount))); $cp_row_el.find("input[name^=cp_id]").val(cp_id); $cp_row_el.find("input[name^=cp_amount]").val(amount); @@ -807,23 +866,29 @@ $(function() { var cp_id = $el.find("input[name='o_cp_id[]']").val(); var amount = parseInt($el.find("input[name='o_cp_amt[]']").val()); var subj = $el.find("input[name='o_cp_subj[]']").val(); - var od_amount = parseInt($("input[name=org_od_amount]").val()); var send_cost = $("input[name=org_send_cost]").val(); var item_coupon = parseInt($("input[name=item_coupon]").val()); + var od_amount = parseInt($("input[name=org_od_amount]").val()) - item_coupon; - if(parseInt(amount) == 0) { + if(amount == 0) { if(!confirm(subj+"쿠폰의 할인 금액은 "+amount+"원입니다.\n쿠폰을 적용하시겠습니까?")) { return false; } } + if(od_amount - amount <= 0) { + alert("쿠폰할인금액이 주문금액보다 크므로 쿠폰을 적용할 수 없습니다."); + return false; + } + $("input[name=od_send_cost]").val(send_cost); $("input[name=sc_cp_id]").val(""); $("#sc_coupon_btn").text("쿠폰적용"); $("#sc_coupon_cancel").remove(); - $("input[name=od_amount]").val(od_amount - item_coupon - amount); + $("input[name=od_amount]").val(od_amount - amount); $("input[name=od_cp_id]").val(cp_id); + $("input[name=od_coupon]").val(amount); calculate_order_amount(); $("#od_coupon_frm").remove(); $("#od_coupon_btn").text("쿠폰변경").focus(); @@ -842,6 +907,8 @@ $(function() { $("input[name=od_amount]").val(org_amount - item_coupon); $("input[name=od_send_cost]").val($("input[name=org_send_cost]").val()); $("input[name=sc_cp_id]").val(""); + $("input[name=od_coupon]").val(0); + $("input[name=od_send_coupon]").val(0); calculate_order_amount(); $("#od_coupon_frm").remove(); $("#od_coupon_btn").text("쿠폰적용").focus(); @@ -879,6 +946,7 @@ $(function() { $("input[name=od_send_cost]").val(send_cost - amount); $("input[name=sc_cp_id]").val(cp_id); + $("input[name=od_send_coupon]").val(amount); calculate_order_amount(); $("#sc_coupon_frm").remove(); $("#sc_coupon_btn").text("쿠폰변경").focus(); @@ -894,6 +962,7 @@ $(function() { $("#sc_coupon_cancel").live("click", function() { var send_cost = $("input[name=org_send_cost]").val(); $("input[name=od_send_cost]").val(send_cost); + $("input[name=od_send_coupon]").val(0); calculate_order_amount(); $("#sc_coupon_frm").remove(); $("#sc_coupon_btn").text("쿠폰적용").focus(); @@ -945,7 +1014,8 @@ function calculate_total_amount() var $it_amt = $("input[name^=it_amount]"); var $cp_amt = $("input[name^=cp_amount]"); var tot_sell_amount = sell_amount = tot_cp_amount = 0; - var it_amount, cp_amount; + var it_amount, cp_amount, it_notax; + var tot_mny = comm_tax_mny = comm_vat_mny = comm_free_mny = tax_mny = vat_mny = 0; var send_cost = parseInt($("input[name=org_send_cost]").val()); $it_amt.each(function(index) { @@ -953,6 +1023,14 @@ function calculate_total_amount() cp_amount = parseInt($cp_amt.eq(index).val()); sell_amount += it_amount; tot_cp_amount += cp_amount; + + it_notax = $("input[name^=it_notax]").eq(index).val(); + if(it_notax == "1") { + comm_free_mny += (it_amount - cp_amount); + } else { + tot_mny += (it_amount - cp_amount); + } + }); tot_sell_amount = sell_amount - tot_cp_amount + send_cost; @@ -964,6 +1042,15 @@ function calculate_total_amount() $("input[name=od_amount]").val(sell_amount - tot_cp_amount); $("input[name=od_send_cost]").val(send_cost); $("input[name=item_coupon]").val(tot_cp_amount); + $("input[name=od_coupon]").val(0); + $("input[name=od_send_coupon]").val(0); + + comm_tax_mny = Math.round((tot_mny + send_cost) / 1.1); + comm_vat_mny = (tot_mny + send_cost) - comm_tax_mny; + $("input[name=comm_tax_mny]").val(comm_tax_mny); + $("input[name=comm_vat_mny]").val(comm_vat_mny); + $("input[name=comm_free_mny]").val(comm_free_mny); + 0) { ?> $("input[name=od_cp_id]").val(""); if($("#od_coupon_cancel").size()) { @@ -992,7 +1079,7 @@ function calculate_order_amount() var send_cost2 = parseInt($("input[name=od_send_cost2]").val()); var tot_amount = sell_amount + send_cost + send_cost2; - $("form[name=sm_form] input[name=good_mny]").val(tot_amount); + $("input[name=good_mny]").val(tot_amount); $("#od_tot_amount").text(number_format(String(tot_amount))); 0 && $is_member) { ?> calculate_temp_point(); @@ -1017,7 +1104,7 @@ function calculate_temp_point() if(temp_point > point) temp_point = point; - $("#use_max_point").text(number_format(String(temp_point))+"점"); + $("#use_max_point").text("최대 "+number_format(String(temp_point))+"점"); $("input[name=max_temp_point]").val(temp_point); } @@ -1035,6 +1122,48 @@ function calculate_sendcost(code) ); } +function calculate_tax() +{ + var $it_amt = $("input[name^=it_amount]"); + var $cp_amt = $("input[name^=cp_amount]"); + var sell_amount = tot_cp_amount = 0; + var it_amount, cp_amount, it_notax; + var tot_mny = comm_free_mny = tax_mny = vat_mny = 0; + var send_cost = parseInt($("input[name=org_send_cost]").val()); + var send_cost2 = parseInt($("input[name=od_send_cost2]").val()); + var od_coupon = parseInt($("input[name=od_coupon]").val()); + var send_coupon = parseInt($("input[name=od_send_coupon]").val()); + var temp_point = 0; + + $it_amt.each(function(index) { + it_amount = parseInt($(this).val()); + cp_amount = parseInt($cp_amt.eq(index).val()); + sell_amount += it_amount; + tot_cp_amount += cp_amount; + it_notax = $("input[name^=it_notax]").eq(index).val(); + if(it_notax == "1") { + comm_free_mny += (it_amount - cp_amount); + } else { + tot_mny += (it_amount - cp_amount); + } + }); + + if($("input[name=od_temp_point]").size()) + temp_point = parseInt($("input[name=od_temp_point]").val()); + + tot_mny += (send_cost + send_cost2 - od_coupon - send_coupon - temp_point); + if(tot_mny < 0) { + comm_free_mny = comm_free_mny + tot_mny; + tot_mny = 0; + } + + tax_mny = Math.round(tot_mny / 1.1); + vat_mny = tot_mny - tax_mny; + $("input[name=comm_tax_mny]").val(tax_mny); + $("input[name=comm_vat_mny]").val(vat_mny); + $("input[name=comm_free_mny]").val(comm_free_mny); +} + /* 결제방법에 따른 처리 후 결제등록요청 실행 */ function kcp_approval() { @@ -1132,6 +1261,11 @@ function kcp_approval() f.rcvr_add2.value = pf.od_b_addr2.value; f.settle_method.value = settle_method; + + if(settle_method != "무통장") + calculate_tax(); + + var new_win = window.open("about:blank", "tar_opener", "scrollbars=yes,resizable=yes"); f.target = "tar_opener"; diff --git a/mobile/shop/orderformupdate.php b/mobile/shop/orderformupdate.php index 62a32e795..bb2a76352 100644 --- a/mobile/shop/orderformupdate.php +++ b/mobile/shop/orderformupdate.php @@ -135,6 +135,9 @@ if($is_member) { if($cp['cp_maximum'] && $dc > $cp['cp_maximum']) $dc = $cp['cp_maximum']; + if($item_price < $dc) + continue; + $tot_it_cp_amount += $dc; $arr_it_cp_amt[$it_id] = $dc; } @@ -164,6 +167,9 @@ if($is_member) { if($cp['cp_maximum'] && $dc > $cp['cp_maximum']) $dc = $cp['cp_maximum']; + if($tot_od_amount < $dc) + die('Order coupon error.'); + $tot_od_cp_amount = $dc; $tot_od_amount -= $tot_od_cp_amount; } diff --git a/shop/orderform.php b/shop/orderform.php index a60e0af83..72137de31 100644 --- a/shop/orderform.php +++ b/shop/orderform.php @@ -143,7 +143,8 @@ setTimeout("init_pay_button();",300); a.ct_send_cost, b.ca_id, b.ca_id2, - b.ca_id3 + b.ca_id3, + 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 = '$s_uq_id' and a.ct_select = '1' @@ -158,6 +159,10 @@ setTimeout("init_pay_button();",300); $good_info = ''; $it_send_cost = 0; + $comm_tax_mny = 0; // 과세금액 + $comm_vat_mny = 0; // 부가세 + $comm_free_mny = 0; // 면세금액 + for ($i=0; $row=mysql_fetch_array($result); $i++) { // 합계금액 계산 @@ -202,6 +207,21 @@ setTimeout("init_pay_button();",300); $it_send_cost += get_item_sendcost($row['it_id'], $sum['price'], $sum['qty']); } + // 복합과세금액 계산 + if($default['de_tax_flag_use']) { + $tax_mny = $vat_mnt = $free_mny = 0; + if($row['it_notax']) { + $free_mny = $sum['price']; + $comm_free_mny += $free_mny; + } else { + $tax_mny = round((int)$sum['price'] / 1.1); + $vat_mny = (int)$sum['price'] - $tax_mny; + + $comm_tax_mny += $tax_mny; + $comm_vat_mny += $vat_mny; + } + } + $point = $sum['point']; $sell_amount = $sum['price']; @@ -236,6 +256,9 @@ setTimeout("init_pay_button();",300); + + + @@ -273,6 +296,15 @@ setTimeout("init_pay_button();",300); $send_cost = $it_send_cost; } } + + // 배송비 복합과세처리 + if($default['de_tax_flag_use'] && $send_cost > 0) { + $send_tax = round((int)$send_cost / 1.1); + $send_vat = (int)$send_cost - $send_tax; + + $comm_tax_mny += $send_tax; + $comm_vat_mny += $send_vat; + } ?> @@ -301,6 +333,8 @@ setTimeout("init_pay_button();",300); + + + + + + + + + + it_notax = $("input[name^=it_notax]").eq(index).val(); + if(it_notax == "1") { + comm_free_mny += (it_amount - cp_amount); + } else { + tot_mny += (it_amount - cp_amount); + } + }); tot_sell_amount = sell_amount - tot_cp_amount + send_cost; @@ -1164,6 +1241,15 @@ function calculate_total_amount() $("input[name=od_amount]").val(sell_amount - tot_cp_amount); $("input[name=od_send_cost]").val(send_cost); $("input[name=item_coupon]").val(tot_cp_amount); + $("input[name=od_coupon]").val(0); + $("input[name=od_send_coupon]").val(0); + + comm_tax_mny = Math.round((tot_mny + send_cost) / 1.1); + comm_vat_mny = (tot_mny + send_cost) - comm_tax_mny; + $("input[name=comm_tax_mny]").val(comm_tax_mny); + $("input[name=comm_vat_mny]").val(comm_vat_mny); + $("input[name=comm_free_mny]").val(comm_free_mny); + 0) { ?> $("input[name=od_cp_id]").val(""); if($("#od_coupon_cancel").size()) { @@ -1235,6 +1321,48 @@ function calculate_sendcost(code) ); } +function calculate_tax() +{ + var $it_amt = $("input[name^=it_amount]"); + var $cp_amt = $("input[name^=cp_amount]"); + var sell_amount = tot_cp_amount = 0; + var it_amount, cp_amount, it_notax; + var tot_mny = comm_free_mny = tax_mny = vat_mny = 0; + var send_cost = parseInt($("input[name=org_send_cost]").val()); + var send_cost2 = parseInt($("input[name=od_send_cost2]").val()); + var od_coupon = parseInt($("input[name=od_coupon]").val()); + var send_coupon = parseInt($("input[name=od_send_coupon]").val()); + var temp_point = 0; + + $it_amt.each(function(index) { + it_amount = parseInt($(this).val()); + cp_amount = parseInt($cp_amt.eq(index).val()); + sell_amount += it_amount; + tot_cp_amount += cp_amount; + it_notax = $("input[name^=it_notax]").eq(index).val(); + if(it_notax == "1") { + comm_free_mny += (it_amount - cp_amount); + } else { + tot_mny += (it_amount - cp_amount); + } + }); + + if($("input[name=od_temp_point]").size()) + temp_point = parseInt($("input[name=od_temp_point]").val()); + + tot_mny += (send_cost + send_cost2 - od_coupon - send_coupon - temp_point); + if(tot_mny < 0) { + comm_free_mny = comm_free_mny + tot_mny; + tot_mny = 0; + } + + tax_mny = Math.round(tot_mny / 1.1); + vat_mny = tot_mny - tax_mny; + $("input[name=comm_tax_mny]").val(tax_mny); + $("input[name=comm_vat_mny]").val(vat_mny); + $("input[name=comm_free_mny]").val(comm_free_mny); +} + function forderform_check(f) { errmsg = ""; @@ -1393,6 +1521,11 @@ function forderform_check(f) } } + + if(settle_method != "무통장") + calculate_tax(); + + // pay_method 설정 switch(settle_method) { diff --git a/shop/orderformupdate.php b/shop/orderformupdate.php index 178e3d99b..b774c9957 100644 --- a/shop/orderformupdate.php +++ b/shop/orderformupdate.php @@ -129,6 +129,9 @@ if($is_member) { if($cp['cp_maximum'] && $dc > $cp['cp_maximum']) $dc = $cp['cp_maximum']; + if($item_price < $dc) + continue; + $tot_it_cp_amount += $dc; $arr_it_cp_amt[$it_id] = $dc; } @@ -158,6 +161,9 @@ if($is_member) { if($cp['cp_maximum'] && $dc > $cp['cp_maximum']) $dc = $cp['cp_maximum']; + if($tot_od_amount < $dc) + die('Order coupon error.'); + $tot_od_cp_amount = $dc; $tot_od_amount -= $tot_od_cp_amount; } @@ -605,3 +611,29 @@ if (get_session('ss_direct')) goto_url(G4_SHOP_URL.'/orderinquiryview.php?od_id='.$od_id.'&uq_id='.$uq_id); ?> + + + + *** KCP [AX-HUB Version] *** + + + \ No newline at end of file