403Webshell
Server IP : 103.48.194.25  /  Your IP : 216.73.217.33
Web Server : Apache/2.4.6 (CentOS) OpenSSL/1.0.2k-fips PHP/7.4.33
System : Linux VMHostDefault 3.10.0-1160.42.2.el7.x86_64 #1 SMP Tue Sep 7 14:49:57 UTC 2021 x86_64
User : sieuthimay ( 1016)
PHP Version : 8.2.20
Disable Function : NONE
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : ON  |  Sudo : ON  |  Pkexec : ON
Directory :  /var/www/nguyenlieumyphamgiasi.vn/public_html/webadmin/controllers/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /var/www/nguyenlieumyphamgiasi.vn/public_html/webadmin/controllers/order.php
<?php
class Order extends CI_Controller
{
	protected $_templates;
	
	public function __construct()
	{
        parent::__construct();
	  
		 $this->pre_message ="";
		 $this->load->model('order_model','order');
		 $this->load->library('pagination_library');
		 $this->load->helper('mail_helper');
		 
		 $this->permit_library->check_permit();
		 $this->session->set_userdata(array('Url'=>uri_string()));           
	}
	
	function index()
	{
		 $this->listorder();
	}
	
	function listorder()
	{
		$data['title'] = 'Danh sách đơn hàng';
		$config['base_url'] = base_url().'order/listorder/';
		$config['total_rows'] =  $this->order->get_num_order();
		$data['num'] = $config['total_rows'];
		$config['per_page'] = 30 ;
		$config['uri_segment'] = 3 ;
		$this->pagination->initialize($config);
		$data['list'] = $this->order->get_all_order($config['per_page'],$this->uri->segment('3'));
		$data['pagination'] = $this->pagination->create_links();             
		$data['page'] = 'order/listorder';
		$this->load->view("layout/skin",$data);
	}
	
	function change_list_order()
	{
		 $status = (int)$this->input->post('status');
		 
		 $limit  =30;  
		 $data['limit'] = $limit; 
		 $offset = (int)$this->input->post('page_no'); 
		 $data['offset'] = $offset;
		 $num = $this->order->get_num_change_order($status);
		 $data['num'] =$num;
		 
		 if($offset!=0)
			  $start = ($offset - 1) * $limit;
		 else
			  $start = 0;   
		 $list =   $this->order->get_all_change_order($status,$limit,$offset);   
		
		 $data['list'] ="";
		 $k=1;
		 foreach($list as $rs):
			 $data['list'] .='
				<tr class="row'.$k.'">
					 <td><input type="checkbox" name="ar_id[]" value="'.$rs->cart_id.'"></td>
					 <td>'.anchor('order/detail/'.$rs->cart_id,'ECom-'.$rs->cart_id).'</td>
					 <td>'.$rs->cusname.'</td>
					 <td>'.$rs->pro_name.'</td>
					 <td>'.date('H:i, d/m/Y', strtotime($rs->dt_create)).'</td>
					 <td style="text-align:center;">'.$rs->nb_order.'</td>
					 <td style="text-align:center;">'.number_format($rs->pro_price).'</td>
					 <td style="text-align:center;">'.number_format($rs->pro_price * $rs->nb_order).' VNĐ</td>
					 <td align="center">
						  '.icon_edit('order/detail/'.$rs->cart_id).'
						  '.icon_del('order/del/'.$rs->cart_id.'/'.(int)$this->uri->segment(4)).'
					 </td>
				</tr>          
			 ';
			 $k=1-$k;
		 endforeach;
		 $data['pagination']   = $this->pagination_library->pagination($num,$offset,$limit,''); 
		 $data['status'] = $status;
		 echo json_encode($data);
	}
	
	function detail()
	{
		$id = (int) $this->uri->segment(3) ;
		$rs = $this->order->get_order_by_id($id);
		$data['title'] = 'Chi tiết đơn hàng: ECom-'.$rs->cart_id;
		$data['rs'] = $rs;
		$this->form_validation->set_rules('status','','');
		if($this->form_validation->run()){
		  if($this->order->saveorder()){
				$this->session->set_flashdata('message','Lưu thành công');  
		  }else{
				$this->session->set_flashdata('message','Lưu thành công');
		  }
		  redirect('order/detail/'.$this->uri->segment(3)); 
		}
		$data['page'] = 'order/detail';
		$this->load->view("layout/skin",$data);
	}
	
