diff --git a/app/Controllers/Business.php b/app/Controllers/Business.php index 07ec03e..ba3c10c 100644 --- a/app/Controllers/Business.php +++ b/app/Controllers/Business.php @@ -69,6 +69,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); } @@ -129,6 +131,8 @@ class Business extends BaseController ## Business Data $BusinessModel = new BusinessModel(); + print_r( $this->request->getPost('currency')); + $data = [ 'title' => $this->request->getPost('bname'), 'email' => $this->request->getPost('bmail'), @@ -149,13 +153,12 @@ class Business extends BaseController 'admin_email' => $this->request->getPost('admin_email'), 'site_mobile'=> $this->request->getPost('site_mobile'), 'copyright'=> $this->request->getPost('copyright'), - 'currency'=> $this->request->getPost('currency'), + '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; } @@ -167,7 +170,7 @@ class Business extends BaseController } $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; @@ -305,4 +308,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; + } } diff --git a/app/Controllers/Customer.php b/app/Controllers/Customer.php index c9d54f0..718e407 100644 --- a/app/Controllers/Customer.php +++ b/app/Controllers/Customer.php @@ -658,41 +658,45 @@ class Customer extends BaseController $spreadsheet = $reader->load($path.$fileNewName); $sheet_data = $spreadsheet->getActiveSheet()->toArray(); if (!empty($sheet_data)) { - $flag = 0; $final_notes = []; $list = []; foreach ($sheet_data as $key => $val) { if ($key != 0 && trim($val[0]) && trim($val[1])) { // key zero - header - $flag = 0; + // $flag = 0; + $is_duplicate = false; $notes = []; - if ($val[4]) { - $validate = $this->check_existing($val[4], 'donor', 'mobile_no'); - if ($validate) { $notes[] = $validate; $flag++;} + $invalid_fields = []; + if($val[6] != ""){ + if ($this->check_existing($val[6], 'donor', 'pan_no')) { + $is_duplicate = true; + $invalid_fields[] = "PAN number"; + } } - if ($val[5]) { - $validate = $this->check_existing($val[5], 'donor', 'email'); - if ($validate) { $notes[] = $validate; $flag++;} + if($val[7] != ""){ + if ($this->check_existing($val[7], 'donor', 'adhar_no')) { + $is_duplicate = true; + $invalid_fields[] = "Aadhar number"; + } } - if ($val[6]) { - $validate = $this->check_existing($val[6], 'donor', 'pan_no'); - if ($validate) { $notes[] = $validate; $flag++;} + if($val[8] != ""){ + if ($this->check_existing($val[8], 'donor', 'passport_no')) { + $is_duplicate = true; + $invalid_fields[] = "passport number"; + } } - if ($val[7]) { - $validate = $this->check_existing($val[7], 'donor', 'adhar_no'); - if ($validate) { $notes[] = $validate; $flag++;} - } - if ($val[8]) { - $validate = $this->check_existing($val[8], 'donor', 'passport_no'); - if ($validate) { $notes[] = $validate; $flag++;} - } - if ($flag > 0) { - $final_notes[] = $val[0] . ' has duplicate entries: ' . implode(',', $notes); - } else { + 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' => ucfirst(strtolower($val[1])), + '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, @@ -718,13 +722,16 @@ class Customer extends BaseController $CustomerModel = new CustomerModel(); $result = $CustomerModel->bulkInsert($list); $response = $result ? [ - 'success_message' => count($list) . " Contributors imported successfully. " . implode("\n", $final_notes) + 'success_message' => count($list) . " Contributors imported successfully.".(count($final_notes) > 0 ? count($final_notes) . " duplicate entries found.
" : ""), ] : ['error_message' => "Something went wrong. Please try again."]; + $response['message_in_details'] = implode("
", $final_notes); } else { - $response = ['error_message' => "No new record is found." . implode("\n", $final_notes)]; - } + $response = [ + 'error_message' => "No new record is found.", + 'message_in_details' => implode("
", $final_notes), + ]; } } else { - $response = ['error_message' => "There is no record to import"]; + $response = ['error_message' => "There is no record to import", 'message_in_details' => '']; } return $this->response->setJSON($response); } diff --git a/app/Controllers/Invoice.php b/app/Controllers/Invoice.php index 9f6ce6a..33f0cb7 100644 --- a/app/Controllers/Invoice.php +++ b/app/Controllers/Invoice.php @@ -148,6 +148,8 @@ 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); @@ -174,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; +// print_r($data);die; $this->render_page('invoice_form', $data); } @@ -526,14 +528,15 @@ class Invoice extends BaseController } $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); @@ -542,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
"; - $baseurl = base_url()."public/uploads/".$data[0]->business_logo; - } else { - // echo "Inside: Logo does not exist
"; 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', [ @@ -566,11 +564,13 @@ class Invoice extends BaseController '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') { diff --git a/app/Models/BusinessModel.php b/app/Models/BusinessModel.php index 7a40ce4..f140422 100644 --- a/app/Models/BusinessModel.php +++ b/app/Models/BusinessModel.php @@ -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','12AA','80G_vaildupto','12AA_vaildupto']; + 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) { diff --git a/app/Views/auth_confirm_mail.php b/app/Views/auth_confirm_mail.php index 69be357..70666a0 100644 --- a/app/Views/auth_confirm_mail.php +++ b/app/Views/auth_confirm_mail.php @@ -42,7 +42,7 @@ diff --git a/app/Views/auth_lock_screen.php b/app/Views/auth_lock_screen.php index 08ecefa..c1905aa 100644 --- a/app/Views/auth_lock_screen.php +++ b/app/Views/auth_lock_screen.php @@ -40,7 +40,7 @@ diff --git a/app/Views/auth_login.php b/app/Views/auth_login.php index db6830b..a8b07d9 100644 --- a/app/Views/auth_login.php +++ b/app/Views/auth_login.php @@ -43,7 +43,7 @@ diff --git a/app/Views/auth_logout.php b/app/Views/auth_logout.php index ff52303..2c13e07 100644 --- a/app/Views/auth_logout.php +++ b/app/Views/auth_logout.php @@ -41,7 +41,7 @@ diff --git a/app/Views/business_form.php b/app/Views/business_form.php index 1dbc4d4..c559221 100644 --- a/app/Views/business_form.php +++ b/app/Views/business_form.php @@ -115,21 +115,34 @@
-
+
Please provide.
-
+
Please provide.
-
+
Please provide.
+
+ + +
@@ -186,17 +199,25 @@
- - + + +
Please provide.
-
- - -
@@ -292,7 +313,7 @@
- Image dimensions should be between 140x45 pixels and 150x50 pixels. (formats: .png, .jpg, .jpeg) + Image dimensions should be between 140x45 pixels and 300x100 pixels. (formats: .png, .jpg, .jpeg)

