books,scheme,invoice

This commit is contained in:
heama 2023-10-19 10:10:32 +05:30
commit 4888e405f2
20 changed files with 878 additions and 196 deletions

View File

@ -11,7 +11,25 @@ class ApiIntegration extends ResourceController
{
use ResponseTrait;
private $global_variable_business_id;
private $global_variable_user_id;
private $global_variable_user_name;
private $global_variable_role;
public function __construct()
{
$this->global_variable_business_id = 1;
$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];
$existing_data = $api_model->getData($table, $where);
$this->global_variable_user_id = isset($existing_data[0]->user_id) ? (int)$existing_data[0]->user_id : NULL;
$this->global_variable_user_name = isset($existing_data[0]->user_id) ? $existing_data[0]->first_name." ".$existing_data[0]->last_name : NULL;
}
public function api_integration($api_request_text) {
$this->logger->info("Api Integration : UID = ".$this->global_variable_user_id." * ".$this->global_variable_user_name);
$this->logger->info("Api Integration : Request Text = ".$api_request_text);
try {
$request_data = $this->request->getVar();
@ -142,6 +160,7 @@ class ApiIntegration extends ResourceController
$primary_key_id = (int)$existing_data[0][$table_column[0]];
$this->logger->info("Api CallMethods : ".$table." its PrimaryKey ID = ".$primary_key_id);
$inactive_data['isactive'] = 0;
$inactive_data['updated_by'] = $this->global_variable_user_id;
$update_where = ['isactive' => 1, $table_column[0] => $primary_key_id];
$api_model->updateData($table, $inactive_data, $update_where);
$get_existing_child_details = $api_model->getData($table_child, $update_where);
@ -253,9 +272,10 @@ class ApiIntegration extends ResourceController
$book_data['price'] = (isset($records['sale_price']) && $records['sale_price'] != '') ? $records['sale_price'] : ((isset($records['regular_price']) && $records['regular_price'] != '') ? $records['regular_price'] : ((isset($records['price']) && $records['price'] != '') ? $records['price'] : NULL));
$book_data['sku'] = isset($records['sku']) ? $records['sku'] : NULL;
$book_data['isactive'] = (isset($records['status']) && strtolower($records['status']) === "publish") ? 1 : 0;
$book_data['business_id'] = 1;
$book_data['business_id'] = $this->global_variable_business_id;
$images = $records['images'];
if ((int)$countAll == 0) {
$book_data['created_by'] = $this->global_variable_user_id;
$insert_result = $api_model->insertData('books', $book_data);
$last_insert_book_id = $insert_result['info'];
$extensive_correspondence .= $insert_result['info'] ? "Book id : " . $insert_result['info']
@ -265,6 +285,7 @@ class ApiIntegration extends ResourceController
$insert_result['err'] ? $this->logger->error("Api SaveBookDetails : Err = ".$insert_result['err']):"";
} else {
$last_insert_book_id = $book_id;
$book_data['updated_by'] = $this->global_variable_user_id;
/** Draft status means entry must but inactive. publish means active that's why comment here
* $book_where = ['book_id' => $book_id, 'isactive' => 1, 'wp_api_product_id' => $wordpress_book_id];
**/
@ -310,7 +331,8 @@ class ApiIntegration extends ResourceController
$inactive_where = ['isactive' => 1, 'book_id' => (int)$last_insert_book_id];
$inactive_whereIn[0] = 'wp_api_img_id';
$inactive_whereIn[1] = $missingValues;
$api_model->inactiveMissingDetails('book_images', $inactive_where, $inactive_whereIn);
$data_to_batch_update = ['isactive' => 0,'updated_by'=>$this->global_variable_user_id];
$api_model->inactiveMissingDetails('book_images',$data_to_batch_update, $inactive_where, $inactive_whereIn);
}
}
}
@ -401,7 +423,8 @@ class ApiIntegration extends ResourceController
$where2 = ['isactive' => 1];
$whereIn2[0] = 'category_id';
$whereIn2[1] = $book_categories_to_inactive;
$api_model->inactiveMissingDetails('book_categories', $where2, $whereIn2);
$data_to_batch_update2 = ['isactive' => 0,'updated_by'=>$this->global_variable_user_id];
$api_model->inactiveMissingDetails('book_categories',$data_to_batch_update2, $where2, $whereIn2);
//echo $api_model->getlastQuery();
}
} // loop closed
@ -478,13 +501,14 @@ class ApiIntegration extends ResourceController
$customer_data['email'] = $records['email'];
$customer_data['profile_picture'] = $records['avatar_url'];
$customer_data['wp_api_customer_id'] = $wordpress_customer_id;
$customer_data['mode'] = 'online';
$customer_data['business_id'] = 1;
$customer_data['mode'] = $this->global_variable_role;
$customer_data['business_id'] = $this->global_variable_business_id;
$billing = $records['billing'];
$shipping = $records['shipping'];
if ((int)$countAll == 0) {
$customer_data['created_by'] = $this->global_variable_user_id;
$insert_result = $api_model->insertData('customers', $customer_data);
$last_insert_customer_id = $insert_result['info'];
$extensive_correspondence .= $insert_result['info'] ? "Customer id : " . $insert_result['info']
@ -493,6 +517,7 @@ class ApiIntegration extends ResourceController
$insert_result['info'] ? $this->logger->info("Api SaveCustomerDetails : Customer id = ".$insert_result['info']):"";
$insert_result['err'] ? $this->logger->error("Api SaveCustomerDetails : Err = ".$insert_result['err']):"";
} else {
$customer_data['updated_by'] = $this->global_variable_user_id;
$last_insert_customer_id = $customer_id;
$customer_where = ['customer_id' => $customer_id, 'isactive' => 1, 'wp_api_customer_id' => $wordpress_customer_id];
$update_result = $api_model->updateData('customers', $customer_data, $customer_where);
@ -545,7 +570,8 @@ class ApiIntegration extends ResourceController
$inactive_where = ['isactive' => 1, 'customer_id' => (int)$last_insert_customer_id,'address_type'=>1];
$inactive_whereIn[0] = 'address_1';
$inactive_whereIn[1] = $missingBillingValues;
$api_model->inactiveMissingDetails('customer_addresses', $inactive_where, $inactive_whereIn);
$data_to_batch_update = ['isactive' => 0,'updated_by'=>$this->global_variable_user_id];
$api_model->inactiveMissingDetails('customer_addresses',$data_to_batch_update, $inactive_where, $inactive_whereIn);
}
}
}
@ -626,7 +652,8 @@ class ApiIntegration extends ResourceController
$inactive_where = ['isactive' => 1, 'customer_id' => (int)$last_insert_customer_id, 'address_type'=>2];
$inactive_whereIn[0] = 'address_1';
$inactive_whereIn[1] = $missingShippingValues;
$api_model->inactiveMissingDetails('customer_addresses', $inactive_where, $inactive_whereIn);
$data_to_batch_update = ['isactive' => 0,'updated_by'=>$this->global_variable_user_id];
$api_model->inactiveMissingDetails('customer_addresses',$data_to_batch_update, $inactive_where, $inactive_whereIn);
$this->logger->info("Api SaveCustomerDetails : Missing Shipping " .implode(",",$missingShippingValues)." Are inactived");
}
}
@ -715,20 +742,30 @@ class ApiIntegration extends ResourceController
if(isset($records['billing']) && gettype($records['billing']) === 'object') {$billing_array = [$records['billing']];}
if(isset($records['shipping']) && gettype($records['shipping']) === 'object') {$shipping_array = [$records['shipping']];}
$where = ['wp_api_customer_id' => (int)$records['customer_id'], 'isactive' => 1];
$local_customer = $api_model->getData('customers', $where);
$local_customer_id = !empty($local_customer) ? $local_customer[0]->customer_id : NULL;
$this->logger->info((!empty($local_customer)) ? "Api SaveSalesDetails : in wordpress customer ref ID = ".$records['customer_id']." is available on Customer table and its PrimaryKey = ".$local_customer_id."(local customer id)" : "Api SaveSalesDetails : in wordpress customer ref ID = ".$records['customer_id']." Not available on Customer table");
if (count($billing_array) > 0) {
foreach ($billing_array as $bill) {
if($bill->first_name != ""){
$billing_addr = "<span>".$bill->address_1 .",". $bill->address_2 ."<br> </span><span>".$bill->city." ".$bill->postcode."<br></span><span>".$bill->state." ".$bill->country.".<br></span>";
}
}
// foreach ($billing_array as $bill) {
// if($bill->first_name != ""){
// $billing_addr = $bill->address_1 . " " . $bill->address_2 . ",\n" . $bill->city . ",\n" . $bill->state . " - " . $bill->postal_code . ",\n" . $bill->country . ".";
// }
// }
$result_billing_addr = $this->save_invoice_address_in_customer_address($billing_array,1,(int)$local_customer_id);
$billing_addr_id = $result_billing_addr['addr_id'];
$billing_addr = $result_billing_addr['addr'];
}
if (count($shipping_array) > 0) {
foreach ($shipping_array as $ship) {
if($ship->first_name != ""){
$shipping_addr = "<span>".$ship->address_1 .",". $ship->address_2 ."<br> </span><span>".$ship->city." ".$ship->postcode."<br></span><span>".$ship->state." ".$ship->country.".<br></span>";
}
}
// foreach ($shipping_array as $ship) {
// if($ship->first_name != ""){
// $shipping_addr = $ship->address_1 . " " . $ship->address_2 . ",\n" . $ship->city . ",\n" . $ship->state . " - " . $ship->postal_code . ",\n" . $ship->country . ".";
// }
// }
$result_shipping_addr = $this->save_invoice_address_in_customer_address($shipping_array,2,(int)$local_customer_id);
$shipping_addr_id = $result_shipping_addr['addr_id'];
$shipping_addr = $result_shipping_addr['addr'];
}
if (count($records['line_items']) > 0) {
@ -744,9 +781,7 @@ class ApiIntegration extends ResourceController
$subtotal = $lineitems_subtotal + (float)$records['shipping_total'];
$tax = $lineitems_tax + (float)$records['shipping_tax'];
$total = ($lineitems_total)+(float)$records['shipping_total'] + (float)$records['shipping_tax'];
$where = ['wp_api_customer_id' => (int)$records['customer_id'], 'isactive' => 1];
$local_customer = $api_model->getData('customers', $where);
$local_customer_id = !empty($local_customer) ? $local_customer[0]->customer_id : "";
$invoice_data['invoice_id']=$invoice_id;
$invoice_data['invoice_number']=$records['number'];
@ -762,16 +797,16 @@ class ApiIntegration extends ResourceController
$invoice_data['order_number']=$records['order_key'];
$invoice_data['payment_method']=$records['payment_method_title'];
$invoice_data['event_id']=NULL;
$invoice_data['business_id']=1;
$invoice_data['business_id']=$this->global_variable_business_id;
$invoice_data['shipping_address']=$shipping_addr;
$invoice_data['shipping_address_id']=NULL;
$invoice_data['shipping_address_id']=$shipping_addr_id;
$invoice_data['billing_address']=$billing_addr;
$invoice_data['billing_address_id'] =NULL;
$invoice_data['billing_address_id'] =$billing_addr_id;
$invoice_data['shipping_charge'] = isset($records['shipping_total'])?$records['shipping_total']:NULL;
$invoice_data['notes'] = isset($records['customer_note'])?$records['customer_note']:NULL;
$invoice_data['invoice_type'] = 1;
if ((int)$countAll == 0) {
$invoice_data['created_by'] = $this->global_variable_user_id;
$insert_result = $api_model->insertData('invoice', $invoice_data);
$last_insert_invoice_id = $insert_result['info'];
$extensive_correspondence .= $insert_result['info'] ? "Invoice id : " . $insert_result['info']
@ -782,6 +817,7 @@ class ApiIntegration extends ResourceController
} else {
$last_insert_invoice_id = $invoice_id;
$customer_where = ['invoice_id' => $invoice_id, 'isactive' => 1, 'wp_api_order_id' => $wordpress_order_id];
$invoice_data['updated_by'] = $this->global_variable_user_id;
$update_result = $api_model->updateData('invoice', $invoice_data, $customer_where);
$extensive_correspondence .= $update_result['info'] ? "Invoice id : " . $last_insert_invoice_id . " ( " . $update_result['info'] . ")"
: " ( Err :" . $update_result['err'] . ")";
@ -829,7 +865,8 @@ class ApiIntegration extends ResourceController
$inactive_where = ['isactive' => 1, 'invoice_id' => (int)$last_insert_invoice_id];
$inactive_whereIn[0] = 'wp_api_line_items_id';
$inactive_whereIn[1] = $missingValues;
$api_model->inactiveMissingDetails('invoiceitems', $inactive_where, $inactive_whereIn);
$data_to_batch_update = ['isactive' => 0,'updated_by'=>$this->global_variable_user_id];
$api_model->inactiveMissingDetails('invoiceitems',$data_to_batch_update, $inactive_where, $inactive_whereIn);
}
}
}
@ -890,7 +927,7 @@ class ApiIntegration extends ResourceController
$subscription_data[$x]['from_subscription'] = $fromDate;
$subscription_data[$x]['to_subscription'] = $toDate;
$subscription_data[$x]['mode'] = $result_book_category[$x]['category_name'];
$subscription_data[$x]['business_id']=1;
$subscription_data[$x]['business_id']=$this->global_variable_business_id;
$this->logger->info("Api SaveSalesDetails : Subscription Data inx = $x Request data = ".json_encode($subscription_data));
}
}
@ -1089,7 +1126,7 @@ class ApiIntegration extends ResourceController
$book_category_data[$a]['id'] = $masterCategoryId;
$book_category_data[$a]['name'] = $r->name;
$book_category_data[$a]['wp_api_category_id'] = $r->id;
$book_category_data[$a]['business_id'] = 1;
$book_category_data[$a]['business_id'] = $this->global_variable_business_id;
$book_category_data[$a]['parent_wp_api_category_id'] = NULL;
$a++;
$this->logger->info("Api SaveCategoriesMasterDetails : Categories Data = $a Request data to save on master category = " . json_encode($book_category_data));
@ -1101,4 +1138,61 @@ class ApiIntegration extends ResourceController
$this->logger->error("Api SaveCategoriesMasterDetails : Err = Categories Data Not Found");
}
}
public function save_invoice_address_in_customer_address($request_addr_array,$flag,$customer_id){
$this->logger->info("Api saveInvoiceAddressInCustomerAddress = ".json_encode($request_addr_array));
$this->logger->info("Api saveInvoiceAddressInCustomerAddress Flag = ".$flag." Customer Id = ".$customer_id);
$api_model = new ApiIntegrationModel();
$where = ['customer_id' =>$customer_id,'address_type'=>$flag,
'first_name'=>$request_addr_array[0]->first_name,'last_name'=>$request_addr_array[0]->last_name,
'address_1'=>$request_addr_array[0]->address_1,'address_2'=>$request_addr_array[0]->address_2,
'city'=>$request_addr_array[0]->city,'state'=>$request_addr_array[0]->state,
'postal_code'=>$request_addr_array[0]->postcode];
$existing_addr = $api_model->getData('customer_addresses', $where);
$this->logger->info("Api saveInvoiceAddressInCustomerAddress Count = ".count($existing_addr));
$final_array['addr_id'] = NULL;
$final_array['addr'] = NULL;
$addr_data = [];
if (!empty($existing_addr)) {
$final_array['addr_id'] = isset($existing_addr) && !empty($existing_addr) ? $existing_addr[0]->customer_address_id : NULL;
$this->logger->info("Api saveInvoiceAddressInCustomerAddress Ex Addr id = ".$final_array['addr_id']);
if($existing_addr[0]->first_name != ""){
$final_array['addr'] = $existing_addr[0]->address_1 . " " . $existing_addr[0]->address_2 . ",\n" . $existing_addr[0]->city . ",\n" . $existing_addr[0]->state . " - " . $existing_addr[0]->postal_code . ",\n" . $existing_addr[0]->country . ".";
}
$this->logger->info("Api saveInvoiceAddressInCustomerAddress Ex Addr = ".$final_array['addr']);
}
if (empty($existing_addr)) {
foreach ($request_addr_array as $addr) {
if($addr->first_name != ""){
$addr_data['first_name'] = $addr->first_name;
$addr_data['last_name'] = $addr->last_name;
$addr_data['company'] = $addr->company;
$addr_data['address_1'] = $addr->address_1;
$addr_data['address_2'] = $addr->address_2;
$addr_data['city'] = $addr->city;
$addr_data['state'] = $addr->state;
$addr_data['country'] = $addr->country;
$addr_data['postal_code'] = $addr->postcode;
$addr_data['email'] = isset($addr->email)? $addr->email:"";
$addr_data['mobile_no'] = isset($addr->phone)?$addr->phone:"";
$addr_data['customer_id'] = $customer_id;
$addr_data['address_type'] = $flag;
$addr_data['customer_address_id'] = NULL;
$addr_data['created_by'] = $this->global_variable_user_id;
$final_array['addr'] = $addr->address_1 . " " . $addr->address_2 . ",\n" . $addr->city . ",\n" . $addr->state . " - " . $addr->postcode . ",\n" . $addr->country . ".";
}
}
$this->logger->info("Api saveInvoiceAddressInCustomerAddress New Addr = ".$final_array['addr']);
if(!empty($addr_data)){
$insert_result = $api_model->insertData('customer_addresses',$addr_data);
$final_array['addr_id'] = $insert_result['info'];
$this->logger->info("Api saveInvoiceAddressInCustomerAddress New Addr id = ".$final_array['addr_id']);
}
}
return $final_array;
}
}

