26th mar Disssion changes and revised Role.
This commit is contained in:
parent
af64355a88
commit
5c244684e4
@ -88,8 +88,6 @@ $routes->post("insert_contributor_group", "Customer::insert_donor_group");
|
||||
$routes->get("campaign_list/", "Event::index");
|
||||
$routes->get("new_campaign/(:any)", "Event::new_campaign/$1");
|
||||
$routes->post("insert_event/", "Event::insert_event");
|
||||
$routes->get('invoice_number_format/(:any)', 'Event::invoice_number_format/$1');
|
||||
$routes->post("insert_invoice_number_format", "Event::insert_invoice_number_format");
|
||||
|
||||
#Receipt Routes (also known as Invoice)
|
||||
$routes->get("receipt_list/", "Invoice::index");
|
||||
@ -105,7 +103,6 @@ $routes->post("get_donor_details", "Invoice::get_donor_details");
|
||||
$routes->post("save_invoice/", "Invoice::save_invoice/");
|
||||
$routes->add('approve_invoice/(:num)', 'Invoice::approve_invoice/$1');
|
||||
$routes->get('generate_invoice_pdf/(:num)', 'Invoice::generate_invoice_pdf/$1');
|
||||
$routes->get('print_address/(:num)', 'Invoice::print_address/$1');
|
||||
|
||||
#Report Routes
|
||||
$routes->match(['get','post'],'/general_inv_rp','Invoice::general_inv_rp');
|
||||
|
||||
@ -15,17 +15,19 @@ class Books extends BaseController
|
||||
$session_role = get_user_role();
|
||||
$session_bid = get_business_id();
|
||||
|
||||
if (!empty($session_role) && $session_role !== "sadmin") {
|
||||
$where = ['causes.business_id' => $session_bid, 'causes.isactive' => 1];
|
||||
} else {
|
||||
$where = ['causes.isactive !=' => NULL];
|
||||
}
|
||||
|
||||
$default_financial_year_condition = [
|
||||
'causes.created_on >= CONCAT(YEAR(NOW()) - IF(MONTH(NOW()) >= 1 AND MONTH(NOW()) <= 3, 1, 0), "-01-01")',
|
||||
'causes.created_on < CONCAT(YEAR(NOW()) + IF(MONTH(NOW()) >= 1 AND MONTH(NOW()) <= 3, 1, 0), "-01-01")'
|
||||
];
|
||||
$where = ['causes.business_id' => $session_bid];
|
||||
// $where = array_merge($where, $default_financial_year_condition);
|
||||
|
||||
$model = new BooksModel();
|
||||
$model->setTable('causes');
|
||||
$data['cause_list'] = $model->getData('donations_accepted',null,null);
|
||||
$data['page_name'] = 'Causes List';
|
||||
$data['details'] = $model->where('causes.business_id', $session_bid)->where('causes.isactive', 1)->findAll();
|
||||
$data['details'] = $model->where($where)->where('causes.isactive', 1)->findAll();
|
||||
$this->render_page('book_list', $data);
|
||||
} else {
|
||||
// Session is not active or user is not logged in
|
||||
|
||||
@ -15,6 +15,11 @@ class Customer extends BaseController
|
||||
if (is_session_active()) {
|
||||
$session_role = get_user_role();
|
||||
$session_bid = get_business_id();
|
||||
$default_financial_year_condition = [
|
||||
'created_on >= CONCAT(YEAR(NOW()) - IF(MONTH(NOW()) >= 1 AND MONTH(NOW()) <= 3, 1, 0), "-01-01")',
|
||||
'created_on < CONCAT(YEAR(NOW()) + IF(MONTH(NOW()) >= 1 AND MONTH(NOW()) <= 3, 1, 0), "-01-01")'
|
||||
];
|
||||
|
||||
if (!empty($session_role) && $session_role !== "sadmin") {
|
||||
$this->logger->info("Donor: Listing In admin role . BID = ".$session_bid);
|
||||
$where = ['isactive' => 1, 'business_id' => (int)$session_bid];
|
||||
@ -22,6 +27,7 @@ class Customer extends BaseController
|
||||
$this->logger->info("Donor: Listing In Super-admin role .");
|
||||
$where = ['isactive != ' => NULL];
|
||||
}
|
||||
// $where = array_merge($where, $default_financial_year_condition);
|
||||
$CustomerModel = new CustomerModel();
|
||||
|
||||
$data['page_name'] = 'Contributor Details';
|
||||
@ -138,7 +144,7 @@ class Customer extends BaseController
|
||||
|
||||
];
|
||||
|
||||
print_r($data);
|
||||
// print_r($data);
|
||||
// echo $this->db->getLastQuery();die();
|
||||
$donor_id = $this->request->getPost('donor_id'); // Get the business ID for update
|
||||
if (empty($donor_id)) {
|
||||
|
||||
@ -15,11 +15,17 @@ class Event extends BaseController
|
||||
$session_role = get_user_role();
|
||||
$session_bid = get_business_id();
|
||||
|
||||
$default_financial_year_condition = [
|
||||
'campaign.created_on >= CONCAT(YEAR(NOW()) - IF(MONTH(NOW()) >= 1 AND MONTH(NOW()) <= 3, 1, 0), "-01-01")',
|
||||
'campaign.created_on < CONCAT(YEAR(NOW()) + IF(MONTH(NOW()) >= 1 AND MONTH(NOW()) <= 3, 1, 0), "-01-01")'
|
||||
];
|
||||
|
||||
if (!empty($session_role) && $session_role !== "sadmin") {
|
||||
$where = ['campaign.business_id' => (int)$session_bid];
|
||||
} else {
|
||||
$where = ['campaign.business_id != ' => NULL];
|
||||
}
|
||||
// $where = array_merge($where, $default_financial_year_condition);
|
||||
|
||||
$EventModel = new EventModel();
|
||||
$data['page_name'] = 'Campaign Details';
|
||||
@ -114,64 +120,4 @@ class Event extends BaseController
|
||||
return redirect()->route('campaign_list');
|
||||
}
|
||||
|
||||
public function invoice_number_format($id)
|
||||
{
|
||||
helper('session');
|
||||
$session_bid = get_business_id();
|
||||
$data['page_name'] = 'Edit invoice number formatting';
|
||||
$model = new EventModel();
|
||||
$edit_campaign_details = $model->setTable('invoice_number_formatting')->where(['id' => (int)$id,'business_id'=>$session_bid])->first();
|
||||
$data['campaign'] = $edit_campaign_details;
|
||||
$data['session_bid'] = $session_bid;
|
||||
|
||||
$this->render_page('invoice_number_formatting', $data);
|
||||
}
|
||||
public function insert_invoice_number_format()
|
||||
{
|
||||
$this->logger->info("insert_invoice_number_format: Inserting/Updating Details");
|
||||
try {
|
||||
helper('session');
|
||||
$session_bid = get_business_id();
|
||||
$session_uid = get_logged_user_id();
|
||||
$EventModel = new EventModel();
|
||||
$data = [
|
||||
'next_id' => $this->request->getPost('nextid'),
|
||||
'left_pad' => $this->request->getPost('leftpad'),
|
||||
'id_formating' => $this->request->getPost('formating'),
|
||||
'business_id' => $this->request->getPost('business_id')
|
||||
];
|
||||
$pk_id = $this->request->getPost('id'); // Get the business ID for update
|
||||
|
||||
if (empty($pk_id)) {
|
||||
// It's an insert operation
|
||||
$data['created_by'] = $session_uid;
|
||||
// $EventModel->insert($data);
|
||||
$insert_result = $EventModel->insertData('invoice_number_formatting', $data);
|
||||
|
||||
if ($insert_result['info']) {
|
||||
session()->setFlashdata('success', "updated Successfully");
|
||||
$this->logger->info($insert_result['info']);
|
||||
} else {
|
||||
session()->setFlashdata('error', $insert_result['err']);
|
||||
$this->logger->error($insert_result['err']);
|
||||
}
|
||||
} else {
|
||||
// It's an update operation
|
||||
$data['updated_by'] = $session_uid;
|
||||
$where = ['id' => $pk_id, 'business_id' => get_business_id()];
|
||||
$update_result = $EventModel->updateData('invoice_number_formatting', $data,$where);
|
||||
if ($update_result['info']) {
|
||||
session()->setFlashdata('success',"updated Successfully");
|
||||
$this->logger->info($update_result['info']);
|
||||
} else {
|
||||
session()->setFlashdata('error', $update_result['err']);
|
||||
$this->logger->error($update_result['err']);
|
||||
}
|
||||
}
|
||||
} catch (\Exception $e) {
|
||||
$this->logger->error("campaign: Err Occur = " . $e->getMessage() . " Line = " . $e->getLine() . " File = " . $e->getFile());
|
||||
session()->setFlashdata('error', 'Message: ' . $e->getMessage());
|
||||
}
|
||||
return redirect()->to(base_url("invoice_number_format/1"));
|
||||
}
|
||||
}
|
||||
|
||||
@ -12,47 +12,64 @@ class Home extends BaseController
|
||||
helper('session');
|
||||
$session_role = get_user_role();
|
||||
$session_bid = get_business_id();
|
||||
$session_uid = get_logged_user_id();
|
||||
|
||||
// echo $session_bid, $session_role; die;
|
||||
|
||||
$data['page_name'] = 'Dashboard';
|
||||
if (!empty($session_role) && $session_role == "sadmin") {
|
||||
$where = ['isactive != ' => NULL];
|
||||
} else if (!empty($session_role) && $session_role == "admin") {
|
||||
$where = ['isactive' => 1, 'business_id' => $session_bid];
|
||||
}
|
||||
else {
|
||||
$where = [];
|
||||
}
|
||||
$model = new HomeModel();
|
||||
$data['customer'] = $model->customers($where);
|
||||
$data['customer']['label'] = "donors";
|
||||
|
||||
// echo '<pre>';
|
||||
// print_r($data['customer'] ); die;
|
||||
$bwhere = ['user_id'=> $session_uid,'business_id'=> $session_bid,'isactive'=> 1];
|
||||
$branch_id = $model->getbranchid($bwhere);
|
||||
|
||||
$where = ['donor.business_id' => $session_bid];
|
||||
|
||||
if (!empty($session_role)) {
|
||||
switch ($session_role) {
|
||||
case 'auditor':
|
||||
$where['donor.created_by'] = $session_uid;
|
||||
break;
|
||||
case 'accounts':
|
||||
if ($branch_id) {
|
||||
$where['users.branch_id'] = $branch_id;
|
||||
}
|
||||
break;
|
||||
case 'donor':
|
||||
case 'volunteer':
|
||||
if ($branch_id) {
|
||||
$where['users.branch_id'] = $branch_id;
|
||||
}
|
||||
$where['donor.created_by'] = $session_uid;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
$data['donordetails'] = $model->donordetails($where);
|
||||
|
||||
$data['donordetails']['label'] = "donors";
|
||||
|
||||
// $data['invoice'] = $model->invoice();
|
||||
// $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);
|
||||
|
||||
}
|
||||
|
||||
## Dynamic Validation For Existing Check AJAX Call
|
||||
# USED in 1) User Module
|
||||
# 2) Recepit-DonorQuickAdd Module
|
||||
# 3) Contributor(or)Donor Module
|
||||
# 4) Buiness(Or)Organsation Module
|
||||
## PLEASE mention here wherever you used this.
|
||||
public function check_existing()
|
||||
{
|
||||
$value = $this->request->getPost('value');
|
||||
$table = $this->request->getPost('module');
|
||||
$field = $this->request->getPost('field');
|
||||
$model = new HomeModel();
|
||||
// $model->setTable('customers');
|
||||
|
||||
$model->setTable((string)$table);
|
||||
$where = [$field => $value];
|
||||
$check_existing = $model->where($where)->findAll();
|
||||
|
||||
$statement_string = ucfirst(str_replace('_', ' ', (string)$field));
|
||||
$data = ['status' => false, 'message' => '']; // Initialize the data array
|
||||
$data = ['status' => false, 'message' => ''];
|
||||
if (!empty($check_existing)) {
|
||||
$data['status'] = true;
|
||||
$data['message'] = $statement_string." Already existing";
|
||||
|
||||
@ -42,7 +42,12 @@ class Invoice extends BaseController
|
||||
$where = ['business_id' => (int)get_business_id()];
|
||||
$data['Donors'] = $model->getData('donor', $where);
|
||||
$data['page_name'] = 'Receipt Details';
|
||||
$data['receipt'] = $model->where(["business_id"=>$session_bid])->findAll();
|
||||
$default_financial_year_condition = [
|
||||
'created_at >= CONCAT(YEAR(NOW()) - IF(MONTH(NOW()) >= 1 AND MONTH(NOW()) <= 3, 1, 0), "-01-01")',
|
||||
'created_at < CONCAT(YEAR(NOW()) + IF(MONTH(NOW()) >= 1 AND MONTH(NOW()) <= 3, 1, 0), "-01-01")'
|
||||
];
|
||||
// $where = array_merge($where, $default_financial_year_condition);
|
||||
$data['receipt'] = $model->where($where)->findAll();
|
||||
$data['temp_receipt_count'] = $model->where(["business_id"=>$session_bid, 'receipt_header' => 'Temporary Receipt'])->countAllResults();
|
||||
|
||||
foreach ($data['receipt'] as $key => $value) {
|
||||
@ -155,17 +160,7 @@ class Invoice extends BaseController
|
||||
{
|
||||
$data['receipt_details'] = $model->where(['receipt_id' => $id, 'isactive' => 1])->first();
|
||||
}
|
||||
$get_receipt_type_where = [
|
||||
'business_id' => (int)get_business_id(),
|
||||
'isactive' => 1,
|
||||
'donor_id' => $data['receipt_details']['donor_id']
|
||||
];
|
||||
|
||||
$get_receipt_type = $model->getData('donor', $get_receipt_type_where);
|
||||
if (!empty($get_receipt_type)) {
|
||||
$firstItem = reset($get_receipt_type);
|
||||
$data['receipt_type'] = $firstItem->donor_type;
|
||||
}
|
||||
$data['receipt_type'] = (int)$data['receipt_details']['receipt_type'];
|
||||
}
|
||||
$cus_where = ['business_id' => (int)get_business_id() , 'isactive' => 1, 'donor_type'=>$data['receipt_type']];
|
||||
$data['typebaseddonors'] = $model->getData('donor', $cus_where);
|
||||
@ -534,28 +529,27 @@ class Invoice extends BaseController
|
||||
$dompdf = new Dompdf($options);
|
||||
|
||||
define("DOMPDF_UNICODE_ENABLED", true);
|
||||
$user = $this->UserModel->select('first_name')->where('user_id',$data[0]->created_by)->findAll();
|
||||
$user = $this->UserModel->select('first_name, last_name')->where('user_id',$data[0]->created_by)->findAll();
|
||||
|
||||
clearstatcache();
|
||||
|
||||
// var_dump(file_exists($logoPath));
|
||||
if ($data[0]->business_logo && file_exists(ROOTPATH."public/uploads/".$data[0]->business_logo)) {
|
||||
// echo "Inside: Logo exists<br>";
|
||||
$baseurl = base_url()."public/uploads/".$data[0]->business_logo;;
|
||||
$baseurl = base_url()."public/uploads/".$data[0]->business_logo;
|
||||
} else {
|
||||
// echo "Inside: Logo does not exist<br>"; die;
|
||||
$baseurl = base_url()."public/uploads/default.png";
|
||||
}
|
||||
$digits = strlen((string)$data[0]->amount);
|
||||
$amount_in_words = $digits <= 9 ? $this->convertNumberToWords($data[0]->amount) : $data[0]->amount;
|
||||
|
||||
$html = view('invoice_pdf_template', [
|
||||
'data' => $data[0],
|
||||
'currency' => $data[0]->currency,
|
||||
'currency_in_words' => $amount_in_words ,
|
||||
'baseurl' => $baseurl,
|
||||
'signature' => "",
|
||||
'staff_name' => $user[0]['first_name'],
|
||||
'signature' => $data[0]->signature,
|
||||
'staff_name' => $user[0]['first_name'] . ' ' .$user[0]['last_name'],
|
||||
'Notes' => $terms_data[0]['terms']
|
||||
]);
|
||||
// echo $html;die;
|
||||
@ -577,8 +571,11 @@ class Invoice extends BaseController
|
||||
// $downloadLink = base_url() . 'pdf/' . $filename;
|
||||
// echo $downloadLink;die;
|
||||
return $html;
|
||||
}
|
||||
$dompdf->stream('Receipt.pdf', ['Attachment' => 1]);
|
||||
}
|
||||
$original_name = isset($data[0]->receipt_number) && !empty($data[0]->receipt_number) ? $data[0]->receipt_number : 'Receipt';
|
||||
$sanitized_name = preg_replace("/[^A-Za-z0-9_\-\.]/", "_", $original_name);
|
||||
$pdf_extension_name = $sanitized_name . '.pdf';
|
||||
$dompdf->stream($pdf_extension_name, ['Attachment' => 1]);
|
||||
} catch (\Exception $e) {
|
||||
// Handle the exception
|
||||
// For example, log the error, display a user-friendly message, or return an error response
|
||||
|
||||
@ -14,7 +14,10 @@ class Users extends BaseController
|
||||
|
||||
$session_role = get_user_role();
|
||||
$session_bid = get_business_id();
|
||||
|
||||
$default_financial_year_condition = [
|
||||
'users.created_at >= CONCAT(YEAR(NOW()) - IF(MONTH(NOW()) >= 1 AND MONTH(NOW()) <= 3, 1, 0), "-01-01")',
|
||||
'users.created_at < CONCAT(YEAR(NOW()) + IF(MONTH(NOW()) >= 1 AND MONTH(NOW()) <= 3, 1, 0), "-01-01")'
|
||||
];
|
||||
if (!empty($session_role) && $session_role === "sadmin") {
|
||||
$this->logger->info("Users: Listing In Super-admin role .");
|
||||
$where = ['users.isactive !=' => NULL];
|
||||
@ -25,6 +28,7 @@ class Users extends BaseController
|
||||
$this->logger->info("Users: Listing In ".$session_role." role . BID = ".$session_bid);
|
||||
$where = ['users.business_id' => (int)$session_bid, 'users.isactive' => 1];
|
||||
}
|
||||
// $where = array_merge($where, $default_financial_year_condition);
|
||||
$model = new UsersModel();
|
||||
$model->setTable('users');
|
||||
// $user_details = $model->where($where)->orderBy('user_id', 'DESC')->findAll();
|
||||
|
||||
@ -16,104 +16,8 @@ class CustomerModel extends Model
|
||||
{
|
||||
return $this->insert($data);
|
||||
}
|
||||
public function getCustomerNamesByBusiness($business_id)
|
||||
{
|
||||
$this->builder()->select('donor_id,CONCAT(first_name, " ", last_name) as full_name', false);
|
||||
$this->builder()->where('business_id ', $business_id); // Filter by business_id
|
||||
$query = $this->builder()->get(); // Use findAll() instead of get()
|
||||
return ($query->getResult());
|
||||
}
|
||||
|
||||
// $customerNames = [];
|
||||
|
||||
// foreach ($query->getResult() as $row) {
|
||||
// $customerNames[] = [ $row->full_name ];
|
||||
// }
|
||||
// print_r($customerNames);
|
||||
// die();
|
||||
|
||||
|
||||
|
||||
// public function getCustomerIdByName($customerName, $businessId)
|
||||
// {
|
||||
// $customer = $this->builder()
|
||||
// ->select('donor_id')
|
||||
// ->where('CONCAT(first_name, " ", last_name)', $customerName)
|
||||
// ->where('business_id', $businessId)
|
||||
// ->get()
|
||||
// ->getRow();
|
||||
|
||||
// if ($customer) {
|
||||
// return $customer->donor_id;
|
||||
// }
|
||||
|
||||
// return null; // Customer not found
|
||||
// }
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
public function insertAddress($addressData) {
|
||||
$this->db->table('customer_addresses')->insert($addressData);
|
||||
return $this->db->insertID(); // Return the last inserted ID
|
||||
}
|
||||
|
||||
public function insertAddressBatch($addressesDataArray) {
|
||||
$this->db->table('customer_addresses')->insertBatch($addressesDataArray);
|
||||
return $this->db->insertID(); // Note: insertID() might not be applicable for batch inserts
|
||||
}
|
||||
|
||||
public function saveAddressDetails($data){
|
||||
$i = 0;
|
||||
$statement = [];
|
||||
foreach ($data as $row) {
|
||||
$id = $row['customer_address_id'];
|
||||
if($id != ''){
|
||||
unset($row['customer_address_id']); // Remove the id from the data to avoid updating it
|
||||
unset($row['created_by']); // bcoz here data Updating here.
|
||||
$this->db->table('customer_addresses')->where('customer_address_id', $id)->update($row);// Update the row with the specified id
|
||||
$affectedRows = $this->db->affectedRows();
|
||||
$statement[$i] = "address - ".$id." ". ($affectedRows ? " Updated":" Nothing to Updated");
|
||||
}else{
|
||||
$this->db->table('customer_addresses')->insert($row);
|
||||
$insertID = $this->db->insertID();
|
||||
$statement[$i] = "address - ".$insertID." Inserted";
|
||||
}
|
||||
$i++;
|
||||
}
|
||||
return $statement;
|
||||
}
|
||||
|
||||
|
||||
public function inactiveMissingAddressDetails($where,$missingValues){
|
||||
$dataToUpdate = ['isactive' => 0];
|
||||
$this->db->table('customer_addresses')->where($where)->whereIn('customer_address_id',$missingValues)->update($dataToUpdate);
|
||||
}
|
||||
public function getInvoicesByCustomerId($donor_id)
|
||||
{
|
||||
return $this->db->table('invoice')
|
||||
->select('invoice_number, subtotal, invoice_date')
|
||||
->where('donor_id', $donor_id)
|
||||
->get()
|
||||
->getResult();
|
||||
}
|
||||
public function getSubscriberDataByCustomerId($customerId)
|
||||
{
|
||||
// Assuming 'subscription' is the table name where subscriber data is stored.
|
||||
$builder = $this->db->table('subscription');
|
||||
$builder->join('books', 'books.book_id = subscription.scheme_id');
|
||||
|
||||
|
||||
// Define the columns you want to select from the subscription table.
|
||||
$builder->select('subscription.*,books.title');
|
||||
|
||||
// Add a where condition to filter results based on customer ID.
|
||||
$builder->where('donor_id', $customerId);
|
||||
|
||||
// Execute the query and return the result as an array of objects.
|
||||
return $builder->get()->getResult();
|
||||
}
|
||||
|
||||
|
||||
public function saveGroupDetails($data){
|
||||
$id = $data['group_id'];
|
||||
|
||||
@ -4,94 +4,37 @@ use CodeIgniter\Model;
|
||||
class HomeModel extends Model
|
||||
{
|
||||
|
||||
public function customers($where) {
|
||||
public function donordetails($where) {
|
||||
|
||||
$query = $this->db->table('donor');
|
||||
$totalDonors = $this->db->table('donor')
|
||||
->where($where)->countAll();
|
||||
|
||||
$totalCustomers = $query->where($where)->countAll();
|
||||
$activeCustomers = $query->where($where)->countAllResults();
|
||||
|
||||
$where['DATE(created_on)'] = date('Y-m-d');
|
||||
$todayCustomers = $query->where($where)->countAllResults();
|
||||
|
||||
if ($totalCustomers > 0) {
|
||||
$customer['percentage'] = ($activeCustomers / $totalCustomers) * 100;
|
||||
$activeDonors = $this->db->table('donor')->select('donor.*, users.branch_id,users.business_id as users_business_id')
|
||||
->join('users', 'users.user_id = donor.created_by AND users.business_id = donor.business_id', 'left')
|
||||
->where($where)->where('donor.isactive',1)->countAllResults();
|
||||
|
||||
$where['DATE(donor.created_on)'] = date('Y-m-d');
|
||||
$todayDonors = $this->db->table('donor')->select('donor.*, users.branch_id,users.business_id as users_business_id')
|
||||
->join('users', 'users.user_id = donor.created_by AND users.business_id = donor.business_id', 'left')
|
||||
->where($where)->where('donor.isactive',1)->countAllResults();
|
||||
|
||||
if ($totalDonors > 0) {
|
||||
$final['percentage'] = ($activeDonors / $totalDonors) * 100;
|
||||
} else {
|
||||
$customer['percentage'] = 0;
|
||||
$final['percentage'] = 0;
|
||||
}
|
||||
|
||||
$customer['total'] = $totalCustomers;
|
||||
$customer['active'] = $activeCustomers;
|
||||
$customer['today'] = $todayCustomers;
|
||||
return $customer;
|
||||
$final['total'] = $totalDonors;
|
||||
$final['active'] = $activeDonors;
|
||||
$final['today'] = $todayDonors;
|
||||
|
||||
return $final;
|
||||
}
|
||||
|
||||
// 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('donor as C', 'C.customer_id = S.customer_id', 'left')
|
||||
// ->join('books as BK', 'BK.book_id = S.scheme_id', 'left')
|
||||
// ->join('book_categories as BC', 'BC.book_id = S.scheme_id', 'left')
|
||||
// ->join('category as CM', 'CM.id = BC.category_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.business_id, S.to_subscription, S.from_subscription, BK.title, BK.book_id,DATEDIFF(S.to_subscription, CURDATE()) as countdays,DATE_FORMAT(S.to_subscription, "%d-%m-%Y") as to_subscription_date_format')
|
||||
// ->where('S.to_subscription >=', $now)
|
||||
// ->where('S.to_subscription <=', $last30days)
|
||||
// // ->where('BC.category_id', 5)
|
||||
// ->where('LOWER(CM.name)', strtolower("Membership"))
|
||||
// ->orderBy('S.to_subscription', 'ASC')
|
||||
// ->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)
|
||||
// ->orderBy('B.publication_date', 'DESC')
|
||||
// ->groupBy('B.book_id')
|
||||
// ->get()
|
||||
// ->getResultArray();
|
||||
// }
|
||||
public function getbranchid($bwhere){
|
||||
$query = $this->db->table('users');
|
||||
$result = $query->select('branch_id')->where($bwhere)->get()->getRow();
|
||||
return $result ? (int)$result->branch_id : 0;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -7,105 +7,14 @@ class InvoiceModel extends Model
|
||||
{
|
||||
protected $table = 'receipt';
|
||||
protected $primaryKey = 'receipt_id';
|
||||
// protected $allowedFields = ['invoice_id','invoice_number','donor_id','invoice_date','event_id','business_id','created_on','business_id'];
|
||||
protected $allowedFields = ['receipt_id', 'receipt_number', 'donor_id','notes','amount', 'payment_mode', 'business_id', 'created_on', 'created_by', 'updated_on', 'updated_by','isactive', 'payment_ref_no', 'receipt_date','causes_id','campaign_id','receipt_header','reason','currency'];
|
||||
|
||||
public function saveInvoiceItemDetails($data){
|
||||
$i = 0;
|
||||
$statement = [];
|
||||
foreach ($data as $row) {
|
||||
$id = isset($row['invoice_child_id']) ? $row['invoice_child_id'] : '';
|
||||
if($id != ''){
|
||||
unset($row['invoice_child_id']); // Remove the id from the data to avoid updating it
|
||||
unset($row['created_by']); // bcoz here data are Updating here.
|
||||
$this->db->table('invoiceitems')->where('invoice_child_id', $id)->update($row);// Update the row with the specified id
|
||||
$affectedRows = $this->db->affectedRows();
|
||||
$statement[$i] = "Invoice Item - ".$id." ".$affectedRows ? " Updated":" Not Updated";
|
||||
}else{
|
||||
unset($row['updated_by']); // bcoz here data are inserting here.
|
||||
$this->db->table('invoiceitems')->insert($row);
|
||||
$insertID = $this->db->insertID();
|
||||
$statement[$i] = "Invoice Item - ".$insertID." Inserted";
|
||||
}
|
||||
}
|
||||
return $statement;
|
||||
}
|
||||
protected $allowedFields = ['receipt_id', 'receipt_number', 'donor_id','notes','amount', 'payment_mode', 'business_id', 'created_on', 'created_by', 'updated_on', 'updated_by','isactive', 'payment_ref_no', 'receipt_date','causes_id','campaign_id','receipt_header','reason','currency','receipt_type'];
|
||||
|
||||
|
||||
public function inactiveMissingInvoiceItemDetails($where,$missingValues){
|
||||
$dataToUpdate = ['isactive' => 0];
|
||||
$this->db->table('invoiceitems')->where($where)->whereIn('invoice_child_id',$missingValues)->update($dataToUpdate);
|
||||
}
|
||||
|
||||
public function updateData($table, $data, $where)
|
||||
{
|
||||
$this->db->table($table)->update($data, $where);
|
||||
$affected_rows = $this->db->affectedRows();
|
||||
return $affected_rows;
|
||||
}
|
||||
|
||||
public function getSubscriptionInvoiceDetail($where)
|
||||
public function updateData($table, $data, $where)
|
||||
{
|
||||
$result = $this->getJoinedData($where);
|
||||
// print_r($result);die;
|
||||
if(!empty($result)){
|
||||
foreach ($result as $i => $item) {
|
||||
$invoiceId = $item['invoice_id'];
|
||||
$scheme_name = [];
|
||||
$from_subscription = [];
|
||||
$to_subscription = [];
|
||||
$invoiceItems = $this->getInvoiceItems($invoiceId,'');
|
||||
foreach ($invoiceItems as $j => $child) {
|
||||
if ($child->category_name == 'Membership') {
|
||||
$scheme_name[] = $child->title;
|
||||
$from_subscription[] = ($j == 0 && !empty($child->from_subscription) && $child->from_subscription !== null) ? date('d/m/Y', strtotime($child->from_subscription)) : "";
|
||||
$to_subscription[] = ($j == 0 && !empty($child->to_subscription) && $child->from_subscription !== null ) ? date('d/m/Y', strtotime($child->to_subscription)) : "";
|
||||
}
|
||||
}
|
||||
$result[$i]['scheme_name'] = !empty($scheme_name) ? implode(", ", $scheme_name) : '';
|
||||
$result[$i]['from_subscription'] = !empty($from_subscription) ? implode(" ", $from_subscription) : '';
|
||||
$result[$i]['to_subscription'] = !empty($to_subscription) ? implode(" ", $to_subscription) : '';
|
||||
$result[$i]['invoice_items_details'] = $invoiceItems;
|
||||
}
|
||||
}
|
||||
return $result;
|
||||
}
|
||||
|
||||
public function getJoinedData($where)
|
||||
{
|
||||
|
||||
return $this->db->table($this->table.' as I' )
|
||||
|
||||
->join('donor as C', 'C.donor_id = I.donor_id', 'left')
|
||||
->join('Campaign as E', 'E.Campaign_id = I.event_id', 'left')
|
||||
->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, (C.first_name," ",C.last_name) as customer_name , I.business_id, 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')
|
||||
->where($where)
|
||||
->orderBy('invoice_id', 'DESC')
|
||||
->get()
|
||||
->getResultArray();
|
||||
|
||||
|
||||
// I.shipping_address_id, I.billing_address_id,
|
||||
}
|
||||
|
||||
|
||||
public function getDetailForApproveNotifications($where)
|
||||
{
|
||||
$result = $this->getJoinedData($where);
|
||||
if(!empty($result)){
|
||||
foreach ($result as $object) {
|
||||
$invoiceId = $object['invoice_id'];
|
||||
$items = $this->getInvoiceItems($invoiceId,'');
|
||||
}
|
||||
}else{
|
||||
$items = [];
|
||||
}
|
||||
$data['invoice'] = $result;
|
||||
$data['item'] = $items;
|
||||
return $data;
|
||||
$this->db->table($table)->update($data, $where);
|
||||
$affected_rows = $this->db->affectedRows();
|
||||
return $affected_rows;
|
||||
}
|
||||
|
||||
public function getData($table, $where = null)
|
||||
@ -117,6 +26,7 @@ public function updateData($table, $data, $where)
|
||||
return $query->get()->getResult();
|
||||
}
|
||||
|
||||
## gethering Donor receipt Details for PDF.
|
||||
public function getInvoiceData($id)
|
||||
{
|
||||
// Fetch invoice data
|
||||
@ -131,174 +41,5 @@ public function updateData($table, $data, $where)
|
||||
->getResult();
|
||||
|
||||
}
|
||||
// // this function Also Used For Approve Notification.
|
||||
// public function getInvoiceItems($id,$stringflag)
|
||||
// {
|
||||
|
||||
// if ($stringflag == 'groupby') {
|
||||
// $select = 'invoiceitems.*, B.*, GROUP_CONCAT(C.name SEPARATOR \',\') as name';
|
||||
// $group_by = 'invoiceitems.invoice_child_id';
|
||||
// } else {
|
||||
// $select = 'invoiceitems.*, B.*, C.name as category_name';
|
||||
// $group_by = "";
|
||||
// }
|
||||
|
||||
// $data = $this->db->table('invoiceitems')
|
||||
// ->where(['invoice_id' => $id, 'invoiceitems.isactive' => 1])
|
||||
// ->join('causes as B', 'B.causes_id = invoiceitems.product', 'left')
|
||||
// ->select($select)
|
||||
// ->groupBy($group_by) // Fixed the variable name here
|
||||
// ->get()
|
||||
// ->getResult();
|
||||
|
||||
// //->orderBy("book_img_id", "asc") // Order by book_img_id in ascending order
|
||||
// //->limit(1,0)
|
||||
|
||||
|
||||
// // print_r($this->db->getLastQuery());die;
|
||||
// // print_r($data);die("ends -- here");
|
||||
// return $data;
|
||||
// }
|
||||
|
||||
|
||||
// public function getMembershipListForCustomer($category, $id)
|
||||
// {
|
||||
// $data = $this->db->table('subscription as S')
|
||||
// ->join('donor as C', 'C.donor_id = S.donor_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('causes as BK', 'BC.causes_id = BK.causes_id', 'left')
|
||||
// ->select('S.donor_id, CONCAT(C.first_name, " ", C.last_name) as customer_name, S.sub_id, S.scheme_id, DATE_FORMAT(S.from_subscription, "%d/%m/%Y") AS formatted_from_subscription, DATE_FORMAT(S.to_subscription, "%d/%m/%Y") AS formatted_to_subscription, S.from_subscription, S.to_subscription, S.created_on, CM.name, BK.title, BK.causes_id')
|
||||
// ->where('CM.name', strtolower($category))
|
||||
// ->where('S.donor_id', $id)
|
||||
// ->groupBy('S.sub_id')
|
||||
// ->orderBy('S.created_on', 'ASC')
|
||||
// ->get()
|
||||
// ->getResultArray();
|
||||
// return $data;
|
||||
// }
|
||||
|
||||
public function getProductImgs($productId)
|
||||
{
|
||||
$data = $this->db->table('book_images')
|
||||
->where(['causes_id' => $productId])
|
||||
// ->join('causes as B', 'B.causes_id = invoiceitems.product', 'left')
|
||||
// ->join('book_images as BI', 'BI.causes_id = invoiceitems.product', 'left')
|
||||
->select('book_images.*')
|
||||
//->orderBy("book_img_id", "asc") // Order by book_img_id in ascending order
|
||||
//->limit(1,0)
|
||||
->get()
|
||||
->getResult();
|
||||
|
||||
// print_r($this->db->getLastQuery());
|
||||
return $data;
|
||||
}
|
||||
|
||||
public function getCategoryBooks()
|
||||
{
|
||||
return $this->db->table('causes')
|
||||
->join('book_categories', 'book_categories.causes_id= causes.causes_id', 'left')
|
||||
->join('category','category.id=book_categories.category_id')
|
||||
->where('category.name', 'membership')
|
||||
->get()
|
||||
->getResult();
|
||||
|
||||
}
|
||||
public function getNonMembershipCategoryBooks()
|
||||
{
|
||||
$data = $this->db->table('causes')
|
||||
->select('causes.*')
|
||||
->join('book_categories', 'book_categories.causes_id= causes.causes_id', 'left')
|
||||
->join('category','category.id=book_categories.category_id')
|
||||
->where('category.name !=', 'membership')
|
||||
->groupBy('causes.causes_id')
|
||||
->get()
|
||||
->getResult();
|
||||
return $data;
|
||||
|
||||
}
|
||||
public function insertSubscriptionData($data)
|
||||
{
|
||||
return $this->db->table('subscription')->insert($data);
|
||||
}
|
||||
|
||||
// ***********************REPORT**********************
|
||||
|
||||
public function get_general_invoice_data($f_date = null, $t_date = null)
|
||||
{
|
||||
// Fetch invoice data
|
||||
$query = $this->db->table('invoice')
|
||||
->select('invoice.*, donor.*, 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
|
||||
if ($f_date !== null && $t_date !== null) {
|
||||
$query->where('invoice.invoice_date >=', $f_date)
|
||||
->where('invoice.invoice_date <=', $t_date);
|
||||
}
|
||||
|
||||
$result = $query->join('donor', 'donor.donor_id = invoice.donor_id', 'left')
|
||||
->join('invoiceitems', 'invoiceitems.invoice_id = invoice.invoice_id', 'left')
|
||||
->join('causes', 'causes.causes_id = invoiceitems.product', 'left')
|
||||
->groupBy('invoice.invoice_id') // Assuming invoice_id is the primary key of the invoice table
|
||||
->get()
|
||||
->getResult();
|
||||
|
||||
return $result;
|
||||
}
|
||||
|
||||
|
||||
public function get_mem_invoice_data($f_date = null, $t_date = null)
|
||||
{
|
||||
// Fetch invoice data
|
||||
$query = $this->db->table('invoice')
|
||||
->select('invoice.*, donor.*, COUNT(invoiceitems.product) as item_count')
|
||||
->where('invoice.isactive', 1)
|
||||
->where('invoice.invoice_type', 2)
|
||||
->where('invoiceitems.isactive', 1);
|
||||
|
||||
// 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('donor', 'donor.donor_id = invoice.donor_id', 'left')
|
||||
->join('invoiceitems', 'invoiceitems.invoice_id = invoice.invoice_id', 'left')
|
||||
->join('causes', 'causes.causes_id = invoiceitems.product', 'left')
|
||||
->groupBy('invoice.invoice_id') // Assuming invoice_id is the primary key of the invoice table
|
||||
->get()
|
||||
->getResult();
|
||||
|
||||
return $result;
|
||||
|
||||
}
|
||||
|
||||
public function itemwise_report_data($f_date = null, $t_date = null)
|
||||
{
|
||||
// Fetch invoice data
|
||||
$query = $this->db->table('invoice')
|
||||
->select('invoice.*, causes.* , COUNT(invoiceitems.product) as item_count , sum(invoiceitems.product * invoiceitems.unit_price) as item_cost')
|
||||
->where('invoice.isactive', 1)
|
||||
->where('causes.isactive', 1);
|
||||
|
||||
// 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('causes', 'causes.causes_id = invoiceitems.product', 'left')
|
||||
->groupBy('causes.causes_id')
|
||||
->get()
|
||||
->getResult();
|
||||
|
||||
return $result;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@ -61,18 +61,20 @@
|
||||
</div>
|
||||
<div class="form-group col-md-6">
|
||||
<label for="bmail" class="col-form-label">Organization Email<span class="text-danger">*</span></label>
|
||||
<input type="email" class="form-control" name="bmail" value="<?= isset($organzations['email']) ? $organzations['email'] : '' ?>" placeholder="Email" required />
|
||||
<input type="email" class="form-control" id="bmail" name="bmail" value="<?= isset($organzations['email']) ? $organzations['email'] : '' ?>" placeholder="Email" required onchange="checkExisting(this,'email','bmail','business')"/>
|
||||
<span id="bemailValidationMessage"></span>
|
||||
<div class="invalid-feedback"> Please provide. </div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-row">
|
||||
<div class="form-group col-md-6">
|
||||
<label for="bmobile" class="col-form-label">Organization PAN Number<span class="text-danger">*</span></label>
|
||||
<input type="text" class="form-control" name="pan_no" value="<?= isset($organzations['pan_no']) ? $organzations['pan_no'] : '' ?>" placeholder="PAN Number" required pattern="[A-Z]{5}[0-9]{4}[A-Z]{1}" title="Enter a valid PAN number" />
|
||||
<label for="pan_no" class="col-form-label">Organization PAN Number<span class="text-danger">*</span></label>
|
||||
<input type="text" class="form-control" id="pan_no" name="pan_no" value="<?= isset($organzations['pan_no']) ? $organzations['pan_no'] : '' ?>" placeholder="PAN Number" required pattern="[A-Z]{5}[0-9]{4}[A-Z]{1}" title="Enter a valid PAN number" onchange="checkExisting(this,'pan_no','pan_no','business')"/>
|
||||
<span id="panValidationMessage"></span>
|
||||
<div class="invalid-feedback"> Please provide. </div>
|
||||
</div>
|
||||
<div class="form-group col-md-6">
|
||||
<label for="baddress" class="col-form-label">Organization Reg Number<span class="text-danger">*</span></label>
|
||||
<label for="org_reg_no" class="col-form-label">Organization Reg Number<span class="text-danger">*</span></label>
|
||||
<input type="text" class="form-control" name="org_reg_no" value="<?= isset($organzations['org_reg_no']) ? $organzations['org_reg_no'] : '' ?>" placeholder="Organization Register Number" required />
|
||||
<div class="invalid-feedback"> Please provide. </div>
|
||||
</div>
|
||||
@ -80,7 +82,8 @@
|
||||
<div class="form-row">
|
||||
<div class="form-group col-md-4">
|
||||
<label for="bmobile" class="col-form-label">Organization Mobile Number<span class="text-danger">*</span></label>
|
||||
<input type="tel" class="form-control" name="bmobile" value="<?= isset($organzations['mobile_no']) ? $organzations['mobile_no'] : '' ?>" placeholder="Mobile Number (Enter only numbers)" required pattern="\d{10}" title="Please enter a 10-digit mobile number" oninput="this.value = this.value.replace(/[^0-9]/g, '')" maxlength="10" />
|
||||
<input type="tel" class="form-control" id="bmobile" name="bmobile" value="<?= isset($organzations['mobile_no']) ? $organzations['mobile_no'] : '' ?>" placeholder="Mobile Number (Enter only numbers)" required pattern="\d{10}" title="Please enter a 10-digit mobile number" oninput="this.value = this.value.replace(/[^0-9]/g, '')" maxlength="10" onchange="checkExisting(this,'mobile_no','bmobile','business')" />
|
||||
<span id="bmobileValidationMessage"></span>
|
||||
<div class="invalid-feedback"> Please provide. </div>
|
||||
</div>
|
||||
<div class="form-group col-md-4">
|
||||
@ -91,7 +94,7 @@
|
||||
|
||||
<?php if (isset($organzations['loged_user'])) { ?>
|
||||
<div class="form-group col-md-4">
|
||||
<label for="baddress" class="col-form-label">80G</label>
|
||||
<label for="80G" class="col-form-label">80G</label>
|
||||
<input type="text" class="form-control" name="80G" value="<?= isset($organzations['80G']) ? $organzations['80G'] : '' ?>" placeholder="80G Tax Free" />
|
||||
</div>
|
||||
<?php } ?>
|
||||
@ -152,11 +155,13 @@
|
||||
<div class="form-row">
|
||||
<div class="form-group col-md-6">
|
||||
<label for="admin_email" class="col-form-label">Admin Email</label>
|
||||
<input type="email" class="form-control" id="admin_email" name="admin_email" placeholder="Admin Email" value="<?= isset($organzations['admin_email']) ? $organzations['admin_email'] : '' ?>" />
|
||||
<input type="email" class="form-control" id="admin_email" name="admin_email" placeholder="Admin Email" value="<?= isset($organzations['admin_email']) ? $organzations['admin_email'] : '' ?>" onchange="checkExisting(this,'admin_email','admin_email','business')"/>
|
||||
<span id="adminemailValidationMessage"></span>
|
||||
</div>
|
||||
<div class="form-group col-md-6">
|
||||
<label for="site_mobile" class="col-form-label">Mobile Number</label>
|
||||
<input type="text" class="form-control" id="site_mobile" name="site_mobile" placeholder="Mobile Number (Enter only numbers)" data-parsley-type="number" value="<?= isset($organzations['site_mobile']) ? $organzations['site_mobile'] : '' ?>" pattern="\d{10}" title="Please enter a 10-digit mobile number" maxlength="10" />
|
||||
<input type="text" class="form-control" id="site_mobile" name="site_mobile" placeholder="Mobile Number (Enter only numbers)" data-parsley-type="number" value="<?= isset($organzations['site_mobile']) ? $organzations['site_mobile'] : '' ?>" pattern="\d{10}" title="Please enter a 10-digit mobile number" maxlength="10" onchange="checkExisting(this,'site_mobile','site_mobile','business')"/>
|
||||
<span id="sitemobileValidationMessage"></span>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-row">
|
||||
@ -587,4 +592,47 @@
|
||||
}
|
||||
});
|
||||
|
||||
</script>
|
||||
</script>
|
||||
<script>
|
||||
function checkExisting(input,databasecolumnname,elementid,table){
|
||||
|
||||
switch(elementid){
|
||||
case 'pan_no' :
|
||||
spanid = "panValidationMessage"; break;
|
||||
case 'bmail' :
|
||||
spanid = "bemailValidationMessage"; break;
|
||||
case 'bmobile' :
|
||||
spanid = "bmobileValidationMessage"; break;
|
||||
case 'admin_email' :
|
||||
spanid = "adminemailValidationMessage"; break;
|
||||
case 'site_mobile' :
|
||||
spanid = "sitemobileValidationMessage"; break;
|
||||
}
|
||||
var validationMessage = document.getElementById(spanid);
|
||||
var value = input.value.trim();
|
||||
if (value === "") {
|
||||
validationMessage.style.display = 'none';
|
||||
return;
|
||||
}
|
||||
$.ajax({
|
||||
type: "POST",
|
||||
url: "<?= base_url() . 'check_existing' ?>",
|
||||
data: {
|
||||
value: value,
|
||||
module: table,
|
||||
field: databasecolumnname
|
||||
},
|
||||
success: function(response) {
|
||||
console.log("check existing " + elementId + "--" + response['data']['message']);
|
||||
validationMessage.style.display = response['data']['status'] ? 'block' : 'none';
|
||||
validationMessage.innerText = response['data']['message'];
|
||||
validationMessage.style.color = "red";
|
||||
input.setCustomValidity(response['data']['status'] ? response['data']['message'] : '');
|
||||
if (response['data']['status']) input.value = '';
|
||||
},
|
||||
error: function(xhr, status, error) {
|
||||
console.error("check existing " + elementId + " -- " + status + ": " + error);
|
||||
}
|
||||
});
|
||||
}
|
||||
</script>
|
||||
|
||||
@ -4,28 +4,14 @@
|
||||
<div class="card">
|
||||
<div class="card-body">
|
||||
<h4 class="header-title"><?= $page_name; ?></h4>
|
||||
<?php if ($page_name === 'Edit Customer Details') : ?>
|
||||
<ul class="nav nav-tabs" id="customerTabs" role="tablist">
|
||||
<li class="nav-item">
|
||||
<a class="nav-link active" id="customerDetails-tab" data-toggle="tab" href="#customerDetails" role="tab" aria-controls="customerDetails" aria-selected="true">Customer Details</a>
|
||||
</li>
|
||||
<li class="nav-item">
|
||||
<a class="nav-link" id="subscriptionDetails-tab" data-toggle="tab" href="#subscriptionDetails" role="tab" aria-controls="subscriptionDetails" aria-selected="false">Subscription Details</a>
|
||||
</li>
|
||||
<li class="nav-item">
|
||||
<a class="nav-link" id="invoiceDetails-tab" data-toggle="tab" href="#invoiceDetails" role="tab" aria-controls="invoiceDetails" aria-selected="false">Invoice Details</a>
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
<?php endif; ?>
|
||||
<div class="form-group text-right m-b-0">
|
||||
<button class="btn btn-primary"style="margin-top:-60px;" id="editButton">Edit</button>
|
||||
</div>
|
||||
|
||||
<div class="tab-content">
|
||||
|
||||
|
||||
<!-- Customer Details Tab -->
|
||||
<div class="tab-pane fade show active" id="customerDetails" role="tabpanel" aria-labelledby="customerDetails-tab">
|
||||
|
||||
|
||||
<!-- Customer details form fields -->
|
||||
<form class="parsley-examples" novalidate method="POST" enctype="multipart/form-data" action="<?= base_url() . "insert_donor"; ?>" id="myForm" name="myForm">
|
||||
<!-- <img src="<?= base_url() . "public/assets/images/plugins/loading.gif" ?>" alt="loader1" style="display:none; height:30px; width:auto;" id="loaderImg"> -->
|
||||
@ -74,9 +60,8 @@
|
||||
<!-- <div class="input-group-prepend"> -->
|
||||
<div class="input-group-text">+91</div>
|
||||
<!-- </div> -->
|
||||
<input name="mobile"class="form-control" pattern="[0-9]{10}" value="<?= isset($customer['mobile_no']) ? $customer['mobile_no'] : '' ?>" type="tel" data-parsley-type="number" data-parsley-length="[10,10]" class="form-control" placeholder="Enter Contact Mobile" id="mobile" maxlength="10" onkeypress = "return onlyNumbers(event)" style="width: 80% !important;" required >
|
||||
|
||||
|
||||
<input name="mobile"class="form-control" pattern="[0-9]{10}" value="<?= isset($customer['mobile_no']) ? $customer['mobile_no'] : '' ?>" type="tel" data-parsley-type="number" data-parsley-length="[10,10]" class="form-control" placeholder="Enter Contact Mobile" id="mobile" maxlength="10" onkeypress = "return onlyNumbers(event)" style="width: 80% !important;" required onchange="checkExisting(this,'mobile_no','mobile')">
|
||||
<span id="mobileValidationMessage"></span>
|
||||
<div class="invalid-feedback"> Please provide. </div>
|
||||
</div>
|
||||
</div>
|
||||
@ -86,7 +71,7 @@
|
||||
<div class="form-row">
|
||||
<div class="form-group col-md-4">
|
||||
<label for="cmail" class="col-form-label"><span class="contactPerson">Contact Person </span>Email</label>
|
||||
<input type="text" class="form-control" id="cmail" name="cmail" value="<?= isset($customer['email']) ? $customer['email'] : '' ?>" placeholder="Email" onkeyup="validateEmail(this.value)" />
|
||||
<input type="text" class="form-control" id="cmail" name="cmail" value="<?= isset($customer['email']) ? $customer['email'] : '' ?>" placeholder="Email" onkeyup="validateEmail(this.value)" onchange="checkExisting(this,'email','cmail')"/>
|
||||
<span id="emailValidationMessage"></span>
|
||||
</div>
|
||||
|
||||
@ -97,11 +82,13 @@
|
||||
|
||||
<div class="form-group col-md-4">
|
||||
<label for="csname" class="col-form-label"><span class="contactPerson">Organization </span> PAN Number <i class="text-danger contactPerson"> *</i> </label>
|
||||
<input type="text" class="form-control" id="pan_no"name="pan_no" required value="<?= isset($customer['pan_no']) ? $customer['pan_no'] : '' ?>" placeholder="PAN Number" />
|
||||
<input type="text" class="form-control" id="pan_no"name="pan_no" required value="<?= isset($customer['pan_no']) ? $customer['pan_no'] : '' ?>" placeholder="PAN Number" onchange="checkExisting(this,'pan_no','pan_no')"/>
|
||||
<span id="panValidationMessage"></span>
|
||||
</div>
|
||||
<div class="form-group col-md-4" id="adhar_no_individual">
|
||||
<label for="csname" class="col-form-label"><span class="contactPerson"> </span>Aadhaar Number</label>
|
||||
<input type="text" class="form-control" id="adhar_no" name="adhar_no" value="<?= isset($customer['adhar_no']) ? $customer['adhar_no'] : '' ?>" placeholder="Aadhaar Number" />
|
||||
<input type="text" class="form-control" id="adhar_no" name="adhar_no" value="<?= isset($customer['adhar_no']) ? $customer['adhar_no'] : '' ?>" placeholder="Aadhaar Number" onchange="checkExisting(this,'adhar_no','adhar_no')"/>
|
||||
<span id="adharValidationMessage"></span>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
@ -169,8 +156,8 @@
|
||||
</div>
|
||||
</form>
|
||||
|
||||
</div><!-- end customer Details Tab -->
|
||||
</div><!-- end tab-content-->
|
||||
|
||||
|
||||
</div><!-- end card-body-->
|
||||
</div>
|
||||
</div>
|
||||
@ -323,4 +310,45 @@
|
||||
toggleFormElements();
|
||||
});
|
||||
</script>
|
||||
|
||||
<script>
|
||||
function checkExisting(input,databasecolumnname,elementid){
|
||||
|
||||
switch(elementid){
|
||||
case 'pan_no' :
|
||||
spanid = "panValidationMessage"; break;
|
||||
case 'cmail' :
|
||||
spanid = "emailValidationMessage"; break;
|
||||
case 'mobile' :
|
||||
spanid = "mobileValidationMessage"; break;
|
||||
case 'adhar_no' :
|
||||
spanid = "adharValidationMessage"; break;
|
||||
}
|
||||
var validationMessage = document.getElementById(spanid);
|
||||
var value = input.value.trim();
|
||||
if (value === "") {
|
||||
validationMessage.style.display = 'none';
|
||||
return;
|
||||
}
|
||||
$.ajax({
|
||||
type: "POST",
|
||||
url: "<?= base_url() . 'check_existing' ?>",
|
||||
data: {
|
||||
value: value,
|
||||
module: 'donor',
|
||||
field: databasecolumnname
|
||||
},
|
||||
success: function(response) {
|
||||
|
||||
console.log("check existing " + elementId + "--" + response['data']['message']);
|
||||
validationMessage.style.display = response['data']['status'] ? 'block' : 'none';
|
||||
validationMessage.innerText = response['data']['message'];
|
||||
validationMessage.style.color = "red";
|
||||
input.setCustomValidity(response['data']['status'] ? response['data']['message'] : '');
|
||||
if (response['data']['status']) input.value = '';
|
||||
},
|
||||
error: function(xhr, status, error) {
|
||||
console.error("check existing " + elementId + " -- " + status + ": " + error);
|
||||
}
|
||||
});
|
||||
}
|
||||
</script>
|
||||
@ -33,7 +33,8 @@
|
||||
<th>Name</th>
|
||||
<th>Mobile Number</th>
|
||||
<th>Contributor Type</th>
|
||||
<th>Action</th>
|
||||
<?php if (get_user_role() != 'accounts') { ?>
|
||||
<th>Action</th><?php } ?>
|
||||
</tr>
|
||||
</thead>
|
||||
<?php foreach ($customer as $value) :?>
|
||||
@ -52,6 +53,7 @@
|
||||
<?= 'Organization'; ?>
|
||||
<?php endif; ?>
|
||||
</td>
|
||||
<?php if (get_user_role() != 'accounts') { ?>
|
||||
<td>
|
||||
<a href="<?= "new_Donor/" . $value['donor_id']; ?>" class="edit-button"><i class="ri-pencil-line"></i></a>
|
||||
<a href="#" class="view-receipts" data-donor-id="<?= $value['donor_id']; ?>"><i class="ri-eye-fill"></i></a>
|
||||
@ -60,6 +62,7 @@
|
||||
<a href="<?= "delete_donor/" . $value['donor_id']; ?>" class="delete-button"><i class="ri-delete-bin-line"></i></a>
|
||||
<?php } ?>
|
||||
</td>
|
||||
<?php } ?>
|
||||
</tr>
|
||||
<?php endforeach; ?>
|
||||
</tbody>
|
||||
|
||||
@ -5,17 +5,17 @@
|
||||
<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" />
|
||||
<input data-plugin="knob" data-width="70" data-height="70" data-fgColor="#1abc9c" data-bgColor="#d1f2eb" value="<?= $donordetails['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>
|
||||
<h3 class="mb-1 mt-0"> <span data-plugin="counterup"><?= $donordetails['active']; ?></span> </h3>
|
||||
<p class="text-muted mb-0"><?= 'Available ' . $donordetails['label']; ?></p>
|
||||
<br>
|
||||
<h3 class="mb-1 mt-0"> <span data-plugin="counterup"><?= $customer['total']; ?></span> </h3>
|
||||
<p class="text-muted mb-0"><?= 'Total ' . $customer['label']; ?></p>
|
||||
<h3 class="mb-1 mt-0"> <span data-plugin="counterup"><?= $donordetails['total']; ?></span> </h3>
|
||||
<p class="text-muted mb-0"><?= 'Total ' . $donordetails['label']; ?></p>
|
||||
<br>
|
||||
<h3 class="mb-1 mt-0"> <span data-plugin="counterup"><?= $customer['today']; ?></span> </h3>
|
||||
<p class="text-muted mb-0"><?= 'New ' . $customer['label']; ?></p>
|
||||
<h3 class="mb-1 mt-0"> <span data-plugin="counterup"><?= $donordetails['today']; ?></span> </h3>
|
||||
<p class="text-muted mb-0"><?= 'New ' . $donordetails['label']; ?></p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@ -7,6 +7,26 @@
|
||||
color: #ff0000;
|
||||
/* Change to the desired hover color */
|
||||
}
|
||||
.spinner-overlay {
|
||||
position: absolute;
|
||||
top: 0;
|
||||
left: 0;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
background-color: rgba(255, 255, 255, 0.7);
|
||||
display: none;
|
||||
}
|
||||
|
||||
.spinner-overlay.active {
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
}
|
||||
|
||||
.spinner-border {
|
||||
z-index: 1;
|
||||
}
|
||||
|
||||
</style>
|
||||
<div class="row">
|
||||
<div class="col-lg-12">
|
||||
@ -168,6 +188,9 @@
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
<div class="spinner-overlay">
|
||||
<div class="spinner-border" role="status"></div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<!-- Your Minton theme modal HTML structure -->
|
||||
@ -185,7 +208,7 @@
|
||||
</div>
|
||||
<div class="modal-footer">
|
||||
<a href="#" class="btn btn-primary" id="downloadButton">Download</a>
|
||||
<a href="<?= base_url() . "receipt_list"; ?>" class="btn btn-secondary" data-dismiss="modal">Close</a>
|
||||
<a href="#" class="btn btn-secondary" id="closeButton">Close</a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@ -202,11 +225,11 @@
|
||||
type: 'POST',
|
||||
url: '<?= base_url("save_invoice"); ?>',
|
||||
data: $(this).serialize(),
|
||||
beforeSend: function() { $('.spinner-overlay').addClass('active'); },
|
||||
success: function(response) {
|
||||
if (response.success) {
|
||||
$('#successModal').modal('show');
|
||||
$('#downloadButton').attr('href', "<?= base_url('generate_invoice_pdf/'); ?>" + response.invoice_id);
|
||||
|
||||
} else {
|
||||
// Handle errors or display a different modal for failure
|
||||
console.log(response.message);
|
||||
@ -214,9 +237,17 @@
|
||||
},
|
||||
error: function(error) {
|
||||
console.log('AJAX Error:', error);
|
||||
}
|
||||
},
|
||||
complete: function() { $('.spinner-overlay').removeClass('active'); }
|
||||
});
|
||||
});
|
||||
$('#closeButton').on('click', function(e) {
|
||||
e.preventDefault();
|
||||
var url = "<?php echo base_url('receipt_list'); ?>";
|
||||
$('#successModal').modal('hide');
|
||||
$('#receiptForm')[0].reset();
|
||||
window.location.href = url;
|
||||
});
|
||||
});
|
||||
</script>
|
||||
|
||||
@ -225,7 +256,7 @@
|
||||
var data = <?php echo json_encode($typebaseddonors); ?>;
|
||||
var alldonors = <?php echo json_encode($alldonors); ?>;
|
||||
var editdata = <?php echo json_encode($receipt_details); ?>;
|
||||
var Rt = <?php echo json_encode($receipt_type); ?>;
|
||||
var Rt = "<?php echo $receipt_type; ?>";
|
||||
$(function() {
|
||||
|
||||
if (Rt == 'organization') {
|
||||
@ -241,7 +272,7 @@
|
||||
}
|
||||
|
||||
$('#donor_mobile').on('change', function() {
|
||||
var type = $('.receipt_type:checked').val();
|
||||
var Rtype = $('.receipt_type:checked').val();
|
||||
if ($(this).val()) {
|
||||
if ($(this).val() == '0') {
|
||||
$('#standard-modal').modal('show');
|
||||
@ -259,7 +290,7 @@
|
||||
// Assuming `data` is an array of objects containing donor information
|
||||
for (const donor of data) {
|
||||
if (selectedMobile == donor.mobile_no) {
|
||||
if (type == "organization") {
|
||||
if (Rtype == "organization") {
|
||||
options += `<option value="${donor.donor_id}" ${editdata && editdata.donor_id == donor.donor_id ? 'selected' : ''}>${donor.org_name} - ${donor.pan_no}</option>`;
|
||||
}else{
|
||||
options += `<option value="${donor.donor_id}" ${editdata && editdata.donor_id == donor.donor_id ? 'selected' : ''}>${donor.first_name}</option>`;
|
||||
@ -273,7 +304,7 @@
|
||||
}
|
||||
} else {
|
||||
var selectedMobile = $(this).val();
|
||||
var type = $('.receipt_type:checked').val();
|
||||
var Rtype = $('.receipt_type:checked').val();
|
||||
var options = '<option value="">--Select--</option>';
|
||||
if(role != 'accounts'){
|
||||
options += '<option value="0">+ Add a donor</option>';
|
||||
@ -281,7 +312,7 @@
|
||||
// Assuming `data` is an array of objects containing donor information
|
||||
console.log(donor);
|
||||
for (const donor of data) {
|
||||
if (type == "organization") {
|
||||
if (Rtype == "organization") {
|
||||
options += `<option value="${donor.donor_id}">${donor.org_name} - ${donor.pan_no}</option>`;
|
||||
}else{
|
||||
options += `<option value="${donor.donor_id}">${donor.first_name}</option>`;
|
||||
@ -296,13 +327,13 @@
|
||||
});
|
||||
|
||||
$('#donor_first_name').on('change', function() {
|
||||
var type = $('.receipt_type:checked').val();
|
||||
var Rtype = $('.receipt_type:checked').val();
|
||||
if ($(this).val() == '0') {
|
||||
$('#standard-modal').modal('show');
|
||||
} else {
|
||||
$('#standard-modal').modal('hide');
|
||||
$('#donor-form-submit').prop('disabled', false);
|
||||
if (type == "organization") {
|
||||
if (Rtype == "organization") {
|
||||
var selectedID = $(this).val();
|
||||
var options = '<option value="">--Select--</option>';
|
||||
if(role != 'accounts'){
|
||||
@ -332,7 +363,7 @@
|
||||
$('#donor-form-submit').on('click', function() {
|
||||
var form = $('#donorForm');
|
||||
var isValid = form[0].checkValidity();
|
||||
var type = $('.receipt_type:checked').val();
|
||||
var Rtype = $('.receipt_type:checked').val();
|
||||
|
||||
if (isValid) {
|
||||
// If the form is valid, disable the button to prevent multiple clicks
|
||||
@ -367,7 +398,7 @@
|
||||
value: v.mobile_no,text: v.mobile_no,
|
||||
selected: (v.donor_id == response['data']['donor_id']) ? true : false
|
||||
}));
|
||||
var dynamic = (type == 'organization') ? v.org_name+' - '+v.pan_no : v.first_name;
|
||||
var dynamic = (Rtype == 'organization') ? v.org_name+' - '+v.pan_no : v.first_name;
|
||||
$('#donor_first_name').append($('<option>', {
|
||||
value: v.donor_id,text: dynamic,
|
||||
selected: (v.donor_id == response['data']['donor_id']) ? true : false
|
||||
@ -525,7 +556,7 @@
|
||||
<div class="form-row">
|
||||
<div class="form-group col-md-12">
|
||||
<label for="o_pan_no" class="col-form-label"><span class="contactPerson">Organization PAN Number<span class="text-danger"> *</span></label>
|
||||
<input type="text" class="form-control" id="pan_no_org" name="o_pan_no" value="" placeholder="PAN Number" oninput="validatePANFormatOrg(this)" />
|
||||
<input type="text" class="form-control" id="pan_no_org" name="o_pan_no" value="" placeholder="PAN Number" oninput="validatePANFormatOrg(this)" onchange="checkExisting(this,'pan_no','pan_no_org')"/>
|
||||
<div id="panNoErrors" style="display: none; color: red;">Invalid PAN format</div>
|
||||
<div class="invalid-feedback"> Please provide. </div>
|
||||
</div>
|
||||
@ -552,7 +583,8 @@
|
||||
<div class="form-row">
|
||||
<div class="form-group col-md-12">
|
||||
<label for="cmail" class="col-form-label"><span class="contactPerson">Contact Person </span>Email<span class="text-danger"> *</span></label>
|
||||
<input type="email" class="form-control" id="cmail" name="cmail" value="<?= isset($receipt_details['email']) ? $receipt_details['email'] : '' ?>" placeholder="Email" required />
|
||||
<input type="email" class="form-control" id="cmail" name="cmail" value="<?= isset($receipt_details['email']) ? $receipt_details['email'] : '' ?>" placeholder="Email" required onchange="checkExisting(this,'email','cmail')"/>
|
||||
<div id="emailNoError" style="display: none; color: red;"></div>
|
||||
<div class="invalid-feedback"> Please provide a valid email address. </div>
|
||||
</div>
|
||||
</div>
|
||||
@ -560,7 +592,7 @@
|
||||
<div class="form-row" id="ind_pan">
|
||||
<div class="form-group col-md-12">
|
||||
<label for="pan_no" class="col-form-label">PAN Number<span class="text-danger"> *</span></label>
|
||||
<input type="text" class="form-control" id="pan_no" name="pan_no" value="<?= isset($receipt_details['pan_no']) ? $receipt_details['pan_no'] : '' ?>" placeholder="PAN Number" oninput="validatePANFormat(this)" required />
|
||||
<input type="text" class="form-control" id="pan_no" name="pan_no" value="<?= isset($receipt_details['pan_no']) ? $receipt_details['pan_no'] : '' ?>" placeholder="PAN Number" oninput="validatePANFormat(this)" required onchange="checkExisting(this,'pan_no','pan_no')"/>
|
||||
<div id="panNoError" style="display: none; color: red;">Invalid PAN format</div>
|
||||
<div class="invalid-feedback"> Please provide. </div>
|
||||
</div>
|
||||
@ -690,4 +722,36 @@
|
||||
});
|
||||
|
||||
}
|
||||
</script>
|
||||
<script>
|
||||
function checkExisting(input,databasecolumnname,elementid){
|
||||
|
||||
switch(elementid){
|
||||
case 'pan_no_org' :
|
||||
divErrorId = "panNoErrors"; break;
|
||||
case 'cmail' :
|
||||
divErrorId = "emailNoError"; break;
|
||||
case 'pan_no' :
|
||||
divErrorId = "panNoError"; break;
|
||||
}
|
||||
$.ajax({
|
||||
type: "POST",
|
||||
url: "<?= base_url() . 'check_existing' ?>",
|
||||
data: {
|
||||
value: input.value,
|
||||
module: 'donor',
|
||||
field: databasecolumnname
|
||||
},
|
||||
success: function(response) {
|
||||
console.log("check existing "+elementid+"--"+response['data']['message']);
|
||||
document.getElementById(divErrorId).style.display = response['data']['status'] ? 'block' : 'none';
|
||||
document.getElementById(divErrorId).innerText = response['data']['message'];
|
||||
input.setCustomValidity(response['data']['status'] ? response['data']['message'] : '');
|
||||
if(response['data']['status']) document.getElementById(elementid).value = '';
|
||||
},
|
||||
error: function(error) {
|
||||
console.log("check existing "+elementid+"--"+error);
|
||||
}
|
||||
});
|
||||
}
|
||||
</script>
|
||||
@ -69,9 +69,12 @@
|
||||
<td><?= date("d-m-Y", strtotime($row['receipt_date'])); ?> </td>
|
||||
<td><?= $row['created_name']; ?></td>
|
||||
<td>
|
||||
<?php foreach ($Donors as $DonorData) : ?>
|
||||
<?= $row['donor_id'] === $DonorData->donor_id ? $DonorData->first_name . $DonorData->last_name : ''; ?>
|
||||
<?php endforeach; ?>
|
||||
<?php foreach ($Donors as $DonorData) :
|
||||
$suffix = "";
|
||||
if($row['receipt_type'] == "organization"){ $suffix = " (".$DonorData->org_name.")"; } ?>
|
||||
<?= $row['donor_id'] === $DonorData->donor_id ? $DonorData->first_name . $DonorData->last_name.$suffix : ''; ?>
|
||||
<?php
|
||||
endforeach; ?>
|
||||
</td>
|
||||
<td id="<?= $row['receipt_id'] ?>">
|
||||
|
||||
@ -118,10 +121,19 @@
|
||||
<td><?= $row['receipt_header']; ?></td>
|
||||
<td><?php echo ($row['reason'] == null) ? '-' : $row['reason']; ?></td>
|
||||
<td>
|
||||
<a href="<?= base_url() . "new_receipt/" . $row['receipt_id']; ?>" class="edit-button" title="Edit the Invoice"><i class="ri-pencil-line" title="Edit the Invoice"></i></a>
|
||||
<a href="<?= base_url("generate_invoice_pdf/{$row['receipt_id']}") ?>" class="download-pdf-button" title="Download the Invoice"><i class="ri-file-download-line"></i></a>
|
||||
|
||||
|
||||
<!-- for my clarification
|
||||
assume that "receipt_header column like a Receipt Status"
|
||||
Default is 'Temporary Receipt'
|
||||
'Temporary Receipt' header means "Draft" Status
|
||||
'Receipt' header means "Completed" Status
|
||||
'Rejected' header means "Rejected" Status
|
||||
-->
|
||||
<?php if (isset($row['receipt_header']) && $row['receipt_header'] == 'Temporary Receipt') { ?>
|
||||
<a href="<?= base_url() . "new_receipt/" . $row['receipt_id']; ?>" class="edit-button" title="Edit the Invoice"><i class="ri-pencil-line" title="Edit the Invoice"></i></a>
|
||||
<?php } ?>
|
||||
<?php if (get_user_role() != 'volunteer') { ?>
|
||||
<a href="<?= base_url("generate_invoice_pdf/{$row['receipt_id']}") ?>" class="download-pdf-button" title="Download the Invoice"><i class="ri-file-download-line"></i></a>
|
||||
<?php } ?>
|
||||
<?php if (get_user_role() == 'accounts') { ?>
|
||||
<input type="hidden" id="donor_id" value="<?= isset($row['donor_id']) ? $row['donor_id'] : '' ?>">
|
||||
<?php if (isset($row['receipt_header']) && $row['receipt_header'] != 'Receipt') { ?>
|
||||
|
||||
@ -1,80 +0,0 @@
|
||||
<div class="row">
|
||||
<div class="col-lg-12">
|
||||
<div class="card">
|
||||
<div class="card-body">
|
||||
<h4 class="header-title"><?= $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">×</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">×</span>
|
||||
</button>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
<?php endif; ?>
|
||||
<p class="sub-header"> </p>
|
||||
<form class="needs-validation" novalidate method="POST" enctype="multipart/form-data" action="<?= base_url() . "insert_invoice_number_format"; ?>" id="myForm">
|
||||
<div class="form-group">
|
||||
<div class="form-row">
|
||||
<div class="form-group col-md-12">
|
||||
<label for="formating" class="col-form-label">Identifier formatting<span class="text-danger">*</span></label>
|
||||
<input type="text" class="form-control" name="formating" value="<?= isset($event['id_formating']) ? $event['id_formating'] : '' ?>" placeholder="INV{{-0-}}" required />
|
||||
<div class="invalid-feedback"> Please provide. </div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-row">
|
||||
<div class="form-group col-md-6">
|
||||
<label for="nextid" class="col-form-label">Next ID<span class="text-danger">*</span></label>
|
||||
<input type="number" class="form-control" name="nextid" value="<?= isset($event['next_id']) ? $event['next_id'] : 1 ?>" placeholder="" required />
|
||||
<div class="invalid-feedback"> Please provide. </div>
|
||||
</div>
|
||||
|
||||
<div class="form-group col-md-6">
|
||||
<label for="leftpad" class="col-form-label">Left Pad<span class="text-danger">*</span></label>
|
||||
<input type="number" class="form-control" name="leftpad" placeholder="Enter Number (3 means Eg : 000)" value="<?= isset($event['left_pad']) ? $event['left_pad'] : '' ?>" required>
|
||||
<div class="invalid-feedback"> Please provide. </div>
|
||||
</div>
|
||||
</div>
|
||||
<input type="hidden" id="id" name="id" placeholder="hidden for scheme id" value="<?= isset($event['id']) ? $event['id'] : '' ?>" />
|
||||
<input type="hidden" id="business_id" name="business_id" placeholder="hidden for business id" value="<?= $session_bid ?>" />
|
||||
|
||||
<br>
|
||||
|
||||
<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
|
||||
</button>
|
||||
<button type="reset" class="btn btn-primary waves-effect mr-1">
|
||||
Reset
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
</div> <!-- end card-body-->
|
||||
</div> <!-- end card-->
|
||||
</div> <!-- end col-->
|
||||
</div><!-- end row -->
|
||||
<script>
|
||||
document.getElementById('myForm').addEventListener('submit', function(event) {
|
||||
var form = event.target;
|
||||
|
||||
if (form.checkValidity() === false) {
|
||||
|
||||
form.reportValidity(); // Display validation error messages
|
||||
event.preventDefault(); // Prevent form submission if it's not valid
|
||||
$('#submitBtn').prop('disabled', false);
|
||||
} else {
|
||||
|
||||
$('#submitBtn').prop('disabled', true);
|
||||
}
|
||||
});
|
||||
</script>
|
||||
@ -82,9 +82,9 @@
|
||||
<td style="width: 20%; height: 25px; text-align: center;border: none;"> <img src="<?= $baseurl ?>" alt="Your Organization Logo" style="width: 100%;"></td>
|
||||
<td style="width: 80%; height: 20px;border: none;">
|
||||
<h3 style="text-align: right;text-decoration: underline"><strong><?= $data->title ?></strong></h3>
|
||||
<p class="sub-add" style="padding-left: 80px; text-align: right;"><?= $data->org_address ?>, <?= $data->org_city ?>,<?= $data->org_state ?> ,<?= $data->org_zip ?>.<br>
|
||||
MobileNo: <?= $data->org_mobile ?>, Email: <?= $data->org_email ?>,<br>
|
||||
PAN No: <?= $data->org_pan ?>, Register No:<?= $data->org_reg_no ?></p>
|
||||
<p class="sub-add" style="padding-left: 80px; text-align: right;"><?= $data->org_address ?> <?= $data->org_city ?? ",".$data->org_city ?> <?= $data->org_state ?? ",".$data->org_state ?> <?= $data->org_zip ?? ",".$data->org_zip."." ?><br>
|
||||
<?= $data->org_mobile ?? "MobileNo: ".$data->org_mobile.", " ?> <?= $data->org_email ?? "Email: ".$data->org_email.", " ?><br>
|
||||
<?= $data->org_pan ?? "PAN No: ".$data->org_pan.", " ?> <?= $data->org_reg_no ?? "Register No: ".$data->org_reg_no ?></p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr style="height: 18px;">
|
||||
@ -97,7 +97,7 @@
|
||||
<td style="width: 49% !important; height: 18px; text-align: right;border: none;"><strong>Date:</strong> <?=date("d-m-Y", strtotime($data->receipt_date));?></td>
|
||||
</tr>
|
||||
<tr style="height: 18px;">
|
||||
<td style="width: 100%; height: 18px; text-align: justify;border: none;padding:30px;" colspan="2"><p>Received with thanks from <b><?= $data->customer_name ?></b> <?php if($data->cust_pan_no) { echo ', PAN <b>'.$data->cust_pan_no.'</b>'; } ?>, a sum of (<?= $currency ?>.<?= $data->amount ?>) <b><?= $currency ?> <?= $currency_in_words ? $currency_in_words.' Only' :'' ?></b>, towards <b><?= $data->cause_name ?></b>.</td>
|
||||
<td style="width: 100%; height: 18px; text-align: justify;border: none;padding:30px;" colspan="2"><p>Received with thanks from <b><?= $data->customer_name . ($data->cust_org_name ? ' (' . $data->cust_org_name . ')' : '') ?></b><?php if($data->cust_pan_no) { echo ', PAN <b>'.$data->cust_pan_no.'</b>'; } ?>, a sum of (<?= $currency ?>.<?= $data->amount ?>) <b><?= $currency ?> <?= $currency_in_words ? $currency_in_words.' Only' :'' ?></b>, towards <b><?= $data->cause_name ?></b>.</td>
|
||||
</tr>
|
||||
<tr style="height: 18px;">
|
||||
<td style="width: 30.5118%; height: 18px;border: none;"><strong>Collected by:</strong> <?= $staff_name ?></td>
|
||||
|
||||
@ -1,174 +0,0 @@
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<title>Shipping Label Template</title>
|
||||
|
||||
<?php if($action == 2) { ?>
|
||||
<style>
|
||||
.aside-content{
|
||||
border-bottom: 3px solid #ffffff;
|
||||
}
|
||||
.invoice {
|
||||
width: 48%;
|
||||
height: 150px;
|
||||
margin-left: 2px;
|
||||
float: left;
|
||||
page-break-inside: avoid;
|
||||
padding-right: 2px !important;
|
||||
border: 2px solid #FFFF00;
|
||||
box-sizing: border-box;
|
||||
}
|
||||
.header {
|
||||
text-align: center;
|
||||
background:#fff!important;
|
||||
}
|
||||
|
||||
.bill-details {
|
||||
margin-bottom: 20px;
|
||||
}
|
||||
|
||||
.customer-details {
|
||||
margin-top: 20px;
|
||||
}
|
||||
|
||||
.row {
|
||||
clear: both;
|
||||
}
|
||||
|
||||
.page-container {
|
||||
width: 98%; /* Set the width of the A4 sheet */
|
||||
margin: 1%; /* Add margin for spacing between A4 sheet and labels */
|
||||
}
|
||||
|
||||
.business-logo {
|
||||
max-width:175px;
|
||||
height: auto;
|
||||
width:100%;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<div class="page-container">
|
||||
<?php
|
||||
// Assuming $customerDetails is an array of customer details
|
||||
$customerCount = count($customerDetails);
|
||||
$labelsPerRow = 2;
|
||||
for ($i = 0; $i < $customerCount; $i++) :
|
||||
if ($i % $labelsPerRow == 0) {
|
||||
echo '<div class="row aside-content">';
|
||||
}
|
||||
?>
|
||||
<div class="invoice">
|
||||
<div class="bill-details">
|
||||
<!-- <div style="margin-bottom:5px;">To:</div> -->
|
||||
<?= $customerDetails[$i]['customer_name'] ?>
|
||||
<?= $customerDetails[$i]['address_1'] ?>,
|
||||
<?= $customerDetails[$i]['address_2'] ?>,
|
||||
<?= $customerDetails[$i]['city'] ?>,
|
||||
<?= $customerDetails[$i]['state'] ?> -
|
||||
<?= $customerDetails[$i]['postal_code'] ?>
|
||||
<?php if($customerDetails[$i]['mobile_no'])
|
||||
{
|
||||
echo'Mobile : '.$customerDetails[$i]['mobile_no'];
|
||||
} ?>
|
||||
</div>
|
||||
|
||||
<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]['address'] ?>
|
||||
<?= $customerDetails[$i]['city'] ?> - <?= $customerDetails[$i]['postal_code'] ?></div>
|
||||
</div>
|
||||
</div>
|
||||
<?php
|
||||
if (($i + 1) % $labelsPerRow == 0 || ($i + 1) == $customerCount) {
|
||||
echo '</div>';
|
||||
}
|
||||
endfor; ?>
|
||||
</div>
|
||||
</body>
|
||||
<?php } ?>
|
||||
<?php if($action == 1) { ?>
|
||||
<style>
|
||||
body{
|
||||
font-family:Helvetica!important;
|
||||
line-height:24px;
|
||||
color:#000!important;
|
||||
}
|
||||
.invoice {
|
||||
width: 4in;
|
||||
/* height: 6in; */
|
||||
margin: 20px auto;
|
||||
border: 1px solid #FFFF00;
|
||||
padding:15px;
|
||||
box-sizing: border-box;
|
||||
}
|
||||
|
||||
.header {
|
||||
text-align: center;
|
||||
background:#fff!important;
|
||||
}
|
||||
|
||||
.business-logo {
|
||||
max-width:175px;
|
||||
height: auto;
|
||||
width:100%;
|
||||
}
|
||||
|
||||
.bill-details {
|
||||
margin-bottom: 20px;
|
||||
}
|
||||
|
||||
.customer-details {
|
||||
margin-top: 20px;
|
||||
}
|
||||
|
||||
.row {
|
||||
clear: both;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<div class="page-container">
|
||||
<?php
|
||||
// Assuming $customerDetails is an array of customer details
|
||||
$customerCount = count($customerDetails);
|
||||
|
||||
for ($i = 0; $i < $customerCount; $i++) :
|
||||
?>
|
||||
<div class="invoice">
|
||||
|
||||
|
||||
<div class="bill-details">
|
||||
<!-- <div style="margin-bottom:5px;">To:</div> -->
|
||||
<?= $customerDetails[$i]['customer_name'] ?>
|
||||
<?= $customerDetails[$i]['address_1'] ?>,
|
||||
<?= $customerDetails[$i]['address_2'] ?>,
|
||||
<?= $customerDetails[$i]['city'] ?>,
|
||||
<?= $customerDetails[$i]['state'] ?> -
|
||||
<?= $customerDetails[$i]['postal_code'] ?>
|
||||
<?php if($customerDetails[$i]['mobile_no'])
|
||||
{
|
||||
echo'Mobile : '.$customerDetails[$i]['mobile_no'];
|
||||
} ?>
|
||||
</div>
|
||||
|
||||
<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="<?= 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]['address'] ?>
|
||||
<?= $customerDetails[$i]['city'] ?> - <?= $customerDetails[$i]['postal_code'] ?></div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<?php endfor; ?>
|
||||
</div>
|
||||
</body>
|
||||
<?php } ?>
|
||||
</html>
|
||||
@ -1,189 +0,0 @@
|
||||
|
||||
<!-- 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">
|
||||
<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">
|
||||
|
||||
|
||||
<table id="datatable-buttons" class="table table-striped dt-responsive nowrap w-100">
|
||||
<thead>
|
||||
<tr>
|
||||
<th hidden>id</th>
|
||||
<th>Invoice No</th>
|
||||
<th>Invoice Date</th>
|
||||
<th>Customer Name</th>
|
||||
<th>GST</th>
|
||||
<th>Discount</th>
|
||||
<th>Count</th>
|
||||
<th>OT Charges</th>
|
||||
<th>Total</th>
|
||||
<th>payment</th>
|
||||
</tr>
|
||||
</thead>
|
||||
|
||||
|
||||
<tbody>
|
||||
<?php foreach ($report_data as $row)
|
||||
{ ?>
|
||||
<tr>
|
||||
<td hidden><?php echo $row->invoice_id;?></td>
|
||||
<td><?php echo $row->invoice_number;?></td>
|
||||
<td><?php echo $row->invoice_date;?></td>
|
||||
<td><?php echo $row->first_name." ".$row->last_name;?></td>
|
||||
<td><?php echo $row->tax . '%'; ?></td>
|
||||
<td><?php echo '₹' . number_format($row->discount, 2, '.', ','); ?></td>
|
||||
<td><?php echo $row->item_count;?></td>
|
||||
<td><?php echo '₹' . number_format($row->shipping_charge, 2, '.', ','); ?></td>
|
||||
<td><?php echo '₹' . number_format($row->total_amount, 2, '.', ','); ?></td>
|
||||
<td><?php echo $row->payment_method;?></td>
|
||||
</tr>
|
||||
<?php } ?>
|
||||
</tbody>
|
||||
|
||||
</table>
|
||||
|
||||
</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: 'pdfHtml5',
|
||||
title: 'General Invoice Report',
|
||||
text: 'PDF',
|
||||
customize: function(doc) {
|
||||
// Exclude the first and last columns
|
||||
doc.content[1].table.body.forEach(function(row) {
|
||||
row.splice(0, 1); // Remove the first column
|
||||
row.splice(-1, 1); // Remove the last column
|
||||
});
|
||||
}
|
||||
},
|
||||
{
|
||||
extend: 'print',
|
||||
title: 'General 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, th:last-child, td:last-child').remove();
|
||||
}
|
||||
},
|
||||
{
|
||||
extend: 'csv',
|
||||
text: 'CSV',
|
||||
title: 'General Invoice Report',
|
||||
exportOptions: {
|
||||
columns: ':not(:first-child):not(:last-child)' // Exclude the first and last columns
|
||||
}
|
||||
}
|
||||
],
|
||||
columnDefs: [
|
||||
{ type: 'date', targets: [1,2,3,4,5,6,7,8,9], 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();
|
||||
if (title != 'Invoice Date') {
|
||||
// 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>');
|
||||
});
|
||||
} else {
|
||||
// For "Invoice Date" column, add a date input
|
||||
if (title != 'GST')
|
||||
$(this).html('<input type="date" class="form-control form-control-sm" placeholder="Search ' + title + '" />');
|
||||
}
|
||||
|
||||
$('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 type="text" class="form-control form-control-sm" placeholder="Select date range"/>')
|
||||
.appendTo('#datatable-buttons thead tr:eq(2) th:eq(2)')
|
||||
.daterangepicker({
|
||||
autoUpdateInput: false,
|
||||
locale: {
|
||||
cancelLabel: 'Clear'
|
||||
}
|
||||
})
|
||||
.on('click', function (e) {
|
||||
// Prevent sorting when clicking on the date range filter input
|
||||
e.stopPropagation();
|
||||
});
|
||||
|
||||
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();
|
||||
});
|
||||
|
||||
dateRangeFilter.on('cancel.daterangepicker', function () {
|
||||
dateRangeFilter.val('');
|
||||
table.column(2).search('').draw();
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
</script>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@ -1,105 +0,0 @@
|
||||
<style>
|
||||
.custom-thead th,
|
||||
.custom-tbody td {
|
||||
white-space: initial !important;
|
||||
}
|
||||
</style>
|
||||
|
||||
|
||||
<!-- 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('itemwise_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>
|
||||
<!-- end page title -->
|
||||
|
||||
<div class="row">
|
||||
<div class="col-12">
|
||||
<div class="card">
|
||||
<div class="card-body">
|
||||
<table id="datatable-buttons" class="table table-striped dt-responsive nowrap w-100">
|
||||
<thead class="custom-thead">
|
||||
<tr>
|
||||
<th>Product Name</th>
|
||||
<th>Count</th>
|
||||
<th>Value</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody class="custom-tbody">
|
||||
<?php foreach ($report_data as $row)
|
||||
{ ?>
|
||||
<tr>
|
||||
<td><?php echo $row->title;?></td>
|
||||
<td><?php echo $row->item_count;?></td>
|
||||
<td><?php echo $row->item_cost;?></td>
|
||||
</tr>
|
||||
<?php } ?>
|
||||
</tbody>
|
||||
</table>
|
||||
</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: 'pdfHtml5',
|
||||
title: 'General Invoice Report',
|
||||
text: 'PDF',
|
||||
customize: function(doc) {
|
||||
// Exclude the first and last columns
|
||||
doc.content[1].table.body.forEach(function(row) {
|
||||
row.splice(0, 1); // Remove the first column
|
||||
row.splice(-1, 1); // Remove the last column
|
||||
});
|
||||
}
|
||||
},
|
||||
{
|
||||
extend: 'print',
|
||||
title: 'General 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, th:last-child, td:last-child').remove();
|
||||
}
|
||||
},
|
||||
{
|
||||
extend: 'csv',
|
||||
text: 'CSV',
|
||||
title: 'General Invoice Report',
|
||||
exportOptions: {
|
||||
columns: ':not(:first-child):not(:last-child)' // Exclude the first and last columns
|
||||
}
|
||||
}
|
||||
]
|
||||
});
|
||||
});
|
||||
|
||||
</script>
|
||||
|
||||
|
||||
|
||||
@ -1,183 +0,0 @@
|
||||
|
||||
<!-- 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('mem_inv_rp'); ?>" 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">
|
||||
|
||||
<table id="datatable-buttons" class="table table-striped dt-responsive nowrap w-100">
|
||||
<thead>
|
||||
<tr>
|
||||
<th hidden>id</th>
|
||||
<th>Invoice No</th>
|
||||
<th>Invoice Date</th>
|
||||
<!-- <th>scheme name</th> -->
|
||||
<th>Customer Name</th>
|
||||
<th>GST</th>
|
||||
<th>Discount</th>
|
||||
<th>Count</th>
|
||||
<th>OT Charges</th>
|
||||
<th>Total</th>
|
||||
<th>payment</th>
|
||||
</tr>
|
||||
</thead>
|
||||
|
||||
|
||||
<tbody>
|
||||
<?php foreach ($report_data as $row)
|
||||
{ ?>
|
||||
<tr>
|
||||
<td hidden><?php echo $row->invoice_id;?></td>
|
||||
<td><?php echo $row->invoice_number;?></td>
|
||||
<td><?php echo $row->invoice_date;?></td>
|
||||
<!-- <td>scheme name</td> -->
|
||||
<td><?php echo $row->first_name." ".$row->last_name;?></td>
|
||||
<td><?php echo $row->tax . '%'; ?></td>
|
||||
<td><?php echo '₹' . number_format($row->discount, 2, '.', ','); ?></td>
|
||||
<td><?php echo $row->item_count;?></td>
|
||||
<td><?php echo '₹' . number_format($row->shipping_charge, 2, '.', ','); ?></td>
|
||||
<td><?php echo '₹' . number_format($row->total_amount, 2, '.', ','); ?></td>
|
||||
<td><?php echo $row->payment_method;?></td>
|
||||
</tr>
|
||||
<?php } ?>
|
||||
</tbody>
|
||||
|
||||
</table>
|
||||
|
||||
</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: 'pdfHtml5',
|
||||
title: 'General Invoice Report',
|
||||
text: 'PDF',
|
||||
customize: function(doc) {
|
||||
// Exclude the first and last columns
|
||||
doc.content[1].table.body.forEach(function(row) {
|
||||
row.splice(0, 1); // Remove the first column
|
||||
row.splice(-1, 1); // Remove the last column
|
||||
});
|
||||
}
|
||||
},
|
||||
{
|
||||
extend: 'print',
|
||||
title: 'General 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, th:last-child, td:last-child').remove();
|
||||
}
|
||||
},
|
||||
{
|
||||
extend: 'csv',
|
||||
text: 'CSV',
|
||||
title: 'General Invoice Report',
|
||||
exportOptions: {
|
||||
columns: ':not(:first-child):not(:last-child)' // Exclude the first and last columns
|
||||
}
|
||||
}
|
||||
],
|
||||
columnDefs: [
|
||||
{ type: 'date', targets: [1,2,3,4,5,6,7,8,9], 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();
|
||||
if (title != 'Invoice Date') {
|
||||
// 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>');
|
||||
});
|
||||
} else {
|
||||
// For "Invoice Date" column, add a date input
|
||||
if (title != 'GST')
|
||||
$(this).html('<input type="date" class="form-control form-control-sm" placeholder="Search ' + title + '" />');
|
||||
}
|
||||
|
||||
$('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 type="text" class="form-control form-control-sm" placeholder="Select date range"/>')
|
||||
.appendTo('#datatable-buttons thead tr:eq(2) th:eq(2)')
|
||||
.daterangepicker({
|
||||
autoUpdateInput: false,
|
||||
locale: {
|
||||
cancelLabel: 'Clear'
|
||||
}
|
||||
})
|
||||
.on('click', function (e) {
|
||||
// Prevent sorting when clicking on the date range filter input
|
||||
e.stopPropagation();
|
||||
});
|
||||
|
||||
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();
|
||||
});
|
||||
|
||||
dateRangeFilter.on('cancel.daterangepicker', function () {
|
||||
dateRangeFilter.val('');
|
||||
table.column(2).search('').draw();
|
||||
});
|
||||
|
||||
|
||||
});
|
||||
|
||||
</script>
|
||||
|
||||
|
||||
|
||||
@ -1,277 +0,0 @@
|
||||
<html>
|
||||
|
||||
<head>
|
||||
</head>
|
||||
<style>
|
||||
/* CSS for the preview image */
|
||||
.preview-image {
|
||||
display: block;
|
||||
/* Ensure the image is displayed as a block element */
|
||||
width: 120px;
|
||||
/* Set the desired width for passport size */
|
||||
height: 160px;
|
||||
/* Set the desired height for passport size */
|
||||
object-fit: cover;
|
||||
/* Maintain the aspect ratio and fill the container */
|
||||
margin-top: 10px;
|
||||
/* Add a top margin for spacing */
|
||||
}
|
||||
</style>
|
||||
|
||||
|
||||
|
||||
<div class="row">
|
||||
<div class="col-lg-12">
|
||||
<div class="card">
|
||||
<div class="card-body">
|
||||
<h4 class="header-title"><?= $page_name; ?></h4>
|
||||
<p class="sub-header"> </p>
|
||||
|
||||
<?php if (session()->getFlashdata('success')): ?>
|
||||
<div class="alert alert-success"><?= session()->getFlashdata('success') ?></div>
|
||||
<?php endif; ?>
|
||||
<form method="post" enctype="multipart/form-data"
|
||||
action="<?= base_url()."sitesetting_synchronization"; ?>">
|
||||
<div class="form-group">
|
||||
|
||||
<div class="form-row">
|
||||
<div class="form-group col-md-12">
|
||||
<label for="postal_code" class="col-form-label">Organization</label>
|
||||
<select id="business_id" name="business_id" class="form-control">
|
||||
<option value="null"><?php if(!isset($details['business_id'])){ echo 'Choose Organization'; } ?></option>
|
||||
<?php foreach ($organzation_details as $value) { ?>
|
||||
<option value="<?php echo $value['business_id']; ?>"
|
||||
<?php if (isset($details['business_id']) && ($details['business_id'] === $value['business_id'])) echo "selected"; ?>>
|
||||
<?php echo $value['title']; ?></option>
|
||||
<?php } ?>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-row">
|
||||
<div class="form-group col-md-6">
|
||||
<label for="site_name" class="col-form-label">Site Name</label>
|
||||
<input type="text" class="form-control" id="site_name" name="site_name"
|
||||
value="<?= isset($details['site_name']) ? $details['site_name'] : '' ?>"
|
||||
placeholder="Site Name" />
|
||||
</div>
|
||||
<div class="form-group col-md-6">
|
||||
<label for="site_title" class="col-form-label">Site Title</label>
|
||||
<input type="text" class="form-control" id="site_title" name="site_title"
|
||||
placeholder="Site Title"
|
||||
value="<?= isset($details['site_title']) ? $details['site_title'] : '' ?>" />
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-row">
|
||||
<div class="form-group col-md-6">
|
||||
<label for="admin_email" class="col-form-label">Admin Email</label>
|
||||
<input type="email" class="form-control" id="admin_email" name="admin_email"
|
||||
placeholder="Admin Email"
|
||||
value="<?= isset($details['admin_email']) ? $details['admin_email'] : '' ?>" />
|
||||
</div>
|
||||
<div class="form-group col-md-6">
|
||||
<label for="mobile" class="col-form-label">Mobile Number</label>
|
||||
<input type="text" class="form-control" id="mobile" name="mobile"
|
||||
placeholder="Mobile Number (Enter only numbers)" data-parsley-type="number"
|
||||
value="<?= isset($details['mobile']) ? $details['mobile'] : '' ?>" maxlength="10" />
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-row">
|
||||
<div class="form-group col-md-6">
|
||||
<label for="copyright" class="col-form-label">Copyright</label>
|
||||
<input type="text" class="form-control" id="copyright" name="copyright"
|
||||
placeholder="Copy Right"
|
||||
value="<?= isset($details['copyright']) ? $details['copyright'] : '' ?>" />
|
||||
</div>
|
||||
<div class="form-group col-md-6">
|
||||
<label for="pagination_limit" class="col-form-label">Pagination Limit</label>
|
||||
<input type="text" class="form-control" id="pagination_limit" name="pagination_limit"
|
||||
placeholder="Pagination Limit"
|
||||
value="<?= isset($details['pagination_limit']) ? $details['pagination_limit'] : '' ?>" />
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-row">
|
||||
<div class="form-group col-md-6">
|
||||
<label for="logo" class="col-form-label">Logo Image</label>
|
||||
<input type="file" class="form-control" style="border: 0px !important; " id="logo"
|
||||
name="slogo" placeholder="Logo Name" accept=".png, .jpg, .jpeg"
|
||||
value="<?= isset($details['logo']) ? $details['logo'] : '' ?>" />
|
||||
</div>
|
||||
<?php if (!empty($details['logo'])) { ?>
|
||||
<div class="form-group col-md-6">
|
||||
<label for="slogo" class="col-form-label"> Logo</label>
|
||||
<img src="<?= base_url('public/uploads/'. $details['logo']) ?>" alt="Logo"
|
||||
class="preview-image" />
|
||||
</div>
|
||||
<?php } ?>
|
||||
<div class="form-group col-md-6">
|
||||
<label for="favicon" class="col-form-label">Favicon</label>
|
||||
<input type="file" class="form-control" style="border: 0px !important; " id="favic"
|
||||
name="favicon" placeholder="Fav-icon Name" accept=".png, .jpg, .jpeg"
|
||||
value="<?= isset($details['favicon']) ? $details['favicon'] : '' ?>" />
|
||||
</div>
|
||||
<?php if (!empty($details['favicon'])) { ?>
|
||||
<div class="form-group col-md-6">
|
||||
<label for="favicon" class="col-form-label">Icon</label>
|
||||
<img src="<?= base_url('public/uploads/'. $details['favicon']) ?>" alt="Icon"
|
||||
class="preview-image" />
|
||||
</div>
|
||||
<?php } ?>
|
||||
</div>
|
||||
<div class="form-row">
|
||||
<div class="form-group col-md-6">
|
||||
<label for="currency" class="col-form-label">Currency</label>
|
||||
<input type="text" class="form-control" id="currency" name="currency"
|
||||
placeholder="currency (eg : Rupees,Dollar,Euro)"
|
||||
value="<?= isset($details['currency']) ? $details['currency'] : '' ?>" />
|
||||
</div>
|
||||
<div class="form-group col-md-6">
|
||||
<label for="country" class="col-form-label">Country</label>
|
||||
<input type="text" class="form-control" id="country" name="country"
|
||||
placeholder="Country"
|
||||
value="<?= isset($details['country']) ? $details['country'] : '' ?>" />
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-row">
|
||||
<div class="form-group col-md-4">
|
||||
<label for="mail_protocol" class="col-form-label">Mail Protocol</label>
|
||||
<input type="text" class="form-control" id="mail_protocol" name="mail_protocol"
|
||||
placeholder="Mail Protocol (eg : zoho,gmail)"
|
||||
value="<?= isset($details['mail_protocol']) ? $details['mail_protocol'] : '' ?>" />
|
||||
</div>
|
||||
<div class="form-group col-md-4">
|
||||
<label for="mail_title" class="col-form-label">Mail Title</label>
|
||||
<input type="text" class="form-control" id="mail_title" name="mail_title"
|
||||
placeholder="Mail Title"
|
||||
value="<?= isset($details['mail_title']) ? $details['mail_title'] : '' ?>" />
|
||||
</div>
|
||||
<div class="form-group col-md-4">
|
||||
<label for="mail_host" class="col-form-label">Mail Host</label>
|
||||
<input type="text" class="form-control" id="mail_host" name="mail_host"
|
||||
placeholder="Mail Host"
|
||||
value="<?= isset($details['mail_host']) ? $details['mail_host'] : '' ?>" />
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-row">
|
||||
<div class="form-group col-md-4">
|
||||
<label for="mail_port" class="col-form-label">Mail Port</label>
|
||||
<input type="text" class="form-control" id="mail_port" name="mail_port"
|
||||
placeholder="Mail Port"
|
||||
value="<?= isset($details['mail_port']) ? $details['mail_port'] : '' ?>" />
|
||||
</div>
|
||||
<!-- <div class="form-group col-md-3">
|
||||
<label for="mail_encryption" class="col-form-label">Mail Encryption</label>
|
||||
<input type="text" class="form-control" id="mail_encryption" name="mail_encryption"
|
||||
placeholder="Mail Encryption"
|
||||
value="<?= isset($details['mail_encryption']) ? $details['mail_encryption'] : '' ?>" />
|
||||
</div> -->
|
||||
<div class="form-group col-md-4">
|
||||
<label for="mail_username" class="col-form-label">Mail Username</label>
|
||||
<input type="text" class="form-control" id="mail_username" name="mail_username"
|
||||
placeholder="Mail Username"
|
||||
value="<?= isset($details['mail_username']) ? $details['mail_username'] : '' ?>" />
|
||||
</div>
|
||||
<div class="form-group col-md-4">
|
||||
<label for="mail_password" class="col-form-label">Mail Password</label>
|
||||
<input type="text" class="form-control" id="mail_password" name="mail_password"
|
||||
placeholder="Mail Password"
|
||||
value="<?= isset($details['mail_password']) ? $details['mail_password'] : '' ?>" />
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<br />
|
||||
<div class="after-add-more">
|
||||
<hr />
|
||||
<h4 class="header-title">Receipt Format</h4>
|
||||
<div class="form-group">
|
||||
<div class="form-row">
|
||||
<div class="form-group col-md-4">
|
||||
<div>
|
||||
<label for="bistate" class="col-form-label">Prefix</label>
|
||||
<input type="text" class="form-control" id="bistate" name="prefix_format" placeholder="Receipt Number Format" value="<?= isset($details['prefix_format']) ? $details['prefix_format'] : ''?>"/>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group col-md-4">
|
||||
<label for="baddress1" class="col-form-label">Left Padding</label>
|
||||
<input type="text" class="form-control" id="baddress1" name="left_pad" placeholder="Left Padding Number" value="<?= isset($details['left_pad']) ? $details['left_pad'] : '' ?>"/>
|
||||
</div>
|
||||
<div class="form-group col-md-4">
|
||||
<label for="bcity" class="col-form-label">Start Number</label>
|
||||
<input type="text" class="form-control" id="bcity" name="start_no" value="<?= isset($details['start_no']) ? $details['start_no'] : '1' ?>" placeholder="Start Number" />
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<br />
|
||||
|
||||
|
||||
<input type="hidden" id="setting_id" name="setting_id" placeholder="hidden for setting id" value="<?= isset($details['setting_id']) ? $details['setting_id'] : '' ?>" />
|
||||
|
||||
<?php if(!empty($details)){ ?>
|
||||
<div class="form-group text-right m-b-0 checkbox checkbox-purple" style="display: none;">
|
||||
<input type="checkbox" id="isactive" name="isactive" class="form-control"
|
||||
<?= isset($details) && $details['isactive'] == 1 ? 'checked' : '' ?>>
|
||||
<label for="isactive"> Is Active</label>
|
||||
</div>
|
||||
<br>
|
||||
<?php } ?>
|
||||
<div class="form-group text-right m-b-0">
|
||||
<button type="submit" class="btn btn-success waves-effect waves-light mr-1" id="submitBtn">Save</button>
|
||||
|
||||
<!-- <button type="button" class="btn btn-secondary waves-effect">Cancel</button> -->
|
||||
<button type="button" class="btn btn-secondary waves-effect" onclick="history.back()">Cancel</button>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
</div> <!-- end card-body-->
|
||||
</div> <!-- end card-->
|
||||
</div> <!-- end col-->
|
||||
</div>
|
||||
<!-- end row -->
|
||||
<script>
|
||||
document.getElementById('myForm').addEventListener('submit', function(event) {
|
||||
var form = event.target;
|
||||
|
||||
if (form.checkValidity() === false) {
|
||||
|
||||
form.reportValidity(); // Display validation error messages
|
||||
event.preventDefault(); // Prevent form submission if it's not valid
|
||||
$('#submitBtn').prop('disabled', false);
|
||||
} else {
|
||||
|
||||
$('#submitBtn').prop('disabled', true);
|
||||
}
|
||||
});
|
||||
</script>
|
||||
<script>
|
||||
function checkFileFormat() {
|
||||
var input = document.getElementById('logo');
|
||||
var fileName = input.value;
|
||||
var allowedFormats = ['.png', '.jpg', '.jpeg'];
|
||||
|
||||
if (fileName) {
|
||||
var fileExtension = fileName.slice((fileName.lastIndexOf(".") - 1 >>> 0) + 2);
|
||||
|
||||
if (allowedFormats.indexOf(fileExtension.toLowerCase()) === -1) {
|
||||
alert('Please choose a valid image file (PNG, JPG, JPEG).');
|
||||
input.value = ''; // Clear the file input to allow choosing a new file
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
<script>
|
||||
function checkFileFormats() {
|
||||
var input = document.getElementById('favic');
|
||||
var fileName = input.value;
|
||||
var allowedFormats = ['.png', '.jpg', '.jpeg'];
|
||||
|
||||
if (fileName) {
|
||||
var fileExtension = fileName.slice((fileName.lastIndexOf(".") - 1 >>> 0) + 2);
|
||||
|
||||
if (allowedFormats.indexOf(fileExtension.toLowerCase()) === -1) {
|
||||
alert('Please choose a valid image file (PNG, JPG, JPEG).');
|
||||
input.value = ''; // Clear the file input to allow choosing a new file
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
@ -1,67 +0,0 @@
|
||||
<div class="row">
|
||||
<div class="col-12">
|
||||
<div class="card">
|
||||
<div class="card-body">
|
||||
<div class="float-right">
|
||||
<a href="<?= base_url()."sitesetting_page/0"; ?>" class="btn btn-primary"><i class="mdi mdi-playlist-plus"></i> Add Setting </a>
|
||||
</div><!-- end col-->
|
||||
<br>
|
||||
<h4 class="header-title mb-3"><?= $page_name; ?></h4>
|
||||
<?php if (session()->getFlashdata('success')): ?>
|
||||
<div class="alert alert-success"><?= session()->getFlashdata('success') ?></div>
|
||||
<?php endif; ?>
|
||||
<div class="table-responsive">
|
||||
<table id="scroll-horizontal-datatable" class="table w-100 nowrap">
|
||||
<thead class="thead-light">
|
||||
<tr>
|
||||
<th>Site Name</th>
|
||||
<th>Site Title</th>
|
||||
<th>Admin email</th>
|
||||
<th>Mobile Number</th>
|
||||
<th>Copyright</th>
|
||||
<th>Logo</th>
|
||||
<th>Icon</th>
|
||||
<th>Status</th>
|
||||
<th>Action</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<?php foreach ($details as $row):
|
||||
if ($row['isactive']) {
|
||||
$class = 'badge badge-soft-success';
|
||||
$message = 'Active';
|
||||
} else {
|
||||
$class = 'badge badge-soft-danger';
|
||||
$message = 'In-Active';
|
||||
}
|
||||
$edit_page_route = base_url()."sitesetting_page/".$row['setting_id'];
|
||||
?>
|
||||
<tr>
|
||||
<td><?php echo $row['site_name'] ; ?></td>
|
||||
<td><?php echo $row['site_title'] ; ?></td>
|
||||
<td><?php echo $row['admin_email'] ; ?></td>
|
||||
<td><?php echo $row['mobile'] ; ?></td>
|
||||
<td><?php echo $row['copyright'] ; ?></td>
|
||||
<td><?php echo $row['logo'] ; ?></td>
|
||||
<td><?php echo $row['favicon'] ; ?></td>
|
||||
<td>
|
||||
<span class="<?php echo $class; ?>"><?php echo $message; ?></span>
|
||||
</td>
|
||||
<td>
|
||||
<ul class="list-inline table-action m-0">
|
||||
<li class="list-inline-item">
|
||||
<a href="<?php echo $edit_page_route; ?>" class="action-icon px-1"> <i class="ri ri-edit-box-fill"></i></a>
|
||||
</li>
|
||||
</ul>
|
||||
</td>
|
||||
|
||||
</tr>
|
||||
<?php endforeach; ?>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div> <!-- end card body-->
|
||||
</div> <!-- end card -->
|
||||
</div><!-- end col-->
|
||||
</div>
|
||||
<!-- end row-->
|
||||
@ -115,8 +115,8 @@
|
||||
|
||||
<!--- Sidemenu -->
|
||||
<div id="sidebar-menu">
|
||||
|
||||
<ul id="side-menu">
|
||||
<?php if ($loggedin_person_role !== 'donor') : ?>
|
||||
<li>
|
||||
<a href="<?= base_url()."dashboard"; ?>">
|
||||
<i class="ri-dashboard-line"></i>
|
||||
@ -124,6 +124,7 @@
|
||||
<span> Dashboard </span>
|
||||
</a>
|
||||
</li>
|
||||
<?php endif; ?>
|
||||
<?php if ($loggedin_person_role !== 'sadmin') : ?>
|
||||
<li>
|
||||
<a href="<?= base_url()."receipt_list"; ?>">
|
||||
@ -172,22 +173,7 @@
|
||||
</a>
|
||||
</li>
|
||||
<?php endif; ?>
|
||||
<!-- <?php if ($loggedin_person_role === 'sadmin' && $loggedin_person_role !== 'accounts') : ?>
|
||||
<li>
|
||||
<a href="<?= base_url()."sitesetting_list"; ?>">
|
||||
<i class="ri-list-settings-line"></i>
|
||||
<span> Org Settings </span>
|
||||
</a>
|
||||
</li>
|
||||
<?php endif; ?>
|
||||
<?php if ($loggedin_person_role === 'sadmin' && $loggedin_person_role !== 'accounts') : ?>
|
||||
<li>
|
||||
<a href="<?= base_url()."appsetting_page"; ?>">
|
||||
<i class="ri-list-settings-line"></i>
|
||||
<span> App Settings </span>
|
||||
</a>
|
||||
</li>
|
||||
<?php endif; ?> -->
|
||||
|
||||
<?php if ($loggedin_person_role !== 'volunteer' && $loggedin_person_role !== 'sadmin' && $loggedin_person_role !== 'accounts') : ?>
|
||||
<li>
|
||||
<a href="<?= base_url()."campaign_list"; ?>">
|
||||
@ -197,38 +183,7 @@
|
||||
</a>
|
||||
</li>
|
||||
<?php endif; ?>
|
||||
<?php if ($loggedin_person_role !== 'volunteer' && $loggedin_person_role !== 'accounts') : ?>
|
||||
<!-- <li>
|
||||
<a href="<?= base_url()."invoice_number_format/1"; ?>">
|
||||
<i class="fe-check-square"></i>
|
||||
<span> Invoice Number Format </span>
|
||||
</a>
|
||||
</li> -->
|
||||
<?php endif; ?>
|
||||
|
||||
<?php if ($loggedin_person_role !== 'volunteer' && $loggedin_person_role !== 'sadmin' && $loggedin_person_role !== 'accounts') : ?>
|
||||
<!-- <li>
|
||||
<a href="#reportLayouts" data-toggle="collapse">
|
||||
<i class="ri-file-chart-fill"></i>
|
||||
<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>
|
||||
</li>
|
||||
<li>
|
||||
<a href="<?= base_url()."mem_inv_rp"; ?>">Membership invoice report</a>
|
||||
</li>
|
||||
<li>
|
||||
<a href="<?= base_url()."itemwise_report"; ?>">Itemwise Report</a>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
</li> -->
|
||||
<?php endif; ?>
|
||||
|
||||
|
||||
<?php if ($loggedin_person_role !== 'volunteer' && $loggedin_person_role !== 'sadmin' && $loggedin_person_role !== 'accounts') : ?>
|
||||
<li>
|
||||
<a href="#notificationsLayouts" data-toggle="collapse">
|
||||
|
||||
@ -20,11 +20,11 @@
|
||||
</div>
|
||||
<div class="form-group col-md-4">
|
||||
<label for="mobile_no" class="col-form-label">Phone Number <span class="text-danger">*</span></label>
|
||||
<input type="text" class="form-control" id="mobile_no" name="mobile_no" placeholder="Phone Number (Enter only numbers)" data-toggle="input-mask" data-mask-format="0000000000" value="<?= isset($details['mobile_no']) ? $details['mobile_no'] : '' ?>" autofocus required onchange="checkExisting(this.value,'mobile_no','mobile_no')">
|
||||
<input type="text" class="form-control" id="mobile_no" name="mobile_no" placeholder="Phone Number (Enter only numbers)" data-toggle="input-mask" data-mask-format="0000000000" value="<?= isset($details['mobile_no']) ? $details['mobile_no'] : '' ?>" autofocus required onchange="checkExisting(this,'mobile_no','mobile_no')">
|
||||
<span id="mobileValidationMessage"></span>
|
||||
</div>
|
||||
<div class="form-group col-md-4">
|
||||
<label for="role" class="col-form-label">Role <span class="text-danger">*</span></label>
|
||||
<label for="role" class="col-form-label" id="role_label">Role <span class="text-danger">*</span></label>
|
||||
<select id="role" name="role" class="form-control" required>
|
||||
<option value="">--Select--</option>
|
||||
<?php $roleArr = array('admin', 'accounts', 'auditor','donor','volunteer');
|
||||
@ -67,7 +67,7 @@
|
||||
<div class="form-row">
|
||||
<div class="form-group col-md-4">
|
||||
<label for="email" class="col-form-label">Email <span class="text-danger">*</span></label>
|
||||
<input type="email" class="form-control" id="email" name="email" placeholder="Email" value="<?= isset($details['email']) ? $details['email'] : '' ?>" required onchange="checkExisting(this.value,'email','email')"/>
|
||||
<input type="email" class="form-control" id="email" name="email" placeholder="Email" value="<?= isset($details['email']) ? $details['email'] : '' ?>" required onchange="checkExisting(this,'email','email')"/>
|
||||
<span id="emailValidationMessage"></span>
|
||||
</div>
|
||||
<?php if (empty($details)) { ?>
|
||||
@ -162,6 +162,14 @@
|
||||
element.setAttribute('disabled', true);
|
||||
});
|
||||
}
|
||||
var flag_for_validations = "<?= isset($dummy_flag) ? $dummy_flag : '' ?>";
|
||||
|
||||
if (flag_for_validations == '1') {
|
||||
$('#branch_label').html('Branch');
|
||||
$('#role_label').html('Role');
|
||||
$('#branch').removeAttr("required").prop('disabled', true);
|
||||
$('#role').removeAttr("required").prop('disabled', true);
|
||||
}
|
||||
});
|
||||
</script>
|
||||
|
||||
@ -292,28 +300,32 @@
|
||||
formGroup.style.display = 'none';
|
||||
}
|
||||
});
|
||||
function checkExisting(inputvalue,fieldname,elementid){
|
||||
function checkExisting(input,databasecolumnname,elementid){
|
||||
spanid = elementid == 'email' ? "emailValidationMessage" : "mobileValidationMessage";
|
||||
var validationMessage = document.getElementById(spanid);
|
||||
var value = input.value.trim();
|
||||
if (value === "") {
|
||||
validationMessage.style.display = 'none';
|
||||
return;
|
||||
}
|
||||
$.ajax({
|
||||
type: "POST",
|
||||
url: "<?= base_url() . 'check_existing' ?>",
|
||||
data: {
|
||||
value: inputvalue,
|
||||
value: value,
|
||||
module: 'users',
|
||||
field: fieldname
|
||||
field: databasecolumnname
|
||||
},
|
||||
success: function(response) {
|
||||
if (response['data']['status']) {
|
||||
validationMessage.textContent = response['data']['message'];
|
||||
validationMessage.style.color = "red";
|
||||
document.getElementById(elementid).value = "";
|
||||
} else {
|
||||
validationMessage.textContent = "";
|
||||
}
|
||||
success: function(response) {
|
||||
console.log("check existing " + elementId + "--" + response['data']['message']);
|
||||
validationMessage.style.display = response['data']['status'] ? 'block' : 'none';
|
||||
validationMessage.innerText = response['data']['message'];
|
||||
validationMessage.style.color = "red";
|
||||
input.setCustomValidity(response['data']['status'] ? response['data']['message'] : '');
|
||||
if (response['data']['status']) input.value = '';
|
||||
},
|
||||
error: function() {
|
||||
alert("Error occur.");
|
||||
error: function(xhr, status, error) {
|
||||
console.error("check existing " + elementId + " -- " + status + ": " + error);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user