<?php

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

class Delivery_model extends CI_Model {

    public function __construct() {
        parent::__construct();
    }

    function getdeliveryorders() {
        $this->db->select('DR.ID DRIVERID, DR.DRIVERNAME, C.ID CALLID, C.CALLERID, C.DATENEW, C.LINEID, C.MONEY, C.CUSTOMER, CU.NAME, CU.ADDRESS,
CU.ADDRESS2, D.ID, D.RECEIPT, C.STATUS');
        
        $this->db->join('DELIVERYORDERS D', 'D.CALLID=C.ID', 'LEFT');
        $this->db->join('DRIVERS DR', 'D.DRIVERID=DR.ID', 'LEFT');
        $this->db->join('CUSTOMERS CU', 'C.CUSTOMER=CU.ID', 'LEFT');
         
        $q = $this->db->get('CALLS C');
        return $q->result_array();
    }

}

