Merge branch 'master' of github.com:gnuboard/yc4s
This commit is contained in:
@ -90,18 +90,16 @@ $sql = " select ct_id,
|
||||
it_id,
|
||||
it_name,
|
||||
ct_qty,
|
||||
ct_option,
|
||||
ct_price,
|
||||
ct_point,
|
||||
ct_status,
|
||||
ct_time,
|
||||
ct_point_use,
|
||||
ct_stock_use,
|
||||
it_opt1,
|
||||
it_opt2,
|
||||
it_opt3,
|
||||
it_opt4,
|
||||
it_opt5,
|
||||
it_opt6
|
||||
io_type,
|
||||
io_price,
|
||||
ct_num
|
||||
from {$g4['shop_cart_table']}
|
||||
where uq_id = '{$od['uq_id']}'
|
||||
order by ct_id ";
|
||||
@ -111,7 +109,12 @@ $lines = array();
|
||||
$total_order = 0;
|
||||
for($i=0; $row=sql_fetch_array($result); $i++) {
|
||||
$lines[$i] = $row;
|
||||
$total_order += ($row['ct_price'] * $row['ct_qty']);
|
||||
if($row['io_type'])
|
||||
$total_price = $row['io_price'] * $row['ct_qty'];
|
||||
else
|
||||
$total_price = ($row['ct_price'] + $row['io_price']) * $row['ct_qty'];
|
||||
$lines[$i]['price'] = $total_price;
|
||||
$total_order += $total_price;
|
||||
}
|
||||
|
||||
$pg_anchor = '<ul class="anchor">
|
||||
@ -165,26 +168,28 @@ $pg_anchor = '<ul class="anchor">
|
||||
<tbody>
|
||||
<?php
|
||||
for ($i=0; $i<count($lines); $i++) {
|
||||
$ct_amount['소계'] = $lines[$i]['ct_price'] * $lines[$i]['ct_qty'];
|
||||
$ct_amount['소계'] = $lines[$i]['price'];
|
||||
$ct_point['소계'] = $lines[$i]['ct_point'] * $lines[$i]['ct_qty'];
|
||||
if ($lines[$i]['ct_status']=='주문' || $lines[$i]['ct_status']=='준비' || $lines[$i]['ct_status']=='배송' || $lines[$i]['ct_status']=='완료')
|
||||
$t_ct_amount['정상'] += $lines[$i]['ct_price'] * $lines[$i]['ct_qty'];
|
||||
$t_ct_amount['정상'] += $lines[$i]['price'];
|
||||
else if ($lines[$i]['ct_status']=='취소' || $lines[$i]['ct_status']=='반품' || $lines[$i]['ct_status']=='품절')
|
||||
$t_ct_amount['취소'] += $lines[$i]['ct_price'] * $lines[$i]['ct_qty'];
|
||||
$t_ct_amount['취소'] += $lines[$i]['price'];
|
||||
|
||||
$image = get_it_image($lines[$i]['it_id'], 50, 50);
|
||||
?>
|
||||
|
||||
<? if($lines[$i]['ct_num'] == 0) { ?>
|
||||
<tr>
|
||||
<td colspan="9"><a href="./itemform.php?w=u&it_id=<?php echo $row['it_id']; ?>"><?php echo $image; ?><?php echo stripslashes($lines[$i]['it_name']); ?></a></td>
|
||||
</tr>
|
||||
<?php } ?>
|
||||
<tr>
|
||||
<td class="td_chk">
|
||||
<input type="hidden" name="ct_id[<?php echo $i; ?>]" value="<?php echo $row['ct_id']; ?>">
|
||||
<input type="hidden" name="ct_id[<?php echo $i; ?>]" value="<?php echo $lines[$i]['ct_id']; ?>">
|
||||
<label for="ct_chk_<?php echo $i; ?>" class="sound_only"><?php echo $lines[$i]['it_name']; ?> 체크</label>
|
||||
<input type="checkbox" name="ct_chk[<?php echo $i; ?>]" value="1" id="ct_chk_<?php echo $i; ?>">
|
||||
</td>
|
||||
<td>
|
||||
<a href="./itemform.php?w=u&it_id=<?php echo $row['it_id']; ?>"><?php echo $image; ?><?php echo stripslashes($lines[$i]['it_name']); ?></a><br>
|
||||
<?php echo print_item_options($lines[$i]['it_id'], $lines[$i]['it_opt1'], $lines[$i]['it_opt2'], $lines[$i]['it_opt3'], $lines[$i]['it_opt4'], $lines[$i]['it_opt5'], $lines[$i]['it_opt6']); ?>
|
||||
</td>
|
||||
<td><?php echo $lines[$i]['ct_option']; ?></td>
|
||||
<td class="td_small_stats"><?php echo $lines[$i]['ct_status']; ?></td>
|
||||
<td class="td_num"><?php echo $lines[$i]['ct_qty']; ?></td>
|
||||
<td class="td_num"><?php echo number_format($lines[$i]['ct_price']); ?></td>
|
||||
|
||||
@ -39,7 +39,7 @@ if ($csv == 'csv')
|
||||
$to_date = date_conv($to_date);
|
||||
|
||||
|
||||
$sql = " SELECT od_b_zip1, od_b_zip2, od_b_addr1, od_b_addr2, od_b_name, od_b_tel, od_b_hp, b.it_name, ct_qty, b.it_id, a.od_id, od_memo, od_invoice
|
||||
$sql = " SELECT od_b_zip1, od_b_zip2, od_b_addr1, od_b_addr2, od_b_name, od_b_tel, od_b_hp, b.it_name, ct_qty, b.it_id, a.od_id, od_memo, od_invoice, b.ct_option
|
||||
FROM {$g4['shop_order_table']} a, {$g4['shop_cart_table']} b
|
||||
where a.uq_id = b.uq_id ";
|
||||
if ($case == 1) // 출력기간
|
||||
@ -62,7 +62,7 @@ if ($csv == 'csv')
|
||||
header('Cache-Control: must-revalidate, post-check=0, pre-check=0');
|
||||
header('Pragma: public');
|
||||
//echo "우편번호,주소,이름,전화1,전화2,상품명,수량,비고,전하실말씀\n";
|
||||
echo "우편번호,주소,이름,전화1,전화2,상품명,수량,상품코드,주문번호,운송장번호,전하실말씀\n";
|
||||
echo "우편번호,주소,이름,전화1,전화2,상품명,수량,선택사항,상품코드,주문번호,운송장번호,전하실말씀\n";
|
||||
for ($i=0; $row=mysql_fetch_array($result); $i++)
|
||||
{
|
||||
echo '"'.$row['od_b_zip1'].'-'.$row['od_b_zip2'].'"'.',';
|
||||
@ -74,6 +74,7 @@ if ($csv == 'csv')
|
||||
echo '"'.conv_telno($row['od_b_hp']) . '"'.',';
|
||||
echo '"'.preg_replace("/\"/", """, $row['it_name']) . '"'.',';
|
||||
echo '"'.$row['ct_qty'].'"'.',';
|
||||
echo '"'.$row['ct_option'].'"'.',';
|
||||
echo '"\''.$row['it_id'].'\'"'.',';
|
||||
echo '"\''.$row['od_id'].'\'"'.',';
|
||||
echo '"'.$row['od_invoice'].'"'.',';
|
||||
@ -94,7 +95,7 @@ if ($csv == 'xls')
|
||||
$to_date = date_conv($to_date);
|
||||
|
||||
|
||||
$sql = " SELECT od_b_zip1, od_b_zip2, od_b_addr1, od_b_addr2, od_b_name, od_b_tel, od_b_hp, b.it_name, ct_qty, b.it_id, a.od_id, od_memo, od_invoice, b.it_opt1, b.it_opt2, b.it_opt3, b.it_opt4, b.it_opt5, b.it_opt6
|
||||
$sql = " SELECT od_b_zip1, od_b_zip2, od_b_addr1, od_b_addr2, od_b_name, od_b_tel, od_b_hp, b.it_name, ct_qty, b.it_id, a.od_id, od_memo, od_invoice, b.ct_option
|
||||
FROM {$g4['shop_order_table']} a, {$g4['shop_cart_table']} b
|
||||
where a.uq_id = b.uq_id ";
|
||||
if ($case == 1) // 출력기간
|
||||
@ -130,6 +131,7 @@ if ($csv == 'xls')
|
||||
echo '<td>전화2</td>';
|
||||
echo '<td>상품명</td>';
|
||||
echo '<td>수량</td>';
|
||||
echo '<td>선택사항</td>';
|
||||
echo '<td>상품코드</td>';
|
||||
echo '<td>주문번호</td>';
|
||||
echo '<td>운송장번호</td>';
|
||||
@ -148,6 +150,7 @@ if ($csv == 'xls')
|
||||
echo '<td class="mso_txt">'.$row['od_b_hp'].'</td>';
|
||||
echo '<td>'.$it_name.'</td>';
|
||||
echo '<td>'.$row['ct_qty'].'</td>';
|
||||
echo '<td>'.$row['ct_option'].'</td>';
|
||||
echo '<td class="mso_txt">'.$row['it_id'].'</td>';
|
||||
echo '<td class="mso_txt">'. urlencode($row['od_id']).'</td>';
|
||||
echo '<td class="mso_txt">'.$row['od_invoice'].'</td>';
|
||||
@ -265,7 +268,7 @@ if (mysql_num_rows($result) == 0)
|
||||
<table>
|
||||
<thead>
|
||||
<tr>
|
||||
<th scope="col">상품명(주문번호)</th>
|
||||
<th scope="col">상품명(선택사항)</th>
|
||||
<th scope="col">판매가</th>
|
||||
<th scope="col">수량</th>
|
||||
<th scope="col">소계</th>
|
||||
@ -273,13 +276,7 @@ if (mysql_num_rows($result) == 0)
|
||||
</thead>
|
||||
<tbody>
|
||||
<?php
|
||||
$sql2 = " select a.*,
|
||||
b.it_opt1_subject,
|
||||
b.it_opt2_subject,
|
||||
b.it_opt3_subject,
|
||||
b.it_opt4_subject,
|
||||
b.it_opt5_subject,
|
||||
b.it_opt6_subject
|
||||
$sql2 = " select a.*
|
||||
from {$g4['shop_cart_table']} a, {$g4['shop_item_table']} b
|
||||
where a.it_id = b.it_id
|
||||
and a.uq_id = '{$row['uq_id']}' ";
|
||||
@ -291,34 +288,15 @@ if (mysql_num_rows($result) == 0)
|
||||
$cnt = $sub_tot_qty = $sub_tot_amount = 0;
|
||||
while ($row2 = sql_fetch_array($res2))
|
||||
{
|
||||
$row2_tot_amount = $row2['ct_price'] * $row2['ct_qty'];
|
||||
if($row2['io_type'])
|
||||
$row2_tot_amount = $row2['io_price'] * $row2['ct_qty'];
|
||||
else
|
||||
$row2_tot_amount = ($row2['ct_price'] + $row2['io_price']) * $row2['ct_qty'];
|
||||
$sub_tot_qty += $row2['ct_qty'];
|
||||
$sub_tot_amount += $row2_tot_amount;
|
||||
|
||||
$it_name = stripslashes($row2['it_name']);
|
||||
$it_name = "$it_name ($row2[it_id])";
|
||||
|
||||
$str_split = "";
|
||||
for ($k=1; $k<=6; $k++)
|
||||
{
|
||||
if ($row2["it_opt{$k}"] == "") continue;
|
||||
$it_name .= $str_split;
|
||||
$it_opt_subject = $row2["it_opt{$k}_subject"];
|
||||
$opt = explode( ";", trim($row2["it_opt{$k}"]) );
|
||||
$it_name .= $it_opt_subject.' = '.$opt[0];
|
||||
|
||||
if ($opt[1] != 0)
|
||||
{
|
||||
$it_name .= " (";
|
||||
//if (ereg("[+]", $opt[1]) == true)
|
||||
if (preg_match("/[+]/", $opt[1]) == true)
|
||||
$it_name .= "+";
|
||||
// 금액을 전화문의 표시로
|
||||
$it_name .= display_price($opt[1]) . ")";
|
||||
}
|
||||
$str_split = "<br />";
|
||||
}
|
||||
$it_name .= "";
|
||||
$it_name = "$it_name ({$row2['ct_option']})";
|
||||
|
||||
$fontqty1 = $fontqty2 = "";
|
||||
if ($row2['ct_qty'] >= 2)
|
||||
|
||||
@ -48,26 +48,15 @@ $sql = " select a.od_id,
|
||||
a.od_deposit_name,
|
||||
a.od_time,
|
||||
a.od_mobile,
|
||||
b.it_opt1,
|
||||
b.it_opt2,
|
||||
b.it_opt3,
|
||||
b.it_opt4,
|
||||
b.it_opt5,
|
||||
b.it_opt6,
|
||||
b.ct_status,
|
||||
b.ct_qty,
|
||||
b.ct_price,
|
||||
b.ct_point,
|
||||
(b.ct_qty * b.ct_price) as ct_sub_amount,
|
||||
b.ct_option,
|
||||
(IF(b.io_type = 1, b.io_price * b.ct_qty, (b.ct_price + b.io_price) * b.ct_qty)) as ct_sub_amount,
|
||||
(b.ct_qty * b.ct_point) as ct_sub_point,
|
||||
b.it_id,
|
||||
b.it_name,
|
||||
c.it_opt1_subject,
|
||||
c.it_opt2_subject,
|
||||
c.it_opt3_subject,
|
||||
c.it_opt4_subject,
|
||||
c.it_opt5_subject,
|
||||
c.it_opt6_subject
|
||||
b.it_name
|
||||
$sql_common
|
||||
order by $sort1 $sort2
|
||||
limit $from_record, $rows ";
|
||||
@ -183,7 +172,7 @@ if ($search) // 검색렬일 때만 처음 버튼을 보여줌
|
||||
<a href="<?php echo $_SERVER['PHP_SELF']; ?>?sort1=<?php echo $sort1; ?>&sort2=<?php echo $sort2; ?>&sel_field=od_id&search=<?php echo $lines[$i]['od_id']; ?>"><?php echo $lines[$i]['od_id']; ?></a><br>
|
||||
<?php echo $lines[$i]['od_time']; ?>
|
||||
</td>
|
||||
<td class="td_it_img"><a href="<?php echo $href; ?>"><?php echo get_it_image($lines[$i]['it_id'], 50, 50); ?><?php echo $it_name; ?></a></td>
|
||||
<td class="td_it_img"><a href="<?php echo $href; ?>"><?php echo get_it_image($lines[$i]['it_id'], 50, 50); ?><?php echo $it_name; ?></a><br><?php echo $lines[$i]['ct_option']; ?></td>
|
||||
<td class="td_name">
|
||||
<a href="<?php echo $_SERVER['PHP_SELF']; ?>?sort1=<?php echo $sort1; ?>&sort2=<?php echo $sort2; ?>&sel_field=od_name&search=<?php echo $lines[$i]['od_name']; ?>"><?php echo cut_str($lines[$i]['od_name'],10,""); ?></a>
|
||||
<?php if ($lines[$i]['od_deposit_name'] != "") echo '<br>'.$lines[$i]['od_deposit_name']?>
|
||||
|
||||
@ -32,13 +32,13 @@ if (G4_HTTPS_DOMAIN) {
|
||||
define(_MISU_QUERY_, "
|
||||
count(distinct a.od_id) as ordercount, /* 주문서건수 */
|
||||
count(b.ct_id) as itemcount, /* 상품건수 */
|
||||
(SUM(b.ct_price * b.ct_qty) + a.od_send_cost) as orderamount , /* 주문합계 */
|
||||
(SUM(IF(b.ct_status = '취소' OR b.ct_status = '반품' OR b.ct_status = '품절', b.ct_price * b.ct_qty, 0))) as ordercancel, /* 주문취소 */
|
||||
(SUM(IF(b.io_type = 1, b.io_price * b.ct_qty, (b.ct_price + b.io_price) * b.ct_qty)) + a.od_send_cost) as orderamount, /* 주문합계 */
|
||||
(SUM(IF(b.ct_status = '취소' OR b.ct_status = '반품' OR b.ct_status = '품절', (IF(b.io_type = 1, b.io_price * b.ct_qty, (b.ct_price + b.io_price) * b.ct_qty)), 0))) as ordercancel, /* 주문취소 */
|
||||
(a.od_receipt_bank + a.od_receipt_card + a.od_receipt_hp + a.od_receipt_point) as receiptamount, /* 입금합계 */
|
||||
(a.od_refund_amount + a.od_cancel_card) as receiptcancel, /* 입금취소 */
|
||||
(
|
||||
(SUM(b.ct_price * b.ct_qty) + a.od_send_cost) -
|
||||
(SUM(IF(b.ct_status = '취소' OR b.ct_status = '반품' OR b.ct_status = '품절', b.ct_price * b.ct_qty, 0))) -
|
||||
(SUM(IF(b.io_type = 1, b.io_price * b.ct_qty, (b.ct_price + b.io_price) * b.ct_qty)) + a.od_send_cost) -
|
||||
(SUM(IF(b.ct_status = '취소' OR b.ct_status = '반품' OR b.ct_status = '품절', (IF(b.io_type = 1, b.io_price * b.ct_qty, (b.ct_price + b.io_price) * b.ct_qty)), 0))) -
|
||||
a.od_dc_amount -
|
||||
(a.od_receipt_bank + a.od_receipt_card + a.od_receipt_hp + a.od_receipt_point) +
|
||||
(a.od_refund_amount + a.od_cancel_card)
|
||||
|
||||
@ -74,9 +74,9 @@ CREATE TABLE IF NOT EXISTS `shop_cart` (
|
||||
`ct_ip` varchar(25) NOT NULL DEFAULT '',
|
||||
`ct_send_cost` varchar(255) NOT NULL,
|
||||
`ct_direct` tinyint(4) NOT NULL,
|
||||
`ct_order` int(11) NOT NULL DEFAULT '0',
|
||||
PRIMARY KEY (`ct_id`),
|
||||
KEY `uq_id` (`uq_id`)
|
||||
KEY `uq_id` (`uq_id`),
|
||||
KEY `ct_num` (`ct_num`)
|
||||
) ENGINE=MyISAM DEFAULT CHARSET=utf8;
|
||||
|
||||
-- --------------------------------------------------------
|
||||
|
||||
@ -217,11 +217,11 @@ else if ($act == "optionmod") // 장바구니에서 옵션변경
|
||||
// 장바구니에 Insert
|
||||
$comma = '';
|
||||
$sql = " INSERT INTO {$g4['shop_cart_table']}
|
||||
( uq_id, it_id, it_name, ct_status, ct_price, ct_point, ct_point_use, ct_stock_use, ct_option, ct_qty, ct_num, io_id, io_type, io_price, ct_time, ct_ip, ct_direct, ct_order )
|
||||
( uq_id, it_id, it_name, ct_status, ct_price, ct_point, ct_point_use, ct_stock_use, ct_option, ct_qty, ct_num, io_id, io_type, io_price, ct_time, ct_ip, ct_direct )
|
||||
VALUES ";
|
||||
|
||||
for($i=0; $i<$option_count; $i++) {
|
||||
$sql .= $comma."( '$tmp_uq_id', '{$_POST['it_id']}', '{$_POST['it_name']}', '쇼핑', '{$_POST['it_price']}', '{$_POST['it_point']}', '0', '0', '{$_POST['io_value'][$i]}', '{$_POST['ct_qty'][$i]}', '$i', '{$_POST['io_id'][$i]}', '{$_POST['io_type'][$i]}', '{$_POST['io_price'][$i]}', '".G4_TIME_YMDHIS."', '$REMOTE_ADDR', '$sw_direct', '{$_POST['ct_order']}' )";
|
||||
$sql .= $comma."( '$tmp_uq_id', '{$_POST['it_id']}', '{$_POST['it_name']}', '쇼핑', '{$_POST['it_price']}', '{$_POST['it_point']}', '0', '0', '{$_POST['io_value'][$i]}', '{$_POST['ct_qty'][$i]}', '$i', '{$_POST['io_id'][$i]}', '{$_POST['io_type'][$i]}', '{$_POST['io_price'][$i]}', '".G4_TIME_YMDHIS."', '$REMOTE_ADDR', '$sw_direct' )";
|
||||
$comma = ' , ';
|
||||
}
|
||||
|
||||
@ -333,18 +333,38 @@ else // 장바구니에 담기
|
||||
else
|
||||
$ct_num = 0;
|
||||
|
||||
$ct_count = 0;
|
||||
$comma = '';
|
||||
$sql = " INSERT INTO {$g4['shop_cart_table']}
|
||||
( uq_id, it_id, it_name, ct_status, ct_price, ct_point, ct_point_use, ct_stock_use, ct_option, ct_qty, ct_num, io_id, io_type, io_price, ct_time, ct_ip, ct_direct )
|
||||
VALUES ";
|
||||
|
||||
for($i=0; $i<$option_count; $i++) {
|
||||
// 동일옵션의 상품이 있으면 수량 더함
|
||||
$sql2 = " select ct_id
|
||||
from {$g4['shop_cart_table']}
|
||||
where uq_id = '$tmp_uq_id'
|
||||
and it_id = '{$_POST['it_id']}'
|
||||
and io_id = '{$_POST['io_id'][$i]}'
|
||||
and ct_status = '쇼핑' ";
|
||||
$row2 = sql_fetch($sql2);
|
||||
if($row2['ct_id']) {
|
||||
$sql3 = " update {$g4['shop_cart_table']}
|
||||
set ct_qty = ct_qty + {$_POST['ct_qty'][$i]}
|
||||
where ct_id = '{$row2['ct_id']}' ";
|
||||
sql_query($sql3);
|
||||
|
||||
continue;
|
||||
}
|
||||
|
||||
$sql .= $comma."( '$tmp_uq_id', '{$_POST['it_id']}', '{$_POST['it_name']}', '쇼핑', '{$_POST['it_price']}', '{$_POST['it_point']}', '0', '0', '{$_POST['io_value'][$i]}', '{$_POST['ct_qty'][$i]}', '$ct_num', '{$_POST['io_id'][$i]}', '{$_POST['io_type'][$i]}', '{$_POST['io_price'][$i]}', '".G4_TIME_YMDHIS."', '$REMOTE_ADDR', '$sw_direct' )";
|
||||
$comma = ' , ';
|
||||
$ct_num++;
|
||||
$ct_count++;
|
||||
}
|
||||
|
||||
sql_query($sql);
|
||||
if($ct_count > 0)
|
||||
sql_query($sql);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user