Compare commits

..

10 Commits

Author SHA1 Message Date
c46ff81926 FIX_bug Fixes : ps 2024-07-11 06:19:36 +00:00
bf680a0d7c FIX_issues : ps 2024-07-11 04:05:22 +00:00
c19f6ff061 FIX_bugs : ps 2024-07-10 11:17:52 +00:00
5fa3ffbe1d FIX_tracker issues : ps 2024-07-10 03:32:42 +00:00
ec8574993b CHANGE_Bug Fix : ps 2024-06-18 06:37:52 +00:00
e9d1abc26f FIX_Bug : ps 2024-06-07 12:32:22 +00:00
edadba1a41 Change_bug : ps 2024-06-05 06:29:11 +00:00
635c477812 Change_Sample.xlsx : ps 2024-06-05 03:40:03 +00:00
2392cb082a CHANGE_5point : ps 2024-06-01 05:30:03 +00:00
5e16aa99f6 FIX_23rd disscussion : ps 2024-04-25 02:56:51 +00:00
41 changed files with 3246 additions and 603 deletions

2
.gitignore vendored
View File

@ -82,7 +82,7 @@ writable/**/*.sqlite
#-------------------------
# Composer
#-------------------------
!vendor/
vendor
composer.lock
tests

View File

@ -68,6 +68,7 @@ $routes->get("org_list/", "Business::index");
$routes->get("new_org/(:any)", "Business::new_org/$1");
$routes->post("insert_org/", "Business::insert_org");
$routes->get("delete_org/(:any)", "Business::delete_org/$1");
$routes->get("activate_org/(:any)", "Business::activate_org/$1");
#Donor Routes (also known as contributor,customer)
$routes->get("Contributor_list/", "Customer::index");
@ -76,6 +77,8 @@ $routes->get('Customer/getReceiptDetails/(:num)', 'Customer::getReceiptDetails/$
$routes->post("insert_donor", "Customer::insert_donor");
$routes->post("insert_ajaxdonor", "Customer::insert_ajaxdonor");
$routes->get("delete_donor/(:any)", "Customer::delete_donor/$1");
$routes->get("export_Donor", "Customer::export_donor");
$routes->post("import_Donor", "Customer::import_donor");
#Donor group Routes (renamed as contributor group : 20/03/2024)
$routes->get('contributor_group/', 'Customer::donor_group');
@ -103,6 +106,8 @@ $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("export_receipt", "Invoice::export_receipt");
$routes->post("import_receipt", "Invoice::import_receipt");
#Report Routes
$routes->match(['get','post'],'/general_inv_rp','Invoice::general_inv_rp');

View File

@ -85,6 +85,10 @@ abstract class BaseController extends Controller
$mergedData['browser_title']= $mergedData['company_name'] . ' | ' . $mergedData['company_short_name'] . ' ' . $mergedData['page_name'];
$mergedData['heading']= $mergedData['page_name'] === "Dashboard" ? 'Welcome to ' . $mergedData['company_name'] : "";
$reminder = $this->reminderMessage();
if((int)count($reminder['reminder']) > 0){
session()->setFlashdata('reminder', $reminder['reminder']);
}
echo view('template/header.php', $mergedData );
echo view('template/topbar.php', $mergedData);
echo view($viewpage, $mergedData);
@ -161,4 +165,41 @@ abstract class BaseController extends Controller
}
public function reminderMessage(){
helper('session');
$session_bid = get_business_id();
// $reminderMessage = "";
$reminderMessage = [];
// $c = 0; //count
$am = new AuthenticationModel();
$bwhere = ['business_id'=> $session_bid,'isactive'=> 1];
$getreminder = $am->getreminder($bwhere);
$reminderThreshold = 30; // Set the reminder days (e.g., 30 days before expiration)
if (!empty($getreminder['80G_vaildupto'])) {
$expirationDate1 = strtotime($getreminder['80G_vaildupto']);
$daysUntilExpiration1 = ($expirationDate1 - time()) / (60 * 60 * 24);
if ($daysUntilExpiration1 <= $reminderThreshold && $daysUntilExpiration1 >= 0) {
// $reminderMessage .= "Reminder: The 80G registration will expire in " . ceil($daysUntilExpiration1) . " days.";
array_push($reminderMessage, "Reminder: The 80G registration will expire in " . ceil($daysUntilExpiration1) . " days.");
// $c++;
}
}
if (!empty($getreminder['12AA_vaildupto'])) {
$expirationDate2 = strtotime($getreminder['12AA_vaildupto']);
$daysUntilExpiration2 = ($expirationDate2 - time()) / (60 * 60 * 24);
if ($daysUntilExpiration2 <= $reminderThreshold && $daysUntilExpiration2 >= 0) {
// $reminderMessage .= "<br> Reminder: The 12AA registration will expire in " . ceil($daysUntilExpiration2) . " days.";
array_push($reminderMessage, "Reminder: The 12AA registration will expire in " . ceil($daysUntilExpiration2) . " days.");
// $c++;
}
}
return ["reminder"=>$reminderMessage];//,"count"=>$c];
}
}

View File

@ -99,8 +99,9 @@ class Books extends BaseController
} else {
// It's an update operation
$isactive = $this->request->getPost('isactive');
$data['isactive'] = ($isactive == 'on') ? 1 : 0;
// $isactive = $this->request->getPost('isactive');
// $data['isactive'] = ($isactive == 'on') ? 1 : 0;
$data['isactive'] = 1;
$data['updated_by'] = $session_uid;
$BooksModel->update($causes_id, $data);

View File

@ -3,6 +3,7 @@
namespace App\Controllers;
use App\Models\BusinessModel;
use CodeIgniter\Database\Exceptions\DatabaseException;
class Business extends BaseController
{
@ -18,11 +19,11 @@ class Business extends BaseController
$where = ['business_id' => (int)get_business_id(), 'isactive' => 1];
} else {
$this->logger->info("Buiness: Listing In Super-admin role .");
$where = ['isactive !=' => NULL];
$where = ['business_id !=' => 0,'isactive !=' => NULL];
}
$BusinessModel = new BusinessModel();
$data['page_name'] = 'Organization Details';
$data['organzations'] = $BusinessModel->where($where)->where('business_id !=', 0)->where('isactive', 1)->findAll();
$data['organzations'] = $BusinessModel->where($where)->findAll();
// $data['lastQuery'] = $BusinessModel->getLastQuery();
// print_r($data);die;
$this->render_page('business_list', $data);
@ -52,7 +53,7 @@ class Business extends BaseController
$model->setTable('business');
## Fetch business details (particular business)
$edit_organzation_details = $model->where(['business_id ' => $id , 'isactive' => 1])->first();
$edit_organzation_details = $model->where(['business_id ' => $id])->first();
$data['organzations'] = $edit_organzation_details;
## Fetch branch details
@ -69,6 +70,8 @@ class Business extends BaseController
$data['master_organzation_details']=$this->organzation_details();
$data['session_bid']=$session_bid;
$data['country_details'] = $this->get_country_details();
// print_r($data['donation']);die;
$this->render_page('business_form', $data);
}
@ -98,82 +101,99 @@ class Business extends BaseController
helper('session');
$session_uid = get_logged_user_id();
$session_role = get_user_role();
## logo
$img = $this->request->getFile('business_logo');
$filePath = 'public/uploads/' . $this->request->getPost('business_logo');
$fileName = $img->getName();
if ($fileName !== "") {
if ($img->isValid() && !$img->hasMoved()) {
$img->move(ROOTPATH . 'public/uploads', $fileName);
}
}
## favicon
$favicon = $this->request->getFile('favicon');
$faviconFileName = $favicon->getName();
if ($faviconFileName !== "") {
if ($favicon->isValid() && !$favicon->hasMoved()) {
$favicon->move(ROOTPATH . 'public/uploads', $faviconFileName);
}
}
## signature
$sign = $this->request->getFile('signature');
$signFileName = $sign->getName();
if ($signFileName !== "") {
if ($sign->isValid() && !$sign->hasMoved()) {
$sign->move(ROOTPATH . 'public/uploads', $signFileName);
}
}
## Business Data
$panNo = $this->request->getPost('pan_no');
$BusinessModel = new BusinessModel();
$data = [
'title' => $this->request->getPost('bname'),
'email' => $this->request->getPost('bmail'),
'mobile_no' => $this->request->getPost('bmobile'),
'address' => $this->request->getPost('baddress'),
'city' => $this->request->getPost('bcity'),
'state' => $this->request->getPost('bstate'),
'postal_code' => $this->request->getPost('bzip'),
'pan_no' => $this->request->getPost('pan_no'),
'org_reg_no' => $this->request->getPost('org_reg_no'),
'terms' => $this->request->getPost('bterms'),
'80G' => $this->request->getPost('80G'),
'site_name' => $this->request->getPost('site_name'),
'site_title' => $this->request->getPost('site_title'),
'admin_email' => $this->request->getPost('admin_email'),
'site_mobile'=> $this->request->getPost('site_mobile'),
'copyright'=> $this->request->getPost('copyright'),
'currency'=> $this->request->getPost('currency'),
'country'=> $this->request->getPost('country'),
'start_no'=> $this->request->getPost('start_no'),
'left_pad'=> $this->request->getPost('left_pad'),
'prefix_format'=> $this->request->getPost('prefix_format'),
];
$businessId = $this->request->getPost('business_id');
if ($fileName !== "") {
$data['business_logo'] = $fileName;
}
if ($faviconFileName !== "") {
$data['favicon'] = $faviconFileName;
}
if ($signFileName !== "") {
$data['signature'] = $signFileName;
$existingBusiness = $BusinessModel->where('pan_no', $panNo)->first();
if ($existingBusiness && $existingBusiness['business_id'] != $businessId) {
// If it exists and it's not the same record being updated, show an error message
session()->setFlashdata('error', 'The PAN number already exists.');
return redirect()->back()->withInput(); // Redirect back with input data
}
$business_id = $this->request->getPost('business_id'); // Get the business ID for update
try {
## logo
$img = $this->request->getFile('business_logo');
$filePath = 'public/uploads/' . $this->request->getPost('business_logo');
$fileName = $img->getName();
if ($fileName !== "") {
if ($img->isValid() && !$img->hasMoved()) {
$img->move(ROOTPATH . 'public/uploads', $fileName);
}
}
## favicon
$favicon = $this->request->getFile('favicon');
$faviconFileName = $favicon->getName();
if ($faviconFileName !== "") {
if ($favicon->isValid() && !$favicon->hasMoved()) {
$favicon->move(ROOTPATH . 'public/uploads', $faviconFileName);
}
}
## signature
$sign = $this->request->getFile('signature');
$signFileName = $sign->getName();
if ($signFileName !== "") {
if ($sign->isValid() && !$sign->hasMoved()) {
$sign->move(ROOTPATH . 'public/uploads', $signFileName);
}
}
## Business Data
// print_r( $this->request->getPost('currency'));
$data = [
'title' => $this->request->getPost('bname'),
'email' => $this->request->getPost('bmail'),
'mobile_no' => $this->request->getPost('bmobile'),
'address' => $this->request->getPost('baddress'),
'city' => $this->request->getPost('bcity'),
'state' => $this->request->getPost('bstate'),
'postal_code' => $this->request->getPost('bzip'),
'pan_no' => $this->request->getPost('pan_no'),
'org_reg_no' => $this->request->getPost('org_reg_no'),
'terms' => $this->request->getPost('bterms'),
'80G' => $this->request->getPost('80G'),
'12AA' => $this->request->getPost('12AA'),
'80G_vaildupto' => $this->request->getPost('80G_vaildupto'),
'12AA_vaildupto' => $this->request->getPost('12AA_vaildupto'),
'site_name' => $this->request->getPost('site_name'),
'site_title' => $this->request->getPost('site_title'),
'admin_email' => $this->request->getPost('admin_email'),
'site_mobile'=> $this->request->getPost('site_mobile'),
'copyright'=> $this->request->getPost('copyright'),
'currency'=> serialize($this->request->getPost('currency')),
'country'=> $this->request->getPost('country'),
'start_no'=> $this->request->getPost('start_no'),
'left_pad'=> $this->request->getPost('left_pad'),
'prefix_format'=> $this->request->getPost('prefix_format'),
];
if ($fileName !== "") {
$data['business_logo'] = $fileName;
}
if ($faviconFileName !== "") {
$data['favicon'] = $faviconFileName;
}
if ($signFileName !== "") {
$data['signature'] = $signFileName;
}
$business_id = $this->request->getPost('business_id'); // Get the business ID for update
// print_r($data);die;
if (empty($business_id)) {
// It's an insert operation
$data['created_by'] = $session_uid;
$businessId = $BusinessModel->insert($data);
session()->setFlashdata('success', 'Organization details have been updated successfully.');
} else {
// It's an update operation
$businessId = $business_id;
$data['updated_by'] = $session_uid;
$BusinessModel->update($business_id, $data);
session()->setFlashdata('success', 'Organization details have been updated successfully.');
}
## Donation Business Data (Note: not a super-admin means just updated only)
@ -192,12 +212,14 @@ class Business extends BaseController
}
if ($session_role === 'sadmin') {
session()->setFlashdata('success', 'organization details has been updated successfully.');
return redirect()->route('org_list');
}else{
session()->setFlashdata('success', 'organization details has been updated successfully.');
} else {
return redirect()->to(base_url("new_org/{$business_id}"));
}
} catch (DatabaseException $e) {
session()->setFlashdata('error', $e->getMessage());
return redirect()->back()->withInput(); // Redirect back with input data
}
}
public function save_business_branch($requestData, $bid)
@ -228,7 +250,6 @@ class Business extends BaseController
if (!empty($missingValues)) {
$where = ['isactive' => 1, 'business_id'=>$bid];
$model->inactiveMissingBuinessBranchDetails($where, $missingValues);
echo
$this->logger->info("BuinessBranch: Inactived Missing Count = " . count($missingValues)." That Primary ID = ".implode(",",$BBprimaryid));
}
}
@ -286,6 +307,17 @@ class Business extends BaseController
return redirect()->route('org_list');
}
public function activate_org($id){
helper('session');
$session_uid = get_logged_user_id();
$BusinessModel = new BusinessModel();
$data['isactive'] = 1;
$data['updated_by'] = $session_uid;
$BusinessModel->update($id, $data);
return redirect()->route('org_list');
}
public function insertDonationBusiness($businessId)
{
$db = \Config\Database::connect();
@ -303,4 +335,12 @@ class Business extends BaseController
$db->table('donation_business')->insertBatch($donationData);
}
}
public function get_country_details()
{
$model = new BusinessModel();
$model->setTable('countries');
$country_details = $model->orderBy('country_id', 'ASC')->findAll();
return $country_details;
}
}

View File