@@ -305,7 +326,7 @@
- Image dimensions should be 216x216 pixels.(formats: .png, .jpg, .jpeg) + Image dimensions should be 256x256 pixels.(formats: .png, .jpg, .jpeg)

@@ -323,7 +344,7 @@
- Image dimensions should be 50x50 pixels. (formats: .png, .jpg, .jpeg) + Image dimensions should be 150x30 pixels. (formats: .png, .jpg, .jpeg)

@@ -505,8 +526,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 = ''; @@ -535,14 +556,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.'; } }; diff --git a/app/Views/customer_form.php b/app/Views/customer_form.php index 469344b..9dd9368 100644 --- a/app/Views/customer_form.php +++ b/app/Views/customer_form.php @@ -83,7 +83,6 @@ -
@@ -173,31 +172,13 @@ function checkValidityAndSetRequired() { var type = document.getElementById('DonorType').value; var panInput = document.getElementById('pan_no'); - var passportInput = document.getElementById('passport_no'); - var errorMessage = document.getElementById('errorMessage'); - var passportValidationMessage = document.getElementById('passportValidationMessage'); // Clear previous error messages - errorMessage.textContent = ""; - passportValidationMessage.textContent = ""; - if (type === 'organization') { panInput.setAttribute('required', 'required'); - passportInput.removeAttribute('required'); } else if (type === 'individual') { - if (panInput.value === "" && passportInput.value === "") { - panInput.setAttribute('required', 'required'); - passportInput.setAttribute('required', 'required'); - errorMessage.textContent = "Either PAN or Passport is required."; - passportValidationMessage.textContent = "Either PAN or Passport is required."; - } else { - panInput.removeAttribute('required'); - passportInput.removeAttribute('required'); - } - } else { panInput.removeAttribute('required'); - passportInput.removeAttribute('required'); - } + } } document.getElementById('myForm').addEventListener('submit', function(event) { @@ -235,10 +216,6 @@ event.preventDefault(); // Prevent form submission if Aadhaar is not valid return; } - if (panValue === '' && passportValue === '') { - event.preventDefault(); // Prevent form submission if both PAN and Passport are empty - return; - } if (panValue !== '' && !validatePANNumber(panValue)) { event.preventDefault(); // Prevent form submission if PAN is not valid return; diff --git a/app/Views/customer_list.php b/app/Views/customer_list.php index 8481693..1c7594e 100644 --- a/app/Views/customer_list.php +++ b/app/Views/customer_list.php @@ -241,6 +241,7 @@ $(document).on('click', '.view-receipts', function(e) {
+
- - - - -
+
+
-
@@ -306,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'); diff --git a/app/Views/invoice_list.php b/app/Views/invoice_list.php index 99ef082..a23dbdb 100644 --- a/app/Views/invoice_list.php +++ b/app/Views/invoice_list.php @@ -82,31 +82,9 @@ } } ?> - - - - + + + diff --git a/app/Views/invoice_pdf_template.php b/app/Views/invoice_pdf_template.php index 20e973a..dc803fa 100644 --- a/app/Views/invoice_pdf_template.php +++ b/app/Views/invoice_pdf_template.php @@ -83,7 +83,7 @@

title ?>

org_address ?> org_city ? ",".$data->org_city :""; ?> org_state ? ",".$data->org_state :""; ?> org_zip ? ",".$data->org_zip.".":""; ?>
- org_mobile ? "Mobile No: ".$data->org_mobile.", ":""; ?> org_email ? "Email: ".$data->org_email.", ":""; ?>
+ org_mobile ? "Mobile No: ".$data->org_mobile.", ":""; ?> org_email ? "Email: ".$data->org_email.",
":""; ?> org_pan ? "PAN No: ".$data->org_pan.", ":""; ?> org_reg_no ? "Register No: ".$data->org_reg_no:""; ?>

@@ -97,7 +97,7 @@ Date:  receipt_date));?> -

Received with thanks from customer_name . ($data->cust_org_name ? ' (' . $data->cust_org_name . ')' : '') ?>cust_pan_no) { echo ', PAN '.$data->cust_pan_no.''; } ?>, a sum of (.amount ?>), towards cause_name ?>. +

Received with thanks from customer_name . ($data->cust_org_name ? ' (' . $data->cust_org_name . ')' : '') ?>cust_pan_no) { echo ', PAN '.$data->cust_pan_no.''; } ?>,
a sum of (.amount ?>),
towards cause_name ?>. Collected by:  @@ -119,10 +119,12 @@ Valid Upto:   + Note:  +

diff --git a/app/Views/template/header.php b/app/Views/template/header.php index bd3276b..a23eec4 100644 --- a/app/Views/template/header.php +++ b/app/Views/template/header.php @@ -66,10 +66,10 @@