View File

@ -63,6 +63,7 @@ class Books extends BaseController
## For inserting/updating details of book
public function insert_books()
{
try{
helper('session');
$session_uid = get_logged_user_id();
$session_bid = get_business_id();
@ -125,6 +126,13 @@ class Books extends BaseController
}
// print_r($bookId); print_r($imageData); print_r($category_id);die;
if ($BooksModel->insert($data)) {
session()->setFlashdata('success', 'Book has been added successfully.');
$this->logger->info("Books: has been added successfully. Inserted ID = " . $BooksModel->insertID());
} else {
session()->setFlashdata('error', 'Book could not be added. Please try again..');
$this->logger->error("Books: Err could not be added. Please try again.");
}
} else {
// It's an update operation
$isactive = $this->request->getPost('isactive');
@ -142,6 +150,17 @@ class Books extends BaseController
// Insert the book-category association into the book_categories table
$BooksModel->db->table('book_categories')->insert(['book_id' => $book_id, 'category_id' => $category_id]);
}
if ($BooksModel->update($book_id, $data)) {
session()->setFlashdata('success', 'Book has been updated successfully.');
$this->logger->info("Books: has been updated successfully. Updated Book ID = " . $book_id);
} else {
session()->setFlashdata('error', 'Book update failed. Please try again.');
$this->logger->error("Books: Err Failed to update ID =" . $book_id);
}
}
} catch (\Exception $e) {
$this->logger->error("Book: Err Occur = ".$e->getMessage()." File = ". $e->getFile() . " Line = " . $e->getLine());
session()->setFlashdata('error', 'Message: ' . $e->getMessage());
}
return redirect()->route('book_list');
@ -150,21 +169,55 @@ class Books extends BaseController
## For delete the book details (Which means inactive the details)
public function delete_books($id)
{
helper('session');
$session_uid = get_logged_user_id();
$BooksModel = new BooksModel();
$existingBook = $BooksModel->find($id);
if (!$existingBook) {
return redirect()->route('book_list');
try {
helper('session');
$session_uid = get_logged_user_id();
$BooksModel = new BooksModel();
$where = ['book_id' => (int)$id, 'isactive =' => 1];
// $existingBook = $BooksModel->find($id);
$existingBook = $BooksModel->where($where)->find($id);
if ($existingBook) {
$this->logger->Info("BOOK: Going to Inactive ID = ".$id);
$data = ['isactive' => 0 , 'updated_by' => $session_uid];
if ($BooksModel->update($id, $data)) {
$activeBookImages = $BooksModel->getData('book_images', $where);
if(!empty($activeBookImages)){
for ($y = 0; $y < count($activeBookImages); $y++) {
$bookImgIds[$y] = $activeBookImages[$y]->book_img_id;
}
if(!empty($bookImgIds)){
$this->logger->Info("BOOK: Images Going to Inactived = ".implode(" ",$bookImgIds));
$inactive_img_whereIn[0] = 'book_img_id';
$inactive_img_whereIn[1] = $bookImgIds;
$BooksModel->inactiveMissingDetails('book_images',$data,$where, $inactive_img_whereIn);
}
}
$activeBookCategory = $BooksModel->getData('book_categories', $where);
if(!empty($activeBookCategory)){
for ($z = 0; $z < count($activeBookCategory); $z++) {
$bookCategoryIds[$z] = $activeBookCategory[$z]->id;
}
if(!empty($bookCategoryIds)){
$this->logger->Info("BOOK: Categories Going to Inactived = ".implode(" ",$bookCategoryIds));
$inactive_category_whereIn[0] = 'id';
$inactive_category_whereIn[1] = $bookCategoryIds;
$BooksModel->inactiveMissingDetails('book_categories',$data,$where, $inactive_category_whereIn);
}
}
session()->setFlashdata('success', 'Deleted successfully.');
$this->logger->info("BOOK: has been Inactived successfully. Inactived ID = " . $id);
} else {
$this->logger->error("BOOK: Not able to Inactive ID =" . $id);
throw new \Exception("Data Not able to Deleted");
}
}
} catch (\Exception $e) {
$this->logger->error("Book: Err Occur = ".$e->getMessage()." File = ". $e->getFile() . " Line = " . $e->getLine());
session()->setFlashdata('error', 'Message: ' . $e->getMessage());
}
$data['isactive'] = 0;
$data['updated_by'] = $session_uid;
$BooksModel->update($id, $data);
return redirect()->route('book_list');
}
}