@ -5,6 +5,14 @@ namespace App\Controllers;
use App\Models\CustomerModel;
use App\Models\SubscriptionModel;
use PhpOffice\PhpSpreadsheet\Spreadsheet;
use PhpOffice\PhpSpreadsheet\Writer\Xlsx;
use PhpOffice\PhpSpreadsheet\Reader\Csv as ReaderCsv;
use PhpOffice\PhpSpreadsheet\Reader\Xlsx as ReaderXlsx;
use PhpOffice\PhpSpreadsheet\Cell\DataType;
use PhpOffice\PhpSpreadsheet\Style\NumberFormat;
use CodeIgniter\Database\Exceptions\DatabaseException;
class Customer extends BaseController
{
@ -85,7 +93,14 @@ class Customer extends BaseController
$session_bid = get_business_id();
$pan = ($this->request->getPost('pan_no') == '') ? $this->request->getPost('o_pan_no') : $this->request->getPost('pan_no');
$existingDonor = $model->where('pan_no', $pan)->first();
if ($existingDonor) {
$results = ['status' => false, 'message' => 'The PAN number already exists.','donor_id' => ''];
return $this->response->setJSON(['data' => $results]);
}
try {
$data = [
'first_name' => $this->request->getPost('cfname'),
'mobile_no' => $this->request->getPost('mobile'),
@ -107,7 +122,11 @@ class Customer extends BaseController
$donor_where = ['business_id' => (int)get_business_id() , 'isactive' => 1, 'donor_type'=>$this->request->getPost('DonorType')];
$results['donor'] = $model->getData('donor', $donor_where);
return $this->response->setJSON(['data' => $results]);
return $this->response->setJSON(['data' => $results]);
} catch (DatabaseException $e) {
$results = ['status' => false, 'message' => 'could not be added DB Error Occur','donor_id' => '','error'=>$e->getMessage()];
return $this->response->setJSON(['data' => $results]);
}
}
public function insert_donor()
{
@ -131,7 +150,7 @@ class Customer extends BaseController
'date_of_birth' => $dob,
'pan_no' => $pan,
'adhar_no' => $this->request->getPost('adhar_no'),
'passport_no' => $this->request->getPost('DonorType') == 'individual' && $this->request->getPost('passport_no') ? $this->request->getPost('passport_no') : null,
'donor_type' => $this->request->getPost('DonorType'),
'org_name' => $this->request->getPost('org_name') !== '' || $this->request->getPost('org_name') !== null ? $this->request->getPost('org_name') : NULL,
'org_reg_details'=> $this->request->getPost('org_reg_Details'),
@ -510,16 +529,236 @@ class Customer extends BaseController
}
return redirect()->route('donor_group');
}
// Example in your controller
public function getReceiptDetails($donorId)
{
$CustomerModel = new CustomerModel();
// Fetch receipt details from the model based on $donorId
$receiptDetails = $CustomerModel->getReceiptDetailsByDonorId($donorId);
// Return the details as JSON
return $this->response->setJSON($receiptDetails);
}
public function getReceiptDetails($donorId)
{
$CustomerModel = new CustomerModel();
$receiptDetails = $CustomerModel->getReceiptDetailsByDonorId($donorId);
return $this->response->setJSON($receiptDetails);
}
public function export_donor()
{
helper('session');
$session_bid = get_business_id();
$CustomerModel = new CustomerModel();
$data = $CustomerModel->export_excel($session_bid);
$spreadsheet = new Spreadsheet();
$sheet = $spreadsheet->getActiveSheet();
$sheet->mergeCells('B3:P3');
$sheet->getStyle('B3')->getAlignment()->setHorizontal('center');
$sheet->setTitle('Contributor details');
$headers = [
'B3' => 'Contributor Details',
'A5' => 'Contributor Name',
'B5' => 'Contributor Type',
'C5' => 'Organization Name',
'D5' => 'Organization Reg Details',
'E5' => 'Contact Number',
'F5' => 'Email Address',
'G5' => 'PAN',
'H5' => 'Aadhaar Number',
'I5' => 'Passport Number',
'J5' => 'Address',
'K5' => 'Country',
'L5' => 'State',
'M5' => 'City',
'N5' => 'Postal Code',
'O5' => 'CreatedBy',
'P5' => 'UpdatedBy',
'Q5' => 'CreatedAt',
'R5' => 'UpdatedAt',
'S5' => 'IsActive'
];
foreach ($headers as $cell => $value) {
$sheet->setCellValue($cell, $value);
$sheet->getStyle($cell)->getFont()->setSize($cell == 'B3' ? 14 : 12);
$sheet->getStyle($cell)->getFont()->setBold(true);
}
if ($data) {
$row = 6;
foreach ($data as $d) {
$col = 'A'; // Start from column A
foreach ($d as $value) {
if (is_numeric($value)) {
$sheet->setCellValueExplicit($col . $row, $value, DataType::TYPE_STRING);
$sheet->getStyle($col . $row)->getNumberFormat()->setFormatCode(NumberFormat::FORMAT_NUMBER);
} else {
$sheet->setCellValue($col . $row, $value);
}
$sheet->setCellValue($col . $row, $value);
$col++;
}
$row++;
}
}
ob_clean();
$writer = new Xlsx($spreadsheet);
$filename = 'exportDonor.xlsx';
header('Content-Type: application/vnd.openxmlformats-officedocument.spreadsheetml.sheet');
header('Content-Disposition: attachment;filename="'. $filename .'"');
header('Cache-Control: max-age=0');
header('Expires: 0');
header('Pragma: public');
$writer->save('php://output');
exit;
}
public function import_donor()
{
$ip_address = $_SERVER['REMOTE_ADDR'];
helper('session');
$session_uid = get_logged_user_id();
$session_bid = get_business_id();
$response = []; // Arr - response For Message FrontEnd
$list = []; // Arr - Store on DB
$path = ROOTPATH . 'public/import/donor/';
$fileNewName = "";
$file = $this->request->getFile('file');
if (!is_dir($path)) {
mkdir($path, 0777, true);
}
$fileName = $file->getName();
if ($fileName !== "") {
if ($file->isValid() && !$file->hasMoved()) {
$newName = $file->getRandomName();
$file->move($path, $newName);
$fileNewName = $newName;
}
}
if (!$fileNewName) {
$response = ['error_message' => "Failed to upload file"];
return $this->response->setJSON($response);
}
$arr_file = explode('.', $fileName);
$extension = $arr_file[1];
if ('csv' == $extension) {
$reader = new ReaderCsv();
} else if ('xlsx' == $extension) {
$reader = new ReaderXlsx();
} else {
$response = ['error_message' => "Unsupported file type"];
return $this->response->setJSON($response);
}
if (!$reader) {
$response = ['error_message' => "Failed to initialize reader"];
return $this->response->setJSON($response);
}
$spreadsheet = $reader->load($path.$fileNewName);
$sheet_data = $spreadsheet->getActiveSheet()->toArray();
if (!empty($sheet_data)) {
$final_notes = [];
$list = [];
foreach ($sheet_data as $key => $val) {
if ($key != 0 && trim($val[0]) && trim($val[1])) { // key zero - header
// $flag = 0;
$is_duplicate = false;
$notes = [];
$invalid_fields = [];
if($val[6] != ""){
if ($this->check_existing($val[6], 'donor', 'pan_no')) {
$is_duplicate = true;
$invalid_fields[] = "PAN number";
}
}
if($val[7] != ""){
if ($this->check_existing($val[7], 'donor', 'adhar_no')) {
$is_duplicate = true;
$invalid_fields[] = "Aadhar number";
}
}
if($val[8] != ""){
if ($this->check_existing($val[8], 'donor', 'passport_no')) {
$is_duplicate = true;
$invalid_fields[] = "passport number";
}
}
if ($is_duplicate) {
$notes[] = $val[0] . " is invalid because " . implode(" and ", $invalid_fields) . " (already exists)";
}
if ($is_duplicate) {
$final_notes = array_merge($final_notes, $notes);
} else {
$list[] = [
'business_id' => $session_bid,
'first_name' => $val[0],
'donor_type' => strtolower($val[1]),
'org_name' => $val[2] ? $val[2] : null,
'org_reg_details' => $val[3] ? $val[3] : null,
'mobile_no' => $val[4] ? $val[4] : null,
'email' => $val[5],
'pan_no' => $val[6],
'adhar_no' => $val[7] ? $val[7] : null,
'passport_no' => $val[8] ? $val[8] : null,
'address' => $val[9] ? $val[9] : null,
'country' => $val[10] ? $val[10] : null,
'state' => $val[11] ? $val[11] : null,
'city' => $val[12] ? $val[12] : null,
'postal_code' => $val[13] ? $val[13] : null,
'created_by' => $session_uid,
'XL_file_name' => $fileNewName,
'ip_address' => $ip_address
];
}
}
}
if (count($list) > 0) {
$CustomerModel = new CustomerModel();
$result = $CustomerModel->bulkInsert($list);
$response = $result ? [
'success_message' => count($list) . " Contributors imported successfully.".(count($final_notes) > 0 ? count($final_notes) . " duplicate entries found. <br>" : ""),
] : ['error_message' => "Something went wrong. Please try again."];
$response['message_in_details'] = implode(" <br> ", $final_notes);
} else {
$response = [
'error_message' => "No new record is found.",
'message_in_details' => implode(" <br> ", $final_notes),
]; }
} else {
$response = ['error_message' => "There is no record to import", 'message_in_details' => ''];
}
return $this->response->setJSON($response);
}
public function check_existing($value, $table, $field) {
$model = new CustomerModel();
$model->setTable($table);
$where = [$field => $value];
$check_existing = $model->where($where)->findAll();
$statement_string = ucfirst(str_replace('_', ' ', $field));
$notes = '';
if (!empty($check_existing)) {
$notes = $statement_string . " already exists";
}
return $notes;
}
}

View File

@ -7,6 +7,32 @@ use App\Models\HomeModel;
class Home extends BaseController
{
public function index()
{
helper('session');
$session_role = get_user_role();
if (!empty($session_role)) {
switch ($session_role) {
case 'admin':
case 'auditor':
$this->dashboard();
break;
case 'accounts':
$this->dashboard_accounts();
break;
case 'volunteer':
$this->dashboard_volunteers();
break;
default:
$data['page_name'] = 'Dashboard';
$this->render_page('dashboard', $data);
}
}
}
//Default Dashboard..
public function dashboard()
{
// echo "hwllo"
helper('session');
@ -33,7 +59,6 @@ class Home extends BaseController
$where['users.branch_id'] = $branch_id;
}
break;
case 'donor':
case 'volunteer':
if ($branch_id) {
$where['users.branch_id'] = $branch_id;
@ -42,7 +67,7 @@ class Home extends BaseController
break;
}
}
$data['donordetails'] = $model->donordetails($where);
$data['donordetails']['label'] = "donors";
@ -51,6 +76,36 @@ class Home extends BaseController
}
public function dashboard_accounts()
{
helper('session');
$session_bid = get_business_id();
$model = new HomeModel();
$where = ['users.business_id' => $session_bid];
$data = $model->dashboard_account($where);
$data['page_name'] = 'Dashboard';
// $this->render_page('dashboard', $data);
$this->render_page('dashboard_accounts', $data);
}
public function dashboard_volunteers()
{
helper('session');
$session_bid = get_business_id();
$session_uid = get_logged_user_id();
$model = new HomeModel();
$bwhere = ['user_id'=> $session_uid,'users.business_id'=> $session_bid,'users.isactive'=> 1];
$branch_id = $model->getbranchid($bwhere);
$data = $model->dashboard_volunteer($bwhere);
$data['page_name'] = 'Dashboard';
$this->render_page('dashboard', $data);
}
## Dynamic Validation For Existing Check AJAX Call
# USED in 1) User Module
# 2) Recepit-DonorQuickAdd Module

View File

