예제 #1
0
             $currentColors = unserialize($currentColors);
         }
         $currentColors[$_GET['order_id']] = $_GET['value'];
         $currentColors = serialize($currentColors);
         Employee::update($_SESSION['user']['data']['id'], array('conf_ord_colors' => $currentColors));
         $_SESSION['user']['data']['conf_ord_colors'] = $currentColors;
         break;
     case 'referrer_payment_status_all':
         $bDoUpdate = false;
         $orders = explode(',', $_GET['order_id']);
         foreach ($orders as $order_id) {
             $order_id = trim($order_id);
             if (empty($order_id)) {
                 continue;
             }
             $order_info = get_order_info($order_id);
             if ($order_info['referrer_payment_status'] == 0) {
                 Order::update($order_id, array('referrer_payment_status' => 1, 'referrer_payment_date' => date('Y-m-d H:i:s')));
             }
         }
         $result[] = 'Оплачено';
         break;
 }
 if ($bDoUpdate) {
     Order::update($_GET['order_id'], array($_GET['field'] => $value));
     $order_info = Order::find($_GET['order_id']);
     if ($bDoHistoryUpdate) {
         $data = array('change_date' => time(), 'change_user_id' => $_SESSION['user']['data']['id'], 'order_id' => $_GET['order_id'], 'filial_id_new' => $order_info['filial_id'], 'klient_id_new' => $order_info['klient_id'], 'vuz_id_new' => $order_info['vuz_id'], 'vuz_user_new' => $order_info['vuz_user'], 'type_id_new' => $order_info['type_id'], 'type_user_new' => $order_info['type_user'], 'napr_id_new' => $order_info['napr_id'], 'disc_id_new' => $order_info['disc_id'], 'disc_user_new' => $order_info['disc_user'], 'time_kln_new' => $order_info['time_kln'], 'cost_kln_new' => $order_info['cost_kln'], 'payment_id_new' => $order_info['payment_id'], 'subject_new' => $order_info['subject'], 'about_kln_new' => $order_info['about_kln'], 'about_mng_new' => $order_info['about_mng'], 'kurs_new' => $order_info['kurs'], 'prakt_pc_new' => $order_info['prakt_pc'], 'pages_min_new' => $order_info['pages_min'], 'pages_max_new' => $order_info['pages_max'], 'src_min_new' => $order_info['src_min'], 'src_max_new' => $order_info['src_max'], 'from_id_new' => $order_info['from_id'], 'oform_new' => $order_info['oform'], 'next_rel_date_new' => $order_info['next_rel_date'], 'status_id_new' => $order_info['status_id'], 'ok_comment_new' => $order_info['ok_comment'], 'ok_comment_date_new' => $order_info['ok_comment_date'], 'payment_comment_new' => $order_info['payment_comment'], 'cost_auth_new' => $order_info['cost_auth'], 'time_auth_new' => $order_info['time_auth'], 'oplata_kln_new' => $order_info['oplata_kln'], 'author_paid_new' => $order_info['author_paid'], 'company_paid_new' => $order_info['company_paid'], 'filial_id_old' => $order_info['filial_id'], 'klient_id_old' => $order_info['klient_id'], 'vuz_id_old' => $order_info['vuz_id'], 'vuz_user_old' => $order_info['vuz_user'], 'type_id_old' => $order_info['type_id'], 'type_user_old' => $order_info['type_user'], 'napr_id_old' => $order_info['napr_id'], 'disc_id_old' => $order_info['disc_id'], 'disc_user_old' => $order_info['disc_user'], 'time_kln_old' => $order_info['time_kln'], 'cost_kln_old' => $order_info['cost_kln'], 'payment_id_old' => $order_info['payment_id'], 'subject_old' => $order_info['subject'], 'about_kln_old' => $order_info['about_kln'], 'about_mng_old' => $order_info['about_mng'], 'kurs_old' => $order_info['kurs'], 'prakt_pc_old' => $order_info['prakt_pc'], 'pages_min_old' => $order_info['pages_min'], 'pages_max_old' => $order_info['pages_max'], 'src_min_old' => $order_info['src_min'], 'src_max_old' => $order_info['src_max'], 'from_id_old' => $order_info['from_id'], 'oform_old' => $order_info['oform'], 'next_rel_date_old' => $order_info['next_rel_date'], 'status_id_old' => $order_info['status_id'], 'ok_comment_old' => $order_info['ok_comment'], 'ok_comment_date_old' => $order_info['ok_comment_date'], 'payment_comment_old' => $order_info['payment_comment'], 'cost_auth_old' => $order_info['cost_auth'], 'time_auth_old' => $order_info['time_auth'], 'oplata_kln_old' => $order_info['oplata_kln'], 'author_paid_old' => $order_info['author_paid'], 'company_paid_old' => $order_info['company_paid']);
         $data[$_GET['field'] . '_new'] = $_GET['value'];
         OrderHistory::create($data);
     }
예제 #2
0
<?php

/**
 * 查询订单详情
 * @Author:anlong
 */
require dirname(__FILE__) . '/includes/init.php';
admin_priv("s_os");
//初始化城市编号
$city_code = db_create_in(array_keys($_SESSION['city_arr']));
if ($_REQUEST['act'] == 'query') {
    $order_info = get_order_info();
    $smarty->assign("order_sn", $_GET['order_sn']);
    $smarty->assign("print_sn", $_GET['print_sn']);
    $smarty->assign("datetime", $_GET['datetime']);
    $smarty->assign("arr", $order_info['order_info']);
    $smarty->assign("c_num", $order_info['cj']);
    $smarty->assign("l_num", $order_info['lz']);
    $smarty->assign("arr2", $order_info['goods_info']);
    $smarty->assign('ur_here', '订单查询');
    $smarty->display("order_search.html");
    exit;
} else {
    $smarty->assign("datetime", date("Y-m-d"));
    $smarty->assign('ur_here', '订单查询');
    $smarty->display("order_search.html");
    exit;
}
function get_order_info()
{
    $datetime = $_GET['datetime'];
예제 #3
0
        $cancel_msg = '결제정보 입력 오류';
        switch ($default['de_pg_service']) {
            case 'lg':
                include G5_SHOP_PATH . '/lg/xpay_cancel.php';
                break;
            case 'inicis':
                include G5_SHOP_PATH . '/inicis/inipay_cancel.php';
                break;
            default:
                include G5_SHOP_PATH . '/kcp/pp_ax_hub_cancel.php';
                break;
        }
        die("<p>{$sql}<p>" . mysql_errno() . " : " . mysql_error() . "<p>error file : {$_SERVER['SCRIPT_NAME']}");
    }
    // 미수금 정보 업데이트
    $info = get_order_info($pp['od_id']);
    $sql = " update {$g5['g5_shop_order_table']}\n                set od_misu     = '{$info['od_misu']}' ";
    if ($info['od_misu'] == 0) {
        $sql .= " , od_status = '입금' ";
    }
    $sql .= " where od_id = '{$pp['od_id']}' ";
    sql_query($sql, FALSE);
    // 장바구니 상태변경
    if ($info['od_misu'] == 0) {
        $sql = " update {$g5['g5_shop_cart_table']}\n                    set ct_status = '입금'\n                    where od_id = '{$pp['od_id']}' ";
        sql_query($sql, FALSE);
    }
}
// 주문 정보 임시 데이터 삭제
$sql = " delete from {$g5['g5_shop_order_data_table']} where od_id = '{$pp['pp_id']}' and dt_pg = '{$pp_pg}' ";
sql_query($sql);
예제 #4
0
function apms_order($od_id, $od_status, $od_mk = '')
{
    global $g5;
    if (!$od_id) {
        return;
    }
    $arr_it_id = array();
    $arr_no_auto = array();
    $account = array();
    $now = G5_TIME_YMDHIS;
    $od_ok = $od_status == "입금" ? true : false;
    // APMS
    $mk_id = '';
    $mk_brate = 0;
    if (USE_PARTNER) {
        $apms = sql_fetch(" select * from {$g5['apms']} ", false);
        if ($od_mk) {
            // 추천인 아이디가 있으면
            $mk = apms_marketer($od_mk, 'pt_id, pt_benefit');
            if ($mk['pt_id']) {
                $mk_id = $mk['pt_id'];
                $lvl = isset($mk['pt_level']) && $mk['pt_level'] > 0 ? $mk['pt_level'] : 1;
                $mk_lvrate = isset($apms['apms_benefit' . $lvl]) && $apms['apms_benefit' . $lvl] > 0 ? $apms['apms_benefit' . $lvl] : 0;
                $mk_brate = ($mk_lvrate + $mk['pt_benefit']) / 100;
            }
        }
    }
    // 장바구니에서 내역가져오기
    $result = sql_query("select * from {$g5['g5_shop_cart_table']} where od_id = '{$od_id}' and ct_select = '1' order by pt_id, it_id", false);
    while ($row = sql_fetch_array($result)) {
        $it = apms_it($row['it_id']);
        //상품정보
        $query = "";
        if ($od_ok && in_array($it['pt_it'], $g5['apms_automation'])) {
            //자동처리 상품일 때 입금상태이면 재고반영, 포인트반영, 결제완료 처리함
            //상태변경
            $ct_status = '완료';
            // 장바구니 업데이트
            $query .= ", ct_status = '{$ct_status}'";
            // 판매량 반영
            $arr_it_id[] = $row['it_id'];
            // 재고량 반영
            if (!$row['ct_stock_use']) {
                //YC5 관리자용 차용
                apms_stock($row['it_id'], $row['ct_qty'], $row['io_id'], $row['io_type']);
                $query .= ", ct_stock_use = '1'";
            }
            // 포인트 반영 - 컨텐츠 상품은 설정일과 상관없이 반영함
            if ($row['mb_id'] && $row['ct_point'] > 0 && !$row['ct_point_use']) {
                $po_point = $row['ct_point'] * $row['ct_qty'];
                $po_content = "주문번호 {$od_id} ({$row['it_id']} : {$row['ct_id']}) 결제완료";
                insert_point($row['mb_id'], $po_point, $po_content, "@delivery", $row['mb_id'], "{$od_id},{$row['ct_id']}");
                $query .= ", ct_point_use = '1'";
            }
            // 정산일 반영
            $query .= ", pt_datetime = '{$now}'";
            // 히스토리에 남김 - 히스토리에 남길때는 작업|아이디|시간|IP|그리고 나머지 자료
            $ct_history = "\n{$ct_status}|automation|{$now}|";
            $query .= ", ct_history = CONCAT(ct_history,'{$ct_history}')";
            // 멤버쉽 아이템 체크 - 멤버쉽 함수가 있을 때만 작동
            if (function_exists('apms_membership_order')) {
                apms_membership_order($row, $ct_status, $now);
            }
        } else {
            // 자동처리 아닌 상품
            $arr_no_auto[] = $row['it_id'];
        }
        //커미션, 인센티브
        if (USE_PARTNER) {
            if ($it['pt_id']) {
                // 판매자
                list($commission, $incentive) = apms_pt_rate($apms, $it['pt_it'], $it['pt_id'], $it['pt_commission'], $it['pt_incentive']);
                $row['pt_commission_rate'] = $commission ? $commission : 0;
                $row['pt_incentive_rate'] = $incentive ? $incentive : 0;
                // 가정산
                $account = apms_account($row);
                $query .= " , pt_id = '{$it['pt_id']}'\n\t\t\t\t\t\t\t, pt_commission_rate = '{$row['pt_commission_rate']}'\n\t\t\t\t\t\t\t, pt_incentive_rate = '{$row['pt_incentive_rate']}'\n\t\t\t\t\t\t\t, pt_sale = '{$account['sale']}'\n\t\t\t\t\t\t\t, pt_commission = '{$account['commission']}'\n\t\t\t\t\t\t\t, pt_point = '{$account['point']}'\n\t\t\t\t\t\t\t, pt_incentive = '{$account['incentive']}'\n\t\t\t\t\t\t\t, pt_net = '{$account['net']}' ";
            }
            if ($mk_id && isset($it['pt_marketer']) && $it['pt_marketer'] > 0) {
                // 추천인
                $mk_prate = $it['pt_marketer'] / 100;
                $mk_amount = $row['ct_price'] * $row['ct_qty'];
                //총금액
                if ($row['ct_notax']) {
                    $mk_net = $mk_amount;
                } else {
                    list($mk_net) = apms_vat($mk_amount);
                }
                $mk_profit = floor($mk_net * $mk_prate);
                if ($mk_profit > 0) {
                    $mk_benefit = floor($mk_profit * $mk_brate);
                    $query .= " , mk_id = '{$mk_id}'\n\t\t\t\t\t\t\t\t, mk_profit = '{$mk_profit}'\n\t\t\t\t\t\t\t\t, mk_benefit = '{$mk_benefit}' ";
                }
            }
        }
        if ($query) {
            $sql = " update {$g5['g5_shop_cart_table']} \n\t\t\t\t\t\tset pt_it = '{$it['pt_it']}'\n\t\t\t\t\t\t\t{$query} \n\t\t\t\t\t\twhere od_id = '{$od_id}' and ct_id = '{$row['ct_id']}'\n\t\t\t\t\t";
            sql_query($sql);
        }
    }
    // 판매량 일괄반영
    if (is_array($arr_it_id) && !empty($arr_it_id)) {
        $unq_it_id = array_unique($arr_it_id);
        foreach ($unq_it_id as $it_id) {
            $row2 = sql_fetch(" select sum(ct_qty) as sum_qty from {$g5['g5_shop_cart_table']} where it_id = '{$it_id}' and ct_status = '완료' ");
            sql_query(" update {$g5['g5_shop_item_table']} set it_sum_qty = '{$row2['sum_qty']}' where it_id = '{$it_id}' ");
        }
    }
    // 주문서가 자동처리 상품으로 되어 있으면 주문서도 완료처리
    $is_sendcost = true;
    if ($od_ok && is_array($arr_no_auto) && empty($arr_no_auto)) {
        $info = get_order_info($od_id);
        if ($info && $info['od_misu'] == 0) {
            sql_query(" update {$g5['g5_shop_order_table']} set od_status = '완료' where od_id = '{$od_id}' ");
            $is_sendcost = false;
        }
    }
    // 개별배송비처리 - 무료가 아니고 기본배송비가 있는 경우만 체크
    if ($is_sendcost) {
        $where_sql = !empty($g5['apms_automation']) ? " and pt_it not in (" . implode(', ', $g5['apms_automation']) . ") " : "";
        $sql = " select * from {$g5['g5_shop_cart_table']} where od_id = '{$od_id}' and ct_select = '1' {$where_sql} group by it_id order by ct_id ";
        $result = sql_query($sql);
        for ($i = 0; $row = sql_fetch_array($result); $i++) {
            // 합계금액 계산
            $sql = " select SUM(IF(io_type = 1, (io_price * ct_qty), ((ct_price + io_price) * ct_qty))) as price,\n\t\t\t\t\t\t\tSUM(ct_point * ct_qty) as point,\n\t\t\t\t\t\t\tSUM(ct_qty) as qty\n\t\t\t\t\t\tfrom {$g5['g5_shop_cart_table']}\n\t\t\t\t\t\twhere it_id = '{$row['it_id']}'\n\t\t\t\t\t\t  and od_id = '{$od_id}' ";
            $sum = sql_fetch($sql);
            // 배송비
            $sc_price = 0;
            switch ($row['ct_send_cost']) {
                case 1:
                    $sc_type = '착불';
                    break;
                case 2:
                    $sc_type = '무료';
                    break;
                default:
                    $sc_type = '선불';
                    $sc_price = $row['it_sc_price'];
                    break;
            }
            // 조건부무료
            if ($sc_price && $row['it_sc_type'] == 2) {
                $sc_price = get_item_sendcost($row['it_id'], $sum['price'], $sum['qty'], $od_id);
                if ($sc_price == 0) {
                    $sc_type = '무료';
                }
            }
            // 개별배송비 등록
            sql_query(" insert into {$g5['apms_sendcost']} set od_id = '{$od_id}', it_id = '{$row['it_id']}', pt_id = '{$row['pt_id']}', sc_price = '{$sc_price}', sc_type = '{$sc_type}', sc_datetime = '" . G5_TIME_YMDHIS . "' ", false);
        }
    }
    return;
}
/* ##### Connect to Server Database ##### */
$con = mysql_connect("localhost", "root", "revive");
if (!$con) {
    die('Could not connect: ' . mysql_error());
}
if (!mysql_select_db("server", $con)) {
    die('Error: ' . mysql_error());
}
mysql_query("SET NAMES UTF8");
/* ###################################### */
/* ##### Get User Input ##### */
if (isset($_POST) && !empty($_POST)) {
    $data = store_data();
    if ($data["select_oid"] != "查詢報價單") {
        $oid = $data["select_oid"];
        $data = get_order_info($oid);
    }
}
/* ######################### */
/* ##### Function ##### */
function store_data()
{
    /* ##### Store Customer Data ##### */
    $data = array();
    foreach ($_POST as $key => $value) {
        // echo "$key: $value<br />";
        $data[$key] = $value;
    }
    return $data;
    /* ############################### */
}
예제 #6
0
파일: functions.php 프로젝트: yonkon/diplom
function send_order_by_email($Frm, $Err, $_authors = null)
{
    global $data_courses, $data_practica;
    if (!$Err) {
        $order_id = $Frm->GetNmValueI("order_id");
        $changes = array();
        $order_info = get_order_info($order_id);
        if ($order_info['vuz_id'] == 0) {
            $changes[] = "'вуз' " . $order_info['vuz_user'];
        } else {
            $vuz1 = get_vuz_name($order_info['vuz_id']);
            $changes[] = "'вуз' " . $vuz1['sname'] . "(" . $vuz1['name'] . ")";
        }
        if ($order_info['type_id'] == 0) {
            $changes[] = "'вид работы' " . $order_info['type_user'];
        } else {
            $changes[] = "'вид работы' " . get_worktype_name($order_info['type_id']);
        }
        $changes[] = "'факультет' " . get_naprav_name($order_info['napr_id']);
        if ($order_info['disc_id'] == 0) {
            $spec = $order_info['disc_user'];
        } else {
            $spec = get_discipline_name($order_info['disc_id']);
        }
        $changes[] = "Специальность: " . $spec;
        $changes[] = "Тема работы: " . $order_info['subject'];
        $changes[] = "Требования: " . $order_info['about_kln'];
        $changes[] = "Курс: " . $data_courses[$order_info['kurs']]['name'];
        $changes[] = "Практика: " . $data_practica[$order_info['prakt_pc']]['name'];
        $changes[] = "Минимальное число страниц: " . $order_info['pages_min'];
        $changes[] = "Максимальное число страниц: " . $order_info['pages_max'];
        $changes[] = "Минимальное число источников: " . $order_info['src_min'];
        $changes[] = "Максимальное число источников: " . $order_info['src_max'];
        $changes[] = "Гонорар автора: " . $order_info['cost_auth'];
        $changes[] = "Дата сдачи для автора: " . format_date($order_info['time_auth']);
        $changes[] = "";
        try {
            $manager = Employee::find($order_info['manager_id']);
        } catch (Exception $e) {
            $Frm->_gui->ERR("У заказа не указан менеджер");
            page_reloadAll();
        }
        try {
            $filial = Filial::find($order_info['filial_id']);
        } catch (Exception $e) {
            $Frm->_gui->ERR("У заказа не указан филиал");
            page_reloadAll();
        }
        if (empty($filial['email'])) {
            $Frm->_gui->ERR("У филиала к которому принадлежит заказ не указан email");
            page_reloadAll();
        }
        $changes[] = "Менеджер: " . $manager['fio'] . ". По данному заказу писать на почту " . $filial['email'];
        $changes[] = "Если заказ по данной дисциплине/специальности для Вас не является профильным, то Вы в любой момент можете отписаться от данной дисциплины/специальности в своем личном кабинете, расположенном по адресу: sessia-online.ru. Там же Вы так же можете подписаться на другие, интересные Вам дисциплины.";
        $msg_for_author = "Детали заказа №" . $order_id . ":\n";
        $msg_for_author .= join($changes, "<br>");
        $authors = array();
        if (is_array($_authors) && count($_authors)) {
            $authors = $_authors;
        } else {
            if (isset($_POST['authors'])) {
                $authors = $_POST['authors'];
            }
        }
        $failed = Author::saveMessageAndEnqueueEmail($order_id, $authors, 'u' . $_SESSION['user']['data']['id'], '№' . $order_id . ' ' . ucfirst($spec), str_replace(array('http://', 'https://'), '', $msg_for_author), \Components\Entity\EmailNotification::TO_SUBSCRIBED_AUTHORS_ON_DISTRIBUTION);
        //    $failed = Author::sendEmail($order_id, $authors, '№' . $order_id . ' ' . ucfirst($spec), str_replace(array('http://', 'https://'), '', $msg_for_author), true, true);
        if (!count($failed)) {
            $Frm->_gui->OK("Заказ отправлен");
        } else {
            $failed_receivers = array();
            foreach ($failed as $receiver) {
                $failed_receivers[] = $receiver['name'] . ' - ' . $receiver['email'];
            }
            $Frm->_gui->ERR("Вовремя отправки заказа возникли ошибки. Заказ не отправлен: " . join("\n", $failed_receivers));
        }
    }
}