vbp tracker item

This commit is contained in:
heama 2024-02-09 17:25:58 +05:30
parent 9b7b2d7a8c
commit 8000f261b6
27 changed files with 1416 additions and 182 deletions

View File

@ -51,6 +51,8 @@ $routes->get('dashboard/', 'Home::index');
$routes->get("user_list/", "Users::index");
$routes->get("user_page/(:any)", "Users::user_page/$1");
$routes->post("insert_users", "Users::insert_users");
$routes->get('users/fetch_event_names', 'Users::fetch_event_names');
$routes->get("delete_user/(:any)", "Users::delete_user/$1");
# Books Routes
@ -114,6 +116,9 @@ $routes->post("insert_invoice_number_format", "Event::insert_invoice_number_form
$routes->get("invoice_list/", "Invoice::index");
$routes->get("new_book_invoice/(:any)", "Invoice::new_book_invoice/$1");
$routes->get("new_subscription_invoice/(:any)", "Invoice::new_subscription_invoice/$1");
// $routes->get("download_invoice_pdf/(:num)",'Invoice::download_invoice_pdf/$1');
$routes->get("download_invoice_pdf/(:any)", 'Invoice::download_invoice_pdf/$1');
$routes->post("get_customer_billing_details", "Invoice::get_customer_billing_details");
@ -128,6 +133,9 @@ $routes->get('print_address/(:num)', 'Invoice::print_address/$1');
$routes->match(['get','post'],'/general_inv_rp','Invoice::general_inv_rp');
$routes->match(['get','post'],'/mem_inv_rp','Invoice::general_membership_inv_rp');
$routes->match(['get','post'],'/itemwise_report','Invoice::itemwise_report');
$routes->match(['get','post'],'/expired_customer_report','Invoice::expired_customer_report');
$routes->match(['get','post'],'/book_publishwise_Report','Invoice::book_publishwise_Report');
# Notifications Routes

View File

@ -65,7 +65,8 @@ abstract class BaseController extends Controller
echo "This is a command-line request.";
// echo $requestedRoute;
} else {
if ($requestedRoute !== '/login' && $requestedRoute !== '/authenticate' && $uri->getSegment(1) != 'getExpCustomerDetail') {
if ($requestedRoute !== '/login' && $requestedRoute !== '/authenticate' && $uri->getSegment(1) != 'getExpCustomerDetail'&& $uri->getSegment(1) != 'download_invoice_pdf') {
$this->authData = $this->session_log();
}
}

View File

@ -541,6 +541,8 @@ class Invoice extends BaseController
$recipient_mobile = $rec['customer_mobile'];
$subtotal = $rec['subtotal'];
$tax = $rec['tax'];
$invoiceDate=$rec['invoice_date'];
$total_amount = $rec['total_amount'];
$payment_method = $rec['payment_method'];
$business_name= $rec['business_name'];
@ -549,7 +551,8 @@ class Invoice extends BaseController
$business_state= $rec['business_state'];
$business_postal_code= $rec['business_postal_code'];
$business_email= $rec['business_email'];
$business_mobile_no= $rec['business_mobile_no'];
$business_mobile_no= $rec['business_mobile_no'];
}
$records['invoice_order_number'] = $reference_number;
$records['invoice_serial_number'] = $invoice_serial_number;
@ -568,24 +571,49 @@ class Invoice extends BaseController
$records['template_name'] = 'approve_template';
$records['item'] = $details['item'];
// print_r($records['item']);die;
$lineitem_html="";
foreach ($records['item'] as $inv) {
// print_r($item->title);die;
$lineitem_html.='<p>'.$inv->title. ' x ' .$inv->quantity .' => ' .$inv->subtotal.'</p>';
}
// print_r($title);die;
$records['subject'] = $invoice_serial_number . " - Approval Notification";
$records['description'] = "<html><head><title>VBP Approve Information</title></head><body>
<p>Dear $recipient_name,</p>
<p> &ensp;&ensp; We are pleased to inform you that your Invoice has been approved.</p>
<p><strong>Details:</strong></p>
<ul><li>Approval Date:" . $approval_date . "</li>
<li>Approved By:" . $approved_by . "</li>
<li>Reference ID:" . $reference_number . "</li>
</ul><br>
<p>Best regards,</p>
<ul style='list-style: none;'>
<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,\n".$business_name.",\n".$business_address." ".$business_city." ".$business_state." - ".$business_postal_code.".\nCall Us: +91 ".$business_mobile_no."\nEmail Us:".$business_email;
$records['description'] = "<html>
<body>
<div class='custom-box' style=' border: 1px solid #ccc;
padding: 20px;
border-radius: 10px;
width: 300px; /* Adjust the width as needed */
margin: 20px auto; text-align: center;'>
<h2><img src='https://pbs.twimg.com/profile_images/1116902407332450304/QEQWyRq2_400x400.jpg'alt='Company Logo' style='max-width: 100px; margin-bottom: -20%;;'></h2>
<p style='color: red;
font-size: larger;'><b>THANKS FOR YOUR ORDER!!<b></p>
<p>Order Number:#$invoice_serial_number</p>
<p>Total Amount:$total_amount</p>
<!-- Download Invoice Button -->
<a href='" . base_url("download_invoice_pdf/" . md5($invoice_id)) . "' style='display: inline-block; padding: 10px; background-color: #4CAF50; color: #fff; text-decoration: none; border-radius: 5px; margin-top: 20px;'>Download Invoice</a>
<br>
<p>Thank you for choosing us!</p>
<ul style='list-style:none;font-size: 10px; text-align: center;margin-right:54px;'>
<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>
</ul>
</div>
</body>
</html>";
// print_r($records['description']);die;
$url = base_url("download_invoice_pdf/" . md5($invoice_id));
$encodedUrl = urlencode($url);
$template = "Dear " . $recipient_name . ",\r\r\n\nYour Invoice has been generated.\n\nDetails:\r\n- Invoice Date: " . $invoiceDate . "\r\n- Invoice Number: " . $invoice_serial_number . "\r\n- Click here to download the Invoice: " . base_url("download_invoice_pdf/" .$encodedUrl);
$params = (object) Null;
$params->number = (int)'91' . $recipient_mobile;
@ -604,6 +632,7 @@ class Invoice extends BaseController
## To Generate Invoice PDF based on invoice ID
public function generate_invoice_pdf($id)
{
// echo "hello"; die;
// Fetch the invoice data based on $invoice_id
$model = new InvoiceModel();
$data = $model->getInvoiceData($id);
@ -629,6 +658,9 @@ class Invoice extends BaseController
$mpdf->SetTitle('Invoice');
$mpdf->SetAuthor($data[0]->company_name);
$mpdf->SetCreator('');
$htmlFooter='<div >
<img src="https://cdn.pixabay.com/photo/2012/04/26/14/17/blue-42596_960_720.png"style=margin-left:70px;/> </div>';
$mpdf->setHTMLFooter($htmlFooter);
// Generate the PDF content (HTML)
if ($data[0]->status === 'Draft') {
@ -691,24 +723,35 @@ class Invoice extends BaseController
}
public function general_inv_rp()
{
{
$model = new InvoiceModel();
if($this->request->is('get'))
{
if ($this->request->is('get')) {
$data['report_data'] = $model->get_general_invoice_data();
$data['selected_data'] = "";
}
else
{
$dateParts = explode(' - ', $this->request->getVar('date') );
} else {
$dateParts = explode(' - ', $this->request->getVar('date'));
$fromDate = $dateParts[0];
$toDate = $dateParts[1];
$data['report_data'] = $model->get_general_invoice_data( date("Y-m-d", strtotime($fromDate)) , date("Y-m-d", strtotime($toDate)) );
// Update date conversion format using the global namespace
$fromDate = \DateTime::createFromFormat('d/m/Y', $fromDate)->format('Y-m-d');
$toDate = \DateTime::createFromFormat('d/m/Y', $toDate)->format('Y-m-d');
// Debugging statements for date range
var_dump($fromDate, $toDate);
$data['report_data'] = $model->get_general_invoice_data($fromDate, $toDate);
$data['selected_data'] = $this->request->getVar('date');
}
$data['page_name'] = 'General Invoice Report';
// Debugging statement for report data
// var_dump($data['report_data']);
$data['page_name'] = 'Sales Report';
$this->render_page('report_general_invoice', $data);
}
public function general_membership_inv_rp()
{
@ -736,6 +779,34 @@ class Invoice extends BaseController
$this->render_page('report_mem_invoice', $data);
}
}
public function expired_customer_report()
{
if($this->request->getmethod() == 'get')
{
$model = new InvoiceModel();
$data['expired_customers'] = $model->getExpiredCustomers();
$this->logger->info("'Membership Renewals Report'");
$data['page_name'] = 'Membership Renewals Report';
$this->render_page('report_expired_customers', $data);
}
else
{
$dateParts = explode(' - ', $this->request->getVar('date') );
$fromDate = $dateParts[0];
$toDate = $dateParts[1];
$dateTime = \DateTime::createFromFormat('m/d/Y', $fromDate);
$dateTime1 = \DateTime::createFromFormat('m/d/Y', $toDate);
$model = new InvoiceModel();
$data['expired_customers'] = $model->getExpiredCustomers( $dateTime->format('Y-m-d') , $dateTime1->format('Y-m-d') );
$this->logger->info("Itemwise Report ");
$this->logger->info("'Membership Renewals Report'");
$data['page_name'] = 'Membership Renewals Report';
$this->render_page('report_expired_customers', $data);
}
}
public function itemwise_report()
{
@ -744,7 +815,7 @@ class Invoice extends BaseController
$model = new InvoiceModel();
$data['report_data'] = $model->itemwise_report_data();
$this->logger->info("Itemwise Report ");
$data['page_name'] = 'Itemwise Report';
$data['page_name'] = 'Bookswise Report';
$this->render_page('report_itemwise', $data);
}
else
@ -758,13 +829,42 @@ class Invoice extends BaseController
$model = new InvoiceModel();
$data['report_data'] = $model->itemwise_report_data( $dateTime->format('Y-m-d') , $dateTime1->format('Y-m-d') );
$this->logger->info("Itemwise Report ");
$data['page_name'] = 'Itemwise Report';
$data['page_name'] = 'Bookswise Report';
$data['selected_data'] = $this->request->getVar('date');
$this->render_page('report_itemwise', $data);
}
}
}
public function book_publishwise_Report()
{
if($this->request->getmethod() == 'get')
{
$model = new InvoiceModel();
$data['report_data'] = $model->itemwise_report_data_with_publish_code();
$this->logger->info("Itemwise Report ");
$data['page_name'] = 'Bookswise Report';
// print_r($data);die;
$this->render_page('report_book_publish', $data);
}
else
{
$dateParts = explode(' - ', $this->request->getVar('date') );
$fromDate = $dateParts[0];
$toDate = $dateParts[1];
$dateTime = \DateTime::createFromFormat('m/d/Y', $fromDate);
$dateTime1 = \DateTime::createFromFormat('m/d/Y', $toDate);
$model = new InvoiceModel();
$data['report_data'] = $model->itemwise_report_data_with_publish_code( $dateTime->format('Y-m-d') , $dateTime1->format('Y-m-d') );
$this->logger->info("Itemwise Report ");
$data['page_name'] = 'Bookswise Report';
$data['selected_data'] = $this->request->getVar('date');
$this->render_page('report_book_publish', $data);
}
}
// public function generate_invoice_pdf($id)
// {
@ -799,4 +899,60 @@ class Invoice extends BaseController
// }
// Fetch the invoice data based on $invoice_id
public function download_invoice_pdf($md5Hash)
{
$model = new InvoiceModel();
// Retrieve the invoice ID from the MD5 hash
$invoice_id = $model->getInvoiceIdByMd5($md5Hash);
// Check if the MD5 hash is valid and the invoice ID exists
if ($invoice_id) {
// Fetch the invoice data based on $invoice_id
$data = $model->getInvoiceData($invoice_id);
$invoiceItems = $model->getInvoiceItems($invoice_id, 'groupby');
foreach ($invoiceItems as $index => $singleItem) {
$productImgs = $model->getProductImgs($singleItem->product);
$invoiceItems[$index]->imgs = $productImgs;
}
$invoice_type = $data[0]->invoice_type;
// Create an mPDF object
$mpdf = new Mpdf();
$mpdf->autoLangToFont = true;
$mpdf->autoScriptToLang = true;
// Set PDF properties
$mpdf->SetTitle('Invoice');
$mpdf->SetAuthor($data[0]->company_name);
$mpdf->SetCreator('');
$htmlFooter = '<div >
<img src="https://cdn.pixabay.com/photo/2012/04/26/14/17/blue-42596_960_720.png"style=margin-left:70px;/> </div>';
$mpdf->setHTMLFooter($htmlFooter);
// Generate the PDF content (HTML) with data
$html = view('invoice_pdf_template', ['data' => $data, 'invoiceItems' => $invoiceItems, 'invoice_type' => $invoice_type, 'invoiceTerms' => $data]);
// Load HTML into the mPDF instance
$mpdf->WriteHTML($html);
// Output the PDF to the browser for download
$mpdf->Output("invoice_" . date('Y-m-d H-i-s') . '.pdf', 'D');
}else{
echo "no code works";
}
}
private function getInvoiceIdByMd5($md5Hash)
{
// Assuming you have a table named 'invoices' with columns 'invoice_id' and 'md5_hash'
$result = $this->db->table('invoices')->select('invoice_id')->where('md5_hash', $md5Hash)->get()->getRow();
return $result ? $result->invoice_id : null;
}
}

