조건부 무료 처리 실행코드 위치변경

This commit is contained in:
chicpro
2014-07-16 10:12:55 +09:00
parent 81aba50faf
commit 82296af20c
2 changed files with 125 additions and 102 deletions

View File

@ -60,18 +60,8 @@ $result = sql_query($sql);
$res = sql_query($sql); $res = sql_query($sql);
$rowspan = mysql_num_rows($res); $rowspan = mysql_num_rows($res);
for($k=0; $opt=sql_fetch_array($res); $k++) {
if($opt['io_type'])
$opt_price = $opt['io_price'];
else
$opt_price = $opt['ct_price'] + $opt['io_price'];
// 소계
$ct_price['stotal'] = $opt_price * $opt['ct_qty'];
$ct_point['stotal'] = $opt['ct_point'] * $opt['ct_qty'];
// 배송비 // 배송비
switch($opt['ct_send_cost']) switch($row['ct_send_cost'])
{ {
case 1: case 1:
$ct_send_cost = '착불'; $ct_send_cost = '착불';
@ -90,7 +80,19 @@ $result = sql_query($sql);
if($sendcost == 0) if($sendcost == 0)
$ct_send_cost = '무료'; $ct_send_cost = '무료';
$save_it_id = $row['it_id'];
} }
for($k=0; $opt=sql_fetch_array($res); $k++) {
if($opt['io_type'])
$opt_price = $opt['io_price'];
else
$opt_price = $opt['ct_price'] + $opt['io_price'];
// 소계
$ct_price['stotal'] = $opt_price * $opt['ct_qty'];
$ct_point['stotal'] = $opt['ct_point'] * $opt['ct_qty'];
?> ?>
<tr> <tr>
<?php if($k == 0) { ?> <?php if($k == 0) { ?>

View File

@ -63,10 +63,13 @@ if ($csv == 'csv')
header('Pragma: public'); header('Pragma: public');
//echo "우편번호,주소,이름,전화1,전화2,상품명,수량,비고,전하실말씀\n"; //echo "우편번호,주소,이름,전화1,전화2,상품명,수량,비고,전하실말씀\n";
echo iconv('utf-8', 'euc-kr', "우편번호,주소,이름,전화1,전화2,상품명,수량,선택사항,배송비,상품코드,주문번호,운송장번호,전하실말씀\n"); echo iconv('utf-8', 'euc-kr', "우편번호,주소,이름,전화1,전화2,상품명,수량,선택사항,배송비,상품코드,주문번호,운송장번호,전하실말씀\n");
$save_it_id = '';
for ($i=0; $row=mysql_fetch_array($result); $i++) for ($i=0; $row=mysql_fetch_array($result); $i++)
{ {
$row = array_map('iconv_euckr', $row); $row = array_map('iconv_euckr', $row);
if($save_it_id != $row['it_id']) {
// 합계금액 계산 // 합계금액 계산
$sql = " select SUM(IF(io_type = 1, (io_price * ct_qty), ((ct_price + io_price) * ct_qty))) as price, $sql = " select SUM(IF(io_type = 1, (io_price * ct_qty), ((ct_price + io_price) * ct_qty))) as price,
SUM(ct_qty) as qty SUM(ct_qty) as qty
@ -96,7 +99,10 @@ if ($csv == 'csv')
$ct_send_cost = '무료'; $ct_send_cost = '무료';
} }
$save_it_id = $row['it_id'];
$ct_send_cost = iconv_euckr($ct_send_cost); $ct_send_cost = iconv_euckr($ct_send_cost);
}
echo '"'.$row['od_b_zip1'].'-'.$row['od_b_zip2'].'"'.','; echo '"'.$row['od_b_zip1'].'-'.$row['od_b_zip2'].'"'.',';
echo '"'.print_address($row['od_b_addr1'], $row['od_b_addr2'], $row['od_b_addr3']).'"'.','; echo '"'.print_address($row['od_b_addr1'], $row['od_b_addr2'], $row['od_b_addr3']).'"'.',';
@ -163,7 +169,10 @@ if ($csv == 'xls')
$worksheet->write(0, $col++, $cell); $worksheet->write(0, $col++, $cell);
} }
for($i=1; $row=sql_fetch_array($result); $i++) { $save_it_id = '';
for($i=1; $row=sql_fetch_array($result); $i++)
{
if($save_it_id != $row['it_id']) {
// 합계금액 계산 // 합계금액 계산
$sql = " select SUM(IF(io_type = 1, (io_price * ct_qty), ((ct_price + io_price) * ct_qty))) as price, $sql = " select SUM(IF(io_type = 1, (io_price * ct_qty), ((ct_price + io_price) * ct_qty))) as price,
SUM(ct_qty) as qty SUM(ct_qty) as qty
@ -193,7 +202,11 @@ if ($csv == 'xls')
$ct_send_cost = '무료'; $ct_send_cost = '무료';
} }
$save_it_id = $row['it_id'];
$ct_send_cost = iconv_euckr($ct_send_cost); $ct_send_cost = iconv_euckr($ct_send_cost);
}
$row = array_map('iconv_euckr', $row); $row = array_map('iconv_euckr', $row);
$worksheet->write($i, 0, $row['od_b_zip1'].'-'.$row['od_b_zip2']); $worksheet->write($i, 0, $row['od_b_zip1'].'-'.$row['od_b_zip2']);
@ -271,6 +284,7 @@ if (mysql_num_rows($result) == 0)
<?php <?php
$mod = 10; $mod = 10;
$tot_total_price = 0; $tot_total_price = 0;
$save_it_id = '';
for ($i=0; $row=sql_fetch_array($result); $i++) for ($i=0; $row=sql_fetch_array($result); $i++)
{ {
$sql1 = " select * from {$g5['g5_shop_order_table']} where od_id = '{$row['od_id']}' "; $sql1 = " select * from {$g5['g5_shop_order_table']} where od_id = '{$row['od_id']}' ";
@ -346,6 +360,8 @@ if (mysql_num_rows($result) == 0)
$res2 = sql_query($sql2); $res2 = sql_query($sql2);
$cnt = $sub_tot_qty = $sub_tot_price = 0; $cnt = $sub_tot_qty = $sub_tot_price = 0;
$save_it_id = '';
while ($row2 = sql_fetch_array($res2)) while ($row2 = sql_fetch_array($res2))
{ {
if($row2['io_type']) { if($row2['io_type']) {
@ -364,6 +380,8 @@ if (mysql_num_rows($result) == 0)
$price_plus = '+'; $price_plus = '+';
$it_name = "$it_name ({$row2['ct_option']} ".$price_plus.display_price($row2['io_price']).")"; $it_name = "$it_name ({$row2['ct_option']} ".$price_plus.display_price($row2['io_price']).")";
if($save_it_id != $row2['it_id']) {
switch($row2['ct_send_cost']) switch($row2['ct_send_cost'])
{ {
case 1: case 1:
@ -387,12 +405,15 @@ if (mysql_num_rows($result) == 0)
// 조건부무료 // 조건부무료
if($row2['it_sc_type'] == 2) { if($row2['it_sc_type'] == 2) {
$sendcost = get_item_sendcost($row['it_id'], $sum['price'], $sum['qty'], $row['od_id']); $sendcost = get_item_sendcost($row2['it_id'], $sum['price'], $sum['qty'], $row['od_id']);
if($sendcost == 0) if($sendcost == 0)
$ct_send_cost = '무료'; $ct_send_cost = '무료';
} }
$save_it_id = $row2['it_id'];
}
$fontqty1 = $fontqty2 = ""; $fontqty1 = $fontqty2 = "";
if ($row2['ct_qty'] >= 2) if ($row2['ct_qty'] >= 2)
{ {