@ -15,6 +15,13 @@ use Mpdf\Mpdf;
use Dompdf\Dompdf;
use Dompdf\Options;
use PhpOffice\PhpSpreadsheet\Spreadsheet;
use PhpOffice\PhpSpreadsheet\Writer\Xlsx;
use PhpOffice\PhpSpreadsheet\Reader\Csv as ReaderCsv;
use PhpOffice\PhpSpreadsheet\Reader\Xlsx as ReaderXlsx;
use PhpOffice\PhpSpreadsheet\Cell\DataType;
use PhpOffice\PhpSpreadsheet\Style\NumberFormat;
class Invoice extends BaseController
{
@ -108,7 +115,7 @@ class Invoice extends BaseController
$upt_data = $model->updateData('donations_accepted', $data, $where);
}
}
session()->setFlashdata('success', 'Data has been added successfully.');
session()->setFlashdata('success', 'Recepit Updated Successfully.');
return redirect()->route('donations_accepted');
}
catch (\Throwable $e)
@ -140,9 +147,13 @@ class Invoice extends BaseController
// Get customer names for the dropdown, events details, and books details
$data['currency'] = $this->BusinessModel->select('currency')->where($where)->findAll();
$data['currency_code'] = $this->BusinessModel->select('currency')->where($where)->first()['currency'] ?? null;
$query = $this->BusinessModel->select('currency')->where($where)->first();
$data['currencies'] = unserialize($query['currency']);
$data['causes'] = $bmodel->select('*')->where('business_id', (int)get_business_id())->where('isactive',1)->get()->getResult();
$data['campaign'] = $model->getData('campaign', $where);
$data['invoice_number_formatting'] = $model->getData('business', $where);
$data['receipt_type'] = "individual";
if ($id === '0') {
@ -165,7 +176,7 @@ class Invoice extends BaseController
$cus_where = ['business_id' => (int)get_business_id() , 'isactive' => 1, 'donor_type'=>$data['receipt_type']];
$data['typebaseddonors'] = $model->getData('donor', $cus_where);
$data['alldonors'] = $model->getData('donor', ['business_id' => (int)get_business_id() , 'isactive' => 1]);
// print_r($data);die;
$this->render_page('invoice_form', $data);
}
@ -201,7 +212,7 @@ class Invoice extends BaseController
$this->AuditHistoryModel->save($audit_data);
/************************************* */
if($upt_data){ session()->setFlashdata('success', 'Data has been accepted successfully.');echo true; }
if($upt_data){ session()->setFlashdata('success', 'Recepit has been accepted successfully.');echo true; }
else echo false;
}
@ -234,7 +245,7 @@ class Invoice extends BaseController
];
$this->AuditHistoryModel->save($audit_data);
/************************************* */
session()->setFlashdata('success', 'Data has been rejected successfully.');
session()->setFlashdata('success', 'Recepit has been rejected successfully.');
return redirect()->route('receipt_list');
}
@ -267,6 +278,7 @@ class Invoice extends BaseController
'business_id' => (int)get_business_id(),
'isactive' => 1
];
// print_r($data);die;
## Based on the invoice ID, we designated Insert or Update on Details...
if (empty($receipt_id)) {
$data['created_by'] = (int)get_logged_user_id();
@ -286,6 +298,7 @@ class Invoice extends BaseController
'updated_by' => (int)get_logged_user_id()
];
$this->AuditHistoryModel->save($audit_data);
/************************************* */
session()->setFlashdata('success', 'Receipt has been added successfully.');
$this->logger->info("Receipt: has been added successfully. Inserted ID = " . $receipt_id);
@ -341,7 +354,6 @@ class Invoice extends BaseController
$donordata = $model->getData('donor', $where);
// generate recipt
$html = $this->generate_invoice_pdf($receipt_id, 'mail');
// echo $html;die;
// send mail
$notification = new NotificationHelper();
if($donordata[0]->email != null || $donordata[0]->email != '')
@ -508,23 +520,23 @@ class Invoice extends BaseController
$where = ['business_id' => (int)get_business_id()];
$currency_data = $model->setTable('business')->select('currency')->where($where)->findAll();
$terms_data = $this->BusinessModel->select('terms,signature')->where($where)->findAll();
$terms_data = $this->BusinessModel->select('terms,signature,80G as eightyG ,12AA as twelveAA,80G_vaildupto as eightyGVaildUpto,12AA_vaildupto as twelveAAVaildUpto')->where($where)->findAll();
$data = $model->getInvoiceData($id);
// print_r($data);die;
// Check if data is empty
if (!$data || !$currency_data) {
throw new \Exception('Data not found or empty');
}
$options = new Options();
$options->set('defaultFont', 'DejaVu Sans');
$options->set('isHtml5ParserEnabled', true);
$options->set('isFontSubsettingEnabled', true);
$options->set('isPhpEnabled', true);
$options->set('isRemoteEnabled', true);
$options->set('font_subsetting', true);
$options->set('tempDir', sys_get_temp_dir());
$options->set('defaultFont', 'DejaVuSans');
$options->set('chroot', base_url()."public/uploads");
//$options->set('chroot', base_url()."public/uploads");
$options->set('chroot', FCPATH . 'public/uploads');
$dompdf = new Dompdf($options);
@ -533,14 +545,9 @@ class Invoice extends BaseController
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;
} else {
// echo "Inside: Logo does not exist<br>"; die;
$baseurl = base_url()."public/uploads/default.png";
}
$logoPath = FCPATH . "public/uploads/" . $data[0]->business_logo;
$baseurl = $data[0]->business_logo && file_exists($logoPath) ? base_url("public/uploads/" . $data[0]->business_logo) : 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', [
@ -550,13 +557,20 @@ class Invoice extends BaseController
'baseurl' => $baseurl,
'signature' => $data[0]->signature,
'staff_name' => $user[0]['first_name'] . ' ' .$user[0]['last_name'],
'Notes' => $terms_data[0]['terms']
'Notes' => $terms_data[0]['terms'],
'eightyG' => $terms_data[0]['eightyG'],
'eightyGVaildUpto' => $terms_data[0]['eightyGVaildUpto'],
'twelveAA' => $terms_data[0]['twelveAA'],
'twelveAAVaildUpto' => $terms_data[0]['twelveAAVaildUpto'],
]);
// echo $html;die;
//echo $html;die;
$dompdf->loadHtml($html);
$dompdf->setPaper('letter', 'landscape');
// $dompdf->setPaper('letter', 'landscape');
$dompdf->setPaper('A5', 'landscape');
$dompdf->render();
if($dest == 'mail') {
@ -580,6 +594,11 @@ class Invoice extends BaseController
// Handle the exception
// For example, log the error, display a user-friendly message, or return an error response
echo 'Error: ' . $e->getMessage();
log_message('error', sprintf(
"Exception caught: [message: %s] [code: %d] [file: %s] [line: %d]",
$e->getMessage(), $e->getCode(),$e->getFile(),$e->getLine()
));
log_message('error', $e->getTraceAsString());
}
}
@ -678,6 +697,239 @@ class Invoice extends BaseController
return $this->response->setJSON(['data' => $data]);
}
public function export_receipt(){
helper('session');
$session_bid = (int)get_business_id();
$model = new InvoiceModel();
$where = ['business_id' => $session_bid];
$receipt = $model->where($where)->findAll();
$alldonors = $model->getData('donor', ['business_id' => $session_bid , 'isactive' => 1]);
$export = [];
if(!empty($receipt)){
foreach ($receipt as $key => $value) {
$export[$key]['receipt_number'] = $receipt[$key]['receipt_number'] ;
$export[$key]['receipt_date'] = (isset($receipt[$key]['receipt_date']) && !empty($receipt[$key]['receipt_date']) && strtotime($receipt[$key]['receipt_date']) !== false)
? date("d-m-Y", strtotime($receipt[$key]['receipt_date']))
: '-';
$export[$key]['receipt_type'] = $receipt[$key]['receipt_type'];
$export[$key]['donor'] = '';
foreach ($alldonors as $DonorData) {
if ($receipt[$key]['donor_id'] === $DonorData->donor_id) {
$suffix = "";
if ($receipt[$key]['receipt_type'] == "organization" && !empty($DonorData->org_name)) {
$suffix = !empty($DonorData->org_name) ? " (" . $DonorData->org_name . ")" : " (-)";
}
$export[$key]['donor'] = $DonorData->first_name . ' ' . $DonorData->last_name . $suffix;
break;
}
}
$currencySymbol = '';
switch (strtoupper($receipt[$key]['currency'])) {
case 'RS':
case 'INR': $currencySymbol = '₹'; break;
case 'USD': $currencySymbol = '$'; break;
case 'EUR': $currencySymbol = '€'; break;
default: $currencySymbol = ''; break;
}
$export[$key]['amount'] = $currencySymbol . ' ' . $receipt[$key]['amount'];
$paymentMode = '';
switch (strtoupper($receipt[$key]['payment_mode'])) {
case 'DEBIT': $paymentMode = 'Debit Card'; break;
case 'CREDIT': $paymentMode = 'Credit Card'; break;
case 'CASH': $paymentMode = 'Cash'; break;
case 'UPI': $paymentMode = 'UPI'; break;
default: $paymentMode = $receipt[$key]['payment_mode']; break;
}
$status = '';
switch (strtoupper($receipt[$key]['receipt_header'])) {
case 'TEMPORARY RECEIPT ': $status = 'Draft'; break;
case 'RECEIPT': $status = 'Completed'; break;
case 'REJECTED': $status = 'Rejected'; break;
default: $status = $receipt[$key]['receipt_header']; break;
}
$export[$key]['status'] = $status;
$export[$key]['payment_mode'] = $paymentMode;
$export[$key]['payment_ref_no'] = $receipt[$key]['payment_ref_no'];
$export[$key]['notes'] = $receipt[$key]['notes'] == null ? '-' : $receipt[$key]['notes'];
$export[$key]['reason'] = ($receipt[$key]['reason'] == null) ? '-' :$receipt[$key]['reason'];
$export[$key]['created_by'] = $this->UserModel->where('user_id', $receipt[$key]['created_by'])->get()->getRow()->first_name;// 2
$export[$key]['updated_by'] = (isset($receipt[$key]['updated_by']) && !empty($receipt[$key]['updated_by']) && $receipt[$key]['updated_by'] !== null)
? $this->UserModel->where('user_id', $receipt[$key]['updated_by'])->get()->getRow()->first_name
: '-';// 2
$export[$key]['created_on'] = (isset($receipt[$key]['created_on']) && !empty($receipt[$key]['created_on']) && strtotime($receipt[$key]['created_on']) !== false)
? date("d-m-Y", strtotime($receipt[$key]['created_on']))
: '-';
$export[$key]['updated_on'] = (isset($receipt[$key]['updated_on']) && !empty($receipt[$key]['updated_on']) && strtotime($receipt[$key]['updated_on']) !== false)
? date("d-m-Y", strtotime($receipt[$key]['updated_on']))
: '-';
$export[$key]['isactive'] = (int)$receipt[$key]['isactive'] == 1 ? 'Active' : 'Inactive';
}
}
$this->fetch_receipt($export);
}
public function fetch_receipt($export){
$spreadsheet = new Spreadsheet(); // instantiate Spreadsheet
$sheet = $spreadsheet->getActiveSheet();
$sheet->mergeCells('B3:R3');
$sheet->getStyle('B3')->getAlignment()->setHorizontal('center');
$sheet->setTitle('Receipt details');
$headers = [
'B3' => 'Receipt Details',
'A5' => 'Receipt Number',
'B5' => 'Receipt Date',
'C5' => 'Receipt Type',
'D5' => 'Contributor Name',
'E5' => 'Amount',
'F5' => 'Status',
'G5' => 'Payment Mode',
'H5' => 'Payment Ref no',
'I5' => 'Notes',
'J5' => 'Reason',
'K5' => 'CreatedBy',
'L5' => 'UpdatedBy',
'M5' => 'CreatedAt',
'N5' => 'UpdatedAt',
'O5' => 'IsActive'
];
foreach ($headers as $cell => $value) {
$sheet->setCellValue($cell, $value);
$sheet->getStyle($cell)->getFont()->setSize($cell == 'B3' ? 14 : 12);
$sheet->getStyle($cell)->getFont()->setBold(true);
}
if($export){
$row = 6; // Start from row 6
foreach ($export as $d) {
$col = 'A'; // Start from column A
foreach ($d as $value) {
if (is_numeric($value)) {
$sheet->setCellValueExplicit($col . $row, $value, DataType::TYPE_STRING);
$sheet->getStyle($col . $row)->getNumberFormat()->setFormatCode(NumberFormat::FORMAT_NUMBER);
} else {
$sheet->setCellValue($col . $row, $value);
}
$sheet->setCellValue($col . $row, $value);
$col++;
}
$row++;
}
}
// Clear the output buffer to prevent any other output
ob_clean();
$writer = new Xlsx($spreadsheet);
$filename = 'exportReceipt.xlsx';
header('Content-Type: application/vnd.openxmlformats-officedocument.spreadsheetml.sheet');
header('Content-Disposition: attachment;filename="'. $filename .'"');
header('Cache-Control: max-age=0');
header('Expires: 0');
header('Pragma: public');
$writer->save('php://output');
exit;
}
public function import_receipt()
{
$ip_address = $_SERVER['REMOTE_ADDR'];
$InvoiceModel = new InvoiceModel();
helper('session');
$session_uid = get_logged_user_id();
$session_bid = get_business_id();
$json = []; // Arr - Json For Message FrontEnd
$list = []; // Arr - Store on DB
$path = ROOTPATH . 'public/import/receipt/';
$fileNewName = "";
$file = $this->request->getFile('file');
if (!is_dir($path)) {
mkdir($path, 0777, true);
}
$fileName = $file->getName();
if ($fileName !== "") {
if ($file->isValid() && !$file->hasMoved()) {
$newName = $file->getRandomName();
$file->move($path, $newName);
$fileNewName = $newName;
}
}
if (!$fileNewName) {
$json = ['error_message' => "Failed to upload file"];
return $this->response->setJSON($json);
}
$arr_file = explode('.', $fileName);
$extension = $arr_file[1];
if ('csv' == $extension) {
$reader = new ReaderCsv();
} else if ('xlsx' == $extension) {
$reader = new ReaderXlsx();
} else {
$json = ['error_message' => "Unsupported file type"];
return $this->response->setJSON($json);
}
if (!$reader) {
$json = ['error_message' => "Failed to initialize reader"];
return $this->response->setJSON($json);
}
$spreadsheet = $reader->load($path.$fileNewName);
$sheet_data = $spreadsheet->getActiveSheet()->toArray();
if(!empty($sheet_data)){
foreach ($sheet_data as $key => $val) {
if ($key != 0) { // key zero - header
$list[] = [
'business_id' => $session_bid,
'first_name' => $val[0],
'donor_type' => $val[1],
'org_name' => $val[2] ? $val[2] : null ,
'org_reg_details' => $val[3] ? $val[3] : null,
'mobile_no' => $val[4] ? $val[4] : null,
'email' => $val[5],
'pan_no' => $val[6],
'adhar_no' => $val[7],
'passport_no' => $val[8] ? $val[8] : null ,
'address' => $val[9],
'country' => $val[10],
'state' => $val[11],
'city' => $val[12],
'postal_code' => $val[13],
'created_by' => $session_uid,
'XL_file_name' => $fileNewName,
'ip_address' => $ip_address
];
}
}
}else{
$json = ['error_message' => "There is no record to import"];
return $this->response->setJSON($json);
}
if (count($list) > 0) {
$result = $InvoiceModel->bulkInsert($list);
($result) ? ['success_message' => "All Entries are imported successfully."]
: ['error_message' => "Something went wrong. Please try again."];
} else {
$json = ['error_message' => "No new record is found."];
}
return $this->response->setJSON($json);
}
}

View File

@ -195,9 +195,10 @@ class Notifications extends BaseController
public function template_creation()
{
$session_bid = get_business_id();
$data['page_name'] = 'Template Details';
$model = new NotificationModel();
$data['template'] = $model->getTemplateDetails();
$data['template'] = $model->getTemplateDetails($session_bid);
$this->render_page('template_creation', $data);
// echo "templates";die;
}
@ -330,10 +331,10 @@ class Notifications extends BaseController
//Campaign Creation
public function campaign_creation()
{
{ $session_bid = get_business_id();
$data['page_name'] = 'Campaign Details';
$model = new NotificationModel();
$data['campaign'] = $model->getCampaignDetails();
$data['campaign'] = $model->getCampaignDetails($session_bid);
$this->render_page('campaign_creation', $data);
// echo "templates";die;
}

View File

@ -4,6 +4,7 @@ namespace App\Controllers;
use App\Models\UsersModel;
use App\Models\BusinessModel;
use CodeIgniter\Database\Exceptions\DatabaseException;
class Users extends BaseController
{
@ -145,6 +146,7 @@ class Users extends BaseController
{
$model = new BusinessModel();
$model->setTable('business');
$organzation_details = $model->orderBy('business_id', 'DESC')->findAll();
// Fetch branches for all organizations

View File

@ -30,5 +30,17 @@ class AuthenticationModel extends Model
return $query->getResultArray();
}
public function getreminder($bwhere){
$query = $this->db->table('business');
$result = $query->where($bwhere)->get()->getResultArray();
if (count($result) > 0) {
$reminder = $result[0];
} else {
$reminder = [];
}
return $reminder;
}
}

View File

@ -9,7 +9,7 @@ class BusinessModel extends Model
{
protected $table = 'business';
protected $primaryKey = 'business_id';
protected $allowedFields = ['business_id','title','email','mobile_no','terms','address','city','state','postal_code' ,'business_logo','isactive', 'pan_no', 'org_reg_no', '80G', 'signature','favicon','start_no','left_pad','prefix_format','site_name','site_title','site_mobile','site_info','admin_email','terms_service','footer_about','copyright','pagination_limit','about_info','currency'];
protected $allowedFields = ['business_id','title','email','mobile_no','terms','address','city','state','postal_code' ,'business_logo','isactive', 'pan_no', 'org_reg_no', '80G', 'signature','favicon','start_no','left_pad','prefix_format','site_name','site_title','site_mobile','site_info','admin_email','terms_service','footer_about','copyright','pagination_limit','about_info','country','currency','12AA','80G_vaildupto','12AA_vaildupto'];
public function insertBusiness($data)
{

View File

@ -10,7 +10,7 @@ class CustomerModel extends Model
protected $table = 'donor';
protected $primaryKey = 'donor_id ';
// protected $allowedFields = ['donor_id ','first_name','city','last_name','email','mobile_no','country','state','postal_code' ,'address','profile_picture','date_of_birth','gender','mode','isactive','business_id'];
protected $allowedFields = ['donor_id ','first_name','city','last_name','email','mobile_no','country','state','postal_code' ,'address','org_name','date_of_birth','pan_no','adhar_no','org_reg_details','donor_type','isactive','business_id','created_by','updated_by'];
protected $allowedFields = ['donor_id ','first_name','city','last_name','email','mobile_no','country','state','postal_code' ,'address','org_name','date_of_birth','pan_no','adhar_no','org_reg_details','donor_type','isactive','business_id','created_by','updated_by','XL_file_name','ip_address','passport_no'];
public function insertCustomer($data)
{
@ -81,7 +81,27 @@ public function getData($table, $where = null)
return $query->get()->getResult();
}
function export_excel($business_id)
{
$builder = $this->db->table('donor')
->select('CONCAT_WS(" ", donor.first_name, donor.last_name) AS full_name')
->select('donor.donor_type,donor.org_name,donor.org_reg_details,donor.mobile_no,donor.email,donor.pan_no,donor.adhar_no,donor.passport_no,donor.address,donor.country,donor.state,donor.city,donor.postal_code')
->select('CONCAT_WS(" ", creator.first_name, creator.last_name) AS creator_name')
->select('CONCAT_WS(" ", updater.first_name, updater.last_name) AS updater_name')
->select('IFNULL(DATE_FORMAT(donor.created_on, "%d-%m-%Y"), "-") AS formatted_created_on')
->select('IFNULL(DATE_FORMAT(donor.updated_on, "%d-%m-%Y"), "-") AS formatted_updated_on')
->select('CASE WHEN donor.isactive = 1 THEN "Active" ELSE "Inactive" END AS active_status', false)
->join('users as creator', ' donor.created_by = creator.user_id', 'left')
->join('users as updater', ' donor.updated_by = updater.user_id', 'left')
->where('donor.business_id', $business_id);
$query = $builder->get();
return $query->getResultArray();
}
public function bulkInsert($data) {
return $this->db->table('donor')->insertBatch($data);
}
}
?>

View File

@ -6,8 +6,7 @@ class HomeModel extends Model
public function donordetails($where) {
$totalDonors = $this->db->table('donor')
->where($where)->countAll();
$totalDonors = $this->db->table('donor')->where($where)->countAllResults();
$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')
@ -36,5 +35,87 @@ class HomeModel extends Model
$result = $query->select('branch_id')->where($bwhere)->get()->getRow();
return $result ? (int)$result->branch_id : 0;
}
public function dashboard_account($where){
$query = $this->db->table('users')
->select('users.user_id,receipt.receipt_header,SUM(receipt.amount) AS total_amount')
->select("CONCAT_WS(' ', users.first_name, users.last_name) AS full_name")
->join('receipt', 'receipt.created_by = users.user_id', 'left')
->where('users.isactive', 1)
->where('receipt.receipt_header', 'Receipt')
->where($where)
->like('users.role', 'volunteer')
->groupby('users.user_id, full_name');
$result = $query->get()->getResult();
// echo $this->db->getLastQuery()->getQuery();die;
$total_amount_today = $this->db->table('receipt')
->select('SUM(amount) AS total_amount_today')
->join('users', 'receipt.created_by = users.user_id', 'left')
->where('receipt.receipt_header', 'Receipt')
->where($where)
->where('DATE(receipt.created_on) = CURDATE()')
->get()->getRow();
$today = ($total_amount_today) ? $total_amount_today->total_amount_today : 0;
$total_amount_current_month = $this->db->table('receipt')
->select('SUM(amount) AS total_amount_current_month')
->join('users', 'receipt.created_by = users.user_id', 'left')
->where('receipt.receipt_header', 'Receipt')
->where($where)
->where('YEAR(receipt.created_on)', date('Y'))
->where('MONTH(receipt.created_on)', date('m'))
->get()->getRow();
$month = ($total_amount_current_month) ? $total_amount_current_month->total_amount_current_month : 0;
$total_amount_current_financial_year = $this->db->table('receipt')
->select('SUM(amount) AS total_amount_current_financial_year')
->join('users', 'receipt.created_by = users.user_id', 'left')
->where('receipt.receipt_header', 'Receipt')
->where($where)
->where('receipt.created_on >=', date('Y-04-01'))
->where('receipt.created_on <', date('Y-04-01', strtotime('+1 year')))
->get()->getRow();
$financial_year = ($total_amount_current_financial_year) ? $total_amount_current_financial_year->total_amount_current_financial_year : 0;
$final['volunter'] = $result;
$final['month'] = (int)$month;
$final['today'] = (int)$today;
$final['year'] = (int)$financial_year;
return $final;
}
public function dashboard_volunteer($where){
$common_query = $this->db->table('users')
->select('users.user_id, SUM(receipt.amount) AS total_amount')
->select("CONCAT_WS(' ', users.first_name, users.last_name) AS full_name")
->join('receipt', 'receipt.created_by = users.user_id', 'left')
->where($where)
->like('users.role', 'volunteer')
->groupby('users.user_id');
$today_collection = clone $common_query;
$today_collection = $today_collection->where('DATE(receipt.created_on)', date('Y-m-d'))->get()->getRow();
$final['today_collection'] = ($today_collection) ? (int)$today_collection->total_amount : 0;
$overall_collection = clone $common_query;
$overall_collection = $overall_collection->get()->getRow();
// echo $this->db->getLastQuery()->getQuery();die;
$final['overall_collection'] = ($overall_collection) ? (int)$overall_collection->total_amount : 0;
$settlement_today = clone $common_query;
$settlement_today = $settlement_today->where('DATE(receipt.created_on)', date('Y-m-d'))
->where('receipt.receipt_header', 'Receipt')
->get()->getRow();
$final['settlement_today'] = ($settlement_today) ? (int)$settlement_today->total_amount : 0;
$settlement_overall = clone $common_query;
$settlement_overall = $settlement_overall->where('receipt.receipt_header', 'Receipt')->get()->getRow();
$final['settlement_overall'] = ($settlement_overall) ? (int)$settlement_overall->total_amount : 0;
return $final;
}
}

View File

@ -42,4 +42,25 @@ protected $allowedFields = ['receipt_id', 'receipt_number', 'donor_id','notes','
}
function export_excel($business_id)
{
$builder = $this->db->table('donor')
->select('CONCAT_WS(" ", donor.first_name, donor.last_name) AS full_name')
->select('donor.donor_type,donor.org_name,donor.org_reg_details,donor.mobile_no,donor.email,donor.pan_no,donor.adhar_no,donor.passport_no,donor.address,donor.country,donor.state,donor.city,donor.postal_code')
->select('CONCAT_WS(" ", creator.first_name, creator.last_name) AS creator_name')
->select('CONCAT_WS(" ", updater.first_name, updater.last_name) AS updater_name')
->select('IFNULL(DATE_FORMAT(donor.created_on, "%d-%m-%Y"), "-") AS formatted_created_on')
->select('IFNULL(DATE_FORMAT(donor.updated_on, "%d-%m-%Y"), "-") AS formatted_updated_on')
->select('CASE WHEN donor.isactive = 1 THEN "Active" ELSE "Inactive" END AS active_status', false)
->join('users as creator', ' donor.created_by = creator.user_id', 'left')
->join('users as updater', ' donor.updated_by = updater.user_id', 'left')
->where('donor.business_id', $business_id);
$query = $builder->get();
return $query->getResultArray();
}
public function bulkInsert($data) {
return $this->db->table('donor')->insertBatch($data);
}
}

