diff --git a/app/Models/InvoiceModel.php b/app/Models/InvoiceModel.php index d75a0459..0b728683 100644 --- a/app/Models/InvoiceModel.php +++ b/app/Models/InvoiceModel.php @@ -125,10 +125,12 @@ public function updateData($table, $data, $where) ->join('customers as C','C.customer_id= invoice.customer_id','left') ->join('business as B','B.business_id = invoice.business_id','left') ->join('customer_addresses as A','A.customer_id=invoice.customer_id and A.address_type=1','left') + ->join('states', 'states.state_short_name = A.state AND A.country = "IN"', 'left') + ->join('countries', 'countries.country_short_name = A.country', 'left') ->select('invoice.*,concat(C.first_name," ",C.last_name) as customer_name,A.address_1, A.address_2,A.postal_code,A.city, A.state,C.mobile_no,B.title,B.business_logo,B.terms,B.address,B.city,B.state,B.postal_code,B.email,B.mobile_no') - + ->select('states.state_name != "",states.state_name,A.state) as customer_bill_state,concat(A.address_1," ", A.address_2) as customer_bill_address,A.postal_code as customer_bill_postal_code ,A.city as customer_bill_city, countries.country_name as customer_bill_country') ->get() - ->getResult(); + ->getResult(); } // this function Also Used For Approve Notification. @@ -139,7 +141,8 @@ public function updateData($table, $data, $where) ->join('books as B', 'B.book_id = invoiceitems.product', 'left') ->join('book_categories as BC', 'BC.book_id = invoiceitems.product', 'left') ->join('category as C', 'C.id = BC.category_id', 'left') - ->select('invoiceitems.*,B.*,C.name as category_name') + ->select('invoiceitems.*,B.*,GROUP_CONCAT(C.name SEPARATOR \',\') as name') + ->groupBy('invoiceitems.invoice_child_id') //->orderBy("book_img_id", "asc") // Order by book_img_id in ascending order //->limit(1,0) ->get() @@ -195,13 +198,16 @@ public function updateData($table, $data, $where) } public function getNonMembershipCategoryBooks() { - return $this->db->table('books') + $data = $this->db->table('books') + ->select('books.*') ->join('book_categories', 'book_categories.book_id= books.book_id', 'left') ->join('category','category.id=book_categories.category_id') ->where('category.name !=', 'membership') ->groupBy('books.book_id') ->get() ->getResult(); + return $data; + } public function insertSubscriptionData($data) { diff --git a/app/Views/address_pdf_template.php b/app/Views/address_pdf_template.php index 632d118e..e45f2dfc 100644 --- a/app/Views/address_pdf_template.php +++ b/app/Views/address_pdf_template.php @@ -60,13 +60,13 @@ = $value->postal_code ?> -
To:
= $value->customer_name ?>
-= $value->address_1 ?>= $value->address_2 ?>
-= $value->city ?> = $value->state ?>
-= $value->postal_code ?>
+= $value->customer_bill_address ?>
+= $value->customer_bill_city ?> = $value->customer_bill_state ?>
+= $value->customer_bill_postal_code ?>
+= $value->customer_bill_country ?>