View File

@ -22,6 +22,13 @@ class Home extends BaseController
$model = new HomeModel();
$data['customer'] = $model->customers($where);
$data['customer']['label'] = "Customer";
$data['invoice'] = $model->invoice();
$data['active_category'] = $model->schemes();
$data['expiring_membership'] = $model->expiring_membership_list();
// $data['active_category'] = array_filter($model->schemes(), function ($element) {
// return $element['count'] !== '0' ;
// });
$data['book_published'] = $model->book_published_list();
$this->render_page('dashboard', $data);
}

View File

@ -432,6 +432,13 @@ class Invoice extends BaseController
$tax = "";
$total_amount = "";
$payment_method = "";
$business_name= "";
$business_address= "";
$business_city= "";
$business_state= "";
$business_postal_code= "";
$business_email= "";
$business_mobile_no= "";
if (isset($details)) {
$this->logger->info("Invoice: approve notification Request data type = ".gettype($details));
}
@ -449,6 +456,13 @@ class Invoice extends BaseController
$tax = $rec['tax'];
$total_amount = $rec['total_amount'];
$payment_method = $rec['payment_method'];
$business_name= $rec['business_name'];
$business_address= $rec['business_address'];
$business_city= $rec['business_city'];
$business_state= $rec['business_state'];
$business_postal_code= $rec['business_postal_code'];
$business_email= $rec['business_email'];
$business_mobile_no= $rec['business_mobile_no'];
}
$records['invoice_order_number'] = $reference_number;
$records['invoice_serial_number'] = $invoice_serial_number;
@ -479,12 +493,12 @@ class Invoice extends BaseController
</ul><br>
<p>Best regards,</p>
<ul style='list-style: none;'>
<li>VijayaBharathamBooks,</li>
<li>Sri Kasi, 12, M.V. Naidu Street, Chetpet, Chennai.</li>
<li>Call Us: +91 89391 49466</li>
<li>Email Us: contact@vijayabharathambooks.com</li></body></html>";
<li>".$business_name.",</li>
<li>".$business_address." ".$business_city." ".$business_state." - ".$business_postal_code."</li>
<li>Call Us: +91 ".$business_mobile_no."</li>
<li>Email Us: ".$business_email."</li></body></html>";
$template = "Dear " . $recipient_name . ",\r\r\n\nYour Invoice has been approved.\n\nDetails:\r\n- Approval Date: " . $approval_date . "\r\n- Approved By: " . $approved_by . "\r\n- Reference ID: " . $reference_number . "\r\n\nBest regards,\nVijayaBharathamBooks,\nSri Kasi, 12, M.V. Naidu Street, Chetpet, Chennai.\nCall Us: +91 89391 49466\nEmail Us: contact@vijayabharathambooks.com";
$template = "Dear " . $recipient_name . ",\r\r\n\nYour Invoice has been approved.\n\nDetails:\r\n- Approval Date: " . $approval_date . "\r\n- Approved By: " . $approved_by . "\r\n- Reference ID: " . $reference_number . "\r\n\nBest regards,\n".$business_name.",\n".$business_address." ".$business_city." ".$business_state." - ".$business_postal_code.".\nCall Us: +91 ".$business_mobile_no."\nEmail Us:".$business_email;
$params = (object) Null;
$params->number = (int)'91' . $recipient_mobile;