View File

@ -452,6 +452,7 @@ class Notifications extends BaseController
################################################################
public function getExpCustomerDetail($window_time = null)
{
echo "hi";die;
# Step 1: add the days to retrive the data//
$providedDate = date('Y-m-d');
$newDate = date('Y-m-d', strtotime($providedDate . ' + ' . $window_time . ' days'));
@ -839,7 +840,7 @@ class Notifications extends BaseController
public function noifications_acknowlegdement(){
$model = new NotificationModel();
$data['noifications_acknowlegdement'] = $model->get_noifications_acknowlegdement_data();
$data['page_name'] = 'Notifications Acknowlegdement';
$data['page_name'] = 'Notifications Status';
$this->render_page('noifications_acknowlegdement', $data);
}
############## Notification Acknowlegdement Ends ################

View File

@ -68,6 +68,7 @@ class Scheme extends BaseController
'price' => $this->request->getPost('sprice'),
'duration' => $this->request->getPost('sduration'),
'sku' => $this->request->getPost('sku'),
'short_code'=>$this->request->getpost('short_code'),
'business_id' => $this->request->getPost('business_id')
];

View File

@ -124,7 +124,10 @@ public function add_subscription() {
public function download_details()
{
$selectedSchemes = $this->request->getPost('selected_schemes');
$downloadType = $this->request->getPost('download_type');
$action = $this->request->getPost('action');
// Initialize an empty PDF with custom paper size (4x6 inches)
$config = [
'mode' => 'utf-8',
@ -151,47 +154,59 @@ public function download_details()
'margin_footer' => 0,
];
if($action == 1) $pdf = new Mpdf($config);
if ($action == 1) $pdf = new Mpdf($config);
else $pdf = new Mpdf($configa4);
$customerDetails = [];
// Iterate through selected schemes
if (!empty($selectedSchemes)) {
foreach ($selectedSchemes as $selectedScheme) {
// Call the model method to get customer details for each selected scheme
$subscriptionModel = new SubscriptionModel();
$details = $subscriptionModel->getAllCustomerDetailsBySchemeName($selectedScheme);
$customerDetails = array_merge($customerDetails, $details);
}
foreach ($selectedSchemes as $selectedScheme) {
// Call the model method to get customer details for each selected scheme and download type
$subscriptionModel = new SubscriptionModel();
if ($downloadType === 'active') {
$details = $subscriptionModel->getAllCustomerDetailsBySchemeName($selectedScheme);
} elseif ($downloadType === 'expired') {
$details = $subscriptionModel->getAllExpiredCustomerDetailsByScheme($selectedScheme);
} elseif ($downloadType === 'both') {
$details =$subscriptionModel->getBothDetailsSchemeName($selectedScheme);
}
$customerDetails = array_merge($customerDetails, $details);
}
if (!empty($customerDetails)) {
$html = view('print_addresses_form', ['customerDetails' => $customerDetails , 'action' => $action , 'pdf' => $pdf]);
// Add the current scheme's details to the PDF
// echo $html;die;
// $pdf->AddPage();
// Pass customer details, action, and pdf to the view
$html = view('print_addresses_form', ['customerDetails' => $customerDetails, 'action' => $action, 'pdf' => $pdf]);
// Add the details to the PDF
$pdf->WriteHTML($html);
// Set the PDF filename
$filename = 'CustomerDetails_' . date('YmdHis') . '.pdf';
// Output the PDF for download
$pdf->Output($filename, 'D');
$this->logger->info("Print Addresses (Scheme) : Downloaded = ".$filename);
$this->logger->info("Print Addresses (Scheme): Downloaded = " . $filename);
} else {
$this->logger->info("Print Addresses (Scheme) : Details Not Available ");
// Handle case when customer details are not available
$this->logger->info("Print Addresses (Scheme): Details Not Available");
echo "<script>alert('Customer Details Not Available.');</script>";
echo "<script>setTimeout(function(){ window.location.href = '" . base_url("subscribers_list") . "'; }, 250);</script>";
}
} else {
$this->logger->info("Print Addresses (Scheme) : Schemes Not Choosen ");
echo "<script>alert('Schemes Not Choosen.');</script>";
// Handle case when no schemes are chosen
$this->logger->info("Print Addresses (Scheme): Schemes Not Chosen");
echo "<script>alert('Schemes Not Chosen.');</script>";
echo "<script>setTimeout(function(){ window.location.href = '" . base_url("subscribers_list") . "'; }, 250);</script>";
}
}
}
// public function generate_pdf()
// {

View File

@ -202,6 +202,7 @@ class Users extends BaseController
'last_name' => $this->request->getPost('last_name'),
'mobile_no' => $this->request->getPost('mobile_no'),
'date_of_birth' => NULL,
'event_id' => $this->request->getPost('event_id'),
'address' => $this->request->getPost('address'),
'gender' => $this->request->getPost('gender'),
'business_id' => $business_id
@ -290,4 +291,13 @@ class Users extends BaseController
}
return redirect()->route('user_list');
}
public function fetch_event_names()
{
$usersModel = new UsersModel();
$eventNames = $usersModel->getEventName();
return $this->response->setJSON(['eventNames' => $eventNames]);
}
}

View File

@ -0,0 +1,33 @@
<!-- email_template.html -->
<!DOCTYPE html>
<html lang="en">
<head>
<title>Order Confirmed</title>
</head>
<body>
<div style='border: 1px solid #ccc; padding: 20px; border-radius: 10px;'>
<h1 style='font-size: 24px; color: #4CAF50; margin-bottom: 10px;'>Order Confirmed</h1>
<p style='font-size: 18px; margin-bottom: 20px;'>Thank you for your order! Your invoice has been successfully approved.</p>
<strong>Order Details:</strong>
$lineitem_html
<ul>
<li>Order Date: <?php echo $approval_date; ?></li>
<li>Confirmed By: <?php echo $approved_by; ?></li>
<li>Order Reference ID: <?php echo $reference_number; ?></li>
</ul>
<!-- Download Invoice Button -->
<a href='" . base_url("download-invoice/$invoice_id") . "' style='display: inline-block; padding: 10px; background-color: #4CAF50; color: #fff; text-decoration: none; border-radius: 5px; margin-top: 20px;'>Download Invoice</a>
<br>
<p>Thank you for choosing us!</p>
<ul style='list-style: none;'>
<li><?php echo $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>
</ul>
</div>
</body>
</html>

View File