View File

@ -41,12 +41,13 @@ class NotificationModel extends Model
->get()->getResultArray();
}
public function getTemplateDetails(){
public function getTemplateDetails($session_bid){
return $this->db->table('templates as T' )
->join('users as U1', 'U1.user_id = T.created_by', 'left')
->join('users as U2', 'U2.user_id = T.updated_by', 'left')
->select('T.template_id,T.template_name,T.mode,T.created_on,T.created_by,T.updated_on,T.updated_by,DATE_FORMAT(T.created_on, "%d/%m/%Y %h:%i %p") AS formatted_created_on,concat(U1.first_name," ",U1.last_name) as created_by_name,concat(U2.first_name," ",U2.last_name) as updated_by_name,T.isactive')
->whereNotIn('T.template_name',array('EXPIRAY_NOTIFY_TEMPLATE_EMAIL','EXPIRAY_NOTIFY_TEMPLATE_WHATSAPP'))
->where('U1.business_id =',$session_bid)
->get()->getResultArray();
}
@ -82,13 +83,14 @@ class NotificationModel extends Model
return $statement;
}
public function getCampaignDetails(){
public function getCampaignDetails($session_bid){
$result = $this->db->table('notification_campaign as NC' )
->join('users as U1', 'U1.user_id = NC.created_by', 'left')
->join('users as U2', 'U2.user_id = NC.updated_by', 'left')
->join('templates as T', 'T.template_id = NC.template_id', 'left')
->select('NC.campaign_id,NC.campaign_name,T.template_id,T.template_name,NC.mode,NC.created_on,NC.created_by,NC.updated_on,NC.updated_by,DATE_FORMAT(NC.created_on, "%d/%m/%Y %h:%i %p") AS formatted_created_on,concat(U1.first_name," ",U1.last_name) as created_by_name,concat(U2.first_name," ",U2.last_name) as updated_by_name,NC.isactive,NC.group_id,NC.scheduled_date,if(NC.scheduled_time IS NULL ,"",NC.scheduled_time) as scheduled_time')
->whereNotIn('T.template_name',array('EXPIRAY_NOTIFY_TEMPLATE_EMAIL','EXPIRAY_NOTIFY_TEMPLATE_WHATSAPP'))
->where('U1.business_id =',$session_bid)
->get()->getResultArray();
if (!empty($result)) {

View File

@ -15,8 +15,8 @@
<th>Action</th>
<th>Module</th>
<th>Key</th>
<th>Old Value</th>
<th>New Value</th>
<th>Old Value</th>
<th>Updated By</th>
<th>Updated On</th>
</tr>

View File

@ -42,7 +42,7 @@
</a>
<a href="javascript:void(0);" class="logo logo-light text-center">
<span class="logo-lg">
<span class="logo-lg" style="background: white;">
<img src="<?= base_url() . "public/uploads/default.png" ?>" alt="" height="55">
</span>
</a>

View File

@ -40,7 +40,7 @@
</a>
<a href="javascript:void(0);" class="logo logo-light text-center">
<span class="logo-lg">
<span class="logo-lg" style="background: white;">
<img src="<?= base_url() . "public/uploads/default.png" ?>" alt="" height="55">
</span>
</a>

View File

@ -21,7 +21,9 @@
<link href="<?= base_url() . "public/assets/css/icons.min.css" ?>" rel="stylesheet" type="text/css" />
</head>
<style>
.debug-bar-ndisplay {display: none !important;}
</style>
<body class="loading">
<div class="account-pages mt-5 mb-5">
@ -41,7 +43,7 @@
</a>
<a href="javascript: void(0);" class="logo logo-light text-center">
<span class="logo-lg">
<span class="logo-lg" style="background: white;">
<img src="<?= base_url() . "public/uploads/default.png" ?>" alt="" height="80">
</span>
</a>

View File

@ -41,7 +41,7 @@
</a>
<a href="javascript:void(0);" class="logo logo-light text-center">
<span class="logo-lg">
<span class="logo-lg" style="background: white;">
<img src="<?= base_url() . "public/uploads/default.png" ?>" alt="" height="55">
</span><br/>
</a>

View File

@ -96,6 +96,14 @@
<script>
$(function() {
// don't for validation.
var get_fromdate = "<?php echo isset($details[0]['from_date']) ? $details[0]['from_date'] : ''; ?>";
var default_mindate = new Date().toISOString().split('T')[0];
var from_mindate = default_mindate ; //default today date is MinDate Of From Date
var to_mindate = (get_fromdate === '') ? default_mindate : get_fromdate; //default today date is MinDate Of To Date but in edit Screen From Date Availble Means Setted to min date
$("#from_date").attr("min", from_mindate);
$("#to_date").attr("min", to_mindate);
role = "<?php echo get_user_role() ?>";
console.log(role);
if(role == "auditor")
@ -112,7 +120,13 @@
});
}
});
$("#from_date").on("change", function() {
$("#to_date").val('');
var fromDate = $(this).val();
$("#to_date").attr("min", fromDate);
});
</script>
<script>
document.addEventListener("DOMContentLoaded", function() {
const coverPictureInput = documenxt.getElementById("cover_picture");

View File

@ -35,6 +35,7 @@
<div class="card-body">
<h4 class="header-title"><?= $page_name; ?></h4>
<p class="sub-header"> </p>
<?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') ?>
@ -43,6 +44,15 @@
</button>
</div>
<?php endif; ?>
<?php if (session()->getFlashdata('error')) : ?>
<div class="alert alert-danger alert-dismissible fade show" role="alert">
<?= session('error') ?>
<button type="button" class="close" data-dismiss="alert" aria-label="Close">
<span aria-hidden="true">&times;</span>
</button>
</div>
<?php endif; ?>
<?php endif; ?>
<form class="needs-validation" novalidate method="POST" enctype="multipart/form-data" action="<?= base_url() . "insert_org"; ?>" id="myForm">
<hr />
<h4 class="header-title" id="org-settings-title">
@ -79,6 +89,28 @@
<div class="invalid-feedback"> Please provide. </div>
</div>
</div>
<?php if($loged_user === 'sadmin' || $loged_user === 'admin'){ ?>
<div class="form-row">
<div class="form-group col-md-3">
<label for="80G" class="col-form-label">80G</label>
<input type="text" class="form-control" id="80G" name="80G" value="<?= isset($organzations['80G']) ? htmlspecialchars($organzations['80G']) : '' ?>" placeholder="80G Tax Free / Registration number" onchange="checkValidityAndSetRequired()"/>
</div>
<div class="form-group col-md-3">
<label for="80G_vaildupto" class="col-form-label">80G Vaild Upto<span class="text-danger 80G-text-danger" style="display:none;">*</span></label>
<input type="date" class="form-control" id="80G_vaildupto" name="80G_vaildupto" value="<?= !empty($organzations['80G_vaildupto']) ? htmlspecialchars($organzations['80G_vaildupto']) : null ?>" min="<?= date('Y-m-d') ?>">
</div>
<div class="form-group col-md-3">
<label for="12AA" class="col-form-label">12AA</label>
<input type="text" class="form-control" id="12AA" name="12AA" value="<?= isset($organzations['12AA']) ? htmlspecialchars($organzations['12AA']) : null ?>" placeholder="12AA Tax Free / Registration number" onchange="checkValidityAndSetRequired()"/>
</div>
<div class="form-group col-md-3">
<label for="12AA_vaildupto" class="col-form-label">12AA Vaild Upto<span class="text-danger 12AA-text-danger" style="display:none;">*</span></label>
<input type="date" class="form-control" id="12AA_vaildupto" name="12AA_vaildupto" value="<?= !empty($organzations['12AA_vaildupto']) ? htmlspecialchars($organzations['12AA_vaildupto']) : null ?>" min="<?= date('Y-m-d') ?>">
</div>
</div>
<?php } ?>
<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>
@ -86,35 +118,41 @@
<span id="bmobileValidationMessage"></span>
<div class="invalid-feedback"> Please provide. </div>
</div>
<div class="form-group col-md-4">
<div class="form-group col-md-8">
<label for="baddress" class="col-form-label">Organization Address<span class="text-danger">*</span></label>
<input type="text" class="form-control" name="baddress" value="<?= isset($organzations['address']) ? $organzations['address'] : '' ?>" placeholder="Address (eg : 1234 Main St)" required />
<div class="invalid-feedback"> Please provide. </div>
</div>
<?php if (isset($organzations['loged_user'])) { ?>
<div class="form-group col-md-4">
<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 } ?>
</div>
<div class="form-row">
<div class="form-group col-md-4">
<div class="form-group col-md-3">
<label for="bcity" class="col-form-label">City<span class="text-danger">*</span></label>
<input type="text" class="form-control" name="bcity" value="<?= isset($organzations['city']) ? $organzations['city'] : '' ?>" placeholder="City" required pattern="[A-Za-z\s]+" title="Please enter alphabets only" />
<div class="invalid-feedback"> Please provide. </div>
</div>
<div class="form-group col-md-4">
<div class="form-group col-md-3">
<label for="bstate" class="col-form-label">State<span class="text-danger">*</span></label>
<input type="text" class="form-control" name="bstate" value="<?= isset($organzations['state']) ? $organzations['state'] : '' ?>" placeholder="State" required pattern="[A-Za-z\s]+" title="Please enter alphabets only" />
<div class="invalid-feedback"> Please provide. </div>
</div>
<div class="form-group col-md-4">
<div class="form-group col-md-3">
<label for="bzip" class="col-form-label">Postal Code<span class="text-danger">*</span></label>
<input type="text" class="form-control" name="bzip" value="<?= isset($organzations['postal_code']) ? $organzations['postal_code'] : '' ?>" placeholder="Postal Code (Eg: Pincode)" pattern="[0-9]{6}" maxlength="6" required />
<div class="invalid-feedback"> Please provide. </div>
</div>
<div class="form-group col-md-3">
<label for="country" class="col-form-label">Country</label>
<select class="form-control" id="country" name="country" >
<option value="<?= isset($organzations['country']) ? $organzations['country'] : '' ?>"><?= isset($organzations['country']) ? $organzations['country'] : '--Select--';?></option>
<?php foreach ($country_details as $value) { ?>
<option value="<?php echo $value['country_name']; ?>">
<?php
echo $value['country_name'];
?>
</option>
<?php } ?>
</select>
</div>
</div>
</div>
<!-- Existing form fields above this section -->
@ -145,11 +183,12 @@
<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($organzations['site_name']) ? $organzations['site_name'] : '' ?>" placeholder="Site Name" />
<?php if ($loged_user === 'sadmin') : ?> <span class="help-block"><small>Auto-Text Copied from Buiness title field (First time only)</small></span> <?php endif; ?>
<?php if ($loged_user === 'sadmin') : ?> <span class="help-block"><small>Auto-text copied from Organization Name field (First time only. If you want to change it means please edit.)</small></span> <?php endif; ?>
</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($organzations['site_title']) ? $organzations['site_title'] : '' ?>" />
<?php if ($loged_user === 'sadmin') : ?> <span class="help-block"><small>Auto-text copied from Organization Name field (First time only. If you want to change it means please edit.)</small></span> <?php endif; ?>
</div>
</div>
<div class="form-row">
@ -170,17 +209,25 @@
<input type="text" class="form-control" id="copyright" name="copyright" placeholder="Copy Right" value="<?= isset($organzations['copyright']) ? $organzations['copyright'] : '' ?>" />
</div>
<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($organzations['currency']) ? $organzations['currency'] : '' ?>" />
<label for="currency" class="col-form-label">Currency<span class="text-danger">*</span></label>
<select class="form-control" placeholder="Currency (eg : Rupees,Dollar,Euro - symbols)" id="currency" name="currency[]" required data-toggle="select2" multiple>
<option value="0" disabled>--Select--</option>
<?php
$defaultCurrencies = isset($organzations['currency']) ? unserialize((string)$organzations['currency']) : ['INR'];
foreach ($country_details as $val) {
echo '<option value="' . $val['currency_code'] . '" ' . (in_array($val['currency_code'], $defaultCurrencies) ? 'selected' : '') . '>';
echo $val['currency_code'];
echo '</option>';
}?>
<!-- echo $val['currency_code'] . ' (' . $val['currency_name'] . ' - ' . $val['currency_symbol'] . ')'; -->
</select>
<div class="invalid-feedback"> Please provide. </div>
</div>
</div>
<div class="form-row">
<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($organzations['country']) ? $organzations['country'] : '' ?>" />
</div>
</div>
</div>
@ -226,24 +273,24 @@
<div class="form-group">
<div class="form-row">
<div class="form-group col-md-6">
<label for="branchname" class="col-form-label">Branch Name<span class="text-danger"> </span></label>
<label for="branchname" class="col-form-label">Branch Name<span class="text-danger">* </span></label>
<input type="text" class="form-control" id="branchname" name="branch_name[]" placeholder="Branch Name" required />
<div class="invalid-feedback"> Please provide. </div>
</div>
<div class="form-group col-md-6">
<label for="branchaddress" class="col-form-label">Branch Address<span class="text-danger"></span></label>
<label for="branchaddress" class="col-form-label">Branch Address<span class="text-danger">*</span></label>
<input type="text" class="form-control" id="branchaddress" name="branchaddress[]" placeholder="Address (eg : 1234 Main St)" required />
<div class="invalid-feedback"> Please provide. </div>
</div>
</div>
<div class="form-row">
<div class="form-group col-md-6">
<label for="mobile_no" class="col-form-label">Contact Person Mobile <span class="text-danger"></span></label>
<label for="mobile_no" class="col-form-label">Contact Person Mobile <span class="text-danger">*</span></label>
<input type="number" class="form-control" id="mobile_no" name="mobile_no[]" placeholder="Contact Person Mobile " required data-parsley-type="number" maxlength="10" />
<div class="invalid-feedback"> Please provide. </div>
</div>
<div class="form-group col-md-6">
<label for="email" class="col-form-label">Email<span class="text-danger"></span></label>
<label for="email" class="col-form-label">Email<span class="text-danger">*</span></label>
<input type="text" class="form-control" id="email" name="email[]" placeholder="Email" required />
<div class="invalid-feedback"> Please provide. </div>
</div>
@ -276,6 +323,7 @@
<div class="form-group col-md-6">
<label for="logo" class="col-form-label">Logo</label>
<input type="file" class="form-control" style="border: 0px !important; " id="logo" name="business_logo" placeholder="Logo Name" accept=".png, .jpg, .jpeg" value="<?= isset($organzations['business_logo']) ? $organzations['business_logo'] : '' ?>" />
<span class="help-block"><small>Image dimensions should be between <strong>140x45</strong> pixels and <strong>300x100</strong> pixels. (formats: .png, .jpg, .jpeg)</small></span>
<p id="logo-error-message" style="color: red;"></p>
</div>
@ -288,6 +336,7 @@
<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($organzations['favicon']) ? $organzations['favicon'] : '' ?>" />
<span class="help-block"><small>Image dimensions should be <strong>256x256</strong> pixels.(formats: .png, .jpg, .jpeg) </small></span>
<p id="favic-error-message" style="color: red;"></p>
</div>
@ -304,7 +353,8 @@
<div class="form-group col-md-6">
<label for="bfile" class="col-form-label">Signature</label>
<input type="file" onchange="validateImage(this)" class="form-control" style="border: 0px !important;" id="signature" name="signature" value="<?= isset($organzations['signature']) ? $organzations['signature'] : null ?>" multiple />
<input type="file" onchange="validateImage(this)" class="form-control" style="border: 0px !important;" id="signature" name="signature" value="<?= isset($organzations['signature']) ? $organzations['signature'] : null ?>" accept=".png, .jpg, .jpeg"/>
<span class="help-block"><small>Image dimensions should be <strong>150x30</strong> pixels. (formats: .png, .jpg, .jpeg) </small></span>
<p id="error-message"></p>
</div>
@ -391,13 +441,34 @@
</div> <!-- end col-->
</div><!-- end row -->
<script>
function checkValidityAndSetRequired() {
if (document.getElementById('80G').value.trim() !== "") {
document.getElementById('80G_vaildupto').setAttribute('required', 'required');
} else {
document.getElementById('80G_vaildupto').removeAttribute('required');
}
if (document.getElementById('12AA').value.trim() !== "") {
document.getElementById('12AA_vaildupto').setAttribute('required', 'required');
} else {
document.getElementById('12AA_vaildupto').removeAttribute('required');
}
}
document.getElementById('myForm').addEventListener('submit', function(event) {
var form = event.target;
var role = <?php echo json_encode($loged_user); ?>;
if(role === 'sadmin'){checkValidityAndSetRequired();}
if (form.checkValidity() === false) {
form.reportValidity(); // Display validation error messages
event.preventDefault(); // Prevent form submission if it's not valid
var invalidFields = form.querySelectorAll(':invalid');
if (invalidFields.length > 0) {
invalidFields[0].focus();
}
$('#submitBtn').prop('disabled', false);
} else {
@ -465,8 +536,8 @@
img.onload = function() {
if (
img.width >= 140 && img.width <= 150 &&
img.height >= 45 && img.height <= 50
img.width >= 140 && img.width <= 300 &&
img.height >= 45 && img.height <= 100
) {
// Valid size, clear error message
errorMessageElement.textContent = '';
@ -495,14 +566,14 @@
img.onload = function() {
if (
img.width === 216 && img.height === 216
img.width === 256 && img.height === 256
) {
// Valid size, clear error message
errorMessageElement.textContent = '';
} else {
// Invalid size, reset the input and display an error message
input.value = '';
errorMessageElement.textContent = 'Image dimensions should not exceed 216x216.';
errorMessageElement.textContent = 'Image dimensions should not exceed 256x256.';
}
};
@ -517,20 +588,32 @@
</script>
<script>
$(document).ready(function() {
var Role = <?php echo json_encode($loged_user); ?>;
$('#bname').on('input', function() {
if($('#site_name').val() != "" && $('#site_title').val() != "" && Role === 'sadmin'){
$('#bname').change(function(){
// alert($(this).val());
if($('#site_name').val() === "" && $('#site_title').val() === "" && Role === 'sadmin'){
var bname = $(this).val();
$('#site_name').val(bname);
$('#site_title').val(bname);
if (bname === '' ) {
$('#site_name').val('');
$('#site_title').val('');
}
$('#site_name').val(bname);
$('#site_title').val(bname);
if (bname === '' ) {
$('#site_name').val('');
$('#site_title').val('');
}
}
});
if (Role === 'sadmin') {
$('#branchaddress').removeAttr('required');
$('#branchaddress').siblings('span.text-danger').remove();
$('#branchname').removeAttr('required');
$('#branchname').siblings('span.text-danger').remove();
$('#mobile_no').removeAttr('required');
$('#mobile_no').siblings('span.text-danger').remove();
$('#email').removeAttr('required');
$('#email').siblings('span.text-danger').remove();
}
});
$(document).ready(function() {
var Role = <?php echo json_encode($loged_user); ?>;
var busiBranchArray = <?php echo json_encode($branches); ?>;
if (busiBranchArray.length > 0) {

View File

@ -22,13 +22,22 @@
<th>State</th>
<th>Zip</th>
<th>File</th>
<th>Status</th>
<th>Action</th>
</tr>
</thead>
<tbody>
<?php foreach ($organzations as $business) : ?>
<?php foreach ($organzations as $business) :
if ($business['isactive']) {
$class = 'badge badge-soft-success';
$message = 'Active';
} else {
$class = 'badge badge-soft-danger';
$message = 'In-Active';
}
?>
<tr>
<td><?= $business['title']; ?></td>
<td><?= $business['email']; ?></td>
@ -38,10 +47,15 @@
<td><?= $business['state']; ?></td>
<td><?= $business['postal_code']; ?></td>
<td><?= $business['business_logo']; ?></td>
<td><span class="<?php echo $class; ?>"><?php echo $message; ?></span></td>
<td>
<a href="<?= base_url() . "new_org/" . $business['business_id']; ?>" class="edit-button" title="Click to Edit Business"><i class="ri-pencil-line"></i></a>
<?php if($loggedin_person_role === 'sadmin'): ?>
<a href="<?= base_url() . "delete_org/" . $business['business_id']; ?>" class="delete-button" title="Click to Delete Business"><i class="ri-delete-bin-line"></i></a>
<?php if($business['isactive'] == 1) { ?>
<a href="<?= base_url() . "delete_org/" . $business['business_id']; ?>" class="delete-button" title="Click to Delete Business"><i class="ri-delete-bin-line"></i></a>
<?php } else {?>
<a href="<?= base_url() . "activate_org/" . $business['business_id']; ?>" class="active-button" title="Click to Active Business"><i class="ri-checkbox-circle-line"></i></a>
<?php } ?>
<?php endif; ?>
</td>
</tr>

View File

@ -79,7 +79,6 @@
<label for="dob" class="col-form-label">Date Of Birth</label>
<input type="date" class="form-control" name="dob" value="" placeholder="Date Of Birth" />
</div> -->
<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" onchange="checkExisting(this,'pan_no','pan_no')"/>
@ -90,6 +89,11 @@
<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 class="form-group col-md-4" id="passport_no_individual">
<label for="csname" class="col-form-label"><span class="contactPerson"> </span>Passport Number <i class="text-danger contactPerson"> *</i> </label>
<input type="text" class="form-control" id="passport_no"name="passport_no" value="<?= isset($customer['passport_no']) ? $customer['passport_no'] : '' ?>" placeholder="Passport Number" onchange="checkExisting(this,'passport_no','passport_no')"/>
<span id="passportValidationMessage" style="color: red;"></span>
</div>
</div>
@ -165,19 +169,81 @@
<script>
function checkValidityAndSetRequired() {
var type = document.getElementById('DonorType').value;
var panInput = document.getElementById('pan_no');
// Clear previous error messages
if (type === 'organization') {
panInput.setAttribute('required', 'required');
} else if (type === 'individual') {
panInput.removeAttribute('required');
}
}
document.getElementById('myForm').addEventListener('submit', function(event) {
var form = event.target;
// Call function to set required fields based on donor type
checkValidityAndSetRequired();
var type = document.getElementById('DonorType').value;
var aadharValue = document.getElementById('adhar_no').value.trim();
var panValue = document.getElementById('pan_no').value.trim();
var passportValue = document.getElementById('passport_no').value.trim();
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);
if (type === 'organization') {
if (panValue !== '' && !validatePANNumber(panValue)) {
event.preventDefault(); // Prevent form submission if PAN is not valid
return;
}
}else if (type === 'individual' && (panValue === '' && passportValue === '')) {
event.preventDefault(); // Prevent form submission
alert('Please enter either PAN Number or Passport Number.');
return ;
}
else if (type === 'individual') {
if (aadharValue !== '' && !validateAdharNumber(aadharValue)) {
event.preventDefault(); // Prevent form submission if Aadhaar is not valid
return;
}else{ document.getElementById('pan_no').removeAttribute('required'); }
if (panValue !== '' && !validatePANNumber(panValue)) {
event.preventDefault(); // Prevent form submission if PAN is not valid
return;
}else{ document.getElementById('adhar_no').removeAttribute('required'); }
if (passportValue !== '' && !validatePassport(passportValue)) {
event.preventDefault(); // Prevent form submission if Passport is not valid
return;
}else{ document.getElementById('passport_no').removeAttribute('required'); }
}
var invalidFields = form.querySelectorAll('.is-invalid');
console.log("*** Invalid Fields ***");
invalidFields.forEach(function(field) {
console.log(field);
});
if (invalidFields.length > 0) {
invalidFields[0].focus();
console.log("**" + invalidFields[0]);
event.preventDefault();
return;
}
});
if (!form.checkValidity()) {
form.reportValidity(); // Display validation error messages
event.preventDefault(); // Prevent form submission if form is not valid
}
});
// if (form.checkValidity() === true) {
// 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 onlyNumbers(event){
@ -232,6 +298,10 @@
$('#pan_no').on('input', function(){
validatePANNumber($(this).val());
});
$('#passport_no').on('input', function(){
validatePassport($(this).val());
});
function updateDonorTypeFields() {
let DonorType = $('#DonorType').val();
@ -242,6 +312,7 @@
$('#org_reg').show();
$('.contactPerson').show();
$('#adhar_no_individual').hide();
$('#passport_no_individual').hide();
$('#org_name_field').prop('required', true);
$('#org_reg_details').prop('required', true);
$('#pan_no').prop('required', true);
@ -249,6 +320,7 @@
// Individual type selected
else {
$('#adhar_no_individual').show();
$('#passport_no_individual').show();
$('#org_name').hide();
$('#org_reg').hide();
$('.contactPerson').hide();
@ -261,20 +333,49 @@
if (!adharPattern.test(adharNumber)) {
$('#adhar_no').addClass('is-invalid');
return false;
} else {
$('#adhar_no').removeClass('is-invalid');
return true;
}
}
function validatePANNumber(panNumber) {
let panPattern = /^[A-Z]{5}[0-9]{4}[A-Z]$/;
if (!panPattern.test(panNumber)) {
$('#pan_no').addClass('is-invalid');
return false;
} else {
$('#pan_no').removeClass('is-invalid');
return true;
}
}
function validatePassport(passport) {
// Check length (8 to 12 characters)
if (passport.length < 8 || passport.length > 12) {
$('#passport_no').addClass('is-invalid');
return false;
}
// Check first character for type of passport (P, D, S)
const type = passport.charAt(0);
if (!['P', 'D', 'S'].includes(type)) {
$('#passport_no').addClass('is-invalid');
return false;
}
// Check that the rest of the characters are alphanumeric
const rest = passport.slice(1);
const alphanumericRegex = /^[a-zA-Z0-9]+$/;
if (!alphanumericRegex.test(rest)) {
$('#passport_no').addClass('is-invalid');
return false;
}
$('#passport_no').removeClass('is-invalid');
return true;
}
});
</script>
<script>
@ -322,13 +423,16 @@
spanid = "mobileValidationMessage"; break;
case 'adhar_no' :
spanid = "adharValidationMessage"; break;
case 'passport_no':
spanid = "passportValidationMessage"; break;
}
var validationMessage = document.getElementById(spanid);
var validationMessage = document.getElementById(spanid);
resetValidationMessage(spanid);
var value = input.value.trim();
if (value === "") {
validationMessage.style.display = 'none';
return;
}
}else{
$.ajax({
type: "POST",
url: "<?= base_url() . 'check_existing' ?>",
@ -339,7 +443,7 @@
},
success: function(response) {
console.log("check existing " + elementId + "--" + response['data']['message']);
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";
@ -347,8 +451,14 @@
if (response['data']['status']) input.value = '';
},
error: function(xhr, status, error) {
console.error("check existing " + elementId + " -- " + status + ": " + error);
console.error("check existing " + elementid + " -- " + status + ": " + error);
}
});
}}
function resetValidationMessage(spanid) {
var validationMessage = document.getElementById(spanid);
validationMessage.style.display = 'none';
validationMessage.innerText = '';
validationMessage.style.color = '';
}
</script>

View File

@ -4,10 +4,19 @@
<div class="card-body">
<div class="float-right">
<a href="<?= base_url() . "new_Donor/0"; ?>" class="btn btn-primary"><i class="ri-map-pin-user-fill"></i> Add Contributor </a>
<a href="<?= base_url() . "export_Donor"; ?>" class="btn btn-info"><i class="ri-file-excel-2-fill"></i> Export Contributor </a>
<!-- <a href="<?= base_url() . "import_Donor"; ?>" class="btn btn-secondary"><i class="ri-file-excel-2-line"></i> Import Contributor </a> -->
<button type="button" class="btn btn-secondary" data-toggle="modal" data-target="#standard-modal"><i class="ri-file-excel-2-line"></i> Import Contributor</button>
<div class="row">
<div class="col-12 text-right">
<a href="<?= base_url() . "public/import/sample_contributor.xlsx"; ?>" download class="btn btn-link">Click here to download the sample Excel file for contributor import</a>
</div>
</div>
</div><!-- end col-->
<br>
<h4 class="header-title mb-3"><?= $page_name; ?></h4>
<?php if (session()->getFlashdata('success') || session()->getFlashdata('error')) : ?>
<br>
<?php if (session()->getFlashdata('success')) : ?>
<div class="alert alert-success alert-dismissible fade show" role="alert">
<?= session('success') ?>
@ -210,4 +219,80 @@ $(document).on('click', '.view-receipts', function(e) {
});
}
});
</script>
<div id="standard-modal" class="modal fade" tabindex="-1" role="dialog" aria-labelledby="standard-modalLabel" aria-hidden="true">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<h4 class="modal-title" id="standard-modalLabel">Import Contributor</h4>
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
</div>
<form id="form-upload">
<div class="modal-body">
<div class="form-group col-md-12">
<label for="control-label">Choose File <small class="text-danger">*</small></label>
<input type="file" class="form-control" style="border: 0px !important; " id="file" name="file" placeholder="csv,xlsx files" accept=".csv, application/vnd.openxmlformats-officedocument.spreadsheetml.sheet,
application/vnd.ms-excel" required />
<span class="help-block"><small>Upload xlsx or csv file only.</small></span>
</div>
<div class="form-group">
<div class="text-center">
<div class="upload-loader" style="display: none; ">
<i class="fa fa-spinner fa-spin"></i> <small>Please wait ...</small>
</div>
<div class="result"></div>
</div>
<div class="text-left message_in_details"></div>
</div>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-light" data-dismiss="modal">Close</button>
<button type="submit" class="btn btn-primary" id="btn-upload">Upload</button>
</div>
</form>
</div><!-- /.modal-content -->
</div><!-- /.modal-dialog -->
</div><!-- /.modal -->
<script>
$(document).ready(function(){
$('#form-upload').on('submit', function(event) {
event.preventDefault(); // Prevent default form submission
var formData = new FormData($('#form-upload')[0]);
$.ajax({
type: "POST",
url: "<?= base_url() . 'import_Donor' ?>",
data: formData,
contentType: false,
processData: false,
beforeSend: function() {
$("#btn-upload").prop('disabled', true);
$(".upload-loader").show();
},
success: function(result) {
$("#btn-upload").prop('disabled', false);
if($.isEmptyObject(result.error_message)) {
$(".result").html(result.success_message).css("color", "green");
} else {
$(".result").html(result.error_message).css("color", "red");
}
if (!$.isEmptyObject(result.message_in_details)) {
$(".message_in_details").html(result.message_in_details+" <center> <br><br> After 12 seconds. Import Contributor pop will be closed </center>").css("color", "blue");
}
$("#form-upload")[0].reset();
$(".upload-loader").hide();
setTimeout(function() {
console.log("Timeout executed!"); // Check if this message appears in the console
refreshPage();
$(".result").html('');
$(".message_in_details").html('');
}, 12000); // 10000 milliseconds = 10 seconds now setted as 12 seconds.
}
});
});
});
</script>

View File

@ -1,4 +1,22 @@
<?php if ($loggedin_person_role !== 'sadmin') : ?>
<?php if (session()->getFlashdata('reminder')) :
$messages = session()->getFlashdata('reminder'); ?>
<div class="alert remainder alert-info alert-dismissible fade show" role="alert">
<div class="row">
<div class="col-md-1" style="display: flex; align-items: center; justify-content: center;">
<i class="fas fa-duotone fa-bell fa-2x" style="color: darksalmon;"></i>
</div>
<div class="col-md-10">
<?php $allMessages = implode('<br>', $messages); ?>
<?=$allMessages?>
</div>
</div>
<button type="button" class="close" data-dismiss="alert" aria-label="Close">
<span aria-hidden="true">&times;</span>
</button>
</div>
<?php endif; ?>
<?php if ($loggedin_person_role === 'auditor' || $loggedin_person_role === 'admin') : ?>
<div class="row justify-content-center">
<div class="col-xl-3 col-md-6">
<div class="card">
@ -22,4 +40,46 @@
</div>
</div>
</div>
<?php endif; ?>
<?php endif; ?>
<?php if ($loggedin_person_role === 'volunteer') : ?>
<div class="row">
<div class="col-lg-12">
<div class="row mb-3">
<div class="col-lg-6">
<div>
<!-- <h4 class="font-15 mb-2">Today Collection</h4> -->
<div class="card p-2 mb-lg-0">
<div class="text-center">
<h3><b>Collections</b></h3>
</div>
<div class="mt-4 pt-1">
<div class="d-flex justify-content-between">
<p class="mb-1"><span class="font-weight-semibold">Today :</span><?= $today_collection; ?></p>
<p class="mb-0"><span class="font-weight-semibold">Overall :</span><?= $overall_collection; ?></p>
</div>
</div>
</div>
</div>
</div>
<div class="col-lg-6">
<div>
<!-- <h4 class="font-15 mb-2">Settlement Amount</h4> -->
<div class="card p-2 mb-lg-0">
<div class="text-center">
<h3><b>Pending Settlement</b></h3>
</div>
<div class="mt-4 pt-1">
<div class="d-flex justify-content-between">
<p class="mb-1"><span class="font-weight-semibold">Today :</span><?= $settlement_today; ?></p>
<p class="mb-0"><span class="font-weight-semibold">Overall :</span><?= $settlement_overall; ?></p>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<!-- end row -->
<?php endif; ?>

View File

@ -0,0 +1,124 @@
<!-- Start Content-->
<div class="container-fluid">
<h4 class="header-title mb-3">Account Overviews</h4>
<div class="row">
<div class="col-xl-4 col-md-4">
<div class="card">
<div class="card-body">
<div class="d-flex justify-content-between">
<div>
<h5 class="text-muted font-weight-normal mt-0 text-truncate" title="Financial year">Financial year</h5>
<h3 class="my-2 py-1"><span data-plugin="counterup"><span data-toggle="tooltip" data-placement="bottom" data-original-title="Current Financial year"><?= $year ?></span></span></h3>
<!-- <p class="mb-0 text-muted">
<span class="text-success mr-2"><span class="mdi mdi-arrow-up-bold"></span> 5.27%</span>
<span class="text-nowrap">Since last month</span>
</p> -->
</div>
<!-- <div class="avatar-sm">
<span class="avatar-title bg-soft-primary rounded">
<i class="ri-stack-line font-20 text-primary"></i>
</span>
</div> -->
</div>
</div>
</div>
</div><!-- end col -->
<div class="col-xl-4 col-md-4">
<div class="card">
<div class="card-body">
<div class="d-flex justify-content-between">
<div>
<h5 class="text-muted font-weight-normal mt-0 text-truncate" title="Month">Month</h5>
<h3 class="my-2 py-1"><span data-plugin="counterup"><span data-toggle="tooltip" data-placement="bottom" data-original-title="Current Month"><?= $month ?></span></span></h3>
<!-- <p class="mb-0 text-muted">
<span class="text-danger mr-2"><span class="mdi mdi-arrow-down-bold"></span> 3.27%</span>
<span class="text-nowrap">Since last month</span>
</p> -->
</div>
<!-- <div class="avatar-sm">
<span class="avatar-title bg-soft-primary rounded">
<i class="ri-slideshow-2-line font-20 text-primary"></i>
</span>
</div> -->
</div>
</div>
</div>
</div><!-- end col -->
<div class="col-xl-4 col-md-4">
<div class="card">
<div class="card-body">
<div class="d-flex justify-content-between">
<div>
<h5 class="text-muted font-weight-normal mt-0 text-truncate" title="Today">Today</h5>
<h3 class="my-2 py-1"><span data-plugin="counterup"><span data-toggle="tooltip" data-placement="bottom" data-original-title="Current Today"><?= $today; ?></span></span></h3>
<!-- <p class="mb-0 text-muted">
<span class="text-success mr-2"><span class="mdi mdi-arrow-up-bold"></span> 8.58%</span>
<span class="text-nowrap">Since last month</span>
</p> -->
</div>
<!-- <div class="avatar-sm">
<span class="avatar-title bg-soft-primary rounded">
<i class="ri-hand-heart-line font-20 text-primary"></i>
</span>
</div> -->
</div>
</div>
</div>
</div><!-- end col -->
</div>
<!-- end row -->
<div class="row">
<div class="col-xl-5">
<div class="card">
<div class="card-body">
<h4 class="header-title mb-3">Volunteer Performing</h4>
<div class="table-responsive">
<table class="table table-striped table-sm table-nowrap table-centered mb-0">
<thead>
<tr>
<th>Name</th>
<th>Amount</th>
<!-- <th></th> -->
</tr>
</thead>
<tbody>
<!-- <tr> <td>
<h5 class="font-15 mb-1 font-weight-normal">Volunt</h5>
<span class="text-muted font-13">Senior </span>
</td> -->
<!-- <td>187</td> -->
<!-- <td class="table-action">
<a href="javascript: void(0);" class="action-icon"> <i class="mdi mdi-eye"></i></a>
</td></tr> -->
<?php if (empty($volunter)) : ?>
<tr>
<td colspan="2"><center>No data available</center></td>
</tr>
<?php else : ?>
<?php foreach ($volunter as $value) : ?>
<tr>
<td><?= $value->full_name; ?></td>
<td><?= $value->total_amount; ?></td>
</tr>
<?php endforeach; ?>
<?php endif; ?>
</tbody>
</table>
</div> <!-- end table-responsive-->
</div> <!-- end card-body-->
</div> <!-- end card-->
</div>
<!-- end col-->
</div>
<!-- end row-->
</div> <!-- container -->

View File

@ -16,14 +16,14 @@
<div class="form-row">
<div class="form-group col-md-6">
<label for="nextid" class="col-form-label">Start Date<span class="text-danger">*</span></label>
<input type="date" class="form-control" name="start_date" value="<?= isset($campaign['start_date']) ? $campaign['start_date'] : '' ?>" placeholder="" required />
<label for="start_date" class="col-form-label">Start Date<span class="text-danger">*</span></label>
<input type="date" class="form-control" id="start_date" name="start_date" value="<?= isset($campaign['start_date']) ? $campaign['start_date'] : '' ?>" placeholder="" required />
<div class="invalid-feedback"> Please provide. </div>
</div>
<div class="form-group col-md-6">
<label for="leftpad" class="col-form-label">End Date<span class="text-danger">*</span></label>
<input type="date" class="form-control" name="end_date" placeholder="000" value="<?= isset($campaign['end_date']) ? $campaign['end_date'] : '' ?>" required>
<label for="end_date" class="col-form-label">End Date<span class="text-danger">*</span></label>
<input type="date" class="form-control" id="end_date" name="end_date" placeholder="000" value="<?= isset($campaign['end_date']) ? $campaign['end_date'] : '' ?>" required>
<div class="invalid-feedback"> Please provide. </div>
</div>
</div>
@ -55,6 +55,13 @@
<script>
$(function() {
// don't for validation.
var get_startdate = "<?php echo isset($details[0]['start_date']) ? $details[0]['start_date'] : ''; ?>";
var default_mindate = new Date().toISOString().split('T')[0];
var from_mindate = default_mindate ; //default today date is MinDate Of Start Date
var to_mindate = (get_startdate === '') ? default_mindate : get_startdate; //default today date is MinDate Of To Date but in edit Screen Start Date Availble Means Setted to min date
$("#start_date").attr("min", from_mindate);
$("#end_date").attr("min", to_mindate);
role = "<?php echo get_user_role() ?>";
console.log(role);
if(role == "auditor")
@ -70,6 +77,11 @@
element.setAttribute('disabled', true);
});
}
$("#start_date").on("change", function() {
$("#end_date").val('');
var fromDate = $(this).val();
$("#end_date").attr("min", fromDate);
});
});
</script>

