diff --git a/app/Controllers/Invoice.php b/app/Controllers/Invoice.php index d9fe062d..e8e2f5b6 100644 --- a/app/Controllers/Invoice.php +++ b/app/Controllers/Invoice.php @@ -99,7 +99,7 @@ class Invoice extends BaseController public function load_details1() { $id = $this->request->getPost('selectedValue'); - $where = ['isactive' => 1, 'customer_id' => (int)$id]; + $where = ['customer_addresses.isactive' => 1, 'customer_addresses.customer_id' => (int)$id]; $where['address_type'] = 1; $data['customer_billing'] = $this->get_customer_address($where, []); $select = ["customer_address_id", "CONCAT(address_1,' ',address_2) as address"]; @@ -114,7 +114,7 @@ class Invoice extends BaseController { $customer_id = $this->request->getPost('customerValue'); $address_id = $this->request->getPost('selectedValue'); - $where = ['isactive' => 1, 'customer_id' => (int)$customer_id, 'address_type' => 2, 'customer_address_id' => (int)$address_id]; + $where = ['customer_addresses.isactive' => 1, 'customer_addresses.customer_id' => (int)$customer_id, 'address_type' => 2, 'customer_address_id' => (int)$address_id]; $data['customer_shipping'] = $this->get_customer_address($where, []); return $this->response->setJSON(['data' => $data]); } @@ -124,11 +124,10 @@ class Invoice extends BaseController { $model = new CustomerModel(); $model->setTable('customer_addresses'); - if (!empty($select)) { - $address_details = $model->select($select)->where($where)->findAll(); - } else { - $address_details = $model->where($where)->findAll(); + if (empty($select)) { + $select = ["customer_addresses.customer_id","customer_addresses.customer_address_id","customer_addresses.first_name","customer_addresses.last_name ","customer_addresses.company","customer_addresses.email","customer_addresses.mobile_no","customer_addresses.address_type","customer_addresses.address_1","customer_addresses.address_2","customer_addresses.city","customer_addresses.state","customer_addresses.postal_code","customer_addresses.country","states.state_name","countries.country_name"]; } + $address_details = $model->select($select)->join('states', 'states.state_short_name = customer_addresses.state AND customer_addresses.country = "IN"', 'left')->join('countries', 'countries.country_short_name = customer_addresses.country', 'left')->where($where)->findAll(); return $address_details; } diff --git a/app/Views/customer_form.php b/app/Views/customer_form.php index 81a3fff7..39037dbe 100644 --- a/app/Views/customer_form.php +++ b/app/Views/customer_form.php @@ -3,32 +3,26 @@
No subscriptions found for this customer.
No invoice found for this customer.
= $details['profile_picture']; ?>