@ -95,25 +95,31 @@ public function existsSubscriptionDetails($where){
}
}
public function getSubscriptionInvoiceDetail($where)
{
$result = $this->getJoinedData($where);
if(!empty($result)){
foreach ($result as $i => $item) {
$invoiceId = $item['invoice_id'];
$scheme_name = [];
$invoiceItems = $this->getInvoiceItems($invoiceId,'');
foreach ($invoiceItems as $j => $child) {
if ($child->category_name == 'Membership') {
$scheme_name[] = $child->title;
}
public function getSubscriptionInvoiceDetail($where)
{
$result = $this->getJoinedData($where);
if (!empty($result)) {
foreach ($result as $i => $item) {
$invoiceId = $item['invoice_id'];
$schemes = [];
$invoiceItems = $this->getInvoiceItems($invoiceId, '');
foreach ($invoiceItems as $j => $child) {
if ($child->category_name == 'Membership') {
$schemes[] = [
'scheme_name' => $child->title,
'scheme_code' => $child->short_code, // Update this line to use the correct property
];
}
$result[$i]['scheme_name'] = !empty($scheme_name) ? implode(", ", $scheme_name) : '';
$result[$i]['invoice_items_details'] = $invoiceItems;
}
$result[$i]['scheme_name'] = !empty($schemes) ? implode(", ", array_column($schemes, 'scheme_name')) : '';
$result[$i]['scheme_code'] = !empty($schemes) ? implode(", ", array_column($schemes, 'scheme_code')) : '';
$result[$i]['invoice_items_details'] = $invoiceItems;
}
return $result;
}
return $result;
}
public function getJoinedData($where)
{
@ -324,7 +330,7 @@ public function get_general_invoice_data($f_date = null, $t_date = null)
$query = $this->db->table('invoice')
->select('invoice.*,DATE_FORMAT(invoice.invoice_date, "%d/%m/%Y") AS formatted_invoice_date, customers.*, COUNT(invoiceitems.product) as item_count')
->where('invoice.isactive', 1)
->where('invoice.invoice_type', 1)
->where('invoiceitems.isactive', 1);
// Add date range filter if provided
@ -394,6 +400,67 @@ public function itemwise_report_data($f_date = null, $t_date = null)
return $result;
}
public function getInvoiceIdByMd5($md5Hash)
{
$result = $this->db->table($this->table)
->select('invoice_id')
->get()
->getResult();
foreach ($result as $row) {
if (md5($row->invoice_id) === $md5Hash) {
return $row->invoice_id;
}
}
return null;
}
public function getExpiredCustomers($f_date = null, $t_date = null)
{
$now = date('Y-m-d');
$query = $this->db->table('subscription as S'); // Define $query here
if ($f_date !== null && $t_date !== null) {
$query->where('S.to_subscription >=', $f_date)
->where('S.to_subscription <=', $t_date);
}
$result = $query
->select('S.customer_id,S.sub_id, S.from_subscription, S.to_subscription, C.first_name, C.last_name, C.email, C.mobile_no, S.scheme_id,books.short_code')
->join('customers as C', 'C.customer_id = S.customer_id', 'left')
->join('books', 'books.book_id = S.scheme_id', 'left')
->where('S.isactive', 1)
->where('S.to_subscription <=', $now)
->get()
->getResultArray();
return $result;
}
public function itemwise_report_data_with_publish_code($f_date = null, $t_date = null)
{
// Fetch invoice data
$query = $this->db->table('invoice')
->select('invoice.*, books.* , COUNT(invoiceitems.product) as item_count , sum(invoiceitems.product * invoiceitems.unit_price) as item_cost')
->where('invoice.isactive', 1)
->where('books.isactive', 1)
->where('books.publishers_code', 'VJB'); // Additional condition for publish_code
// Add date range filter if provided
if ($f_date !== null && $t_date !== null) {
$query->where('invoice.invoice_date >=', $f_date)
->where('invoice.invoice_date <=', $t_date);
}
$result = $query->join('invoiceitems', 'invoiceitems.invoice_id = invoice.invoice_id', 'left')
->join('books', 'books.book_id = invoiceitems.product', 'left')
->groupBy('books.book_id')
->get()
->getResult();
// print_r($result);die;
return $result;
}
}

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','created_by'];
protected $allowedFields = ['book_id ','title','sku','description','price','features','short_code','duration','business_id','updated_by','category','isactive','created_by'];
public function insertScheme($data)
{
@ -20,7 +20,7 @@ class SchemeModel extends Model
public function getSchemeNamesAndDurationsByBusiness($business_id)
{
$builder = $this->builder();
$builder->select('books.book_id, books.title, books.price, books.duration, category.name as category_name');
$builder->select('books.book_id, books.title,books.short_code, books.price, books.duration, category.name as category_name');
$builder->join('book_categories', 'book_categories.book_id = books.book_id', 'left');
$builder->join('category', 'category.id = book_categories.category_id', 'left');
$builder->where('books.business_id', $business_id);
@ -37,7 +37,8 @@ class SchemeModel extends Model
'price' => $row->price,
'duration' => $row->duration,
'category_name' => $row->category_name,
'book_id'=>$row->book_id
'book_id'=>$row->book_id,
'short_code'=>$row->short_code,
];
}

View File

@ -88,6 +88,7 @@ public function getCustomerAddressesBySchemeName($schemeName)
}
public function getAllCustomerDetailsBySchemeName($schemeName)
{
$currentDate = date('Y-m-d');
$builder = $this->db->table('subscription');
$builder->select('customers.customer_id, CONCAT(customers.first_name, " ", customers.last_name) as customer_name,customer_addresses.mobile_no, customer_addresses.address_1,customer_addresses.address_2, customer_addresses.city, customer_addresses.state, customer_addresses.postal_code,business.title as business_name,business.address as business_address,business.city as business_city,business.state as business_state,business.postal_code as business_postal_code,books.title,from_subscription,to_subscription,business.title as business_name,business.mobile_no as business_mobile_no,states.state_name');
$builder->join('customers', 'customers.customer_id = subscription.customer_id');
@ -96,12 +97,13 @@ public function getAllCustomerDetailsBySchemeName($schemeName)
$builder->join('books', 'books.book_id = subscription.scheme_id');
$builder->join('states', 'states.state_short_name = customer_addresses.state');
$builder->where('books.title', $schemeName);
$builder->where('subscription.to_subscription >=', $currentDate);
$builder->where('customer_addresses.address_type', 2); // Filter by address_type 2
$builder->orderBy('customers.customer_id', 'ASC'); // Order by customer_id to group by customers
// Fetch the query result
$query = $builder->get();
// print_r($query);die;
$customerDetails = [];
if ($query->getNumRows() > 0) {
@ -150,6 +152,197 @@ public function getAllCustomerDetailsBySchemeName($schemeName)
return $customerDetails;
}
public function getAllActiveCustomerDetails($selectedScheme)
{
// $currentDate = date('Y-m-d');
$builder = $this->db->table('subscription');
$builder->select('customers.customer_id, CONCAT(customers.first_name, " ", customers.last_name) as customer_name, customer_addresses.mobile_no, customer_addresses.address_1, customer_addresses.address_2, customer_addresses.city, customer_addresses.state, customer_addresses.postal_code, business.title as business_name, books.title, from_subscription, to_subscription, business.mobile_no as business_mobile_no, business.address as business_address,business.city as business_city,business.state as business_state,business.postal_code as business_postal_code,books.title,from_subscription,to_subscription,business.title as business_name,business.mobile_no as business_mobile_no,states.state_name');
$builder->join('customers', 'customers.customer_id = subscription.customer_id');
$builder->join('customer_addresses', 'customer_addresses.customer_id = customers.customer_id');
$builder->join('business', 'business.business_id = subscription.business_id');
$builder->join('books', 'books.book_id = subscription.scheme_id');
$builder->join('states', 'states.state_short_name = customer_addresses.state');
// Active subscriptions only
$builder->where('books.title', $schemeName);
$builder->where('customer_addresses.address_type', 2); // Filter by address_type 2
$builder->orderBy('customers.customer_id', 'ASC'); // Order by customer_id to group by customers
$query = $builder->get();
$activeCustomerDetails = [];
if ($query->getNumRows() > 0) {
$currentCustomerID = null;
$shippingAddress = [];
foreach ($query->getResultArray() as $row) {
$customerID = $row['customer_id'];
if ($currentCustomerID !== $customerID) {
// New customer, add the previous customer's details (if any)
if (!empty($shippingAddress)) {
$activeCustomerDetails[] = $shippingAddress;
}
// Start a new customer's details
$shippingAddress = [
'customer_name' => $row['customer_name'],
'address_1' => $row['address_1'],
'address_2' => $row['address_2'],
'mobile_no' => $row['mobile_no'],
'city' => $row['city'],
'state' => $row['state'],
'state_name' => $row['state_name'] != "" ? $row['state_name'] : $row['state'],
'postal_code' => $row['postal_code'],
'title' => $row['title'],
'to_subscription' => $row['to_subscription'],
'company_name' => $row['business_name'],
'company_mobile_no' => $row['business_mobile_no'],
'company_city'=>$row['business_city'],
];
$currentCustomerID = $customerID;
}
}
// Add the last customer's details (if any)
if (!empty($shippingAddress)) {
$activeCustomerDetails[] = $shippingAddress;
}
}
return $activeCustomerDetails;
}
public function getAllExpiredCustomerDetailsByScheme($schemeName)
{
$currentDate = date('Y-m-d');
$builder = $this->db->table('subscription');
$builder->select('customers.customer_id, CONCAT(customers.first_name, " ", customers.last_name) as customer_name, customer_addresses.mobile_no, customer_addresses.address_1, customer_addresses.address_2, customer_addresses.city, customer_addresses.state, customer_addresses.postal_code, business.title as business_name, books.title, from_subscription, to_subscription, business.mobile_no as business_mobile_no, states.state_name');
$builder->join('customers', 'customers.customer_id = subscription.customer_id');
$builder->join('customer_addresses', 'customer_addresses.customer_id = customers.customer_id');
$builder->join('business', 'business.business_id = subscription.business_id');
$builder->join('books', 'books.book_id = subscription.scheme_id');
$builder->join('states', 'states.state_short_name = customer_addresses.state');
$builder->where('books.title', $schemeName);
$builder->where('subscription.to_subscription <', $currentDate); // Expired subscriptions only
$builder->where('customer_addresses.address_type', 2); // Filter by address_type 2
$builder->orderBy('customers.customer_id', 'ASC'); // Order by customer_id to group by customers
// Fetch the query result
$query = $builder->get();
$customerDetails = [];
if ($query->getNumRows() > 0) {
$currentCustomerID = null;
$shippingAddress = [];
foreach ($query->getResultArray() as $row) {
$customerID = $row['customer_id'];
if ($currentCustomerID !== $customerID) {
// New customer, add the previous customer's details (if any)
if (!empty($shippingAddress)) {
$customerDetails[] = $shippingAddress;
}
// Start a new customer's details
$shippingAddress = [
'customer_name' => $row['customer_name'],
'address_1' => $row['address_1'],
'address_2' => $row['address_2'],
'mobile_no' => $row['mobile_no'],
'city' => $row['city'],
'state' => $row['state'],
'state_name' => $row['state_name'] != "" ? $row['state_name'] : $row['state'],
'postal_code' => $row['postal_code'],
'title' => $row['title'],
'to_subscription' => $row['to_subscription'],
'company_name' => $row['business_name'],
'company_mobile_no' => $row['business_mobile_no'],
];
$currentCustomerID = $customerID;
}
}
// Add the last customer's details (if any)
if (!empty($shippingAddress)) {
$customerDetails[] = $shippingAddress;
}
}
return $customerDetails;
}
public function getBothDetailsSchemeName($schemeName)
{
$builder = $this->db->table('subscription');
$builder->select('customers.customer_id, CONCAT(customers.first_name, " ", customers.last_name) as customer_name, customer_addresses.mobile_no, customer_addresses.address_1, customer_addresses.address_2, customer_addresses.city, customer_addresses.state, customer_addresses.postal_code, business.title as business_name, books.title, from_subscription, to_subscription, business.mobile_no as business_mobile_no, business.address as business_address, business.city as business_city, business.state as business_state, business.postal_code as business_postal_code, books.title, states.state_name');
$builder->join('customers', 'customers.customer_id = subscription.customer_id');
$builder->join('customer_addresses', 'customer_addresses.customer_id = customers.customer_id');
$builder->join('business', 'business.business_id = subscription.business_id');
$builder->join('books', 'books.book_id = subscription.scheme_id');
$builder->join('states', 'states.state_short_name = customer_addresses.state');
$builder->where('books.title', $schemeName);
$builder->where('customer_addresses.address_type', 2); // Filter by address_type 2
$builder->orderBy('customers.customer_id', 'ASC'); // Order by customer_id to group by customers
$query = $builder->get();
$customerDetails = [];
if ($query->getNumRows() > 0) {
$currentCustomerID = null;
$shippingAddress = [];
foreach ($query->getResultArray() as $row) {
// print_r($row);die;
$customerID = $row['customer_id'];
if ($currentCustomerID !== $customerID) {
// New customer, add the previous customer's details (if any)
if (!empty($shippingAddress)) {
$customerDetails[]= $shippingAddress;
}
// Start a new customer's details
$shippingAddress = [
'customer_name' => $row['customer_name'],
'address_1' => $row['address_1'],
'address_2' => $row['address_2'],
'mobile_no' => $row['mobile_no'],
'city' => $row['city'],
'state' => $row['state'],
'state_name' => $row['state_name'] != "" ? $row['state_name'] : $row['state'],
'postal_code' => $row['postal_code'],
'title' => $row['title'],
'to_subscription' => $row['to_subscription'],
'company_name' => $row['business_name'],
'company_mobile_no' => $row['business_mobile_no'],
'company_city' => $row['business_city'],
'company_state' => $row['business_state'],
'company_postal_code' => $row['business_postal_code'],
];
$currentCustomerID = $customerID;
}
}
// Add the last customer's details (if any)
if (!empty($shippingAddress)) {
$customerDetails[] = $shippingAddress;
}
}
return $customerDetails;
}
}

View File

@ -5,7 +5,7 @@ class UsersModel 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','created_by','updated_by'];
protected $allowedFields = ['user_id','user_name','email','event_id','first_name','last_name','password','mobile_no','date_of_birth','address','gender','profile_picture','city','state','postal_code','country','role','isactive','business_id','created_by','updated_by'];
public function saveData($data, $id = null)
{
@ -17,6 +17,17 @@ class UsersModel extends Model
return $this->update($id, $data);
}
}
public function getEventName()
{
return $this->db->table('events')
->select('events.*')
->get()
->getResult();
print_r($this->db->getLastQuery());die;
}
}