View File

@ -53,27 +53,52 @@
</div>
</div>
<div class="form-row">
<?php
// print_r($currencies);
$uniqueData = [];
$mobileNumbers = [];
$selected_donor_mobile = "";
$selected_donor_id = isset($receipt_details['donor_id']) ? $receipt_details['donor_id'] : "";
foreach ($typebaseddonors as $object) {
$mobile = $object->mobile_no;
if ($object->donor_id == $selected_donor_id) {
$selected_donor_mobile = $mobile;
}
if (!isset($mobileNumbers[$mobile])) {
$mobileNumbers[$mobile] = true;
$uniqueData[] = $object;
}
}
?>
<div class="form-group col-md-6">
<label for="customerMobile" class="col-form-label dm_label">Donor Mobile<span class="text-danger"> *</span></label>
<label for="customerMobile" class="col-form-label dm_label">Contributor Mobile<span class="text-danger"> *</span></label>
<!-- <?php if (get_user_role() != 'accounts') { ?>
&nbsp;&nbsp;&nbsp;&nbsp;
<i type="button" class="fe-plus-circle" id="add-quk-donar" style="font-size: 24px;" data-toggle="modal" data-target="#standard-modal" title="Add Donor"></i>
<i type="button" class="fe-plus-circle" id="add-quk-donar" style="font-size: 24px;" data-toggle="modal" data-target="#standard-modal" title="Add Contributor "></i>
<?php } ?> -->
<select class="form-control" id="donor_mobile" name="donor_mobile" required data-toggle="select2">
<!-- <select class="form-control" id="donor_mobile" name="donor_mobile" required data-toggle="select2">
<option value="">--Select--</option>
<?php if (get_user_role() != 'accounts') { ?> <option class="blueText" value="0"> + Add a donor</option> <?php } ?>
<?php foreach ($typebaseddonors as $customer) : ?>
<option value="<?= $customer->mobile_no ?>" <?php if (isset($receipt_details['donor_id']) && ($receipt_details['donor_id'] == $customer->donor_id)) echo "selected"; ?>> <?= $customer->mobile_no ?> </option>
<?php endforeach; ?>
</select> -->
<select class="form-control" id="donor_mobile" name="donor_mobile" required data-toggle="select2">
<option value="">--Select--</option>
<?php if (get_user_role() != 'accounts') : ?>
<option class="blueText" value="0"> + Add a Contributor </option>
<?php endif; ?>
<?php foreach ($uniqueData as $customer) : ?>
<option value="<?= $customer->mobile_no ?>" <?php if ($selected_donor_mobile == $customer->mobile_no) echo "selected"; ?>> <?= $customer->mobile_no ?> </option>
<?php endforeach; ?>
</select>
</div>
<div class="form-group col-md-6">
<label for="donor_first_name" class="col-form-label dfn_label">Donor Name<span class="text-danger"> *</span></label>
<label for="donor_first_name" class="col-form-label dfn_label">Contributor Name<span class="text-danger"> *</span></label>
<select class="form-control" id="donor_first_name" name="donor_id" required data-toggle="select2">
<option value="">--Select--</option>
<?php if (get_user_role() != 'accounts') { ?> <option class="blueText" value="0"> + Add a donor</option><?php } ?>
<?php if (get_user_role() != 'accounts') { ?> <option class="blueText" value="0"> + Add a Contributor</option><?php } ?>
<?php foreach ($typebaseddonors as $customer) : ?>
<option value="<?= $customer->donor_id ?>" <?php if (isset($receipt_details['donor_id']) && ($receipt_details['donor_id'] == $customer->donor_id)) echo "selected"; ?>>
<?php if ($receipt_type == "individual") : echo $customer->first_name; endif; ?>
@ -123,12 +148,11 @@
</div>
</div>
<div class="form-row">
<div class="form-group col-md-1">
<label for="csname" class="col-form-label">Currency<span class="text-danger"> *</span></label>
<div class="form-group col-md-2">
<label for="currency" class="col-form-label">Currency<span class="text-danger"> *</span></label>
<select class="form-control" id="currency" name="currency" data-toggle="select2" required>
<?php
$currencies = explode(",", $currency[0]['currency']);
$selectedCurrency = isset($receipt_details['currency']) ? $receipt_details['currency'] : '';
$selectedCurrency = isset($receipt_details['currency']) ? (gettype($receipt_details['currency']) == 'string' ? [] :$receipt_details['currency']) : '';
?>
<?php foreach ($currencies as $index => $currencyOption) : ?>
<option value="<?= $currencyOption ?>" <?= ($index === 0 || $selectedCurrency === $currencyOption) ? 'selected' : '' ?>>
@ -137,11 +161,11 @@
<?php endforeach; ?>
</select>
</div>
<div class="form-group col-md-5">
<div class="form-group col-md-4 ">
<label for="csname" class="col-form-label">Amount<span class="text-danger"> *</span></label>
<input type="text" class="form-control" id="org_name_field" name="amount" value="<?= isset($receipt_details['amount']) ? $receipt_details['amount'] : '' ?>" placeholder="Amount" oninput="this.value = this.value.replace(/[^0-9]/g, '')" required maxlength="9" />
<div class="input-group">
<input type="text" class="form-control" id="org_name_field" name="amount" value="<?= isset($receipt_details['amount']) ? $receipt_details['amount'] : '' ?>" placeholder="Amount" oninput="this.value = this.value.replace(/[^0-9]/g, '')" required maxlength="9" aria-describedby="validationTooltipUsernamePrepend"/>
</div>
</div>
<div class="form-group col-md-3">
<label for="invoiceDate" class="col-form-label">Payment Mode<span class="text-danger"> *</span></label>
@ -230,6 +254,7 @@
if (response.success) {
$('#successModal').modal('show');
$('#downloadButton').attr('href', "<?= base_url('generate_invoice_pdf/'); ?>" + response.invoice_id);
$('#successModal').modal('hide');
} else {
// Handle errors or display a different modal for failure
console.log(response.message);
@ -243,10 +268,12 @@
});
$('#closeButton').on('click', function(e) {
e.preventDefault();
var url = "<?php echo base_url('receipt_list'); ?>";
// var url = "<?php echo base_url('receipt_list'); ?>";
var baseUrl = "<?php echo base_url(); ?>";
var url = baseUrl + 'receipt_list';
window.location.href = url;
$('#successModal').modal('hide');
$('#receiptForm')[0].reset();
window.location.href = url;
});
});
</script>
@ -265,7 +292,7 @@
$('.dm_label').find('.text-danger').remove();
} else {
$('#donor_mobile').prop('disabled', false).attr('required', true);
$('.dfn_label').html('Donor Name<span class="text-danger"> *</span>');
$('.dfn_label').html('Contributor Name<span class="text-danger"> *</span>');
if ($('.dm_label').find('.text-danger').length == 0) {
$('.dm_label').append('<span class="text-danger"> *</span>');
}
@ -273,6 +300,7 @@
$('#donor_mobile').on('change', function() {
var Rtype = $('.receipt_type:checked').val();
$('#donor_first_name').html('');
if ($(this).val()) {
if ($(this).val() == '0') {
$('#standard-modal').modal('show');
@ -284,7 +312,7 @@
var selectedMobile = $(this).val();
var options = '<option value="">--Select--</option>';
if(role != 'accounts'){
options += '<option value="0">+ Add a donor</option>';
options += '<option value="0">+ Add a Contributor</option>';
}
// Assuming `data` is an array of objects containing donor information
@ -307,7 +335,7 @@
var Rtype = $('.receipt_type:checked').val();
var options = '<option value="">--Select--</option>';
if(role != 'accounts'){
options += '<option value="0">+ Add a donor</option>';
options += '<option value="0">+ Add a Contributor</option>';
}
// Assuming `data` is an array of objects containing donor information
console.log(donor);
@ -337,7 +365,7 @@
var selectedID = $(this).val();
var options = '<option value="">--Select--</option>';
if(role != 'accounts'){
options += '<option value="0">+ Add a donor</option>';
options += '<option value="0">+ Add a Contributor</option>';
}
// Filter the donors array based on the selectedID
var filter_array = alldonors.filter(function(d) {
@ -386,10 +414,10 @@
}));
if(role != 'accounts'){
$('#donor_mobile').append($('<option>', {
value: "0",text: "+ Add a donor"
value: "0",text: "+ Add a Contributor"
}));
$('#donor_first_name').append($('<option>', {
value: "0",text: "+ Add a donor"
value: "0",text: "+ Add a Contributor"
}));
}
@ -499,14 +527,12 @@
$('#org_name_fie').prop('required', true);
$('#pan_no_org').prop('required', true);
$('#org_reg_details').prop('required', true);
$('#pan_no').prop('required', false);
$('#ind_pan').hide();
} else {
$('#org_details_form').hide();
$('#org_name_fie').prop('required', false);
$('#pan_no_org').prop('required', false);
$('#org_reg_details').prop('required', false);
$('#pan_no').prop('required', true);
$('#ind_pan').show();
}
})
@ -519,7 +545,7 @@
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<h4 class="modal-title" id="standard-modalLabel">Add Donor</h4>
<h4 class="modal-title" id="standard-modalLabel">Add Contributor</h4>
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
</div>
<div class="modal-body">
@ -530,7 +556,7 @@
<div class="form-row">
<div class="form-group col-md-12">
<label for="DonorType" class="col-form-label">Donor Type<span class="text-danger"> *</span></label>
<label for="DonorType" class="col-form-label">Contributor Type<span class="text-danger"> *</span></label>
<select class="form-control" id="DonorType" name="DonorType" required>
<option value="">--Select--</option>
<?php $typeArr = array('individual', 'organization');
@ -591,8 +617,8 @@
<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 onchange="checkExisting(this,'pan_no','pan_no')"/>
<label for="pan_no" class="col-form-label">PAN Number</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)" 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>
@ -665,13 +691,14 @@
$('.dm_label').find('.text-danger').remove();
} else {
$('#donor_mobile').prop('disabled', false).attr('required', true);
$('.dfn_label').html('Donor Name<span class="text-danger"> *</span>');
$('.dfn_label').html('Contributor Name<span class="text-danger"> *</span>');
if ($('.dm_label').find('.text-danger').length == 0) {
$('.dm_label').append('<span class="text-danger"> *</span>');
}
}
$('#donor_mobile').val("");
$('#donor_first_name').val("");
var uniqueMobiles = [];
$.ajax({
type: "POST",
url: "<?= base_url() . 'get_donor_details' ?>",
@ -687,7 +714,7 @@
}));
$('#donor_mobile').append($('<option>', {
value: "0",
text: "+ Add a donor"
text: "+ Add a Contributor"
}));
$('#donor_first_name').empty().append($('<option>', {
value: "",
@ -695,13 +722,20 @@
}));
$('#donor_first_name').append($('<option>', {
value: "0",
text: "+ Add a donor"
text: "+ Add a Contributor"
}));
$.each(donor, function(k, v) {
$('#donor_mobile').append($('<option>', {
value: v.mobile_no,
text: v.mobile_no
}));
// $('#donor_mobile').append($('<option>', {
// value: v.mobile_no,
// text: v.mobile_no
// }));
if(uniqueMobiles.indexOf(v.mobile_no) === -1) {
uniqueMobiles.push(v.mobile_no);
$('#donor_mobile').append($('<option>', {
value: v.mobile_no,
text: v.mobile_no
}));
}
if (option == 'organization') {
$('#donor_first_name').append($('<option>', {
value: v.donor_id,text: v.org_name+' - '+v.pan_no
@ -754,4 +788,5 @@
}
});
}
</script>
</script>
<!-- <script src="<?= base_url() . "public/assets/js/pages/form-advanced.init.js" ?>"></script> -->

View File

@ -10,12 +10,14 @@
<div class="float-right">
<div id="checkAll" style="display:none;">
<span id="totalAmt" style="margin-right:30px;"></span>
<button type="button" class="btn btn-secondary" id="multi_success">Accept</button>
<button type="button" class="btn btn-success" id="multi_success">Accept</button>
<button type="button" class="btn btn-danger" data-toggle="modal" data-target="#delete-all-modal">Reject</button>
</div>
<div id="addDonorBtn">
<?php if(get_user_role() != 'accounts') { ?>
<a href="<?= base_url() . "new_receipt/0"; ?>" class="btn btn-primary"><i class="ri-currency-line"></i> Add Receipt </a>
<a href="<?= base_url() . "export_receipt"; ?>" class="btn btn-info"><i class="ri-file-excel-2-fill"></i> Export Receipt </a>
<!-- <button type="button" class="btn btn-secondary" data-toggle="modal" data-target="#import-receipt-modal"><i class="ri-file-excel-2-line"></i> Import Receipt</button> -->
<?php } ?>
</div>
</div>
@ -68,39 +70,21 @@
<td><?= $row['receipt_number']; ?></td>
<td><?= date("d-m-Y", strtotime($row['receipt_date'])); ?> </td>
<td><?= $row['created_name']; ?></td>
<td>
<?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'] ?>">
<?php
$currencySymbol = '';
switch ($row['currency']) {
case 'Rs':
$currencySymbol = '₹'; // Rupees symbol
break;
case 'USD':
$currencySymbol = '$'; // Dollar symbol
break;
case 'EUR':
$currencySymbol = '€'; // Euro symbol
break;
case 'INR':
$currencySymbol = '₹';
break;
default:
$currencySymbol = ''; // Default to empty string if no match
break;
}
echo $currencySymbol . ' ' . $row['amount'];
?>
</td>
<?php $donor = '';
foreach ($Donors as $DonorData) {
if ($row['donor_id'] === $DonorData->donor_id) {
$suffix = "";
if ($row['receipt_type'] == "organization" ) {
$suffix = !empty($DonorData->org_name) ? " (" . $DonorData->org_name . ")" : " (-)";
}
$donor = $DonorData->first_name . ' ' . $DonorData->last_name . $suffix;
break;
}
} ?>
<td><?= $donor; ?></td>
<td id="<?= $row['receipt_id'] ?>">
<?= $row['amount'].'('.$row['currency'].')'; ?>
</td>
<!-- Assuming this is the cell where you want to display payment_mode -->
<td>
@ -250,7 +234,9 @@ function totalAmt() {
sum = 0;
for (const checkbox of $('.select-checkbox:checked')) {
const id = $(checkbox).val();
sum = parseInt($('#'+id).html()) + sum;
var string = $('#'+id).html();
var number = string.replace(/\D/g, '');
sum = parseInt(number) + sum;
}
$('#totalAmt').html('Total selected amount: <b>'+sum+'</b>');
}
@ -388,4 +374,76 @@ $(document).ready(function() {
</div>
</div><!-- /.modal-content -->
</div><!-- /.modal-dialog -->
</div><!-- /.modal -->
</div><!-- /.modal -->
<!-- import modal -->
<div id="import-receipt-modal" class="modal fade" tabindex="-1" role="dialog" aria-labelledby="import-receipt-label" aria-hidden="true">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<h4 class="modal-title" id="import-receipt-label">Import Receipt</h4>
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
</div>
<form id="form-upload">
<div class="modal-body">
<div class="form-group col-md-12">
<label for="control-label">Choose File <small class="text-danger">*</small></label>
<input type="file" class="form-control" style="border: 0px !important; " id="file" name="file" placeholder="csv,xlsx files" accept=".csv, application/vnd.openxmlformats-officedocument.spreadsheetml.sheet,
application/vnd.ms-excel" required />
<span class="help-block"><small>Upload xlsx or csv file only.</small></span>
</div>
<div class="form-group">
<div class="text-center">
<div class="upload-loader" style="display: none; ">
<i class="fa fa-spinner fa-spin"></i> <small>Please wait ...</small>
</div>
<div class="result"></div>
</div>
</div>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-light" data-dismiss="modal">Close</button>
<button type="submit" class="btn btn-primary" id="btn-upload">Upload</button>
</div>
</form>
</div><!-- /.modal-content -->
</div><!-- /.modal-dialog -->
</div><!-- /.modal -->
<script>
$(document).ready(function(){
$('#form-upload').on('submit', function(event) {
event.preventDefault(); // Prevent default form submission
var formData = new FormData($('#form-upload')[0]);
$.ajax({
type: "POST",
url: "<?= base_url() . 'import_receipt' ?>",
data: formData,
contentType: false,
processData: false,
beforeSend: function() {
$("#btn-upload").prop('disabled', true);
$(".upload-loader").show();
},
success: function(result) {
$("#btn-upload").prop('disabled', false);
if($.isEmptyObject(result.error_message)) {
$(".result").html(result.success_message).css("color", "green");
} else {
$(".result").html(result.error_message).css("color", "red");
}
$("#form-upload")[0].reset();
$(".upload-loader").hide();
setTimeout(function() {
$("#import-receipt-modal").dialog("close");
refreshPage();
}, 10000); // 10000 milliseconds = 10 seconds
}
});
});
});
</script>

View File

@ -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_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>
<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 ? "Mobile No: ".$data->org_mobile.", ":""; ?> <?= $data->org_email ? "Email: ".$data->org_email.", <br>":""; ?>
<?= $data->org_pan ? "PAN No: ".$data->org_pan.", ":""; ?> <?= $data->org_reg_no ? "Registered No: ".$data->org_reg_no:""; ?></p>
</td>
</tr>
<tr style="height: 18px;">
@ -93,20 +93,38 @@
</td>
</tr>
<tr style="height: 18px;">
<td style="width: 50% !important; height: 18px; text-align: left;border: none;"><strong>Receipt:</strong>&nbsp;<?=$data->receipt_number?></td>
<td style="width: 50% !important; height: 18px; text-align: left;border: none;"><strong>Receipt Number:</strong>&nbsp;<?=$data->receipt_number?></td>
<td style="width: 49% !important; height: 18px; text-align: right;border: none;"><strong>Date:</strong>&nbsp; <?=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 . ($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>
<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 <b><?= $currency ?> <?= $currency_in_words ? $currency_in_words.' Only' :'' ?></b> (<?= $currency ?>.<?= $data->amount ?>), 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>&nbsp; <?= $staff_name ?></td>
<td style="width: 69.4882%; height: 18px;text-align: right;border: none;"> <?php if($signature && file_exists(ROOTPATH."public/uploads/".$signature)) { ?><img src="<?= base_url()."public/uploads/".$signature ?>" width="100px" alt="Signature"><?php }else { echo "Signature"; } ?></td>
<tr>
</tr><td style="width: 30.5118%; height: 18px;"></td></tr>
<tr style="height: 18px;">
<td style="width: 100%; height: 18px; text-align: center;border: none;padding:30px 0px 0px 0px;font-size: 9px;border-top: 1px solid #ccc;" colspan="2"><strong>Note:</strong>&nbsp;<?= $Notes ?></td>
<tr>
<td style="border: none;padding:5px;border-top: 1px solid #ccc;" colspan="2"></td>
</tr>
<?php if($eightyG != "") { ?>
<tr style="height: 0px; padding:0px;">
<td style="width: 30.5118%;border: none; font-size: 9px;"><strong>80G Registration No:</strong>&nbsp; <?= $eightyG ?></td>
<td style="width: 69.4882%;border: none; font-size: 9px;text-align: right;"> <?php if($eightyGVaildUpto) { ?> <strong>Valid Upto: </strong> &nbsp; <?= date("d-m-Y", strtotime($eightyGVaildUpto)) ?><?php } ?></td>
<tr>
<?php } ?>
<?php if($twelveAA != "") { ?>
<tr style="height: 0px; padding:0px;">
<td style="width: 30.5118%;border: none; font-size: 9px;"><strong>12AA Registration No:</strong>&nbsp; <?= $twelveAA ?></td>
<td style="width: 69.4882%;border: none; font-size: 9px; text-align: right;"> <?php if($twelveAAVaildUpto) { ?> <strong>Valid Upto: </strong> &nbsp; <?= date("d-m-Y", strtotime($twelveAAVaildUpto)) ?><?php } ?></td>
<tr>
<?php } ?>
<?php if($Notes != "") { ?>
<tr style="height: 0px; padding:1px;">
<td style="width: 100%; text-align: center;border: none;font-size: 9px; " colspan="2">
<strong>Note:</strong>&nbsp;<?= $Notes ?></td>
</tr>
<?php } ?>
</tbody>
</table>
</div>

View File

@ -147,7 +147,10 @@
// Automatically close both success and error messages after 5 seconds (5000 milliseconds)
setTimeout(function() {
document.querySelectorAll('.alert').forEach(function(alert) {
alert.classList.add('d-none');
// alert.classList.add('d-none');
if (!alert.classList.contains('remainder')) { // Exclude alerts with the class "remainder"
alert.classList.add('d-none');
}
});
}, 5000); // Adjust the time (in milliseconds) as needed

View File

@ -13,7 +13,7 @@
<!-- plugin css -->
<link href="<?= base_url()."public/assets/libs/multiselect/css/multi-select.css" ?>" rel="stylesheet" type="text/css" />
<link href="<?= base_url()."public/assets/libs/select2/css/select2.min.css" ?>" rel="stylesheet" type="text/css" />
<link href="<?= base_url() . "public//assets/libs/sweetalert2/sweetalert2.min.css" ?>" rel="stylesheet" type="text/css" /> <!-- <link href="<?= base_url()."public/assets/libs/selectize/css/selectize.bootstrap3.css" ?>" rel="stylesheet" type="text/css" /> -->
<link href="<?= base_url() . "public/assets/libs/sweetalert2/sweetalert2.min.css" ?>" rel="stylesheet" type="text/css" /> <!-- <link href="<?= base_url()."public/assets/libs/selectize/css/selectize.bootstrap3.css" ?>" rel="stylesheet" type="text/css" /> -->
<!-- third party css -->
<link href="<?= base_url()."public/assets/libs/datatables.net-bs4/css/dataTables.bootstrap4.min.css" ?>" rel="stylesheet" type="text/css" />
@ -40,7 +40,9 @@
<link href="<?= base_url()."public/assets/libs/summernote/summernote-bs4.min.css" ?>" rel="stylesheet" type="text/css" />
<script src="https://code.jquery.com/jquery-3.6.0.min.js"></script>
</head>
<style>
.debug-bar-ndisplay {display: none !important;}
</style>
<body class="loading">
<!-- Begin page -->
@ -53,23 +55,23 @@
<div class="logo-box">
<a href="dashboard" class="logo logo-dark text-center">
<span class="logo-sm">
<img src="<?= $favicon;; ?>" alt="<?= $company_short_name; ?>" height="24">
<img src="<?= $favicon;; ?>" alt="<?= $company_short_name; ?>" height="50">
<!-- <span class="logo-lg-text-light">Minton</span> -->
</span>
<span class="logo-lg">
<img src="<?= $company_logo_large; ?>" alt="<?= $company_name; ?>" height="50">
<img src="<?= $company_logo_large; ?>" alt="<?= $company_name; ?>" height="70">
<!-- <img src="<?= base_url()."public/uploads/default.png" ?>" alt="<?= $company_name; ?>" height="20"> -->
<!-- <span class="logo-lg-text-light">M</span> -->
</span>
</a>
<a href="dashboard" class="logo logo-light text-center">
<span class="logo-sm">
<img src="<?= $favicon;; ?>" alt="<?= $company_short_name; ?>" height="24">
<span class="logo-sm" style="background: white;">
<img src="<?= $favicon; ?>" alt="<?= $company_short_name; ?>" height="50">
</span>
<span class="logo-lg">
<span class="logo-lg" style="background: white;">
<!-- <img src="<?= base_url()."public/uploads/default.png" ?>" alt="<?= $company_name; ?>" height="24"> -->
<img src="<?= $company_logo_large; ?>" alt="<?= $company_name; ?>" height="50">
<img src="<?= $company_logo_large; ?>" alt="<?= $company_name; ?>" height="70">
</span>
</a>
</div>

View File

@ -14,7 +14,15 @@
</form>
</div>
</li>
<!-- <li class="dropdown d-none d-lg-inline-block">
<a class="nav-link dropdown-toggle waves-effect waves-light" href="#" role="button" aria-haspopup="false" aria-expanded="false">
<?php $reminder_count = session()->getFlashdata('count');
if($reminder_count>1){ ?>
<span class="badge badge-danger rounded-circle noti-icon-badge"><?php echo $reminder_count; ?></span>
<?php }?>
</a>
</li> -->
<!-- <li class="dropdown d-none d-lg-inline-block">
<a class="nav-link dropdown-toggle arrow-none waves-effect waves-light" data-toggle="fullscreen" href="#">
<i class="fe-maximize noti-icon"></i>
@ -56,6 +64,60 @@
</div>
</li>
<li class="dropdown notification-list topbar-dropdown">
<!-- <a class="nav-link dropdown-toggle waves-effect waves-light" data-toggle="dropdown" href="#" role="button" aria-haspopup="false" aria-expanded="false">
<i class="fe-bell noti-icon"></i>
<?php // $reminder_messages = session()->getFlashdata('reminder');
// $reminder_count = count($reminder_messages);
// if((int)$reminder_count > 0){ ?>
<span class="badge badge-danger rounded-circle noti-icon-badge"><?php echo $reminder_count; ?></span>
<?php // } ?>
</a> -->
<div class="dropdown-menu dropdown-menu-right dropdown-lg">
<!-- item-->
<div class="dropdown-item noti-title">
<h5 class="m-0">
<!-- <span class="float-right">
<a href="" class="text-dark">
<small>Clear All</small>
</a>
</span>Notification -->
Reminder
</h5>
</div>
<div class="noti-scroll" data-simplebar>
<?php
$reminder_messages = session()->getFlashdata('reminder');
if(!empty($reminder_messages)): ?>
<?php foreach ($reminder_messages as $message): ?>
<a href="javascript:void(0);" class="dropdown-item notify-item active">
<div class="notify-icon bg-soft-primary text-primary">
<i class="mdi mdi-comment-processing-outline"></i>
</div>
<p class="notify-details"></p>
<p class="text-muted mb-0 user-msg">
<small class="text-muted"><?=$message?></small>
</p>
</a>
<?php endforeach; ?>
<?php else: ?>
<a href="javascript:void(0);" class="dropdown-item notify-item active">
<small class="text-muted"><center><?php echo "No Reminder Message Available :) "?></center></small>
</a>
<?php endif; ?>
</div>
<!-- All-->
<a href="javascript:void(0);" class="dropdown-item text-center text-primary notify-item notify-all">
<!-- View all
<i class="fe-arrow-right"></i> -->
</a>
</div>
</li>
<li class="dropdown notification-list topbar-dropdown">
<a class="nav-link dropdown-toggle nav-user mr-0 waves-effect waves-light" data-toggle="dropdown" href="#" role="button" aria-haspopup="false" aria-expanded="false">
@ -115,23 +177,23 @@
<div class="logo-box">
<a href="dashboard" class="logo logo-dark text-center">
<span class="logo-sm">
<img src="<?= $company_logo_small; ?>" alt="<?= $company_short_name; ?>" height="24">
<img src="<?= $company_logo_small; ?>" alt="<?= $company_short_name; ?>" height="50">
<!-- <span class="logo-lg-text-light">Minton</span> -->
</span>
<span class="logo-lg">
<img src="<?= $company_logo_large; ?>" alt="<?= $company_name; ?>" height="50">
<img src="<?= $company_logo_large; ?>" alt="<?= $company_name; ?>" height="70">
<!-- <img src="<?= base_url()."public/uploads/default.png" ?>" alt="<?= $company_name; ?>" height="20"> -->
<!-- <span class="logo-lg-text-light">M</span> -->
</span>
</a>
<a href="dashboard" class="logo logo-light text-center">
<span class="logo-sm">
<img src="<?= $company_logo_small; ?>" alt="<?= $company_short_name; ?>" height="24">
<span class="logo-sm" style="background: white;">
<img src="<?= $company_logo_small; ?>" alt="<?= $company_short_name; ?>" height="50">
</span>
<span class="logo-lg">
<span class="logo-lg" style="background: white;">
<!-- <img src="<?= base_url()."public/uploads/default.png" ?>" alt="<?= $company_name; ?>" height="24"> -->
<img src="<?= $company_logo_large; ?>" alt="<?= $company_name; ?>" height="50">
<img src="<?= $company_logo_large; ?>" alt="<?= $company_name; ?>" height="70">
</span>
</a>
</div>

View File

@ -3,6 +3,7 @@
<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') ?>
@ -11,6 +12,15 @@
</button>
</div>
<?php endif; ?>
<?php if (session()->getFlashdata('error')) : ?>
<div class="alert alert-danger alert-dismissible fade show" role="alert">
<?= session('error') ?>
<button type="button" class="close" data-dismiss="alert" aria-label="Close">
<span aria-hidden="true">&times;</span>
</button>
</div>
<?php endif; ?>
<?php endif; ?>
<form class="parsley-examples" action="<?= base_url() . "insert_users"; ?>" method="post" enctype="multipart/form-data" id="myForm">
<div class="form-group">
<div class="form-row">
@ -23,29 +33,42 @@
<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">
<?php $role = isset($details['role']) ? $details['role'] : "" ;
if($role !== 'sadmin'){ ?>
<div class="form-group col-md-4">
<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');
<?php $roleArr = array('admin', 'accounts', 'auditor','volunteer');
foreach ($roleArr as $value) {
$selected = (isset($details['role']) && $details['role'] === $value) ? "selected" : "";
$selected = ($role === $value) ? "selected" : "";
?>
<option value="<?php echo $value; ?>" <?php echo $selected; ?>><?php echo ucfirst($value); ?></option>
<?php } ?>
</select>
</div>
</div>
<?php }else{ ?>
<input type="hidden" class="form-control" id="role" name="role" placeholder="Role" value="sadmin">
<?php } ?>
</div>
<?php if ($loggedin_person_role === 'sadmin') { ?>
<div class="form-row">
<div class="form-group col-md-6">
<label for="business_id" class="col-form-label">Organization <span class="text-danger">*</span></label>
<select id="business_id" name="business_id" class="form-control" required>
<?php foreach ($organzation_details as $business) { ?>
<!-- <?php foreach ($organzation_details as $business) { ?>
<option value="<?= $business['business_id']; ?>" <?= isset($details['business_id']) && ($details['business_id'] == $business['business_id']) ? 'selected' : '' ?>>
<?= $business['title']; ?>
</option>
<?php } ?>
<?php } ?> -->
<option value="">--Select--</option>
<?php foreach ($organzation_details as $business): ?>
<option value="<?= $business['business_id']; ?>"
<?= isset($details['business_id']) && ($details['business_id'] == $business['business_id']) ? 'selected' : '' ?>
<?= $business['isactive'] != 1 ? 'disabled' : '' ?>>
<?= $business['title'].($business['isactive'] != 1 ? ' (disabled)' : ''); ?>
</option>
<?php endforeach; ?>
</select>
</div>
<div class="form-group col-md-6">

View File

@ -78,13 +78,15 @@
</td>
<td>
<a href="<?= $edit_page_route; ?>" class="edit-button" title="Click to Edit User" ><i class="ri-pencil-line"></i></a>
<?php if(get_user_role() != 'auditor') {
if($row['isactive'] == 1) { ?>
<a href="#" class="delete-button" title="Click to In-Active User"><i class="ri-delete-bin-line"></i></a>
<?php } else {?>
<a href="<?php echo "activate_user/".$row['user_id']; ?>" class="fe-user-check" title="Click to Active User" ></a>
<?php }
}?>
<?php if (get_user_role() != 'auditor'): ?>
<?php if ($row['isactive'] == 1 && $row['role'] != 'sadmin'): ?>
<a href="#" class="delete-button" data-user-id="<?= $row['user_id']; ?>" title="Click to In-Active User">
<i class="ri-delete-bin-line"></i>
</a>
<?php elseif ($row['role'] != 'sadmin'): ?>
<a href="<?= "activate_user/" . $row['user_id']; ?>" class="fe-user-check" title="Click to Active User"></a>
<?php endif; ?>
<?php endif; ?>
</td>
</tr>
<?php endforeach; ?>
@ -108,7 +110,7 @@ $(document).ready(function() {
$(document).ready(function() {
$('.delete-button').click(function(event) {
event.preventDefault();
var user_id = <?php echo $row['user_id']; ?>;
var user_id = $(this).data('user-id');
Swal.fire({
title: "Are you sure?",
text: "You won't be able to revert this!",

View File

@ -12,6 +12,7 @@
"dompdf/dompdf": "^2.0",
"laminas/laminas-escaper": "^2.9",
"mpdf/mpdf": "^8.2",
"phpoffice/phpspreadsheet": "^2.0",
"psr/log": "^1.1"
},
"require-dev": {

1779
composer.lock generated

File diff suppressed because it is too large Load Diff

View File

@ -3,7 +3,7 @@
©2008-2020 SpryMedia Ltd - datatables.net/license
*/
(function(h){"function"===typeof define&&define.amd?define(["jquery"],function(E){return h(E,window,document)}):"object"===typeof exports?module.exports=function(E,H){E||(E=window);H||(H="undefined"!==typeof window?require("jquery"):require("jquery")(E));return h(H,E,E.document)}:h(jQuery,window,document)})(function(h,E,H,k){function $(a){var b,c,d={};h.each(a,function(e){if((b=e.match(/^([^A-Z]+?)([A-Z])/))&&-1!=="a aa ai ao as b fn i m o s ".indexOf(b[1]+" "))c=e.replace(b[0],b[2].toLowerCase()),
d[c]=e,"o"===b[1]&&$(a[e])});a._hungarianMap=d}function J(a,b,c){a._hungarianMap||$(a);var d;h.each(b,function(e){d=a._hungarianMap[e];if(d!==k&&(c||b[d]===k))"o"===d.charAt(0)?(b[d]||(b[d]={}),h.extend(!0,b[d],b[e]),J(a[d],b[d],c)):b[d]=b[e]})}function Ea(a){var b=n.defaults.oLanguage,c=b.sDecimal;c&&Fa(c);if(a){var d=a.sZeroRecords;!a.sEmptyTable&&(d&&"No data available in table"===b.sEmptyTable)&&F(a,a,"sZeroRecords","sEmptyTable");!a.sLoadingRecords&&(d&&"Loading..."===b.sLoadingRecords)&&F(a,
d[c]=e,"o"===b[1]&&$(a[e])});a._hungarianMap=d}function J(a,b,c){a._hungarianMap||$(a);var d;h.each(b,function(e){d=a._hungarianMap[e];if(d!==k&&(c||b[d]===k))"o"===d.charAt(0)?(b[d]||(b[d]={}),h.extend(!0,b[d],b[e]),J(a[d],b[d],c)):b[d]=b[e]})}function Ea(a){var b=n.defaults.oLanguage,c=b.sDecimal;c&&Fa(c);if(a){var d=a.sZeroRecords;!a.sEmptyTable&&(d&&"No data available"===b.sEmptyTable)&&F(a,a,"sZeroRecords","sEmptyTable");!a.sLoadingRecords&&(d&&"Loading..."===b.sLoadingRecords)&&F(a,
a,"sZeroRecords","sLoadingRecords");a.sInfoThousands&&(a.sThousands=a.sInfoThousands);(a=a.sDecimal)&&c!==a&&Fa(a)}}function gb(a){A(a,"ordering","bSort");A(a,"orderMulti","bSortMulti");A(a,"orderClasses","bSortClasses");A(a,"orderCellsTop","bSortCellsTop");A(a,"order","aaSorting");A(a,"orderFixed","aaSortingFixed");A(a,"paging","bPaginate");A(a,"pagingType","sPaginationType");A(a,"pageLength","iDisplayLength");A(a,"searching","bFilter");"boolean"===typeof a.sScrollX&&(a.sScrollX=a.sScrollX?"100%":
"");"boolean"===typeof a.scrollX&&(a.scrollX=a.scrollX?"100%":"");if(a=a.aoSearchCols)for(var b=0,c=a.length;b<c;b++)a[b]&&J(n.models.oSearch,a[b])}function hb(a){A(a,"orderable","bSortable");A(a,"orderData","aDataSort");A(a,"orderSequence","asSorting");A(a,"orderDataType","sortDataType");var b=a.aDataSort;"number"===typeof b&&!h.isArray(b)&&(a.aDataSort=[b])}function ib(a){if(!n.__browser){var b={};n.__browser=b;var c=h("<div/>").css({position:"fixed",top:0,left:-1*h(E).scrollLeft(),height:1,width:1,
overflow:"hidden"}).append(h("<div/>").css({position:"absolute",top:1,left:1,width:100,overflow:"scroll"}).append(h("<div/>").css({width:"100%",height:10}))).appendTo("body"),d=c.children(),e=d.children();b.barWidth=d[0].offsetWidth-d[0].clientWidth;b.bScrollOversize=100===e[0].offsetWidth&&100!==d[0].clientWidth;b.bScrollbarLeft=1!==Math.round(e.offset().left);b.bBounding=c[0].getBoundingClientRect().width?!0:!1;c.remove()}h.extend(a.oBrowser,n.__browser);a.oScroll.iBarWidth=n.__browser.barWidth}
@ -142,7 +142,7 @@ b.aaSorting=[];b.aaSortingFixed=[];ya(b);h(m).removeClass(b.asStripeClasses.join
{nTr:null,anCells:null,_aData:[],_aSortData:null,_aFilterData:null,_sFilterRow:null,_sRowStripe:"",src:null,idx:-1};n.models.oColumn={idx:null,aDataSort:null,asSorting:null,bSearchable:null,bSortable:null,bVisible:null,_sManualType:null,_bAttrSrc:!1,fnCreatedCell:null,fnGetData:null,fnSetData:null,mData:null,mRender:null,nTh:null,nTf:null,sClass:null,sContentPadding:null,sDefaultContent:null,sName:null,sSortDataType:"std",sSortingClass:null,sSortingClassJUI:null,sTitle:null,sType:null,sWidth:null,
sWidthOrig:null};n.defaults={aaData:null,aaSorting:[[0,"asc"]],aaSortingFixed:[],ajax:null,aLengthMenu:[10,25,50,100],aoColumns:null,aoColumnDefs:null,aoSearchCols:[],asStripeClasses:null,bAutoWidth:!0,bDeferRender:!1,bDestroy:!1,bFilter:!0,bInfo:!0,bLengthChange:!0,bPaginate:!0,bProcessing:!1,bRetrieve:!1,bScrollCollapse:!1,bServerSide:!1,bSort:!0,bSortMulti:!0,bSortCellsTop:!1,bSortClasses:!0,bStateSave:!1,fnCreatedRow:null,fnDrawCallback:null,fnFooterCallback:null,fnFormatNumber:function(a){return a.toString().replace(/\B(?=(\d{3})+(?!\d))/g,
this.oLanguage.sThousands)},fnHeaderCallback:null,fnInfoCallback:null,fnInitComplete:null,fnPreDrawCallback:null,fnRowCallback:null,fnServerData:null,fnServerParams:null,fnStateLoadCallback:function(a){try{return JSON.parse((-1===a.iStateDuration?sessionStorage:localStorage).getItem("DataTables_"+a.sInstance+"_"+location.pathname))}catch(b){return{}}},fnStateLoadParams:null,fnStateLoaded:null,fnStateSaveCallback:function(a,b){try{(-1===a.iStateDuration?sessionStorage:localStorage).setItem("DataTables_"+
a.sInstance+"_"+location.pathname,JSON.stringify(b))}catch(c){}},fnStateSaveParams:null,iStateDuration:7200,iDeferLoading:null,iDisplayLength:10,iDisplayStart:0,iTabIndex:0,oClasses:{},oLanguage:{oAria:{sSortAscending:": activate to sort column ascending",sSortDescending:": activate to sort column descending"},oPaginate:{sFirst:"First",sLast:"Last",sNext:"Next",sPrevious:"Previous"},sEmptyTable:"No data available in table",sInfo:"Showing _START_ to _END_ of _TOTAL_ entries",sInfoEmpty:"Showing 0 to 0 of 0 entries",
a.sInstance+"_"+location.pathname,JSON.stringify(b))}catch(c){}},fnStateSaveParams:null,iStateDuration:7200,iDeferLoading:null,iDisplayLength:10,iDisplayStart:0,iTabIndex:0,oClasses:{},oLanguage:{oAria:{sSortAscending:": activate to sort column ascending",sSortDescending:": activate to sort column descending"},oPaginate:{sFirst:"First",sLast:"Last",sNext:"Next",sPrevious:"Previous"},sEmptyTable:"No data available",sInfo:"Showing _START_ to _END_ of _TOTAL_ entries",sInfoEmpty:"Showing 0 to 0 of 0 entries",
sInfoFiltered:"(filtered from _MAX_ total entries)",sInfoPostFix:"",sDecimal:"",sThousands:",",sLengthMenu:"Show _MENU_ entries",sLoadingRecords:"Loading...",sProcessing:"Processing...",sSearch:"Search:",sSearchPlaceholder:"",sUrl:"",sZeroRecords:"No matching records found"},oSearch:h.extend({},n.models.oSearch),sAjaxDataProp:"data",sAjaxSource:null,sDom:"lfrtip",searchDelay:null,sPaginationType:"simple_numbers",sScrollX:"",sScrollXInner:"",sScrollY:"",sServerMethod:"GET",renderer:null,rowId:"DT_RowId"};
$(n.defaults);n.defaults.column={aDataSort:null,iDataSort:-1,asSorting:["asc","desc"],bSearchable:!0,bSortable:!0,bVisible:!0,fnCreatedCell:null,mData:null,mRender:null,sCellType:"td",sClass:"",sContentPadding:"",sDefaultContent:null,sName:"",sSortDataType:"std",sTitle:null,sType:null,sWidth:null};$(n.defaults.column);n.models.oSettings={oFeatures:{bAutoWidth:null,bDeferRender:null,bFilter:null,bInfo:null,bLengthChange:null,bPaginate:null,bProcessing:null,bServerSide:null,bSort:null,bSortMulti:null,
bSortClasses:null,bStateSave:null},oScroll:{bCollapse:null,iBarWidth:0,sX:null,sXInner:null,sY:null},oLanguage:{fnInfoCallback:null},oBrowser:{bScrollOversize:!1,bScrollbarLeft:!1,bBounding:!1,barWidth:0},ajax:null,aanFeatures:[],aoData:[],aiDisplay:[],aiDisplayMaster:[],aIds:{},aoColumns:[],aoHeader:[],aoFooter:[],oPreviousSearch:{},aoPreSearchCols:[],aaSorting:null,aaSortingFixed:[],asStripeClasses:null,asDestroyStripes:[],sDestroyWidth:0,aoRowCallback:[],aoHeaderCallback:[],aoFooterCallback:[],

Binary file not shown.