function getFilledOrder($id)
 {
     $orderdata = Order::where('id', $id)->first();
     if (!empty($orderdata)) {
         $data = Order::getOrder($id);
         return View::make('update', array('data' => $data, 'id' => $id));
     } else {
         $data['message'] = "no data found";
         return Response::json($data, 400);
     }
 }
예제 #2
0
?>
</h2>
<?php 
if (isset($_REQUEST['post_id']) && $_REQUEST['post_id'] != "") {
    //single product month sales...
    global $wpdb;
    $id = $_REQUEST['post_id'];
    $query = "select * from `{$wpdb->prefix}mp_order_items` where pid={$id}";
    $result = $wpdb->get_results($query);
    $product = array();
    $cTotal = 0;
    $cCount = 0;
    $currency_sign = get_option('_wpmp_curr_sign', '$');
    foreach ($result as $oitem) {
        $order1 = new Order();
        $order = $order1->getOrder($oitem->oid);
        if ($order->payment_status != 'Completed') {
            continue;
        }
        $cart_data = unserialize($order->cart_data);
        $cart_data = $cart_data[$id];
        //echo "<pre> {$order->order_id}"; print_r($cart_data); echo "</pre>";
        $count = 0;
        $total = 0;
        if (isset($cart_data['item'])) {
            foreach ($cart_data['item'] as $key => $val) {
                if (!isset($val['coupon_amount']) || $val['coupon_amount'] == "") {
                    $val['coupon_amount'] = 0;
                }
                if (!isset($val['discount_amount']) || $val['discount_amount'] == "") {
                    $val['discount_amount'] = 0;
예제 #3
0
function wpmp_orders()
{
    $order1 = new Order();
    global $wpdb;
    //$wpdb->show_errors();
    $l = 15;
    $currency_sign = get_option('_wpmp_curr_sign', '$');
    //if(isset($_GET['paged'])) {
    $p = isset($_GET['paged']) ? $_GET['paged'] : 1;
    $s = ($p - 1) * $l;
    //}
    //        echo "<pre>";
    //        print_r($_REQUEST);
    //        echo "</pre>";
    if (isset($_GET['task']) && $_GET['task'] == 'vieworder') {
        $order = $order1->getOrder($_GET['id']);
        //                echo "<pre>";
        //                print_r($order);
        //                echo "</pre>";
        include 'tpls/view-order.php';
    } else {
        if (isset($_GET['task']) && $_GET['task'] == 'delete_order') {
            $order_id = esc_attr($_GET['id']);
            $ret = $wpdb->query($wpdb->prepare("\r\n                        DELETE FROM {$wpdb->prefix}mp_orders\r\n                         WHERE order_id = %s\r\n                        ", $order_id));
            if ($ret) {
                //echo $ret;
                $ret = $wpdb->query($wpdb->prepare("\r\n                        DELETE FROM {$wpdb->prefix}mp_order_items\r\n                         WHERE oid = %s\r\n                        ", $order_id));
                //echo $ret;
                if ($ret) {
                    $msg = "Record Deleted for Order ID {$order_id}...";
                }
            }
        } else {
            if (isset($_GET['delete_selected'], $_GET['delete_confirm']) && $_GET['delete_confirm'] == 1) {
                $order_ids = $_GET['id'];
                if (!empty($order_ids) && is_array($order_ids)) {
                    foreach ($order_ids as $key => $order_id) {
                        $order_id = esc_attr($order_id);
                        $ret = $wpdb->query($wpdb->prepare("\r\n                                DELETE FROM {$wpdb->prefix}mp_orders\r\n                                 WHERE order_id = %s\r\n                                ", $order_id));
                        if ($ret) {
                            //echo $ret;
                            $ret = $wpdb->query($wpdb->prepare("\r\n                                DELETE FROM {$wpdb->prefix}mp_order_items\r\n                                 WHERE oid = %s\r\n                                ", $order_id));
                            //echo $ret;
                            if ($ret) {
                                $msg[] = "Record Deleted for Order ID {$order_id}...";
                            }
                        }
                    }
                }
            } else {
                if (isset($_GET['delete_by_payment_sts'], $_GET['delete_all_by_payment_sts']) && $_GET['delete_all_by_payment_sts'] != "") {
                    $payment_status = esc_attr($_GET['delete_all_by_payment_sts']);
                    $order_ids = $wpdb->get_results("\r\n                                SELECT order_id \r\n                                FROM {$wpdb->prefix}mp_orders\r\n                                WHERE payment_status = '{$payment_status}'\r\n                                ", ARRAY_A);
                    if ($order_ids) {
                        foreach ($order_ids as $row) {
                            //print_r($row);
                            $order_id = $row['order_id'];
                            $ret = $wpdb->query($wpdb->prepare("\r\n                                DELETE FROM {$wpdb->prefix}mp_orders\r\n                                 WHERE order_id = %s\r\n                                ", $order_id));
                            if ($ret) {
                                //echo $ret;
                                $ret = $wpdb->query($wpdb->prepare("\r\n                                DELETE FROM {$wpdb->prefix}mp_order_items\r\n                                 WHERE oid = %s\r\n                                ", $order_id));
                                //echo $ret;
                                if ($ret) {
                                    $msg[] = "Record Deleted for Order ID {$order_id}...";
                                }
                            }
                        }
                    }
                }
            }
        }
        //$wpdb->print_error();
        if (isset($_REQUEST['oid']) && $_REQUEST['oid']) {
            $qry[] = "order_id='{$_REQUEST['oid']}'";
        }
        if (isset($_REQUEST['ost']) && $_REQUEST['ost']) {
            $qry[] = "order_status='{$_REQUEST['ost']}'";
        }
        if (isset($_REQUEST['pst']) && $_REQUEST['pst']) {
            $qry[] = "payment_status='{$_REQUEST['pst']}'";
        }
        if (isset($_REQUEST['sdate'], $_REQUEST['edate']) && ($_REQUEST['sdate'] != '' || $_REQUEST['edate'] != '')) {
            $_REQUEST['edate'] = $_REQUEST['edate'] ? $_REQUEST['edate'] : $_REQUEST['sdate'];
            $_REQUEST['sdate'] = $_REQUEST['sdate'] ? $_REQUEST['sdate'] : $_REQUEST['edate'];
            $sdate = strtotime("{$_REQUEST['sdate']} 00:00:00");
            $edate = strtotime("{$_REQUEST['edate']} 23:59:59");
            $qry[] = "(`date` >={$sdate} and `date` <={$edate})";
        }
        if (isset($qry)) {
            $qry = "where " . implode(" and ", $qry);
        } else {
            $qry = "";
        }
        $t = $order1->totalOrders($qry);
        $orders = $order1->GetAllOrders($qry, $s, $l);
        include 'tpls/orders.php';
    }
}
예제 #4
0
<?php

$id = Url::getParam('id');
if (!empty($id)) {
    $objOrder = new Order();
    $order = $objOrder->getOrder($id);
    if (!empty($order)) {
        $items = $objOrder->getOrderItems($id);
        $objCatalogue = new Catalogue();
        $objUser = new User();
        $user = $objUser->getUser($order['client']);
        $objCountry = new Country();
        $objBusiness = new Business();
        $business = $objBusiness->getBusiness();
        $objBasket = new Basket();
        ?>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title>Invoice</title>
<meta name="description" content="" />
<meta name="keywords" content="" />
<meta http-equiv="imagetoolbar" content="no" />
<link href="/css/invoice.css" rel="stylesheet" type="text/css" />
</head>
<body>

<div id="wrapper">
	
예제 #5
0
function manage_wpmarketplace_columns($column_name, $id)
{
    global $wpdb;
    /*
        $count = 0;
        $income = 0;
        $query = "select * from `{$wpdb->prefix}mp_order_items` where pid=$id";
        $result = $wpdb->get_results( $query, ARRAY_A );
        $currency_sign = get_option('_wpmp_curr_sign','$');
        if($result){
       //$count = $wpdb->num_rows;
       foreach ($result as $row){
           $order_id = $row['oid'];
           $get_res = $wpdb->get_row( "SELECT * FROM `{$wpdb->prefix}mp_orders` where order_id='$order_id' and payment_status='Completed'",ARRAY_A );
           if(!empty($get_res)){
               $income += $get_res['total'];
               $count+= $row['quantity'];
           }
       }
        }
    */
    global $wpdb;
    $currency_sign = get_option('_wpmp_curr_sign', '$');
    $oitems = $wpdb->get_results("select * from {$wpdb->prefix}mp_order_items where pid='{$id}'");
    $income = 0;
    $count = 0;
    foreach ($oitems as $oitem) {
        $order1 = new Order();
        $order = $order1->getOrder($oitem->oid);
        if ($order->payment_status != 'Completed') {
            continue;
        }
        //$count += $oitem->quantity;
        $cart_data = unserialize($order->cart_data);
        $cart_data = $cart_data[$id];
        if (isset($cart_data['item'])) {
            foreach ($cart_data['item'] as $key => $val) {
                if (!isset($val['coupon_amount']) || $val['coupon_amount'] == "") {
                    $val['coupon_amount'] = 0;
                }
                if (!isset($val['discount_amount']) || $val['discount_amount'] == "") {
                    $val['discount_amount'] = 0;
                }
                if (!isset($val['prices']) || $val['prices'] == "") {
                    $val['prices'] = 0;
                }
                $count += $val['quantity'];
                $income += number_format(($cart_data['price'] + $val['prices']) * $val['quantity'] - $val['discount_amount'] - $val['coupon_amount'], 2, ".", "");
            }
        } else {
            if (!isset($cart_data['coupon_amount']) || $cart_data['coupon_amount'] == "") {
                $cart_data['coupon_amount'] = 0;
            }
            if (!isset($cart_data['discount_amount']) || $cart_data['discount_amount'] == "") {
                $cart_data['discount_amount'] = 0;
            }
            if (!isset($cart_data['prices']) || $cart_data['prices'] == "") {
                $cart_data['prices'] = 0;
            }
            $count += $cart_data['quantity'];
            $income += number_format(($cart_data['price'] + $cart_data['prices']) * $cart_data['quantity'] - $cart_data['discount_amount'] - $cart_data['coupon_amount'], 2, ".", "");
        }
    }
    switch ($column_name) {
        case 'no_of_sale':
            update_post_meta($id, "_wpmp_product_no_of_sale", $count);
            echo "{$count}";
            break;
        case 'total_income':
            update_post_meta($id, "_wpmp_product_total_income", $income);
            echo "{$currency_sign}{$income}";
            break;
        case 'graph':
            echo "<a href='edit.php?post_type=wpmarketplace&page=product-report&post_id={$id}'>View Graph</a>";
            break;
        case 'ptype':
            global $post;
            $terms = get_the_terms($id, 'ptype');
            /* If terms were found. */
            if (!empty($terms)) {
                $out = array();
                /* Loop through each term, linking to the 'edit posts' page for the specific term. */
                foreach ($terms as $term) {
                    $out[] = sprintf('<a href="%s">%s</a>', esc_url(add_query_arg(array('post_type' => $post->post_type, 'ptype' => $term->slug), 'edit.php')), esc_html(sanitize_term_field('name', $term->name, $term->term_id, 'ptype', 'display')));
                }
                /* Join the terms, separating them with a comma. */
                echo join(', ', $out);
            } else {
                _e('--');
            }
            break;
        case 'total_dl':
            $dl = get_post_meta($id, 'wpmp_product_dl', true);
            if ($dl != "") {
                echo $dl;
            } else {
                echo "0";
            }
            break;
        default:
            break;
    }
    // end switch
}
예제 #6
0
파일: orders.php 프로젝트: luvyatyss/nashop
 $Order = new Order();
 $maxTotal = Order::getValueMaxColName('Total');
 $maxTotal = empty($maxTotal) ? 0 : ceil($maxTotal / 1000000);
 // /1 triệu đồng
 if (isset($_POST["btnSave"])) {
     if (isset($_POST["txtOrderID"])) {
         $Order->setOrderID($_POST["txtOrderID"]);
     }
     if (isset($_POST["cboStatus"])) {
         $Order->setStatus(new Status($_POST["cboStatus"]));
     }
     $Order->update();
     $update = true;
 } else {
     if (isset($_GET["OrderID"]) && isset($_GET["control"])) {
         $Order = Order::getOrder($_GET["OrderID"]);
         if ($Order != null) {
             echo "<script> \$(function () { \$(window).load(function(){ \$('#modalOrder').modal( { backdrop: 'static', keyboard: false }, 'show');});  });</script>";
         } else {
             require_once '../helper/Utils.php';
             $url = "orders.php";
             Utils::Redirect($url);
         }
     }
 }
 ?>
 <div class="page-header">
     <div class="pull-right">
     </div>
     <h1>Order</h1>
     <ol class="breadcrumb bc-3">
예제 #7
0
 public static function updatepaymentOrder($id)
 {
     $data = DB::table('orders')->where('id', $id)->update(array('status' => 'delivered'));
     return Order::getOrder($id);
 }
예제 #8
0
 public function doPay()
 {
     // 获得payment_id 获得相关参数
     $payment_id = Filter::int(Req::args('payment_id'));
     $order_id = Filter::int(Req::args('order_id'));
     $recharge = Req::args('recharge');
     $extendDatas = Req::args();
     if ($payment_id) {
         $payment = new Payment($payment_id);
         $paymentPlugin = $payment->getPaymentPlugin();
         //充值处理
         if ($recharge != null) {
             $recharge = Filter::float($recharge);
             $paymentInfo = $payment->getPayment();
             $data = array('account' => $recharge, 'paymentName' => $paymentInfo['name']);
             $packData = $payment->getPaymentInfo('recharge', $data);
             $packData = array_merge($extendDatas, $packData);
             $sendData = $paymentPlugin->packData($packData);
         } else {
             if ($order_id != null) {
                 $order = Order::getOrder($order_id);
                 $model = new Model("order_goods");
                 if ($order) {
                     //获取订单可能延时时长,0不限制
                     $config = Config::getInstance();
                     $config_other = $config->get('other');
                     // todo 修改方法  order type 去掉  详情表中记录 order type
                     switch ($order['type']) {
                         case '1':
                             $order_delay = isset($config_other['other_order_delay_group']) ? intval($config_other['other_order_delay_group']) : 120;
                             break;
                         case '2':
                             $order_delay = isset($config_other['other_order_delay_flash']) ? intval($config_other['other_order_delay_flash']) : 120;
                             break;
                         case '3':
                             $order_delay = isset($config_other['other_order_delay_bund']) ? intval($config_other['other_order_delay_bund']) : 0;
                             break;
                         default:
                             $order_delay = isset($config_other['other_order_delay']) ? intval($config_other['other_order_delay']) : 0;
                             break;
                     }
                     $time = strtotime("-" . $order_delay . " Minute");
                     $create_time = strtotime($order['create_time']);
                     if ($create_time >= $time || $order_delay == 0) {
                         //取得所有订单商品
                         //$order_goods = $model->table('order_goods')->fields("product_id,goods_nums, prom_type")->where('order_id='.$order_id)->findAll();
                         $order_goods_inst = new OrderGoods();
                         $order_goods = $order_goods_inst->getOrderGoods($order_id);
                         $product_ids = array();
                         $order_products = array();
                         // todo 这里判断 prom_type 类型
                         foreach ($order_goods as $value) {
                             // 套餐不在这里检查商品库存  考虑在别的地方检查
                             // 如果订单详细表中行是由于捆绑促销
                             if ($value['prom_type'] == 'bundling') {
                                 continue;
                             } else {
                                 $product_ids[] = $value['product_id'];
                                 $order_products[$value['product_id']] = $value['goods_nums'];
                             }
                         }
                         $packData = $payment->getPaymentInfo('order', $order_id);
                         $packData = array_merge($extendDatas, $packData);
                         $sendData = $paymentPlugin->packData($packData);
                         /* 这里不需要验证库存量  提交订单时已经验证
                                                 if (!empty($product_ids)) {
                         
                                                     $product_ids = implode(',', $product_ids);
                                                     $products = $model->table('products')->fields("id,store_nums")->where("id in ($product_ids)")->findAll();
                                                     $products_list = array();
                                                     foreach ($products as $value) {
                                                         $products_list[$value['id']] = $value['store_nums'];
                                                     }
                                                     $flag = true;
                                                     foreach ($order_goods as $value) {
                                                         if ($order_products[$value['product_id']] > $products_list[$value['product_id']]) {
                                                             $flag = false;
                                                             break;
                                                         }
                                                     }
                                                     //检测库存是否还能满足订单
                                                     if ($flag) {
                                                         //团购订单
                                                         if ($order['type'] == 1 || $order['type'] == 2) {
                                                             if ($order['type'] == 1) {
                                                                 $prom_name = '团购';
                                                                 $prom_table = "groupbuy";
                                                             } else {
                                                                 $prom_name = '抢购';
                                                                 $prom_table = "flash_sale";
                                                             }
                                                             $prom = $model->table($prom_table)->where("id=" . $order['prom_id'])->find();
                                                             if ($prom) {
                                                                 if (time() > strtotime($prom['end_time']) || $prom['max_num'] <= $prom["goods_num"]) {
                                                                     $model->table("order")->data(array('status' => 6))->where('id=' . $order_id)->update();
                                                                     $this->redirect("/index/msg", false, array('type' => 'fail', 'msg' => '支付晚了,' . $prom_name . "活动已结束。"));
                                                                     exit;
                                                                 }
                                                             }
                                                         }
                         
                                                         $packData = $payment->getPaymentInfo('order', $order_id);
                                                         $packData = array_merge($extendDatas, $packData);
                                                         $sendData = $paymentPlugin->packData($packData);
                         
                                                     } else {
                                                         $model->table("order")->data(array('status' => 6))->where('id=' . $order_id)->update();
                                                         $this->redirect("/index/msg", false, array('type' => 'fail', 'msg' => '支付晚了,库存已不足。'));
                                                         exit;
                         
                                                     }
                                                 }
                                                 */
                     } else {
                         $model->data(array('status' => 6))->where('id=' . $order_id)->update();
                         $this->redirect("/index/msg", false, array('type' => 'fail', 'msg' => '订单超出了规定时间内付款,已作废.'));
                         exit;
                     }
                 }
             }
         }
         if (!empty($sendData)) {
             $this->assign("paymentPlugin", $paymentPlugin);
             $this->assign("sendData", $sendData);
             $this->redirect('pay_form', false);
         } else {
             $this->redirect("/index/msg", false, array('type' => 'fail', 'msg' => '需要支付的订单已经不存在。'));
         }
     } else {
         echo "fail";
     }
 }
예제 #9
0
 public function actionGetinvoice()
 {
     $model = new Order();
     $totalOrder = $model->getTotalOrder();
     if ($totalOrder > 0) {
         // Get Last Invoice Number
         $order = $model->getOrder(0, 1);
         foreach ($order as $value) {
             $last_inv_id = $value['inv_id'];
         }
         $last_inv_id = substr($last_inv_id, 3, 6);
         $last_inv_id = (int) $last_inv_id;
         // Set New Invoice Number
         $inv_id = "INV" . ($last_inv_id + 1);
     } else {
         // Set Default Invoice Number
         $inv_id = "INV100001";
     }
     echo $inv_id;
 }
예제 #10
0
App::loadMod("Order");
App::loadMod("Eassy");
$app = new App();
$user = new User();
$order = new Order();
$eassy = new Eassy();
if (!$user->isLogin()) {
    redirect("Location: status.php?action=login");
}
$look = false;
if (isset($_GET['action']) || isset($_GET['id'])) {
    if ($_GET['action'] == "delete") {
        if (!$user->str_check($_GET['id'])) {
            redirect("Location: error.php");
        }
        $t = $order->getOrder($_GET['id']);
        if ($user->getPower() != 0) {
            if ($user->getUser() != $t['user']) {
                redirect("Location: error.php");
            }
        }
        $order->deleteOrder($_GET['id']);
        echo "<script language=\"javascript\">alert('删除成功!');history.back(-1);</script>";
        die;
    }
    if ($_GET['action'] == "look") {
        if (!$user->str_check($_GET['id'])) {
            redirect("Location: error.php");
        }
        $t = $order->getOrder($_GET['id']);
        if ($user->getPower() != 0) {
예제 #11
0
<?php

require_once '../inc/autoload.php';
// tokens
$token2 = Session::getSession('token2');
$objForm = new Form();
$token1 = $objForm->getPost('token');
if ($token2 == Login::string2hash($token1)) {
    // create order
    $objOrder = new Order();
    if ($objOrder->createOrder()) {
        // populate order details
        $order = $objOrder->getOrder();
        $items = $objOrder->getOrderItems();
        if (!empty($order) && !empty($items)) {
            $objBasket = new Basket();
            $objCatalogue = new Catalogue();
            $objPayPal = new PayPal();
            foreach ($items as $item) {
                $product = $objCatalogue->getProduct($item['product']);
                $objPayPal->addProduct($item['product'], $product['name'], $item['price'], $item['qty']);
            }
            $objPayPal->_tax_cart = $objBasket->_vat;
            // populate client's details
            $objUser = new User();
            $user = $objUser->getUser($order['client']);
            if (!empty($user)) {
                // get user country record
                $objCountry = new Country();
                $country = $objCountry->getCountry($user['country']);
                // pass client's details to the PayPal instance
예제 #12
0
 public static function getOrderWithDetail($order_id)
 {
     $order = Order::getOrder($order_id);
     if ($order) {
         $order_goods_inst = new OrderGoods();
         $order['OrderGoods'] = $order_goods_inst->getOrderGoods($order_id);
         $ret = array('status' => 1, 'data' => $order, 'msg' => '获取订单及详情成功!');
         return $ret;
     } else {
         $ret = array('status' => 0, 'msg' => '获取订单及详情失败!');
         return $ret;
     }
 }
예제 #13
0
<?php

require_once 'bootstrap.php';
if (isset($_GET['order_id']) && !empty($_GET['order_id']) && is_numeric($_GET['order_id'])) {
    $order_id = intval($_GET['order_id']);
} else {
    echo 'Error: No order_id set.';
    exit;
}
$order = new Order();
$order_array = $order->getOrder($order_id);
if ($order->isSessionAuthorized($order_id)) {
    // yep, he has permissions for this order
} else {
    // the user has no permissions for this order
    echo 'Error: No Permissions.';
    exit;
}
// insert Coinkite checkout-stuff here
// get the product data
$product = $products->getProductById(intval($_GET['id']));
if ($product != false) {
    // @TODO thats shitty
    $key = '';
    $secret = '';
    // initialize coinkite class
    require_once 'classes' . DIRECTORY_SEPARATOR . 'payment' . DIRECTORY_SEPARATOR . 'coinkite' . DIRECTORY_SEPARATOR . 'Coinkite.php';
    $coinkite = new Coinkite($key, $secret);
    $coinkite->setAccount('My Bitcoins');
    $coinkite->setReturnURL('http://127.0.0.1/dev/dg/payment_callback.php');
    $coinkite->setCurrency('EUR');