	function get_district()
	{
		$cityid = $this->input->post('cityid');
		$list = $this->order->get_list_district_by_city($cityid);
		$data['listcity'] ='<option value="0">Tất cả quận huyện</option>';
		foreach($list as $rs):
			 $data['listcity'] .= '<option value="'.$rs->CityID.'">'.$rs->CityName.'</option>';
		endforeach;
		$data['listcity'] .='';
		
		echo json_encode($data);
	}   
	   
	
	function changestatus()
	{
		 $status = $this->input->post('status');
		 $id = $this->input->post('id');
		 $this->db->where('cart_id',$id);
		 $rs = $this->db->get('shoppingcart')->row();
		 $total = $this->order->get_sum_price($id);
		 $this->_changestatus($status,$id,$rs->Pay_FullName,$rs->Email,$total);
	}
	
	function _changestatus($status,$id,$fullname,$email,$total)
	{
		 $data = array(
			'Status' => $status
		 );
		 $this->db->where('cart_id',$id);
		 $this->db->update('shoppingcart',$data);
		 
		 $name = '';
		 $subject = 'Thông tin đơn hàng số: '.$id.' của '.$fullname;
		 $to = $email;
		 $from = $this->config->item('contact_email');
		 $message = '<div>Xin chào quý khách.</div>';
		 $message .= '<div>Đơn hàng số '.$id.' của khách hàng đã được thay đổi hiện trạng thành <b>'.$this->get_status($status).'</b></div>';
		 $message .='<div><br><b>Thông tin đơn hàng:</b></div><br>';
		 $message .='<div>Mã đơn hàng: <b>'.$id.'</b></div>';
		 $message .='<div>Tổng giá trị: <b>'.number_format($total).'</b></div>';
		 $message .='<div>Hiện trạng: <b>'.$this->get_status($status).'</b></div>';
		 $message .='<div><br>Chúng tôi sẽ thông báo tới Email của bạn khi tình trạng đơn hàng thay đổi.</div></br>';
		 $message .= '<div>---------------------</div>';
		 $message .= '<div>'.$this->config->item('contact_name').'</div>';
		 $message .= '<div>Địa chỉ: '.$this->config->item('contact_address').'</div>';
		 $message .= '<div>Điện thoại: '.$this->config->item('contact_phone').'</div>';
		 $message .= '<div>Di động: '.$this->config->item('contact_mobile').'</div>';
		 $message .= '<div>Fax: '.$this->config->item('contact_fax').'</div>';          
		 sendmail($name,$from,$to,$subject,$message);
		 
	}
	
	/*******
	* Xóa mot dơn hang*/
	
	function del()
	{
		 $id = $this->uri->segment(3);
		 $page = $this->uri->segment(4);
			if($this->order->delete($id))
				 $this->session->set_flashdata('message','Đã xóa thành công');
			else $this->session->set_flashdata('message','Xóa không thành công');
		 redirect('order/listorder/'.$page);          
	}
	/*******
	* Xóa nhiều đơn hàng
	* 
	*/
	
	function dels()
	{
		if(!empty($_POST['ar_id']))
		{
			 $page = (int)$this->input->post('page');
			 $ar_id = $this->input->post('ar_id');
			 
			 if(!empty($_POST['btn_submit']))
			 {
				  for($i = 0; $i < sizeof($ar_id); $i ++) {
						if ($ar_id[$i]){
							 if($this->order->delete($ar_id[$i]))
								  $this->session->set_flashdata('message','Đã xóa thành công');
							 else $this->session->set_flashdata('message','Xóa không thành công');
						}
				  }
			 }
		}
		redirect('order/listorder/'.$page);          
	}
	
	function get_status($status)
	{
	  if($status == 1){
			return 'Chưa xác nhận';
	  }else if($status == 2){
			return 'Đã hủy';
	  }else if($status == 3){
			return 'Đang xử lý';
	  }else if($status == 4){
			return 'Hoàn thành';
	  }
	}
	
