ss
This commit is contained in:
parent
ed734484b8
commit
e1cc9870dd
@ -28,22 +28,22 @@ class Email extends BaseConfig
|
||||
/**
|
||||
* SMTP Server Address
|
||||
*/
|
||||
public string $SMTPHost = 'smtp.sendgrid.net';
|
||||
public string $SMTPHost = 'mail.venbait.in';
|
||||
|
||||
/**
|
||||
* SMTP Username
|
||||
*/
|
||||
public string $SMTPUser = 'apikey';
|
||||
public string $SMTPUser = 'bbone@venbait.in';
|
||||
|
||||
/**
|
||||
* SMTP Password
|
||||
*/
|
||||
public string $SMTPPass = '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';
|
||||
public string $SMTPPass = 'xk!L(N_-R#};';
|
||||
|
||||
/**
|
||||
* SMTP Port
|
||||
*/
|
||||
public int $SMTPPort = 587;
|
||||
public int $SMTPPort = 465;
|
||||
|
||||
/**
|
||||
* SMTP Timeout (in seconds)
|
||||
@ -58,7 +58,7 @@ class Email extends BaseConfig
|
||||
/**
|
||||
* SMTP Encryption. Either tls or ssl
|
||||
*/
|
||||
public string $SMTPCrypto = 'tls';
|
||||
public string $SMTPCrypto = 'ssl';
|
||||
|
||||
/**
|
||||
* Enable word-wrap
|
||||
|
||||
@ -110,6 +110,11 @@ $routes->post("insert_invoice_number_format", "Event::insert_invoice_number_form
|
||||
#Routes for Receipt Routes
|
||||
$routes->get("receipt_list/", "Invoice::index");
|
||||
$routes->get("new_receipt/(:any)", "Invoice::new_receipt/$1");
|
||||
$routes->post("donor_cash_success/", "Invoice::donor_cash_success");
|
||||
$routes->post("donor_cash_delete/", "Invoice::donor_cash_delete");
|
||||
$routes->get("donations_accepted/", "Invoice::donations_accepted");
|
||||
$routes->post("save_donations_accepted/", "Invoice::save_donations_accepted");
|
||||
$routes->get("audit_history", "Invoice::audit_history");
|
||||
|
||||
$routes->post("load_details1/", "Invoice::load_details1/");
|
||||
$routes->post("load_details2/", "Invoice::load_details2/");
|
||||
|
||||
@ -23,6 +23,7 @@ class Books extends BaseController
|
||||
|
||||
$model = new BooksModel();
|
||||
$model->setTable('causes');
|
||||
$data['cause_list'] = $model->getData('donations_accepted',null,null);
|
||||
$data['page_name'] = 'Causes List';
|
||||
$data['details'] = $model->where('causes.business_id', $session_bid)->where('causes.isactive', 1)->findAll();
|
||||
// echo '<pre>';
|
||||
@ -45,9 +46,13 @@ class Books extends BaseController
|
||||
|
||||
if ($id === '0') {
|
||||
$data['page_name'] = 'Add Causes';
|
||||
$where = ['is_active' => 1 ];
|
||||
$data['cause_list'] = $model->getData('donations_accepted',$where,null);
|
||||
$data['details'] = [];
|
||||
} elseif ($id !== '0') {
|
||||
$data['page_name'] = 'Edit Causes';
|
||||
$where = ['is_active' => 1 ];
|
||||
$data['cause_list'] = $model->getData('donations_accepted',$where,null);
|
||||
$data['details'] = $model->where('causes.causes_id', $id)->findAll();
|
||||
|
||||
}
|
||||
@ -68,6 +73,8 @@ class Books extends BaseController
|
||||
|
||||
'name' => $this->request->getPost('name'),
|
||||
'description' => $this->request->getPost('description'),
|
||||
'from_date' => ($this->request->getPost('from_date') != '') ? $this->request->getPost('from_date') : null,
|
||||
'to_date' => ($this->request->getPost('to_date') != '') ? $this->request->getPost('to_date') : null,
|
||||
'business_id'=>$session_bid
|
||||
|
||||
];
|
||||
|
||||
@ -143,7 +143,16 @@ class Customer extends BaseController
|
||||
$this->logger->error("Donor : Err Occur =" . $e->getMessage());
|
||||
session()->setFlashdata('error', 'Message: ' . $e->getMessage());
|
||||
}
|
||||
return redirect()->route('Donor_list');
|
||||
|
||||
if(isset($requestData['new_receipt']))
|
||||
{
|
||||
// return redirect()->route('new_receipt');
|
||||
return redirect()->back();
|
||||
}
|
||||
else
|
||||
{
|
||||
return redirect()->route('Donor_list');
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -4,7 +4,11 @@ namespace App\Controllers;
|
||||
|
||||
use App\Models\EventModel;
|
||||
use App\Models\CustomerModel;
|
||||
use App\Models\SettingsModel;
|
||||
use App\Models\InvoiceModel;
|
||||
use App\Models\BooksModel;
|
||||
use App\Models\AuditHistoryModel;
|
||||
use App\Models\UsersModel;
|
||||
use App\Helpers\NotificationHelper;
|
||||
|
||||
use Mpdf\Mpdf;
|
||||
@ -14,6 +18,14 @@ use Dompdf\Options;
|
||||
|
||||
class Invoice extends BaseController
|
||||
{
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
|
||||
$this->AuditHistoryModel = new AuditHistoryModel();
|
||||
|
||||
}
|
||||
|
||||
## For Invoice Listing..
|
||||
public function index()
|
||||
{
|
||||
@ -38,16 +50,82 @@ class Invoice extends BaseController
|
||||
}
|
||||
}
|
||||
|
||||
public function donations_accepted()
|
||||
{
|
||||
try
|
||||
{
|
||||
helper('session');
|
||||
if (is_session_active()) {
|
||||
$session_role = get_user_role();
|
||||
$session_bid = get_business_id();
|
||||
|
||||
$model = new InvoiceModel();
|
||||
// $where = ['business_id' => (int)get_business_id()];
|
||||
$data['list'] = $model->getData('donations_accepted',null);
|
||||
$data['page_name'] = 'Donations Accepted';
|
||||
// print_r($data);die();
|
||||
$this->render_page('donations_accepted', $data);
|
||||
} else {
|
||||
return redirect()->to('login');
|
||||
}
|
||||
}
|
||||
catch (\Throwable $e)
|
||||
{
|
||||
$this->logger->error("donations_accepted: Err Occur =" . $e->getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
public function save_donations_accepted()
|
||||
{
|
||||
try
|
||||
{
|
||||
helper('session');
|
||||
// print_r($this->request->getPost());die;
|
||||
$model = new InvoiceModel();
|
||||
$list = $model->getData('donations_accepted',null);
|
||||
foreach ($list as $key => $value) {
|
||||
if(in_array($value->id, $this->request->getPost('name')))
|
||||
{
|
||||
$where = ['id' => $value->id ];
|
||||
$data['is_active'] = 1;
|
||||
$upt_data = $model->updateData('donations_accepted', $data, $where);
|
||||
}
|
||||
else
|
||||
{
|
||||
$where = ['id' => $value->id];
|
||||
$data['is_active'] = 0;
|
||||
$upt_data = $model->updateData('donations_accepted', $data, $where);
|
||||
}
|
||||
}
|
||||
session()->setFlashdata('success', 'Causes has been added successfully.');
|
||||
return redirect()->route('donations_accepted');
|
||||
}
|
||||
catch (\Throwable $e)
|
||||
{
|
||||
$this->logger->error("donations_accepted: Err Occur =" . $e->getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
## To Load Invoice ADD/EDIT page...
|
||||
public function new_receipt($id = '0')
|
||||
{
|
||||
helper('session');
|
||||
$model = new InvoiceModel();
|
||||
$bmodel = new BooksModel();
|
||||
$setting_model = new SettingsModel();
|
||||
$where = ['business_id' => (int)get_business_id()];
|
||||
|
||||
$receipt = $model->getData('receipt', $where);
|
||||
$count_receipt_no = (count($receipt) > 0) ? count($receipt) + 1 : 1;
|
||||
// Get customer names for the dropdown, events details, and books details
|
||||
$data['currency'] = $setting_model->select('currency')->where($where)->findAll();
|
||||
$data['customers'] = $model->getData('donor', $where);
|
||||
$data['causes'] = $model->getData('causes', $where);
|
||||
// $data['causes'] = $model->getData('causes', $where);
|
||||
$data['causes'] = $bmodel->select('causes.* , donations_accepted.id as donations_accepted_id , donations_accepted.name as donations_accepted_name')
|
||||
->join('donations_accepted', 'causes.name = donations_accepted.id', 'left')
|
||||
->where('causes.business_id', (int)get_business_id() )
|
||||
->get()->getResult();
|
||||
$data['count_receipt_no'] = $count_receipt_no;
|
||||
$data['campaign'] = $model->getData('campaign', $where);
|
||||
$data['invoice_number_formatting'] = $model->getData('settings', $where);
|
||||
|
||||
if ($id === '0') {
|
||||
@ -57,13 +135,89 @@ class Invoice extends BaseController
|
||||
} elseif ($id !== '0') {
|
||||
$this->logger->info(" Book Invoice: In Edit Details ID = " . $id);
|
||||
$data['page_name'] = 'Edit Receipt Details';
|
||||
$data['receipt_details'] = $model->where(['receipt_id' => $id, 'isactive' => 1])->first();
|
||||
if(get_user_role() == 'accounts')
|
||||
{
|
||||
$data['receipt_details'] = $model->where(['receipt_id' => $id])->first();
|
||||
}
|
||||
else
|
||||
{
|
||||
$data['receipt_details'] = $model->where(['receipt_id' => $id, 'isactive' => 1])->first();
|
||||
}
|
||||
}
|
||||
|
||||
// echo '<pre>';
|
||||
// print_r($data['invoice_number_formatting']);die;
|
||||
$this->render_page('invoice_form', $data);
|
||||
}
|
||||
|
||||
public function donor_cash_success()
|
||||
{
|
||||
helper('session');
|
||||
$model = new InvoiceModel();
|
||||
// echo $this->request->getPost('id');die;
|
||||
$where = ['business_id' => (int)get_business_id(),'receipt_id' => $this->request->getPost('id') ];
|
||||
$data['receipt_header'] = 'Receipt';
|
||||
$data['isactive'] = 1;
|
||||
$updata = $model->getData('receipt', $where);
|
||||
$upt_data = $model->updateData('receipt', $data, $where);
|
||||
|
||||
//**********AUDIT HISTORY*************/
|
||||
$myArray = array();
|
||||
array_push($myArray, $data);
|
||||
$olddata['receipt_header'] = $updata[0]->receipt_header;
|
||||
$olddata['isactive'] = $updata[0]->isactive;
|
||||
$myArray1 = array();
|
||||
array_push($myArray1, $olddata);
|
||||
/************************** */
|
||||
$currentDateTime = date('Y-m-d H:i:s');
|
||||
$audit_data = [
|
||||
'module' => 'receipt',
|
||||
'business_id' => (int)get_business_id(),
|
||||
'is_edit' => 1,
|
||||
'old_data' => json_encode($myArray1),
|
||||
'current_data' => json_encode($myArray),
|
||||
'updated_on' => $currentDateTime,
|
||||
'updated_by' => (int)get_logged_user_id()
|
||||
];
|
||||
$this->AuditHistoryModel->save($audit_data);
|
||||
/************************************* */
|
||||
|
||||
if($upt_data) echo true;
|
||||
else echo false;
|
||||
}
|
||||
|
||||
public function donor_cash_delete()
|
||||
{
|
||||
helper('session');
|
||||
$model = new InvoiceModel();
|
||||
$where = ['business_id' => (int)get_business_id(),'receipt_id' => $this->request->getPost('id') ];
|
||||
$data['isactive'] = 0;
|
||||
$data['receipt_header'] = 'Receipt Deleted';
|
||||
$data['reason'] = $this->request->getPost('reason');
|
||||
$updata = $model->getData('receipt', $where);
|
||||
$upt_data = $model->updateData('receipt', $data, $where);
|
||||
|
||||
//**********AUDIT HISTORY*************/
|
||||
/**get old data for history */
|
||||
$olddata['receipt_number'] = $updata[0]->receipt_number;
|
||||
$myArray = array();
|
||||
array_push($myArray, $olddata);
|
||||
/************************** */
|
||||
$currentDateTime = date('Y-m-d H:i:s');
|
||||
$audit_data = [
|
||||
'module' => 'receipt',
|
||||
'business_id' => (int)get_business_id(),
|
||||
'is_delete' => 1,
|
||||
// 'old_data' => json_encode($myArray1),
|
||||
'current_data' => json_encode($myArray),
|
||||
'updated_on' => $currentDateTime,
|
||||
'updated_by' => (int)get_logged_user_id()
|
||||
];
|
||||
$this->AuditHistoryModel->save($audit_data);
|
||||
/************************************* */
|
||||
|
||||
return redirect()->route('receipt_list');
|
||||
}
|
||||
|
||||
|
||||
## For Ajax Call To Fetch/Retrive All Address Details Based On Customer...
|
||||
@ -114,7 +268,6 @@ class Invoice extends BaseController
|
||||
{
|
||||
$this->logger->info("Invoice: Insert/Update Details");
|
||||
try {
|
||||
|
||||
## Declarions
|
||||
helper('session');
|
||||
$model = new InvoiceModel();
|
||||
@ -127,9 +280,10 @@ class Invoice extends BaseController
|
||||
$data = [
|
||||
'receipt_number' => $this->request->getPost('receipt_number'),
|
||||
'donor_id' => $customer_id,
|
||||
'campaign_id' => (int)$this->request->getPost('campaign_id'),
|
||||
'notes'=>$this->request->getPost('notes'),
|
||||
'receipt_date' => (!empty($receipt_date)) ? date("Y-m-d", strtotime($receipt_date)) : NULL,
|
||||
'amount' => (int)$this->request->getPost('amount'),
|
||||
'amount' => $this->request->getPost('amount'),
|
||||
'payment_mode' => $this->request->getPost('payment_mode'),
|
||||
'payment_ref_no' => $this->request->getPost('payment_ref_no'),
|
||||
'causes_id' => (int)$this->request->getPost('causes_id'),
|
||||
@ -141,6 +295,21 @@ class Invoice extends BaseController
|
||||
$data['created_by'] = (int)get_logged_user_id();
|
||||
if ($model->insert($data, 'invoices')) {
|
||||
$receipt_id = $model->insertID();
|
||||
//**********AUDIT HISTORY*************/
|
||||
$myArray = array();
|
||||
array_push($myArray, $data);
|
||||
$currentDateTime = date('Y-m-d H:i:s');
|
||||
$audit_data = [
|
||||
'module' => 'receipt',
|
||||
'business_id' => (int)get_business_id(),
|
||||
'is_add' => 1,
|
||||
'current_data' => json_encode($myArray),
|
||||
'created_by' => (int)get_logged_user_id(),
|
||||
'updated_on' => $currentDateTime,
|
||||
'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);
|
||||
|
||||
@ -150,8 +319,27 @@ class Invoice extends BaseController
|
||||
}
|
||||
|
||||
} else {
|
||||
/**get old data for history */
|
||||
$where = ['business_id' => (int)get_business_id(), 'receipt_id' => $receipt_id];
|
||||
$olddata = $model->getData('receipt', $where);
|
||||
/************************** */
|
||||
$data['updated_by'] = (int)get_logged_user_id();
|
||||
if ($model->update($receipt_id, $data)) {
|
||||
$newdata = $model->getData('receipt', $where);
|
||||
//**********AUDIT HISTORY***********/
|
||||
$currentDateTime = date('Y-m-d H:i:s');
|
||||
$audit_data = [
|
||||
'module' => 'receipt',
|
||||
'business_id' => (int)get_business_id(),
|
||||
'is_edit' => 1,
|
||||
'old_data' => json_encode($olddata),
|
||||
'current_data' => json_encode($newdata),
|
||||
'updated_on' => $currentDateTime,
|
||||
'updated_by' => (int)get_logged_user_id()
|
||||
];
|
||||
$this->AuditHistoryModel->save($audit_data);
|
||||
/************************************* */
|
||||
|
||||
session()->setFlashdata('success', 'Receipt has been updated successfully.');
|
||||
$this->logger->info("Receipt: has been updated successfully. Updated ID = " . $receipt_id);
|
||||
} else {
|
||||
@ -171,6 +359,33 @@ class Invoice extends BaseController
|
||||
print_r($update_events);
|
||||
$this->update_number_formatting($update_events);}
|
||||
|
||||
// get donor whatsapp no and mail
|
||||
$where = ['donor_id' => (int)$this->request->getPost('donor_id') ,'business_id' => (int)get_business_id()];
|
||||
$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 != '')
|
||||
{
|
||||
$records['recipient_email'] = $donordata[0]->email;
|
||||
$records['subject'] = 'DONOR RECEIPT';
|
||||
$records['description'] = $html;
|
||||
$notification->sendEmail($records);
|
||||
}
|
||||
|
||||
// $template = "Dear " . '$recipient_name' . ",\r\r\n\nYour Invoice has been approved.\n\nDetails:\r\n- Approval Date: " . '$approval_date' . "\r\n- Approved By: " . '$approved_by' . "\r\n- Reference ID: " . '$reference_number' . "\r\n\nBest regards,\n".'$business_name'.",\n".'$business_address'." ".'$business_city'." ".'$business_state'." - ".'$business_postal_code'.".\nCall Us: +91 ".'$business_mobile_no'."\nEmail Us:".'$business_email';
|
||||
|
||||
// // WHATSAPP
|
||||
// $params = (object) Null;
|
||||
// // $params->number = (int)'91' . $donordata[0]->mobile_no;
|
||||
// $params->number = (int)'919677462018';
|
||||
// $params->type = "text";
|
||||
// $params->message = $template;
|
||||
// $params->instance_id = '65C9B978325A2';
|
||||
// $params->access_token = '65c715e797d16';
|
||||
// $whatsapp_result = $notification->sendWhatsAppMessage(SEND_WAAI_URL, "POST", $params);
|
||||
|
||||
} catch (\Exception $e) {
|
||||
$this->logger->error("Receipt: Err Occur =" . $e->getMessage());
|
||||
@ -178,9 +393,81 @@ class Invoice extends BaseController
|
||||
}
|
||||
return redirect()->route('receipt_list');
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
public function audit_history()
|
||||
{
|
||||
helper('session');
|
||||
$model = new InvoiceModel();
|
||||
$usermodel = new UsersModel();
|
||||
$where = ['business_id' => (int)get_business_id()];
|
||||
$data = $model->getData('audit_history', $where);
|
||||
// echo $data[0]->current_data;die;
|
||||
$diff = [];
|
||||
|
||||
foreach ($data as $audit_data) {
|
||||
$arr1 = json_decode($audit_data->current_data, true);
|
||||
$arr2 = json_decode($audit_data->old_data, true);
|
||||
|
||||
$temp_diff = [];
|
||||
|
||||
// Check each key-value pair in arr1
|
||||
foreach ($arr1[0] as $key => $value) {
|
||||
$con = $key != 'created_on' && $key != 'created_by' && $key != 'updated_on' && $key != 'updated_by';
|
||||
if ($audit_data->is_edit == 1 && $arr2[0][$key] !== $value) {
|
||||
$user = $usermodel->select('first_name,last_name')->where('user_id',$audit_data->updated_by)->findAll();
|
||||
if($con){
|
||||
$temp_diff[] = (object) [
|
||||
'key' => $key,
|
||||
'old_value' => $value,
|
||||
'new_value' => $arr2[0][$key],
|
||||
'module' => $audit_data->module,
|
||||
'mode' => 'Update',
|
||||
'updated_by' => $user[0]['first_name'].' '.$user[0]['last_name'],
|
||||
'updated_on' => $audit_data->updated_on
|
||||
];
|
||||
}
|
||||
}
|
||||
else if($con && $audit_data->is_add == 1){
|
||||
// echo $key;die;
|
||||
$user = $usermodel->select('first_name,last_name')->where('user_id',$audit_data->created_by)->findAll();
|
||||
$temp_diff[] = (object) [
|
||||
'key' => '-',
|
||||
'old_value' => '-',
|
||||
'new_value' => 'New Receipt No "'.$arr1[0]['receipt_number'].'" Created',
|
||||
'module' => $audit_data->module,
|
||||
'mode' => 'Create',
|
||||
'updated_by' => $user[0]['first_name'].' '.$user[0]['last_name'],
|
||||
'updated_on' => $audit_data->created_on
|
||||
];
|
||||
break;
|
||||
}
|
||||
else if($con && $audit_data->is_delete == 1){
|
||||
// echo $key;die;
|
||||
$user = $usermodel->select('first_name,last_name')->where('user_id',$audit_data->updated_by)->findAll();
|
||||
$temp_diff[] = (object) [
|
||||
'key' => '-',
|
||||
'old_value' => '-',
|
||||
'new_value' => 'Receipt No "'.$arr1[0]['receipt_number'].'" Deleted',
|
||||
'module' => $audit_data->module,
|
||||
'mode' => 'Delete',
|
||||
'updated_by' => $user[0]['first_name'].' '.$user[0]['last_name'],
|
||||
'updated_on' => $audit_data->created_on
|
||||
];
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
// Add temp_diff to $diff array if it's not empty
|
||||
if (!empty($temp_diff)) {
|
||||
$diff[] = $temp_diff;
|
||||
}
|
||||
}
|
||||
|
||||
// print_r($diff);
|
||||
$response['page_name'] = 'History';
|
||||
$response['data'] = $diff;
|
||||
$this->render_page('audit_history', $response);
|
||||
}
|
||||
|
||||
## For Updating Events Details ..
|
||||
@ -309,39 +596,64 @@ class Invoice extends BaseController
|
||||
}
|
||||
|
||||
|
||||
public function generate_invoice_pdf($id)
|
||||
public function generate_invoice_pdf($id, $dest = null)
|
||||
{
|
||||
// Fetch the receipt data based on $receipt_id
|
||||
$model = new InvoiceModel();
|
||||
$data = $model->getInvoiceData($id);
|
||||
// echo '<pre>';
|
||||
// print_r($data);die;
|
||||
try {
|
||||
// Fetch the receipt data based on $receipt_id
|
||||
$model = new InvoiceModel();
|
||||
$setting_model = new SettingsModel();
|
||||
$where = ['business_id' => (int)get_business_id()];
|
||||
$currency_data = $setting_model->select('currency')->where($where)->findAll();
|
||||
$data = $model->getInvoiceData($id);
|
||||
// Check if data is empty
|
||||
if (!$data || !$currency_data) {
|
||||
throw new Exception('Data not found or empty');
|
||||
}
|
||||
|
||||
$options = new Options();
|
||||
$options->set('isHtml5ParserEnabled', true);
|
||||
$options->set('isPhpEnabled', true);
|
||||
// $options->set('isRemoteEnabled', true);
|
||||
$options->set('font_subsetting', true);
|
||||
|
||||
$dompdf = new Dompdf($options);
|
||||
|
||||
define("DOMPDF_UNICODE_ENABLED", true);
|
||||
|
||||
$options = new Options();
|
||||
$options->set('isHtml5ParserEnabled', true);
|
||||
$options->set('isPhpEnabled', true);
|
||||
$options->set('isRemoteEnabled', true);
|
||||
$options->set('font_subsetting', true);
|
||||
$baseurl = base_url()."public/uploads/".$data[0]->business_logo;
|
||||
$html = view('invoice_pdf_template', ['data' => $data[0],'currency' => $currency_data[0]['currency'] ,'baseurl' => $baseurl]);
|
||||
// echo $html;die;
|
||||
|
||||
$dompdf->loadHtml($html);
|
||||
$dompdf->setPaper('letter', 'landscape');
|
||||
|
||||
$dompdf->render();
|
||||
|
||||
if($dest == 'mail') {
|
||||
// Generate filename based on current date and time
|
||||
// $filename = date('dmYHis') . '.pdf';
|
||||
|
||||
$dompdf = new Dompdf($options);
|
||||
|
||||
define("DOMPDF_UNICODE_ENABLED", true);
|
||||
$html = view('invoice_pdf_template', ['data' => $data[0]]);
|
||||
|
||||
// echo $html; die;
|
||||
|
||||
$dompdf->loadHtml($html, 'UTF-8');
|
||||
$dompdf->setPaper('letter', 'landscape');
|
||||
|
||||
$dompdf->render();
|
||||
|
||||
$output = $dompdf->output();
|
||||
|
||||
$dompdf->stream('document.pdf', ['Attachment' => 1]);
|
||||
// // Save PDF file to a directory
|
||||
// $outputFilePath = base_url() . 'pdf/' . $filename; // Assuming WRITEPATH is defined
|
||||
// file_put_contents($outputFilePath, $dompdf->output());
|
||||
|
||||
// // Provide download link with the generated filename
|
||||
// $downloadLink = base_url() . 'pdf/' . $filename;
|
||||
// echo $downloadLink;die;
|
||||
return $html;
|
||||
}
|
||||
$dompdf->stream('document.pdf', ['Attachment' => 1]);
|
||||
} catch (Exception $e) {
|
||||
// Handle the exception
|
||||
// For example, log the error, display a user-friendly message, or return an error response
|
||||
echo 'Error: ' . $e->getMessage();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
// public function approve_notifications($receipt_id)
|
||||
// {
|
||||
// $model = new InvoiceModel();
|
||||
|
||||
@ -97,6 +97,22 @@ class Users extends BaseController
|
||||
$render_page_name = 'pages_404';
|
||||
}
|
||||
break;
|
||||
|
||||
case "accounts":
|
||||
$where = ['users.user_id' => $id, 'users.isactive =' => 1];
|
||||
$edit_user_details = $model->where($where)->first();
|
||||
$render_page_name = 'user_form';
|
||||
$data['page_name'] = 'Edit User';
|
||||
$data['branches'] = $this->getOrganizationBranches($edit_user_details['business_id']);
|
||||
break;
|
||||
|
||||
case "auditor":
|
||||
$where = ['users.user_id' => $id, 'users.isactive =' => 1];
|
||||
$edit_user_details = $model->where($where)->first();
|
||||
$render_page_name = 'user_form';
|
||||
$data['page_name'] = 'Edit User';
|
||||
$data['branches'] = $this->getOrganizationBranches($edit_user_details['business_id']);
|
||||
break;
|
||||
|
||||
default:
|
||||
$data['page_name'] = 'Page Not Found';
|
||||
@ -299,7 +315,7 @@ class Users extends BaseController
|
||||
$where = ['users.user_id' => $id, 'users.isactive =' => 1];
|
||||
$existingUser = $model->where($where)->find($id);
|
||||
$this->logger->Info("Users: Going to Inactive ID = ".$id);
|
||||
|
||||
// print_r($existingUser);die;
|
||||
if ($existingUser) {
|
||||
$data['isactive'] = 0;
|
||||
$data['updated_by'] = $session_uid;
|
||||
@ -310,7 +326,7 @@ class Users extends BaseController
|
||||
|
||||
|
||||
if ($model->update($id, $data)) {
|
||||
session()->setFlashdata('success', 'Deleted successfully.');
|
||||
session()->setFlashdata('success', 'User Deactivated successfully.');
|
||||
$this->logger->info("Users: has been Inactived successfully. Inactived ID = ".$id);
|
||||
} else {
|
||||
$this->logger->error("Users: Not able to Inactive ID =".$id);
|
||||
@ -339,7 +355,7 @@ class Users extends BaseController
|
||||
$where = ['users.user_id' => $user_id, 'users.isactive =' => 0];
|
||||
$existingUser = $model->where($where)->find($user_id);
|
||||
$this->logger->Info("Users: Going to ActiveUser ID = ".$user_id);
|
||||
|
||||
// print_r($existingUser);die;
|
||||
if ($existingUser) {
|
||||
$data['isactive'] = 1;
|
||||
$data['updated_by'] = $session_uid;
|
||||
|
||||
@ -17,7 +17,7 @@ class NotificationHelper
|
||||
|
||||
public function sendEmail($records)
|
||||
{
|
||||
$this->logger->info('Helper : Email Request Data type = '.gettype($records));
|
||||
$this->logger->info('Helper : Email Request Data type = '.gettype($records));
|
||||
|
||||
$cc = isset($records['carboncopy']) ? $records['carboncopy'] : '';
|
||||
$bcc = isset($records['blindcarboncopy']) ? $records['blindcarboncopy'] : '';
|
||||
@ -29,7 +29,7 @@ class NotificationHelper
|
||||
}
|
||||
$this->email->setTo($records['recipient_email']);
|
||||
$this->logger->info('Helper : Email recipient = '.$records['recipient_email']);
|
||||
$this->email->setFrom('web@vijayabharathambooks.com', isset($records['company'])?$records['company']:"VB");
|
||||
$this->email->setFrom('bbone@venbait.in', "DONOR");
|
||||
$this->email->setSubject($records['subject']);
|
||||
$this->logger->info('Helper : Email subject = '.$records['subject']);
|
||||
$this->email->setMessage($records['description']);
|
||||
|
||||
44
app/Models/AuditHistoryModel.php
Normal file
44
app/Models/AuditHistoryModel.php
Normal file
@ -0,0 +1,44 @@
|
||||
<?php
|
||||
namespace App\Models;
|
||||
use CodeIgniter\Model;
|
||||
class AuditHistoryModel extends Model
|
||||
{
|
||||
protected $table = 'audit_history';
|
||||
protected $primaryKey = 'id';
|
||||
protected $allowedFields = ['module', 'business_id','is_add','is_edit', 'is_delete', 'current_data', 'old_data', 'created_on','created_by','updated_on','updated_by'];
|
||||
|
||||
public function saveData($data, $id = null)
|
||||
{
|
||||
if ($id === null) {
|
||||
// Insert new record
|
||||
return $this->db->table('audit_history')->insert($data);
|
||||
} else {
|
||||
// Update existing record
|
||||
return $this->update($id, $data);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public function getData($table, $where = null,$whereIn = null)
|
||||
{
|
||||
$query = $this->db->table($table);
|
||||
if ($where) {
|
||||
$query->where($where);
|
||||
}
|
||||
if($whereIn){
|
||||
// $query->whereIn($column_name,$missingValues)
|
||||
$query->whereIn($whereIn[0],$whereIn[1]);
|
||||
}
|
||||
return $query->get()->getResult();
|
||||
}
|
||||
|
||||
public function updateData($table, $data, $where)
|
||||
{
|
||||
$this->db->table($table)->update($data, $where);
|
||||
$affected_rows = $this->db->affectedRows();
|
||||
return $affected_rows;
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
@ -5,7 +5,7 @@ class BooksModel extends Model
|
||||
{
|
||||
protected $table = 'causes';
|
||||
protected $primaryKey = 'causes_id';
|
||||
protected $allowedFields = ['causes_id','name','description', 'business_id', 'created_on','created_by','updated_on','updated_by','isactive'];
|
||||
protected $allowedFields = ['causes_id','name','description','from_date', 'to_date', 'business_id', 'created_on','created_by','updated_on','updated_by','isactive'];
|
||||
// protected $allowedFields = ['causes_id','title','cover_picture','publication_date','isbn_code','publisher','category','genre','language','description','page_count','tax','price','created_on','created_by','updated_on','updated_by','isactive','business_id'];
|
||||
|
||||
public function saveData($data, $id = null)
|
||||
|
||||
@ -8,7 +8,7 @@ class InvoiceModel extends Model
|
||||
protected $table = 'receipt';
|
||||
protected $primaryKey = 'receipt_id';
|
||||
// protected $allowedFields = ['invoice_id','invoice_number','donor_id','invoice_date','event_id','business_id','created_on','business_id'];
|
||||
protected $allowedFields = ['receipt_id', 'receipt_number', 'donor_id','notes','amount', 'payment_mode', 'business_id', 'created_on', 'created_by', 'updated_on', 'updated_by','isactive', 'payment_ref_no', 'receipt_date','causes_id'];
|
||||
protected $allowedFields = ['receipt_id', 'receipt_number', 'donor_id','notes','amount', 'payment_mode', 'business_id', 'created_on', 'created_by', 'updated_on', 'updated_by','isactive', 'payment_ref_no', 'receipt_date','causes_id','campaign_id','receipt_header','reason'];
|
||||
|
||||
public function saveInvoiceItemDetails($data){
|
||||
$i = 0;
|
||||
@ -123,8 +123,9 @@ public function updateData($table, $data, $where)
|
||||
return $this->db->table('receipt')
|
||||
->where('receipt_id', $id)
|
||||
->join('donor as C','C.donor_id= receipt.donor_id','left')
|
||||
->join('causes as D','D.causes_id= receipt.causes_id','left')
|
||||
->join('business as B','B.business_id = receipt.business_id','left')
|
||||
->select('receipt.*,concat(C.first_name," ",C.last_name) as customer_name,C.address, C.postal_code,C.city, C.state,C.mobile_no as customer_mobile, C.pan_no as cust_pan_no')
|
||||
->select('receipt.*,concat(C.first_name," ",C.last_name) as customer_name,C.address, C.postal_code,C.city, C.state,C.mobile_no as customer_mobile, C.pan_no as cust_pan_no, D.name as cause_name')
|
||||
->select('B.title ,B.business_logo,B.terms,B.address as org_address ,B.city as org_city,B.state as org_state,B.postal_code as org_zip,B.email as org_email,B.mobile_no as org_mobile, B.pan_no as org_pan, B.org_reg_no, B.signature')
|
||||
->get()
|
||||
->getResult();
|
||||
|
||||
54
app/Views/audit_history.php
Normal file
54
app/Views/audit_history.php
Normal file
@ -0,0 +1,54 @@
|
||||
<div class="row">
|
||||
<div class="col-12">
|
||||
<div class="card">
|
||||
<div class="card-body">
|
||||
<div class="float-right">
|
||||
</div><!-- end col-->
|
||||
<br>
|
||||
<h4 class="header-title mb-3"><?= $page_name; ?></h4>
|
||||
|
||||
<div class="table-responsive">
|
||||
<table id="scroll-horizontal-datatable_customer" class="table w-100 nowrap">
|
||||
<thead class="thead-light">
|
||||
<tr>
|
||||
<th>Action</th>
|
||||
<th>Module</th>
|
||||
<th>Key</th>
|
||||
<th>Old Value</th>
|
||||
<th>New Value</th>
|
||||
<th>Updated By</th>
|
||||
<th>Updated On</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<?php foreach ($data as $audit_data): ?>
|
||||
<?php foreach ($audit_data as $value): ?>
|
||||
<tr>
|
||||
<td><?= $value->mode ?></td>
|
||||
<td><?= $value->module ?></td>
|
||||
<td><?= $value->key ?></td>
|
||||
<td><?= $value->old_value ?></td>
|
||||
<td><?= $value->new_value ?></td>
|
||||
<td><?= $value->updated_by ?></td>
|
||||
<td><?= $value->updated_on ?></td>
|
||||
</tr>
|
||||
<?php endforeach; ?>
|
||||
<?php endforeach; ?>
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
</div>
|
||||
</div> <!-- end card body-->
|
||||
</div> <!-- end card -->
|
||||
</div><!-- end col-->
|
||||
</div>
|
||||
|
||||
<!-- end row-->
|
||||
<script>
|
||||
$(document).ready(function() {
|
||||
$('#scroll-horizontal-datatable_customer').DataTable({
|
||||
"order": [[6, "desc"]] // 4 is the column index of "created_on" in your table
|
||||
// Other DataTables configuration options
|
||||
});
|
||||
});
|
||||
</script>
|
||||
@ -29,13 +29,20 @@
|
||||
<?php if (session()->getFlashdata('success')) : ?>
|
||||
<div class="alert alert-success"><?= session()->getFlashdata('success') ?></div>
|
||||
<?php endif; ?>
|
||||
<form class="needs-validation" novalidate method="post" enctype="multipart/form-data"
|
||||
<form class="needs-validation" id="myForm" novalidate method="post" enctype="multipart/form-data"
|
||||
action="<?= base_url() . "insert_books"; ?>">
|
||||
<div class="form-group">
|
||||
<div class="form-row">
|
||||
<div class="form-group col-md-6">
|
||||
<label for="title" class="col-form-label">Name<span class="text-danger">*</span></label>
|
||||
<input type="text" class="form-control" id="title" name="name" value="<?= isset($details[0]['name']) ? $details[0]['name'] : '' ?>" placeholder="Name of the Causes" required />
|
||||
<!-- <input type="text" class="form-control" id="title" name="name" value="<?= isset($details[0]['name']) ? $details[0]['name'] : '' ?>" placeholder="Name of the Causes" required /> -->
|
||||
|
||||
<select class="form-control" id="name" name="name" required data-toggle="select2">
|
||||
<?php foreach ($cause_list as $val) : ?>
|
||||
<option value="<?= $val->id ?>" <?php if (isset($details[0]['name']) && $details[0]['name'] == $val->id) echo "selected"; ?> > <?= $val->name ?> </option>
|
||||
<?php endforeach; ?>
|
||||
</select>
|
||||
|
||||
<div class="invalid-feedback"> Please provide. </div>
|
||||
</div>
|
||||
|
||||
@ -46,7 +53,22 @@
|
||||
<div class="invalid-feedback"> Please provide. </div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-row">
|
||||
<div class="form-group col-md-6">
|
||||
<label for="from_date" class="col-form-label">From Date</label>
|
||||
<input type="date" class="form-control" id="from_date" name="from_date" value="<?= isset($details[0]['from_date']) ? $details[0]['from_date'] : '' ?>" placeholder="From date" />
|
||||
<!-- <div class="invalid-feedback"> Please provide. </div> -->
|
||||
</div>
|
||||
|
||||
|
||||
<div class="form-group col-md-6">
|
||||
<label for="to_date" class="col-form-label">To Date</label>
|
||||
<input type="date" class="form-control" id="to_date" name="to_date" placeholder="To date" value="<?= isset($details[0]['to_date']) ? $details[0]['to_date'] : '' ?>" />
|
||||
<!-- <div class="invalid-feedback"> Please provide. </div> -->
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<input type="hidden" id="causes_id" name="causes_id" placeholder="hidden for book id" value="<?= isset($details[0]['causes_id']) ? $details[0]['causes_id'] : '' ?>" />
|
||||
<input type="hidden" id="business_id" name="business_id" placeholder="hidden for business id" value="<?= $session_bid ?>" />
|
||||
|
||||
@ -60,9 +82,9 @@
|
||||
<?php } ?>
|
||||
|
||||
<div class="form-group text-right m-b-0">
|
||||
<button class="btn btn-success waves-effect waves-light mr-1" id="submitBtn" type="submit">Submit</button>
|
||||
<button class="btn btn-success waves-effect waves-light mr-1" id="submitBtn" onclick="disableButton()" type="submit">Submit</button>
|
||||
<button type="reset" class="btn btn-primary waves-effect mr-1">Reset</button>
|
||||
<a href="<?= base_url() . "book_list"; ?>" class="btn btn-secondary waves-effect">Cancel</a>
|
||||
<a onclick="history.back()" class="btn btn-secondary waves-effect">Cancel</a>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
@ -70,6 +92,26 @@
|
||||
</div> <!-- end card-->
|
||||
</div> <!-- end col-->
|
||||
</div><!-- end row -->
|
||||
|
||||
<script>
|
||||
$(function() {
|
||||
role = "<?php echo get_user_role() ?>";
|
||||
console.log(role);
|
||||
if(role == "auditor")
|
||||
{
|
||||
// for input
|
||||
var formElements = document.querySelectorAll('#myForm input, #myForm textarea');
|
||||
formElements.forEach(function(element) {
|
||||
element.setAttribute('readonly', true);
|
||||
});
|
||||
// for select
|
||||
var formElements = document.querySelectorAll('#myForm select, #myForm button');
|
||||
formElements.forEach(function(element) {
|
||||
element.setAttribute('disabled', true);
|
||||
});
|
||||
}
|
||||
});
|
||||
</script>
|
||||
<script>
|
||||
document.addEventListener("DOMContentLoaded", function() {
|
||||
const coverPictureInput = documenxt.getElementById("cover_picture");
|
||||
|
||||
@ -49,13 +49,21 @@
|
||||
?>
|
||||
<tr>
|
||||
<td hidden><?php echo $row['causes_id']; ?></td>
|
||||
<td><?php echo $row['name']; ?></td>
|
||||
<td>
|
||||
<?php
|
||||
foreach ($cause_list as $key => $value) {
|
||||
if($row['name'] == $value->id)
|
||||
echo $value->name;
|
||||
}
|
||||
?>
|
||||
</td>
|
||||
<td><?php echo $row['description']; ?></td>
|
||||
<td>
|
||||
|
||||
<a href="<?php echo $edit_page_route; ?>" class="edit-button"> <i class="ri-pencil-line"></i></a>
|
||||
<a href="<?= base_url() . "delete_books/" . $row['causes_id']; ?>" class="delete-button"><i class="ri-delete-bin-line"></i></a>
|
||||
|
||||
<?php if(get_user_role() != 'auditor') { ?>
|
||||
<a href="<?= base_url() . "delete_books/" . $row['causes_id']; ?>" class="delete-button"><i class="ri-delete-bin-line"></i></a>
|
||||
<?php } ?>
|
||||
</td>
|
||||
|
||||
</tr>
|
||||
|
||||
@ -56,7 +56,7 @@
|
||||
<div class="form-row">
|
||||
<div class="form-group col-md-4">
|
||||
<label for="bmobile" class="col-form-label">Organization Mobile Number<span class="text-danger">*</span></label>
|
||||
<input type="text" class="form-control" name="bmobile" value="<?= isset($businesses['mobile_no']) ? $businesses['mobile_no'] : '' ?>" placeholder="Mobile Number (Enter only numbers)" required data-parsley-type="number" maxlength="10" />
|
||||
<input type="tel" class="form-control" name="bmobile" value="<?= isset($businesses['mobile_no']) ? $businesses['mobile_no'] : '' ?>" placeholder="Mobile Number (Enter only numbers)" required data-parsley-type="number" oninput="this.value = this.value.replace(/[^0-9]/g, '')" maxlength="10" />
|
||||
<div class="invalid-feedback"> Please provide. </div>
|
||||
</div>
|
||||
<div class="form-group col-md-4">
|
||||
@ -187,7 +187,7 @@
|
||||
<div class="form-row">
|
||||
<div class="form-group col-md-6">
|
||||
<label for="bfile" class="col-form-label">Organization Logo</label>
|
||||
<input type="file" class="form-control" style="border: 0px !important;" id="bfile" name="bfile" value="<?= isset($businesses['business_logo']) ? $businesses['business_logo'] : null ?>" multiple />
|
||||
<input type="file" class="form-control" style="border: 0px !important;" id="bfile" name="bfile" value="<?= isset($businesses['business_logo']) ? $businesses['business_logo'] : null ?>" accept=".jpg, .png, .gif" multiple />
|
||||
</div>
|
||||
|
||||
|
||||
@ -224,7 +224,7 @@
|
||||
|
||||
<div class="form-group text-right m-b-0">
|
||||
<button class="btn btn-success waves-effect waves-light mr-1" type="submit" id="submitBtn">Submit</button>
|
||||
<button type="reset" class="btn btn-primary waves-effect mr-1">Reset</button><a href="<?= base_url() . "business_list"; ?>" class="btn btn-secondary waves-effect">Cancel</a>
|
||||
<button type="reset" class="btn btn-primary waves-effect mr-1">Reset</button><a href="<?= base_url() . "org_list"; ?>" class="btn btn-secondary waves-effect">Cancel</a>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
|
||||
@ -29,9 +29,10 @@
|
||||
<div class="form-group col-md-4">
|
||||
<label for="DonorType" class="col-form-label">Donor Type<span class="text-danger"> *</span></label>
|
||||
<select class="form-control" id="DonorType" name="DonorType" required>
|
||||
<option value="<?= isset($customer['donor_type']) ? $customer['donor_type'] : '' ?>"><?= isset($customer['donor_type']) ? ($customer['donor_type'] === 'option1' ? 'Individual' : ($customer['donor_type'] === 'option2' ? 'Organization' : 'Select Donor Type')) : 'Select Donor Type'; ?></option>
|
||||
<option value="option1">Individual</option>
|
||||
<option value="option2">Organization</option>
|
||||
<option value="" <?php if(!isset($customer['donor_type'])) { echo 'selected';} ?>>Select Donor Type</option>
|
||||
<option value="option1" <?php if(isset($customer['donor_type']) && $customer['donor_type'] == 'option1') { echo 'selected';} ?> >Individual</option>
|
||||
<option value="option2" <?php if(isset($customer['donor_type']) && $customer['donor_type'] == 'option2') { echo 'selected'; } ?> >Organization</option>
|
||||
</select>
|
||||
</select>
|
||||
<div class="invalid-feedback">Please provide.</div>
|
||||
</div>
|
||||
@ -43,7 +44,7 @@
|
||||
</div>
|
||||
<div class="form-group col-md-4" id="org_name">
|
||||
<label for="csname" class="col-form-label">Organization Reg Details<span class="text-danger"> *</span></label>
|
||||
<input type="text" class="form-control" id="org_reg_details" name="org_reg_Details" value="<?= isset($customer['org_reg_Details']) ? $customer['org_reg_Details'] : '' ?>" placeholder="Organization Reg details"/>
|
||||
<input type="text" class="form-control" id="org_reg_details" name="org_reg_Details" value="<?= isset($customer['org_reg_details']) ? $customer['org_reg_details'] : '' ?>" placeholder="Organization Reg details"/>
|
||||
<div class="invalid-feedback"> Please provide. </div>
|
||||
</div>
|
||||
|
||||
@ -158,7 +159,7 @@
|
||||
|
||||
<button class="btn btn-success waves-effect waves-light mr-1" id="submitBtn" type="submit"><?= isset($customer['donor_id']) ? 'Update' : 'Submit' ?></button>
|
||||
<button type="reset" class="btn btn-primary waves-effect mr-1">Reset</button>
|
||||
<a href="<?= base_url() . "customer_list"; ?>" class="btn btn-secondary waves-effect">Cancel</a>
|
||||
<a onclick="history.back()" class="btn btn-secondary waves-effect">Cancel</a>
|
||||
</div>
|
||||
</form>
|
||||
|
||||
@ -169,7 +170,26 @@
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
<script>
|
||||
// hide all fields for account login
|
||||
$(function() {
|
||||
role = "<?php echo get_user_role() ?>";
|
||||
console.log(role);
|
||||
if(role == "auditor")
|
||||
{
|
||||
// for input
|
||||
var formElements = document.querySelectorAll('#myForm input, #myForm textarea');
|
||||
formElements.forEach(function(element) {
|
||||
element.setAttribute('readonly', true);
|
||||
});
|
||||
// for select
|
||||
var formElements = document.querySelectorAll('#myForm select, #myForm button');
|
||||
formElements.forEach(function(element) {
|
||||
element.setAttribute('disabled', true);
|
||||
});
|
||||
}
|
||||
});
|
||||
</script>
|
||||
<script>
|
||||
document.getElementById('myForm').addEventListener('submit', function(event) {
|
||||
var form = event.target;
|
||||
@ -221,14 +241,18 @@
|
||||
$('.contactPerson').hide();
|
||||
$('#org_reg').hide();
|
||||
let orgName = $('#org_name_field').val()
|
||||
if(orgName !== '' && orgName !== null){
|
||||
|
||||
if($('#DonorType').val() && $('#DonorType').val() == 'option2'){
|
||||
$('#org_reg').show();
|
||||
$('#org_name').show();
|
||||
$('.contactPerson').show();
|
||||
$('#org_reg_details').prop('required', true)
|
||||
$('#org_name_field').prop('required', true);
|
||||
}
|
||||
else{
|
||||
$('#org_name').hide();
|
||||
$('.contactPerson').hide();
|
||||
$('#org_reg_details').prop('required', false)
|
||||
$('#org_name_field').prop('required', false);
|
||||
}
|
||||
|
||||
@ -251,6 +275,8 @@
|
||||
$('#org_name').hide();
|
||||
$('#org_reg').hide();
|
||||
$('.contactPerson').hide();
|
||||
$('#org_name_field').prop('required', false);
|
||||
$('#org_reg_details').prop('required',false);
|
||||
$('#pan_no').prop('required', false); // Add this line to make PAN field required
|
||||
}
|
||||
})
|
||||
|
||||
@ -54,7 +54,9 @@
|
||||
<td>
|
||||
<a href="<?= base_url() . "view_donor_group/" . $group['group_id']; ?>" class="edit-button" title="Edit" ><i class="ri-pencil-line"></i></a>
|
||||
<a class="preview-button" title="Customer list" data-toggle="modal" data-target="#scrollable-modal" data-primary-key="<?php echo $group['group_id']; ?>" data-group-name="<?php echo $group['group_name']; ?>"><i class="ri-pages-line"></i></a>
|
||||
<?php if ($group['isactive']) { ?> <a href="<?= base_url() . "delete_donor_group/" . $group['group_id']; ?>" class="delete-button" title="Delete" ><i class="ri-delete-bin-line"></i></a> <?php } ?>
|
||||
<?php if(get_user_role() != 'auditor') { ?>
|
||||
<?php if ($group['isactive']) { ?> <a href="<?= base_url() . "delete_donor_group/" . $group['group_id']; ?>" class="delete-button" title="Delete" ><i class="ri-delete-bin-line"></i></a> <?php } ?>
|
||||
<?php } ?>
|
||||
</td>
|
||||
</tr>
|
||||
<?php endforeach; ?>
|
||||
|
||||
@ -169,6 +169,26 @@
|
||||
</div>
|
||||
</div>
|
||||
<!-- <script src="https://code.jquery.com/jquery-3.6.0.min.js"></script> -->
|
||||
<script>
|
||||
$(function() {
|
||||
role = "<?php echo get_user_role() ?>";
|
||||
console.log(role);
|
||||
if(role == "auditor")
|
||||
{
|
||||
// for input
|
||||
var formElements = document.querySelectorAll('#myForm input, #myForm textarea');
|
||||
formElements.forEach(function(element) {
|
||||
element.setAttribute('readonly', true);
|
||||
});
|
||||
// for select
|
||||
var formElements = document.querySelectorAll('#myForm select, #myForm button');
|
||||
formElements.forEach(function(element) {
|
||||
element.setAttribute('disabled', true);
|
||||
});
|
||||
}
|
||||
});
|
||||
</script>
|
||||
|
||||
<script>
|
||||
const myArray = [];
|
||||
document.getElementById("addItem").addEventListener("click", function() {
|
||||
|
||||
@ -48,7 +48,9 @@
|
||||
<td><?= $value['email']; ?></td>
|
||||
<td>
|
||||
<a href="<?= "new_Donor/" . $value['donor_id']; ?>" class="edit-button"><i class="ri-pencil-line"></i></a>
|
||||
<a href="<?= "delete_donor/" . $value['donor_id']; ?>" class="delete-button"><i class="ri-delete-bin-line"></i></a>
|
||||
<?php if(get_user_role() != 'auditor') { ?>
|
||||
<a href="<?= "delete_donor/" . $value['donor_id']; ?>" class="delete-button"><i class="ri-delete-bin-line"></i></a>
|
||||
<?php } ?>
|
||||
</td>
|
||||
</tr>
|
||||
<?php endforeach; ?>
|
||||
|
||||
100
app/Views/donations_accepted.php
Normal file
100
app/Views/donations_accepted.php
Normal file
@ -0,0 +1,100 @@
|
||||
<html>
|
||||
|
||||
<head>
|
||||
</head>
|
||||
<style>
|
||||
/* CSS for the preview image */
|
||||
.preview-image {
|
||||
display: block;
|
||||
/* Ensure the image is displayed as a block element */
|
||||
width: 120px;
|
||||
/* Set the desired width for passport size */
|
||||
height: 160px;
|
||||
/* Set the desired height for passport size */
|
||||
object-fit: cover;
|
||||
/* Maintain the aspect ratio and fill the container */
|
||||
margin-top: 10px;
|
||||
/* Add a top margin for spacing */
|
||||
}
|
||||
</style>
|
||||
|
||||
|
||||
|
||||
<div class="row">
|
||||
<div class="col-lg-12">
|
||||
<div class="card">
|
||||
<div class="card-body">
|
||||
<h4 class="header-title"><?= $page_name; ?></h4>
|
||||
<p class="sub-header"> </p>
|
||||
|
||||
<?php if (session()->getFlashdata('success')) : ?>
|
||||
<div class="alert alert-success"><?= session()->getFlashdata('success') ?></div>
|
||||
<?php endif; ?>
|
||||
|
||||
<form class="needs-validation" novalidate method="post" enctype="multipart/form-data"
|
||||
action="<?= base_url() . "save_donations_accepted"; ?>" id="myForm">
|
||||
<div class="form-group">
|
||||
<div class="form-row">
|
||||
<div class="form-group col-md-6">
|
||||
<label for="title" class="col-form-label">Name<span class="text-danger">*</span></label>
|
||||
<select class="form-control" id="name" name="name[]" required data-toggle="select2" multiple>
|
||||
<option value="">--Select--</option>
|
||||
<?php foreach ($list as $val) : ?>
|
||||
<option value="<?= $val->id ?>" <?php if ($val->is_active == 1) echo "selected"; ?> > <?= $val->name ?> </option>
|
||||
<?php endforeach; ?>
|
||||
</select>
|
||||
</div>
|
||||
|
||||
|
||||
<div class="form-group col-md-6"></div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group text-right m-b-0">
|
||||
<button class="btn btn-success waves-effect waves-light mr-1" id="submitBtn" type="submit">Submit</button>
|
||||
<button onclick="history.back()" class="btn btn-secondary waves-effect">Cancel</button>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
</div> <!-- end card-body-->
|
||||
</div> <!-- end card-->
|
||||
</div> <!-- end col-->
|
||||
</div><!-- end row -->
|
||||
|
||||
<script>
|
||||
$(function() {
|
||||
role = "<?php echo get_user_role() ?>";
|
||||
console.log(role);
|
||||
if(role == "auditor")
|
||||
{
|
||||
// for input
|
||||
var formElements = document.querySelectorAll('#myForm input, #myForm textarea');
|
||||
formElements.forEach(function(element) {
|
||||
element.setAttribute('readonly', true);
|
||||
});
|
||||
// for select
|
||||
var formElements = document.querySelectorAll('#myForm select');
|
||||
formElements.forEach(function(element) {
|
||||
element.setAttribute('disabled', true);
|
||||
});
|
||||
|
||||
$('#submitBtn').attr('disabled', true);
|
||||
}
|
||||
else
|
||||
{
|
||||
// for input
|
||||
// var formElements = document.querySelectorAll('#myForm input, #myForm textarea');
|
||||
// formElements.forEach(function(element) {
|
||||
// element.setAttribute('readonly', false);
|
||||
// });
|
||||
// // for select
|
||||
// var formElements = document.querySelectorAll('form select');
|
||||
// formElements.forEach(function(element) {
|
||||
// element.setAttribute('disabled', false);
|
||||
// });
|
||||
}
|
||||
});
|
||||
</script>
|
||||
</body>
|
||||
|
||||
</html>
|
||||
@ -44,7 +44,7 @@
|
||||
<div class="form-group text-right m-b-0">
|
||||
<button class="btn btn-success waves-effect waves-light mr-1" type="submit" id="submitBtn">Submit</button>
|
||||
<button type="reset" class="btn btn-primary waves-effect mr-1">Reset</button>
|
||||
<a href="<?= base_url() . "campaign"; ?>" class="btn btn-secondary waves-effect">Cancel</a>
|
||||
<a onclick="history.back()" class="btn btn-secondary waves-effect">Cancel</a>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
@ -52,6 +52,27 @@
|
||||
</div> <!-- end card-->
|
||||
</div> <!-- end col-->
|
||||
</div><!-- end row -->
|
||||
|
||||
<script>
|
||||
$(function() {
|
||||
role = "<?php echo get_user_role() ?>";
|
||||
console.log(role);
|
||||
if(role == "auditor")
|
||||
{
|
||||
// for input
|
||||
var formElements = document.querySelectorAll('#myForm input, #myForm textarea');
|
||||
formElements.forEach(function(element) {
|
||||
element.setAttribute('readonly', true);
|
||||
});
|
||||
// for select
|
||||
var formElements = document.querySelectorAll('#myForm select, #myForm button');
|
||||
formElements.forEach(function(element) {
|
||||
element.setAttribute('disabled', true);
|
||||
});
|
||||
}
|
||||
});
|
||||
</script>
|
||||
|
||||
<script>
|
||||
document.getElementById('myForm').addEventListener('submit', function(event) {
|
||||
var form = event.target;
|
||||
|
||||
@ -3,22 +3,46 @@
|
||||
width: 249px !important;
|
||||
}
|
||||
</style>
|
||||
<div class="row">
|
||||
<div class="row">
|
||||
<div class="col-lg-12">
|
||||
<div class="card">
|
||||
<div class="card-body">
|
||||
<h4 class="header-title"><?= $page_name; ?></h4>
|
||||
<div class="row">
|
||||
<div class="col-lg-6"><h4 class="header-title"><?= $page_name; ?></h4></div>
|
||||
<div class="col-lg-6 text-right">
|
||||
<?php if(get_user_role() == 'accounts') { ?>
|
||||
<input type="hidden" id="donor_id" value="<?= isset($receipt_details['donor_id']) ? $receipt_details['donor_id'] : '' ?>">
|
||||
<?php if(isset($receipt_details['receipt_header']) && $receipt_details['receipt_header'] != 'Receipt') { ?>
|
||||
<button type="button" class="btn btn-secondary" id="donor_cash_success">Accept</button>
|
||||
<?php } if(isset($receipt_details['receipt_header']) && $receipt_details['receipt_header'] != 'Receipt Deleted') { ?>
|
||||
<button type="button" class="btn btn-danger" data-toggle="modal" data-target="#info-alert-modal">Delete</button>
|
||||
<?php } ?>
|
||||
<?php } ?>
|
||||
|
||||
<?php if(get_user_role() != 'accounts') { ?>
|
||||
<button type="button" class="btn btn-primary" id="add-quk-donar" data-toggle="modal" data-target="#standard-modal">Add Donar</button>
|
||||
<?php } ?>
|
||||
</div>
|
||||
</div>
|
||||
<br>
|
||||
<form method="POST" enctype="multipart/form-data" action="<?= base_url() . "save_invoice"; ?>" id="myForm">
|
||||
<div class="form-group">
|
||||
<div class="form-row">
|
||||
|
||||
<div class="form-group col-md-6">
|
||||
<label for="customerMobile" class="col-form-label">Donor Mobile Name<span class="text-danger"> *</span></label>
|
||||
<select class="form-control" id="donor_mobile" name="donor_mobile" required data-toggle="select2">
|
||||
<option value="">--Select--</option>
|
||||
<?php foreach ($customers 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>
|
||||
</div>
|
||||
|
||||
<div class="form-group col-md-6">
|
||||
<label for="customerName" class="col-form-label">Donor Name<span class="text-danger"> *</span></label>
|
||||
<select class="form-control" id="customerName" name="donor_id" required data-toggle="select2">
|
||||
<option value="">Select a Donor</option>
|
||||
<?php foreach ($customers as $customer) : ?>
|
||||
<option value="<?= $customer->donor_id ?>" <?php if (isset($receipt_details['donor_id']) && ($receipt_details['donor_id'] === $customer->donor_id)) echo "selected"; ?>><?= $customer->first_name . ' ' . $customer->last_name; ?></option>
|
||||
<?php endforeach; ?>
|
||||
<!-- data append from jquery below -->
|
||||
</select>
|
||||
</div>
|
||||
|
||||
@ -26,9 +50,19 @@
|
||||
<label for="event" class="col-form-label">Causes</label>
|
||||
<select class="form-control" id="event" name="causes_id" data-toggle="select2">
|
||||
<option value="">Select the Causes</option>
|
||||
<?php foreach ($causes as $causesData) : ?>
|
||||
<option value="<?= $causesData->causes_id ?>" <?php if (isset($receipt_details['causes_id']) && ($receipt_details['causes_id'] === $causesData->causes_id)) echo "selected"; ?>><?= $causesData->name ?></option>
|
||||
<?php endforeach; ?>
|
||||
<?php foreach ($causes as $causesData) : if(date("Y-m-d") >= $causesData->from_date && date("Y-m-d") <= $causesData->to_date || $causesData->from_date == '' && $causesData->to_date == ''){?>
|
||||
<option value="<?= $causesData->causes_id ?>" <?php if (isset($receipt_details['causes_id']) && ($receipt_details['causes_id'] === $causesData->causes_id)) echo "selected"; ?>><?= $causesData->donations_accepted_name ?> ( <?= $causesData->from_date ?> - <?= $causesData->to_date ?> )</option>
|
||||
<?php } endforeach; ?>
|
||||
</select>
|
||||
</div>
|
||||
|
||||
<div class="form-group col-md-6">
|
||||
<label for="event" class="col-form-label">Source Of Receipt</label>
|
||||
<select class="form-control" id="campaign" name="campaign_id" data-toggle="select2">
|
||||
<option value="">Select the Campaign</option>
|
||||
<?php foreach ($campaign as $cam) : if(date("Y-m-d") >= $cam->start_date && date("Y-m-d") <= $cam->end_date || $cam->start_date == '' && $cam->end_date == ''){?>
|
||||
<option value="<?= $cam->campaign_id ?>" <?php if (isset($receipt_details['campaign_id']) && ($receipt_details['campaign_id'] === $cam->campaign_id)) echo "selected"; ?>><?= $cam->name ?> ( <?= $cam->start_date ?> - <?= $cam->end_date ?> )</option>
|
||||
<?php } endforeach; ?>
|
||||
</select>
|
||||
</div>
|
||||
|
||||
@ -48,12 +82,12 @@
|
||||
|
||||
<div class="form-row">
|
||||
<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"/>
|
||||
<label for="csname" class="col-form-label">Amount in (<?= $currency[0]['currency'] ?>)<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"/ required>
|
||||
</div>
|
||||
<div class="form-group col-md-4">
|
||||
<label for="invoiceDate" class="col-form-label">Payment Mode<span class="text-danger"> *</span></label>
|
||||
<select class="form-control" id="paymentMode" name="payment_mode">
|
||||
<select class="form-control" id="paymentMode" name="payment_mode" required>
|
||||
<option value="<?= isset($receipt_details['payment_mode']) ? $receipt_details['payment_mode'] : null ;?>"><?= isset($receipt_details['payment_mode']) ? $receipt_details['payment_mode'] : 'Select Payment Mode' ; ?></option>
|
||||
<option value="credit">Credit Card</option>
|
||||
<option value="debit">Debit Card</option>
|
||||
@ -77,7 +111,9 @@
|
||||
</div>
|
||||
<input type="hidden" id="hiddenInvoiceId" name="receipt_id" placeholder="hidden for invoice id" value="<?= isset($receipt_details['receipt_id']) ? $receipt_details['receipt_id'] : '' ?>" />
|
||||
<div class="form-group text-right m-b-0">
|
||||
<?php if(get_user_role() != 'accounts') { ?>
|
||||
<button type="submit" class="btn btn-primary waves-effect mr-1" name="saveas" value="Draft" id="saveDraftButton"><?= isset($receipt_details['receipt_id']) ? 'Update' : 'Save' ?></button>
|
||||
<?php } ?>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
@ -86,53 +122,243 @@
|
||||
</div>
|
||||
|
||||
<script>
|
||||
var data = <?php echo json_encode($customers); ?>;
|
||||
var editdata = <?php echo json_encode($receipt_details); ?>;
|
||||
console.log(editdata,'data');
|
||||
|
||||
$(document).ready(function(){
|
||||
|
||||
var custid = "<?= isset($receipt_details['donor_id']) ? $receipt_details['donor_id'] : ""; ?>";
|
||||
var inv_number = "<?= isset($receipt_details['invoice_number']) ? $receipt_details['invoice_number'] : ""; ?>";
|
||||
var invoiceNo = $("#invoiceNumber").val()
|
||||
// console.log(invoiceNo) ;
|
||||
|
||||
if (invoiceNo != '') {
|
||||
$("#invoiceNumber").val(invoiceNo).prop("readonly", true);
|
||||
}else{
|
||||
var numbering_arr = <?php echo json_encode($invoice_number_formatting); ?>;
|
||||
// console.log('numbering_arr', numbering_arr);
|
||||
var filtered_data = $.grep(numbering_arr, function(item) {
|
||||
// console.log(item)
|
||||
return item;
|
||||
});
|
||||
// console.log(filtered_data);
|
||||
var final_sno = generateSerialNumber(filtered_data);
|
||||
// console.log(final_sno);
|
||||
$("#invoiceNumber").val(final_sno).prop("readonly", true);
|
||||
$(function() {
|
||||
// onload function
|
||||
if(editdata) {
|
||||
var selectedMobile = $('#donor_mobile').val();
|
||||
console.log(selectedMobile,'selectedMobiledsf');
|
||||
var options = '<option value="">Select a Donor</option>';
|
||||
|
||||
// Assuming `data` is an array of objects containing donor information
|
||||
for (const donor of data) {
|
||||
if(selectedMobile == donor.mobile_no) {
|
||||
options += `<option value="${donor.donor_id}" ${editdata && editdata.donor_id == donor.donor_id ? 'selected' : ''}>${donor.first_name} ${donor.last_name}</option>`;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
function generateSerialNumber(filtered_data) {
|
||||
|
||||
var next_id_string = filtered_data[0].start_no;
|
||||
var left_pad_string = filtered_data[0].left_pad;
|
||||
var prefix_string = String(filtered_data[0].prefix_format);
|
||||
|
||||
var left_pad_numberic = parseInt(left_pad_string);
|
||||
var next_id_numberic = parseInt(next_id_string);
|
||||
|
||||
var padded_id = next_id_string.padStart(left_pad_numberic, '0');
|
||||
|
||||
var serial_number = prefix_string + '-' + padded_id;
|
||||
next_id_numberic++;
|
||||
$("#hiddenNextId").val(next_id_numberic).prop("readonly", true);
|
||||
|
||||
return serial_number;
|
||||
|
||||
// Assuming you have a select element with the id `#donor_select`
|
||||
$('#customerName').html(options);
|
||||
}
|
||||
|
||||
$('#donor_mobile').on('change', function(){
|
||||
console.log($(this).val());
|
||||
var selectedMobile = $(this).val();
|
||||
var options = '<option value="">Select a Donor</option>';
|
||||
|
||||
// Assuming `data` is an array of objects containing donor information
|
||||
for (const donor of data) {
|
||||
if(selectedMobile == donor.mobile_no) {
|
||||
options += `<option value="${donor.donor_id}" ${editdata && editdata.donor_id == donor.donor_id ? 'selected' : ''}>${donor.first_name} ${donor.last_name}</option>`;
|
||||
}
|
||||
}
|
||||
|
||||
// Assuming you have a select element with the id `#donor_select`
|
||||
$('#customerName').html(options);
|
||||
});
|
||||
});
|
||||
|
||||
$(function() {
|
||||
$('#form-submit').on('click', function(){
|
||||
console.log('edakfibsefui');
|
||||
$('#submitBtn').click();
|
||||
});
|
||||
});
|
||||
|
||||
// accept donor
|
||||
$(function() {
|
||||
$('#donor_cash_success').on('click', function(){
|
||||
$.ajax({
|
||||
type:"post",
|
||||
url: "<?php echo base_url(); ?>/donor_cash_success",
|
||||
data:{ 'id': $('#hiddenInvoiceId').val() },
|
||||
success:function(response)
|
||||
{
|
||||
console.log(response);
|
||||
if(response) window.location.href = "<?php echo base_url(); ?>/receipt_list";
|
||||
else console.log('update failed');
|
||||
}
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
//delete donor
|
||||
$(function() {
|
||||
$('#form-submit').on('click', function(){
|
||||
console.log('edakfibsefui');
|
||||
$('#submitBtn').click();
|
||||
});
|
||||
});
|
||||
|
||||
// hide all fields for account login
|
||||
$(function() {
|
||||
role = "<?php echo get_user_role() ?>";
|
||||
console.log(role);
|
||||
if(role == "accounts" || role == "auditor")
|
||||
{
|
||||
// for input
|
||||
var formElements = document.querySelectorAll('#myForm input, #myForm textarea');
|
||||
formElements.forEach(function(element) {
|
||||
element.setAttribute('readonly', true);
|
||||
});
|
||||
// for select
|
||||
var formElements = document.querySelectorAll('#myForm select');
|
||||
formElements.forEach(function(element) {
|
||||
element.setAttribute('disabled', true);
|
||||
});
|
||||
|
||||
$('#add-quk-donar').attr('disabled', true);
|
||||
}
|
||||
else
|
||||
{
|
||||
// for input
|
||||
// var formElements = document.querySelectorAll('#myForm input, #myForm textarea');
|
||||
// formElements.forEach(function(element) {
|
||||
// element.setAttribute('readonly', false);
|
||||
// });
|
||||
// // for select
|
||||
// var formElements = document.querySelectorAll('form select');
|
||||
// formElements.forEach(function(element) {
|
||||
// element.setAttribute('disabled', false);
|
||||
// });
|
||||
}
|
||||
});
|
||||
|
||||
$(document).ready(function(){
|
||||
var invoiceNo = $("#invoiceNumber").val()
|
||||
if (invoiceNo != '') {
|
||||
$("#invoiceNumber").val(invoiceNo).prop("readonly", true);
|
||||
}else{
|
||||
var final_sno = "<?php
|
||||
$lastYear = date('Y') - 1;
|
||||
$currentYear = date('y');
|
||||
echo $lastYear.'-'.$currentYear.'/'.$count_receipt_no;
|
||||
?>";
|
||||
|
||||
// console.log(final_sno);
|
||||
$("#invoiceNumber").val(final_sno).prop("readonly", true);
|
||||
}
|
||||
});
|
||||
|
||||
function restriction(event) {
|
||||
var charCode = event.which || event.keyCode;
|
||||
if ((charCode >= 48 && charCode <= 57)) {
|
||||
return true;
|
||||
} else {
|
||||
event.preventDefault(); // Prevent the character from being entered
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
</script>
|
||||
|
||||
<!-- Standard modal content -->
|
||||
<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">Add Donar</h4>
|
||||
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
|
||||
</div>
|
||||
<div class="modal-body">
|
||||
<form class="needs-validation" novalidate method="POST" enctype="multipart/form-data" action="<?= base_url() . "insert_donor"; ?>" id="myForm" name="myForm">
|
||||
|
||||
<input type="hidden" name="new_receipt" value="new_receipt"/>
|
||||
<input type="hidden" id="business_id" name="business_id" placeholder="hidden for business id" value="<?php echo get_business_id() ?>" />
|
||||
|
||||
<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>
|
||||
<select class="form-control" id="DonorType" name="DonorType" required>
|
||||
<option value="<?= isset($receipt_details['donor_type']) ? $receipt_details['donor_type'] : '' ?>"><?= isset($receipt_details['donor_type']) ? ($receipt_details['donor_type'] === 'option1' ? 'Individual' : ($receipt_details['donor_type'] === 'option2' ? 'Organization' : 'Select Donor Type')) : 'Select Donor Type'; ?></option>
|
||||
<option value="option1">Individual</option>
|
||||
<option value="option2">Organization</option>
|
||||
</select>
|
||||
<div class="invalid-feedback">Please provide.</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-row">
|
||||
<div class="form-group col-md-12">
|
||||
<label for="cfname" class="col-form-label"><span class="contactPerson">Contact Person </span>First Name<span class="text-danger"> *</span></label>
|
||||
<input type="text" class="form-control" id="cfname" name="cfname" value="<?= isset($receipt_details['first_name']) ? $receipt_details['first_name'] : '' ?>" placeholder="First Name" required />
|
||||
<div class="invalid-feedback"> Please provide. </div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-row">
|
||||
<div class="form-group col-md-12">
|
||||
<label for="csname" class="col-form-label"><span class="contactPerson">Contact Person </span>Last Name<span class="text-danger"> *</span></label>
|
||||
<input type="text" class="form-control" name="csname" value="<?= isset($receipt_details['last_name']) ? $receipt_details['last_name'] : '' ?>" placeholder="Last Name" required />
|
||||
<div class="invalid-feedback"> Please provide. </div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-row">
|
||||
<div class="form-group col-md-12">
|
||||
<label for="cfname" class="col-form-label"><span class="contactPerson">Contact Person </span>Email<span class="text-danger"> *</span></label>
|
||||
<input type="text" class="form-control" id="cmail" name="cmail" value="<?= isset($receipt_details['email']) ? $receipt_details['email'] : '' ?>" placeholder="Email" required />
|
||||
<div class="invalid-feedback"> Please provide. </div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-row">
|
||||
<div class="form-group col-md-12">
|
||||
<label for="csname" class="col-form-label"><span class="contactPerson">Organization </span>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" required/>
|
||||
<div class="invalid-feedback"> Please provide. </div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-row">
|
||||
<label for="cmobile" class="col-form-label"><span class="contactPerson">Contact Person </span>Mobile<span class="text-danger"> *</span></label>
|
||||
<div class="input-group mb-2">
|
||||
<div class="input-group-prepend">
|
||||
<div class="input-group-text">+91</div>
|
||||
</div>
|
||||
<input type="text" class="form-control" name="cmobile" value="<?= isset($receipt_details['mobile_no']) ? $receipt_details['mobile_no'] : '' ?>" placeholder="Mobile Number (Enter only numbers)" required maxlength="10" onkeypress="return restriction(event)" />
|
||||
<div class="invalid-feedback"> Please provide. </div>
|
||||
</div>
|
||||
</div>
|
||||
<button class="btn btn-success waves-effect waves-light mr-1" id="submitBtn" type="submit" hidden></button>
|
||||
</form>
|
||||
</div>
|
||||
<div class="modal-footer">
|
||||
<button type="button" class="btn btn-light" data-dismiss="modal">Close</button>
|
||||
<button type="button" id="form-submit" class="btn btn-primary">Save changes</button>
|
||||
</div>
|
||||
</div><!-- /.modal-content -->
|
||||
</div><!-- /.modal-dialog -->
|
||||
</div><!-- /.modal -->
|
||||
|
||||
<!-- Info Alert Modal -->
|
||||
<div id="info-alert-modal" class="modal fade" tabindex="-1" role="dialog" aria-hidden="true">
|
||||
<div class="modal-dialog modal-sm">
|
||||
<div class="modal-content">
|
||||
<div class="modal-body p-4">
|
||||
<div class="text-center">
|
||||
<form class="needs-validation" novalidate method="POST" enctype="multipart/form-data" action="<?= base_url() . "donor_cash_delete"; ?>" id="myForm1" name="myForm">
|
||||
|
||||
<input type="hidden" id="id" name="id" value="<?= isset($receipt_details['receipt_id']) ? $receipt_details['receipt_id'] : '' ?>">
|
||||
<h4 class="mt-2">DELETE!</h4>
|
||||
<p class="mt-3">Are you sure you want to delete please continue with reason</p>
|
||||
|
||||
<div class="form-group">
|
||||
<input class="form-control" type="text" id="reason" name="reason" required="" placeholder="Reason">
|
||||
</div>
|
||||
|
||||
<button type="submit" class="btn btn-danger my-2" >Continue</button>
|
||||
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
</div><!-- /.modal-content -->
|
||||
</div><!-- /.modal-dialog -->
|
||||
</div><!-- /.modal -->
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@ -34,6 +34,7 @@
|
||||
<th align="center" >Receipt Date</th>
|
||||
<th align="center" >Donor Name</th>
|
||||
<th align="center" >Amount</th>
|
||||
<th align="center" >Status/Reason</th>
|
||||
<th align="center">Action</th>
|
||||
</tr>
|
||||
</thead>
|
||||
@ -50,9 +51,12 @@
|
||||
<?php endforeach; ?>
|
||||
</td>
|
||||
<td><?= $row['amount']; ?></td>
|
||||
<td><?= $row['receipt_header']; ?> / <?php echo ($row['reason'] == null) ? '-' : $row['reason']; ?></td>
|
||||
<td>
|
||||
<a href="<?= base_url() . "new_receipt/" . $row['receipt_id']; ?>" class="edit-button" title="Edit the Invoice"><i class="ri-pencil-line" title="Edit the Invoice"></i></a>
|
||||
<a href="<?= base_url("generate_invoice_pdf/{$row['receipt_id']}") ?>" class="download-pdf-button" title="Download the Invoice"><i class="ri-file-download-line"></i></a>
|
||||
<?php if(get_user_role() != 'auditor') { ?>
|
||||
<a href="<?= base_url("generate_invoice_pdf/{$row['receipt_id']}") ?>" class="download-pdf-button" title="Download the Invoice"><i class="ri-file-download-line"></i></a>
|
||||
<?php } ?>
|
||||
</td>
|
||||
</tr>
|
||||
<?php endforeach; ?>
|
||||
|
||||
@ -225,7 +225,7 @@ body{
|
||||
<div class="header">
|
||||
<div class="logo_invoice_wrap">
|
||||
<div class="logo_sec">
|
||||
<img class="images" src="<?= base_url()."public/uploads/".$data->business_logo ?>" height="50" width="50" >
|
||||
<img class="images" src="<?= $baseurl ?>" height="50" width="50" >
|
||||
<div class="title_wrap">
|
||||
<p class="title bold"><?= $data->title ?></p>
|
||||
<p class="sub_title">Email : <?= $data->org_email ?></p>
|
||||
@ -242,7 +242,7 @@ body{
|
||||
|
||||
<p class="bold name"><?=$data->customer_name?></p>
|
||||
<span>
|
||||
Monile No : <?=$data->customer_mobile?><br>
|
||||
Mobile No : <?=$data->customer_mobile?><br>
|
||||
PAN No : <?=$data->cust_pan_no?><br>
|
||||
Address :<?=$data->address?><br>
|
||||
</span>
|
||||
@ -258,6 +258,10 @@ body{
|
||||
<span class="bold">Date :</span>
|
||||
<span><?=date("d-m-Y", strtotime($data->receipt_date));?></span>
|
||||
</p>
|
||||
<p class="date">
|
||||
<span class="bold">Recipt Type :</span>
|
||||
<span><?=$data->receipt_header?></span>
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@ -270,7 +274,7 @@ body{
|
||||
</div>
|
||||
<div class="total_wrap">
|
||||
<p>Donated Amount</p>
|
||||
<p class="bold price">Rs. <?=$data->amount?> /-</p>
|
||||
<p class="bold price"><?= $currency ?>. <?=$data->amount?> /-</p>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@ -286,10 +290,10 @@ body{
|
||||
</div>
|
||||
</div>
|
||||
<div class="footer" style="position: relative;bottom: 60px;">
|
||||
<p>Thank you and Best Wishes</p>
|
||||
<p>Received with thanks from <?= $data->customer_name ?> , PAN <?= $data->cust_pan_no ?>, a sum of <?= $data->amount ?> , towards <?= $data->cause_name ?>.</p>
|
||||
<p class="bold">Receipt Note:</p>
|
||||
<div class="terms">
|
||||
<p>Lorem ipsum dolor sit amet consectetur adipisicing elit. Velit non praesentium doloribus. Quaerat vero iure itaque odio numquam, debitis illo quasi consequuntur velit, explicabo esse nesciunt error aliquid quis eius!</p>
|
||||
<p><?= $data->notes ?></p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@ -193,6 +193,26 @@
|
||||
</div><!-- end col -->
|
||||
</div><!-- end row -->
|
||||
|
||||
<script>
|
||||
$(function() {
|
||||
role = "<?php echo get_user_role() ?>";
|
||||
console.log(role);
|
||||
if(role == "auditor")
|
||||
{
|
||||
// for input
|
||||
var formElements = document.querySelectorAll('input, textarea');
|
||||
formElements.forEach(function(element) {
|
||||
element.setAttribute('readonly', true);
|
||||
});
|
||||
// for select
|
||||
var formElements = document.querySelectorAll('select, button');
|
||||
formElements.forEach(function(element) {
|
||||
element.setAttribute('disabled', true);
|
||||
});
|
||||
}
|
||||
});
|
||||
</script>
|
||||
|
||||
<script>
|
||||
const textDiv = document.getElementById('textDiv');
|
||||
|
||||
|
||||
@ -250,7 +250,8 @@
|
||||
<div class="form-group text-right m-b-0">
|
||||
<button type="submit" class="btn btn-success waves-effect waves-light mr-1" id="submitBtn">Submit</button>
|
||||
<button type="reset" class="btn btn-primary waves-effect mr-1">Reset</button>
|
||||
<button type="button" class="btn btn-secondary waves-effect">Cancel</button>
|
||||
<!-- <button type="button" class="btn btn-secondary waves-effect">Cancel</button> -->
|
||||
<button type="button" class="btn btn-secondary waves-effect" onclick="history.back()">Cancel</button>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
|
||||
@ -124,7 +124,15 @@
|
||||
<span> Dashboard </span>
|
||||
</a>
|
||||
</li>
|
||||
<?php if ($loggedin_person_role !== 'manager' && $loggedin_person_role !== 'sadmin') : ?>
|
||||
<?php if ($loggedin_person_role !== 'manager' && $loggedin_person_role !== 'sadmin' && $loggedin_person_role !== 'accounts') : ?>
|
||||
<li>
|
||||
<a href="<?= base_url()."audit_history"; ?>">
|
||||
<i class="ri-history-fill"></i>
|
||||
<span> Audit History </span>
|
||||
</a>
|
||||
</li>
|
||||
<?php endif; ?>
|
||||
<?php if ($loggedin_person_role !== 'manager' && $loggedin_person_role !== 'sadmin' && $loggedin_person_role !== 'accounts') : ?>
|
||||
<li>
|
||||
<a href="<?= base_url()."Donor_list"; ?>">
|
||||
<i class="ri-map-pin-user-fill"></i>
|
||||
@ -140,7 +148,15 @@
|
||||
</a>
|
||||
</li>
|
||||
<?php endif; ?>
|
||||
<?php if ($loggedin_person_role !== 'manager' && $loggedin_person_role !== 'sadmin') : ?>
|
||||
<?php if ($loggedin_person_role !== 'manager' && $loggedin_person_role !== 'sadmin' && $loggedin_person_role !== 'accounts') : ?>
|
||||
<li>
|
||||
<a href="<?= base_url()."donations_accepted"; ?>">
|
||||
<i class="ri-book-open-line"></i>
|
||||
<span> Donations Accepted </span>
|
||||
</a>
|
||||
</li>
|
||||
<?php endif; ?>
|
||||
<?php if ($loggedin_person_role !== 'manager' && $loggedin_person_role !== 'sadmin' && $loggedin_person_role !== 'accounts') : ?>
|
||||
<li>
|
||||
<a href="<?= base_url()."causes_list"; ?>">
|
||||
<i class="ri-book-open-line"></i>
|
||||
@ -148,7 +164,7 @@
|
||||
</a>
|
||||
</li>
|
||||
<?php endif; ?>
|
||||
<?php if ($loggedin_person_role === 'sadmin') : ?>
|
||||
<?php if ($loggedin_person_role === 'sadmin' && $loggedin_person_role !== 'accounts') : ?>
|
||||
<li>
|
||||
<a href="<?= base_url()."org_list"; ?>">
|
||||
<i class="ri-map-pin-user-fill"></i>
|
||||
@ -156,7 +172,7 @@
|
||||
</a>
|
||||
</li>
|
||||
<?php endif; ?>
|
||||
<?php if ($loggedin_person_role !== 'manager') : ?>
|
||||
<?php if ($loggedin_person_role !== 'manager' && $loggedin_person_role !== 'accounts') : ?>
|
||||
<li>
|
||||
<a href="<?= base_url()."user_list"; ?>">
|
||||
<i class="ri-user-line"></i>
|
||||
@ -164,7 +180,7 @@
|
||||
</a>
|
||||
</li>
|
||||
<?php endif; ?>
|
||||
<?php if ($loggedin_person_role === 'sadmin') : ?>
|
||||
<?php if ($loggedin_person_role === 'sadmin' && $loggedin_person_role !== 'accounts') : ?>
|
||||
<li>
|
||||
<a href="<?= base_url()."sitesetting_list"; ?>">
|
||||
<i class="ri-list-settings-line"></i>
|
||||
@ -172,7 +188,7 @@
|
||||
</a>
|
||||
</li>
|
||||
<?php endif; ?>
|
||||
<?php if ($loggedin_person_role === 'sadmin') : ?>
|
||||
<?php if ($loggedin_person_role === 'sadmin' && $loggedin_person_role !== 'accounts') : ?>
|
||||
<li>
|
||||
<a href="<?= base_url()."appsetting_page/1"; ?>">
|
||||
<i class="ri-list-settings-line"></i>
|
||||
@ -180,7 +196,7 @@
|
||||
</a>
|
||||
</li>
|
||||
<?php endif; ?>
|
||||
<?php if ($loggedin_person_role !== 'manager' && $loggedin_person_role !== 'sadmin') : ?>
|
||||
<?php if ($loggedin_person_role !== 'manager' && $loggedin_person_role !== 'sadmin' && $loggedin_person_role !== 'accounts') : ?>
|
||||
<li>
|
||||
<a href="<?= base_url()."campaign_list"; ?>">
|
||||
|
||||
@ -189,7 +205,7 @@
|
||||
</a>
|
||||
</li>
|
||||
<?php endif; ?>
|
||||
<?php if ($loggedin_person_role !== 'manager') : ?>
|
||||
<?php if ($loggedin_person_role !== 'manager' && $loggedin_person_role !== 'accounts') : ?>
|
||||
<!-- <li>
|
||||
<a href="<?= base_url()."invoice_number_format/1"; ?>">
|
||||
<i class="fe-check-square"></i>
|
||||
@ -197,7 +213,7 @@
|
||||
</a>
|
||||
</li> -->
|
||||
<?php endif; ?>
|
||||
<?php if ($loggedin_person_role !== 'manager' && $loggedin_person_role !== 'sadmin') : ?>
|
||||
<?php if ($loggedin_person_role !== 'manager' && $loggedin_person_role !== 'sadmin' && $loggedin_person_role !== 'accounts') : ?>
|
||||
<li>
|
||||
<a href="<?= base_url()."donor_group"; ?>">
|
||||
<i class="ri-team-line"></i>
|
||||
@ -206,7 +222,7 @@
|
||||
</li>
|
||||
<?php endif; ?>
|
||||
|
||||
<?php if ($loggedin_person_role !== 'manager' && $loggedin_person_role !== 'sadmin') : ?>
|
||||
<?php if ($loggedin_person_role !== 'manager' && $loggedin_person_role !== 'sadmin' && $loggedin_person_role !== 'accounts') : ?>
|
||||
<!-- <li>
|
||||
<a href="#reportLayouts" data-toggle="collapse">
|
||||
<i class="ri-file-chart-fill"></i>
|
||||
@ -229,7 +245,7 @@
|
||||
</li> -->
|
||||
<?php endif; ?>
|
||||
|
||||
<?php if ($loggedin_person_role !== 'manager' && $loggedin_person_role !== 'sadmin') : ?>
|
||||
<?php if ($loggedin_person_role !== 'manager' && $loggedin_person_role !== 'sadmin' && $loggedin_person_role !== 'accounts') : ?>
|
||||
<li>
|
||||
<a href="#notificationsLayouts" data-toggle="collapse">
|
||||
<i class="ri-notification-3-line"></i>
|
||||
|
||||
@ -55,7 +55,9 @@
|
||||
<td><span class="<?php echo $class; ?>"><?php echo $message; ?></span></td>
|
||||
<td>
|
||||
<a href="<?= base_url()."template_creation_form/".$temp['template_id']; ?>" class="edit-button" title="Click to Edit Template" ><i class="ri-pencil-line"></i></a>
|
||||
<?php if ($temp['isactive']) { ?> <a href="<?php echo "template_creation_delete/".$temp['template_id']; ?>" class="delete-button" title="Click to Delete Template" ><i class="ri-delete-bin-line"></i></a> <?php } ?>
|
||||
<?php if(get_user_role() != 'auditor') { ?>
|
||||
<?php if ($temp['isactive']) { ?> <a href="<?php echo "template_creation_delete/".$temp['template_id']; ?>" class="delete-button" title="Click to Delete Template" ><i class="ri-delete-bin-line"></i></a> <?php } ?>
|
||||
<?php } ?>
|
||||
</td>
|
||||
</tr>
|
||||
<?php endforeach; ?>
|
||||
|
||||
@ -86,6 +86,25 @@
|
||||
</div> <!-- end card-->
|
||||
</div> <!-- end col-->
|
||||
</div><!-- end row -->
|
||||
<script>
|
||||
$(function() {
|
||||
role = "<?php echo get_user_role() ?>";
|
||||
console.log(role);
|
||||
if(role == "auditor")
|
||||
{
|
||||
// for input
|
||||
var formElements = document.querySelectorAll('#myForm input, #myForm textarea');
|
||||
formElements.forEach(function(element) {
|
||||
element.setAttribute('readonly', true);
|
||||
});
|
||||
// for select
|
||||
var formElements = document.querySelectorAll('#myForm select, #myForm button');
|
||||
formElements.forEach(function(element) {
|
||||
element.setAttribute('disabled', true);
|
||||
});
|
||||
}
|
||||
});
|
||||
</script>
|
||||
<script>
|
||||
$(document).ready(function() {
|
||||
// Listen for changes in the radio buttons
|
||||
|
||||
@ -87,6 +87,8 @@
|
||||
<option value="">Select Role</option>
|
||||
<option value="admin" <?= isset($details['role']) && $details['role'] === 'admin' ? 'selected' : '' ?>>Admin</option>
|
||||
<option value="manager" <?= isset($details['role']) && $details['role'] === 'manager' ? 'selected' : '' ?>>Manager</option>
|
||||
<option value="accounts" <?= isset($details['role']) && $details['role'] === 'accounts' ? 'selected' : '' ?>>Accounts Staff</option>
|
||||
<option value="auditor" <?= isset($details['role']) && $details['role'] === 'auditor' ? 'selected' : '' ?>>Auditor</option>
|
||||
</select>
|
||||
</div>
|
||||
<div class="form-group col-md-4">
|
||||
@ -190,6 +192,27 @@
|
||||
</div> <!-- end card-->
|
||||
</div> <!-- end col-->
|
||||
</div><!-- end row -->
|
||||
|
||||
<script>
|
||||
$(function() {
|
||||
role = "<?php echo get_user_role() ?>";
|
||||
console.log(role);
|
||||
if(role == "auditor")
|
||||
{
|
||||
// for input
|
||||
var formElements = document.querySelectorAll('#myForm input, #myForm textarea');
|
||||
formElements.forEach(function(element) {
|
||||
element.setAttribute('readonly', true);
|
||||
});
|
||||
// for select
|
||||
var formElements = document.querySelectorAll('#myForm select, #myForm button');
|
||||
formElements.forEach(function(element) {
|
||||
element.setAttribute('disabled', true);
|
||||
});
|
||||
}
|
||||
});
|
||||
</script>
|
||||
|
||||
<script>
|
||||
// Get the current date in "yyyy-mm-dd" format
|
||||
function getCurrentDate() {
|
||||
|
||||
@ -77,11 +77,13 @@
|
||||
</td>
|
||||
<td>
|
||||
<a href="<?= $edit_page_route; ?>" class="edit-button" title="Click to Edit User" ><i class="ri-pencil-line"></i></a>
|
||||
<?php if($row['isactive'] === 1) { ?>
|
||||
<?php if(get_user_role() != 'auditor') {
|
||||
if($row['isactive'] == 1) { ?>
|
||||
<a href="<?php echo "delete_user/".$row['user_id']; ?>" class="delete-button" title="Click to In-Active User" ><i class="ri-delete-bin-line"></i></a>
|
||||
<?php } else {?>
|
||||
<a href="<?php echo "activateUser/".$row['user_id']; ?>" class="delete-button" title="Click to Active User" ><i class="ri-delete-bin-line"></i></a>
|
||||
<?php } ?>
|
||||
<a href="<?php echo "activateUser/".$row['user_id']; ?>" class="fe-user-check" title="Click to Active User" ></a>
|
||||
<?php }
|
||||
}?>
|
||||
</td>
|
||||
</tr>
|
||||
<?php endforeach; ?>
|
||||
|
||||
Binary file not shown.
|
Before Width: | Height: | Size: 11 KiB |
Loading…
Reference in New Issue
Block a user