View File

@ -119,6 +119,10 @@
</div>
<br>
<?php } ?>
<a href="<?= base_url()."invoice_number_format/1"; ?>">
<i class="fe-check-square"></i>
<span> Invoice Number Format </span>
</a>
<div class="form-group text-right m-b-0">
<button class="btn btn-success waves-effect waves-light mr-1" type="submit" id="submitBtn">
Submit

30
app/Views/email_temp.php Normal file
View File

@ -0,0 +1,30 @@
<!-- email_template.html -->
<!DOCTYPE html>
<html lang="en">
<head>
<title>Order Confirmed</title>
</head>
<body>
<div style='border: 1px solid #ccc; padding: 20px; border-radius: 10px;'>
<h1 style='font-size: 24px; color: #4CAF50; margin-bottom: 10px;'>Order Confirmed</h1>
<p style='font-size: 18px; margin-bottom: 20px;'>Thank you for your order! Your invoice has been successfully approved.</p>
<strong>Order Details:</strong>
$lineitem_html
<ul>
<li>Order Date: $approval_date</li>
<li>Confirmed By: $approved_by</li>
<li>Order Reference ID: $reference_number</li>
</ul>
<!-- Download Invoice Button -->
<a href='" . base_url("download-invoice/$invoice_id") . "' style='display: inline-block; padding: 10px; background-color: #4CAF50; color: #fff; text-decoration: none; border-radius: 5px; margin-top: 20px;'>Download Invoice</a>
<br>
<p>Thank you for choosing us!</p>
<ul style='list-style: none;'>
<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>
</ul>
</div>
</body>
</html>

View File