	/********
	* Thong ke don hang     
	*/
	function thongke()
	{
	  $data['title'] = 'Thống kê đơn hàng';
	  $this->form_validation->set_rules('tungay','Ngày bắt đầu','required');
	  $this->form_validation->set_rules('denngay','Ngày kết thúc','required');
	  if($this->form_validation->run() == false)
	  {
			$this->pre_message = validation_errors();
	  }
	  else
	  {
			$list = $this->order->get_thongke_donhang();
			ini_set('memory_limit', '100M');
			memory_get_peak_usage(true);
			require_once APPEXCEL.'excel/PHPExcel.php';
			// Create new PHPExcel object
		  
		  $this->phpexcel = new PHPExcel(); 
		  // Set properties
			$this->phpexcel->getProperties()->setCreator("Cty TNHH FYI Viet Nam")
												  ->setLastModifiedBy("Cty TNHH FYI Viet Nam")
												  ->setTitle("Thong ke san pham quang cao")
												  ->setSubject("Thong ke san pham quang cao")
												  ->setDescription("File thong ke san pham quang cao. Author: Tran Ngoc Duoc. Website:http://360vnit.com.")
												  ->setKeywords("office 2007 openxml php")
												  ->setCategory("Thong ke san pham quang cao");
			
			$this->phpexcel->getDefaultStyle()->getFont()->setName('Arial');
			$this->phpexcel->getDefaultStyle()->getFont()->setSize(10);            
			// SET HEADER FILE EXCEL
			$this->phpexcel->setActiveSheetIndex(0)->setCellValue('A1', 'Thống kê đơn hàng ECom từ '.date("d/m/Y",strtotime($this->input->post('tungay'))).' đến ngày '.date("d/m/Y",strtotime($this->input->post('denngay'))));          
			//STT
			$this->phpexcel->setActiveSheetIndex(0)->setCellValue('A3', 'STT');
			$this->phpexcel->getActiveSheet()->getColumnDimension('A')->setWidth(15); 
			//Ma don hang
			$this->phpexcel->setActiveSheetIndex(0)->setCellValue('B3', 'Tên sản phẩm'); 
			$this->phpexcel->getActiveSheet()->getColumnDimension('B')->setWidth(60); 
			// Tình trang
			$this->phpexcel->setActiveSheetIndex(0)->setCellValue('C3', 'Tình trạng');
			$this->phpexcel->getActiveSheet()->getColumnDimension('C')->setWidth(20);
			// Số lượng SP
			$this->phpexcel->setActiveSheetIndex(0)->setCellValue('D3', 'Số lượng');
			$this->phpexcel->getActiveSheet()->getColumnDimension('D')->setWidth(10);
			// Tong tien
			$this->phpexcel->setActiveSheetIndex(0)->setCellValue('E3', 'Tổng tiền (VND)'); 
			$this->phpexcel->getActiveSheet()->getColumnDimension('E')->setWidth(20);
			// Tong tien
			$this->phpexcel->setActiveSheetIndex(0)->setCellValue('F3', 'Ngày mua'); 
			$this->phpexcel->getActiveSheet()->getColumnDimension('F')->setWidth(20);
			// NV xử lý đơn hàng
			$this->phpexcel->setActiveSheetIndex(0)->setCellValue('G3', 'NVKD'); 
			$this->phpexcel->getActiveSheet()->getColumnDimension('G')->setWidth(15);                     
			// THong tin thanh toan
			$this->phpexcel->setActiveSheetIndex(0)->setCellValue('H3', 'Thông tin thanh toán'); 
			$this->phpexcel->getActiveSheet()->getColumnDimension('H')->setWidth(100);   
			// THong tin nhận hàng
			$this->phpexcel->setActiveSheetIndex(0)->setCellValue('I3', 'Thông tin nhận hàng'); 
			$this->phpexcel->getActiveSheet()->getColumnDimension('I')->setWidth(100); 
			$i=4;
			$k=1;
			foreach($list as $rs):
				//  get product name in cart
				$proname = '' ; 
				$product = $this->order->get_product_name($rs->cart_id);
				foreach($product as $pro):
					$proname .= ' * ' . $pro->pro_name ;
				endforeach; 
			
				 $this->phpexcel->setActiveSheetIndex(0)->setCellValue('A'.$i, 'ECom-'.$rs->cart_id);		//$k
				 //Ma don hang
				 $this->phpexcel->setActiveSheetIndex(0)->setCellValue('B'.$i, $proname); 
				 // Tình trang
				 $this->phpexcel->setActiveSheetIndex(0)->setCellValue('C'.$i, status($rs->Status));
				 // Số lượng SP
				 $this->phpexcel->setActiveSheetIndex(0)->setCellValue('D'.$i, $this->order->get_sum_product($rs->cart_id));
				 // Tong tien
				 $this->phpexcel->setActiveSheetIndex(0)->setCellValue('E'.$i, number_format($this->order->get_sum_price($rs->cart_id),0,'','')); 
				 // Tong tien
				 $this->phpexcel->setActiveSheetIndex(0)->setCellValue('F'.$i, date('d/m/Y',$rs->dt_create));   
				 // NVKD
				 $this->phpexcel->setActiveSheetIndex(0)->setCellValue('G'.$i, $rs->AdminName);      
				 // Thong tin thanh toan        
				 $thanhtoan = $rs->Pay_FullName;
				 $thanhtoan .= ' - '.$rs->Pay_PhoneNumber;
				 $thanhtoan .= ' - '.$rs->Pay_Address;
				 $thanhtoan .= ' - '.$this->order->get_city_by_id($rs->Pay_CityID).','.$this->order->get_country_by_id($rs->Pay_CountryID);
				 $this->phpexcel->setActiveSheetIndex(0)->setCellValue('H'.$i,$thanhtoan);           
				 // Thong tin nhan hang
				 $nhanhang = $rs->Pay_FullName;
				 $nhanhang .= ' - '.$rs->Ship_PhoneNumber;
				 $nhanhang .= ' - '.$rs->Ship_Address;
				 $nhanhang .= ' - '.$this->order->get_city_by_id($rs->Ship_CityID).','.$this->order->get_country_by_id($rs->Ship_CountryID);                
				 $this->phpexcel->setActiveSheetIndex(0)->setCellValue('I'.$i,$nhanhang);     
			$i++;
			$k++;
			endforeach;
			//set Font
			$this->phpexcel->getActiveSheet()->getStyle('A1')->getFont()->setBold(true);
			$this->phpexcel->getActiveSheet()->getStyle('A2')->getFont()->setBold(true);
	
			// Witdh
			$this->phpexcel->getActiveSheet()->getColumnDimension('A')->setWidth(5);
			$this->phpexcel->getActiveSheet()->getStyle('A1')->getFont()->setName('Tahoma');
			$this->phpexcel->getActiveSheet()->getStyle('A1')->getFont()->setSize(14); 
			$this->phpexcel->getActiveSheet()->getStyle('A2')->getFont()->setName('Tahoma');
			$this->phpexcel->getActiveSheet()->getStyle('A2')->getFont()->setSize(14);                
			// Rename sheet
			 $this->phpexcel->getActiveSheet()->setTitle('Thongke');
	
			 
			// Set active sheet index to the first sheet, so Excel opens this as the first sheet
			 $this->phpexcel->setActiveSheetIndex(0);
	
			$date = date('h_i_s_d_m_Y',time());
			// Redirect output to a client’s web browser (Excel5)
			header('Content-Type: application/vnd.ms-excel');
			header('Content-Disposition: attachment;filename="thong_ke_e_com_'.$date.'.xls"');
			header('Cache-Control: max-age=0');
	
			$objWriter = PHPExcel_IOFactory::createWriter( $this->phpexcel, 'Excel5');
			$objWriter->save('php://output');
			exit;                       
			
	  }
	  $data['message'] = $this->pre_message;
	  $data['page'] = 'order/thongke';
	  $this->load->view("layout/skin",$data);
	}
}
?>

Youez - 2016 - github.com/yon3zu
LinuXploit