주문서 관리 수정중

This commit is contained in:
gnuboard
2013-11-05 15:23:33 +09:00
parent 17fdd96c47
commit d8873271cd
4 changed files with 83 additions and 28 deletions

View File

@ -21,31 +21,11 @@ sql_query($sql);
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
//------------------------------------------------------------------------------ // 완료된 주문에 포인트를 적립한다.
// 주문포인트를 적립한다. save_order_point("완료");
// 설정일이 지난 포인트 부여되지 않은 배송완료된 장바구니 자료에 포인트 부여
// 설정일이 0 이면 주문서 완료 설정 시점에서 포인트를 바로 부여합니다.
//------------------------------------------------------------------------------
function save_order_point($ct_status="완료")
{
global $default;
$beforedays = date("Y-m-d H:i:s", ( time() - (86400 * (int)$default['de_point_days']) ) ); // 86400초는 하루
$sql = " select * from {$g5['g5_shop_cart_table']} where ct_status = '$ct_status' and ct_point_use = '0' and ct_time <= '$beforedays' ";
$result = sql_query($sql);
for ($i=0; $row=sql_fetch_array($result); $i++) {
// 회원 ID 를 얻는다.
$od_row = sql_fetch("select od_id, mb_id from {$g5['g5_shop_order_table']} where od_id = '{$row['od_id']}' ");
if ($od_row['mb_id'] && $row['ct_point'] > 0) { // 회원이면서 포인트가 0보다 크다면
$po_point = $row['ct_point'] * $row['ct_qty'];
$po_content = "주문번호 {$od_row['od_id']} ({$row['ct_id']}) 배송완료";
insert_point($od_row['mb_id'], $po_point, $po_content, "@delivery", $od_row['mb_id'], "{$od_row['od_id']},{$row['ct_id']}");
}
sql_query("update {$g5['g5_shop_cart_table']} set ct_point_use = '1' where ct_id = '{$row['ct_id']}' ");
}
}
/*
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
// 주문완료 포인트 // 주문완료 포인트
// 설정일이 지난 포인트 부여되지 않은 배송완료된 장바구니 자료에 포인트 부여 // 설정일이 지난 포인트 부여되지 않은 배송완료된 장바구니 자료에 포인트 부여
@ -75,6 +55,7 @@ if (!isset($order_not_point)) {
} }
} }
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
*/
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------

View File

