Ejemplo n.º 1
0
    /**
     * Function creates a template to display the orders available. 
     * @param array $result
     * @param integer $paging
     * @param integer $prev	 
     * @param integer $next	
     * @param integer $dropdown
     * @param array $dropupdatedata
     * @param array  $orderProduct
     * @return string
     */
    function displayOrders($result, $paging, $prev, $next, $dropdown, $dropupdatedata, $orderProduct)
    {
        $obj = new Display_DOrderManagement();
        $orderst = array('', 'Pending', 'Processing', 'Delivered', 'AwaitingPayment', 'Cancel');
        $orderstatuslist = '<select name="selorderstatus" style="width:70px;"><option value="" >All</option>';
        for ($i = 1; $i < 6; $i++) {
            $orderstatuslist .= $_POST['selorderstatus'] == $i ? '<option value=' . $i . ' selected="selected">' . $orderst[$i] . '</option>' : '<option value="' . $i . '">' . $orderst[$i] . '</option>';
        }
        $orderstatuslist .= '</select>';
        if (count($dropupdatedata) > 0) {
            $mmcat = $_POST["selupdatedropdown"];
            $updrop = "<select id='selupdatedropdown' name='selupdatedropdown'>";
            foreach ($dropupdatedata as $row) {
                $orderstatusname = $row['orders_status_name'];
                $orderstatusid = $row['orders_status_id'];
                $updrop .= $mmcat == $orderstatusid ? "<option value='{$orderstatusid}' selected='selected'>{$orderstatusname}</option>" : "<option value='{$orderstatusid}'>{$orderstatusname}</option>";
            }
            $updrop .= "</select>";
        }
        $output = '  <form name="frmorders" method="post"><div class="blocks" style="opacity: 1;">
		<div class="clsListing clearfix"><table cellspacing="0" cellpadding="0" border="0"  class="table table-striped table-bordered  table-hover">


		<!--<tr >
		<td colspan=8 align=right valign=top><input type="hidden" name="selection" value="search" /><input type="button" value="Search"  class="all_bttn" onclick="document.frmorders.selection.value=\'Update\';/* document.frmorders.action=\'?do=disporders\'; */document.frmorders.submit(); "/></td>
		</tr>
		<tr><td colspan="2" align=left  valign=top><a href="#" onclick="return selDeSel(\'sel\');">Select</a>/<a href="#" onclick="return selUnDeSel(\'sel\');"> Unselect All</a> </td> <td>&nbsp;</td>
		<td colspan="2"  valign=top> Change order status to</td><td>' . $updrop . '</td>
		<td colspan=2 align=right  valign=top><input type="hidden" name="selection" value="Update" /><input type="button"  class="all_bttn" value="Update" 
		onclick="document.frmorders.selection.value=\'Update\'; document.frmorders.action=\'?do=disporders&action=update\'; document.frmorders.submit(); " /></td>
		</tr>-->


		<!--' . (isset($_GET['msg']) ? '<div align="center" style="padding:3px;"><font color="green"><b>' . $_GET['msg'] . '</b></font></span>' : "") . '-->
		
		<thead class="green_bg">
		<tr>
		<th  align="left">Order Id</th>
		<th  align="left">Name</th>
		<th  align="left">Order Date</th>
		<th  align="left" >Bill Name</th>
		<th  align="left">Ship Name</th>
		<th  align="left">Order total</th>
		<th  align="left">Status</th>
		<th  align="left">Options</th>
		</tr>
		</thead><tbody>

		
		
		<tr class="list_search_bg">

		<td  valign=top><input type="text" name="orderid" id="orderid" style="width:50px" value="' . $_POST['orderid'] . '" /></td>
		<td  valign="top" ><input type="text" name="dispname" id="dispname" value="' . $_POST['dispname'] . '" style="width:75px"/></td>
		<td><table style="margin-top:-5px;"><tr><td style="border:none">From</td><td style="border:none"><input type="text" name="txtfromdate" id="txtfromdate" size=6  value="' . $_POST['txtfromdate'] . '" /> </td></tr><tr><td style="border:none">To</td><td style="border:none"><input type="text" name="txttodate" id="txttodate" size=6  value="' . $_POST['txttodate'] . '" /></td></tr></table>

		</td>
		<td  valign=top><input type="text" name="billname" id="billname"  value="' . $_POST['billname'] . '"  style="width:50px"/></td>
		<td  valign=top><input type="text" name="shipname" id="shipname"  value="' . $_POST['shipname'] . '" style="width:50px"/></td>
		<td><table style="margin-top:-5px;"><tr><td style="border:none">From</td><td style="border:none"><input type="text" name="ordertotalfrom" id="ordertotalfrom" size=6  value="' . $_POST['ordertotalfrom'] . '"  /></td></tr><tr><td style="border:none">To</td><td style="border:none"><input type="text" name="ordertotalto" id="ordertotalto" size=6   value="' . $_POST['ordertotalto'] . '"/></td></tr></table>
		
		</td>
		<td align="left" class="product_search">' . $orderstatuslist . '</td>
		<td align="center"><input type="submit" value="Search"  class="clsBtn" onclick="document.frmorders.selection.value=\'Update\';/* document.frmorders.action=\'?do=disporders\'; */document.frmorders.submit(); " /></td>
		</tr>';
        $i = 1;
        $cnt = 0;
        if (count($result) > 0) {
            foreach ($result as $row) {
                $id = $row['orders_id'];
                $dispname = $row['Name'];
                $customerid = $row['customers_id'];
                $bilname = $row['billing_name'];
                $shipname = $row['shipping_name'];
                $status = $row['orders_status_name'];
                $statusid = $row['orders_status_id'];
                $currency_tocken = $row['currency_tocken'];
                $amount = $row['order_total'];
                $dropdowndata = $obj->dropdownOrderStatus($dropdown, $statusid);
                $purchaseddatetime = $row['date_purchased'];
                $purchased_date_time = explode(" ", $purchaseddatetime);
                $purchased_date = explode("-", $purchased_date_time[0]);
                $purchased_time = explode(":", $purchased_date_time[1]);
                $purchaseddate = date("l, M d, Y ", mktime(0, 0, 0, $purchased_date[1], $purchased_date[2], $purchased_date[0]));
                if ($i % 2 == 0) {
                    $output .= '<tr   class="content_list_txt2" id="order' . $i . '"><td align="left" class="content_list_txt2"><img src="images/plus.gif" onclick="showOrderDetail(' . $i . ')" id="quick' . $i . '" title="Click to Quick View">' . $id . '</td><td  class="content_list_txt2"><a href="?do=customerdetail&action=detail&userid=' . $customerid . '">' . $dispname . '</a></td><td  class="content_list_txt2">' . $purchaseddate . '</td><td  class="content_list_txt2"">' . $bilname . '</td><td   class="content_list_txt2">' . $shipname . '</td><td   class="content_list_txt2" align="right"><span class="badge badge-success">' . $currency_tocken . ' ' . '' . $amount . '</span></td><td   class="content_list_txt2">' . $dropdowndata . '</td><td class="content_list_txt1"><a href="?do=disporders&action=viewdetail&id=' . $id . '" title="View Order"><i class="icon icon-eye-open"></i></a>&nbsp;&nbsp;<a href="?do=disporders&action=detail&id=' . $id . '"><i class="icon icon-edit"></i></a>&nbsp;&nbsp;<a href="?do=disporders&action=cancel&id=' . $id . '" onclick="return confirm(\'Are you sure you want to Cancel this Order?\')"><i class="icon-trash"></i></a>&nbsp;&nbsp;<a href="javascript:window.open (\'?do=disporders&action=print&id=' . $id . '\',\'mywindow\',\'location=1,status=1,scrollbars=1,width=920,height=700\');void(0);"><i class="icon icon-print"></i> </a>&nbsp;&nbsp;<a href="?do=disporders&action=mail&id=' . $id . '"><i class="icon icon-inbox"></i> </a></td><tr>';
                } else {
                    $output .= '<tr  class="content_list_txt1" id="order' . $i . '"><td  class="content_list_txt1" align="left"><img src="images/plus.gif" onclick="showOrderDetail(' . $i . ')" id="quick' . $i . '" title="Click to Quick View">' . $id . '</td><td  class="content_list_txt1"><a href="?do=customerdetail&action=detail&userid=' . $customerid . '">' . $dispname . '</a></td><td  class="content_list_txt1">' . $purchaseddate . '</td><td  class="content_list_txt1"">' . $bilname . '</td><td class="content_list_txt1">' . $shipname . '</td><td class="content_list_txt1" align="right"><span class="badge badge-success">' . $currency_tocken . ' ' . '' . $amount . '</span></td><td class="content_list_txt1">' . $dropdowndata . '</td><td class="content_list_txt1"><a href="?do=disporders&action=viewdetail&id=' . $id . '"><i class="icon icon-eye-open"></i></a>&nbsp;&nbsp;<a href="?do=disporders&action=detail&id=' . $id . '"><i class="icon icon-edit"></i></a>&nbsp;&nbsp;<a href="?do=disporders&action=cancel&id=' . $id . '" onclick="return confirm(\'Are you sure you want to Cancel this Order?\')"><i class="icon-trash"></i></a>&nbsp;&nbsp;<a href="javascript:window.open (\'?do=disporders&action=print&id=' . $id . '\',\'mywindow\',\'location=1,status=1,scrollbars=1,width=920,height=700\');void(0);"><i class="icon icon-print"></i> </a>&nbsp;&nbsp;<a href="?do=disporders&action=mail&id=' . $id . '"><i class="icon icon-inbox"></i> </a></td><tr>';
                }
                $output .= '<tr class="clshiderow' . $i . ' dlsrow" >
				<td colspan="8" valign="top" align="center">
				<div style="display:none;background-color:#DBF3FF;" id="orderDetail' . $i . '">' . Display_DOrderManagement::getOrderDesc($result[$cnt], $orderProduct) . '</div>
				</td></tr>';
                $i++;
                $cnt++;
            }
            // $output.='<tr><td colspan="8" class="content_list_txt1" valign="top" align=center><!--<input type=submit value="Save">--></td></tr>';
        } else {
            $output .= '<tr><td colspan="9" class="content_list_txt1" valign="top" width="100%"><div class="exc_msgbox"  width="100%" style="width:900px"> No Orders Present</div></td></tr>';
        }
        $output .= '<tr>
		<td colspan="8" class="clsAlignRight">
		<div class="dt-row dt-bottom-row">
		<div class="row-fluid">
		<div class="dataTables_paginate paging_bootstrap pagination">
		<ul>' . ' ' . $prev . ' ';
        for ($i = 1; $i <= count($paging); $i++) {
            $pagingvalues .= $paging[$i] . "  ";
        }
        $output .= $pagingvalues . ' ' . $next . '</ul></div>
		</div>
		</div>
		</td>
		</tr>';
        $output .= '</tbody></table></div></div></form>';
        return $output;
    }