@ -212,32 +212,27 @@ td.invoice-number {
<table class="invoice-related-table">
<thead>
<tr>
<th>Image</th>
<th>S.no</th>
<th>Item Name</th>
<th>Qty</th>
<th>Rate</th>
<th>Tax</th>
<th>Discount</th>
<th>Discount</th>
<th>Total</th>
</tr>
</thead>
<tbody>
<?php $serialNumber = 1; ?>
<?php foreach ($invoiceItems as $item) : ?>
<tr>
<td>
<?php if (!empty($item->imgs[0]->wp_img_url)) : ?>
<img src="<?= $item->imgs[0]->wp_img_url?>" alt="Product Image"style="max-width: 50px; max-height: 30px;">
<?php else : ?>
<?php if (isset($item->imgs[0]) && !empty($item->imgs[0]->img_name)) : ?>
<img src="<?= base_url('public/uploads/' . $item->imgs[0]->img_name) ?>" alt="Fallback Image"style="max-width: 50px; max-height: 30px;">
<?php endif; ?>
<?php endif; ?>
<?= $serialNumber++; ?>
</td>
<td><?= $item->title ?></td>
<td><?= $item->quantity ?></td>
<td><?= number_format($item->unit_price, 2, '.', ',') ?></td>
<td><?= $item->tax ?></td>
<td>
<?php if ($item->discount_type === '%') : ?>
<?= $item->discount_amount ?>%
@ -255,9 +250,7 @@ td.invoice-number {
<tr>
<td colspan="5" align="right">Subtotal : &nbsp;&nbsp;<?= number_format($value->subtotal, 2, '.', ',') ?></td>
</tr>
<tr>
<td colspan="5" align="right">TAX : &nbsp;&nbsp;<?= number_format($value->tax, 2, '.', ',') ?></td>
</tr>
<tr>
<td colspan="5" align="right">Discount : &nbsp;&nbsp;<?= number_format($value->discount, 2, '.', ',') ?></td>
</tr>
@ -302,5 +295,15 @@ td.invoice-number {
endforeach; ?>
</div>
<?php endforeach; ?>
<!-- ... (your existing HTML template) -->
<!-- Add this to the end of your HTML template -->
<div class="footer">
<!-- <img src="https://cdn.pixabay.com/photo/2012/04/26/14/17/blue-42596_960_720.png" /> -->
</div>
</body>
</html>

View File

@ -2,22 +2,28 @@
/* Show the form section by default */
#mailFormDiv { display: none; }
#whatsappFormDiv { display: none; }
img {
max-width: 20px; /* Adjust as needed */
max-height: 20px; /* Adjust as needed */
}
</style>
<div class="card">
<div class="card-body">
<div class="row">
<div class="col">
<a class="dropdown-icon-item" id="showMailLink">
<input type="radio" name="notificationType" id="showMailLink" value="mail" >
<label for="mailRadio">
<img src="<?= base_url() . "public/assets/images/brands/gmail.png" ?>" alt="mail">
<span>Mail Custom Notification</span>
</a>
</label>
</div>
<div class="col">
<a class="dropdown-icon-item" id="showWhatsappLink">
<input type="radio" name="notificationType" id="showWhatsappLink" value="whatsapp">
<label for="whatsappRadio">
<img src="<?= base_url() . "public/assets/images/brands/whatsapp.png" ?>" alt="whatsapp">
<span>Whatsapp Custom Notification</span>
</a>
</label>
</div>
<!-- <div class="col">
<a class="dropdown-icon-item" href="<?= base_url()."send_whatsapp_message"; ?>">
@ -58,7 +64,7 @@
<div id="textDiv">
<span class="widget-simple text-center">
<div class="media-body align-self-center font-24 avatar-title">
<p style="color: #0a0a0a!important;" class="mt-0" style><?= "Please Choose Your Choice....."; ?></p>
<p style="color: #0a0a0a!important;" class="mt-0" style><?= "Please Choose Message Mode....."; ?></p>
</div>
</span>
</div>
@ -163,27 +169,31 @@
</div>
</div>
<div class="form-group row">
<label for="type" class="col-4 col-form-label">Message Type</label>
<div class="col-7">
<select class="form-control" id="type" name="type">
<!-- <option value="">Choose your Message Type</option> -->
<option value="text">Text</option>
<option value="media">Media</option>
</select>
</div>
</div>
<label class="col-4 col-form-label">Message Type</label>
<div class="col-7">
<div class="form-check form-check-inline">
<input class="form-check-input" type="radio" name="type" id="textType" value="text" checked>
<label class="form-check-label" for="textType">Text</label>
</div>
<div class="form-check form-check-inline">
<input class="form-check-input" type="radio" name="type" id="mediaType" value="media">
<label class="form-check-label" for="mediaType">Media</label>
</div>
</div>
</div>
<div id="fields-for-mediaurl" style="display: none;">
<div class="form-group row">
<label for="media_url" class="col-4 col-form-label">Media Url</label>
<label for="media_url" class="col-4 col-form-label">Media Link</label>
<div class="col-7">
<input type="text" placeholder="Media URL" class="form-control" id="media_url" name="media_url">
<input type="text" placeholder="Media Link" class="form-control" id="media_url" name="media_url">
</div>
</div>
</div>
<div class="form-group row">
<label for="message" class="col-4 col-form-label">Message <span class="text-danger"> *</span></label>
<div class="col-7">
<textarea id="message" name="description" class="form-control" rows="5">Hello {USER_NAME},Please,write text here!</textarea>
<textarea id="message" name="description" class="form-control" rows="5">Message text here</textarea>
</div>
</div>
<div class="form-group text-right m-b-0">
@ -245,20 +255,22 @@
});
// Get references to the dropdown and field divs
const dropdown = document.getElementById("type");
const fieldsForMediaURL = document.getElementById("fields-for-mediaurl");
const radioTextType = document.getElementById("textType");
const radioMediaType = document.getElementById("mediaType");
const fieldsForMediaURL = document.getElementById("fields-for-mediaurl");
// Add change event listeners to the radio buttons
radioTextType.addEventListener("change", function () {
// If "Text" is selected, hide the media URL field
fieldsForMediaURL.style.display = "none";
document.getElementById("media_url").value = "";
});
radioMediaType.addEventListener("change", function () {
// If "Media" is selected, show the media URL field
fieldsForMediaURL.style.display = "block";
});
// Add a change event listener to the dropdown
dropdown.addEventListener("change", function() {
// Determine which option is selected and show the corresponding fields
const selectedOption = dropdown.value;
if(selectedOption === "media"){
fieldsForMediaURL.style.display = "block";
} else {
fieldsForMediaURL.style.display = "none";
document.getElementById("media_url").value = "";
}
});
const categories = document.getElementById("categories");
const fieldsForGroupID = document.getElementById("fields-for-groupid");

View File

@ -29,6 +29,7 @@
margin-top: 30px;
margin-left: 10px;
}
.customer-details {
@ -80,11 +81,28 @@
<div class="header">
<!-- <img src="https://vijayabharathambooks.com/wp-content/uploads/2021/09/vijaya-bharatham-logo-8pt.png" alt="Business Logo" class="business-logo"><br> -->
<div style="float:left; width:80px;margin-right:10px;"><img src="https://vbp.venbait.in/wp-content/uploads/2023/05/1111.png" alt="Business Logo" class="business-logo"/></div>
<div style="text-align:left;font-size:12px;">From<br/>
<?= $customerDetails[$i]['company_name']; ?><br>
<?= $customerDetails[$i]['company_address']; ?><br>
<?= $customerDetails[$i]['company_city'] ?> - <?= $customerDetails[$i]['company_postal_code']; ?>
<?= 'Mobile : '.$customerDetails[$i]['company_mobile_no']; ?></div>
<div style="text-align:left;font-size:12px;">F From<br/>
<?= $customerDetails[$i]['company_name']; ?><br>
<?php if (isset($customerDetails[$i]['company_address'])) : ?>
<?= $customerDetails[$i]['company_address']; ?><br>
<?php else : ?>
Company Address Not Available<br>
<?php endif; ?>
<?php if (isset($customerDetails[$i]['company_city'])) : ?>
<?= $customerDetails[$i]['company_city']; ?> -
<?php else : ?>
City Not Available -
<?php endif; ?>
<?php if (isset($customerDetails[$i]['company_postal_code'])) : ?>
<?= $customerDetails[$i]['company_postal_code']; ?><br>
<?php else : ?>
Postal Code Not Available<br>
<?php endif; ?>
<?= 'Mobile : ' . $customerDetails[$i]['company_mobile_no']; ?></div>
</div>
</div>
<?php
@ -124,6 +142,7 @@
.bill-details {
margin-bottom: 20px;
font-size:12px;
}
.customer-details {
@ -164,11 +183,28 @@
<!-- <img src="https://vijayabharathambooks.com/wp-content/uploads/2021/09/vijaya-bharatham-logo-8pt.png" alt="Business Logo" class="business-logo"><br> -->
<!-- <div style="float:left; width:80px;margin-right:10px;"><img src="<?= base_url('public/uploads/vijayabharathampdf.png') ?>" alt="Business Logo" class="business-logo"/></div> -->
<div style="float:left; width:80px;margin-right:10px;"><img src="https://vbp.venbait.in/wp-content/uploads/2023/05/1111.png" alt="Business Logo" class="business-logo"/></div>
<div style="text-align:left;font-size:12px;">From<br/>
<?= $customerDetails[$i]['company_name']; ?><br>
<?= $customerDetails[$i]['company_address']; ?><br>
<?= $customerDetails[$i]['company_city'] ?> - <?= $customerDetails[$i]['company_postal_code']; ?>
<?= 'Mobile : '.$customerDetails[$i]['company_mobile_no']; ?>
<div style="text-align:left;font-size:12px;"> From<br/>
<?= $customerDetails[$i]['company_name']; ?><br>
<?php if (isset($customerDetails[$i]['company_address'])) : ?>
<?= $customerDetails[$i]['company_address']; ?><br>
<?php else : ?>
Company Address Not Available<br>
<?php endif; ?>
<?php if (isset($customerDetails[$i]['company_city'])) : ?>
<?= $customerDetails[$i]['company_city']; ?> -
<?php else : ?>
City Not Available -
<?php endif; ?>
<?php if (isset($customerDetails[$i]['company_postal_code'])) : ?>
<?= $customerDetails[$i]['company_postal_code']; ?><br>
<?php else : ?>
Postal Code Not Available<br>
<?php endif; ?>
<?= 'Mobile : ' . $customerDetails[$i]['company_mobile_no']; ?>
</div>
</div>
</div>

View File

@ -0,0 +1,265 @@
<!-- start page title -->
<div class="row">
<div class="col-md-4">
<div class="page-title-box page-title-box-alt">
<h4 class="page-title"><?= $page_name ?></h4>
</div>
</div>
<div class="offset-md-3 col-md-5">
<form action="<?php echo base_url('general_inv_rp'); ?>" method="post">
<div class="form-group">
<div class="row">
<div class="col-md-7">
<div class="input-group">
<input type="text" class="form-control input-daterange-datepicker" name="date" />
</div>
<!-- <input class="form-control input-daterange-datepicker" type="text" name="date" value="<?php if (isset($selected_data)) { echo $selected_data; } ?>" /> -->
</div>
<div class="col-md-5">
<button type="submit" class="btn btn-primary">Generate Report</button>
</div>
</div>
</div>
</form>
</div>
</div>
<!-- end page title -->
<div class="row">
<div class="col-12">
<div class="card">
<div class="card-body">
<div class="col-md-12">
<button type="button" class="btn btn-primary show-column-selection-modal" style="margin-left: 870px;">Select Columns</button>
</div>
<div class="table-responsive">
<table id="datatable-buttons" class="table table-striped nowrap w-100">
<thead>
<tr>
<th hidden>id</th>
<th>Book Name</th>
<th>Author</th>
<th>Cost</th>
<th>Published On</th>
<th>Inv Date</th>
</tr>
</thead>
<tbody>
<?php foreach ($report_data as $row) { ?>
<tr>
<td hidden><?php echo $row->title; ?></td>
<td><?php echo $row->title; ?></td>
<td><?php echo $row->publisher; ?></td>
<td><?php echo $row->price ?></td>
<td><?php echo $row->publishers_code?></td>
<td><?php echo $row->invoice_date ?></td>
</tr>
<?php } ?>
</tbody>
</table>
</div>
<div class="modal fade" id="columnSelectionModal" tabindex="-1" role="dialog" aria-labelledby="columnSelectionModalLabel" aria-hidden="true">
<div class="modal-dialog" role="document">
<div class="modal-content">
<div class="modal-header">
<h5 class="modal-title" id="columnSelectionModalLabel">Select Columns to Display</h5>
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
<span aria-hidden="true">&times;</span>
</button>
</div>
<div class="modal-body">
<!-- Add checkboxes for each column -->
<div class="form-check form-check-inline">
<input type="checkbox" class="form-check-input column-toggle" data-column="1" checked> Invoice No
</div><br>
<div class="form-check form-check-inline">
<input type="checkbox" class="form-check-input column-toggle" data-column="2" checked> Invoice Date
</div><br>
<div class="form-check form-check-inline">
<input type="checkbox" class="form-check-input column-toggle" data-column="3" checked> Customer Name
</div><br>
<div class="form-check form-check-inline">
<input type="checkbox" class="form-check-input column-toggle" data-column="4" checked> GST
</div><br>
<div class="form-check form-check-inline">
<input type="checkbox" class="form-check-input column-toggle" data-column="5" checked> Discount
</div><br>
<div class="form-check form-check-inline">
<input type="checkbox" class="form-check-input column-toggle" data-column="6" checked> Count
</div><br>
<div class="form-check form-check-inline">
<input type="checkbox" class="form-check-input column-toggle" data-column="7" checked> OT Charges
</div><br>
<div class="form-check form-check-inline">
<input type="checkbox" class="form-check-input column-toggle" data-column="8" checked> Total
</div><br>
<div class="form-check form-check-inline">
<input type="checkbox" class="form-check-input column-toggle" data-column="9" checked>Status
</div><br>
<div class="form-check form-check-inline">
<input type="checkbox" class="form-check-input column-toggle" data-column="10" checked>Type of Invoice
</div><br>
<div class="form-check form-check-inline">
<input type="checkbox" class="form-check-input column-toggle" data-column="11" checked>Payment
</div><br>
<!-- Repeat similar blocks for other columns -->
</div>
<div class="modal-footer">
<button type="button" class="btn btn-secondary" data-dismiss="modal">Close</button>
<button type="button" class="btn btn-primary apply-column-selection">Apply</button>
</div>
</div>
</div>
</div>
</div> <!-- end card body-->
</div> <!-- end card -->
</div><!-- end col-->
</div>
<!-- end row-->
<script>
$(document).ready(function() {
var table = $('#datatable-buttons').DataTable({
"order": [
[0, 'desc']
],
"dom": 'Bfrtip',
buttons: [{
extend: 'print',
text: 'Print',
title: 'General Invoice Report',
customize: function(win) {
// Exclude the first and last columns
$(win.document.body).find('table').find('th:first-child, td:first-child').remove();
}
},
{
extend: 'csv',
text: 'CSV',
title: 'General Invoice Report',
exportOptions: {
columns: ':not(:first-child)'
}
}
],
columnDefs: [{
type: 'date',
targets: [1, 2, 3, 4, 5, 6, 7, 8, 9, 10],
orderable: false
} // Specify the column index for date sorting and disable sorting
]
});
});
//have to adjust the script coording to this report
// $('.show-column-selection-modal').on('click', function() {
// // Hide dropdowns when the modal is shown
// $('.table-responsive select').hide();
// $('#columnSelectionModal').modal('show');
// });
// // Handle column visibility toggling
// $('.column-toggle').on('change', function() {
// var column = table.column($(this).data('column'));
// column.visible(!column.visible());
// // Remove corresponding values when column is removed
// if (!column.visible()) {
// // Find the index of the column
// var columnIndex = $(this).data('column');
// // Remove values from the column selection dropdown
// $('#datatable-buttons thead tr:eq(1) th:eq(' + columnIndex + ') select').remove();
// // Remove the date range filter for the column
// if (columnIndex === 2) {
// $('#datatable-buttons thead tr:eq(2) th:eq(2) input').daterangepicker('destroy').remove();
// }
// }
// });
// // Apply Column Selection
// $('.apply-column-selection').on('click', function() {
// // Show dropdowns when the modal is closed
// $('.table-responsive select').show();
// $('#columnSelectionModal').modal('hide');
// });
// // Add date range filter and dropdowns
// $('#datatable-buttons thead tr').clone(true).appendTo('#datatable-buttons thead');
// $('#datatable-buttons thead tr:eq(1) th').each(function(i) {
// var title = $(this).text();
// // For non-"Invoice Date" columns, add a dropdown
// var uniqueValues = table.column(i).data().unique().sort();
// var select = $('<select class="form-control form-control-sm"><option value="">Search ' + title + '</option></select>')
// .appendTo($(this).empty())
// .on('change', function() {
// var val = $.fn.dataTable.util.escapeRegex($(this).val());
// table.column(i)
// .search(val ? '^' + val + '$' : '', true, false)
// .draw();
// });
// uniqueValues.each(function(d, j) {
// select.append('<option value="' + d + '">' + d + '</option>');
// });
// $('input', this).on('keyup change', function() {
// if (table.column(i).search() !== this.value) {
// table
// .column(i)
// .search(this.value)
// .draw();
// }
// });
// });
// // Add date range filter for "Invoice Date" column
// var dateRangeFilter = $('input.input-daterange-datepicker')
// .daterangepicker({
// autoUpdateInput: false,
// locale: {
// format: 'DD/MM/YYYY',
// cancelLabel: 'Clear'
// },
// ranges: {
// 'Today': [moment(), moment()],
// 'Yesterday': [moment().subtract(1, 'days'), moment().subtract(1, 'days')],
// 'This Month': [moment().startOf('month'), moment().endOf('month')]
// }
// })
// .on('apply.daterangepicker', function (ev, picker) {
// $(this).val(picker.startDate.format('DD/MM/YYYY') + ' - ' + picker.endDate.format('DD/MM/YYYY'));
// })
// .on('cancel.daterangepicker', function () {
// $(this).val('');
// });
// // Add click events for "Today" and "Yesterday" buttons
// $('.today-btn').on('click', function () {
// var today = moment();
// dateRangeFilter.data('daterangepicker').setStartDate(today);
// dateRangeFilter.data('daterangepicker').setEndDate(today);
// dateRangeFilter.trigger('apply.daterangepicker');
// });
// $('.yesterday-btn').on('click', function () {
// var yesterday = moment().subtract(1, 'days');
// dateRangeFilter.data('daterangepicker').setStartDate(yesterday);
// dateRangeFilter.data('daterangepicker').setEndDate(yesterday);
// dateRangeFilter.trigger('apply.daterangepicker');
// });
// });
</script>

View File

@ -0,0 +1,169 @@
<!-- start page title -->
<div class="row">
<div class="col-md-4">
<div class="page-title-box page-title-box-alt">
<h4 class="page-title"><?= $page_name ?></h4>
</div>
</div>
<div class="offset-md-3 col-md-5">
<form action="<?php echo base_url('expired_customer_report'); ?>" method="post">
<div class="form-group">
<div class="row">
<div class="col-md-7">
<input class="form-control input-daterange-datepicker" type="text" name="date" value="<?php if(isset($selected_data)) { echo $selected_data; } ?>"/>
</div>
<div class="col-md-5">
<button type="submit" class="btn btn-primary">Generate Report</button>
</div>
</div>
</div>
</form>
</div>
</div>
<div class="row">
<div class="col-12">
<div class="card">
<div class="card-body">
<div class="table-responsive">
<table id="datatable-buttons" class="table table-striped nowrap w-100">
<thead>
<tr>
<th hidden>id</th>
<th>Member Name</th>
<th>Mobile Number</th>
<th>Email</th>
<th>Scheme Code</th>
<th>From Subscription</th>
<th>To Subscription</th>
</tr>
</thead>
<tbody>
<?php foreach ($expired_customers as $row) { ?>
<tr>
<td hidden><?php echo $row["sub_id"]; ?></td>
<td><?= $row['first_name'] . ' ' . $row['last_name'] ?></td>
<td><?= $row['mobile_no'] ?></td>
<td><?= $row['email'] ?></td>
<td><?= $row['short_code'] ?></td>
<td><?= $row['from_subscription'] ?></td>
<td><?= $row['to_subscription'] ?></td>
</tr>
<?php } ?>
</tbody>
</table>
</div>
</div> <!-- end card body-->
</div> <!-- end card -->
</div><!-- end col-->
</div>
<!-- end row-->
<script>
$(document).ready(function() {
var table = $('#datatable-buttons').DataTable({
"order": [[0, 'desc']],
"dom": 'Bfrtip',
buttons: [
{
extend: 'print',
title: 'Experiref\d Invoice Report',
text: 'Print',
customize: function(win) {
// Exclude the first and last columns
$(win.document.body).find('table').find('th:first-child, td:first-child').remove();
}
},
{
extend: 'csv',
text: 'CSV',
title: 'Membership Invoice Report',
exportOptions: {
columns: ':not(:first-child)'
}
}
],
columnDefs: [
{ type: 'date', targets: [1,2,3,4,5,6], orderable: false }
// Specify the column index for date sorting and disable sorting
]
});
// Add date range filter and dropdowns
$('#datatable-buttons thead tr').clone(true).appendTo('#datatable-buttons thead');
$('#datatable-buttons thead tr:eq(1) th').each(function (i) {
var title = $(this).text();
// For non-"Invoice Date" columns, add a dropdown
var uniqueValues = table.column(i).data().unique().sort();
var select = $('<select class="form-control form-control-sm"><option value="">Search ' + title + '</option></select>')
.appendTo($(this).empty())
.on('change', function () {
var val = $.fn.dataTable.util.escapeRegex($(this).val());
table.column(i)
.search(val ? '^' + val + '$' : '', true, false)
.draw();
});
uniqueValues.each(function (d, j) {
select.append('<option value="' + d + '">' + d + '</option>');
});
$('input', this).on('keyup change', function () {
if (table.column(i).search() !== this.value) {
table
.column(i)
.search(this.value)
.draw();
}
});
});
// Add date range filter for "Invoice Date" column
var dateRangeFilter = $('input.input-daterange-datepicker')
.daterangepicker({
autoUpdateInput: false,
locale: {
format: 'DD/MM/YYYY',
cancelLabel: 'Clear'
},
ranges: {
'Today': [moment(), moment()],
'Yesterday': [moment().subtract(1, 'days'), moment().subtract(1, 'days')],
'This Month': [moment().startOf('month'), moment().endOf('month')]
}
})
.on('apply.daterangepicker', function (ev, picker) {
$(this).val(picker.startDate.format('DD/MM/YYYY') + ' - ' + picker.endDate.format('DD/MM/YYYY'));
})
.on('cancel.daterangepicker', function () {
$(this).val('');
});
// Add click events for "Today" and "Yesterday" buttons
$('.today-btn').on('click', function () {
var today = moment();
dateRangeFilter.data('daterangepicker').setStartDate(today);
dateRangeFilter.data('daterangepicker').setEndDate(today);
dateRangeFilter.trigger('apply.daterangepicker');
});
$('.yesterday-btn').on('click', function () {
var yesterday = moment().subtract(1, 'days');
dateRangeFilter.data('daterangepicker').setStartDate(yesterday);
dateRangeFilter.data('daterangepicker').setEndDate(yesterday);
dateRangeFilter.trigger('apply.daterangepicker');
});
});
</script>

View File

@ -10,8 +10,13 @@
<div class="form-group">
<div class="row">
<div class="col-md-7">
<input class="form-control input-daterange-datepicker" type="text" name="date" value="<?php if (isset($selected_data)) { echo $selected_data; } ?>" />
<div class="input-group">
<input type="text" class="form-control input-daterange-datepicker" name="date" />
</div>
<!-- <input class="form-control input-daterange-datepicker" type="text" name="date" value="<?php if (isset($selected_data)) { echo $selected_data; } ?>" /> -->
</div>
<div class="col-md-5">
<button type="submit" class="btn btn-primary">Generate Report</button>
</div>
@ -26,6 +31,10 @@
<div class="col-12">
<div class="card">
<div class="card-body">
<div class="col-md-12">
<button type="button" class="btn btn-primary show-column-selection-modal" style="margin-left: 870px;">Select Columns</button>
</div>
<div class="table-responsive">
<table id="datatable-buttons" class="table table-striped nowrap w-100">
<thead>
@ -40,6 +49,7 @@
<th>OT Charges</th>
<th>Total</th>
<th>Status</th>
<th>Type of Invoice</th>
<th>Payment</th>
</tr>
</thead>
@ -58,6 +68,7 @@
<td><?php echo '₹' . number_format($row->shipping_charge, 2, '.', ','); ?></td>
<td><?php echo '₹' . number_format($row->total_amount, 2, '.', ','); ?></td>
<td><?php echo $row->status; ?></td>
<td><?php echo ($row->invoice_type == 1) ? 'Book Invoice' : 'Membership Invoice'; ?></td>
<td><?php echo $row->payment_method; ?></td>
</tr>
<?php } ?>
@ -65,6 +76,65 @@
</table>
</div>
<div class="modal fade" id="columnSelectionModal" tabindex="-1" role="dialog" aria-labelledby="columnSelectionModalLabel" aria-hidden="true">
<div class="modal-dialog" role="document">
<div class="modal-content">
<div class="modal-header">
<h5 class="modal-title" id="columnSelectionModalLabel">Select Columns to Display</h5>
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
<span aria-hidden="true">&times;</span>
</button>
</div>
<div class="modal-body">
<!-- Add checkboxes for each column -->
<div class="form-check form-check-inline">
<input type="checkbox" class="form-check-input column-toggle" data-column="1" checked> Invoice No
</div><br>
<div class="form-check form-check-inline">
<input type="checkbox" class="form-check-input column-toggle" data-column="2" checked> Invoice Date
</div><br>
<div class="form-check form-check-inline">
<input type="checkbox" class="form-check-input column-toggle" data-column="3" checked> Customer Name
</div><br>
<div class="form-check form-check-inline">
<input type="checkbox" class="form-check-input column-toggle" data-column="4" checked> GST
</div><br>
<div class="form-check form-check-inline">
<input type="checkbox" class="form-check-input column-toggle" data-column="5" checked> Discount
</div><br>
<div class="form-check form-check-inline">
<input type="checkbox" class="form-check-input column-toggle" data-column="6" checked> Count
</div><br>
<div class="form-check form-check-inline">
<input type="checkbox" class="form-check-input column-toggle" data-column="7" checked> OT Charges
</div><br>
<div class="form-check form-check-inline">
<input type="checkbox" class="form-check-input column-toggle" data-column="8" checked> Total
</div><br>
<div class="form-check form-check-inline">
<input type="checkbox" class="form-check-input column-toggle" data-column="9" checked>Status
</div><br>
<div class="form-check form-check-inline">
<input type="checkbox" class="form-check-input column-toggle" data-column="10" checked>Type of Invoice
</div><br>
<div class="form-check form-check-inline">
<input type="checkbox" class="form-check-input column-toggle" data-column="11" checked>Payment
</div><br>
<!-- Repeat similar blocks for other columns -->
</div>
<div class="modal-footer">
<button type="button" class="btn btn-secondary" data-dismiss="modal">Close</button>
<button type="button" class="btn btn-primary apply-column-selection">Apply</button>
</div>
</div>
</div>
</div>
</div> <!-- end card body-->
</div> <!-- end card -->
</div><!-- end col-->
@ -105,7 +175,36 @@
} // Specify the column index for date sorting and disable sorting
]
});
$('.show-column-selection-modal').on('click', function() {
// Hide dropdowns when the modal is shown
$('.table-responsive select').hide();
$('#columnSelectionModal').modal('show');
});
// Handle column visibility toggling
$('.column-toggle').on('change', function() {
var column = table.column($(this).data('column'));
column.visible(!column.visible());
// Remove corresponding values when column is removed
if (!column.visible()) {
// Find the index of the column
var columnIndex = $(this).data('column');
// Remove values from the column selection dropdown
$('#datatable-buttons thead tr:eq(1) th:eq(' + columnIndex + ') select').remove();
// Remove the date range filter for the column
if (columnIndex === 2) {
$('#datatable-buttons thead tr:eq(2) th:eq(2) input').daterangepicker('destroy').remove();
}
}
});
// Apply Column Selection
$('.apply-column-selection').on('click', function() {
// Show dropdowns when the modal is closed
$('.table-responsive select').show();
$('#columnSelectionModal').modal('hide');
});
// Add date range filter and dropdowns
$('#datatable-buttons thead tr').clone(true).appendTo('#datatable-buttons thead');
$('#datatable-buttons thead tr:eq(1) th').each(function(i) {
@ -136,30 +235,39 @@
});
// Add date range filter for "Invoice Date" column
var dateRangeFilter = $('<input type="text" class="form-control form-control-sm" placeholder="Select date range"/>')
.appendTo('#datatable-buttons thead tr:eq(2) th:eq(2)')
var dateRangeFilter = $('input.input-daterange-datepicker')
.daterangepicker({
autoUpdateInput: false,
locale: {
format: 'DD/MM/YYYY',
cancelLabel: 'Clear'
},
ranges: {
'Today': [moment(), moment()],
'Yesterday': [moment().subtract(1, 'days'), moment().subtract(1, 'days')],
'This Month': [moment().startOf('month'), moment().endOf('month')]
}
})
.on('click', function(e) {
// Prevent sorting when clicking on the date range filter input
e.stopPropagation();
.on('apply.daterangepicker', function (ev, picker) {
$(this).val(picker.startDate.format('DD/MM/YYYY') + ' - ' + picker.endDate.format('DD/MM/YYYY'));
})
.on('cancel.daterangepicker', function () {
$(this).val('');
});
dateRangeFilter.on('apply.daterangepicker', function(ev, picker) {
table.column(2)
.search(picker.startDate.format('YYYY-MM-DD') + ' to ' + picker.endDate.format('YYYY-MM-DD'))
.draw();
// Add click events for "Today" and "Yesterday" buttons
$('.today-btn').on('click', function () {
var today = moment();
dateRangeFilter.data('daterangepicker').setStartDate(today);
dateRangeFilter.data('daterangepicker').setEndDate(today);
dateRangeFilter.trigger('apply.daterangepicker');
});
dateRangeFilter.on('cancel.daterangepicker', function() {
dateRangeFilter.val('');
table.column(2).search('').draw();
$('.yesterday-btn').on('click', function () {
var yesterday = moment().subtract(1, 'days');
dateRangeFilter.data('daterangepicker').setStartDate(yesterday);
dateRangeFilter.data('daterangepicker').setEndDate(yesterday);
dateRangeFilter.trigger('apply.daterangepicker');
});
});
</script>

View File

@ -30,6 +30,10 @@
</div>
<div class="form-row">
<div class="form-group col-md-6">
<label for="scode" class="col-form-label">Short Code</label>
<input type="text" class="form-control" name="short_code" value="<?= isset($scheme['short_code']) ? $scheme['short_code'] : '' ?>" placeholder="Short Code" />
</div>
<div class="form-group col-md-6">
<label for="sdescription" class="col-form-label">Description<span class="text-danger"></span></label>
<textarea readonly class="form-control" name="sdescription" placeholder="Description"><?= isset($scheme['description']) ? $scheme['description'] : '' ?></textarea>

View File

@ -41,7 +41,7 @@
<?php foreach ($scheme as $row) : ?>
<tr>
<td hidden><?= $row['book_id']; ?></td>
<td><?= $row['title']; ?></td>
<td><?= $row['short_code']; ?></td>
<td><?= $row['price']; ?></td>
<td><?= $row['duration']; ?></td>
<td hidden><?= $row['category_name']; ?></td>

View File

@ -32,16 +32,20 @@
<thead class="thead-light">
<tr>
<th hidden></th>
<th>Invoice Number</th>
<th>Invoice Date</th>
<th>Member Name</th>
<th>From Subscription</th>
<th>To Subscription</th>
<th>Customer Name</th>
<th>Scheme Name</th>
<th>Status</th>
<th>Short-Code</th>
<th>Expiring Status</th>
<th>Invoic Number</th>
<th>Invoice Date</th>
<th>Total</th>
<th>Status</th>
<th align="center">Action</th>
</tr>
</thead>
<tbody>
@ -75,15 +79,19 @@
?>
<tr>
<td hidden><?= $row['invoice_id'] ?></td>
<td><?= $row['invoice_number']; ?></td>
<td><?= $invoice_date; ?></td>
<td><?= $row['customer_name']; ?></td>
<td><?= $from_date; ?></td>
<td><?= $to_date; ?></td>
<td><?= $row['customer_name']; ?></td>
<td><?= $row['scheme_name']; ?></td>
<td><?= $row['status']; ?></td>
<td><?= $row['scheme_code']; ?></td>
<td><span class="<?php echo $class; ?>"><?php echo $message; ?></span></td>
<td><?= $row['invoice_number']; ?></td>
<td><?= $invoice_date; ?></td>
<td><?= "" . $row['total_amount']; ?></td>
<td><?= $row['status']; ?></td>
<td>
<a href="<?= base_url() . "new_subscription_invoice/" . $row['invoice_id']; ?>" class="edit-button" title="Edit the Invoice"><i class="ri-pencil-line" title="Edit the Invoice"></i></a>&nbsp;
<a href="<?= base_url("generate_invoice_pdf/{$row['invoice_id']}") ?>" class="download-pdf-button" title="Download the Invoice"><i class="ri-file-download-line"></i></a>&nbsp;
@ -124,6 +132,23 @@
}
endforeach;
?>
<div class="form-group">
<label>Select Subscription Type:</label>
<div class="form-check">
<input class="form-check-input" type="radio" name="download_type" id="activeOption" value="active">
<label class="form-check-label" for="activeOption">Active Customers</label>
</div>
<div class="form-check">
<input class="form-check-input" type="radio" name="download_type" id="expiredOption" value="expired">
<label class="form-check-label" for="expiredOption">Expired Customers</label>
</div>
<div class="form-check">
<input class="form-check-input" type="radio" name="download_type" id="bothOption" value="both" checked>
<label class="form-check-label" for="bothOption">Both</label>
</div>
</div>
</div>
<div class="row">

View File

@ -136,7 +136,7 @@
<li>
<a href="<?= base_url()."invoice_list"; ?>">
<i class="fe-file-text"></i>
<span> Invoices </span>
<span> Sales </span>
</a>
</li>
<?php endif; ?>
@ -144,7 +144,7 @@
<li>
<a href="<?= base_url()."subscribers_list"; ?>">
<i class="ri-shield-user-line"></i>
<span>Membership </span>
<span>Members </span>
</a>
</li>
<?php endif; ?>
@ -152,7 +152,7 @@
<li>
<a href="<?= base_url()."scheme_list"; ?>">
<i class="ri-currency-line"></i>
<span> Scheme </span>
<span> Schemes </span>
</a>
</li>
<?php endif; ?>
@ -160,7 +160,7 @@
<li>
<a href="<?= base_url()."book_list"; ?>">
<i class="ri-book-open-line"></i>
<span> Products </span>
<span> Books</span>
</a>
</li>
<?php endif; ?>
@ -191,44 +191,38 @@
<a href="<?= base_url()."event_list"; ?>">
<i class="fe-shopping-bag"></i>
<span> Campaign </span>
</a>
</li>
<?php endif; ?>
<?php if ($loggedin_person_role !== 'manager' && $loggedin_person_role !== 'sadmin' ) : ?>
<li>
<a href="<?= base_url()."invoice_number_format/1"; ?>">
<i class="fe-check-square"></i>
<span> Invoice Number Format </span>
<span> Events </span>
</a>
</li>
<?php endif; ?>
<?php if ($loggedin_person_role !== 'manager' && $loggedin_person_role !== 'sadmin') : ?>
<li>
<a href="<?= base_url()."customer_group"; ?>">
<i class="ri-team-line"></i>
<span> Customer Group </span>
</a>
</li>
<?php endif; ?>
<?php if ($loggedin_person_role !== 'manager' && $loggedin_person_role !== 'sadmin') : ?>
<li>
<a href="#reportLayouts" data-toggle="collapse">
<i class="ri-file-chart-fill"></i>
<span> Report </span>
<span> Reports </span>
<span class="menu-arrow"></span>
</a>
<div class="collapse" id="reportLayouts">
<ul class="nav-second-level">
<li>
<a href="<?= base_url()."general_inv_rp"; ?>">General Invoice Report</a>
<a href="<?= base_url()."general_inv_rp"; ?>">Sales Report</a>
</li>
<li>
<!-- <li>
<a href="<?= base_url()."mem_inv_rp"; ?>">Membership Invoice Report</a>
</li> -->
<li>
<a href="<?= base_url()."expired_customer_report"; ?>">Membership Renewal</a>
</li>
<li>
<a href="<?= base_url()."itemwise_report"; ?>">Itemwise Report</a>
<a href="<?= base_url()."itemwise_report"; ?>">Bookswise Report</a>
</li>
<li>
<a href="<?= base_url()."book_publishwise_Report"; ?>">Bookswise Published</a>
</li>
</ul>
</div>
@ -245,16 +239,19 @@
<div class="collapse" id="notificationsLayouts">
<ul class="nav-second-level">
<li>
<a href="<?= base_url()."template_creation"; ?>">Template Creation</a>
<a href="<?= base_url()."template_creation"; ?>">Templates</a>
</li>
<li>
<a href="<?= base_url()."campaign_creation"; ?>">Notification Campaign</a>
<a href="<?= base_url()."customer_group"; ?>">Customer Group</a>
</li>
<li>
<a href="<?= base_url()."campaign_creation"; ?>">Campaign</a>
</li>
<li>
<a href="<?= base_url()."acknowlegdement"; ?>">Notification Acknowlegdement</a>
<a href="<?= base_url()."acknowlegdement"; ?>">Campaign Status</a>
</li>
<li>
<a href="<?= base_url()."mail_custom_notifications"; ?>">Custom Notifications</a>
<a href="<?= base_url()."mail_custom_notifications"; ?>">Ad-hoc Messages</a>
</li>
</ul>
</div>

View File

@ -21,7 +21,7 @@
</a>
</li>
<li class="dropdown d-none d-lg-inline-block topbar-dropdown">
<!-- <li class="dropdown d-none d-lg-inline-block topbar-dropdown">
<a class="nav-link dropdown-toggle arrow-none waves-effect waves-light" data-toggle="dropdown" href="#" role="button" aria-haspopup="false" aria-expanded="false">
<i class="fe-grid noti-icon"></i>
</a>
@ -45,7 +45,7 @@
<div class="col">
<a class="dropdown-icon-item" href="https://mail.google.com" target="_blank">
<!-- <img src="https://ssl.gstatic.com/ui/v1/icons/mail/rfr/logo_gmail_lockup_default_1x_r5.png" alt="G Suite"> -->
<img src="<?= base_url()."public/assets/images/brands/gmail.png" ?>" alt="G mail">
<!-- <img src="<?= base_url()."public/assets/images/brands/gmail.png" ?>" alt="G mail">
<span>G Mail</span>
</a>
</div>
@ -54,7 +54,7 @@
</div>
</div>
</li>
</li> --> -->
<li class="dropdown notification-list topbar-dropdown">
<a class="nav-link dropdown-toggle nav-user mr-0 waves-effect waves-light" data-toggle="dropdown" href="#" role="button" aria-haspopup="false" aria-expanded="false">
@ -106,11 +106,11 @@
</li>
<li class="dropdown notification-list">
<!-- <li class="dropdown notification-list">
<a href="javascript:void(0);" class="nav-link right-bar-toggle waves-effect waves-light">
<i class="fe-settings noti-icon"></i>
</a>
</li>
</li> -->
</ul>

View File

@ -57,6 +57,13 @@
<option value="female" <?= isset($details['gender']) && $details['gender'] === 'female' ? 'selected' : '' ?>>Female</option>
</select>
</div>
<div class="form-group col-md-4"id="eventNameContainer">
<label for="event_id" class="col-form-label">Event Name<span class="text-danger">*</span></label>
<select id="event_id" name="event_id" class="form-control">
<!-- Options will be dynamically populated using AJAX -->
</select>
</div>
<input type="hidden" id="selected_event_id" name="selected_event_id" value="<?= isset($details['selected_event_id']) ? $details['selected_event_id'] : '' ?>">
</div>
@ -75,6 +82,10 @@
<label for="state" class="col-form-label">State<span class="text-danger"></span></label>
<input type="text" class="form-control" id="state" name="state" placeholder="State" value="<?= isset($details['state']) ? $details['state'] : '' ?>" />
</div>
<!-- Add the event name dropdown and selected event ID input field to your form -->
<!-- Add the event name dropdown and selected event ID input field to your form -->
</div>
<div class="form-row">
<div class="form-group col-md-4">
@ -233,4 +244,77 @@
$('#submitBtn').prop('disabled', true);
}
});
</script>
</script>
<!-- Modify the existing JavaScript code -->
<script>
$(document).ready(function () {
// Function to show/hide the event name container based on the selected role
function toggleEventNameContainer() {
var selectedRole = $('#role').val();
var eventNameContainer = $('#eventNameContainer');
if (selectedRole === 'manager') {
eventNameContainer.show();
} else {
eventNameContainer.hide();
}
}
// Trigger the function on page load and on the change event of the role dropdown
$('#role').on('change', toggleEventNameContainer);
toggleEventNameContainer(); // Initial check on page load
// Other existing JavaScript code...
});
</script>
<script>
$(document).ready(function () {
// Assuming you trigger the AJAX on the change event of the role dropdown
$('#role').on('change', function () {
var selectedRole = $(this).val();
// Check if the selected role is "manager" before making the AJAX request
if (selectedRole === 'manager') {
var storedEventId = '<?= isset($details['event_id']) ? $details['event_id'] : '' ?>';
// Perform AJAX request to fetch event names based on the selected role
$.ajax({
url: "<?= base_url('users/fetch_event_names') ?>",
type: 'GET',
dataType: 'json',
success: function (data) {
// Assuming your response has an array of event names
var eventNames = data.eventNames;
// Clear existing options
$('#event_id').empty();
// Add new options based on the fetched data
for (var i = 0; i < eventNames.length; i++) {
$('#event_id').append('<option value="' + eventNames[i].event_id + '">' + eventNames[i].event_name + '</option>');
}
// Set the selected option based on the stored event ID
if (storedEventId) {
$('#event_id').val(storedEventId);
}
},
error: function (error) {
console.error(error); // Log any errors to the console
}
});
} else {
// Clear event names dropdown if the selected role is not "manager"
$('#event_id').empty();
}
});
// Trigger the change event initially to populate event names on page load
$('#role').change();
});
</script>

Binary file not shown.

Before

Width:  |  Height:  |  Size: 5.7 KiB