@ -65,7 +65,8 @@ if ($od_receipt_point) {
} }
if ($od_coupon) { if ($od_coupon) {
$where[] = " od_coupon != 0 "; // 개별상품쿠폰, 배송비쿠폰, 주문금액쿠폰
$where[] = " (od_cart_coupon + od_send_coupon + od_coupon) != 0 ";
} }
if ($fr_date && $to_date) { if ($fr_date && $to_date) {
@ -180,7 +181,7 @@ $listall = '<a href="'.$_SERVER['PHP_SELF'].'" class="ov_listall">전체목록</
<input type="checkbox" name="od_receipt_point" value="Y" id="od_misu04" <?php echo get_checked($od_receipt_point, 'Y'); ?>> <input type="checkbox" name="od_receipt_point" value="Y" id="od_misu04" <?php echo get_checked($od_receipt_point, 'Y'); ?>>
<label for="od_misu04">포인트주문</label> <label for="od_misu04">포인트주문</label>
<input type="checkbox" name="od_coupon" value="Y" id="od_misu05" <?php echo get_checked($od_coupon, 'Y'); ?>> <input type="checkbox" name="od_coupon" value="Y" id="od_misu05" <?php echo get_checked($od_coupon, 'Y'); ?>>
<label for="od_misu05">쿠폰</label> <label for="od_misu05">쿠폰할인</label>
</div> </div>
<div class="sch_last"> <div class="sch_last">

View File

@ -389,6 +389,7 @@ function get_image($img, $width=0, $height=0, $img_id='')
return $str; return $str;
} }
// 상품 이미지를 얻는다 // 상품 이미지를 얻는다
function get_it_image($it_id, $width, $height=0, $anchor=false, $img_id='') function get_it_image($it_id, $width, $height=0, $anchor=false, $img_id='')
{ {
@ -448,6 +449,8 @@ function get_it_image($it_id, $width, $height=0, $anchor=false, $img_id='')
return $img; return $img;
} }
// 상품이미지 썸네일 생성
function get_it_thumbnail($img, $width, $height=0, $id='') function get_it_thumbnail($img, $width, $height=0, $id='')
{ {
$str = ''; $str = '';
@ -481,7 +484,8 @@ function get_it_thumbnail($img, $width, $height=0, $id='')
return $str; return $str;
} }
//
// 이미지 URL 을 얻는다.
function get_it_imageurl($it_id) function get_it_imageurl($it_id)
{ {
global $g5; global $g5;
@ -513,6 +517,7 @@ function get_it_imageurl($it_id)
return $str; return $str;
} }
// 상품의 재고 (창고재고수량 - 주문대기수량) // 상품의 재고 (창고재고수량 - 주문대기수량)
function get_it_stock_qty($it_id) function get_it_stock_qty($it_id)
{ {
@ -535,6 +540,7 @@ function get_it_stock_qty($it_id)
return $jaego - $daegi; return $jaego - $daegi;
} }
// 옵션의 재고 (창고재고수량 - 주문대기수량) // 옵션의 재고 (창고재고수량 - 주문대기수량)
function get_option_stock_qty($it_id, $io_id, $type) function get_option_stock_qty($it_id, $io_id, $type)
{ {
@ -560,6 +566,7 @@ function get_option_stock_qty($it_id, $io_id, $type)
return $jaego - $daegi; return $jaego - $daegi;
} }
// 큰 이미지 // 큰 이미지
function get_large_image($img, $it_id, $btn_image=true) function get_large_image($img, $it_id, $btn_image=true)
{ {
@ -579,6 +586,7 @@ function get_large_image($img, $it_id, $btn_image=true)
return $str; return $str;
} }
// 금액 표시 // 금액 표시
function display_price($price, $tel_inq=false) function display_price($price, $tel_inq=false)
{ {
@ -590,6 +598,7 @@ function display_price($price, $tel_inq=false)
return $price; return $price;
} }
// 금액표시 // 금액표시
// $it : 상품 배열 // $it : 상품 배열
function get_price($it) function get_price($it)
@ -610,12 +619,14 @@ function display_point($point)
return number_format($point, 0).'점'; return number_format($point, 0).'점';
} }
// 포인트를 구한다 // 포인트를 구한다
function get_point($amount, $point) function get_point($amount, $point)
{ {
return (int)($amount * $point / 100); return (int)($amount * $point / 100);
} }
// HTML 특수문자 변환 htmlspecialchars // HTML 특수문자 변환 htmlspecialchars
function htmlspecialchars2($str) function htmlspecialchars2($str)
{ {
@ -624,6 +635,7 @@ function htmlspecialchars2($str)
return $str; return $str;
} }
// 상품이미지 업로드 // 상품이미지 업로드
function it_img_upload($srcfile, $filename, $dir) function it_img_upload($srcfile, $filename, $dir)
{ {
@ -654,6 +666,7 @@ function it_img_upload($srcfile, $filename, $dir)
return $file; return $file;
} }
// 파일을 업로드 함 // 파일을 업로드 함
function upload_file($srcfile, $destfile, $dir) function upload_file($srcfile, $destfile, $dir)
{ {
@ -664,6 +677,7 @@ function upload_file($srcfile, $destfile, $dir)
return true; return true;
} }
function message($subject, $content, $align="left", $width="450") function message($subject, $content, $align="left", $width="450")
{ {
$str = " $str = "
@ -689,6 +703,7 @@ function message($subject, $content, $align="left", $width="450")
return $str; return $str;
} }
// 시간이 비어 있는지 검사 // 시간이 비어 있는지 검사
function is_null_time($datetime) function is_null_time($datetime)
{ {
@ -701,6 +716,7 @@ function is_null_time($datetime)
return false; return false;
} }
// 출력유형, 스킨파일, 1라인이미지수, 총라인수, 이미지폭, 이미지높이 // 출력유형, 스킨파일, 1라인이미지수, 총라인수, 이미지폭, 이미지높이
// 1.02.01 $ca_id 추가 // 1.02.01 $ca_id 추가
//function display_type($type, $skin_file, $list_mod, $list_row, $img_width, $img_height, $ca_id="") //function display_type($type, $skin_file, $list_mod, $list_row, $img_width, $img_height, $ca_id="")
@ -745,6 +761,7 @@ function display_type($type, $list_skin='', $list_mod='', $list_row='', $img_wid
} }
} }
// 모바일 유형별 상품 출력 // 모바일 유형별 상품 출력
function mobile_display_type($type, $skin_file, $list_row, $img_width, $img_height, $ca_id="") function mobile_display_type($type, $skin_file, $list_row, $img_width, $img_height, $ca_id="")
{ {
@ -774,6 +791,7 @@ function mobile_display_type($type, $skin_file, $list_row, $img_width, $img_heig
} }
} }
// 분류별 출력 // 분류별 출력
// 스킨파일번호, 1라인이미지수, 총라인수, 이미지폭, 이미지높이 , 분류번호 // 스킨파일번호, 1라인이미지수, 총라인수, 이미지폭, 이미지높이 , 분류번호
function display_category($no, $list_mod, $list_row, $img_width, $img_height, $ca_id="") function display_category($no, $list_mod, $list_row, $img_width, $img_height, $ca_id="")
@ -801,6 +819,7 @@ function display_category($no, $list_mod, $list_row, $img_width, $img_height, $c
} }
} }
// 별 // 별
function get_star($score) function get_star($score)
{ {
@ -814,6 +833,7 @@ function get_star($score)
return $star; return $star;
} }
// 별 이미지 // 별 이미지
function get_star_image($it_id) function get_star_image($it_id)
{ {
@ -825,6 +845,7 @@ function get_star_image($it_id)
return (int)get_star($row['score']); return (int)get_star($row['score']);
} }
// 메일 보내는 내용을 HTML 형식으로 만든다. // 메일 보내는 내용을 HTML 형식으로 만든다.
function email_content($str) function email_content($str)
{ {
@ -840,6 +861,7 @@ function email_content($str)
return $s; return $s;
} }
// 타임스탬프 형식으로 넘어와야 한다. // 타임스탬프 형식으로 넘어와야 한다.
// 시작시간, 종료시간 // 시작시간, 종료시간
function gap_time($begin_time, $end_time) function gap_time($begin_time, $end_time)
@ -864,6 +886,7 @@ function continue_cut_str($str, $len=80)
return preg_replace($pattern, "\\0\n", $str); return preg_replace($pattern, "\\0\n", $str);
} }
// 제목별로 컬럼 정렬하는 QUERY STRING // 제목별로 컬럼 정렬하는 QUERY STRING
// $type 이 1이면 반대 // $type 이 1이면 반대
function title_sort($col, $type=0) function title_sort($col, $type=0)
@ -903,6 +926,7 @@ function session_check()
gotourl(G5_SHOP_URL); gotourl(G5_SHOP_URL);
} }
// 상품 선택옵션 // 상품 선택옵션
function get_item_options($it_id, $subject) function get_item_options($it_id, $subject)
{ {
@ -990,6 +1014,7 @@ function get_item_options($it_id, $subject)
return $str; return $str;
} }
// 상품 추가옵션 // 상품 추가옵션
function get_item_supply($it_id, $subject) function get_item_supply($it_id, $subject)
{ {
@ -1059,6 +1084,7 @@ function get_item_supply($it_id, $subject)
return $str; return $str;
} }
function print_item_options($it_id, $cart_id) function print_item_options($it_id, $cart_id)
{ {
global $g5; global $g5;
@ -1079,6 +1105,7 @@ function print_item_options($it_id, $cart_id)
return $str; return $str;
} }
// 일자형식변환 // 일자형식변환
function date_conv($date, $case=1) function date_conv($date, $case=1)
{ {
@ -1091,6 +1118,7 @@ function date_conv($date, $case=1)
return $date; return $date;
} }
// 배너출력 // 배너출력
function display_banner($position, $num="") function display_banner($position, $num="")
{ {
@ -1101,6 +1129,7 @@ function display_banner($position, $num="")
include G5_SHOP_SKIN_PATH.'/boxbanner'.$num.'.skin.php'; include G5_SHOP_SKIN_PATH.'/boxbanner'.$num.'.skin.php';
} }
// 1.00.02 // 1.00.02
// 파일번호, 이벤트번호, 1라인이미지수, 총라인수, 이미지폭, 이미지높이 // 파일번호, 이벤트번호, 1라인이미지수, 총라인수, 이미지폭, 이미지높이
// 1.02.01 $ca_id 추가 // 1.02.01 $ca_id 추가
@ -1130,6 +1159,7 @@ function display_event($no, $event, $list_mod, $list_row, $img_width, $img_heigh
} }
} }
function get_yn($val, $case='') function get_yn($val, $case='')
{ {
switch ($case) { switch ($case) {
@ -1139,6 +1169,7 @@ function get_yn($val, $case='')
return $result; return $result;
} }
// 상품명과 건수를 반환 // 상품명과 건수를 반환
function get_goods($cart_id) function get_goods($cart_id)
{ {
@ -1213,6 +1244,7 @@ function check_datetime($datetime)
return false; return false;
} }
// 경고메세지를 경고창으로 // 경고메세지를 경고창으로
function alert_opener($msg='', $url='') function alert_opener($msg='', $url='')
{ {
@ -1229,6 +1261,7 @@ function alert_opener($msg='', $url='')
exit; exit;
} }
// option 리스트에 selected 추가 // option 리스트에 selected 추가
function conv_selected_option($options, $value) function conv_selected_option($options, $value)
{ {
@ -1240,6 +1273,7 @@ function conv_selected_option($options, $value)
return $options; return $options;
} }
// 주문서 번호를 얻는다. // 주문서 번호를 얻는다.
function get_new_od_id() function get_new_od_id()
{ {
@ -1266,6 +1300,7 @@ function get_new_od_id()
return $od_id; return $od_id;
} }
// cart id 설정 // cart id 설정
function set_cart_id($direct) function set_cart_id($direct)
{ {
@ -1314,6 +1349,7 @@ function set_cart_id($direct)
} }
} }
// 상품 목록 : 관련 상품 출력 // 상품 목록 : 관련 상품 출력
function relation_item($it_id, $width, $height, $rows=3) function relation_item($it_id, $width, $height, $rows=3)
{ {
@ -1349,6 +1385,7 @@ function relation_item($it_id, $width, $height, $rows=3)
return $str; return $str;
} }
// 상품이미지에 유형 아이콘 출력 // 상품이미지에 유형 아이콘 출력
function item_icon($it) function item_icon($it)
{ {
@ -1378,6 +1415,7 @@ function item_icon($it)
return $icon; return $icon;
} }
// sns 공유하기 // sns 공유하기
function get_sns_share_link($sns, $url, $title, $img) function get_sns_share_link($sns, $url, $title, $img)
{ {
@ -1399,6 +1437,7 @@ function get_sns_share_link($sns, $url, $title, $img)
return $str; return $str;
} }
// 상품이미지 썸네일 삭제 // 상품이미지 썸네일 삭제
function delete_item_thumbnail($dir, $file) function delete_item_thumbnail($dir, $file)
{ {
@ -1416,6 +1455,7 @@ function delete_item_thumbnail($dir, $file)
} }
} }
// 쿠폰번호 생성함수 // 쿠폰번호 생성함수
function get_coupon_id() function get_coupon_id()
{ {
@ -1439,6 +1479,7 @@ function get_coupon_id()
return $str; return $str;
} }
// array_map() 대체 // array_map() 대체
function array_add_callback($func, $array) function array_add_callback($func, $array)
{ {
@ -1461,6 +1502,7 @@ function array_add_callback($func, $array)
return $array; return $array;
} }
// 주문의 금액, 배송비 과세금액 등의 정보를 가져옴 // 주문의 금액, 배송비 과세금액 등의 정보를 가져옴
function get_order_info($od_id) function get_order_info($od_id)
{ {
@ -1605,6 +1647,7 @@ function get_order_info($od_id)
return $info; return $info;
} }
// 상품포인트 // 상품포인트
function get_item_point($it) function get_item_point($it)
{ {
@ -1619,6 +1662,7 @@ function get_item_point($it)
return $it_point; return $it_point;
} }
// 배송비 구함 // 배송비 구함
function get_sendcost($cart_id, $selected=1) function get_sendcost($cart_id, $selected=1)
{ {
@ -1672,6 +1716,7 @@ function get_sendcost($cart_id, $selected=1)
return ($total_send_cost + $send_cost); return ($total_send_cost + $send_cost);
} }
// 상품별 배송비 // 상품별 배송비
function get_item_sendcost($it_id, $price, $qty) function get_item_sendcost($it_id, $price, $qty)
{ {
@ -1708,6 +1753,7 @@ function get_item_sendcost($it_id, $price, $qty)
return $sendcost; return $sendcost;
} }
// 쿠폰 사용체크 // 쿠폰 사용체크
function is_used_coupon($mb_id, $cp_id) function is_used_coupon($mb_id, $cp_id)
{ {
@ -1723,6 +1769,33 @@ function is_used_coupon($mb_id, $cp_id)
return $used; return $used;
} }
//------------------------------------------------------------------------------
// 주문포인트를 적립한다.
// 설정일이 지난 포인트 부여되지 않은 배송완료된 장바구니 자료에 포인트 부여
// 설정일이 0 이면 주문서 완료 설정 시점에서 포인트를 바로 부여합니다.
//------------------------------------------------------------------------------
function save_order_point($ct_status="완료")
{
global $default;
$beforedays = date("Y-m-d H:i:s", ( time() - (86400 * (int)$default['de_point_days']) ) ); // 86400초는 하루
$sql = " select * from {$g5['g5_shop_cart_table']} where ct_status = '$ct_status' and ct_point_use = '0' and ct_time <= '$beforedays' ";
$result = sql_query($sql);
for ($i=0; $row=sql_fetch_array($result); $i++) {
// 회원 ID 를 얻는다.
$od_row = sql_fetch("select od_id, mb_id from {$g5['g5_shop_order_table']} where od_id = '{$row['od_id']}' ");
if ($od_row['mb_id'] && $row['ct_point'] > 0) { // 회원이면서 포인트가 0보다 크다면
$po_point = $row['ct_point'] * $row['ct_qty'];
$po_content = "주문번호 {$od_row['od_id']} ({$row['ct_id']}) 배송완료";
insert_point($od_row['mb_id'], $po_point, $po_content, "@delivery", $od_row['mb_id'], "{$od_row['od_id']},{$row['ct_id']}");
}
sql_query("update {$g5['g5_shop_cart_table']} set ct_point_use = '1' where ct_id = '{$row['ct_id']}' ");
}
}
//============================================================================== //==============================================================================
// 쇼핑몰 라이브러리 모음 끝 // 쇼핑몰 라이브러리 모음 끝
//============================================================================== //==============================================================================