Ejemplo n.º 2
0
 function showChangeShipping()
 {
     $sql = "SELECT * FROM shipments_master_table WHERE  status='1'";
     $obj = new Bin_Query();
     $obj->executeQuery($sql);
     $records = $obj->records;
     $sqlOrder = "SELECT * FROM orders_table WHERE  orders_id='" . $_GET['id'] . "' ";
     $objOrder = new Bin_Query();
     $objOrder->executeQuery($sqlOrder);
     $shipping_method = $objOrder->records[0]['shipping_method'];
     $shipment_id = $objOrder->records[0]['shipment_id_selected'];
     $buyer_zipcode = $objOrder->records[0]['shipping_postcode'];
     $shipment_track_id = $objOrder->records[0]['shipment_track_id'];
     $order_ship = $objOrder->records[0]['order_ship'];
     $order_total = $objOrder->records[0]['order_total'];
     $sqlOrderPro = "SELECT * FROM order_products_table WHERE order_id='" . $_GET['id'] . "' ";
     $objOrderPro = new Bin_Query();
     $objOrderPro->executeQuery($sqlOrderPro);
     $recordsOrderPro = $objOrderPro->records;
     if (count($recordsOrderPro) > 0) {
         $totalweight = 0;
         $productWeight = '';
         $shipping_cost = '';
         $totalshipcost = 0;
         for ($i = 0; $i < count($recordsOrderPro); $i++) {
             $sqlProduct = "SELECT product_id,weight,shipping_cost FROM products_table WHERE product_id='" . $recordsOrderPro[$i]['product_id'] . "'";
             $objProduct = new Bin_Query();
             $objProduct->executeQuery($sqlProduct);
             $productWeight = $objProduct->records[0]['weight'];
             $shipping_cost = $objProduct->records[0]['shipping_cost'];
             $weight = $productWeight * $recordsOrderPro[$i]['product_qty'];
             $shipcost = $shipping_cost * $recordsOrderPro[$i]['product_qty'];
             $totalweight = $totalweight + $weight;
             $totalshipcost = $totalshipcost + $shipcost;
         }
     }
     return Display_DOrderManagement::showChangeShipping($records, $shipment_id, $buyer_zipcode, $totalweight, $totalshipcost, $shipping_method, $shipment_track_id, $order_ship, $order_total);
 }