diff --git a/app/Controllers/ApiIntegration.php b/app/Controllers/ApiIntegration.php index d6082689..0a9f8f8b 100644 --- a/app/Controllers/ApiIntegration.php +++ b/app/Controllers/ApiIntegration.php @@ -19,7 +19,7 @@ class ApiIntegration extends ResourceController public function __construct() { $this->global_variable_business_id = 1; - $this->global_variable_role = "online"; + $this->global_variable_role = "Online"; $api_model = new ApiIntegrationModel(); $table = 'users'; $where = ['role'=>$this->global_variable_role,'business_id'=>(int)$this->global_variable_business_id]; diff --git a/app/Controllers/Customer.php b/app/Controllers/Customer.php index bfd7f1be..11c05924 100644 --- a/app/Controllers/Customer.php +++ b/app/Controllers/Customer.php @@ -91,20 +91,15 @@ class Customer extends BaseController $session_uid = get_logged_user_id(); $session_role = get_user_role(); $model = new CustomerModel(); + $dob = $this->request->getPost('dob'); + $dob = (isset($dob) && $dob != "") ? $dob : NULL ; $data = [ 'first_name' => $this->request->getPost('cfname'), 'last_name' => $this->request->getPost('csname'), 'mobile_no' => $this->request->getPost('cmobile'), - 'address' => $this->request->getPost('address'), - 'city' => $this->request->getPost('ccity'), 'email' => $this->request->getPost('cmail'), - 'state' => $this->request->getPost('cstate'), - 'postal_code' => $this->request->getPost('czip'), - 'country' => $this->request->getPost('ccountry'), - 'date_of_birth' => $this->request->getPost('dob'), - 'gender' => $this->request->getPost('gen'), - 'profile_picture' => $this->request->getPost('cfile'), - 'mode' => $this->request->getPost('cmode'), + 'date_of_birth' => $dob, + 'mode' => "Offline", 'business_id' => $this->request->getPost('business_id') ]; @@ -308,7 +303,7 @@ class Customer extends BaseController ['value'=>'CA.state','fieldflag'=>1,'text'=> 'State','disable' => false], ['value'=>'CM.name','fieldflag'=>1,'text'=> 'Category','disable' => false], ['value'=>'I.invoice_date','fieldflag'=>2,'text'=> 'Invoice Date','disable' => false], - ['value'=>'S.to_subscription','fieldflag'=>2,'text'=> 'Due Date','disable' => false]]; + ['value'=>'S.to_subscription','fieldflag'=>2,'text'=> 'Expiry Date','disable' => false]]; $data['operator'] = [ '' => 'Choose the operator', diff --git a/app/Controllers/Event.php b/app/Controllers/Event.php index 2b883377..df5cbaa8 100644 --- a/app/Controllers/Event.php +++ b/app/Controllers/Event.php @@ -48,7 +48,7 @@ public function new_event($id) $data['page_name'] = 'Add Event'; $data['event'] = []; } else if ($id !== '0') { - $data['page_name'] = 'Edit Scheme'; + $data['page_name'] = 'Edit Event'; $model = new EventModel(); $model->setTable('events'); $edit_event_details = $model->where(['id' => $id])->first(); diff --git a/app/Controllers/Invoice.php b/app/Controllers/Invoice.php index 60a6305a..83ce4f5b 100644 --- a/app/Controllers/Invoice.php +++ b/app/Controllers/Invoice.php @@ -50,19 +50,19 @@ class Invoice extends BaseController $data['books'] = $model->getNonMembershipCategoryBooks('books', $where); if ($id === '0') { - $this->logger->info("Book Invoice: In Add Page"); + $this->logger->info("Book Invoice: In Add Details"); $data['page_name'] = 'Add Book Invoice Details'; $data['invoice_type'] = '2'; $data['invoice_details'] = []; $data['invoice_item_details'] = []; } elseif ($id !== '0') { - $this->logger->info("Book Invoice: In Edit Page ID =" . $id); + $this->logger->info("Book Invoice: In Edit Details ID =" . $id); $data['page_name'] = 'Edit Book Invoice Details'; $data['invoice_type'] ='2'; $data['invoice_details'] = $model->where(['invoice_id' => $id, 'isactive' => 1])->first(); $data['invoice_item_details'] = $this->get_invoice_item($id); } - + // print_r($data['invoice_details']);die; $this->render_page('invoice_form', $data); } diff --git a/app/Controllers/Subscription.php b/app/Controllers/Subscription.php index d67fa18b..cb9a5158 100644 --- a/app/Controllers/Subscription.php +++ b/app/Controllers/Subscription.php @@ -27,7 +27,7 @@ class Subscription extends BaseController $model = new InvoiceModel(); $data['page_name'] = 'Subscription Invoice Details'; - $data['invoice'] = $model->getJoinedData($where); + $data['invoice'] = $model->getSubscriptionInvoiceDetail($where); $this->logger->info("Invoice: Listing Count ." . count($data['invoice'])); diff --git a/app/Models/CustomerModel.php b/app/Models/CustomerModel.php index 66dc7ea6..1bdfd935 100644 --- a/app/Models/CustomerModel.php +++ b/app/Models/CustomerModel.php @@ -151,7 +151,7 @@ public function getGroupDetails() return $this->db->table('customer_groups as CG' ) ->join('users as U1', 'U1.user_id = CG.created_by', 'left') ->join('users as U2', 'U2.user_id = CG.updated_by', 'left') -->select('CG.group_id,CG.group_name,CG.created_on,CG.created_by,CG.updated_on,CG.updated_by,DATE_FORMAT(CG.created_on, "%d-%m-%Y %h:%i %p") AS formatted_created_on,concat(U1.first_name," ",U1.last_name) as created_by_name,concat(U2.first_name," ",U2.last_name) as updated_by_name,CG.isactive') +->select('CG.group_id,CG.group_name,CG.created_on,CG.created_by,CG.updated_on,CG.updated_by,DATE_FORMAT(CG.created_on, "%d/%m/%Y %h:%i %p") AS formatted_created_on,concat(U1.first_name," ",U1.last_name) as created_by_name,concat(U2.first_name," ",U2.last_name) as updated_by_name,CG.isactive') // ->where(['CG.isactive' => 1]) ->get() ->getResultArray(); diff --git a/app/Models/InvoiceModel.php b/app/Models/InvoiceModel.php index 6a64bb94..7705cefe 100644 --- a/app/Models/InvoiceModel.php +++ b/app/Models/InvoiceModel.php @@ -44,6 +44,33 @@ public function updateData($table, $data, $where) return $affected_rows; } + public function getSubscriptionInvoiceDetail($where) + { + $result = $this->getJoinedData($where); + // print_r($result);die; + if(!empty($result)){ + foreach ($result as $i => $item) { + $invoiceId = $item['invoice_id']; + $scheme_name = []; + $from_subscription = []; + $to_subscription = []; + $invoiceItems = $this->getInvoiceItems($invoiceId); + foreach ($invoiceItems as $j => $child) { + if ($child->category_name == 'Membership') { + $scheme_name[] = $child->title; + $from_subscription[] = $child->from_subscription ? date('d/m/Y', strtotime($child->from_subscription)) : ""; + $to_subscription[] = $child->to_subscription ? date('d/m/Y', strtotime($child->to_subscription)) : ""; + } + } + $result[$i]['scheme_name'] = !empty($scheme_name) ? implode(", ", $scheme_name) : ''; + $result[$i]['from_subscription'] = !empty($from_subscription) ? implode(", ", $from_subscription) : ''; + $result[$i]['to_subscription'] = !empty($to_subscription) ? implode(", ", $to_subscription) : ''; + $result[$i]['invoice_items_details'] = $invoiceItems; + } + } + return $result; + } + public function getJoinedData($where) { @@ -127,14 +154,14 @@ public function updateData($table, $data, $where) } // this function Also Used For Approve Notification. - public function getInvoiceItems($id) { $data = $this->db->table('invoiceitems') ->where(['invoice_id' => $id, 'invoiceitems.isactive' => 1]) ->join('books as B', 'B.book_id = invoiceitems.product', 'left') - // ->join('book_images as BI', 'BI.book_id = invoiceitems.product', 'left') - ->select('invoiceitems.*,B.*') + ->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') //->orderBy("book_img_id", "asc") // Order by book_img_id in ascending order //->limit(1,0) ->get() diff --git a/app/Models/NotificationModel.php b/app/Models/NotificationModel.php index 6d42bd89..352e6edc 100644 --- a/app/Models/NotificationModel.php +++ b/app/Models/NotificationModel.php @@ -41,7 +41,7 @@ class NotificationModel extends Model return $this->db->table('templates as T' ) ->join('users as U1', 'U1.user_id = T.created_by', 'left') ->join('users as U2', 'U2.user_id = T.updated_by', 'left') - ->select('T.template_id,T.template_name,T.mode,T.created_on,T.created_by,T.updated_on,T.updated_by,DATE_FORMAT(T.created_on, "%d-%m-%Y %h:%i %p") AS formatted_created_on,concat(U1.first_name," ",U1.last_name) as created_by_name,concat(U2.first_name," ",U2.last_name) as updated_by_name,T.isactive') + ->select('T.template_id,T.template_name,T.mode,T.created_on,T.created_by,T.updated_on,T.updated_by,DATE_FORMAT(T.created_on, "%d/%m/%Y %h:%i %p") AS formatted_created_on,concat(U1.first_name," ",U1.last_name) as created_by_name,concat(U2.first_name," ",U2.last_name) as updated_by_name,T.isactive') ->get()->getResultArray(); } @@ -81,7 +81,7 @@ public function getCampaignDetails(){ ->join('users as U1', 'U1.user_id = NC.created_by', 'left') ->join('users as U2', 'U2.user_id = NC.updated_by', 'left') ->join('templates as T', 'T.template_id = NC.template_id', 'left') - ->select('NC.campaign_id,NC.campaign_name,T.template_id,T.template_name,NC.mode,NC.created_on,NC.created_by,NC.updated_on,NC.updated_by,DATE_FORMAT(NC.created_on, "%d-%m-%Y %h:%i %p") AS formatted_created_on,concat(U1.first_name," ",U1.last_name) as created_by_name,concat(U2.first_name," ",U2.last_name) as updated_by_name,NC.isactive,NC.group_id,NC.scheduled_date,NC.scheduled_time') + ->select('NC.campaign_id,NC.campaign_name,T.template_id,T.template_name,NC.mode,NC.created_on,NC.created_by,NC.updated_on,NC.updated_by,DATE_FORMAT(NC.created_on, "%d/%m/%Y %h:%i %p") AS formatted_created_on,concat(U1.first_name," ",U1.last_name) as created_by_name,concat(U2.first_name," ",U2.last_name) as updated_by_name,NC.isactive,NC.group_id,NC.scheduled_date,NC.scheduled_time') ->get()->getResultArray(); if (!empty($result)) { diff --git a/app/Views/book_list.php b/app/Views/book_list.php index 854a61a8..b8616425 100644 --- a/app/Views/book_list.php +++ b/app/Views/book_list.php @@ -2,9 +2,9 @@