View File

@ -3,12 +3,13 @@
namespace App\Controllers;
use App\Helpers\NotificationHelper;
use App\Models\NotificationModel;
class Notifications extends BaseController
{
## Email Section :
public function mail_custom_notifications()
public function mail_custom_notificationsi()
{
$request = \Config\Services::request();
if ($request->is('post')) {
@ -70,4 +71,68 @@ class Notifications extends BaseController
$data['page_name'] = 'Custom Notifications';
$this->render_page('notifications_form', $data);
}
// public function due_date_notifications()
public function mail_custom_notifications()
{
$model = new NotificationModel();
$details = $model->getSubscriptionDueDetail();
$records = [];
$recipient_name = "";
$recipient_email = "";
$recipient_mobile = "";
$subscription_name = "";
$business_name= "";
$to_subscription= "";
if (isset($details)) {
$this->logger->info("Notification : Duedate notification Request data type = ".gettype($details));
}
helper('notification');
$notification = new NotificationHelper();
foreach ($details as $rec) {
$recipient_name = $rec['customer_name'];
$recipient_email = $rec['customer_email'];
$recipient_mobile = $rec['customer_mobile'];
// $recipient_email = "sanjeev.p@venbainfotech.com";
// $recipient_mobile = 6369084112;
$business_name= $rec['business_name'];
$subscription_name = $rec['title'];
$to_subscription= $rec['to_subscription'];
}
$records['template_name'] = '';
$records['recipient_name'] = $recipient_name;
$records['recipient_email'] = $recipient_email ? $recipient_email : "sanjeev.p@venbainfotech.com";
$records['subject'] = $business_name ." - Due Date Reminder";
$records['description'] = "<!DOCTYPE html>
<html>
<head><title>Due Date Reminder</title></head>
<body>
<p>Hello ".$recipient_name.",</p>
<p>This is a reminder that the following subscription is due soon:</p>
<p><strong>Subscription Name:</strong>".$subscription_name." </p>
<p><strong>Due Date:</strong> ".$to_subscription."</p>
<p>Please make sure to complete this subscription on time.</p>
<p>Thank you.</p>
</body>
</html>";
$template = "Hello " . $recipient_name . ",\r\r\n\nThis is a reminder that the following subscription is due soon:\r\n- Subscription Name: " . $subscription_name . "\r\n Due Date: " . $to_subscription . "\r\n\nPlease make sure to complete this subscription on time.\n Thank you.";
$params = (object) Null;
$params->number = (int)'91' . $recipient_mobile;
$params->type = "text";
$params->message = $template;
$params->instance_id = WAAI_INSTANCE;
$params->access_token = WAAI_TOKEN;
$this->logger->info("Notification : Duedate notification Email Request data = ".json_encode($records));
$email_result = $notification->sendEmail($records);
$this->logger->info("Notification : Duedate notification Email Response = " . json_encode($email_result));
$this->logger->info("Notification : Duedate notification Whatsapp Request data = ".json_encode($params));
$whatsapp_result = $notification->sendWhatsAppMessage(SEND_WAAI_URL, "POST", $params);
$this->logger->info("Notification : Duedate notification Whatsapp Response = " . json_encode($whatsapp_result));
}
}

View File

@ -60,6 +60,7 @@ class Scheme extends BaseController
## For inserting/updating details of scheme
public function insert_scheme()
{
try{
helper('session');
$session_bid = get_business_id();
$session_uid = get_logged_user_id();
@ -79,30 +80,32 @@ class Scheme extends BaseController
if (empty($scheme_id)) {
// It's an insert operation
$data['isactive'] = 1;
$data['created_by'] = $session_uid;
$SchemeModel->insert($data);
// $last_inserted_id = 100;
$last_inserted_id = $SchemeModel->insertID();
// Retrieve the category name 'membership'
$category_name = 'membership';
// Find the category ID for 'membership' from the category table
$db = db_connect();
$category = $db->table('category')
->select('id')
->where('name', $category_name)
->get()
->getRow();
// Check if the category exists
if ($category) {
// Insert data into book_categories table
$db->table('book_categories')->insert([
'book_id' => $last_inserted_id,
'category_id' => $category->id
]);
if ($SchemeModel->insert($data)) {
$last_inserted_id = $SchemeModel->insertID();
// Retrieve the category name 'membership'
$category_name = 'membership';
// Find the category ID for 'membership' from the category table
$db = db_connect();
$category = $db->table('category')
->select('id')
->where('name', $category_name)
->get()
->getRow();
// Check if the category exists
if ($category) {
// Insert data into book_categories table
$db->table('book_categories')->insert([
'book_id' => $last_inserted_id,
'category_id' => $category->id,
'created_by' => $session_uid
]);
}
session()->setFlashdata('success', 'Scheme has been added successfully.');
$this->logger->info("Scheme: has been added successfully. Inserted ID = " . $last_inserted_id);
} else {
session()->setFlashdata('error', 'Scheme could not be added. Please try again..');
$this->logger->error("Scheme: Err could not be added. Please try again.");
}
if (!empty($_FILES['img_name']['name'])) {
// A new image has been uploaded
@ -134,36 +137,59 @@ class Scheme extends BaseController
$data['updated_by'] = $session_uid;
$SchemeModel->update($scheme_id, $data);
if ($SchemeModel->update($scheme_id, $data)) {
session()->setFlashdata('success', 'Scheme has been updated successfully.');
$this->logger->info("Scheme: has been updated successfully. Updated Scheme ID = " . $scheme_id);
} else {
session()->setFlashdata('error', 'Scheme update failed. Please try again.');
$this->logger->error("Scheme: Err Failed to update ID =" . $scheme_id);
}
}
} catch (\Exception $e) {
$this->logger->error("Scheme: Err Occur = ".$e->getMessage()." File = ". $e->getFile() . " Line = " . $e->getLine());
session()->setFlashdata('error', 'Message: ' . $e->getMessage());
}
return redirect()->route('scheme_list');
}
## For delete the Scheme details (Which means inactive the details)
public function delete_scheme($id)
{
$SchemeModel = new SchemeModel();
// Check if the business ID exists
$existingScheme = $SchemeModel->find($id);
if (!$existingScheme) {
// return redirect()->to(base_url('Business/index'))->with('error', 'Business not found.');
return redirect()->route('scheme_list');
try {
helper('session');
$session_uid = get_logged_user_id();
$SchemeModel = new SchemeModel();
$where = ['book_id' => (int)$id, 'isactive =' => 1];
// $existingScheme = $SchemeModel->find($id);
$existingScheme = $SchemeModel->where($where)->find($id);
if ($existingScheme) {
$this->logger->Info("Scheme: Going to Inactive ID = ".$id);
$data = ['isactive' => 0 , 'updated_by' => $session_uid];
if ($SchemeModel->update($id, $data)) {
$activeSchemeCategory = $SchemeModel->getData('book_categories', $where);
if(!empty($activeSchemeCategory)){
for ($z = 0; $z < count($activeSchemeCategory); $z++) {
$SchemeCategoryIds[$z] = $activeSchemeCategory[$z]->id;
}
if(!empty($SchemeCategoryIds)){
$this->logger->Info("Scheme: Categories Going to Inactived = ".implode(" ",$SchemeCategoryIds));
$inactive_category_whereIn[0] = 'id';
$inactive_category_whereIn[1] = $SchemeCategoryIds;
$SchemeModel->inactiveMissingDetails('book_categories',$data,$where, $inactive_category_whereIn);
}
}
session()->setFlashdata('success', 'Deleted successfully.');
$this->logger->info("Scheme: has been Inactived successfully. Inactived ID = " . $id);
} else {
$this->logger->error("Scheme: Not able to Inactive ID =" . $id);
throw new \Exception("Data Not able to Deleted");
}
}
} catch (\Exception $e) {
$this->logger->error("Scheme: Err Occur = ".$e->getMessage()." File = ". $e->getFile() . " Line = " . $e->getLine());
session()->setFlashdata('error', 'Message: ' . $e->getMessage());
}
helper('session');
$session_uid = get_logged_user_id();
// Delete the business record
$data['isactive'] = 0;
$data['updated_by'] = $session_uid;
//echo 'id='.$id;
print_r($data);
//die();
$SchemeModel->update($id, $data);
// print_r($data);die();
//$BusinessModel->delete($id);
// return redirect()->to(base_url('Business/index'))->with('success', 'Business deleted successfully.');
return redirect()->route('scheme_list');
}
}

View File

@ -83,9 +83,21 @@ class ApiIntegrationModel extends Model
return $text;
}
public function inactiveMissingDetails($table_name,$where,$whereIn){
$dataToUpdate = ['isactive' => 0];
$this->db->table($table_name)->where($where)->whereIn($whereIn[0],$whereIn[1])->update($dataToUpdate);
// public function inactiveMissingDetails($table_name,$where,$whereIn){
// $dataToUpdate = ['isactive' => 0];
// $this->db->table($table_name)->where($where)->whereIn($whereIn[0],$whereIn[1])->update($dataToUpdate);
// }
public function inactiveMissingDetails($table_name,$dataToUpdate,$where = null,$whereIn = null)
{
$this->db->table($table_name);
$query = $this->db->table($table_name);
if ($where) {
$query->where($where);
}
if ($whereIn) {
$query->whereIn($whereIn[0], $whereIn[1]);
}
$query->update($dataToUpdate);
}
public function getBookCategories($product_id){

View File

@ -92,4 +92,30 @@ public function insertImage($imageData)
}
public function getData($table, $where = null,$whereIn = null)
{
$query = $this->db->table($table);
if ($where) {
$query->where($where);
}
if($whereIn){
// $query->whereIn($column_name,$missingValues)
$query->whereIn($whereIn[0],$whereIn[1]);
}
return $query->get()->getResult();
}
public function inactiveMissingDetails($table_name,$dataToUpdate,$where = null,$whereIn = null)
{
$this->db->table($table_name);
$query = $this->db->table($table_name);
if ($where) {
$query->where($where);
}
if ($whereIn) {
$query->whereIn($whereIn[0], $whereIn[1]);
}
return $query->update($dataToUpdate);
}
}

View File

@ -9,6 +9,7 @@ class CustomerModel extends Model
{
protected $table = 'customers';
protected $primaryKey = 'customer_id ';
// protected $allowedFields = ['customer_id ','first_name','city','last_name','email','mobile_no','country','state','postal_code' ,'address','profile_picture','date_of_birth','gender','mode','isactive','business_id'];
protected $allowedFields = ['customer_id ','first_name','city','last_name','email','mobile_no','country','state','postal_code' ,'address','profile_picture','date_of_birth','gender','mode','type','isactive','business_id','created_by','updated_by'];
public function insertCustomer($data)

View File

@ -24,4 +24,71 @@ class HomeModel extends Model
$customer['today'] = $todayCustomers;
return $customer;
}
public function invoice() {
if (date('m') <= 3) {
$invoice['financial_year'] = (date('Y')-1) . '-' . date('Y');
$start_date = (date('Y')-1).'-04-01';
$end_date = date('Y').'-03-31';
} else {
$invoice['financial_year'] = date('Y') . '-' . (date('Y') + 1);
$start_date = date('Y').'-04-01';
$end_date = (date('Y')+1).'-03-31';
}
$date_where = ['DATE(created_on)' => date('Y-m-d'),'isactive'=>1];
$date_query = $this->db->table('invoice')->where($date_where)->countAllResults();
$month_where = ['MONTH(created_on)' => date('m'),'isactive'=>1];
$month_query = $this->db->table('invoice')->where($month_where)->countAllResults();
$fin_year_where = ['DATE(created_on) >= ' => $start_date , 'DATE(created_on) <= ' => $end_date,'isactive'=>1];
$fin_year_query = $this->db->table('invoice')->where($fin_year_where)->countAllResults();
$invoice['today'] = $date_query;
$invoice['month'] = $month_query;
$invoice['year'] = $fin_year_query;
return $invoice;
}
public function schemes(){
$query = $this->db->table('category AS C')
->select('C.id,C.name,LEFT(C.name, 1) AS first_letter, COUNT(S.customer_id) AS count')
->join('subscription AS S', 'C.id = S.scheme_id', 'left')
->where(['C.isactive'=>1,'C.business_id'=>1])
->groupBy('C.id, S.scheme_id');
$results = $query->get()->getResultArray();
return $results;
}
public function expiring_membership_list(){
$now = date('Y-m-d');
$last30days = date('Y-m-d', strtotime('+30 days'));
return $this->db->table('subscription as S')
->join('customers as C', 'C.customer_id = S.customer_id', 'left')
->join('category as CM', 'CM.id = S.scheme_id', 'left')
->join('book_categories as BC', 'BC.category_id = S.scheme_id', 'left')
->join('books as BK', 'BC.book_id = BK.book_id', 'left')
->select('CM.name, CONCAT(C.first_name, " ", C.last_name) as customer_name, C.email as customer_email, C.mobile_no as customer_mobile, S.sub_id, S.scheme_id, S.customer_id, S.from_subscription, S.to_subscription, S.business_id, S.to_subscription, S.from_subscription, BK.title, BK.book_id,DATEDIFF(S.to_subscription, CURDATE()) as countdays')
->where('S.to_subscription >=', $now)
->where('S.to_subscription <=', $last30days)
->where('BC.category_id', 5)
->groupBy('S.sub_id')
->get()
->getResultArray();
}
public function book_published_list(){
$now = date('Y-m-d');
$oneMonthAgo = date('Y-m-d', strtotime($now . ' -1 month'));
return $this->db->table('books as B')
->select("B.book_id, B.title, B.created_on, B.publisher, B.author, B.publication_date, DATE_FORMAT(B.publication_date, '%d-%m-%Y') as publication_date_format, GROUP_CONCAT(CM.name, ',') as categories")
->join('book_categories as BC', 'BC.book_id = B.book_id and BC.isactive = 1', 'left')
->join('category as CM', 'BC.category_id = CM.id', 'left')
->where('B.created_on >=', $oneMonthAgo)
->where('B.created_on <=', $now)
->where('B.isactive', 1)
->groupBy('B.book_id')
->get()
->getResultArray();
}
}

View File

@ -53,7 +53,7 @@ public function updateData($table, $data, $where)
->join('business as B', 'B.business_id = I.business_id', 'left')
->join('users as U1', 'U1.user_id = I.created_by', 'left')
->join('users as U2', 'U2.user_id = I.updated_by', 'left')
->select('I.invoice_id, I.invoice_number, I.customer_id,concat(C.first_name," ",C.last_name) as customer_name , I.invoice_date, I.due_date, I.subtotal, I.tax, I.discount, I.total_amount,I.status, I.payment_status, I.order_number, I.payment_method,I.invoice_type, I.event_id,E.event_name, I.business_id,B.title as business_name, I.created_on, I.created_by,concat(U1.first_name," ",U1.last_name) as created_by_name, I.updated_on, I.updated_by,concat(U2.first_name," ",U2.last_name) as updated_by_name, I.isactive,C.email as customer_email,C.mobile_no as customer_mobile,I.shipping_address_id,I.shipping_address,I.billing_address_id,I.billing_address')
->select('I.invoice_id, I.invoice_number, I.customer_id,concat(C.first_name," ",C.last_name) as customer_name , I.invoice_date, I.due_date, I.subtotal, I.tax, I.discount, I.total_amount,I.status, I.payment_status, I.order_number, I.payment_method,I.invoice_type, I.event_id,E.event_name, I.business_id,B.title as business_name, I.created_on, I.created_by,concat(U1.first_name," ",U1.last_name) as created_by_name, I.updated_on, I.updated_by,concat(U2.first_name," ",U2.last_name) as updated_by_name, I.isactive,C.email as customer_email,C.mobile_no as customer_mobile,I.shipping_address_id,I.shipping_address,I.billing_address_id,I.billing_address,B.address as business_address,B.city as business_city,B.state as business_state,B.postal_code as business_postal_code,B.email as business_email,B.mobile_no as business_mobile_no')
->where($where)
->get()
->getResultArray();

View File

@ -3,20 +3,36 @@ namespace App\Models;
use CodeIgniter\Model;
class NotificationModel extends Model
{
protected $table = 'users';
protected $primaryKey = 'user_id';
protected $allowedFields = ['user_id','user_name','email','first_name','last_name','password','mobile_no','date_of_birth','address','gender','profile_picture','city','state','postal_code','country','role','isactive','business_id'];
protected $table;
public function saveData($data, $id = null)
public function setCustomTable($tableName)
{
if ($id === null) {
// Insert new record
return $this->insert($data);
} else {
// Update existing record
return $this->update($id, $data);
}
$this->table = $tableName;
}
// public function getTasksDueLastWeek()
// {
// $now = date('Y-m-d');
// $oneWeekAgo = date('Y-m-d', strtotime('-7 days', strtotime($now)));
// return $this->where('due_date >=', $oneWeekAgo)
// ->where('due_date <=', $now)
// ->findAll();
// }
public function getSubscriptionDueDetail(){
$now = date('Y-m-d');
$lastWeek = date('Y-m-d', strtotime('+7 days'));
return $this->db->table('subscription as S' )
->join('customers as C', 'C.customer_id = S.customer_id', 'left')
->join('category as CM', 'CM.id = S.scheme_id', 'left')
->join('business as B', 'B.business_id = S.business_id', 'left')
->join('book_categories as BC', 'BC.category_id = S.scheme_id', 'left')
->join('books as BK', 'BC.book_id = BK.book_id', 'left')
->select('CM.name,concat(C.first_name, " ", C.last_name) as customer_name,C.email as customer_email,C.mobile_no as customer_mobile,S.sub_id,S.scheme_id,S.customer_id,S.from_subscription,S.to_subscription,S.business_id,B.title as business_name,B.address as business_address,B.city as business_city,B.state as business_state,B.postal_code as business_postal_code,B.email as business_email,B.mobile_no as business_mobile_no,S.to_subscription,S.from_subscription,BK.title,BK.book_id')
->where('S.to_subscription >=', $now)->where('S.to_subscription <=',$lastWeek)
->groupBy('S.sub_id')
->get()->getResultArray();
}
}

View File

@ -9,7 +9,7 @@ class SchemeModel extends Model
{
protected $table = 'books';
protected $primaryKey = 'book_id';
protected $allowedFields = ['book_id ','title','sku','description','price','features','duration','business_id','updated_by','category','isactive'];
protected $allowedFields = ['book_id ','title','sku','description','price','features','duration','business_id','updated_by','category','isactive','created_by'];
public function insertScheme($data)
{
@ -25,6 +25,7 @@ class SchemeModel extends Model
$builder->join('category', 'category.id = book_categories.category_id', 'left');
$builder->where('books.business_id', $business_id);
$builder->where('category.name', 'membership');
$builder->where('books.isactive', 1);
$query = $builder->get();
@ -136,6 +137,32 @@ public function getAllSchemes()
}
public function getData($table, $where = null, $whereIn = null)
{
$query = $this->db->table($table);
if ($where) {
$query->where($where);
}
if ($whereIn) {
// $query->whereIn($column_name,$missingValues)
$query->whereIn($whereIn[0], $whereIn[1]);
}
return $query->get()->getResult();
}
public function inactiveMissingDetails($table_name,$dataToUpdate,$where = null,$whereIn = null)
{
$this->db->table($table_name);
$query = $this->db->table($table_name);
if ($where) {
$query->where($where);
}
if ($whereIn) {
$query->whereIn($whereIn[0], $whereIn[1]);
}
return $query->update($dataToUpdate);
}
}

View File

@ -149,12 +149,12 @@
<div style="font-weight : 300; color : rgb(68,68,68); line-height : 22px; ">
<p>
<span><?= $recipient_name; ?><br></span>
<span>22/2, SriKrishna Apartments<br> </span>
<span>1st Street, Subramania Nagar, Kodambakkam<br> </span>
<span>CHENNAI 600024<br></span>
<span>Tamil Nadu<br></span>
<span><a style="color : rgb(68,68,68); font-weight : 300; " target="_blank">+919445062922</a><br></span>
<span><a style="color : rgb(68,68,68); font-weight : 300; " target="_blank">arasubu@gmail.com</a><br></span>
<span><?= $recipient_name; ?><br> </span>
<span><?= $recipient_name; ?><br> </span>
<span><?= $recipient_name; ?><br></span>
<span><?= $recipient_name; ?><br></span>
<span><a style="color : rgb(68,68,68); font-weight : 300; " target="_blank">+91<?= $recipient_name; ?></a><br></span>
<span><a style="color : rgb(68,68,68); font-weight : 300; " target="_blank"><?= $recipient_name; ?></a><br></span>
</p>
</div>

View File

@ -65,7 +65,7 @@
<label for="isbn_code" class="col-form-label">ISBN CODE<span
class="text-danger">*</span></label>
<input type="text" class="form-control" id="isbn_code" name="isbn_code"
value="<?= isset($details['publication_date']) ? $details['publication_date'] : '' ?>"
value="<?= isset($details['isbn_code']) ? $details['isbn_code'] : '' ?>"
required />
<div class="invalid-feedback"> Please provide. </div>
</div>
@ -110,13 +110,9 @@
<div class="form-group col-md-6">
<label for="publication_date" class="col-form-label">Publication Date<span
class="text-danger"></span></label>
<input type="date" class="form-control" id="publication_date" name="publication_date"
placeholder="Publication Date (format : DD/MM/YYYY)" data-toggle="input-mask"
value="<?= isset($details['publication_date']) ? $details['publication_date'] : '' ?>" />
<label for="publication_date" class="col-form-label">Publication Date<span class="text-danger"></span></label>
<input type="date" class="form-control" id="publication_date" name="publication_date" placeholder="Publication Date (format : DD/MM/YYYY)" data-toggle="input-mask" data-mask-format="00/00/0000" value="<?= isset($details['publication_date']) ? $details['publication_date'] : '' ?>" />
</div>

View File

@ -7,6 +7,24 @@
</div>
<br>
<h4 class="header-title mb-3"><?= $page_name; ?></h4>
<?php if (session()->getFlashdata('success') || session()->getFlashdata('error')) : ?>
<?php if (session()->getFlashdata('success')) : ?>
<div class="alert alert-success alert-dismissible fade show" role="alert">
<?= session('success') ?>
<button type="button" class="close" data-dismiss="alert" aria-label="Close">
<span aria-hidden="true">&times;</span>
</button>
</div>
<?php endif; ?>
<?php if (session()->getFlashdata('error')) : ?>
<div class="alert alert-danger alert-dismissible fade show" role="alert">
<?= session('error') ?>
<button type="button" class="close" data-dismiss="alert" aria-label="Close">
<span aria-hidden="true">&times;</span>
</button>
</div>
<?php endif; ?>
<?php endif; ?>
<div class="table-responsive">
<!-- <table id="basic-datatable" class="table dt-responsive w-100"> -->
<table id="scroll-horizontal-datatable_new" class="table w-100 nowrap">

View File

@ -1,93 +1,337 @@
<?php if ($loggedin_person_role !== 'manager') : ?>
<div class="row">
<div class="col-xl-3 col-md-6">
<div class="card">
<div class="card-body">
<div class="d-flex justify-content-between align-items-center">
<div class="knob-chart" dir="ltr">
<input data-plugin="knob" data-width="70" data-height="70" data-fgColor="#1abc9c"
data-bgColor="#d1f2eb" value="<?= $customer['percentage']; ?>"
data-skin="tron" data-angleOffset="0" data-readOnly=true
data-thickness=".15"/>
</div>
<!-- <div class="text-right">
<?php if ($loggedin_person_role === 'sadmin') : ?>
<div class="row">
<div class="col-xl-3 col-md-6">
<div class="card">
<div class="card-body">
<div class="d-flex justify-content-between align-items-center">
<div class="knob-chart" dir="ltr">
<input data-plugin="knob" data-width="70" data-height="70" data-fgColor="#1abc9c" data-bgColor="#d1f2eb" value="<?= $customer['percentage']; ?>" data-skin="tron" data-angleOffset="0" data-readOnly=true data-thickness=".15" />
</div>
<!-- <div class="text-right">
<h3 class="mb-1 mt-0"> <span data-plugin="counterup"><?= $customer['active']; ?></span> </h3>
<p class="text-muted mb-0"><?= 'Available '.$customer['label']; ?></p>
<p class="text-muted mb-0"><?= 'Available ' . $customer['label']; ?></p>
</div>
<div class="text-right">
<h3 class="mb-1 mt-0"> <span data-plugin="counterup"><?= $customer['total']; ?></span> </h3>
<p class="text-muted mb-0"><?= 'Total '.$customer['label']; ?></p>
<p class="text-muted mb-0"><?= 'Total ' . $customer['label']; ?></p>
</div>
<div class="text-right">
<h3 class="mb-1 mt-0"> <span data-plugin="counterup">268</span> </h3>
<p class="text-muted mb-0">New Customers</p>
</div> -->
<div class="text-right">
<h3 class="mb-1 mt-0"> <span data-plugin="counterup"><?= $customer['today']; ?></span> </h3>
<p class="text-muted mb-0"><?= 'New '.$customer['label']; ?></p>
<div class="text-right">
<h3 class="mb-1 mt-0"> <span data-plugin="counterup"><?= $customer['today']; ?></span> </h3>
<p class="text-muted mb-0"><?= 'New ' . $customer['label']; ?></p>
</div>
</div>
</div>
</div>
</div>
</div><!-- end col -->
</div><!-- end col -->
<div class="col-xl-3 col-md-6">
<div class="card">
<div class="card-body">
<div class="d-flex justify-content-between align-items-center">
<div class="knob-chart" dir="ltr">
<input data-plugin="knob" data-width="70" data-height="70" data-fgColor="#3bafda"
data-bgColor="#d8eff8" value="80"
data-skin="tron" data-angleOffset="0" data-readOnly=true
data-thickness=".15"/>
</div>
<div class="text-right">
<h3 class="mb-1 mt-0"> <span data-plugin="counterup">8574</span> </h3>
<p class="text-muted mb-0">Online Orders</p>
<div class="col-xl-3 col-md-6">
<div class="card">
<div class="card-body">
<div class="d-flex justify-content-between align-items-center">
<div class="knob-chart" dir="ltr">
<input data-plugin="knob" data-width="70" data-height="70" data-fgColor="#3bafda" data-bgColor="#d8eff8" value="80" data-skin="tron" data-angleOffset="0" data-readOnly=true data-thickness=".15" />
</div>
<div class="text-right">
<h3 class="mb-1 mt-0"> <span data-plugin="counterup">8574</span> </h3>
<p class="text-muted mb-0">Online Orders</p>
</div>
</div>
</div>
</div>
</div>
</div><!-- end col -->
</div><!-- end col -->
<div class="col-xl-3 col-md-6">
<div class="card">
<div class="card-body">
<div class="d-flex justify-content-between align-items-center">
<div class="knob-chart" dir="ltr">
<input data-plugin="knob" data-width="70" data-height="70" data-fgColor="#f672a7"
data-bgColor="#fde3ed" value="77"
data-skin="tron" data-angleOffset="0" data-readOnly=true
data-thickness=".15"/>
</div>
<div class="text-right">
<h3 class="mb-1 mt-0"> <span data-plugin="counterup">958.25</span> </h3>
<p class="text-muted mb-0">Revenue</p>
<div class="col-xl-3 col-md-6">
<div class="card">
<div class="card-body">
<div class="d-flex justify-content-between align-items-center">
<div class="knob-chart" dir="ltr">
<input data-plugin="knob" data-width="70" data-height="70" data-fgColor="#f672a7" data-bgColor="#fde3ed" value="77" data-skin="tron" data-angleOffset="0" data-readOnly=true data-thickness=".15" />
</div>
<div class="text-right">
<h3 class="mb-1 mt-0"> <span data-plugin="counterup">958.25</span> </h3>
<p class="text-muted mb-0">Revenue</p>
</div>
</div>
</div>
</div>
</div>
</div><!-- end col -->
</div><!-- end col -->
<div class="col-xl-3 col-md-6">
<div class="card">
<div class="card-body">
<div class="d-flex justify-content-between align-items-center">
<div class="knob-chart" dir="ltr">
<input data-plugin="knob" data-width="70" data-height="70" data-fgColor="#6c757d"
data-bgColor="#e2e3e5" value="35"
data-skin="tron" data-angleOffset="0" data-readOnly=true
data-thickness=".15"/>
</div>
<div class="text-right">
<h3 class="mb-1 mt-0"> <span data-plugin="counterup">89.25</span> </h3>
<p class="text-muted mb-1">Daily Average</p>
<div class="col-xl-3 col-md-6">
<div class="card">
<div class="card-body">
<div class="d-flex justify-content-between align-items-center">
<div class="knob-chart" dir="ltr">
<input data-plugin="knob" data-width="70" data-height="70" data-fgColor="#6c757d" data-bgColor="#e2e3e5" value="35" data-skin="tron" data-angleOffset="0" data-readOnly=true data-thickness=".15" />
</div>
<div class="text-right">
<h3 class="mb-1 mt-0"> <span data-plugin="counterup">89.25</span> </h3>
<p class="text-muted mb-1">Daily Average</p>
</div>
</div>
</div>
</div>
</div>
</div><!-- end col -->
</div><!-- end col -->
</div>
</div>
<?php endif; ?>
<!-- end row -->
<!-- end row -->
<?php if ($loggedin_person_role !== 'manager') : ?>
<!-- <div class="row">
<div class="col-xl-6">
<div class="card bg-info border-info">
<div class="card-body">
<div class="row">
<div class="col-md-7">
<div class="row align-items-center">
<div class="col-6 text-center">
<h1 class="display-4"><i class="wi ri-stack-line"></i></h1>
</div>
<div class="col-6">
<div class="text-white">
<h2 class="text-white"><b>32°</b></h2>
<p>Partly cloudy</p>
<p class=" mb-0">15km/h - 37%</p>
</div>
</div
</div>
</div>
<div class="col-md-5">
<div class="row">
<div class="col-4 text-center">
<h4 class="text-white mt-0">SAT</h4>
<h3 class="my-3"><i class="wi wi-night-alt-cloudy text-white"></i></h3>
<h4 class="text-white mb-0">30<i class="wi wi-degrees"></i></h4>
</div>
<div class="col-4 text-center">
<h4 class="text-white mt-0">SUN</h4>
<h3 class="my-3"><i class="wi wi-day-sprinkle text-white"></i></h3>
<h4 class="text-white mb-0">28<i class="wi wi-degrees"></i></h4>
</div>
<div class="col-4 text-center">
<h4 class="text-white mt-0">MON</h4>
<h3 class="my-3"><i class="wi wi-hot text-white"></i></h3>
<h4 class="text-white mb-0">33<i class="wi wi-degrees"></i></h4>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div> -->
<div class="row">
<div class="col-xl-3 col-lg-4">
<div class="card">
<div class="card-body">
<div style="min-height: 200px !important">
<div class="text-primary float-right">
<span data-toggle="tooltip" data-placement="bottom" data-original-title="Current Financial Year"> <?= $invoice['financial_year']; ?></span>
</div>
<div style="padding: 80px 0;">
<h3 class="text-center">Today : <span data-toggle="tooltip" data-placement="bottom" data-original-title="Today Invoice Raised" data-plugin="counterup"><?= $invoice['today']; ?></span>
</h3>
</div>
<div class="text-success">
<span> MTD : <span data-toggle="tooltip" data-placement="bottom" data-original-title="Monthly Invoice Raised" data-plugin="counterup"><?= $invoice['month']; ?></span></span>
<span class="float-right" > YTD : <span data-toggle="tooltip" data-placement="bottom" data-original-title="Yearly Invoice Raised" data-plugin="counterup"><?= $invoice['year']; ?></span></span>
</div>
</div><!-- end min-height-->
</div> <!-- end card-body-->
</div><!--end card-->
</div> <!-- end col -->
<div class="col-xl-9 col-lg-8">
<div class="card">
<div class="card-body">
<h4 class="header-title mb-2">Schemes</h4>
<div class="conversation-list" data-simplebar style="max-height: 200px !important"> <!-- default 460px -->
<?php foreach ($active_category as $a) : ?>
<div class="media">
<div class="avatar-md mr-3">
<div class="avatar-title bg-light rounded text-body font-20 font-weight-semibold">
<?= $a['first_letter']; ?>
</div>
</div>
<div class="media-body">
<h5 class="my-1"><?= $a['name']; ?></h5>
<p class="text-muted mb-0">
<span class="badge badge-soft-success"><i class="mdi mdi-account mr-1"></i> <span data-plugin="counterup"><?= $a['count']; ?></span> Subscribers </span>
</p>
</div>
</div>
<hr>
<?php endforeach; ?>
<!-- <div class="media">
<div class="avatar-md mr-3">
<div class="avatar-title bg-light rounded text-body font-20 font-weight-semibold">
</div>
</div>
<div class="media-body">
<h5 class="my-1">Samarth Scheme (2years) </h5>
<p class="text-muted mb-0">
<span class="badge badge-soft-success"><i class="mdi mdi-account mr-1"></i> <span data-plugin="counterup"> 32 </span> Subscribers </span>
</p>
</div>
</div>
<hr> -->
<!-- <div class="media">
<div class="mr-3">
<img src="<?= base_url() . "public/assets/images/users/avatar-1.jpg" ?>" alt="user-image" class="rounded avatar-md">
</div>
<div class="media-body">
<h5 class="my-1">Samarth Scheme (1years) </h5>
<p class="text-muted mb-0">
<span class="badge badge-soft-success"><i class="mdi mdi-account mr-1"></i> <span data-plugin="counterup"> 32 </span> Subscribers </span>
</p>
</div>
</div>
<hr> -->
</div>
</div><!-- end card-body -->
</div><!--end card-->
</div><!-- end col -->
</div>
<div class="row">
<div class="col-xl-4 col-lg-6">
<div class="card">
<div class="card-body">
<h4 class="header-title mt-1">Expiring Membership List</h4>
<div class="conversation-list" data-simplebar style="max-height: 255px !important">
<div class="table-responsive">
<table class="table table-sm table-centered mb-0 font-14">
<thead class="thead-light">
<tr>
<th style="width: 5%;">#</th>
<th style="width: 20%;">Name</th>
<th style="width: 50%;">Scheme Name</th>
<th style="width: 25%;">Expiring In</th>
</tr>
</thead>
<tbody>
<?php
// print "<pre>";
// print_r($expiring_membership);
// print "</pre>";
foreach ($expiring_membership as $e) : ?>
<tr>
<td><?= $e['sub_id']; ?></td>
<td>
<h5 class="mt-0 mb-1"><?= $e['customer_name']; ?></h5>
<span class="font-13"><?= $e['customer_mobile']; ?></span>
</td>
<td><?= $e['title']; ?></td>
<td><span class="badge badge-success badge-pill"><span data-plugin="counterup"><?= $e['countdays']; ?></span> days</span></td>
</tr>
<?php endforeach; ?>
<!-- <tr>
<td>
<h5 class="mt-0 mb-1">Sangavi</h5>
<span class="font-13">9092279559</span>
</td>
<td>Samarth Scheme (5years)</td>
<td><span class="badge badge-success badge-pill">5 days</span></td>
</tr>
<tr>
<td>
<h5 class="mt-0 mb-1">Suganya</h5>
<span class="font-13">7128122050</span>
</td>
<td>Samarth Scheme (5years)</td>
<td><span class="badge badge-success badge-pill">5 days</span></td>
</tr> -->
</tbody>
</table>
</div> <!-- end table-responsive-->
</div>
</div> <!-- end card-body-->
</div> <!-- end card-->
</div> <!-- end col-->
<div class="col-xl-4 col-lg-6">
<div class="card">
<div class="card-body">
<h4 class="header-title mt-1">Books Published in Last One Month</h4>
<div class="conversation-list" data-simplebar style="max-height: 255px !important">
<div class="table-responsive">
<table class="table table-sm table-centered mb-0 font-14">
<thead class="thead-light">
<tr>
<th style="width: 50%;">Book Details</th>
<th style="width: 50%;">Category</th>
</tr>
</thead>
<tbody>
<?php foreach ($book_published as $b) :?>
<tr>
<td><?= $b['title']; ?>
<p class="text-muted mb-0">
<i class="mdi mdi-account mr-1"></i><?= $b['author']; ?>
</p>
<p class="text-muted mb-0">
<i class="mdi mdi-book-open-variant mr-1"></i><?= $b['publisher']; ?>
</p>
<p class="text-muted mb-0">
<i class="mdi mdi-update mr-1"></i><?= $b['publication_date_format']; ?>
</p>
</td>
<td>
<?php // echo $b['categories'];
$splitted = explode(', ', $b['categories']);
if(!empty($splitted)){
// print_r($splitted);
for ($i = 0; $i < count($splitted); $i++) {
if($splitted[$i] !== ''){ ?>
<span class="badge badge-success badge-pill mr-1"><?= str_replace(',', '', $splitted[$i]); ?></span>
<?php }
}
} ?>
</td>
</tr>
<?php endforeach; ?>
<!-- <tr>
<td>First std English
<p class="text-muted mb-0">
<i class="mdi mdi-account mr-1"></i> தி. . வைகுண்டம்
</p>
<p class="text-muted mb-0">
<i class="mdi mdi-book-open-variant mr-1"></i> விஜயபாரதம் பிரசுரம்
</p>
<p class="text-muted mb-0">
<i class="mdi mdi-update mr-1"></i> 17/10/2023
</p>
</td>
<td><span class="badge badge-success badge-pill mr-1">History</span></td>
</tr>
<tr>
<td>First std Science
<p class="text-muted mb-0">
<i class="mdi mdi-account mr-1"></i> Dr. சரத் ஹேபால்கர்
</p>
<p class="text-muted mb-0">
<i class="mdi mdi-book-open-variant mr-1"></i> அலைகள் வெளியீட்டகம்
</p>
<p class="text-muted mb-0">
<i class="mdi mdi-update mr-1"></i> 17/10/2023
</p>
</td>
<td><span class="badge badge-success badge-pill mr-1">Paperbacks</span></td>
</tr> -->
</tbody>
</table>
</div> <!-- end table-responsive-->
</div>
</div> <!-- end card-body-->
</div> <!-- end card-->
</div> <!-- end col-->
</div>
<?php endif; ?>

View File

@ -45,12 +45,12 @@
<input type="hidden" id="hiddenBillingAddressId" name="billing_address_id"
placeholder="hidden for billing address id"
value="<?= isset($invoice_details['billing_address_id']) ? $invoice_details['billing_address_id'] : '' ?>" />
<textarea class="form-control" id="storeBillingAddress" name="billing_address"
<textarea class="form-control" id="storeBillingAddress" name="billing_address" rows="4"
readonly><?= isset($invoice_details['billing_address']) ? $invoice_details['billing_address'] : '' ?></textarea>
</div>
<div class="form-group col-md-6">
<label for="storeShippingAddress">Shipping Address</label>
<textarea class="form-control" id="storeShippingAddress" name="shipping_address"
<textarea class="form-control" id="storeShippingAddress" name="shipping_address" rows="4"
readonly><?= isset($invoice_details['shipping_address']) ? $invoice_details['shipping_address'] : '' ?></textarea>
</div>
</div>
@ -644,8 +644,7 @@ $(document).ready(function() {
customer_billing = "";
if (cb.length > 0) {
$.each(cb, function(k, v) {
customer_billing = v.address_1 + "," + v.address_2 + "," + v.city +
"," + v.state + "," + v.country + "." + v.postal_code
customer_billing = v.address_1 + " " + v.address_2 + ",\n" + v.city + ",\n" + v.state + " - "+v.postal_code+",\n"+ v.country +"."
customer_billing_id = v.customer_address_id
});
}
@ -703,8 +702,7 @@ $(document).ready(function() {
customer_shipping = "";
if (cs.length > 0) {
$.each(cs, function(k, v) {
customer_shipping = v.address_1 + "," + v.address_2 + "," + v.city +
"," + v.state + "," + v.country + "." + v.postal_code
customer_shipping = v.address_1 + " " + v.address_2 + ",\n" + v.city + ",\n" + v.state + " - "+v.postal_code+",\n"+ v.country +"."
});
}
// console.log(customer_shipping);

View File

@ -7,6 +7,24 @@
</div><!-- end col-->
<br>
<h4 class="header-title mb-3"><?= $page_name; ?></h4>
<?php if (session()->getFlashdata('success') || session()->getFlashdata('error')) : ?>
<?php if (session()->getFlashdata('success')) : ?>
<div class="alert alert-success alert-dismissible fade show" role="alert">
<?= session('success') ?>
<button type="button" class="close" data-dismiss="alert" aria-label="Close">
<span aria-hidden="true">&times;</span>
</button>
</div>
<?php endif; ?>
<?php if (session()->getFlashdata('error')) : ?>
<div class="alert alert-danger alert-dismissible fade show" role="alert">
<?= session('error') ?>
<button type="button" class="close" data-dismiss="alert" aria-label="Close">
<span aria-hidden="true">&times;</span>
</button>
</div>
<?php endif; ?>
<?php endif; ?>
<div class="table-responsive">
<!-- <table id="datatable-buttons" class="table dt-responsive w-100"> -->
<table id="scroll-horizontal-datatable_scheme" class="table w-100 nowrap">

BIN
public/uploads/avatar.png Executable file → Normal file

Binary file not shown.

Before

Width:  |  Height:  |  Size: 24 KiB

After

Width:  |  Height:  |  Size: 5.7 KiB