<?php

defined('BASEPATH') OR exit('No direct script access allowed');

class Provider extends CI_Controller {

    /**
     * Index Page for this controller.
     *
     * Maps to the following URL
     * 		http://example.com/index.php/welcome
     * 	- or -
     * 		http://example.com/index.php/welcome/index
     * 	- or -
     * Since this controller is set as the default controller in
     * config/routes.php, it's displayed at http://example.com/
     *
     * So any other public methods not prefixed with an underscore will
     * map to /index.php/welcome/<method_name>
     * @see https://codeigniter.com/user_guide/general/urls.html
     */
    public function processRequest() {
        $mysql = " SELECT a.agent_name,a.street AS to_street,a.city AS to_city,a.state AS to_state,TO_CHAR(s.service_date :: TIMESTAMP, 'Day Mon dd, yyyy HH:MI AM') AS long_date,"
                . " s.quantity,a.zipcode  AS to_zipcode,a.phone AS to_phone,m.firstname,m.lastname,"
                . " p.street1 AS from_street,  p.street2 AS from_street2, p.city AS from_city,  p.zipcode AS from_zipcode , p.state AS from_state, p.country AS from_country ,m.phone AS from_phone"
                . " FROM members_service_request s "
                . " LEFT JOIN agents a ON a.id=s.agent_id "
                . " LEFT JOIN members m ON m.id=s.member_id "
                . " LEFT JOIN members_profile p ON p.member_id=m.id ";
        $q = $this->db->query($mysql);

        $data = $q->result()[0];
        $this->load->view('provider/view_confirm', $data);
    }

}