View File

@ -147,12 +147,12 @@ if(openwin != null) {
<dd class="sod_bsk_dvr"><strong><?php echo number_format($od['od_cart_price']); ?> 원</strong></dd> <dd class="sod_bsk_dvr"><strong><?php echo number_format($od['od_cart_price']); ?> 원</strong></dd>
<?php if($od['od_cart_coupon'] > 0) { ?> <?php if($od['od_cart_coupon'] > 0) { ?>
<dt class="sod_bsk_dvr">상품할인</dt> <dt class="sod_bsk_dvr">개별상품 쿠폰할인</dt>
<dd class="sod_bsk_dvr"><strong><?php echo number_format($od['od_cart_coupon']); ?> 원</strong></dd> <dd class="sod_bsk_dvr"><strong><?php echo number_format($od['od_cart_coupon']); ?> 원</strong></dd>
<?php } ?> <?php } ?>
<?php if($od['od_coupon'] > 0) { ?> <?php if($od['od_coupon'] > 0) { ?>
<dt class="sod_bsk_dvr">결제할인</dt> <dt class="sod_bsk_dvr">주문금액 쿠폰할인</dt>
<dd class="sod_bsk_dvr"><strong><?php echo number_format($od['od_coupon']); ?> 원</strong></dd> <dd class="sod_bsk_dvr"><strong><?php echo number_format($od['od_coupon']); ?> 원</strong></dd>
<?php } ?> <?php } ?>