#235 주문폼에서 복합과세 계산을 한번만 하도록 수정

This commit is contained in:
chicpro
2013-06-19 10:36:17 +09:00
parent 9fe87eb5ce
commit f7be300e7f
2 changed files with 20 additions and 62 deletions

View File

@ -84,6 +84,11 @@ ob_start();
$good_info = ''; $good_info = '';
$it_send_cost = 0; $it_send_cost = 0;
$comm_tax_mny = 0; // 과세금액
$comm_vat_mny = 0; // 부가세
$comm_free_mny = 0; // 면세금액
$tot_tax_mny = 0;
for ($i=0; $row=mysql_fetch_array($result); $i++) for ($i=0; $row=mysql_fetch_array($result); $i++)
{ {
// 합계금액 계산 // 합계금액 계산
@ -130,18 +135,12 @@ ob_start();
$it_send_cost += get_item_sendcost($row['it_id'], $sum['price'], $sum['qty']); $it_send_cost += get_item_sendcost($row['it_id'], $sum['price'], $sum['qty']);
} }
// 복합과세금액 계산 // 복합과세금액
if($default['de_tax_flag_use']) { if($default['de_tax_flag_use']) {
$tax_mny = $vat_mnt = $free_mny = 0;
if($row['it_notax']) { if($row['it_notax']) {
$free_mny = $sum['price']; $comm_free_mny += $sum['price'];
$comm_free_mny += $free_mny;
} else { } else {
$tax_mny = round((int)$sum['price'] / 1.1); $tot_tax_mny += $sum['price'];
$vat_mny = (int)$sum['price'] - $tax_mny;
$comm_tax_mny += $tax_mny;
$comm_vat_mny += $vat_mny;
} }
} }
@ -220,13 +219,10 @@ ob_start();
} }
} }
// 배송비 복합과세처리 // 복합과세처리
if($default['de_tax_flag_use'] && $send_cost > 0) { if($default['de_tax_flag_use']) {
$send_tax = round((int)$send_cost / 1.1); $comm_tax_mny = round(($tot_tax_mny + $send_cost) / 1.1);
$send_vat = (int)$send_cost - $send_tax; $comm_vat_mnt = ($tot_tax_mny + $send_cost) - $comm_tax_mny;
$comm_tax_mny += $send_tax;
$comm_vat_mny += $send_vat;
} }
?> ?>
</tbody> </tbody>
@ -1023,14 +1019,6 @@ function calculate_total_amount()
cp_amount = parseInt($cp_amt.eq(index).val()); cp_amount = parseInt($cp_amt.eq(index).val());
sell_amount += it_amount; sell_amount += it_amount;
tot_cp_amount += cp_amount; tot_cp_amount += cp_amount;
<?php if($default['de_tax_flag_use']) { ?>
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);
}
<?php } ?>
}); });
tot_sell_amount = sell_amount - tot_cp_amount + send_cost; tot_sell_amount = sell_amount - tot_cp_amount + send_cost;
@ -1044,13 +1032,6 @@ function calculate_total_amount()
$("input[name=item_coupon]").val(tot_cp_amount); $("input[name=item_coupon]").val(tot_cp_amount);
$("input[name=od_coupon]").val(0); $("input[name=od_coupon]").val(0);
$("input[name=od_send_coupon]").val(0); $("input[name=od_send_coupon]").val(0);
<?php if($default['de_tax_flag_use']) { ?>
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);
<?php } ?>
<?php if($oc_cnt > 0) { ?> <?php if($oc_cnt > 0) { ?>
$("input[name=od_cp_id]").val(""); $("input[name=od_cp_id]").val("");
if($("#od_coupon_cancel").size()) { if($("#od_coupon_cancel").size()) {

View File

@ -162,6 +162,7 @@ setTimeout("init_pay_button();",300);
$comm_tax_mny = 0; // 과세금액 $comm_tax_mny = 0; // 과세금액
$comm_vat_mny = 0; // 부가세 $comm_vat_mny = 0; // 부가세
$comm_free_mny = 0; // 면세금액 $comm_free_mny = 0; // 면세금액
$tot_tax_mny = 0;
for ($i=0; $row=mysql_fetch_array($result); $i++) for ($i=0; $row=mysql_fetch_array($result); $i++)
{ {
@ -207,18 +208,12 @@ setTimeout("init_pay_button();",300);
$it_send_cost += get_item_sendcost($row['it_id'], $sum['price'], $sum['qty']); $it_send_cost += get_item_sendcost($row['it_id'], $sum['price'], $sum['qty']);
} }
// 복합과세금액 계산 // 복합과세금액
if($default['de_tax_flag_use']) { if($default['de_tax_flag_use']) {
$tax_mny = $vat_mnt = $free_mny = 0;
if($row['it_notax']) { if($row['it_notax']) {
$free_mny = $sum['price']; $comm_free_mny += $sum['price'];
$comm_free_mny += $free_mny;
} else { } else {
$tax_mny = round((int)$sum['price'] / 1.1); $tot_tax_mny += $sum['price'];
$vat_mny = (int)$sum['price'] - $tax_mny;
$comm_tax_mny += $tax_mny;
$comm_vat_mny += $vat_mny;
} }
} }
@ -297,13 +292,10 @@ setTimeout("init_pay_button();",300);
} }
} }
// 배송비 복합과세처리 // 복합과세처리
if($default['de_tax_flag_use'] && $send_cost > 0) { if($default['de_tax_flag_use']) {
$send_tax = round((int)$send_cost / 1.1); $comm_tax_mny = round(($tot_tax_mny + $send_cost) / 1.1);
$send_vat = (int)$send_cost - $send_tax; $comm_vat_mnt = ($tot_tax_mny + $send_cost) - $comm_tax_mny;
$comm_tax_mny += $send_tax;
$comm_vat_mny += $send_vat;
} }
?> ?>
</tbody> </tbody>
@ -1222,14 +1214,6 @@ function calculate_total_amount()
cp_amount = parseInt($cp_amt.eq(index).val()); cp_amount = parseInt($cp_amt.eq(index).val());
sell_amount += it_amount; sell_amount += it_amount;
tot_cp_amount += cp_amount; tot_cp_amount += cp_amount;
<?php if($default['de_tax_flag_use']) { ?>
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);
}
<?php } ?>
}); });
tot_sell_amount = sell_amount - tot_cp_amount + send_cost; tot_sell_amount = sell_amount - tot_cp_amount + send_cost;
@ -1243,13 +1227,6 @@ function calculate_total_amount()
$("input[name=item_coupon]").val(tot_cp_amount); $("input[name=item_coupon]").val(tot_cp_amount);
$("input[name=od_coupon]").val(0); $("input[name=od_coupon]").val(0);
$("input[name=od_send_coupon]").val(0); $("input[name=od_send_coupon]").val(0);
<?php if($default['de_tax_flag_use']) { ?>
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);
<?php } ?>
<?php if($oc_cnt > 0) { ?> <?php if($oc_cnt > 0) { ?>
$("input[name=od_cp_id]").val(""); $("input[name=od_cp_id]").val("");
if($("#od_coupon_cancel").size()) { if($("#od_coupon_cancel").size()) {